Mailing List Archive

Get the network interface working in shadow translate mode. This
# HG changeset patch
# User sos22@douglas.cl.cam.ac.uk
# Node ID 1580009f137c2d90a3de05c06d677dfbdd65e4bd
# Parent cc9bb3e0e348e6484d6fa2bc43b4900c6a40da79
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

diff -r cc9bb3e0e348 -r 1580009f137c xen/common/grant_table.c
--- a/xen/common/grant_table.c Wed Jan 25 17:57:44 2006
+++ b/xen/common/grant_table.c Thu Jan 26 13:33:20 2006
@@ -711,6 +711,7 @@
int i;
grant_entry_t *sha;
gnttab_transfer_t gop;
+ unsigned long real_mfn;

for ( i = 0; i < count; i++ )
{
@@ -731,7 +732,8 @@
continue;
}

- page = pfn_to_page(gop.mfn);
+ real_mfn = __gpfn_to_mfn(d, gop.mfn);
+ page = pfn_to_page(real_mfn);
if ( unlikely(IS_XEN_HEAP_FRAME(page)) )
{
DPRINTK("gnttab_transfer: xen frame %lx\n",
@@ -792,7 +794,21 @@

/* Tell the guest about its new page frame. */
sha = &e->grant_table->shared[gop.ref];
- sha->frame = gop.mfn;
+ if (shadow_mode_translate(e)) {
+ struct domain_mmap_cache c1, c2;
+ unsigned long pfn = sha->frame;
+ domain_mmap_cache_init(&c1);
+ domain_mmap_cache_init(&c2);
+ shadow_lock(e);
+ shadow_sync_and_drop_references(e, page);
+ set_p2m_entry(e, pfn, real_mfn, &c1, &c2);
+ set_pfn_from_mfn(real_mfn, pfn);
+ shadow_unlock(e);
+ domain_mmap_cache_destroy(&c1);
+ domain_mmap_cache_destroy(&c2);
+ } else {
+ sha->frame = real_mfn;
+ }
wmb();
sha->flags |= GTF_transfer_completed;

diff -r cc9bb3e0e348 -r 1580009f137c xen/common/memory.c
--- a/xen/common/memory.c Wed Jan 25 17:57:44 2006
+++ b/xen/common/memory.c Thu Jan 26 13:33:20 2006
@@ -76,7 +76,7 @@
int *preempted)
{
struct pfn_info *page;
- unsigned long i, j, mpfn;
+ unsigned long i, j, mpfn, mfn;

if ( !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
return 0;
@@ -94,14 +94,15 @@

for ( j = 0; j < (1 << extent_order); j++ )
{
- if ( unlikely((mpfn + j) >= max_page) )
+ mfn = __gpfn_to_mfn(d, mpfn + j);
+ if ( unlikely(mfn >= max_page) )
{
DPRINTK("Domain %u page number out of range (%lx >= %lx)\n",
- d->domain_id, mpfn + j, max_page);
+ d->domain_id, mfn, max_page);
return i;
}

- page = pfn_to_page(mpfn + j);
+ page = pfn_to_page(mfn);
if ( unlikely(!get_page(page, d)) )
{
DPRINTK("Bad page free for domain %u\n", d->domain_id);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog