x86: Make use of pagetable_get_mfn() where appropriate
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 27 Sep 2017 14:30:13 +0000 (14:30 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Oct 2017 09:47:34 +0000 (10:47 +0100)
... instead of the opencoded _mfn(pagetable_get_pfn(...)) construct.

Fix two overly long lines; no functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/domain.c
xen/arch/x86/domctl.c
xen/arch/x86/mm/p2m-ept.c
xen/arch/x86/mm/shadow/multi.c

index 6dfd0db1a8ff586b0b5d7f3db079d96bc0b85f5e..2515c2aad9127b082b502595cfdb48ba98e23a2a 100644 (file)
@@ -1113,7 +1113,7 @@ int arch_set_info_guest(
     {
         l4_pgentry_t *l4tab;
 
-        l4tab = map_domain_page(_mfn(pagetable_get_pfn(v->arch.guest_table)));
+        l4tab = map_domain_page(pagetable_get_mfn(v->arch.guest_table));
         *l4tab = l4e_from_pfn(page_to_mfn(cr3_page),
             _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);
         unmap_domain_page(l4tab);
index 1b208f9f958baea76f0f32be8dc5a67c8e6f6602..80b4df9ec95b24b42b1d16368f1a0a0dae494cd7 100644 (file)
@@ -1638,7 +1638,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
         else
         {
             const l4_pgentry_t *l4e =
-                map_domain_page(_mfn(pagetable_get_pfn(v->arch.guest_table)));
+                map_domain_page(pagetable_get_mfn(v->arch.guest_table));
 
             c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
             unmap_domain_page(l4e);
index 054827aa883421e228b658e4258454ef2127b63c..b4996ce658ac10b9c03642f570d2e5e26b7f7c72 100644 (file)
@@ -434,7 +434,7 @@ static int ept_invalidate_emt_range(struct p2m_domain *p2m,
     unsigned int i, index;
     int wrc, rc = 0, ret = GUEST_TABLE_MAP_FAILED;
 
-    table = map_domain_page(_mfn(pagetable_get_pfn(p2m_get_pagetable(p2m))));
+    table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     for ( i = p2m->ept.wl; i > target; --i )
     {
         ret = ept_next_level(p2m, 1, &table, &gfn_remainder, i);
@@ -718,7 +718,7 @@ ept_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
            (target == 0));
     ASSERT(!p2m_is_foreign(p2mt) || target == 0);
 
-    table = map_domain_page(_mfn(pagetable_get_pfn(p2m_get_pagetable(p2m))));
+    table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
 
     ret = GUEST_TABLE_MAP_FAILED;
     for ( i = ept->wl; i > target; i-- )
@@ -915,7 +915,8 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m,
                            p2m_query_t q, unsigned int *page_order,
                            bool_t *sve)
 {
-    ept_entry_t *table = map_domain_page(_mfn(pagetable_get_pfn(p2m_get_pagetable(p2m))));
+    ept_entry_t *table =
+        map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     unsigned long gfn = gfn_x(gfn_);
     unsigned long gfn_remainder = gfn;
     ept_entry_t *ept_entry;
@@ -1025,7 +1026,8 @@ void ept_walk_table(struct domain *d, unsigned long gfn)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     struct ept_data *ept = &p2m->ept;
-    ept_entry_t *table = map_domain_page(_mfn(pagetable_get_pfn(p2m_get_pagetable(p2m))));
+    ept_entry_t *table =
+        map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
     unsigned long gfn_remainder = gfn;
 
     int i;
@@ -1324,7 +1326,7 @@ static void ept_dump_p2m_table(unsigned char key)
             char c = 0;
 
             gfn_remainder = gfn;
-            table = map_domain_page(_mfn(pagetable_get_pfn(p2m_get_pagetable(p2m))));
+            table = map_domain_page(pagetable_get_mfn(p2m_get_pagetable(p2m)));
 
             for ( i = ept->wl; i > 0; i-- )
             {
index 1e42e1d8ab1b6b0ef27e151eb3a3e86b41144b84..e44fbb2f6724faa71d409564e930bc32b344ebea 100644 (file)
@@ -3391,7 +3391,8 @@ static int sh_page_fault(struct vcpu *v,
             int i;
             for ( i = 0; i < 4; i++ )
             {
-                mfn_t smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+                mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+
                 if ( mfn_valid(smfn) && (mfn_x(smfn) != 0) )
                 {
                     used |= (mfn_to_page(smfn)->v.sh.back == mfn_x(gmfn));
@@ -4645,7 +4646,7 @@ static void sh_pagetable_dying(struct vcpu *v, paddr_t gpa)
             if ( pagetable_is_null(v->arch.shadow_table[i]) )
                 smfn = INVALID_MFN;
             else
-                smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
+                smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
         }
         else
         {