From: Keir Fraser Subject: Re: guest physical to xen machine copy? Date: Mon, 29 Sep 2008 21:11:34 +0100 Message-ID: References: <3260af91-f84d-40c3-84f0-a75ddb625cc3@default> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <3260af91-f84d-40c3-84f0-a75ddb625cc3@default> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer , "Xen-Devel (E-mail)" , "Tian, Kevin" List-Id: xen-devel@lists.xenproject.org On 29/9/08 19:50, "Dan Magenheimer" wrote: > Hmmm... gfn_to_mfn() when used as below seems to just > return the original gfn, e.g. > > guest_mfn = gfn_to_mfn(current->domain,gpfn,&t); > > Is this correct? Note that current->domain is a 32-bit > paravirtualized domain and xen is 64-bit, if that matters. > (Is there a better way if one knows that the domain is > always pv?) Xen doesn't do pfn-to-mfn translation for PV guests. They do it themselves with their own p2m table. So, for a PV guest, gfn==mfn. >> Use p2m_is_ram() instead of checking individual p2m ram type > > In copying the other direction (e.g. copy_page_TO_guest), > I think I need to check for t==p2m_ram_rw, right? You need to check for not p2m_ram_ro. You also should page_mark_dirty() (__hvm_copy() does it unconditionally on pages it modifies). -- Keir > If so, the "Not necessarily true" comment in static > inline _gfn_to_mfn in include/asm-x86/p2m.h worries me. > Should it?