@@ -782,32 +782,29 @@ int epte_get_entry_emt(struct domain *d,
mfn_x(mfn) + (1UL << order) - 1) )
return -1;
- switch ( hvm_get_mem_pinned_cacheattr(d, gfn, order, &type) )
+ if ( direct_mmio )
{
- case 1:
+ if ( (mfn_x(mfn) ^ d->arch.hvm_domain.vmx.apic_access_mfn) >> order )
+ return MTRR_TYPE_UNCACHABLE;
+ if ( order )
+ return -1;
*ipat = 1;
- return type != PAT_TYPE_UC_MINUS ? type : PAT_TYPE_UNCACHABLE;
- case -1:
- return -1;
+ return MTRR_TYPE_WRBACK;
}
if ( !need_iommu(d) && !cache_flush_permitted(d) )
{
- ASSERT(!direct_mmio ||
- !((mfn_x(mfn) ^ d->arch.hvm_domain.vmx.apic_access_mfn) >>
- order));
*ipat = 1;
return MTRR_TYPE_WRBACK;
}
- if ( direct_mmio )
+ switch ( hvm_get_mem_pinned_cacheattr(d, gfn, order, &type) )
{
- if ( (mfn_x(mfn) ^ d->arch.hvm_domain.vmx.apic_access_mfn) >> order )
- return MTRR_TYPE_UNCACHABLE;
- if ( order )
- return -1;
+ case 1:
*ipat = 1;
- return MTRR_TYPE_WRBACK;
+ return type != PAT_TYPE_UC_MINUS ? type : PAT_TYPE_UNCACHABLE;
+ case -1:
+ return -1;
}
gmtrr_mtype = is_hvm_domain(d) && v ?
@@ -618,7 +618,8 @@ _sh_propagate(struct vcpu *v,
* 3) if disables snoop control, compute the PAT index with
* gMTRR and gPAT.
*/
- if ( hvm_get_mem_pinned_cacheattr(d, gfn_x(target_gfn), 0, &type) )
+ if ( !mmio_mfn &&
+ hvm_get_mem_pinned_cacheattr(d, gfn_x(target_gfn), 0, &type) )
sflags |= pat_type_2_pte_flags(type);
else if ( d->arch.hvm_domain.is_in_uc_mode )
sflags |= pat_type_2_pte_flags(PAT_TYPE_UNCACHABLE);