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: Sean Christopherson <seanjc@google.com>
Date: 2022-11-03 18:35:15
Also in: kvm, kvm-riscv, kvmarm, linux-mips, linux-riscv, linux-s390, linuxppc-dev, lkml

On Thu, Nov 03, 2022, Paolo Bonzini wrote:
On 11/3/22 00:19, Sean Christopherson wrote:
quoted
+	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;
I think the reference to the BIOS should remain in these messages and in
svm.c (even though these days it's much less common for vendors to default
to disabled virtualization in the system setup).
Ya, I'll figure out a way to mention BIOS/firmware.
The check for X86_FEATURE_MSR_IA32_FEAT_CTL is not needed because
init_ia32_feat_ctl() will clear X86_FEATURE_VMX if the rdmsr fail (and not
set X86_FEATURE_MSR_IA32_FEAT_CTL).
It's technically required.  IA32_FEAT_CTL and thus KVM_INTEL depends on any of
CPU_SUP_{INTEL,CENATUR,ZHAOXIN}, but init_ia32_feat_ctl() is invoked if and only
if the actual CPU type matches one of the aforementioned CPU_SUP_*.

E.g. running a kernel built with

  CONFIG_CPU_SUP_INTEL=y
  CONFIG_CPU_SUP_AMD=y
  # CONFIG_CPU_SUP_HYGON is not set
  # CONFIG_CPU_SUP_CENTAUR is not set
  # CONFIG_CPU_SUP_ZHAOXIN is not set

on a Cenatur or Zhaoxin CPU will leave X86_FEATURE_VMX set but not set
X86_FEATURE_MSR_IA32_FEAT_CTL.  If VMX isn't enabled in MSR_IA32_FEAT_CTL, KVM
will get unexpected #UDs when trying to enable VMX.

_______________________________________________
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