public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* guest assigned device MMIO maps with WC: does this work correctly?
@ 2013-11-20 19:58 Michael S. Tsirkin
  2013-11-21  7:18 ` Gleb Natapov
  0 siblings, 1 reply; 11+ messages in thread
From: Michael S. Tsirkin @ 2013-11-20 19:58 UTC (permalink / raw)
  To: kvm, gleb

I see this in kvm:

static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool
is_mmio)
{        
        u64 ret;
         
        /* For VT-d and EPT combination
         * 1. MMIO: always map as UC
         * 2. EPT with VT-d:
         *   a. VT-d without snooping control feature: can't guarantee
         *   the
         *      result, try to trust guest.
         *   b. VT-d with snooping control feature: snooping control
         *   feature of
         *      VT-d engine can guarantee the cache correctness. Just
         *      set it
         *      to WB to keep consistent with host. So the same as item
         *      3.
         * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep
         *    consistent with host MTRR 
         */
        if (is_mmio)
                ret = MTRR_TYPE_UNCACHABLE << VMX_EPT_MT_EPTE_SHIFT;

...
}


does this mean that even if guest maps BAR for an assigned device
as write combined (or configures such using an MTRR),
host will override this and use uncacheable in practice?

I think there are some drivers that map MMIO as write-combined
for performance (but don't have such hardware) so
I'd like to figure out from code whether this will work correctly.

-- 
MST

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-11-21  8:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 19:58 guest assigned device MMIO maps with WC: does this work correctly? Michael S. Tsirkin
2013-11-21  7:18 ` Gleb Natapov
2013-11-21  8:02   ` Michael S. Tsirkin
2013-11-21  8:01     ` Gleb Natapov
2013-11-21  8:16       ` Michael S. Tsirkin
2013-11-21  8:16         ` Gleb Natapov
2013-11-21  8:18         ` Michael S. Tsirkin
2013-11-21  8:21           ` Michael S. Tsirkin
2013-11-21  8:25             ` Michael S. Tsirkin
2013-11-21  8:25               ` Gleb Natapov
2013-11-21  8:34                 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox