[PATCH v4 0/7] KVM: arm64: Hide unsupported MPAM from the guest
Joey Gouly
joey.gouly at arm.com
Fri Oct 4 04:07:07 PDT 2024
Hi,
I have taken over these patches from James, as he doesn't have the time to push
them forward currently.
James wrote:
This series fixes up a long standing bug where MPAM was accidentally exposed
to a guest, but the feature was not otherwise trapped or context switched.
This could result in KVM warning about unexpected traps, and injecting an
undef into the guest contradicting the ID registers.
This would prevent an MPAM aware kernel from booting - fortunately, there
aren't any of those.
Ideally, we'd take the MPAM feature away from the ID registers, but that
would leave existing guests unable to migrate to a newer kernel. Instead,
just ignore that field when it matches the hardware. KVM wasn't going to
expose MPAM anyway. The guest will not see MPAM in the id registers.
This series includes the head.S and KVM changes to enable/disable traps. If
MPAM is neither enabled nor emulated by EL3 firmware, these system register
accesses will trap to EL3.
If your kernel doesn't boot, and the problem bisects here - please update
your firmware. MPAM has been supported by trusted firmware since v1.6 in
2018. (also noted on patch 3).
changes since v3 [1]:
- Converted to the new generated sysreg file
- Added MPAM_frac support
- Changed the Kconfig to hopefully make it obvious that it doesn't
actually enable MPAM for users
- rebased onto v6.12-rc1
Thanks,
Joey
[1] https://lore.kernel.org/kvmarm/20240321165728.31907-1-james.morse@arm.com/
James Morse (7):
arm64: head.S: Initialise MPAM EL2 registers and disable traps
arm64/sysreg: Convert existing MPAM sysregs and add the remaining
entries
arm64: cpufeature: discover CPU support for MPAM
KVM: arm64: Fix missing traps of guest accesses to the MPAM registers
KVM: arm64: Add a macro for creating filtered sys_reg_descs entries
KVM: arm64: Disable MPAM visibility by default and ignore VMM writes
KVM: arm64: selftests: Test ID_AA64PFR0.MPAM isn't completely ignored
.../arch/arm64/cpu-feature-registers.rst | 2 +
arch/arm64/Kconfig | 20 +++
arch/arm64/include/asm/cpu.h | 1 +
arch/arm64/include/asm/cpucaps.h | 2 +
arch/arm64/include/asm/cpufeature.h | 12 ++
arch/arm64/include/asm/el2_setup.h | 16 ++
arch/arm64/include/asm/kvm_arm.h | 1 +
arch/arm64/include/asm/mpam.h | 32 ++++
arch/arm64/include/asm/sysreg.h | 12 --
arch/arm64/kernel/Makefile | 2 +
arch/arm64/kernel/cpufeature.c | 97 ++++++++++
arch/arm64/kernel/cpuinfo.c | 4 +
arch/arm64/kernel/image-vars.h | 5 +
arch/arm64/kernel/mpam.c | 8 +
arch/arm64/kvm/hyp/include/hyp/switch.h | 32 ++++
arch/arm64/kvm/sys_regs.c | 114 +++++++++---
arch/arm64/tools/cpucaps | 1 +
arch/arm64/tools/sysreg | 166 ++++++++++++++++++
.../selftests/kvm/aarch64/set_id_regs.c | 100 ++++++++++-
19 files changed, 587 insertions(+), 40 deletions(-)
create mode 100644 arch/arm64/include/asm/mpam.h
create mode 100644 arch/arm64/kernel/mpam.c
--
2.25.1
More information about the linux-arm-kernel
mailing list