WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "Dietmar Hahn" <dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Mapping hvm guest pages in Dom0
From: Satya <satyakiran@xxxxxxxxx>
Date: Thu, 9 Oct 2008 10:09:31 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 09 Oct 2008 10:09:59 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=7fhplZF9Jq2yTWhPI+cGYs7pA2uxogObaDrnaGR5XJ0=; b=jTEt99cScBK/Bf3FIqjDjUh1yFHjOLBkASSurE+ZwGx/b/R9IozApj2Ts3D6Zivc9z bb5fx0B3czHJxowjyqwhrXa49xGZ8unnI+/sVdFkSiI+297aYT1rBPAQMmudigqi7uCO wJLKT2Ly3S9RyUEERHpebUjHs9PezFwZbQPGk=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=B4rAwCrpv2jx2tm7HISTPUajoULyZjV12sBfef7FMTJpXeb4q5hzTMGf1M3bujrH3X Zt7XqZ++qxA+Z/KfaT0idyf16Yr2+0f9bIjKuj7HjNfpJc7p3FNpnonKCPXaVTirir16 IMYBklpJYAYQgrCXHDL45Xn8yilCZUo+ahInk=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <200810091156.37303.dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <acbcf3840809261202i693c21fawbe86ec75f8a995ba@xxxxxxxxxxxxxx> <200809290930.46865.dietmar.hahn@xxxxxxxxxxxxxxxxxxx> <acbcf3840810071414t412e70eai5465055d7289740f@xxxxxxxxxxxxxx> <200810091156.37303.dietmar.hahn@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On Thu, Oct 9, 2008 at 2:56 AM, Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxxxxxxx> wrote:
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.

yeah, I only have the host machine frame numbers. I don't have the 'gmfn' - which is I believe is the guest's view of this machine frame number. Is there a function f(hostmfn, domid) that will give me the corresponding gmfn? i.e I should be able to read the guest's p2m table. I sent out another message to xen-devel asking the same question, but I don't see it posted to the list yet.

 

Are you seeing a message on serial console or 'xm log' ?
Well 'xm dmesg' showed nothing relevant.



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

Thanks, that was helpful.

./satya
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>