]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: SVM: Check vCPU ID against max x2AVIC ID if and only if x2AVIC is enabled
authorSean Christopherson <seanjc@google.com>
Mon, 12 Jan 2026 23:28:05 +0000 (15:28 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 14 Jan 2026 21:09:50 +0000 (13:09 -0800)
commitcfbe371194d1f342bdd88f87a9b36407d1ec0f52
tree2b52811e16b7e77e2e259f94b3a0929e8ec6f5b7
parent3611ca7c12b740e250d83f8bbe3554b740c503b0
KVM: SVM: Check vCPU ID against max x2AVIC ID if and only if x2AVIC is enabled

When allocating the AVIC backing page, only check one of the max AVIC vs.
x2AVIC ID based on whether or not x2AVIC is enabled.  Doing so fixes a bug
where KVM incorrectly inhibits AVIC if x2AVIC is _disabled_ and any vCPU
with a non-zero APIC ID is created, as x2avic_max_physical_id is left '0'
when x2AVIC is disabled.

Fixes: 940fc47cfb0d ("KVM: SVM: Add AVIC support for 4k vCPUs in x2AVIC mode")
Cc: stable@vger.kernel.org
Cc: Naveen N Rao (AMD) <naveen@kernel.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Naveen N Rao (AMD) <naveen@kernel.org>
Link: https://patch.msgid.link/20260112232805.1512361-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/avic.c