Re: [PATCH v9 03/10] arm64/kvm: expose FEAT_MTE_TAGGED_FAR feature to guest
From: Marc Zyngier <maz@kernel.org>
Date: 2025-06-18 16:43:11
Also in:
linux-doc, lkml
In general, please use a patch title format that matches the one used for the subsystem. For KVM, that'd be "KVM: arm64: Expose ..."/ On Wed, 18 Jun 2025 09:45:06 +0100, Yeoreum Yun [off-list ref] wrote:
quoted hunk ↗ jump to hunk
expose FEAT_MTE_TAGGED_FAR feature to guest. Signed-off-by: Yeoreum Yun <redacted> --- arch/arm64/kvm/sys_regs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 76c2f0da821f..c8c92cb9da01 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c@@ -1586,7 +1586,7 @@ static u64 __kvm_read_sanitised_id_reg(const struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) { u32 id = reg_to_encoding(r); - u64 val; + u64 val, mask; if (sysreg_visible_as_raz(vcpu, r)) return 0;@@ -1617,8 +1617,12 @@ static u64 __kvm_read_sanitised_id_reg(const struct kvm_vcpu *vcpu, val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_MPAM_frac); break; case SYS_ID_AA64PFR2_EL1: - /* We only expose FPMR */ - val &= ID_AA64PFR2_EL1_FPMR; + mask = ID_AA64PFR2_EL1_FPMR; + + if (kvm_has_mte(vcpu->kvm)) + mask |= ID_AA64PFR2_EL1_MTEFAR; + + val &= mask;
I don't think there is a need for an extra variable, and you could follow the pattern established in this file by writing this as: val &= (ID_AA64PFR2_EL1_FPMR | (kvm_has_mte(vcpu->kvm) ? ID_AA64PFR2_EL1_MTEFAR : 0)); Not a big deal though. Thanks, M. -- Without deviation from the norm, progress is not possible.