]> Git Repo - linux.git/commitdiff
arm64: Allow arm64_sw.hvhe on command line
authorMarc Zyngier <[email protected]>
Fri, 9 Jun 2023 16:21:59 +0000 (17:21 +0100)
committerOliver Upton <[email protected]>
Mon, 12 Jun 2023 23:17:24 +0000 (23:17 +0000)
Add the arm64_sw.hvhe=1 option to force the use of the hVHE mode
in the hypervisor code only.

This enables the hVHE mode of operation when using KVM on VHE
hardware.

Signed-off-by: Marc Zyngier <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Oliver Upton <[email protected]>
arch/arm64/kernel/idreg-override.c

index 8c93b6198bf560933ff548a14ea65a8a5956bf44..c553d30089e58bf2e797d773bb2125cca872d9f5 100644 (file)
@@ -138,11 +138,22 @@ static const struct ftr_set_desc smfr0 __initconst = {
        },
 };
 
+static bool __init hvhe_filter(u64 val)
+{
+       u64 mmfr1 = read_sysreg(id_aa64mmfr1_el1);
+
+       return (val == 1 &&
+               lower_32_bits(__boot_status) == BOOT_CPU_MODE_EL2 &&
+               cpuid_feature_extract_unsigned_field(mmfr1,
+                                                    ID_AA64MMFR1_EL1_VH_SHIFT));
+}
+
 static const struct ftr_set_desc sw_features __initconst = {
        .name           = "arm64_sw",
        .override       = &arm64_sw_feature_override,
        .fields         = {
                FIELD("nokaslr", ARM64_SW_FEATURE_OVERRIDE_NOKASLR, NULL),
+               FIELD("hvhe", ARM64_SW_FEATURE_OVERRIDE_HVHE, hvhe_filter),
                {}
        },
 };
This page took 0.055462 seconds and 4 git commands to generate.