Re: [PATCH v2 1/3] KVM: SVM: Add paranoid helper for checking if vCPU is AVIC-addressable

From: Naveen N Rao

Date: Thu Sep 24 2026 - 07:24:40 EST


On Wed, Sep 23, 2026 at 08:51:06AM -0700, Sean Christopherson wrote:
> Add a helper to check if a vCPU is addressable by AVIC hardware, i.e. has
> an APIC ID that fits in the physical ID table, and use the more paranoid
> helper when determining if a vCPU is compatible with AVIC when initializing
> the vCPU. KVM is supposed to reject vCPU creation if the vCPU's ID is
> greater than or equal to max_vcpu_ids, i.e. simply checking the
> architectural maximum *should* suffice. But piecing together why this is
> safe is unnecessarily difficult, and there is no meaningful downside to
> being extra cautious.
>
> Suggested-by: Naveen N Rao (AMD) <naveen@xxxxxxxxxx>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> ---
> arch/x86/kvm/svm/avic.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)


Reviewed-by: Naveen N Rao (AMD) <naveen@xxxxxxxxxx>


- Naveen