Set kvm_caps.has_extapic when the CPU has X86_FEATURE_EXTAPIC, allowing KVM to expose Extended APIC functionality to AMD guests. This is a prerequisite for advertising AMD's extended APIC space to userspace and enabling extended LVT emulation. The has_extapic flag gates access to extended APIC registers (APIC_EFEAT at 0x400, APIC_ECTRL at 0x410, and APIC_EILVTn at 0x500-0x530) beyond the standard APIC register space. Signed-off-by: Manali Shukla --- arch/x86/kvm/svm/svm.c | 3 +++ arch/x86/kvm/x86.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 7803d2781144..6b582fede23d 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -5356,6 +5356,9 @@ static __init void svm_set_cpu_caps(void) if (cpu_feature_enabled(X86_FEATURE_BUS_LOCK_THRESHOLD)) kvm_caps.has_bus_lock_exit = true; + if (cpu_feature_enabled(X86_FEATURE_EXTAPIC)) + kvm_caps.has_extapic = true; + /* CPUID 0x80000008 */ if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) || boot_cpu_has(X86_FEATURE_AMD_SSBD)) diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 70e81f008030..ec70f6579b58 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -27,6 +27,8 @@ struct kvm_caps { bool has_bus_lock_exit; /* notify VM exit supported? */ bool has_notify_vmexit; + /* extapic supported */ + bool has_extapic; /* bit mask of VM types */ u32 supported_vm_types; -- 2.43.0