]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Allow AVIC support on system w/ physical APIC ID > 255
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Fri, 11 Feb 2022 00:08:51 +0000 (18:08 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Apr 2022 18:59:25 +0000 (20:59 +0200)
commitee240c11704b6c7752e561b7a565105444ecfd4a
treeca5caabd55e228cad1389c8ceebf391bc79bcf3b
parent3ddeaa9df26f55fefded62e1381544e13e0591e7
KVM: SVM: Allow AVIC support on system w/ physical APIC ID > 255

commit 9ae01a7401b140635597509597a8a001807cdbc5 upstream.

Expand KVM's mask for the AVIC host physical ID to the full 12 bits defined
by the architecture.  The number of bits consumed by hardware is model
specific, e.g. early CPUs ignored bits 11:8, but there is no way for KVM
to enumerate the "true" size.  So, KVM must allow using all bits, else it
risks rejecting completely legal x2APIC IDs on newer CPUs.

This means KVM relies on hardware to not assign x2APIC IDs that exceed the
"true" width of the field, but presumably hardware is smart enough to tie
the width to the max x2APIC ID.  KVM also relies on hardware to support at
least 8 bits, as the legacy xAPIC ID is writable by software.  But, those
assumptions are unavoidable due to the lack of any way to enumerate the
"true" width.

Cc: stable@vger.kernel.org
Cc: Maxim Levitsky <mlevitsk@redhat.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Fixes: b09f7780cbb0 ("KVM: x86: Detect and Initialize AVIC support")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Message-Id: <20220211000851.185799-1-suravee.suthikulpanit@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[modified due to the conflict caused by the commit 95c1a9d7c660 ("KVM:
x86: SVM: move avic definitions from AMD's spec to svm.h")]
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm/avic.c
arch/x86/kvm/svm/svm.h