Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: Fix FEAT_SPE_FnE to use PMSIDR_EL1.FnE, not PMSVer

FEAT_SPE_FnE is architecturally detected via PMSIDR_EL1.FnE [6], not
ID_AA64DFR0_EL1.PMSVer. The FEAT_X macro form (register, field, value)
cannot encode a PMSIDR_EL1-based feature, so FEAT_SPE_FnE was defined
identically to FEAT_SPEv1p2 (ID_AA64DFR0_EL1, PMSVer, V1P2), producing
a duplicate that used PMSVer >= V1P2 as a proxy.

Replace the macro with feat_spe_fne(), following the same pattern as
the sibling feat_spe_fds(): guard on FEAT_SPEv1p2 and read
PMSIDR_EL1.FnE [6] directly. Wire the two NEEDS_FEAT consumers to use
the new function.

Remove the now-unused FEAT_SPE_FnE macro.

Fixes: 63d423a7635b ("KVM: arm64: Switch to table-driven FGU configuration")
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260424084908.370776-4-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org

authored by

Fuad Tabba and committed by
Marc Zyngier
08d71533 2a623408

+12 -3
+12 -3
arch/arm64/kvm/config.c
··· 131 131 } 132 132 133 133 #define FEAT_SPE ID_AA64DFR0_EL1, PMSVer, IMP 134 - #define FEAT_SPE_FnE ID_AA64DFR0_EL1, PMSVer, V1P2 135 134 #define FEAT_BRBE ID_AA64DFR0_EL1, BRBE, IMP 136 135 #define FEAT_TRC_SR ID_AA64DFR0_EL1, TraceVer, IMP 137 136 #define FEAT_PMUv3 ID_AA64DFR0_EL1, PMUVer, IMP ··· 299 300 */ 300 301 return (kvm_has_feat(kvm, FEAT_SPEv1p4) && 301 302 (read_sysreg_s(SYS_PMSIDR_EL1) & PMSIDR_EL1_FDS)); 303 + } 304 + 305 + static bool feat_spe_fne(struct kvm *kvm) 306 + { 307 + /* 308 + * Revisit this if KVM ever supports SPE -- this really should 309 + * look at the guest's view of PMSIDR_EL1. 310 + */ 311 + return (kvm_has_feat(kvm, FEAT_SPEv1p2) && 312 + (read_sysreg_s(SYS_PMSIDR_EL1) & PMSIDR_EL1_FnE)); 302 313 } 303 314 304 315 static bool feat_trbe_mpam(struct kvm *kvm) ··· 546 537 HDFGRTR_EL2_PMBPTR_EL1 | 547 538 HDFGRTR_EL2_PMBLIMITR_EL1, 548 539 FEAT_SPE), 549 - NEEDS_FEAT(HDFGRTR_EL2_nPMSNEVFR_EL1, FEAT_SPE_FnE), 540 + NEEDS_FEAT(HDFGRTR_EL2_nPMSNEVFR_EL1, feat_spe_fne), 550 541 NEEDS_FEAT(HDFGRTR_EL2_nBRBDATA | 551 542 HDFGRTR_EL2_nBRBCTL | 552 543 HDFGRTR_EL2_nBRBIDR, ··· 614 605 HDFGWTR_EL2_PMBPTR_EL1 | 615 606 HDFGWTR_EL2_PMBLIMITR_EL1, 616 607 FEAT_SPE), 617 - NEEDS_FEAT(HDFGWTR_EL2_nPMSNEVFR_EL1, FEAT_SPE_FnE), 608 + NEEDS_FEAT(HDFGWTR_EL2_nPMSNEVFR_EL1, feat_spe_fne), 618 609 NEEDS_FEAT(HDFGWTR_EL2_nBRBDATA | 619 610 HDFGWTR_EL2_nBRBCTL, 620 611 FEAT_BRBE),