From: Paul Durrant <pdurrant@amazon.com>
Re-factor the code to take advantage of the fact that the APIC access page is
a 'special' page.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
---
xen/arch/x86/hvm/mtrr.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 3ad813ed15..0992f05e8f 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -814,29 +814,22 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
return -1;
}
- if ( direct_mmio )
- {
- if ( (mfn_x(mfn) ^ mfn_x(d->arch.hvm.vmx.apic_access_mfn)) >> order )
- return MTRR_TYPE_UNCACHABLE;
- if ( order )
- return -1;
- *ipat = 1;
- return MTRR_TYPE_WRBACK;
- }
-
if ( !mfn_valid(mfn) )
{
*ipat = 1;
return MTRR_TYPE_UNCACHABLE;
}
- if ( (!is_iommu_enabled(d) && !cache_flush_permitted(d)) ||
+ if ( (!direct_mmio && !is_iommu_enabled(d) && !cache_flush_permitted(d)) ||
is_special_page(mfn_to_page(mfn)) )
{
*ipat = 1;
return MTRR_TYPE_WRBACK;
}
+ if ( direct_mmio )
+ return MTRR_TYPE_UNCACHABLE;
+
gmtrr_mtype = hvm_get_mem_pinned_cacheattr(d, _gfn(gfn), order);
if ( gmtrr_mtype >= 0 )
{
--
2.20.1
Re-factor the code to take advantage of the fact that the APIC access page is
a 'special' page.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
---
xen/arch/x86/hvm/mtrr.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 3ad813ed15..0992f05e8f 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -814,29 +814,22 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
return -1;
}
- if ( direct_mmio )
- {
- if ( (mfn_x(mfn) ^ mfn_x(d->arch.hvm.vmx.apic_access_mfn)) >> order )
- return MTRR_TYPE_UNCACHABLE;
- if ( order )
- return -1;
- *ipat = 1;
- return MTRR_TYPE_WRBACK;
- }
-
if ( !mfn_valid(mfn) )
{
*ipat = 1;
return MTRR_TYPE_UNCACHABLE;
}
- if ( (!is_iommu_enabled(d) && !cache_flush_permitted(d)) ||
+ if ( (!direct_mmio && !is_iommu_enabled(d) && !cache_flush_permitted(d)) ||
is_special_page(mfn_to_page(mfn)) )
{
*ipat = 1;
return MTRR_TYPE_WRBACK;
}
+ if ( direct_mmio )
+ return MTRR_TYPE_UNCACHABLE;
+
gmtrr_mtype = hvm_get_mem_pinned_cacheattr(d, _gfn(gfn), order);
if ( gmtrr_mtype >= 0 )
{
--
2.20.1