mbox series

[RFC,v2,0/3] KVM: arm64: Don't claim MTE_ASYNC if not supported

Message ID 20250512114112.359087-1-ben.horgan@arm.com
Headers show
Series KVM: arm64: Don't claim MTE_ASYNC if not supported | expand

Message

Ben Horgan May 12, 2025, 11:41 a.m. UTC
The ID_AA64PFR1_EL1.MTE_frac field is currently hidden from KVM.
However, when ID_AA64PFR1_EL1.MTE==2, ID_AA64PFR1_EL1.MTE_frac==0
indicates that MTE_ASYNC is supported. On a host with
ID_AA64PFR1_EL1.MTE==2 but without MTE_ASYNC support a guest with the
MTE capability enabled will incorrectly see MTE_ASYNC advertised as
supported. This series fixes that.

This was found by inspection and the current behaviour is not known to
break anything. Linux doesn't check MTE_frac, and wrongly, assumes
MTE async faults can be generated whenever MTE is supported. This is
a separate problem and not addressed here.

I am looking for feedback on whether this change is valuable or
otherwise.

Changes since v1:
        Only pass MTE_Frac hw value to the guest when it is the exact failure case.
        Changed base commit to v6.15-rc5 but still applies on v6.16-rc2 as well.

Ben Horgan (3):
  arm64/sysreg: Expose MTE_frac so that it is visible to KVM
  KVM: arm64: Make MTE_frac masking conditional on MTE capability
  KVM: selftests: Confirm exposing MTE_frac does not break migration

 arch/arm64/kernel/cpufeature.c                |  1 +
 arch/arm64/kvm/sys_regs.c                     | 28 ++++++-
 .../testing/selftests/kvm/arm64/set_id_regs.c | 77 ++++++++++++++++++-
 3 files changed, 103 insertions(+), 3 deletions(-)


base-commit: 92a09c47464d040866cf2b4cd052bc60555185fb