linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/7] KVM: arm64: Hide unsupported MPAM from the guest
@ 2024-10-15 13:39 Joey Gouly
  2024-10-15 13:39 ` [PATCH v5 1/7] arm64/sysreg: Convert existing MPAM sysregs and add the remaining entries Joey Gouly
                   ` (7 more replies)
  0 siblings, 8 replies; 25+ messages in thread
From: Joey Gouly @ 2024-10-15 13:39 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm
  Cc: anshuman.khandual, james.morse, joey.gouly, Marc Zyngier,
	Oliver Upton, Suzuki K Poulose, Zenghui Yu, Jing Zhang,
	Shameerali Kolothum Thodi, Catalin Marinas, Will Deacon

Hi,

Thanks Gavin and Marc for the feedback, hopefully incorporated it all here.

changes since v4 [1]:
	- Swap order of patches, to be able to use MPAMIDR_EL1_HAS_HCR_SHIFT from
	  el2_setup.h
	- Remove trap_mpam() and use undef_acccess() directly
	- Stopped using ID_FILTERED() for the 32-bit ID register
	- Fix ID_AA64PFR1_EL1 sanitisation
	- Fix MPAM_EL1 encoding
	- Fix bug that set everything apart from MPAM_frac as writable in
	  ID_AA64PFR1_EL1. Match the current behaviour, so nothing is writable.

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).

Thanks,
Joey

[1] https://lore.kernel.org/linux-arm-kernel/20241004110714.2051604-1-joey.gouly@arm.com/

James Morse (7):
  arm64/sysreg: Convert existing MPAM sysregs and add the remaining
    entries
  arm64: head.S: Initialise MPAM EL2 registers and disable traps
  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                      |   6 +
 arch/arm64/kvm/hyp/include/hyp/switch.h       |  32 ++++
 arch/arm64/kvm/sys_regs.c                     | 105 +++++++++---
 arch/arm64/tools/cpucaps                      |   1 +
 arch/arm64/tools/sysreg                       | 161 ++++++++++++++++++
 .../selftests/kvm/aarch64/set_id_regs.c       | 100 ++++++++++-
 19 files changed, 571 insertions(+), 40 deletions(-)
 create mode 100644 arch/arm64/include/asm/mpam.h
 create mode 100644 arch/arm64/kernel/mpam.c

-- 
2.25.1



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2024-10-22 14:33 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 13:39 [PATCH v5 0/7] KVM: arm64: Hide unsupported MPAM from the guest Joey Gouly
2024-10-15 13:39 ` [PATCH v5 1/7] arm64/sysreg: Convert existing MPAM sysregs and add the remaining entries Joey Gouly
2024-10-16 23:41   ` Gavin Shan
2024-10-15 13:39 ` [PATCH v5 2/7] arm64: head.S: Initialise MPAM EL2 registers and disable traps Joey Gouly
2024-10-16 23:41   ` Gavin Shan
2024-10-15 13:39 ` [PATCH v5 3/7] arm64: cpufeature: discover CPU support for MPAM Joey Gouly
2024-10-17  2:36   ` Gavin Shan
2024-10-15 13:39 ` [PATCH v5 4/7] KVM: arm64: Fix missing traps of guest accesses to the MPAM registers Joey Gouly
2024-10-17  0:10   ` Oliver Upton
2024-10-17 10:58     ` Joey Gouly
2024-10-17 16:07       ` Oliver Upton
2024-10-22 14:31         ` Joey Gouly
2024-10-17  2:37   ` Gavin Shan
2024-10-17 11:54   ` Marc Zyngier
2024-10-17 13:06     ` Joey Gouly
2024-10-17 13:38       ` Marc Zyngier
2024-10-17 13:43   ` Marc Zyngier
2024-10-15 13:39 ` [PATCH v5 5/7] KVM: arm64: Add a macro for creating filtered sys_reg_descs entries Joey Gouly
2024-10-17  2:37   ` Gavin Shan
2024-10-15 13:39 ` [PATCH v5 6/7] KVM: arm64: Disable MPAM visibility by default and ignore VMM writes Joey Gouly
2024-10-17  2:37   ` Gavin Shan
2024-10-15 13:39 ` [PATCH v5 7/7] KVM: arm64: selftests: Test ID_AA64PFR0.MPAM isn't completely ignored Joey Gouly
2024-10-17  0:41   ` Gavin Shan
2024-10-17 11:03     ` Joey Gouly
2024-10-17  8:34 ` [PATCH v5 0/7] KVM: arm64: Hide unsupported MPAM from the guest Shameerali Kolothum Thodi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).