Skip to content

Commit 7a26e1f

Browse files
Marc Zyngieroupton
authored andcommitted
arm64: Don't enable VHE for the kernel if OVERRIDE_HVHE is set
If the OVERRIDE_HVHE SW override is set (as a precursor of the KVM_HVHE capability), do not enable VHE for the kernel and drop to EL1 as if VHE was either disabled or unavailable. Further changes will enable VHE at EL2 only, with the kernel still running at EL1. Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20230609162200.2024064-6-maz@kernel.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent e2d6c90 commit 7a26e1f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

arch/arm64/kernel/hyp-stub.S

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,15 @@ SYM_CODE_START_LOCAL(__finalise_el2)
8282
tbnz x1, #0, 1f
8383

8484
// Needs to be VHE capable, obviously
85-
check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 2f 1f x1 x2
85+
check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 0f 1f x1 x2
86+
87+
0: // Check whether we only want the hypervisor to run VHE, not the kernel
88+
adr_l x1, arm64_sw_feature_override
89+
ldr x2, [x1, FTR_OVR_VAL_OFFSET]
90+
ldr x1, [x1, FTR_OVR_MASK_OFFSET]
91+
and x2, x2, x1
92+
ubfx x2, x2, #ARM64_SW_FEATURE_OVERRIDE_HVHE, #4
93+
cbz x2, 2f
8694

8795
1: mov_q x0, HVC_STUB_ERR
8896
eret

0 commit comments

Comments
 (0)