setup grant table share page for vmx guest
PATCH 6/6 setup grant table share page for vmx guest
Setup grant table share page for vmx guest.
Unmodified linux can not use fix map to setup the grant table share page. This patch put the grant table share page into the guest phys_to_machine mapping, so that guest can use ioremap to access these pages. The guest physical address is passed from guest and it is in the event channel pci device mmio space. By this way, no extra hypercall needed.
Signed-off-by Xiaofeng Ling <[email protected]>
Signed-off-by Arun Sharma <[email protected]>
xen/common/grant_table.c +21 -2
@@ -693,11 +693,30 @@if ( op.nr_frames <=NR_GRANT_FRAMES ) {ASSERT (d->grant_table !=NULL ); - (void )put_user (GNTST_okay, &uop->status); -for ( i =0 ; i < op.nr_frames; i++ ) +if (!shadow_mode_external (current->domain)) + { + (void )put_user (GNTST_okay, &uop->status); +for ( i =0 ; i < op.nr_frames; i++ ) (void )put_user ( (virt_to_phys (d->grant_table->shared) >>PAGE_SHIFT ) + i, &uop->frame_list[i]); + } +else + { +unsigned long mfn, gpa; + op.status = GNTST_okay; + + gpa = (unsigned long )op.frame_list; +for ( i =0 ; i < op.nr_frames; i++ ) + { + mfn = (virt_to_phys (d->grant_table->shared) >>PAGE_SHIFT ) + + i, +DPRINTK ("gpa:%lx share mfn:%lx\n" , gpa, mfn); +set_phystomachine (gpa >>PAGE_SHIFT , mfn); + gpa = gpa +PAGE_SIZE ; + } + (void )copy_to_user (uop, &op,sizeof (op)); + } }put_domain (d);
xen/arch/x86/mm.c +44 -0
50 lines not on this page · raw message
xen/include/asm-x86/mm.h +3 -0
@@ -289,6 +289,9 @@return mfn; } +unsigned long set_phystomachine (unsigned long pfn, +unsigned long mfn); +#ifdef MEMORY_GUARD void memguard_init (void );void memguard_guard_range (void *p,unsigned long l);