[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Mapping hvm guest pages in Dom0


  • To: Satya <satyakiran@xxxxxxxxx>
  • From: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
  • Date: Thu, 9 Oct 2008 11:56:37 +0200
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 09 Oct 2008 02:57:04 -0700
  • Domainkey-signature: s=s768; d=fujitsu-siemens.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:From:To:Subject:Date:User-Agent:Cc: References:In-Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-Disposition:Message-Id; b=HYD99DLtuFf9hEExwKqMoimdopVt+x61lWa/0HipCeMo74w7nkofJMCM P/6cwg6YHKXAFh8YZR2hFY1cqjWELwzyKpB/lwKAYBbeHv4Zj1oOr3anW oAt9BQF5xBg91kR;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Am Dienstag, 7. Oktober 2008 schrieb Satya:
> If you have the gmfn's from the HVM domU (I'am not sure where you get this
>
> > from if you want to keep your guest "pure" HVM) and the domU id, you can
> > map
> > the domU memory into the dom0 kernel memory with
> >
> > struct vm_struct area;
> > area = alloc_vm_area(num_pages * PAGE_SIZE);
> > direct_kernel_remap_pfn_range(((unsigned long)) area->addr, gmfn,
> >                                PAGE_SIZE*num_pages, prots, domU_id);
>
> I did that but the hypercall from __direct_remap_pfn_range() errors out
> (-EINVAL) if prots include _PAGE_PRESENT. Without this flag the kernel
> cannot handle reads and writes to these pages (will essentially page
> fault). Any thoughts? 
>
> ./satya
>
> ps: Thanks to everyone for the replies.

Maybe your gmfn is wrong.
Are you seeing a message on serial console or 'xm log' ?

What I do is:
domU gives the gmfn's to dom0
prot = __pgprot(_KERNPG_TABLE);      // _KERNPG_TABLE contains _PAGE_PRESENT
area = alloc_vm_area(num_pages * PAGE_SIZE);
direct_kernel_remap_pfn_range(((unsigned long)) area->addr, gmfn,
                                PAGE_SIZE*num_pages, prots, domU_id);
Now I can read and write the domU memory from dom0 kernel!

You can find an example in xenoprof part in the dom0 linux kernel:
xenoprof_arch_map_shared_buffer() or xenoprof_arch_set_passive()
in arch/i386/oprofile/xenoprof.c

Dietmar.






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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.