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

[Xen-changelog] Remove unnecessary union in grant table map/unmap ops.



# HG changeset patch
# User akw27@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 390b130b34558d59b2e4362cd9ef05e2239f3187
# Parent  058e8087d36ab686e3ea7a873edf66d094b986d9
Remove unnecessary union in grant table map/unmap ops.

All addresses, host virtual and PTEs, are now passed in the cunningly
ambiguous "host_addr" field, rather than in an anonymous union.

diff -r 058e8087d36a -r 390b130b3455 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Sat Aug 13 
09:06:44 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Sat Aug 13 
15:47:53 2005
@@ -120,10 +120,10 @@
     {
         if ( BLKBACK_INVALID_HANDLE != ( handle = pending_handle(idx, i) ) )
         {
-            unmap[i].host_virt_addr = MMAP_VADDR(idx, i);
+            unmap[i].host_addr      = MMAP_VADDR(idx, i);
             unmap[i].dev_bus_addr   = 0;
             unmap[i].handle         = handle;
-            pending_handle(idx, i) = BLKBACK_INVALID_HANDLE;
+            pending_handle(idx, i)  = BLKBACK_INVALID_HANDLE;
             invcount++;
         }
     }
@@ -383,7 +383,7 @@
     {
         struct gnttab_map_grant_ref map;
 
-        map.host_virt_addr = MMAP_VADDR(pending_idx, 0);
+        map.host_addr = MMAP_VADDR(pending_idx, 0);
         map.flags = GNTMAP_host_map;
         map.ref = blkif_gref_from_fas(req->frame_and_sects[0]);
         map.dom = blkif->domid;
@@ -480,7 +480,7 @@
             goto bad_descriptor;
         preq.nr_sects += seg[i].nsec;
 
-        map[i].host_virt_addr = MMAP_VADDR(pending_idx, i);
+        map[i].host_addr = MMAP_VADDR(pending_idx, i);
         map[i].dom = blkif->domid;
         map[i].ref = blkif_gref_from_fas(fas);
         map[i].flags = GNTMAP_host_map;
diff -r 058e8087d36a -r 390b130b3455 
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Sat Aug 13 
09:06:44 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Sat Aug 13 
15:47:53 2005
@@ -42,7 +42,7 @@
      * must still be notified to the remote driver.
      */
 #ifdef CONFIG_XEN_BLKDEV_GRANT
-    op.host_virt_addr = blkif->shmem_vaddr;
+    op.host_addr      = blkif->shmem_vaddr;
     op.handle         = blkif->shmem_handle;
     op.dev_bus_addr   = 0;
     BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
@@ -204,7 +204,7 @@
 #else
     { /* Map: Use the Grant table reference */
         struct gnttab_map_grant_ref op;
-        op.host_virt_addr = VMALLOC_VMADDR(vma->addr);
+        op.host_addr      = VMALLOC_VMADDR(vma->addr);
         op.flags          = GNTMAP_host_map;
         op.ref            = ref;
         op.dom            = domid;
diff -r 058e8087d36a -r 390b130b3455 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sat Aug 13 
09:06:44 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sat Aug 13 
15:47:53 2005
@@ -511,9 +511,9 @@
     gop = unmap_ops;
     while (dc != dp) {
         pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
-        gop->host_virt_addr = MMAP_VADDR(pending_idx);
+        gop->host_addr    = MMAP_VADDR(pending_idx);
         gop->dev_bus_addr = 0;
-        gop->handle = grant_tx_ref[pending_idx];
+        gop->handle       = grant_tx_ref[pending_idx];
         grant_tx_ref[pending_idx] = GRANT_INVALID_REF;
         gop++;
     }
@@ -699,7 +699,7 @@
         /* Packets passed to netif_rx() must have some headroom. */
         skb_reserve(skb, 16);
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-        mop->host_virt_addr = MMAP_VADDR(pending_idx);
+        mop->host_addr = MMAP_VADDR(pending_idx);
         mop->dom = netif->domid;
         mop->ref = txreq.addr >> PAGE_SHIFT;
         mop->flags = GNTMAP_host_map | GNTMAP_readonly;
diff -r 058e8087d36a -r 390b130b3455 tools/libxc/xc_gnttab.c
--- a/tools/libxc/xc_gnttab.c   Sat Aug 13 09:06:44 2005
+++ b/tools/libxc/xc_gnttab.c   Sat Aug 13 15:47:53 2005
@@ -50,7 +50,7 @@
     struct gnttab_map_grant_ref op;
     int rc;
 
-    op.host_virt_addr = host_virt_addr;
+    op.host_addr      = host_virt_addr;
     op.dom            = (domid_t)dom;
     op.ref            = ref;
     op.flags          = flags;
@@ -75,7 +75,7 @@
     struct gnttab_unmap_grant_ref op;
     int rc;
 
-    op.host_virt_addr = host_virt_addr;
+    op.host_addr      = host_virt_addr;
     op.dev_bus_addr   = dev_bus_addr;
     op.handle         = handle;
  
diff -r 058e8087d36a -r 390b130b3455 xen/arch/ia64/grant_table.c
--- a/xen/arch/ia64/grant_table.c       Sat Aug 13 09:06:44 2005
+++ b/xen/arch/ia64/grant_table.c       Sat Aug 13 15:47:53 2005
@@ -355,7 +355,7 @@
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
     if ( unlikely(__get_user(dom, &uop->dom) |
                   __get_user(ref, &uop->ref) |
-                  __get_user(host_virt_addr, &uop->host_virt_addr) |
+                  __get_user(host_virt_addr, &uop->host_addr) |
                   __get_user(dev_hst_ro_flags, &uop->flags)) )
     {
         DPRINTK("Fault while reading gnttab_map_grant_ref_t.\n");
@@ -500,7 +500,7 @@
     ld = current->domain;
 
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
-    if ( unlikely(__get_user(virt, &uop->host_virt_addr) |
+    if ( unlikely(__get_user(virt, &uop->host_addr) |
                   __get_user(frame, &uop->dev_bus_addr) |
                   __get_user(handle, &uop->handle)) )
     {
diff -r 058e8087d36a -r 390b130b3455 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Sat Aug 13 09:06:44 2005
+++ b/xen/common/grant_table.c  Sat Aug 13 15:47:53 2005
@@ -97,7 +97,7 @@
      * Returns:
      * .  -ve: error
      * .    1: ok
-     * .    0: ok and TLB invalidate of host_virt_addr needed.
+     * .    0: ok and TLB invalidate of host_addr needed.
      *
      * On success, *pframe contains mfn.
      */
@@ -356,7 +356,7 @@
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
     if ( unlikely(__get_user(dom, &uop->dom) |
                   __get_user(ref, &uop->ref) |
-                  __get_user(addr, &uop->host_virt_addr) |
+                  __get_user(addr, &uop->host_addr) |
                   __get_user(dev_hst_ro_flags, &uop->flags)) )
     {
         DPRINTK("Fault while reading gnttab_map_grant_ref_t.\n");
@@ -512,7 +512,7 @@
     ld = current->domain;
 
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
-    if ( unlikely(__get_user(addr, &uop->host_virt_addr) |
+    if ( unlikely(__get_user(addr, &uop->host_addr) |
                   __get_user(frame, &uop->dev_bus_addr) |
                   __get_user(handle, &uop->handle)) )
     {
diff -r 058e8087d36a -r 390b130b3455 xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h  Sat Aug 13 09:06:44 2005
+++ b/xen/include/public/grant_table.h  Sat Aug 13 15:47:53 2005
@@ -142,7 +142,10 @@
  *  1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address
  *     via which I/O devices may access the granted frame.
  *  2. If GNTPIN_map_for_host is specified then a mapping will be added at
- *     virtual address <host_virt_addr> in the current address space.
+ *     either a host virtual address in the current address space, or at
+ *     a PTE at the specified machine address.  The type of mapping to
+ *     perform is selected through the GNTMAP_contains_pte flag, and the 
+ *     address is specified in <host_addr>.
  *  3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
  *     host mapping is destroyed by other means then it is *NOT* guaranteed
  *     to be accounted to the correct grant reference!
@@ -150,10 +153,7 @@
 #define GNTTABOP_map_grant_ref        0
 typedef struct gnttab_map_grant_ref {
     /* IN parameters. */
-    union {
-        memory_t  pte_addr;
-        memory_t  host_virt_addr;
-    };
+    memory_t    host_addr;
     domid_t     dom;
     grant_ref_t ref;
     u16         flags;                /* GNTMAP_* */
@@ -164,7 +164,7 @@
 
 /*
  * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
- * tracked by <handle>. If <host_virt_addr> or <dev_bus_addr> is zero, that
+ * tracked by <handle>. If <host_addr> or <dev_bus_addr> is zero, that
  * field is ignored. If non-zero, they must refer to a device/host mapping
  * that is tracked by <handle>
  * NOTES:
@@ -176,10 +176,7 @@
 #define GNTTABOP_unmap_grant_ref      1
 typedef struct gnttab_unmap_grant_ref {
     /* IN parameters. */
-    union {
-        memory_t  pte_addr;
-        memory_t  host_virt_addr;
-    };
+    memory_t    host_addr;
     memory_t    dev_bus_addr;
     u16         handle;
     /* OUT parameters. */

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