Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] arm64: Clamp ID overrides and gate the GMID_EL1 read
@ 2026-08-25 16:42 Fuad Tabba
  2026-08-25 16:42 ` [PATCH v4 1/2] arm64: Apply overrides to CPU local capabilities Fuad Tabba
  2026-08-25 16:42 ` [PATCH v4 2/2] arm64: Don't read GMID_EL1 when MTE is disabled Fuad Tabba
  0 siblings, 2 replies; 9+ messages in thread
From: Fuad Tabba @ 2026-08-25 16:42 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, linux-arm-kernel
  Cc: Marc Zyngier, Oliver Upton, Mark Rutland, Suzuki K Poulose,
	Mark Brown, kvmarm, linux-kernel, Fuad Tabba

Hi folks,

Changes since v3 [1]:
  - Gate on __read_sysreg_by_encoding() and drop the helper's argument,
    so the command-line override is not open-coded in the header.
    (Catalin)
  - Pick up Suzuki's override clamp as patch 1, rather than adding a
    raw-presence check to the gate. (Will)

Patch 2 fixes a GMID_EL1 read that traps to EL2 when the kernel has
disabled MTE, panicking the host under pKVM on a CPU that is offlined
and brought back online. It gates the read on
__read_sysreg_by_encoding().

That needs patch 1, Suzuki's override clamp [2]. Without it
__read_sysreg_by_encoding() applies the command-line override raw, so
id_aa64pfr1.mte=2 on a CPU without FEAT_MTE2 makes the gate true and the
kernel reads a GMID_EL1 that is not there. On the boot CPU that read
comes before init_cpu_ftr_reg() strips the unsafe override, so the gate
cannot rely on it.

Tested on QEMU under pKVM. With -machine virt,mte=on, offlining and
onlining CPU1 with arm64.nomte panics an unpatched v7.2 in
__cpuinfo_store_cpu() and does not with the series. Without tag memory,
where QEMU implements no GMID_EL1, id_aa64pfr1.mte=2 covers the
force-up case.

Based on Linux 7.2 (8d3ae59288f1e).

Cheers,
/fuad

[1] https://lore.kernel.org/all/20260824184155.2644646-1-fuad.tabba@linux.dev/
[2] https://lore.kernel.org/all/afc5bd00-28ca-413b-b047-ee53589c285d@arm.com/

Fuad Tabba (1):
  arm64: Don't read GMID_EL1 when MTE is disabled

Suzuki K Poulose (1):
  arm64: Apply overrides to CPU local capabilities

 arch/arm64/include/asm/cpufeature.h |  9 ++++++
 arch/arm64/kernel/cpufeature.c      | 48 +++++++++++++++++++++--------
 arch/arm64/kernel/cpuinfo.c         |  2 +-
 3 files changed, 46 insertions(+), 13 deletions(-)

-- 
2.39.5



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

end of thread, other threads:[~2026-08-28 10:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 16:42 [PATCH v4 0/2] arm64: Clamp ID overrides and gate the GMID_EL1 read Fuad Tabba
2026-08-25 16:42 ` [PATCH v4 1/2] arm64: Apply overrides to CPU local capabilities Fuad Tabba
2026-08-26 13:47   ` Catalin Marinas
2026-08-27  8:58     ` Fuad Tabba
2026-08-25 16:42 ` [PATCH v4 2/2] arm64: Don't read GMID_EL1 when MTE is disabled Fuad Tabba
2026-08-26 13:48   ` Catalin Marinas
2026-08-27 12:56   ` Will Deacon
2026-08-27 13:19     ` Will Deacon
2026-08-28 10:50     ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox