WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 07 of 18] libxc: add xc_domain_add_to_physmap to wrap

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 07 of 18] libxc: add xc_domain_add_to_physmap to wrap XENMEM_add_to_physmap
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 12 Oct 2010 15:16:25 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 12 Oct 2010 07:24:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1286892978@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1286892402 -3600
# Node ID 901ec3e53b42d599fe8d8e148797cfc729774702
# Parent  d284f5cbda808a8ac816829bdd67c8a9f692c8e4
libxc: add xc_domain_add_to_physmap to wrap XENMEM_add_to_physmap

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r d284f5cbda80 -r 901ec3e53b42 tools/libxc/xc_dom_x86.c
--- a/tools/libxc/xc_dom_x86.c  Tue Oct 12 15:06:42 2010 +0100
+++ b/tools/libxc/xc_dom_x86.c  Tue Oct 12 15:06:42 2010 +0100
@@ -815,31 +815,26 @@ int arch_setup_bootlate(struct xc_dom_im
     else
     {
         /* paravirtualized guest with auto-translation */
-        struct xen_add_to_physmap xatp;
         int i;
 
         /* Map shared info frame into guest physmap. */
-        xatp.domid = dom->guest_domid;
-        xatp.space = XENMAPSPACE_shared_info;
-        xatp.idx = 0;
-        xatp.gpfn = dom->shared_info_pfn;
-        rc = xc_memory_op(dom->xch, XENMEM_add_to_physmap, &xatp);
+        rc = xc_domain_add_to_physmap(dom->xch, dom->guest_domid,
+                                      XENMAPSPACE_shared_info,
+                                      0, dom->shared_info_pfn);
         if ( rc != 0 )
         {
             xc_dom_panic(dom->xch, XC_INTERNAL_ERROR, "%s: mapping"
                          " shared_info failed (pfn=0x%" PRIpfn ", rc=%d)",
-                         __FUNCTION__, xatp.gpfn, rc);
+                         __FUNCTION__, dom->shared_info_pfn, rc);
             return rc;
         }
 
         /* Map grant table frames into guest physmap. */
         for ( i = 0; ; i++ )
         {
-            xatp.domid = dom->guest_domid;
-            xatp.space = XENMAPSPACE_grant_table;
-            xatp.idx = i;
-            xatp.gpfn = dom->total_pages + i;
-            rc = xc_memory_op(dom->xch, XENMEM_add_to_physmap, &xatp);
+            rc = xc_domain_add_to_physmap(dom->xch, dom->guest_domid,
+                                          XENMAPSPACE_grant_table,
+                                          i, dom->total_pages + i);
             if ( rc != 0 )
             {
                 if ( (i > 0) && (errno == EINVAL) )
@@ -849,7 +844,7 @@ int arch_setup_bootlate(struct xc_dom_im
                 }
                 xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
                              "%s: mapping grant tables failed " "(pfn=0x%"
-                             PRIpfn ", rc=%d)", __FUNCTION__, xatp.gpfn, rc);
+                             PRIpfn ", rc=%d)", __FUNCTION__, dom->total_pages 
+ i, rc);
                 return rc;
             }
         }
diff -r d284f5cbda80 -r 901ec3e53b42 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Tue Oct 12 15:06:42 2010 +0100
+++ b/tools/libxc/xc_domain.c   Tue Oct 12 15:06:42 2010 +0100
@@ -680,6 +680,21 @@ int xc_domain_decrease_reservation_exact
     }
 
     return err;
+}
+
+int xc_domain_add_to_physmap(xc_interface *xch,
+                             uint32_t domid,
+                             unsigned int space,
+                             unsigned long idx,
+                             xen_pfn_t gpfn)
+{
+    struct xen_add_to_physmap xatp = {
+        .domid = domid,
+        .space = space,
+        .idx = idx,
+        .gpfn = gpfn,
+    };
+    return xc_memory_op(xch, XENMEM_add_to_physmap, &xatp);
 }
 
 int xc_domain_populate_physmap(xc_interface *xch,
diff -r d284f5cbda80 -r 901ec3e53b42 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Tue Oct 12 15:06:42 2010 +0100
+++ b/tools/libxc/xenctrl.h     Tue Oct 12 15:06:42 2010 +0100
@@ -810,6 +810,12 @@ int xc_domain_decrease_reservation_exact
                                          unsigned long nr_extents,
                                          unsigned int extent_order,
                                          xen_pfn_t *extent_start);
+
+int xc_domain_add_to_physmap(xc_interface *xch,
+                             uint32_t domid,
+                             unsigned int space,
+                             unsigned long idx,
+                             xen_pfn_t gpfn);
 
 int xc_domain_populate_physmap(xc_interface *xch,
                                uint32_t domid,

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

<Prev in Thread] Current Thread [Next in Thread>