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

[Xen-changelog] Make grant-table dev_bus_addr really be an address, not a frame



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b6ededee6dc997ebe379aeb9c647ca6d43a96b8d
# Parent  eb2c985e88be573f10f5ef48ff93fa1b2c1f0927
Make grant-table dev_bus_addr really be an address, not a frame
number. Also get rid of GNTUNMAP_DEV_FROM_VIRT -- it makes little
sense and noone uses it.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r eb2c985e88be -r b6ededee6dc9 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Sun Aug 21 
16:49:54 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Sun Aug 21 
17:06:08 2005
@@ -431,7 +431,7 @@
         }
 
         phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
-            FOREIGN_FRAME(map[i].dev_bus_addr);
+            FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
 
         pending_handle(pending_idx, i) = map[i].handle;
     }
@@ -441,8 +441,7 @@
     {
         fas         = req->frame_and_sects[i];
 #ifdef CONFIG_XEN_BLKDEV_GRANT
-        seg[i].buf  = (map[i].dev_bus_addr << PAGE_SHIFT) |
-                      (blkif_first_sect(fas) << 9);
+        seg[i].buf  = map[i].dev_bus_addr | (blkif_first_sect(fas) << 9);
 #else
         seg[i].buf  = (fas & PAGE_MASK) | (blkif_first_sect(fas) << 9);
         seg[i].nsec = blkif_last_sect(fas) - blkif_first_sect(fas) + 1;
diff -r eb2c985e88be -r b6ededee6dc9 
linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c  Sun Aug 21 
16:49:54 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c  Sun Aug 21 
17:06:08 2005
@@ -5,7 +5,6 @@
  * Control interface between the driver and a character device.
  * 
  * Copyright (c) 2004, Andrew Warfield
- *
  */
 
 #include <linux/config.h>
@@ -535,8 +534,8 @@
         /* Set the necessary mappings in p2m and in the VM_FOREIGN 
          * vm_area_struct to allow user vaddr -> struct page lookups
          * to work.  This is needed for direct IO to foreign pages. */
-        phys_to_machine_mapping[__pa(kvaddr)>>PAGE_SHIFT] =
-            FOREIGN_FRAME(map[i].dev_bus_addr);
+        phys_to_machine_mapping[__pa(kvaddr) >> PAGE_SHIFT] =
+            FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
 
         offset = (uvaddr - blktap_vma->vm_start) >> PAGE_SHIFT;
         ((struct page **)blktap_vma->vm_private_data)[offset] =
diff -r eb2c985e88be -r b6ededee6dc9 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sun Aug 21 
16:49:54 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Sun Aug 21 
17:06:08 2005
@@ -768,7 +768,7 @@
             continue;
         }
         phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT] =
-                             FOREIGN_FRAME(mop->dev_bus_addr);
+                             FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT);
         grant_tx_ref[pending_idx] = mop->handle;
 #else
         if ( unlikely(mcl[0].result != 0) )
diff -r eb2c985e88be -r b6ededee6dc9 xen/arch/ia64/grant_table.c
--- a/xen/arch/ia64/grant_table.c       Sun Aug 21 16:49:54 2005
+++ b/xen/arch/ia64/grant_table.c       Sun Aug 21 17:06:08 2005
@@ -546,15 +546,6 @@
     {
         frame = act->frame;
     }
