Skip to content

KVM: arm64: Support FEAT_LS64_ACCDATA in guests

Fuad Tabba kvm kvmarm linux-arm-kernel lkml 1 version Applied

Status from this message: Applied to fixes, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest5 patches 11 repliesApplied

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5arm64: Add override for ID_AA64ISAR1_EL1.LS64Documentation/admin-guide/kernel-parameters.txt arch/arm64/kernel/pi/idreg-override.c+5 -02 replies
2/5KVM: arm64: Add ACCDATA_EL1 to the sysreg arrayarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/sys_regs.c+14 -11 reply
3/5KVM: arm64: Add context-switch of ACCDATA_EL1arch/arm64/kernel/cpufeature.c arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h arch/arm64/tools/cpucaps+31 -06 replies
4/5KVM: arm64: Enable ST64BV0 for guests with FEAT_LS64_ACCDATAarch/arm64/include/asm/kvm_emulate.h+3 -01 reply
5/5KVM: arm64: selftests: Add ACCDATA_EL1 to get-reg-listtools/testing/selftests/kvm/arm64/get-reg-list.c+2 -00 replies

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchCatalin MarinasYuan Yao
1/5A-b
2/5R-b
3/5A-b R-b
4/5R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/5] KVM: arm64: Support FEAT_LS64_ACCDATA in guests

Hi folks,

Changes since v1 [1]:
- Support FEAT_LS64_ACCDATA in guests instead of capping ID_AA64ISAR1_EL1.LS64 at LS64_V. A saved VM keeps its level, so restore no longer has to accept older kernels' levels, and v1's set_id_regs patch goes. (Marc)
- Add an arm64.nols64 option. (Marc)
- Retitled the series to match.

On a host with FEAT_LS64_ACCDATA, KVM advertises ST64BV0 and ACCDATA_EL1 to guests but doesn't support either. A guest's ST64BV0 hits the WARN in handle_other(), and every guest on a CPU shares ACCDATA_EL1.

Patches 2 and 3 are Marc's from 2024 [2], rebased. I changed patch 3 to switch ACCDATA_EL1 for guests only, and only when the new ARM64_HAS_LS64_ACCDATA capability is set, for the reasons in its note. Patch 4 sets HCRX_EL2.EnAS0. Patch 1 adds arm64.nols64 to disable LS64 on a host whose firmware leaves SCR_EL3.ADEn clear. It comes first so that the option exists in every commit that switches ACCDATA_EL1. All five carry Cc: stable. The get-reg-list patch carries it because the test fails on a host with the feature once patch 2 is in.

Tested on the FVP with arm_v8_7_accelerator_support_level at 3 (LS64_ACCDATA) in VHE, nVHE and protected mode, and at 4 (LS64WB) in VHE, with cpuidle.off=1 so that idle doesn't reset ACCDATA_EL1 between VMs. In my reproducer, one VM writes ACCDATA_EL1 and the next VM on the same CPU reads it. Unpatched, it reads the first VM's value and ST64BV0 hits the WARN. Patched, the second VM reads 0 and ST64BV0 doesn't trap.

Based on Linux 7.3-rc3 (fd73f4a665989).

Cheers,
/fuad

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (3):
arm64: Add override for ID_AA64ISAR1_EL1.LS64
KVM: arm64: Enable ST64BV0 for guests with FEAT_LS64_ACCDATA
KVM: arm64: selftests: Add ACCDATA_EL1 to get-reg-list

Marc Zyngier (2):
KVM: arm64: Add ACCDATA_EL1 to the sysreg array
KVM: arm64: Add context-switch of ACCDATA_EL1

 .../admin-guide/kernel-parameters.txt         |  3 +++
 arch/arm64/include/asm/kvm_emulate.h          |  3 +++
 arch/arm64/include/asm/kvm_host.h             |  3 +++
 arch/arm64/kernel/cpufeature.c                |  7 ++++++
 arch/arm64/kernel/pi/idreg-override.c         |  2 ++
 arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h    | 23 +++++++++++++++++++
 arch/arm64/kvm/sys_regs.c                     | 12 +++++++++-
 arch/arm64/tools/cpucaps                      |  1 +
 .../selftests/kvm/arm64/get-reg-list.c        |  2 ++
 9 files changed, 55 insertions(+), 1 deletion(-)

base-commit: fd73f4a6659897191fa0d40695fe370925dd3780

Signature · 1 line
2.47.3