Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[sfrench/cifs-2.6.git] / arch / arm64 / kernel / hyp-stub.S
index d63de1973ddbb4b348e711beb5c59fc5d1cdcf4b..65f76064c86b24db53795ea420efe56f4a21172d 100644 (file)
@@ -82,7 +82,15 @@ SYM_CODE_START_LOCAL(__finalise_el2)
        tbnz    x1, #0, 1f
 
        // Needs to be VHE capable, obviously
-       check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 2f 1f x1 x2
+       check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 0f 1f x1 x2
+
+0:     // Check whether we only want the hypervisor to run VHE, not the kernel
+       adr_l   x1, arm64_sw_feature_override
+       ldr     x2, [x1, FTR_OVR_VAL_OFFSET]
+       ldr     x1, [x1, FTR_OVR_MASK_OFFSET]
+       and     x2, x2, x1
+       ubfx    x2, x2, #ARM64_SW_FEATURE_OVERRIDE_HVHE, #4
+       cbz     x2, 2f
 
 1:     mov_q   x0, HVC_STUB_ERR
        eret