From: Tim Deegan Subject: Re: mapping virtual address to corresponding shadow page in xen Date: Tue, 27 Dec 2011 10:58:14 +0000 Message-ID: <20111227105814.GB44631@ocelot.phlegethon.org> References: <4EF5C756.4070403@gmail.com> <20111224124937.GB63360@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Mohamad Rezaei Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi, At 16:26 +0330 on 24 Dec (1324744009), Mohamad Rezaei wrote: > My question is when I want to read a data from domain, I use > copy_from_guest. but now I want to map that address in domain (guest) > to an address inside xen (hypervisor). I need to translate that > address. somehow like this: gva -> gpfn -> gmfn -> mfn. To do this I > have started a dom0 with dom0_shadow=1 option. So I presume that vtx > is enabled for dom0. Actually shadow pagetables are quite separate from VT-x (and predate it - they were originally used for live migratoin of PV guests). So no, dom0_shadow=1 doesn't turn on VT-x for dom0. Luckily, you don't need VT-x to map a page of dom0 memory (in fact it wouldn't help). Have a look at mem_event_enable() in xen/arch/x86/mm/mem_event.c - it does exactly wat you need, starting with VA ring_addr and ending with a mapping in med->ring_page. Cheers, Tim.