]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: SVM: Drop redundant check in AVIC code on ID during vCPU creation
authorSean Christopherson <seanjc@google.com>
Wed, 11 Jun 2025 22:45:16 +0000 (15:45 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 20 Jun 2025 20:52:59 +0000 (13:52 -0700)
commitc24ed209c474eae6a0a74beb63faa4184ada64ee
tree3454a3c0bea2d5c6faa5bf76d4a153c7804c23b6
parent1aa6e256e46f0b72be6d6e0f890c11e0a1805f53
KVM: SVM: Drop redundant check in AVIC code on ID during vCPU creation

Drop avic_get_physical_id_entry()'s compatibility check on the incoming
ID, as its sole caller, avic_init_backing_page(), performs the exact same
check.  Drop avic_get_physical_id_entry() entirely as the only remaining
functionality is getting the address of the Physical ID table, and
accessing the array without an immediate bounds check is kludgy.

Opportunistically add a compile-time assertion to ensure the vcpu_id can't
result in a bounds overflow, e.g. if KVM (really) messed up a maximum
physical ID #define, as well as run-time assertions so that a NULL pointer
dereference is morphed into a safer WARN().

No functional change intended.

Tested-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Naveen N Rao (AMD) <naveen@kernel.org>
Link: https://lore.kernel.org/r/20250611224604.313496-15-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/avic.c