• Sean Christopherson's avatar
    KVM: SVM: Require logical ID to be power-of-2 for AVIC entry · 1808c950
    Sean Christopherson authored
    Do not modify AVIC's logical ID table if the logical ID portion of the
    LDR is not a power-of-2, i.e. if the LDR has multiple bits set.  Taking
    only the first bit means that KVM will fail to match MDAs that intersect
    with "higher" bits in the "ID"
    
    The "ID" acts as a bitmap, but is referred to as an ID because there's an
    implicit, unenforced "requirement" that software only set one bit.  This
    edge case is arguably out-of-spec behavior, but KVM cleanly handles it
    in all other cases, e.g. the optimized logical map (and AVIC!) is also
    disabled in this scenario.
    
    Refactor the code to consolidate the checks, and so that the code looks
    more like avic_kick_target_vcpus_fast().
    
    Fixes: 18f40c53 ("svm: Add VMEXIT handlers for AVIC")
    Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
    Cc: Maxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20230106011306.85230-28-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    1808c950
avic.c 30.6 KB