From: Satya Subject: Re: Mapping hvm guest pages in Dom0 Date: Tue, 7 Oct 2008 14:14:43 -0700 Message-ID: References: <200809290930.46865.dietmar.hahn@fujitsu-siemens.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1204082996==" Return-path: In-Reply-To: <200809290930.46865.dietmar.hahn@fujitsu-siemens.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: dietmar.hahn@fujitsu-siemens.com Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1204082996== Content-Type: multipart/alternative; boundary="----=_Part_53701_14258958.1223414083846" ------=_Part_53701_14258958.1223414083846 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. ------=_Part_53701_14258958.1223414083846 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline


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.


------=_Part_53701_14258958.1223414083846-- --===============1204082996== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1204082996==--