From: Ian Campbell Subject: Re: [PATCH v4 08/11] xen/arm: Handle remove foreign mapping Date: Mon, 16 Dec 2013 17:21:41 +0000 Message-ID: <1387214501.21086.49.camel@kazak.uk.xensource.com> References: <1386963461-6520-1-git-send-email-julien.grall@linaro.org> <1386963461-6520-9-git-send-email-julien.grall@linaro.org> <20131216115131.GB35881@deinos.phlegethon.org> <52AF1D6E.7080402@linaro.org> <1387208403.21086.12.camel@kazak.uk.xensource.com> <52AF29C3.1030700@linaro.org> <1387211584.21086.27.camel@kazak.uk.xensource.com> <52AF330C.3050305@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VsbrW-0001cF-LA for xen-devel@lists.xenproject.org; Mon, 16 Dec 2013 17:21:46 +0000 In-Reply-To: <52AF330C.3050305@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Keir Fraser , patches@linaro.org, Tim Deegan , stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Mon, 2013-12-16 at 17:06 +0000, Julien Grall wrote: > >> + /* TODO: Handle other p2m type */ > >> + if ( pte.p2m.valid && p2m_is_foreign(pte.p2m.type) ) > >> + { > >> + ASSERT(mfn_valid(mfn)); > > > > Something somewhere is making sure we don't put foreign MMIO regions > > into the p2m, right? > > I misread this part. And the answer is still yes because in this case > MMIO won't belong to a domain (there is no reference on it), so get_page > will return NULL when the foreign mapping is created in > xenmem_add_to_physmap_one. It would be pretty easy for xenmem_add_to_physmap_one() to request the type (it calls get_page_from_gfn anyway) and filter to just the ram types. As I said in another reply we probably want to avoid mappings of foreign mappings and grant tables too. Ian.