Skip to content

Commit ad744e8

Browse files
Marc Zyngieroupton
authored andcommitted
arm64: Allow arm64_sw.hvhe on command line
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]>
1 parent 38cba55 commit ad744e8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/arm64/kernel/idreg-override.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,22 @@ static const struct ftr_set_desc smfr0 __initconst = {
138138
},
139139
};
140140

141+
static bool __init hvhe_filter(u64 val)
142+
{
143+
u64 mmfr1 = read_sysreg(id_aa64mmfr1_el1);
144+
145+
return (val == 1 &&
146+
lower_32_bits(__boot_status) == BOOT_CPU_MODE_EL2 &&
147+
cpuid_feature_extract_unsigned_field(mmfr1,
148+
ID_AA64MMFR1_EL1_VH_SHIFT));
149+
}
150+
141151
static const struct ftr_set_desc sw_features __initconst = {
142152
.name = "arm64_sw",
143153
.override = &arm64_sw_feature_override,
144154
.fields = {
145155
FIELD("nokaslr", ARM64_SW_FEATURE_OVERRIDE_NOKASLR, NULL),
156+
FIELD("hvhe", ARM64_SW_FEATURE_OVERRIDE_HVHE, hvhe_filter),
146157
{}
147158
},
148159
};

0 commit comments

Comments
 (0)