x86/pv: Switch {fill,zap}_ro_mpt() to using mfn_t
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 23 Aug 2017 17:51:59 +0000 (17:51 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 30 Aug 2017 10:03:08 +0000 (11:03 +0100)
And update all affected callers.  Fix the fill_ro_mpt() prototype to be bool
like its implementation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c
xen/arch/x86/mm.c
xen/arch/x86/mm/shadow/multi.c
xen/include/asm-x86/mm.h

index 9b4b9596d8ce9acfe5c90fc6a62670728409d281..57c44b1c297f7484a5398e3575ebd22fbca2fa84 100644 (file)
@@ -967,7 +967,7 @@ int arch_set_info_guest(
                 {
                     if ( (page->u.inuse.type_info & PGT_type_mask) ==
                          PGT_l4_page_table )
-                        done = !fill_ro_mpt(page_to_mfn(page));
+                        done = !fill_ro_mpt(_mfn(page_to_mfn(page)));
 
                     page_unlock(page);
                 }
@@ -1041,7 +1041,7 @@ int arch_set_info_guest(
         case 0:
             if ( !compat && !VM_ASSIST(d, m2p_strict) &&
                  !paging_mode_refcounts(d) )
-                fill_ro_mpt(cr3_gfn);
+                fill_ro_mpt(_mfn(cr3_gfn));
             break;
         default:
             if ( cr3_page == current->arch.old_guest_table )
@@ -1080,7 +1080,7 @@ int arch_set_info_guest(
                     break;
                 case 0:
                     if ( VM_ASSIST(d, m2p_strict) )
-                        zap_ro_mpt(cr3_gfn);
+                        zap_ro_mpt(_mfn(cr3_gfn));
                     break;
                 }
             }
index 791e5268755717eda3861c2abcf5f4b02792d441..11c5ae32b400c1aeb34c6ae651324b32cc82ef70 100644 (file)
@@ -1630,9 +1630,9 @@ void init_guest_l4_table(l4_pgentry_t l4tab[], const struct domain *d,
         l4tab[l4_table_offset(RO_MPT_VIRT_START)] = l4e_empty();
 }
 
-bool fill_ro_mpt(unsigned long mfn)
+bool fill_ro_mpt(mfn_t mfn)
 {
-    l4_pgentry_t *l4tab = map_domain_page(_mfn(mfn));
+    l4_pgentry_t *l4tab = map_domain_page(mfn);
     bool ret = false;
 
     if ( !l4e_get_intpte(l4tab[l4_table_offset(RO_MPT_VIRT_START)]) )
@@ -1646,9 +1646,9 @@ bool fill_ro_mpt(unsigned long mfn)
     return ret;
 }
 
-void zap_ro_mpt(unsigned long mfn)
+void zap_ro_mpt(mfn_t mfn)
 {
-    l4_pgentry_t *l4tab = map_domain_page(_mfn(mfn));
+    l4_pgentry_t *l4tab = map_domain_page(mfn);
 
     l4tab[l4_table_offset(RO_MPT_VIRT_START)] = l4e_empty();
     unmap_domain_page(l4tab);
@@ -2834,7 +2834,7 @@ int new_guest_cr3(unsigned long mfn)
     invalidate_shadow_ldt(curr, 0);
 
     if ( !VM_ASSIST(d, m2p_strict) && !paging_mode_refcounts(d) )
-        fill_ro_mpt(mfn);
+        fill_ro_mpt(_mfn(mfn));
     curr->arch.guest_table = pagetable_from_pfn(mfn);
     update_cr3(curr);
 
@@ -3208,7 +3208,7 @@ long do_mmuext_op(
                 }
 
                 if ( VM_ASSIST(currd, m2p_strict) )
-                    zap_ro_mpt(op.arg1.mfn);
+                    zap_ro_mpt(_mfn(op.arg1.mfn));
             }
 
             curr->arch.guest_table_user = pagetable_from_pfn(op.arg1.mfn);
index f0eabb6a8137741b1021e05d87afda16adf7dc89..c5c0af8f7dcc2544d46055173de2b6d5a81a8693 100644 (file)
@@ -4232,10 +4232,10 @@ sh_update_cr3(struct vcpu *v, int do_locking)
         mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[0]);
 
         if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
-            zap_ro_mpt(mfn_x(smfn));
+            zap_ro_mpt(smfn);
         else if ( (v->arch.flags & TF_kernel_mode) &&
                   !VM_ASSIST(d, m2p_strict) )
-            fill_ro_mpt(mfn_x(smfn));
+            fill_ro_mpt(smfn);
     }
 #else
 #error This should never happen
index b738c8939388864b5a3945777e120f943197eefd..5760e05e18fd3606b514c55ea4fd0e0ddfda8d88 100644 (file)
@@ -331,8 +331,8 @@ int free_page_type(struct page_info *page, unsigned long type,
 
 void init_guest_l4_table(l4_pgentry_t[], const struct domain *,
                          bool_t zap_ro_mpt);
-bool_t fill_ro_mpt(unsigned long mfn);
-void zap_ro_mpt(unsigned long mfn);
+bool fill_ro_mpt(mfn_t mfn);
+void zap_ro_mpt(mfn_t mfn);
 
 bool is_iomem_page(mfn_t mfn);