| From: |
| Fuad Tabba <fuad.tabba-AT-linux.dev> |
| To: |
| Marc Zyngier <maz-AT-kernel.org>, Oliver Upton <oupton-AT-kernel.org>, kvmarm-AT-lists.linux.dev, linux-arm-kernel-AT-lists.infradead.org |
| Subject: |
| [PATCH v2 0/5] KVM: arm64: Support FEAT_LS64_ACCDATA in guests |
| Date: |
| Sun, 25 Oct 2026 07:51:33 +0000 |
| Message-ID: |
| <20261025075138.2919734-1-fuad.tabba@linux.dev> |
| Cc: |
| Catalin Marinas <catalin.marinas-AT-arm.com>, Will Deacon <will-AT-kernel.org>, Joey Gouly <joey.gouly-AT-arm.com>, Suzuki K Poulose <suzuki.poulose-AT-arm.com>, Zenghui Yu <yuzenghui-AT-huawei.com>, Steffen Eiden <seiden-AT-linux.ibm.com>, Mark Rutland <mark.rutland-AT-arm.com>, Yicong Yang <yangyicong-AT-hisilicon.com>, Zhou Wang <wangzhou1-AT-hisilicon.com>, Arnd Bergmann <arnd-AT-arndb.de>, Fuad Tabba <tabba-AT-google.com>, kvm-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org |
| Archive-link: |
| Article |
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/20261023070110.1833446-1-fuad...
[2] https://lore.kernel.org/all/20240815125959.2097734-1-maz@...
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
--
2.47.3