Skip to content

Commit d798bc6

Browse files
james-c-linarooupton
authored andcommitted
arm64: Fix usage of new shifted MDCR_EL2 values
Since the linked fixes commit, these masks are already shifted so remove the shifts. One issue that this fixes is SPE and TRBE not being available anymore: arm_spe_pmu arm,spe-v1: profiling buffer owned by higher exception level Fixes: 6416303 ("arm64: sysreg: Migrate MDCR_EL2 definition to table") Signed-off-by: James Clark <james.clark@linaro.org> Acked-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20241122164636.2944180-1-james.clark@linaro.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 13905f4 commit d798bc6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

arch/arm64/include/asm/el2_setup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
1 << PMSCR_EL2_PA_SHIFT)
8080
msr_s SYS_PMSCR_EL2, x0 // addresses and physical counter
8181
.Lskip_spe_el2_\@:
82-
mov x0, #(MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT)
82+
mov x0, #MDCR_EL2_E2PB_MASK
8383
orr x2, x2, x0 // If we don't have VHE, then
8484
// use EL1&0 translation.
8585

@@ -92,7 +92,7 @@
9292
and x0, x0, TRBIDR_EL1_P
9393
cbnz x0, .Lskip_trace_\@ // If TRBE is available at EL2
9494

95-
mov x0, #(MDCR_EL2_E2TB_MASK << MDCR_EL2_E2TB_SHIFT)
95+
mov x0, #MDCR_EL2_E2TB_MASK
9696
orr x2, x2, x0 // allow the EL1&0 translation
9797
// to own it.
9898

arch/arm64/kernel/hyp-stub.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ SYM_CODE_START_LOCAL(__finalise_el2)
114114

115115
// Use EL2 translations for SPE & TRBE and disable access from EL1
116116
mrs x0, mdcr_el2
117-
bic x0, x0, #(MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT)
118-
bic x0, x0, #(MDCR_EL2_E2TB_MASK << MDCR_EL2_E2TB_SHIFT)
117+
bic x0, x0, #MDCR_EL2_E2PB_MASK
118+
bic x0, x0, #MDCR_EL2_E2TB_MASK
119119
msr mdcr_el2, x0
120120

121121
// Transfer the MM state from EL1 to EL2

arch/arm64/kvm/hyp/nvhe/pkvm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void pvm_init_traps_aa64dfr0(struct kvm_vcpu *vcpu)
126126
/* Trap SPE */
127127
if (!FIELD_GET(ARM64_FEATURE_MASK(ID_AA64DFR0_EL1_PMSVer), feature_ids)) {
128128
mdcr_set |= MDCR_EL2_TPMS;
129-
mdcr_clear |= MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT;
129+
mdcr_clear |= MDCR_EL2_E2PB_MASK;
130130
}
131131

132132
/* Trap Trace Filter */
@@ -143,7 +143,7 @@ static void pvm_init_traps_aa64dfr0(struct kvm_vcpu *vcpu)
143143

144144
/* Trap External Trace */
145145
if (!FIELD_GET(ARM64_FEATURE_MASK(ID_AA64DFR0_EL1_ExtTrcBuff), feature_ids))
146-
mdcr_clear |= MDCR_EL2_E2TB_MASK << MDCR_EL2_E2TB_SHIFT;
146+
mdcr_clear |= MDCR_EL2_E2TB_MASK;
147147

148148
vcpu->arch.mdcr_el2 |= mdcr_set;
149149
vcpu->arch.mdcr_el2 &= ~mdcr_clear;

0 commit comments

Comments
 (0)