FROMGIT: KVM: arm64: Ignore kvm-arm.mode if !is_hyp_mode_available()
Ignore kvm-arm.mode if !is_hyp_mode_available(). Specifically, we want to avoid switching kvm_mode to KVM_MODE_PROTECTED if hypervisor mode is not available. This prevents "Protected KVM" cpu capability being reported when Linux is booting in EL1 and would not have KVM enabled. Reasonably though, we should warn if the command line is requesting a KVM mode at all if KVM isn't actually available. Allow "kvm-arm.mode=none" to skip the warning since this would disable KVM anyway. Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220920190658.2880184-1-quic_eberman@quicinc.com Bug: 249052880 (cherry picked from commit b2a4d007c347b4cb4c60f7512733c3f8300a129c https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next) Change-Id: I196649fc00537e563a1fab0a22bf23c5b7abe00d Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> (cherry picked from commit 8015dd49c00e036b214801b34a727b7c98aa84e3)
This commit is contained in:

committed by
Treehugger Robot

parent
dbcd8cb535
commit
9a1be9a472
@@ -2142,6 +2142,16 @@ static int __init early_kvm_mode_cfg(char *arg)
|
||||
if (!arg)
|
||||
return -EINVAL;
|
||||
|
||||
if (strcmp(arg, "none") == 0) {
|
||||
kvm_mode = KVM_MODE_NONE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!is_hyp_mode_available()) {
|
||||
pr_warn_once("KVM is not available. Ignoring kvm-arm.mode\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(arg, "protected") == 0) {
|
||||
kvm_mode = KVM_MODE_PROTECTED;
|
||||
return 0;
|
||||
@@ -2152,11 +2162,6 @@ static int __init early_kvm_mode_cfg(char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(arg, "none") == 0) {
|
||||
kvm_mode = KVM_MODE_NONE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
early_param("kvm-arm.mode", early_kvm_mode_cfg);
|
||||
|
Reference in New Issue
Block a user