ia64/xen-unstable

changeset 6148:390b130b3455

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.
author akw27@arcadians.cl.cam.ac.uk
date Sat Aug 13 15:47:53 2005 +0000 (2005-08-13)
parents 058e8087d36a
children cbde8271c236
files linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c tools/libxc/xc_gnttab.c xen/arch/ia64/grant_table.c xen/common/grant_table.c xen/include/public/grant_table.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Aug 13 09:06:44 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Aug 13 15:47:53 2005 +0000
     1.3 @@ -120,10 +120,10 @@ static void fast_flush_area(int idx, int
     1.4      {
     1.5          if ( BLKBACK_INVALID_HANDLE != ( handle = pending_handle(idx, i) ) )
     1.6          {
     1.7 -            unmap[i].host_virt_addr = MMAP_VADDR(idx, i);
     1.8 +            unmap[i].host_addr      = MMAP_VADDR(idx, i);
     1.9              unmap[i].dev_bus_addr   = 0;
    1.10              unmap[i].handle         = handle;
    1.11 -            pending_handle(idx, i) = BLKBACK_INVALID_HANDLE;
    1.12 +            pending_handle(idx, i)  = BLKBACK_INVALID_HANDLE;
    1.13              invcount++;
    1.14          }
    1.15      }
    1.16 @@ -383,7 +383,7 @@ static void dispatch_probe(blkif_t *blki
    1.17      {
    1.18          struct gnttab_map_grant_ref map;
    1.19  
    1.20 -        map.host_virt_addr = MMAP_VADDR(pending_idx, 0);
    1.21 +        map.host_addr = MMAP_VADDR(pending_idx, 0);
    1.22          map.flags = GNTMAP_host_map;
    1.23          map.ref = blkif_gref_from_fas(req->frame_and_sects[0]);
    1.24          map.dom = blkif->domid;
    1.25 @@ -480,7 +480,7 @@ static void dispatch_rw_block_io(blkif_t
    1.26              goto bad_descriptor;
    1.27          preq.nr_sects += seg[i].nsec;
    1.28  
    1.29 -        map[i].host_virt_addr = MMAP_VADDR(pending_idx, i);
    1.30 +        map[i].host_addr = MMAP_VADDR(pending_idx, i);
    1.31          map[i].dom = blkif->domid;
    1.32          map[i].ref = blkif_gref_from_fas(fas);
    1.33          map[i].flags = GNTMAP_host_map;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Sat Aug 13 09:06:44 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Sat Aug 13 15:47:53 2005 +0000
     2.3 @@ -42,7 +42,7 @@ static void __blkif_disconnect_complete(
     2.4       * must still be notified to the remote driver.
     2.5       */
     2.6  #ifdef CONFIG_XEN_BLKDEV_GRANT
     2.7 -    op.host_virt_addr = blkif->shmem_vaddr;
     2.8 +    op.host_addr      = blkif->shmem_vaddr;
     2.9      op.handle         = blkif->shmem_handle;
    2.10      op.dev_bus_addr   = 0;
    2.11      BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
    2.12 @@ -204,7 +204,7 @@ void blkif_connect(blkif_be_connect_t *c
    2.13  #else
    2.14      { /* Map: Use the Grant table reference */
    2.15          struct gnttab_map_grant_ref op;
    2.16 -        op.host_virt_addr = VMALLOC_VMADDR(vma->addr);
    2.17 +        op.host_addr      = VMALLOC_VMADDR(vma->addr);
    2.18          op.flags          = GNTMAP_host_map;
    2.19          op.ref            = ref;
    2.20          op.dom            = domid;
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Sat Aug 13 09:06:44 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Sat Aug 13 15:47:53 2005 +0000
     3.3 @@ -511,9 +511,9 @@ inline static void net_tx_action_dealloc
     3.4      gop = unmap_ops;
     3.5      while (dc != dp) {
     3.6          pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
     3.7 -        gop->host_virt_addr = MMAP_VADDR(pending_idx);
     3.8 +        gop->host_addr    = MMAP_VADDR(pending_idx);
     3.9          gop->dev_bus_addr = 0;
    3.10 -        gop->handle = grant_tx_ref[pending_idx];
    3.11 +        gop->handle       = grant_tx_ref[pending_idx];
    3.12          grant_tx_ref[pending_idx] = GRANT_INVALID_REF;
    3.13          gop++;
    3.14      }
    3.15 @@ -699,7 +699,7 @@ static void net_tx_action(unsigned long 
    3.16          /* Packets passed to netif_rx() must have some headroom. */
    3.17          skb_reserve(skb, 16);
    3.18  #ifdef CONFIG_XEN_NETDEV_GRANT_TX
    3.19 -        mop->host_virt_addr = MMAP_VADDR(pending_idx);
    3.20 +        mop->host_addr = MMAP_VADDR(pending_idx);
    3.21          mop->dom = netif->domid;
    3.22          mop->ref = txreq.addr >> PAGE_SHIFT;
    3.23          mop->flags = GNTMAP_host_map | GNTMAP_readonly;
     4.1 --- a/tools/libxc/xc_gnttab.c	Sat Aug 13 09:06:44 2005 +0000
     4.2 +++ b/tools/libxc/xc_gnttab.c	Sat Aug 13 15:47:53 2005 +0000
     4.3 @@ -50,7 +50,7 @@ int xc_gnttab_map_grant_ref(int         
     4.4      struct gnttab_map_grant_ref op;
     4.5      int rc;
     4.6  
     4.7 -    op.host_virt_addr = host_virt_addr;
     4.8 +    op.host_addr      = host_virt_addr;
     4.9      op.dom            = (domid_t)dom;
    4.10      op.ref            = ref;
    4.11      op.flags          = flags;
    4.12 @@ -75,7 +75,7 @@ int xc_gnttab_unmap_grant_ref(int       
    4.13      struct gnttab_unmap_grant_ref op;
    4.14      int rc;
    4.15  
    4.16 -    op.host_virt_addr = host_virt_addr;
    4.17 +    op.host_addr      = host_virt_addr;
    4.18      op.dev_bus_addr   = dev_bus_addr;
    4.19      op.handle         = handle;
    4.20   
     5.1 --- a/xen/arch/ia64/grant_table.c	Sat Aug 13 09:06:44 2005 +0000
     5.2 +++ b/xen/arch/ia64/grant_table.c	Sat Aug 13 15:47:53 2005 +0000
     5.3 @@ -355,7 +355,7 @@ static int
     5.4      /* Bitwise-OR avoids short-circuiting which screws control flow. */
     5.5      if ( unlikely(__get_user(dom, &uop->dom) |
     5.6                    __get_user(ref, &uop->ref) |
     5.7 -                  __get_user(host_virt_addr, &uop->host_virt_addr) |
     5.8 +                  __get_user(host_virt_addr, &uop->host_addr) |
     5.9                    __get_user(dev_hst_ro_flags, &uop->flags)) )
    5.10      {
    5.11          DPRINTK("Fault while reading gnttab_map_grant_ref_t.\n");
    5.12 @@ -500,7 +500,7 @@ static int
    5.13      ld = current->domain;
    5.14  
    5.15      /* Bitwise-OR avoids short-circuiting which screws control flow. */
    5.16 -    if ( unlikely(__get_user(virt, &uop->host_virt_addr) |
    5.17 +    if ( unlikely(__get_user(virt, &uop->host_addr) |
    5.18                    __get_user(frame, &uop->dev_bus_addr) |
    5.19                    __get_user(handle, &uop->handle)) )
    5.20      {
     6.1 --- a/xen/common/grant_table.c	Sat Aug 13 09:06:44 2005 +0000
     6.2 +++ b/xen/common/grant_table.c	Sat Aug 13 15:47:53 2005 +0000
     6.3 @@ -97,7 +97,7 @@ static int
     6.4       * Returns:
     6.5       * .  -ve: error
     6.6       * .    1: ok
     6.7 -     * .    0: ok and TLB invalidate of host_virt_addr needed.
     6.8 +     * .    0: ok and TLB invalidate of host_addr needed.
     6.9       *
    6.10       * On success, *pframe contains mfn.
    6.11       */
    6.12 @@ -356,7 +356,7 @@ static int
    6.13      /* Bitwise-OR avoids short-circuiting which screws control flow. */
    6.14      if ( unlikely(__get_user(dom, &uop->dom) |
    6.15                    __get_user(ref, &uop->ref) |
    6.16 -                  __get_user(addr, &uop->host_virt_addr) |
    6.17 +                  __get_user(addr, &uop->host_addr) |
    6.18                    __get_user(dev_hst_ro_flags, &uop->flags)) )
    6.19      {
    6.20          DPRINTK("Fault while reading gnttab_map_grant_ref_t.\n");
    6.21 @@ -512,7 +512,7 @@ static int
    6.22      ld = current->domain;
    6.23  
    6.24      /* Bitwise-OR avoids short-circuiting which screws control flow. */
    6.25 -    if ( unlikely(__get_user(addr, &uop->host_virt_addr) |
    6.26 +    if ( unlikely(__get_user(addr, &uop->host_addr) |
    6.27                    __get_user(frame, &uop->dev_bus_addr) |
    6.28                    __get_user(handle, &uop->handle)) )
    6.29      {
     7.1 --- a/xen/include/public/grant_table.h	Sat Aug 13 09:06:44 2005 +0000
     7.2 +++ b/xen/include/public/grant_table.h	Sat Aug 13 15:47:53 2005 +0000
     7.3 @@ -142,7 +142,10 @@ typedef u16 grant_ref_t;
     7.4   *  1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address
     7.5   *     via which I/O devices may access the granted frame.
     7.6   *  2. If GNTPIN_map_for_host is specified then a mapping will be added at
     7.7 - *     virtual address <host_virt_addr> in the current address space.
     7.8 + *     either a host virtual address in the current address space, or at
     7.9 + *     a PTE at the specified machine address.  The type of mapping to
    7.10 + *     perform is selected through the GNTMAP_contains_pte flag, and the 
    7.11 + *     address is specified in <host_addr>.
    7.12   *  3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
    7.13   *     host mapping is destroyed by other means then it is *NOT* guaranteed
    7.14   *     to be accounted to the correct grant reference!
    7.15 @@ -150,10 +153,7 @@ typedef u16 grant_ref_t;
    7.16  #define GNTTABOP_map_grant_ref        0
    7.17  typedef struct gnttab_map_grant_ref {
    7.18      /* IN parameters. */
    7.19 -    union {
    7.20 -        memory_t  pte_addr;
    7.21 -        memory_t  host_virt_addr;
    7.22 -    };
    7.23 +    memory_t    host_addr;
    7.24      domid_t     dom;
    7.25      grant_ref_t ref;
    7.26      u16         flags;                /* GNTMAP_* */
    7.27 @@ -164,7 +164,7 @@ typedef struct gnttab_map_grant_ref {
    7.28  
    7.29  /*
    7.30   * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
    7.31 - * tracked by <handle>. If <host_virt_addr> or <dev_bus_addr> is zero, that
    7.32 + * tracked by <handle>. If <host_addr> or <dev_bus_addr> is zero, that
    7.33   * field is ignored. If non-zero, they must refer to a device/host mapping
    7.34   * that is tracked by <handle>
    7.35   * NOTES:
    7.36 @@ -176,10 +176,7 @@ typedef struct gnttab_map_grant_ref {
    7.37  #define GNTTABOP_unmap_grant_ref      1
    7.38  typedef struct gnttab_unmap_grant_ref {
    7.39      /* IN parameters. */
    7.40 -    union {
    7.41 -        memory_t  pte_addr;
    7.42 -        memory_t  host_virt_addr;
    7.43 -    };
    7.44 +    memory_t    host_addr;
    7.45      memory_t    dev_bus_addr;
    7.46      u16         handle;
    7.47      /* OUT parameters. */