]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: SVM: Limit AVIC physical max index based on configured max_vcpu_ids
authorNaveen N Rao <naveen@kernel.org>
Thu, 4 Sep 2025 18:33:01 +0000 (00:03 +0530)
committerSean Christopherson <seanjc@google.com>
Fri, 17 Oct 2025 22:21:42 +0000 (15:21 -0700)
commit574ef752d4aea04134bc121294d717f4422c2755
tree4eee943633ddde995bbc2c6685f7d26bdec41c70
parentc53c632592a427bc01266a8ce7e2f17555a3c247
KVM: SVM: Limit AVIC physical max index based on configured max_vcpu_ids

KVM allows VMMs to specify the maximum possible APIC ID for a virtual
machine through KVM_CAP_MAX_VCPU_ID capability so as to limit data
structures related to APIC/x2APIC. Utilize the same to set the AVIC
physical max index in the VMCB, similar to VMX. This helps hardware
limit the number of entries to be scanned in the physical APIC ID table
speeding up IPI broadcasts for virtual machines with smaller number of
vCPUs.

Unlike VMX, SVM AVIC requires a single page to be allocated for the
Physical APIC ID table and the Logical APIC ID table, so retain the
existing approach of allocating those during VM init.

Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
Link: https://lore.kernel.org/r/adb07ccdb3394cd79cb372ba6bcc69a4e4d4ef54.1757009416.git.naveen@kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/avic.c