[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/HVM: adjust hvm_get_mem_pinned_cacheattr() GFN parameter



commit d29cf2e8f5a2d51086babc423f542e5a848f29df
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Mar 4 14:16:18 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Mar 4 14:16:18 2016 +0100

    x86/HVM: adjust hvm_get_mem_pinned_cacheattr() GFN parameter
    
    Make it gfn_t and rename it accordingly.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/arch/x86/hvm/mtrr.c             | 12 ++++++------
 xen/arch/x86/mm/shadow/multi.c      |  3 +--
 xen/include/asm-x86/hvm/cacheattr.h |  6 ++++--
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 2761f9b..0e2c460 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -545,7 +545,7 @@ void hvm_destroy_cacheattr_region_list(
 
 int hvm_get_mem_pinned_cacheattr(
     struct domain *d,
-    uint64_t guest_fn,
+    gfn_t gfn,
     unsigned int order)
 {
     struct hvm_mem_pinned_cacheattr_range *range;
@@ -559,14 +559,14 @@ int hvm_get_mem_pinned_cacheattr(
                               &d->arch.hvm_domain.pinned_cacheattr_ranges,
                               list )
     {
-        if ( ((guest_fn & mask) >= range->start) &&
-             ((guest_fn | ~mask) <= range->end) )
+        if ( ((gfn_x(gfn) & mask) >= range->start) &&
+             ((gfn_x(gfn) | ~mask) <= range->end) )
         {
             rc = range->type;
             break;
         }
-        if ( ((guest_fn & mask) <= range->end) &&
-             (range->start <= (guest_fn | ~mask)) )
+        if ( ((gfn_x(gfn) & mask) <= range->end) &&
+             ((gfn_x(gfn) | ~mask) >= range->start) )
         {
             rc = -EADDRNOTAVAIL;
             break;
@@ -808,7 +808,7 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, 
mfn_t mfn,
         return MTRR_TYPE_WRBACK;
     }
 
-    gmtrr_mtype = hvm_get_mem_pinned_cacheattr(d, gfn, order);
+    gmtrr_mtype = hvm_get_mem_pinned_cacheattr(d, _gfn(gfn), order);
     if ( gmtrr_mtype >= 0 )
     {
         *ipat = 1;
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 27c16e0..01d916d 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -619,8 +619,7 @@ _sh_propagate(struct vcpu *v,
          *    gMTRR and gPAT.
          */
         if ( !mmio_mfn &&
-             (type = hvm_get_mem_pinned_cacheattr(d, gfn_x(target_gfn),
-                                                  0)) >= 0 )
+             (type = hvm_get_mem_pinned_cacheattr(d, target_gfn, 0)) >= 0 )
             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);
diff --git a/xen/include/asm-x86/hvm/cacheattr.h 
b/xen/include/asm-x86/hvm/cacheattr.h
index e1b7083..0585c60 100644
--- a/xen/include/asm-x86/hvm/cacheattr.h
+++ b/xen/include/asm-x86/hvm/cacheattr.h
@@ -1,19 +1,21 @@
 #ifndef __HVM_CACHEATTR_H__
 #define __HVM_CACHEATTR_H__
 
+#include <xen/mm.h>
+
 void hvm_init_cacheattr_region_list(
     struct domain *d);
 void hvm_destroy_cacheattr_region_list(
     struct domain *d);
 
 /*
- * To see guest_fn is in the pinned range or not,
+ * Check whether gfn is in the pinned range:
  * if yes, return the (non-negative) type
  * if no or ambiguous, return a negative error code
  */
 int hvm_get_mem_pinned_cacheattr(
     struct domain *d,
-    uint64_t guest_fn,
+    gfn_t gfn,
     unsigned int order);
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.