]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
XXX x86: switch to use domheap page for page tables xen-pt-allocation-0.2
authorWei Liu <wei.liu2@citrix.com>
Tue, 5 Feb 2019 17:20:11 +0000 (17:20 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 5 Feb 2019 17:30:04 +0000 (17:30 +0000)
Modify all the _new APIs to handle domheap pages.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/mm.c

index e9899c48193038a8f48a8fca027a88be1828b92b..c3a5316e40a6d9a5a521f1dcceb6c2b9e9cd9841 100644 (file)
@@ -4727,10 +4727,10 @@ mfn_t alloc_xen_pagetable_new(void)
 {
     if ( system_state != SYS_STATE_early_boot )
     {
-        void *ptr = alloc_xenheap_page();
+        struct page_info *pg = alloc_domheap_page(NULL, 0);
 
-        BUG_ON(!hardware_domain && !ptr);
-        return virt_to_mfn(ptr);
+        BUG_ON(!hardware_domain && !pg);
+        return pg ? page_to_mfn(pg) : INVALID_MFN;
     }
 
     return alloc_boot_pages(1, 1);
@@ -4738,20 +4738,21 @@ mfn_t alloc_xen_pagetable_new(void)
 
 void *map_xen_pagetable_new(mfn_t mfn)
 {
-    return mfn_to_virt(mfn_x(mfn));
+    return map_domain_page(mfn);
 }
 
 /* v can point to an entry within a table or be NULL */
 void unmap_xen_pagetable_new(void *v)
 {
-    /* XXX still using xenheap page, no need to do anything.  */
+    if ( v )
+        unmap_domain_page((const void *)((unsigned long)v & PAGE_MASK));
 }
 
 /* mfn can be INVALID_MFN */
 void free_xen_pagetable_new(mfn_t mfn)
 {
     if ( system_state != SYS_STATE_early_boot && !mfn_eq(mfn, INVALID_MFN) )
-        free_xenheap_page(mfn_to_virt(mfn_x(mfn)));
+        free_domheap_page(mfn_to_page(mfn));
 }
 
 static DEFINE_SPINLOCK(map_pgdir_lock);