• S
    KVM: x86/mmu: Restrict mapping level based on guest MTRR iff they're used · d5e90a69
    Sean Christopherson 提交于
    Restrict the mapping level for SPTEs based on the guest MTRRs if and only
    if KVM may actually use the guest MTRRs to compute the "real" memtype.
    For all forms of paging, guest MTRRs are purely virtual in the sense that
    they are completely ignored by hardware, i.e. they affect the memtype
    only if software manually consumes them.  The only scenario where KVM
    consumes the guest MTRRs is when shadow_memtype_mask is non-zero and the
    guest has non-coherent DMA, in all other cases KVM simply leaves the PAT
    field in SPTEs as '0' to encode WB memtype.
    
    Note, KVM may still ultimately ignore guest MTRRs, e.g. if the backing
    pfn is host MMIO, but false positives are ok as they only cause a slight
    performance blip (unless the guest is doing weird things with its MTRRs,
    which is extremely unlikely).
    Signed-off-by: NSean Christopherson <seanjc@google.com>
    Reviewed-by: NMaxim Levitsky <mlevitsk@redhat.com>
    Message-Id: <20220715230016.3762909-5-seanjc@google.com>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    d5e90a69
mmu.c 189.1 KB