]> xenbits.xensource.com Git - people/hx242/xen.git/commitdiff
x86/domain_page: only enable the fast paths when there is direct map
authorHongyan Xia <hongyax@amazon.com>
Tue, 1 Oct 2019 09:50:24 +0000 (10:50 +0100)
committerHongyan Xia <hongyax@amazon.com>
Wed, 16 Oct 2019 12:25:06 +0000 (13:25 +0100)
Signed-off-by: Hongyan Xia <hongyax@amazon.com>
xen/arch/x86/domain_page.c

index 19c0ebe1b8ab109abc44b223dbe98d30c618417a..0105ad20fea378c2c251f5379ac2599cef1ae92e 100644 (file)
@@ -78,7 +78,7 @@ void *map_domain_page(mfn_t mfn)
     struct mapcache_vcpu *vcache;
     struct vcpu_maphash_entry *hashent;
 
-#ifdef NDEBUG
+#if defined(CONFIG_DIRECTMAP) && defined(NDEBUG)
     if ( mfn_x(mfn) <= PFN_DOWN(__pa(HYPERVISOR_VIRT_END - 1)) )
         return mfn_to_virt(mfn_x(mfn));
 #endif
@@ -191,8 +191,10 @@ void unmap_domain_page(const void *ptr)
     unsigned long va = (unsigned long)ptr, mfn, flags;
     struct vcpu_maphash_entry *hashent;
 
+#ifdef CONFIG_DIRECTMAP
     if ( va >= DIRECTMAP_VIRT_START )
         return;
+#endif
 
     if ( va >= FIXADDR_START && va < FIXADDR_TOP )
     {
@@ -252,7 +254,7 @@ int mapcache_domain_init(struct domain *d)
     struct mapcache_domain *dcache = &d->arch.mapcache;
     unsigned int bitmap_pages;
 
-#ifdef NDEBUG
+#if defined(CONFIG_DIRECTMAP) && defined(NDEBUG)
     if ( !mem_hotplug && max_page <= PFN_DOWN(__pa(HYPERVISOR_VIRT_END - 1)) )
         return 0;
 #endif
@@ -323,7 +325,7 @@ void *map_domain_page_global(mfn_t mfn)
              system_state < SYS_STATE_active) ||
             local_irq_is_enabled()));
 
-#ifdef NDEBUG
+#if defined(CONFIG_DIRECTMAP) && defined(NDEBUG)
     if ( mfn_x(mfn) <= PFN_DOWN(__pa(HYPERVISOR_VIRT_END - 1)) )
         return mfn_to_virt(mfn_x(mfn));
 #endif
@@ -335,8 +337,10 @@ void unmap_domain_page_global(const void *ptr)
 {
     unsigned long va = (unsigned long)ptr;
 
+#ifdef CONFIG_DIRECTMAP
     if ( va >= DIRECTMAP_VIRT_START )
         return;
+#endif
 
     ASSERT(va >= VMAP_VIRT_START && va < VMAP_VIRT_END);
 
@@ -349,8 +353,10 @@ mfn_t domain_page_map_to_mfn(const void *ptr)
     unsigned long va = (unsigned long)ptr;
     l1_pgentry_t l1e;
 
+#ifdef CONFIG_DIRECTMAP
     if ( va >= DIRECTMAP_VIRT_START )
         return _mfn(virt_to_mfn(ptr));
+#endif
 
     if ( va >= VMAP_VIRT_START && va < VMAP_VIRT_END )
     {