From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2 1/2] xen: introduce arch_iommu_grant_(un)map_page Date: Thu, 24 Jul 2014 11:51:29 +0100 Message-ID: <53D0E531.80303@linaro.org> References: <1406135982-15487-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1406135982-15487-1-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , xen-devel@lists.xensource.com Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Hi Stefano, The Title of the commit message is now wrong. On 23/07/14 18:19, Stefano Stabellini wrote: > Introduce two arch specific functions to create a new p2m mapping of > granted pages at pfn == mfn. > The x86 implementation just returns ENOSYS. > > Signed-off-by: Stefano Stabellini > --- > xen/arch/arm/p2m.c | 19 +++++++++++++++++++ > xen/include/asm-arm/p2m.h | 4 ++++ > xen/include/asm-x86/p2m.h | 13 +++++++++++++ > 3 files changed, 36 insertions(+) > > diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c > index 9960e17..c38af59 100644 > --- a/xen/arch/arm/p2m.c > +++ b/xen/arch/arm/p2m.c > @@ -555,6 +555,25 @@ void guest_physmap_remove_page(struct domain *d, > pfn_to_paddr(mfn), MATTR_MEM, p2m_invalid); > } > > +int arch_grant_map_page_identity(struct domain *d, unsigned long frame, > + bool_t writeable) > +{ > + p2m_type_t t; > + > + if ( writeable ) > + t = p2m_ram_rw; > + else > + t = p2m_ram_ro; This is not the right p2m type to use here. p2m_ram_{rw,ro} allow foreign mapping. So another guest could access to the grant. I would use p2m_iommu_map_{rw,ro}. Regards, -- Julien Grall