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

[Xen-devel] [PATCH 19 of 25] libxc: convert ia64 dom0vp interface to hypercall buffers



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1287650255 -3600
# Node ID 56cb1fbab19d9e8602244d56976877c13f52f91a
# Parent  19f7acc52f243f91f3ba539b0475dafbb0546ba0
libxc: convert ia64 dom0vp interface to hypercall buffers

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

diff -r 19f7acc52f24 -r 56cb1fbab19d tools/libxc/ia64/xc_dom_ia64_util.c
--- a/tools/libxc/ia64/xc_dom_ia64_util.c       Thu Oct 21 09:37:35 2010 +0100
+++ b/tools/libxc/ia64/xc_dom_ia64_util.c       Thu Oct 21 09:37:35 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 19f7acc52f24 -r 56cb1fbab19d tools/libxc/ia64/xc_ia64_stubs.c
--- a/tools/libxc/ia64/xc_ia64_stubs.c  Thu Oct 21 09:37:35 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_stubs.c  Thu Oct 21 09:37:35 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;
+    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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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