-    else if ( frame == GNTUNMAP_DEV_FROM_VIRT )
-    {
-        if ( !( flags & GNTMAP_device_map ) )
-            PIN_FAIL(unmap_out, GNTST_bad_dev_addr,
-                     "Bad frame number: frame not mapped for dev access.\n");
-        frame = act->frame;
-
-        /* Frame will be unmapped for device access below if virt addr okay. */
-    }
     else
     {
         if ( unlikely(frame != act->frame) )
@@ -615,15 +606,6 @@
 
         act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_hstr_inc
                                               : GNTPIN_hstw_inc;
-
-        if ( frame == GNTUNMAP_DEV_FROM_VIRT )
-        {
-            act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_devr_inc
-                                                  : GNTPIN_devw_inc;
-
-            map->ref_and_flags &= ~GNTMAP_device_map;
-            (void)__put_user(0, &uop->dev_bus_addr);
-        }
 
         rc = 0;
         *va = virt;
diff -r eb2c985e88be -r b6ededee6dc9 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Sun Aug 21 16:49:54 2005
+++ b/xen/common/grant_table.c  Sun Aug 21 17:06:08 2005
@@ -76,7 +76,7 @@
     grant_ref_t      ref,
     u16              dev_hst_ro_flags,
     u64              addr,
-    u64             *pframe )            /* OUT */
+    unsigned long   *pframe )            /* OUT */
 {
     domid_t               sdom;
     u16                   sflags;
@@ -336,14 +336,15 @@
     gnttab_map_grant_ref_t *uop,
     unsigned long *va)
 {
-    domid_t               dom;
-    grant_ref_t           ref;
-    struct domain        *ld, *rd;
-    struct vcpu          *led;
-    u16                   dev_hst_ro_flags;
-    int                   handle;
-    u64                   frame = 0, addr;
-    int                   rc;
+    domid_t        dom;
+    grant_ref_t    ref;
+    struct domain *ld, *rd;
+    struct vcpu   *led;
+    u16            dev_hst_ro_flags;
+    int            handle;
+    u64            addr;
+    unsigned long  frame = 0;
+    int            rc;
 
     led = current;
     ld = led->domain;
@@ -450,7 +451,7 @@
             = (ref << MAPTRACK_REF_SHIFT) |
               (dev_hst_ro_flags & MAPTRACK_GNTMAP_MASK);
 
-        (void)__put_user(frame, &uop->dev_bus_addr);
+        (void)__put_user((u64)frame << PAGE_SHIFT, &uop->dev_bus_addr);
 
         if ( ( dev_hst_ro_flags & GNTMAP_host_map ) &&
              !( dev_hst_ro_flags & GNTMAP_contains_pte) )
@@ -492,27 +493,30 @@
     gnttab_unmap_grant_ref_t *uop,
     unsigned long *va)
 {
-    domid_t        dom;
-    grant_ref_t    ref;
-    u16            handle;
-    struct domain *ld, *rd;
+    domid_t          dom;
+    grant_ref_t      ref;
+    u16              handle;
+    struct domain   *ld, *rd;
     active_grant_entry_t *act;
-    grant_entry_t *sha;
+    grant_entry_t   *sha;
     grant_mapping_t *map;
-    u16            flags;
-    s16            rc = 1;
-    u64            frame, addr;
+    u16              flags;
+    s16              rc = 1;
+    u64              addr, dev_bus_addr;
+    unsigned long    frame;
 
     ld = current->domain;
 
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
     if ( unlikely(__get_user(addr, &uop->host_addr) |
-                  __get_user(frame, &uop->dev_bus_addr) |
+                  __get_user(dev_bus_addr, &uop->dev_bus_addr) |
                   __get_user(handle, &uop->handle)) )
     {
         DPRINTK("Fault while reading gnttab_unmap_grant_ref_t.\n");
         return -EFAULT; /* don't set status */
     }
+
+    frame = (unsigned long)(dev_bus_addr >> PAGE_SHIFT);
 
     map = &ld->grant_table->maptrack[handle];
 
@@ -551,15 +555,6 @@
     if ( frame == 0 )
     {
         frame = act->frame;
-    }
-    else if ( frame == GNTUNMAP_DEV_FROM_VIRT )
-    {
-        if ( !( flags & GNTMAP_device_map ) )
-            PIN_FAIL(unmap_out, GNTST_bad_dev_addr,
-                     "Bad frame number: frame not mapped for dev access.\n");
-        frame = act->frame;
-
-        /* Frame will be unmapped for device access below if virt addr okay. */
     }
     else
     {
@@ -595,15 +590,6 @@
 
         act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_hstr_inc
                                               : GNTPIN_hstw_inc;
-
-        if ( frame == GNTUNMAP_DEV_FROM_VIRT )
-        {
-            act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_devr_inc
-                                                  : GNTPIN_devw_inc;
-
-            map->ref_and_flags &= ~GNTMAP_device_map;
-            (void)__put_user(0, &uop->dev_bus_addr);
-        }
 
         rc = 0;
         if ( !( flags & GNTMAP_contains_pte) )
diff -r eb2c985e88be -r b6ededee6dc9 xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h     Sun Aug 21 16:49:54 2005
+++ b/xen/include/public/dom0_ops.h     Sun Aug 21 17:06:08 2005
@@ -19,7 +19,7 @@
  * This makes sure that old versions of dom0 tools will stop working in a
  * well-defined way (rather than crashing the machine, for instance).
  */
-#define DOM0_INTERFACE_VERSION   0xAAAA100F
+#define DOM0_INTERFACE_VERSION   0xAAAA1010
 
 /************************************************************************/
 
diff -r eb2c985e88be -r b6ededee6dc9 xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h  Sun Aug 21 16:49:54 2005
+++ b/xen/include/public/grant_table.h  Sun Aug 21 17:06:08 2005
@@ -183,8 +183,6 @@
     s16         status;               /* GNTST_* */
 } gnttab_unmap_grant_ref_t;
 
-#define GNTUNMAP_DEV_FROM_VIRT (~0U)
-
 /*
  * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
  * <nr_frames> pages. The frame addresses are written to the <frame_list>.

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