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

[Xen-changelog] [xen-unstable] libxc: convert ia64 dom0vp interface to hypercall buffers



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1287756891 -3600
# Node ID 3a26cd9636a96d0b86fcea5f443b830bd6733a49
# Parent  ad9d8b2218487a1187938e82a6a54e3ba0e9cbfa
libxc: convert ia64 dom0vp interface to hypercall buffers

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
---
 tools/libxc/ia64/xc_dom_ia64_util.c |   16 +++++++++-------
 tools/libxc/ia64/xc_ia64_stubs.c    |   34 +++++++++++++++++++---------------
 2 files changed, 28 insertions(+), 22 deletions(-)

diff -r ad9d8b221848 -r 3a26cd9636a9 tools/libxc/ia64/xc_dom_ia64_util.c
--- a/tools/libxc/ia64/xc_dom_ia64_util.c       Fri Oct 22 15:14:51 2010 +0100
+++ b/tools/libxc/ia64/xc_dom_ia64_util.c       Fri Oct 22 15:14:51 2010 +0100
@@ -36,19 +36,21 @@ xen_ia64_fpswa_revision(struct xc_dom_im
 {
     int ret;
     DECLARE_HYPERCALL;
-    hypercall.op     = __HYPERVISOR_ia64_dom0vp_op;
-    hypercall.arg[0] = IA64_DOM0VP_fpswa_revision;
-    hypercall.arg[1] = (unsigned long)revision;
+    DECLARE_HYPERCALL_BOUNCE(revision, sizeof(*revision), 
XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
 
-    if (lock_pages(revision, sizeof(*revision)) != 0) {
-        xc_interface *xch = dom->xch;
+    if (xc_hypercall_bounce_pre(dom->xch, revision) )
+    {
         PERROR("Could not lock memory for xen fpswa hypercall");
         return -1;
     }
 
+    hypercall.op     = __HYPERVISOR_ia64_dom0vp_op;
+    hypercall.arg[0] = IA64_DOM0VP_fpswa_revision;
+    hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(revision);
+
     ret = do_xen_hypercall(dom->xch, &hypercall);
-    
-    unlock_pages(revision, sizeof(*revision));
+
+    xc_hypercall_bounce_post(dom->xch, revision);
 
     return ret;
 }
diff -r ad9d8b221848 -r 3a26cd9636a9 tools/libxc/ia64/xc_ia64_stubs.c
--- a/tools/libxc/ia64/xc_ia64_stubs.c  Fri Oct 22 15:14:51 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_stubs.c  Fri Oct 22 15:14:51 2010 +0100
@@ -42,19 +42,24 @@ xc_ia64_get_memmap(xc_interface *xch,
                    uint32_t domid, char *buf, unsigned long bufsize)
 {
     privcmd_hypercall_t hypercall;
-    int ret;
+    DECLARE_HYPERCALL_BOUNCE(buf, bufsize, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+    int ret;
+
+    if ( xc_hypercall_bounce_pre(xch, pfn_buf) )
+    {
+        PERROR("xc_get_pfn_list: pfn_buf bounce failed");
+        return -1;
+    }
 
     hypercall.op = __HYPERVISOR_ia64_dom0vp_op;
     hypercall.arg[0] = IA64_DOM0VP_get_memmap;
     hypercall.arg[1] = domid;
-    hypercall.arg[2] = (unsigned long)buf;
+    hypercall.arg[2] = HYPERCALL_BUFFER_AS_ARG(buf);
     hypercall.arg[3] = bufsize;
     hypercall.arg[4] = 0;
 
-    if (lock_pages(buf, bufsize) != 0)
-        return -1;
     ret = do_xen_hypercall(xch, &hypercall);
-    unlock_pages(buf, bufsize);
+    xc_hypercall_bounce_post(xc, buf);
     return ret;
 }
 
@@ -142,6 +147,7 @@ xc_ia64_map_foreign_p2m(xc_interface *xc
                         struct xen_ia64_memmap_info *memmap_info,
                         unsigned long flags, unsigned long *p2m_size_p)
 {
+    DECLARE_HYPERCALL_BOUNCE(memmap_info, sizeof(*memmap_info) + 
memmap_info->efi_memmap_size, XC_HYPERCALL_BOUNCE_BUFFER_IN);
     unsigned long gpfn_max;
     unsigned long p2m_size;
     void *addr;
@@ -157,25 +163,23 @@ xc_ia64_map_foreign_p2m(xc_interface *xc
     addr = mmap(NULL, p2m_size, PROT_READ, MAP_SHARED, xch->fd, 0);
     if (addr == MAP_FAILED)
         return NULL;
+    if (xc_hypercall_bounce_pre(xc, memmap_info)) {
+        saved_errno = errno;
+        munmap(addr, p2m_size);
+        errno = saved_errno;
+        return NULL;
+    }
 
     hypercall.op = __HYPERVISOR_ia64_dom0vp_op;
     hypercall.arg[0] = IA64_DOM0VP_expose_foreign_p2m;
     hypercall.arg[1] = (unsigned long)addr;
     hypercall.arg[2] = dom;
-    hypercall.arg[3] = (unsigned long)memmap_info;
+    hypercall.arg[3] = HYPERCALL_BUFFER_AS_ARG(memmap_info);
     hypercall.arg[4] = flags;
 
-    if (lock_pages(memmap_info,
-                   sizeof(*memmap_info) + memmap_info->efi_memmap_size) != 0) {
-        saved_errno = errno;
-        munmap(addr, p2m_size);
-        errno = saved_errno;
-        return NULL;
-    }
     ret = do_xen_hypercall(xch, &hypercall);
     saved_errno = errno;
-    unlock_pages(memmap_info,
-                 sizeof(*memmap_info) + memmap_info->efi_memmap_size);
+    xc_hypercall_bounce_post(xch, memmap_info);
     if (ret < 0) {
         munmap(addr, p2m_size);
         errno = saved_errno;

_______________________________________________
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®.