ia64/xen-unstable

changeset 8682:1580009f137c

Get the network interface working in shadow translate mode. This
required a few extra __gpfn_to_mfn translations, and also required a
minor change in the grant tables interface: if we're in shadow
translate mode, then shared->frame is supposed to be the pfn you want
to map the new mfn to when accepting a grant transfer, and Xen handles
updating the M2P and P2M tables for you.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
author sos22@douglas.cl.cam.ac.uk
date Thu Jan 26 14:33:20 2006 +0100 (2006-01-26)
parents cc9bb3e0e348
children 0d95066795de
files xen/common/grant_table.c xen/common/memory.c
line diff
     1.1 --- a/xen/common/grant_table.c	Wed Jan 25 18:57:44 2006 +0100
     1.2 +++ b/xen/common/grant_table.c	Thu Jan 26 14:33:20 2006 +0100
     1.3 @@ -711,6 +711,7 @@ gnttab_transfer(
     1.4      int i;
     1.5      grant_entry_t *sha;
     1.6      gnttab_transfer_t gop;
     1.7 +    unsigned long real_mfn;
     1.8  
     1.9      for ( i = 0; i < count; i++ )
    1.10      {
    1.11 @@ -731,7 +732,8 @@ gnttab_transfer(
    1.12              continue;
    1.13          }
    1.14  
    1.15 -        page = pfn_to_page(gop.mfn);
    1.16 +        real_mfn = __gpfn_to_mfn(d, gop.mfn);
    1.17 +        page = pfn_to_page(real_mfn);
    1.18          if ( unlikely(IS_XEN_HEAP_FRAME(page)) )
    1.19          { 
    1.20              DPRINTK("gnttab_transfer: xen frame %lx\n",
    1.21 @@ -792,7 +794,21 @@ gnttab_transfer(
    1.22  
    1.23          /* Tell the guest about its new page frame. */
    1.24          sha = &e->grant_table->shared[gop.ref];
    1.25 -        sha->frame = gop.mfn;
    1.26 +        if (shadow_mode_translate(e)) {
    1.27 +            struct domain_mmap_cache c1, c2;
    1.28 +            unsigned long pfn = sha->frame;
    1.29 +            domain_mmap_cache_init(&c1);
    1.30 +            domain_mmap_cache_init(&c2);
    1.31 +            shadow_lock(e);
    1.32 +            shadow_sync_and_drop_references(e, page);
    1.33 +            set_p2m_entry(e, pfn, real_mfn, &c1, &c2);
    1.34 +            set_pfn_from_mfn(real_mfn, pfn);
    1.35 +            shadow_unlock(e);
    1.36 +            domain_mmap_cache_destroy(&c1);
    1.37 +            domain_mmap_cache_destroy(&c2);
    1.38 +        } else {
    1.39 +            sha->frame = real_mfn;
    1.40 +        }
    1.41          wmb();
    1.42          sha->flags |= GTF_transfer_completed;
    1.43  
     2.1 --- a/xen/common/memory.c	Wed Jan 25 18:57:44 2006 +0100
     2.2 +++ b/xen/common/memory.c	Thu Jan 26 14:33:20 2006 +0100
     2.3 @@ -76,7 +76,7 @@ decrease_reservation(
     2.4      int           *preempted)
     2.5  {
     2.6      struct pfn_info *page;
     2.7 -    unsigned long    i, j, mpfn;
     2.8 +    unsigned long    i, j, mpfn, mfn;
     2.9  
    2.10      if ( !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
    2.11          return 0;
    2.12 @@ -94,14 +94,15 @@ decrease_reservation(
    2.13  
    2.14          for ( j = 0; j < (1 << extent_order); j++ )
    2.15          {
    2.16 -            if ( unlikely((mpfn + j) >= max_page) )
    2.17 +            mfn = __gpfn_to_mfn(d, mpfn + j);
    2.18 +            if ( unlikely(mfn >= max_page) )
    2.19              {
    2.20                  DPRINTK("Domain %u page number out of range (%lx >= %lx)\n", 
    2.21 -                        d->domain_id, mpfn + j, max_page);
    2.22 +                        d->domain_id, mfn, max_page);
    2.23                  return i;
    2.24              }
    2.25              
    2.26 -            page = pfn_to_page(mpfn + j);
    2.27 +            page = pfn_to_page(mfn);
    2.28              if ( unlikely(!get_page(page, d)) )
    2.29              {
    2.30                  DPRINTK("Bad page free for domain %u\n", d->domain_id);