x86/mm: Use mfn_t for make_cr3()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 30 Aug 2017 11:41:40 +0000 (12:41 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 1 Sep 2017 17:33:06 +0000 (18:33 +0100)
No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.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: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/mm.c
xen/arch/x86/mm/hap/hap.c
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/multi.c
xen/include/asm-x86/mm.h

index 4d7631917079aad9dcf25cb152d33372ed6f3cae..e5b0cceae40c51c80d611b6c0342a08b45718035 100644 (file)
@@ -498,9 +498,9 @@ void free_shared_domheap_page(struct page_info *page)
     free_domheap_page(page);
 }
 
-void make_cr3(struct vcpu *v, unsigned long mfn)
+void make_cr3(struct vcpu *v, mfn_t mfn)
 {
-    v->arch.cr3 = mfn << PAGE_SHIFT;
+    v->arch.cr3 = mfn_x(mfn) << PAGE_SHIFT;
 }
 
 void write_ptbase(struct vcpu *v)
@@ -518,7 +518,7 @@ void write_ptbase(struct vcpu *v)
  */
 void update_cr3(struct vcpu *v)
 {
-    unsigned long cr3_mfn;
+    mfn_t cr3_mfn;
 
     if ( paging_mode_enabled(v->domain) )
     {
@@ -527,9 +527,9 @@ void update_cr3(struct vcpu *v)
     }
 
     if ( !(v->arch.flags & TF_kernel_mode) )
-        cr3_mfn = pagetable_get_pfn(v->arch.guest_table_user);
+        cr3_mfn = pagetable_get_mfn(v->arch.guest_table_user);
     else
-        cr3_mfn = pagetable_get_pfn(v->arch.guest_table);
+        cr3_mfn = pagetable_get_mfn(v->arch.guest_table);
 
     make_cr3(v, cr3_mfn);
 }
index 15e4877dc4a9990283fd1450175ffc7c723e086f..6946fde2010731379833c1e181d2004a0397d1f4 100644 (file)
@@ -719,7 +719,7 @@ static void hap_update_paging_modes(struct vcpu *v)
     {
         mfn_t mmfn = hap_make_monitor_table(v);
         v->arch.monitor_table = pagetable_from_mfn(mmfn);
-        make_cr3(v, mfn_x(mmfn));
+        make_cr3(v, mmfn);
         hvm_update_host_cr3(v);
     }
 
index e8ee6dbed0edb5520d14373f4ba7d8095c9f0a7a..3926ed67b395d24d07c9b4a56d548be2fa3d7556 100644 (file)
@@ -2961,7 +2961,7 @@ static void sh_update_paging_modes(struct vcpu *v)
         {
             mfn_t mmfn = v->arch.paging.mode->shadow.make_monitor_table(v);
             v->arch.monitor_table = pagetable_from_mfn(mmfn);
-            make_cr3(v, mfn_x(mmfn));
+            make_cr3(v, mmfn);
             hvm_update_host_cr3(v);
         }
 
@@ -3004,7 +3004,7 @@ static void sh_update_paging_modes(struct vcpu *v)
                 /* Don't be running on the old monitor table when we
                  * pull it down!  Switch CR3, and warn the HVM code that
                  * its host cr3 has changed. */
-                make_cr3(v, mfn_x(new_mfn));
+                make_cr3(v, new_mfn);
                 if ( v == current )
                     write_ptbase(v);
                 hvm_update_host_cr3(v);
@@ -3380,9 +3380,9 @@ static int shadow_one_bit_disable(struct domain *d, u32 mode)
             if ( v->arch.paging.mode )
                 v->arch.paging.mode->shadow.detach_old_tables(v);
             if ( !(v->arch.flags & TF_kernel_mode) )
-                make_cr3(v, pagetable_get_pfn(v->arch.guest_table_user));
+                make_cr3(v, pagetable_get_mfn(v->arch.guest_table_user));
             else
-                make_cr3(v, pagetable_get_pfn(v->arch.guest_table));
+                make_cr3(v, pagetable_get_mfn(v->arch.guest_table));
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
             {
index c5c0af8f7dcc2544d46055173de2b6d5a81a8693..f7efe66e806f6cb8b2667114142d277365fdcf90 100644 (file)
@@ -4273,7 +4273,7 @@ sh_update_cr3(struct vcpu *v, int do_locking)
     ///
     if ( shadow_mode_external(d) )
     {
-        make_cr3(v, pagetable_get_pfn(v->arch.monitor_table));
+        make_cr3(v, pagetable_get_mfn(v->arch.monitor_table));
     }
     else // not shadow_mode_external...
     {
@@ -4287,7 +4287,7 @@ sh_update_cr3(struct vcpu *v, int do_locking)
         v->arch.cr3 = virt_to_maddr(&v->arch.paging.shadow.l3table);
 #else
         /* 4-on-4: Just use the shadow top-level directly */
-        make_cr3(v, pagetable_get_pfn(v->arch.shadow_table[0]));
+        make_cr3(v, pagetable_get_mfn(v->arch.shadow_table[0]));
 #endif
     }
 
index 97647dc4015ca1610bff719df4a640564588466d..bef45e8e9fb9638c5cb8c629b67ab425ca0e0be7 100644 (file)
@@ -537,7 +537,7 @@ void audit_domains(void);
 #endif
 
 int new_guest_cr3(mfn_t mfn);
-void make_cr3(struct vcpu *v, unsigned long mfn);
+void make_cr3(struct vcpu *v, mfn_t mfn);
 void update_cr3(struct vcpu *v);
 int vcpu_destroy_pagetables(struct vcpu *);
 void *do_page_walk(struct vcpu *v, unsigned long addr);