[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] New XENMAPSPACE_gmfn parameter for XENMEM_add_to_physmap.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1231501475 0
# Node ID bf847041d98f507ca005ceee47de3f49136fa52f
# Parent  f75567adad9bc2d47a075f44c9f13e18961b62ef
New XENMAPSPACE_gmfn parameter for XENMEM_add_to_physmap.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/ia64/xen/mm.c      |   66 ++++++++++++++++++++++----------------------
 xen/arch/x86/mm.c           |   12 ++++----
 xen/include/public/memory.h |    3 +-
 3 files changed, 42 insertions(+), 39 deletions(-)

diff -r f75567adad9b -r bf847041d98f xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Fri Jan 09 10:04:24 2009 +0000
+++ b/xen/arch/ia64/xen/mm.c    Fri Jan 09 11:44:35 2009 +0000
@@ -3295,38 +3295,40 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
 
             spin_unlock(&d->grant_table->lock);
             break;
-        case XENMAPSPACE_mfn:
-        {
-            if ( get_page_from_pagenr(xatp.idx, d) ) {
-                struct xen_ia64_memmap_info memmap_info;
-                efi_memory_desc_t md;
-                int ret;
-
-                mfn = xatp.idx;
-                page = mfn_to_page(mfn);
-
-                memmap_info.efi_memmap_size = sizeof(md);
-                memmap_info.efi_memdesc_size = sizeof(md);
-                memmap_info.efi_memdesc_version =
-                    EFI_MEMORY_DESCRIPTOR_VERSION;
-
-                md.type = EFI_CONVENTIONAL_MEMORY;
-                md.pad = 0;
-                md.phys_addr = xatp.gpfn << PAGE_SHIFT;
-                md.virt_addr = 0;
-                md.num_pages = 1UL << (PAGE_SHIFT - EFI_PAGE_SHIFT);
-                md.attribute = EFI_MEMORY_WB;
-
-                ret = __dom0vp_add_memdesc(d, &memmap_info, (char*)&md);
-                if (ret != 0) {
-                    put_page(page);
-                    rcu_unlock_domain(d);
-                    gdprintk(XENLOG_DEBUG,
-                             "%s:%d td %d gpfn 0x%lx mfn 0x%lx ret %d\n",
-                             __func__, __LINE__,
-                             d->domain_id, xatp.gpfn, xatp.idx, ret);
-                    return ret;
-                }
+        case XENMAPSPACE_gmfn:
+            xatp.idx = gmfn_to_mfn(d, xatp.idx);
+        case XENMAPSPACE_mfn: {
+            struct xen_ia64_memmap_info memmap_info;
+            efi_memory_desc_t md;
+            int ret;
+
+            if ( !get_page_from_pagenr(xatp.idx, d) )
+                break;
+
+            mfn = xatp.idx;
+            page = mfn_to_page(mfn);
+
+            memmap_info.efi_memmap_size = sizeof(md);
+            memmap_info.efi_memdesc_size = sizeof(md);
+            memmap_info.efi_memdesc_version =
+                EFI_MEMORY_DESCRIPTOR_VERSION;
+
+            md.type = EFI_CONVENTIONAL_MEMORY;
+            md.pad = 0;
+            md.phys_addr = xatp.gpfn << PAGE_SHIFT;
+            md.virt_addr = 0;
+            md.num_pages = 1UL << (PAGE_SHIFT - EFI_PAGE_SHIFT);
+            md.attribute = EFI_MEMORY_WB;
+
+            ret = __dom0vp_add_memdesc(d, &memmap_info, (char*)&md);
+            if (ret != 0) {
+                put_page(page);
+                rcu_unlock_domain(d);
+                gdprintk(XENLOG_DEBUG,
+                         "%s:%d td %d gpfn 0x%lx mfn 0x%lx ret %d\n",
+                         __func__, __LINE__,
+                         d->domain_id, xatp.gpfn, xatp.idx, ret);
+                return ret;
             }
             break;
         }
diff -r f75567adad9b -r bf847041d98f xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Jan 09 10:04:24 2009 +0000
+++ b/xen/arch/x86/mm.c Fri Jan 09 11:44:35 2009 +0000
@@ -3808,14 +3808,14 @@ long arch_memory_op(int op, XEN_GUEST_HA
 
             spin_unlock(&d->grant_table->lock);
             break;
+        case XENMAPSPACE_gmfn:
+            xatp.idx = gmfn_to_mfn(d, xatp.idx);
         case XENMAPSPACE_mfn:
-        {
-            if ( get_page_from_pagenr(xatp.idx, d) ) {
-                mfn = xatp.idx;
-                page = mfn_to_page(mfn);
-            }
+            if ( !get_page_from_pagenr(xatp.idx, d) )
+                break;
+            mfn = xatp.idx;
+            page = mfn_to_page(mfn);
             break;
-        }
         default:
             break;
         }
diff -r f75567adad9b -r bf847041d98f xen/include/public/memory.h
--- a/xen/include/public/memory.h       Fri Jan 09 10:04:24 2009 +0000
+++ b/xen/include/public/memory.h       Fri Jan 09 11:44:35 2009 +0000
@@ -206,7 +206,8 @@ struct xen_add_to_physmap {
     /* Source mapping space. */
 #define XENMAPSPACE_shared_info 0 /* shared info page */
 #define XENMAPSPACE_grant_table 1 /* grant table page */
-#define XENMAPSPACE_mfn         2 /* usual MFN */
+#define XENMAPSPACE_mfn         2 /* MFN */
+#define XENMAPSPACE_gmfn        3 /* GMFN */
     unsigned int space;
 
     /* Index into source mapping space. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.