From f57b7c5b86fa0764947d020284c0afd710ce5e81 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 4 Mar 2026 02:04:46 -0800 Subject: [PATCH] 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 --- arch/src/x86_64/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index 979fd52a9..8bc5ec19c 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -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 {