arch: x86_64: Correctly disable nested virtualization on AMD

The loop that is for programming the APIC ID and disabling nested
virtualization was prematurely breaking out on AMD platforms as the 0x1
leaf is also valid on AMD. This lead to the code attempting to disable
SVM in the 0x8000_0001 leaf never being reached.

Now only break out early if the CPU vendor is Intel.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-03-04 02:04:46 -08:00
parent 7c48aafb65
commit f57b7c5b86

View File

@@ -841,11 +841,13 @@ pub fn configure_vcpu(
entry.ebx &= 0xffffff;
entry.ebx |= x2apic_id << 24;
apic_id_patched = true;
if !nested {
// Disable nested virtualization for Intel
entry.ecx &= !(1 << VMX_ECX_BIT);
if matches!(cpu_vendor, CpuVendor::Intel) {
if !nested {
// Disable nested virtualization for Intel
entry.ecx &= !(1 << VMX_ECX_BIT);
}
break;
}
break;
}
if entry.function == 0x8000_0001 {
if !nested {