From: "Jan Beulich" Subject: Re: [PATCH v6 2/2] add a new p2m type - p2m_mmio_write_dm Date: Thu, 11 Dec 2014 13:23:59 +0000 Message-ID: <5489A8FF020000780004EFA1@mail.emea.novell.com> References: <1417838137-12473-1-git-send-email-yu.c.zhang@linux.intel.com> <1417838137-12473-3-git-send-email-yu.c.zhang@linux.intel.com> <20141211120450.GA53811@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20141211120450.GA53811@deinos.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Yu Zhang Cc: kevin.tian@intel.com, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, Tim Deegan , ian.jackson@eu.citrix.com, donald.d.dugger@intel.com, Xen-devel@lists.xen.org, Paul.Durrant@citrix.com, zhiyuan.lv@intel.com, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 11.12.14 at 13:04, wrote: > At 11:55 +0800 on 06 Dec (1417863337), Yu Zhang wrote: >> From: Yu Zhang >> >> A new p2m type, p2m_mmio_write_dm, is added to trap and emulate >> the write operations on GPU's page tables. Handling of this new >> p2m type are similar with existing p2m_ram_ro in most condition >> checks, with only difference on final policy of emulation vs. drop. >> For p2m_ram_ro types, write operations will not trigger the device >> model, and will be discarded later in __hvm_copy(); while for the >> p2m_mmio_write_dm type pages, writes will go to the device model >> via ioreq-server. >> >> Signed-off-by: Yu Zhang >> Signed-off-by: Wei Ye > > Sorry not to have seen this before, but it looks like the new type isn't > handled in the shadow-pagetable code. I think you need this as well: > > diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c > index 225290e..58c0cca 100644 > --- a/xen/arch/x86/mm/shadow/multi.c > +++ b/xen/arch/x86/mm/shadow/multi.c > @@ -3181,7 +3181,8 @@ static int sh_page_fault(struct vcpu *v, > } > > /* Need to hand off device-model MMIO to the device model */ > - if ( p2mt == p2m_mmio_dm ) > + if ( p2mt == p2m_mmio_dm > + || p2mt == p2m_mmio_readonly && ft == ft_demand_write ) > { > gpa = guest_walk_to_gpa(&gw); > goto mmio; > > With that hunk added, you can add > > Reviewed-by: Tim Deegan But please add parentheses around the && operands, even if not strictly needed. Jan