ia64/xen-unstable

changeset 6900:c21f47a03225

Start cleaning up grant tables. gnttab_donate now called
gnttab_transfer, with slightly rationalised interface and
simpler implementation inside Xen. This is a tiny chip off
the tip of a very big iceberg. :-)

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Sep 15 17:09:50 2005 +0000 (2005-09-15)
parents 2f5537317988
children cedfbb032261
files linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/include/asm-xen/gnttab.h xen/arch/ia64/xen/grant_table.c xen/common/grant_table.c xen/include/public/grant_table.h xen/include/xen/grant_table.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c	Thu Sep 15 16:55:32 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c	Thu Sep 15 17:09:50 2005 +0000
     1.3 @@ -182,14 +182,14 @@ gnttab_end_foreign_access(grant_ref_t re
     1.4  }
     1.5  
     1.6  int
     1.7 -gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn)
     1.8 +gnttab_grant_foreign_transfer(domid_t domid)
     1.9  {
    1.10      int ref;
    1.11  
    1.12      if ( unlikely((ref = get_free_entry()) == -1) )
    1.13          return -ENOSPC;
    1.14  
    1.15 -    shared[ref].frame = pfn;
    1.16 +    shared[ref].frame = 0;
    1.17      shared[ref].domid = domid;
    1.18      wmb();
    1.19      shared[ref].flags = GTF_accept_transfer;
    1.20 @@ -198,10 +198,9 @@ gnttab_grant_foreign_transfer(domid_t do
    1.21  }
    1.22  
    1.23  void
    1.24 -gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid,
    1.25 -				  unsigned long pfn)
    1.26 +gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid)
    1.27  {
    1.28 -    shared[ref].frame = pfn;
    1.29 +    shared[ref].frame = 0;
    1.30      shared[ref].domid = domid;
    1.31      wmb();
    1.32      shared[ref].flags = GTF_accept_transfer;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Sep 15 16:55:32 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Sep 15 17:09:50 2005 +0000
     2.3 @@ -42,7 +42,7 @@ static multicall_entry_t rx_mcl[NETIF_RX
     2.4  static mmu_update_t rx_mmu[NETIF_RX_RING_SIZE];
     2.5  
     2.6  #ifdef CONFIG_XEN_NETDEV_GRANT
     2.7 -static gnttab_donate_t grant_rx_op[MAX_PENDING_REQS];
     2.8 +static gnttab_transfer_t grant_rx_op[MAX_PENDING_REQS];
     2.9  #else
    2.10  static struct mmuext_op rx_mmuext[NETIF_RX_RING_SIZE];
    2.11  #endif
    2.12 @@ -233,7 +233,7 @@ static void net_rx_action(unsigned long 
    2.13      multicall_entry_t *mcl;
    2.14      mmu_update_t *mmu;
    2.15  #ifdef CONFIG_XEN_NETDEV_GRANT
    2.16 -    gnttab_donate_t *gop;
    2.17 +    gnttab_transfer_t *gop;
    2.18  #else
    2.19      struct mmuext_op *mmuext;
    2.20  #endif
    2.21 @@ -281,7 +281,7 @@ static void net_rx_action(unsigned long 
    2.22  #ifdef CONFIG_XEN_NETDEV_GRANT
    2.23          gop->mfn = old_mfn;
    2.24          gop->domid = netif->domid;
    2.25 -        gop->handle = netif->rx->ring[
    2.26 +        gop->ref = netif->rx->ring[
    2.27          MASK_NETIF_RX_IDX(netif->rx_resp_prod_copy)].req.gref;
    2.28          netif->rx_resp_prod_copy++;
    2.29          gop++;
    2.30 @@ -331,14 +331,14 @@ static void net_rx_action(unsigned long 
    2.31  
    2.32      mcl = rx_mcl;
    2.33  #ifdef CONFIG_XEN_NETDEV_GRANT
    2.34 -    if(HYPERVISOR_grant_table_op(GNTTABOP_donate, grant_rx_op, 
    2.35 +    if(HYPERVISOR_grant_table_op(GNTTABOP_transfer, grant_rx_op, 
    2.36                                   gop - grant_rx_op)) { 
    2.37          /* 
    2.38          ** The other side has given us a bad grant ref, or has no headroom, 
    2.39          ** or has gone away. Unfortunately the current grant table code 
    2.40          ** doesn't inform us which is the case, so not much we can do. 
    2.41          */
    2.42 -        DPRINTK("net_rx: donate to DOM%u failed; dropping (up to) %d "
    2.43 +        DPRINTK("net_rx: transfer to DOM%u failed; dropping (up to) %d "
    2.44                  "packets.\n", grant_rx_op[0].domid, gop - grant_rx_op); 
    2.45      }
    2.46      gop = grant_rx_op;
    2.47 @@ -371,7 +371,7 @@ static void net_rx_action(unsigned long 
    2.48          status = NETIF_RSP_OKAY;
    2.49  #ifdef CONFIG_XEN_NETDEV_GRANT
    2.50          if(gop->status != 0) { 
    2.51 -            DPRINTK("Bad status %d from grant donate to DOM%u\n", 
    2.52 +            DPRINTK("Bad status %d from grant transfer to DOM%u\n", 
    2.53                      gop->status, netif->domid);
    2.54              /* XXX SMH: should free 'old_mfn' here */
    2.55              status = NETIF_RSP_ERROR; 
    2.56 @@ -748,11 +748,6 @@ static void net_tx_action(unsigned long 
    2.57  
    2.58          /* Check the remap error code. */
    2.59  #ifdef CONFIG_XEN_NETDEV_GRANT
    2.60 -        /* 
    2.61 -           XXX SMH: error returns from grant operations are pretty poorly
    2.62 -           specified/thought out, but the below at least conforms with 
    2.63 -           what the rest of the code uses. 
    2.64 -        */
    2.65          if ( unlikely(mop->handle < 0) )
    2.66          {
    2.67              printk(KERN_ALERT "#### netback grant fails\n");
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 15 16:55:32 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 15 17:09:50 2005 +0000
     3.3 @@ -378,8 +378,7 @@ static void network_alloc_rx_buffers(str
     3.4              BUG();
     3.5          }
     3.6          grant_rx_ref[id] = ref;
     3.7 -        gnttab_grant_foreign_transfer_ref(ref, np->backend_id,
     3.8 -                                          virt_to_mfn(skb->head));
     3.9 +        gnttab_grant_foreign_transfer_ref(ref, np->backend_id);
    3.10          np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.gref = ref;
    3.11  #endif
    3.12          rx_pfn_array[i] = virt_to_mfn(skb->head);
    3.13 @@ -825,10 +824,8 @@ static void network_connect(struct net_d
    3.14      for (requeue_idx = 0, i = 1; i <= NETIF_RX_RING_SIZE; i++) { 
    3.15          if ((unsigned long)np->rx_skbs[i] >= __PAGE_OFFSET) {
    3.16  #ifdef CONFIG_XEN_NETDEV_GRANT 
    3.17 -            /* Reinstate the grant ref so backend can 'donate' mfn to us. */
    3.18 -            gnttab_grant_foreign_transfer_ref(grant_rx_ref[i], np->backend_id,
    3.19 -                                              virt_to_mfn(np->rx_skbs[i]->head)
    3.20 -                );
    3.21 +            /* Reinstate the grant ref so backend can transfer mfn to us. */
    3.22 +            gnttab_grant_foreign_transfer_ref(grant_rx_ref[i], np->backend_id);
    3.23              np->rx->ring[requeue_idx].req.gref = grant_rx_ref[i];
    3.24  #endif
    3.25              np->rx->ring[requeue_idx].req.id   = i;
     4.1 --- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h	Thu Sep 15 16:55:32 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h	Thu Sep 15 17:09:50 2005 +0000
     4.3 @@ -37,7 +37,7 @@ int gnttab_grant_foreign_access(domid_t 
     4.4  void gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
     4.5  void gnttab_end_foreign_access(grant_ref_t ref, int readonly);
     4.6  
     4.7 -int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
     4.8 +int gnttab_grant_foreign_transfer(domid_t domid);
     4.9  
    4.10  unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
    4.11  unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
    4.12 @@ -64,8 +64,7 @@ void gnttab_request_free_callback(struct
    4.13  void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
    4.14  				     unsigned long frame, int readonly);
    4.15  
    4.16 -void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
    4.17 -				       unsigned long pfn);
    4.18 +void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid);
    4.19  
    4.20  #ifdef __ia64__
    4.21  #define gnttab_map_vaddr(map) __va(map.dev_bus_addr)
     5.1 --- a/xen/arch/ia64/xen/grant_table.c	Thu Sep 15 16:55:32 2005 +0000
     5.2 +++ b/xen/arch/ia64/xen/grant_table.c	Thu Sep 15 17:09:50 2005 +0000
     5.3 @@ -851,7 +851,7 @@ gnttab_dump_table(gnttab_dump_table_t *u
     5.4  #endif
     5.5  
     5.6  static long
     5.7 -gnttab_donate(gnttab_donate_t *uop, unsigned int count)
     5.8 +gnttab_transfer(gnttab_transfer_t *uop, unsigned int count)
     5.9  {
    5.10      struct domain *d = current->domain;
    5.11      struct domain *e;
    5.12 @@ -865,27 +865,27 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    5.13      return GNTST_general_error;
    5.14  #else
    5.15      for (i = 0; i < count; i++) {
    5.16 -        gnttab_donate_t *gop = &uop[i];
    5.17 +        gnttab_transfer_t *gop = &uop[i];
    5.18  #if GRANT_DEBUG
    5.19 -        printk("gnttab_donate: i=%d mfn=%lx domid=%d gref=%08x\n",
    5.20 +        printk("gnttab_transfer: i=%d mfn=%lx domid=%d gref=%08x\n",
    5.21                 i, gop->mfn, gop->domid, gop->handle);
    5.22  #endif
    5.23          page = &frame_table[gop->mfn];
    5.24          
    5.25          if (unlikely(IS_XEN_HEAP_FRAME(page))) { 
    5.26 -            printk("gnttab_donate: xen heap frame mfn=%lx\n", 
    5.27 +            printk("gnttab_transfer: xen heap frame mfn=%lx\n", 
    5.28                     (unsigned long) gop->mfn);
    5.29              gop->status = GNTST_bad_virt_addr;
    5.30              continue;
    5.31          }
    5.32          if (unlikely(!pfn_valid(page_to_pfn(page)))) {
    5.33 -            printk("gnttab_donate: invalid pfn for mfn=%lx\n", 
    5.34 +            printk("gnttab_transfer: invalid pfn for mfn=%lx\n", 
    5.35                     (unsigned long) gop->mfn);
    5.36              gop->status = GNTST_bad_virt_addr;
    5.37              continue;
    5.38          }
    5.39          if (unlikely((e = find_domain_by_id(gop->domid)) == NULL)) {
    5.40 -            printk("gnttab_donate: can't find domain %d\n", gop->domid);
    5.41 +            printk("gnttab_transfer: can't find domain %d\n", gop->domid);
    5.42              gop->status = GNTST_bad_domain;
    5.43              continue;
    5.44          }
    5.45 @@ -905,7 +905,7 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    5.46              x = y;
    5.47              if (unlikely((x & (PGC_count_mask|PGC_allocated)) !=
    5.48                           (1 | PGC_allocated)) || unlikely(_nd != _d)) {
    5.49 -                printk("gnttab_donate: Bad page values %p: ed=%p(%u), sd=%p,"
    5.50 +                printk("gnttab_transfer: Bad page values %p: ed=%p(%u), sd=%p,"
    5.51                         " caf=%08x, taf=%" PRtype_info "\n", 
    5.52                         (void *) page_to_pfn(page),
    5.53                          d, d->domain_id, unpickle_domptr(_nd), x, 
    5.54 @@ -948,14 +948,14 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    5.55              break;
    5.56          }
    5.57          if (unlikely(test_bit(DOMFLAGS_DYING, &e->domain_flags))) {
    5.58 -            printk("gnttab_donate: target domain is dying\n");
    5.59 +            printk("gnttab_transfer: target domain is dying\n");
    5.60              spin_unlock(&e->page_alloc_lock);
    5.61              put_domain(e);
    5.62              result = GNTST_general_error;
    5.63              break;
    5.64          }
    5.65 -        if (unlikely(!gnttab_prepare_for_transfer(e, d, gop->handle))) {
    5.66 -            printk("gnttab_donate: gnttab_prepare_for_transfer fails\n");
    5.67 +        if (unlikely(!gnttab_prepare_for_transfer(e, d, gop->ref))) {
    5.68 +            printk("gnttab_transfer: gnttab_prepare_for_transfer fails\n");
    5.69              spin_unlock(&e->page_alloc_lock);
    5.70              put_domain(e);
    5.71              result = GNTST_general_error;
    5.72 @@ -965,10 +965,10 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    5.73          ASSERT(e->tot_pages <= e->max_pages);
    5.74          if (unlikely(test_bit(DOMFLAGS_DYING, &e->domain_flags)) ||
    5.75              unlikely(e->tot_pages == e->max_pages) ||
    5.76 -            unlikely(!gnttab_prepare_for_transfer(e, d, gop->handle))) {
    5.77 -            printk("gnttab_donate: Transferee has no reservation headroom (%d,"
    5.78 +            unlikely(!gnttab_prepare_for_transfer(e, d, gop->ref))) {
    5.79 +            printk("gnttab_transfer: Transferee has no reservation headroom (%d,"
    5.80                     "%d) or provided a bad grant ref (%08x) or is dying (%p)\n",
    5.81 -                   e->tot_pages, e->max_pages, gop->handle, e->d_flags);
    5.82 +                   e->tot_pages, e->max_pages, gop->ref, e->d_flags);
    5.83              spin_unlock(&e->page_alloc_lock);
    5.84              put_domain(e);
    5.85              result = GNTST_general_error;
    5.86 @@ -988,7 +988,7 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    5.87           * Transfer is all done: tell the guest about its new page
    5.88           * frame.
    5.89           */
    5.90 -        gnttab_notify_transfer(e, d, gop->handle, gop->mfn);
    5.91 +        gnttab_notify_transfer(e, d, gop->ref, gop->mfn);
    5.92          
    5.93          put_domain(e);
    5.94          
    5.95 @@ -1038,11 +1038,11 @@ do_grant_table_op(
    5.96              rc = gnttab_dump_table((gnttab_dump_table_t *)uop);
    5.97              break;
    5.98  #endif
    5.99 -        case GNTTABOP_donate:
   5.100 +        case GNTTABOP_transfer:
   5.101              if (unlikely(!array_access_ok(uop, count, 
   5.102 -                                          sizeof(gnttab_donate_t))))
   5.103 +                                          sizeof(gnttab_transfer_t))))
   5.104                  goto out;
   5.105 -            rc = gnttab_donate(uop, count);
   5.106 +            rc = gnttab_transfer(uop, count);
   5.107              break;
   5.108          default:
   5.109              rc = -ENOSYS;
     6.1 --- a/xen/common/grant_table.c	Thu Sep 15 16:55:32 2005 +0000
     6.2 +++ b/xen/common/grant_table.c	Thu Sep 15 17:09:50 2005 +0000
     6.3 @@ -797,7 +797,7 @@ gnttab_dump_table(gnttab_dump_table_t *u
     6.4  #endif
     6.5  
     6.6  static long
     6.7 -gnttab_donate(gnttab_donate_t *uop, unsigned int count)
     6.8 +gnttab_transfer(gnttab_transfer_t *uop, unsigned int count)
     6.9  {
    6.10      struct domain *d = current->domain;
    6.11      struct domain *e;
    6.12 @@ -805,19 +805,20 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    6.13      u32 _d, _nd, x, y;
    6.14      int i;
    6.15      int result = GNTST_okay;
    6.16 +    grant_entry_t *sha;
    6.17  
    6.18      for ( i = 0; i < count; i++ )
    6.19      {
    6.20 -        gnttab_donate_t *gop = &uop[i];
    6.21 +        gnttab_transfer_t *gop = &uop[i];
    6.22  #if GRANT_DEBUG
    6.23 -        printk("gnttab_donate: i=%d mfn=%lx domid=%d gref=%08x\n",
    6.24 +        printk("gnttab_transfer: i=%d mfn=%lx domid=%d gref=%08x\n",
    6.25                 i, gop->mfn, gop->domid, gop->handle);
    6.26  #endif
    6.27          page = &frame_table[gop->mfn];
    6.28          
    6.29          if ( unlikely(IS_XEN_HEAP_FRAME(page)))
    6.30          { 
    6.31 -            printk("gnttab_donate: xen heap frame mfn=%lx\n", 
    6.32 +            printk("gnttab_transfer: xen heap frame mfn=%lx\n", 
    6.33                     (unsigned long) gop->mfn);
    6.34              gop->status = GNTST_bad_virt_addr;
    6.35              continue;
    6.36 @@ -825,7 +826,7 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    6.37          
    6.38          if ( unlikely(!pfn_valid(page_to_pfn(page))) )
    6.39          {
    6.40 -            printk("gnttab_donate: invalid pfn for mfn=%lx\n", 
    6.41 +            printk("gnttab_transfer: invalid pfn for mfn=%lx\n", 
    6.42                     (unsigned long) gop->mfn);
    6.43              gop->status = GNTST_bad_virt_addr;
    6.44              continue;
    6.45 @@ -833,7 +834,7 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    6.46  
    6.47          if ( unlikely((e = find_domain_by_id(gop->domid)) == NULL) )
    6.48          {
    6.49 -            printk("gnttab_donate: can't find domain %d\n", gop->domid);
    6.50 +            printk("gnttab_transfer: can't find domain %d\n", gop->domid);
    6.51              gop->status = GNTST_bad_domain;
    6.52              continue;
    6.53          }
    6.54 @@ -853,7 +854,7 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    6.55              x = y;
    6.56              if (unlikely((x & (PGC_count_mask|PGC_allocated)) !=
    6.57                           (1 | PGC_allocated)) || unlikely(_nd != _d)) {
    6.58 -                printk("gnttab_donate: Bad page values %p: ed=%p(%u), sd=%p,"
    6.59 +                printk("gnttab_transfer: Bad page values %p: ed=%p(%u), sd=%p,"
    6.60                         " caf=%08x, taf=%" PRtype_info "\n", 
    6.61                         (void *) page_to_pfn(page),
    6.62                          d, d->domain_id, unpickle_domptr(_nd), x, 
    6.63 @@ -888,12 +889,12 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    6.64           */
    6.65          if ( unlikely(test_bit(DOMFLAGS_DYING, &e->domain_flags)) ||
    6.66               unlikely(e->tot_pages >= e->max_pages) ||
    6.67 -             unlikely(!gnttab_prepare_for_transfer(e, d, gop->handle)) )
    6.68 +             unlikely(!gnttab_prepare_for_transfer(e, d, gop->ref)) )
    6.69          {
    6.70 -            DPRINTK("gnttab_donate: Transferee has no reservation headroom "
    6.71 +            DPRINTK("gnttab_transfer: Transferee has no reservation headroom "
    6.72                      "(%d,%d) or provided a bad grant ref (%08x) or "
    6.73                      "is dying (%lx)\n",
    6.74 -                    e->tot_pages, e->max_pages, gop->handle, e->domain_flags);
    6.75 +                    e->tot_pages, e->max_pages, gop->ref, e->domain_flags);
    6.76              spin_unlock(&e->page_alloc_lock);
    6.77              put_domain(e);
    6.78              gop->status = result = GNTST_general_error;
    6.79 @@ -908,11 +909,11 @@ gnttab_donate(gnttab_donate_t *uop, unsi
    6.80          
    6.81          spin_unlock(&e->page_alloc_lock);
    6.82          
    6.83 -        /*
    6.84 -         * Transfer is all done: tell the guest about its new page
    6.85 -         * frame.
    6.86 -         */
    6.87 -        gnttab_notify_transfer(e, d, gop->handle, gop->mfn);
    6.88 +        /* Tell the guest about its new page frame. */
    6.89 +        sha = &e->grant_table->shared[gop->ref];
    6.90 +        sha->frame = gop->mfn;
    6.91 +        wmb();
    6.92 +        sha->flags |= GTF_transfer_completed;
    6.93          
    6.94          put_domain(e);
    6.95          
    6.96 @@ -960,11 +961,11 @@ do_grant_table_op(
    6.97          rc = gnttab_dump_table((gnttab_dump_table_t *)uop);
    6.98          break;
    6.99  #endif
   6.100 -    case GNTTABOP_donate:
   6.101 +    case GNTTABOP_transfer:
   6.102          if (unlikely(!array_access_ok(
   6.103 -            uop, count, sizeof(gnttab_donate_t))))
   6.104 +            uop, count, sizeof(gnttab_transfer_t))))
   6.105              goto out;
   6.106 -        rc = gnttab_donate(uop, count);
   6.107 +        rc = gnttab_transfer(uop, count);
   6.108          break;
   6.109      default:
   6.110          rc = -ENOSYS;
   6.111 @@ -1171,46 +1172,6 @@ gnttab_prepare_for_transfer(
   6.112      return 0;
   6.113  }
   6.114  
   6.115 -void 
   6.116 -gnttab_notify_transfer(
   6.117 -    struct domain *rd, struct domain *ld, grant_ref_t ref, unsigned long frame)
   6.118 -{
   6.119 -    grant_entry_t  *sha;
   6.120 -    unsigned long   pfn;
   6.121 -
   6.122 -#if GRANT_DEBUG_VERBOSE
   6.123 -    DPRINTK("gnttab_notify_transfer rd(%hu) ld(%hu) ref(%hu).\n",
   6.124 -            rd->domain_id, ld->domain_id, ref);
   6.125 -#endif
   6.126 -
   6.127 -    sha = &rd->grant_table->shared[ref];
   6.128 -
   6.129 -    spin_lock(&rd->grant_table->lock);
   6.130 -
   6.131 -    pfn = sha->frame;
   6.132 -
   6.133 -    if ( unlikely(pfn >= max_page ) )
   6.134 -        DPRINTK("Bad pfn (%lx)\n", pfn);
   6.135 -    else
   6.136 -    {
   6.137 -        set_pfn_from_mfn(frame, pfn);
   6.138 -
   6.139 -        if ( unlikely(shadow_mode_log_dirty(ld)))
   6.140 -             mark_dirty(ld, frame);
   6.141 -
   6.142 -        if (shadow_mode_translate(ld))
   6.143 -            set_mfn_from_pfn(pfn, frame);
   6.144 -    }
   6.145 -    sha->frame = __mfn_to_gpfn(rd, frame);
   6.146 -    sha->domid = rd->domain_id;
   6.147 -    wmb();
   6.148 -    sha->flags = ( GTF_accept_transfer | GTF_transfer_completed );
   6.149 -
   6.150 -    spin_unlock(&rd->grant_table->lock);
   6.151 -
   6.152 -    return;
   6.153 -}
   6.154 -
   6.155  int 
   6.156  grant_table_create(
   6.157      struct domain *d)
     7.1 --- a/xen/include/public/grant_table.h	Thu Sep 15 16:55:32 2005 +0000
     7.2 +++ b/xen/include/public/grant_table.h	Thu Sep 15 17:09:50 2005 +0000
     7.3 @@ -215,18 +215,19 @@ typedef struct gnttab_dump_table {
     7.4  } gnttab_dump_table_t;
     7.5  
     7.6  /*
     7.7 - * GNTTABOP_donate_grant_ref: Donate <frame> to a foreign domain.  The
     7.8 + * GNTTABOP_transfer_grant_ref: Transfer <frame> to a foreign domain.  The
     7.9   * foreign domain has previously registered the details of the transfer.
    7.10   * These can be identified from <handle>, a grant reference.
    7.11   */
    7.12 -#define GNTTABOP_donate                4
    7.13 +#define GNTTABOP_transfer                4
    7.14  typedef struct {
    7.15 -    unsigned long mfn;		      /*  0 */
    7.16 -    domid_t     domid;		      /*  4 */
    7.17 -    u16         handle;               /*  8 */
    7.18 -    s16         status;               /*  10: GNTST_* */
    7.19 -    u32         __pad;
    7.20 -} gnttab_donate_t;	      /*  14 bytes */
    7.21 +    /* IN parameters. */
    7.22 +    unsigned long mfn;
    7.23 +    domid_t     domid;
    7.24 +    grant_ref_t ref;
    7.25 +    /* OUT parameters. */
    7.26 +    s16         status;
    7.27 +} gnttab_transfer_t;
    7.28  
    7.29  /*
    7.30   * Bitfield values for update_pin_status.flags.
     8.1 --- a/xen/include/xen/grant_table.h	Thu Sep 15 16:55:32 2005 +0000
     8.2 +++ b/xen/include/xen/grant_table.h	Thu Sep 15 17:09:50 2005 +0000
     8.3 @@ -106,12 +106,6 @@ int
     8.4  gnttab_prepare_for_transfer(
     8.5      struct domain *rd, struct domain *ld, grant_ref_t ref);
     8.6  
     8.7 -/* Notify 'rd' of a completed transfer via an already-locked grant entry. */
     8.8 -void 
     8.9 -gnttab_notify_transfer(
    8.10 -    struct domain *rd, struct domain *ld,
    8.11 -    grant_ref_t ref, unsigned long frame);
    8.12 -
    8.13  /* Domain death release of granted device mappings of other domains.*/
    8.14  void
    8.15  gnttab_release_dev_mappings(grant_table_t *gt);