ia64/xen-unstable

changeset 6322:b6ededee6dc9

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@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sun Aug 21 17:06:08 2005 +0000 (2005-08-21)
parents eb2c985e88be
children de5d85a66751 473af43ac65b
files linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c xen/arch/ia64/grant_table.c xen/common/grant_table.c xen/include/public/dom0_ops.h xen/include/public/grant_table.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sun Aug 21 16:49:54 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sun Aug 21 17:06:08 2005 +0000
     1.3 @@ -431,7 +431,7 @@ static void dispatch_rw_block_io(blkif_t
     1.4          }
     1.5  
     1.6          phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
     1.7 -            FOREIGN_FRAME(map[i].dev_bus_addr);
     1.8 +            FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
     1.9  
    1.10          pending_handle(pending_idx, i) = map[i].handle;
    1.11      }
    1.12 @@ -441,8 +441,7 @@ static void dispatch_rw_block_io(blkif_t
    1.13      {
    1.14          fas         = req->frame_and_sects[i];
    1.15  #ifdef CONFIG_XEN_BLKDEV_GRANT
    1.16 -        seg[i].buf  = (map[i].dev_bus_addr << PAGE_SHIFT) |
    1.17 -                      (blkif_first_sect(fas) << 9);
    1.18 +        seg[i].buf  = map[i].dev_bus_addr | (blkif_first_sect(fas) << 9);
    1.19  #else
    1.20          seg[i].buf  = (fas & PAGE_MASK) | (blkif_first_sect(fas) << 9);
    1.21          seg[i].nsec = blkif_last_sect(fas) - blkif_first_sect(fas) + 1;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c	Sun Aug 21 16:49:54 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c	Sun Aug 21 17:06:08 2005 +0000
     2.3 @@ -5,7 +5,6 @@
     2.4   * Control interface between the driver and a character device.
     2.5   * 
     2.6   * Copyright (c) 2004, Andrew Warfield
     2.7 - *
     2.8   */
     2.9  
    2.10  #include <linux/config.h>
    2.11 @@ -535,8 +534,8 @@ int blktap_write_fe_ring(blkif_request_t
    2.12          /* Set the necessary mappings in p2m and in the VM_FOREIGN 
    2.13           * vm_area_struct to allow user vaddr -> struct page lookups
    2.14           * to work.  This is needed for direct IO to foreign pages. */
    2.15 -        phys_to_machine_mapping[__pa(kvaddr)>>PAGE_SHIFT] =
    2.16 -            FOREIGN_FRAME(map[i].dev_bus_addr);
    2.17 +        phys_to_machine_mapping[__pa(kvaddr) >> PAGE_SHIFT] =
    2.18 +            FOREIGN_FRAME(map[i].dev_bus_addr >> PAGE_SHIFT);
    2.19  
    2.20          offset = (uvaddr - blktap_vma->vm_start) >> PAGE_SHIFT;
    2.21          ((struct page **)blktap_vma->vm_private_data)[offset] =
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Sun Aug 21 16:49:54 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Sun Aug 21 17:06:08 2005 +0000
     3.3 @@ -768,7 +768,7 @@ static void net_tx_action(unsigned long 
     3.4              continue;
     3.5          }
     3.6          phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT] =
     3.7 -                             FOREIGN_FRAME(mop->dev_bus_addr);
     3.8 +                             FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT);
     3.9          grant_tx_ref[pending_idx] = mop->handle;
    3.10  #else
    3.11          if ( unlikely(mcl[0].result != 0) )
     4.1 --- a/xen/arch/ia64/grant_table.c	Sun Aug 21 16:49:54 2005 +0000
     4.2 +++ b/xen/arch/ia64/grant_table.c	Sun Aug 21 17:06:08 2005 +0000
     4.3 @@ -546,15 +546,6 @@ static int
     4.4      {
     4.5          frame = act->frame;
     4.6      }
     4.7 -    else if ( frame == GNTUNMAP_DEV_FROM_VIRT )
     4.8 -    {
     4.9 -        if ( !( flags & GNTMAP_device_map ) )
    4.10 -            PIN_FAIL(unmap_out, GNTST_bad_dev_addr,
    4.11 -                     "Bad frame number: frame not mapped for dev access.\n");
    4.12 -        frame = act->frame;
    4.13 -
    4.14 -        /* Frame will be unmapped for device access below if virt addr okay. */
    4.15 -    }
    4.16      else
    4.17      {
    4.18          if ( unlikely(frame != act->frame) )
    4.19 @@ -616,15 +607,6 @@ static int
    4.20          act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_hstr_inc
    4.21                                                : GNTPIN_hstw_inc;
    4.22  
    4.23 -        if ( frame == GNTUNMAP_DEV_FROM_VIRT )
    4.24 -        {
    4.25 -            act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_devr_inc
    4.26 -                                                  : GNTPIN_devw_inc;
    4.27 -
    4.28 -            map->ref_and_flags &= ~GNTMAP_device_map;
    4.29 -            (void)__put_user(0, &uop->dev_bus_addr);
    4.30 -        }
    4.31 -
    4.32          rc = 0;
    4.33          *va = virt;
    4.34      }
     5.1 --- a/xen/common/grant_table.c	Sun Aug 21 16:49:54 2005 +0000
     5.2 +++ b/xen/common/grant_table.c	Sun Aug 21 17:06:08 2005 +0000
     5.3 @@ -76,7 +76,7 @@ static int
     5.4      grant_ref_t      ref,
     5.5      u16              dev_hst_ro_flags,
     5.6      u64              addr,
     5.7 -    u64             *pframe )            /* OUT */
     5.8 +    unsigned long   *pframe )            /* OUT */
     5.9  {
    5.10      domid_t               sdom;
    5.11      u16                   sflags;
    5.12 @@ -336,14 +336,15 @@ static int
    5.13      gnttab_map_grant_ref_t *uop,
    5.14      unsigned long *va)
    5.15  {
    5.16 -    domid_t               dom;
    5.17 -    grant_ref_t           ref;
    5.18 -    struct domain        *ld, *rd;
    5.19 -    struct vcpu          *led;
    5.20 -    u16                   dev_hst_ro_flags;
    5.21 -    int                   handle;
    5.22 -    u64                   frame = 0, addr;
    5.23 -    int                   rc;
    5.24 +    domid_t        dom;
    5.25 +    grant_ref_t    ref;
    5.26 +    struct domain *ld, *rd;
    5.27 +    struct vcpu   *led;
    5.28 +    u16            dev_hst_ro_flags;
    5.29 +    int            handle;
    5.30 +    u64            addr;
    5.31 +    unsigned long  frame = 0;
    5.32 +    int            rc;
    5.33  
    5.34      led = current;
    5.35      ld = led->domain;
    5.36 @@ -450,7 +451,7 @@ static int
    5.37              = (ref << MAPTRACK_REF_SHIFT) |
    5.38                (dev_hst_ro_flags & MAPTRACK_GNTMAP_MASK);
    5.39  
    5.40 -        (void)__put_user(frame, &uop->dev_bus_addr);
    5.41 +        (void)__put_user((u64)frame << PAGE_SHIFT, &uop->dev_bus_addr);
    5.42  
    5.43          if ( ( dev_hst_ro_flags & GNTMAP_host_map ) &&
    5.44               !( dev_hst_ro_flags & GNTMAP_contains_pte) )
    5.45 @@ -492,28 +493,31 @@ static int
    5.46      gnttab_unmap_grant_ref_t *uop,
    5.47      unsigned long *va)
    5.48  {
    5.49 -    domid_t        dom;
    5.50 -    grant_ref_t    ref;
    5.51 -    u16            handle;
    5.52 -    struct domain *ld, *rd;
    5.53 +    domid_t          dom;
    5.54 +    grant_ref_t      ref;
    5.55 +    u16              handle;
    5.56 +    struct domain   *ld, *rd;
    5.57      active_grant_entry_t *act;
    5.58 -    grant_entry_t *sha;
    5.59 +    grant_entry_t   *sha;
    5.60      grant_mapping_t *map;
    5.61 -    u16            flags;
    5.62 -    s16            rc = 1;
    5.63 -    u64            frame, addr;
    5.64 +    u16              flags;
    5.65 +    s16              rc = 1;
    5.66 +    u64              addr, dev_bus_addr;
    5.67 +    unsigned long    frame;
    5.68  
    5.69      ld = current->domain;
    5.70  
    5.71      /* Bitwise-OR avoids short-circuiting which screws control flow. */
    5.72      if ( unlikely(__get_user(addr, &uop->host_addr) |
    5.73 -                  __get_user(frame, &uop->dev_bus_addr) |
    5.74 +                  __get_user(dev_bus_addr, &uop->dev_bus_addr) |
    5.75                    __get_user(handle, &uop->handle)) )
    5.76      {
    5.77          DPRINTK("Fault while reading gnttab_unmap_grant_ref_t.\n");
    5.78          return -EFAULT; /* don't set status */
    5.79      }
    5.80  
    5.81 +    frame = (unsigned long)(dev_bus_addr >> PAGE_SHIFT);
    5.82 +
    5.83      map = &ld->grant_table->maptrack[handle];
    5.84  
    5.85      if ( unlikely(handle >= ld->grant_table->maptrack_limit) ||
    5.86 @@ -552,15 +556,6 @@ static int
    5.87      {
    5.88          frame = act->frame;
    5.89      }
    5.90 -    else if ( frame == GNTUNMAP_DEV_FROM_VIRT )
    5.91 -    {
    5.92 -        if ( !( flags & GNTMAP_device_map ) )
    5.93 -            PIN_FAIL(unmap_out, GNTST_bad_dev_addr,
    5.94 -                     "Bad frame number: frame not mapped for dev access.\n");
    5.95 -        frame = act->frame;
    5.96 -
    5.97 -        /* Frame will be unmapped for device access below if virt addr okay. */
    5.98 -    }
    5.99      else
   5.100      {
   5.101          if ( unlikely(frame != act->frame) )
   5.102 @@ -596,15 +591,6 @@ static int
   5.103          act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_hstr_inc
   5.104                                                : GNTPIN_hstw_inc;
   5.105  
   5.106 -        if ( frame == GNTUNMAP_DEV_FROM_VIRT )
   5.107 -        {
   5.108 -            act->pin -= (flags & GNTMAP_readonly) ? GNTPIN_devr_inc
   5.109 -                                                  : GNTPIN_devw_inc;
   5.110 -
   5.111 -            map->ref_and_flags &= ~GNTMAP_device_map;
   5.112 -            (void)__put_user(0, &uop->dev_bus_addr);
   5.113 -        }
   5.114 -
   5.115          rc = 0;
   5.116          if ( !( flags & GNTMAP_contains_pte) )
   5.117              *va = addr;
     6.1 --- a/xen/include/public/dom0_ops.h	Sun Aug 21 16:49:54 2005 +0000
     6.2 +++ b/xen/include/public/dom0_ops.h	Sun Aug 21 17:06:08 2005 +0000
     6.3 @@ -19,7 +19,7 @@
     6.4   * This makes sure that old versions of dom0 tools will stop working in a
     6.5   * well-defined way (rather than crashing the machine, for instance).
     6.6   */
     6.7 -#define DOM0_INTERFACE_VERSION   0xAAAA100F
     6.8 +#define DOM0_INTERFACE_VERSION   0xAAAA1010
     6.9  
    6.10  /************************************************************************/
    6.11  
     7.1 --- a/xen/include/public/grant_table.h	Sun Aug 21 16:49:54 2005 +0000
     7.2 +++ b/xen/include/public/grant_table.h	Sun Aug 21 17:06:08 2005 +0000
     7.3 @@ -183,8 +183,6 @@ typedef struct gnttab_unmap_grant_ref {
     7.4      s16         status;               /* GNTST_* */
     7.5  } gnttab_unmap_grant_ref_t;
     7.6  
     7.7 -#define GNTUNMAP_DEV_FROM_VIRT (~0U)
     7.8 -
     7.9  /*
    7.10   * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
    7.11   * <nr_frames> pages. The frame addresses are written to the <frame_list>.