• Sean Christopherson's avatar
    KVM: x86: Re-split x2APIC ICR into ICR+ICR2 for AMD (x2AVIC) · 73b42dc6
    Sean Christopherson authored
    Re-introduce the "split" x2APIC ICR storage that KVM used prior to Intel's
    IPI virtualization support, but only for AMD.  While not stated anywhere
    in the APM, despite stating the ICR is a single 64-bit register, AMD CPUs
    store the 64-bit ICR as two separate 32-bit values in ICR and ICR2.  When
    IPI virtualization (IPIv on Intel, all AVIC flavors on AMD) is enabled,
    KVM needs to match CPU behavior as some ICR ICR writes will be handled by
    the CPU, not by KVM.
    
    Add a kvm_x86_ops knob to control the underlying format used by the CPU to
    store the x2APIC ICR, and tune it to AMD vs. Intel regardless of whether
    or not x2AVIC is enabled.  If KVM is handling all ICR writes, the storage
    format for x2APIC mode doesn't matter, and having the behavior follow AMD
    versus Intel will provide better test coverage and ease debugging.
    
    Fixes: 4d1d7942 ("KVM: SVM: Introduce logic to (de)activate x2AVIC mode")
    Cc: stable@vger.kernel.org
    Cc: Maxim Levitsky <mlevitsk@redhat.com>
    Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
    Link: https://lore.kernel.org/r/20240719235107.3023592-4-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
    73b42dc6
lapic.c 88.4 KB