On Thu, Sep 26 2024, Gustavo Romero <gustavo.rom...@linaro.org> wrote:
> Hi Cornelia and Ganapatrao, > > On 9/25/24 14:54, Cornelia Huck wrote: >> On Fri, Sep 20 2024, Ganapatrao Kulkarni >> <gankulka...@os.amperecomputing.com> wrote: >>> + >>> + /* >>> + * Clear MTE bits, if not enabled in KVM mode. >> Maybe add "This matches the MTE bits being masked by KVM in that case."? > > Clearing the MTE bits is also necessary when MTE is supported by the > host (and so KVM can enable the MTE capability - so won't mask the MTE > bits, but the user didn't want MTE enabled in the guest (mte=on no given > or explicitly set to =off), so this comment is not always true? > > How about something like: > > "If MTE is supported by the host but could not be enabled on KVM mode or > MTE should not be enabled on the guest (e.i. mte=off), clear guest's MTE > bits." s/e.i./i.e./ :) Otherwise fine with me. > > I do assume MTE is supported by the host (i.e. MTE bits >= 2 in the host) > because otherwise condition "if (cpu_isar_feature(aa64_mte, cpu)) { ... > }" is not > taken; and at this point cpu->isar->id_aa64pfr1 is set from the host's > bits via > kvm_arm_set_cpu_features_from_host() and kvm_arm_get_host_cpu_features (). > > >>> + */ >>> + if (kvm_enabled() && !cpu->kvm_mte) { >>> + FIELD_DP64(cpu->isar.id_aa64pfr1, ID_AA64PFR1, MTE, 0); >>> + } >>> #endif >>> }