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 19 of 25] libxc: convert ia64 dom0vp interface to hyp

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 19 of 25] libxc: convert ia64 dom0vp interface to hypercall buffers
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 22 Oct 2010 15:16:01 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 22 Oct 2010 07:51:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1287756942@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 1287756891 -3600
# Node ID cfab497ee5a0c8ea0ed6b136c4d10f21c921eac0
# Parent  6624f76887ab0672598d99d4ab5a37815d5b4aa3
libxc: convert ia64 dom0vp interface to hypercall buffers

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

diff -r 6624f76887ab -r cfab497ee5a0 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 6624f76887ab -r cfab497ee5a0 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;
+    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

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