Thread (127 messages) 127 messages, 14 authors, 2022-12-01

Re: [PATCH 33/44] KVM: x86: Do VMX/SVM support checks directly in vendor code

From: Huang, Kai <hidden>
Date: 2022-11-15 22:51:14
Also in: kvm, kvm-riscv, kvmarm, linux-mips, linux-riscv, linux-s390, linuxppc-dev, lkml

On Wed, 2022-11-02 at 23:19 +0000, Sean Christopherson wrote:
+static bool __init kvm_is_vmx_supported(void)
+{
+	if (!cpu_has_vmx()) {
+		pr_err("CPU doesn't support VMX\n");
+		return false;
+	}
+
+	if (!boot_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
+	    !boot_cpu_has(X86_FEATURE_VMX)) {
+		pr_err("VMX not enabled in MSR_IA32_FEAT_CTL\n");
+		return false;
+	}
+
+	return true;
+}
+
 static int __init vmx_check_processor_compat(void)
 {
 	struct vmcs_config vmcs_conf;
 	struct vmx_capability vmx_cap;
 
-	if (!this_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) ||
-	    !this_cpu_has(X86_FEATURE_VMX)) {
-		pr_err("VMX is disabled on CPU %d\n", smp_processor_id());
+	if (!kvm_is_vmx_supported())
 		return -EIO;
-	}
 
Looks there's a functional change here -- the old code checks local cpu's
feature bits but the new code always checks bsp's feature bits.  Should have no
problem I think, though.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help