]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Fix FEAT_Debugv8p9 to check DebugVer, not PMUVer
authorFuad Tabba <tabba@google.com>
Fri, 24 Apr 2026 08:49:03 +0000 (09:49 +0100)
committerMarc Zyngier <maz@kernel.org>
Fri, 24 Apr 2026 11:03:57 +0000 (12:03 +0100)
FEAT_Debugv8p9 is incorrectly defined against ID_AA64DFR0_EL1.PMUVer
instead of ID_AA64DFR0_EL1.DebugVer.  All three consumers of the macro
gate features that are architecturally tied to FEAT_Debugv8p9
(DebugVer = 0b1011, DDI0487 M.b A2.2.10):

  - HDFGRTR2_EL2.nMDSELR_EL1, HDFGWTR2_EL2.nMDSELR_EL1: MDSELR_EL1
    is present only when FEAT_Debugv8p9 is implemented (D24.3.21).

  - MDCR_EL2.EBWE: the Extended Breakpoint and Watchpoint Enable bit
    is RES0 unless FEAT_Debugv8p9 is implemented (D24.3.17).

Neither register has any dependency on PMUVer.

FEAT_Debugv8p9 and FEAT_PMUv3p9 are independent.  Per DDI0487 M.b
A2.2.10, FEAT_Debugv8p9 is unconditionally mandatory from Armv8.9,
whereas FEAT_PMUv3p9 is mandatory only when FEAT_PMUv3 is implemented.
An Armv8.9 CPU without a PMU has DebugVer = 0b1011 but PMUVer = 0b0000,
so the wrong field check would cause KVM to incorrectly treat EBWE and
MDSELR_EL1 as RES0 on such hardware.

Fixes: 4bc0fe089840 ("KVM: arm64: Add sanitisation for FEAT_FGT2 registers")
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260424084908.370776-2-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
arch/arm64/kvm/config.c

index f35b8dddd7c1f442e55b91a9485eb1fb466d6ace..093290b366e65ee5d8128726df4e4c0fc2cdd44a 100644 (file)
@@ -192,7 +192,7 @@ struct reg_feat_map_desc {
 #define FEAT_SRMASK            ID_AA64MMFR4_EL1, SRMASK, IMP
 #define FEAT_PoPS              ID_AA64MMFR4_EL1, PoPS, IMP
 #define FEAT_PFAR              ID_AA64PFR1_EL1, PFAR, IMP
-#define FEAT_Debugv8p9         ID_AA64DFR0_EL1, PMUVer, V3P9
+#define FEAT_Debugv8p9         ID_AA64DFR0_EL1, DebugVer, V8P9
 #define FEAT_PMUv3_SS          ID_AA64DFR0_EL1, PMSS, IMP
 #define FEAT_SEBEP             ID_AA64DFR0_EL1, SEBEP, IMP
 #define FEAT_EBEP              ID_AA64DFR1_EL1, EBEP, IMP