KVM: arm64: Stop advertising FEAT_LS64_ACCDATA to guests
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 10 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | KVM: arm64: Hide FEAT_LS64_ACCDATA from guestsarch/ | +24 | 10 replies | |
| 2/2 | KVM: arm64: selftests: Test ID_AA64ISAR1_EL1.LS64 on its owntools/ | +47 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] KVM: arm64: Stop advertising FEAT_LS64_ACCDATA to guests
Hi folks,
On a host with FEAT_LS64_ACCDATA, KVM advertises ST64BV0 and ACCDATA_EL1 to guests but supports neither. The first patch caps ID_AA64ISAR1_EL1.LS64 at LS64_V. A VM saved on an older kernel can carry any level up to the host's, so the patch still accepts those levels from the VMM, capped at LS64_V, and the VM restores. The second patch moves LS64 out of set_id_regs' generic table into a test of its own, since the table's invalid value is now one of those levels. It carries Cc: stable as well, because a stable tree that takes the first patch alone fails the set_id_regs selftest on an LS64_ACCDATA host.
Tested on the FVP AEM with arm_v8_7_accelerator_support_level set to 3 (LS64_ACCDATA) and 4 (LS64WB). Unpatched, on a VHE host, a guest's ST64BV0 hits the WARN in handle_other(). A second VM also reads the ACCDATA_EL1 value the first one wrote, once cpuidle.off=1 stops the FVP's idle states from powering the CPU down. Patched, on VHE, nVHE and protected-mode hosts, ST64BV0 and the ACCDATA_EL1 accesses UNDEF, and set_id_regs passes.
The cap alone would fix the bug, but a VM saved on an older kernel would then fail to restore on a patched kernel. 6685f5d572c2 ("KVM:
arm64: Disable MPAM visibility by default and ignore VMM writes") solved the same problem for MPAM: it hid the field from guests, but kept accepting the value older kernels exposed.
Based on Linux 7.3-rc3 (fd73f4a665989). Patch 2 conflicts with 00e309933879c, now in kvmarm/fixes and kvmarm/next, on the test count. The resolution is:
- test_cnt = 4 + MPAM_IDREG_TEST + MTE_IDREG_TEST; + test_cnt = 4 + MPAM_IDREG_TEST + MTE_IDREG_TEST + LS64_IDREG_TEST;
Cheers,
/fuad
Fuad Tabba (2):
KVM: arm64: Hide FEAT_LS64_ACCDATA from guests
KVM: arm64: selftests: Test ID_AA64ISAR1_EL1.LS64 on its own
arch/arm64/kvm/sys_regs.c | 28 +++++++++-- .../testing/selftests/kvm/arm64/set_id_regs.c | 49 ++++++++++++++++++- 2 files changed, 71 insertions(+), 6 deletions(-)
base-commit: fd73f4a6659897191fa0d40695fe370925dd3780
Signature · 1 line
2.47.3