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 17 of 25] libxc: convert mmuext op interface over to

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 17 of 25] libxc: convert mmuext op interface over to hypercall buffers
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 21 Oct 2010 11:59:00 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 21 Oct 2010 04:27:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1287658723@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 1287650255 -3600
# Node ID 0d9e118f705231b0ac88b9ae98f996e0e62152c7
# Parent  38b752b683f3aec13669c1019e6637e3d3aeb434
libxc: convert mmuext op interface over to hypercall buffers

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

diff -r 38b752b683f3 -r 0d9e118f7052 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Thu Oct 21 09:37:35 2010 +0100
+++ b/tools/libxc/xc_private.c  Thu Oct 21 09:37:35 2010 +0100
@@ -343,23 +343,24 @@ int xc_mmuext_op(
     domid_t dom)
 {
     DECLARE_HYPERCALL;
+    DECLARE_HYPERCALL_BOUNCE(op, nr_ops*sizeof(*op), 
XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
     long ret = -EINVAL;
 
-    if ( hcall_buf_prep(xch, (void **)&op, nr_ops*sizeof(*op)) != 0 )
+    if ( xc_hypercall_bounce_pre(xch, op) )
     {
-        PERROR("Could not lock memory for Xen hypercall");
+        PERROR("Could not bounce memory for mmuext op hypercall");
         goto out1;
     }
 
     hypercall.op     = __HYPERVISOR_mmuext_op;
-    hypercall.arg[0] = (unsigned long)op;
+    hypercall.arg[0] = HYPERCALL_BUFFER_AS_ARG(op);
     hypercall.arg[1] = (unsigned long)nr_ops;
     hypercall.arg[2] = (unsigned long)0;
     hypercall.arg[3] = (unsigned long)dom;
 
     ret = do_xen_hypercall(xch, &hypercall);
 
-    hcall_buf_release(xch, (void **)&op, nr_ops*sizeof(*op));
+    xc_hypercall_bounce_post(xch, op);
 
  out1:
     return ret;
@@ -369,22 +370,23 @@ static int flush_mmu_updates(xc_interfac
 {
     int err = 0;
     DECLARE_HYPERCALL;
+    DECLARE_NAMED_HYPERCALL_BOUNCE(updates, mmu->updates, 
mmu->idx*sizeof(*mmu->updates), XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
 
     if ( mmu->idx == 0 )
         return 0;
 
+    if ( xc_hypercall_bounce_pre(xch, updates) )
+    {
+        PERROR("flush_mmu_updates: bounce buffer failed");
+        err = 1;
+        goto out;
+    }
+
     hypercall.op     = __HYPERVISOR_mmu_update;
-    hypercall.arg[0] = (unsigned long)mmu->updates;
+    hypercall.arg[0] = HYPERCALL_BUFFER_AS_ARG(updates);
     hypercall.arg[1] = (unsigned long)mmu->idx;
     hypercall.arg[2] = 0;
     hypercall.arg[3] = mmu->subject;
-
-    if ( lock_pages(xch, mmu->updates, sizeof(mmu->updates)) != 0 )
-    {
-        PERROR("flush_mmu_updates: mmu updates lock_pages failed");
-        err = 1;
-        goto out;
-    }
 
     if ( do_xen_hypercall(xch, &hypercall) < 0 )
     {
@@ -394,7 +396,7 @@ static int flush_mmu_updates(xc_interfac
 
     mmu->idx = 0;
 
-    unlock_pages(xch, mmu->updates, sizeof(mmu->updates));
+    xc_hypercall_bounce_post(xch, updates);
 
  out:
     return err;

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

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