From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v6 01/11] arch, arm: domain build: let dom0 access I/O memory of mapped devices Date: Tue, 29 Apr 2014 13:37:21 +0100 Message-ID: <535F9D01.6000907@linaro.org> References: <1398087904-16594-1-git-send-email-avanzini.arianna@gmail.com> <1398087904-16594-2-git-send-email-avanzini.arianna@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1398087904-16594-2-git-send-email-avanzini.arianna@gmail.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: Arianna Avanzini Cc: julien.grall@citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, tim@xen.org, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, Ian.Campbell@eu.citrix.com, etrudeau@broadcom.com, JBeulich@suse.com, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org Hi Arianna, On 04/21/2014 02:44 PM, Arianna Avanzini wrote: > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c > index 187e071..1802b6e 100644 > --- a/xen/arch/arm/domain_build.c > +++ b/xen/arch/arm/domain_build.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -740,6 +741,16 @@ static int map_device(struct domain *d, const struct dt_device_node *dev) > DPRINT("addr %u = 0x%"PRIx64" - 0x%"PRIx64"\n", > i, addr, addr + size - 1); > > + res = iomem_permit_access(d, paddr_to_pfn(addr & PAGE_MASK), > + paddr_to_pfn(PAGE_ALIGN(addr + size - 1))); > + if ( res ) > + { > + printk(XENLOG_ERR "Unable to permit to dom%d access to" > + " 0x%"PRIx64" - 0x%"PRIx64"\n", > + d->domain_id, > + addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1); > + return res; > + } > res = map_mmio_regions(d, addr & PAGE_MASK, > PAGE_ALIGN(addr + size) - 1, > addr & PAGE_MASK); > I though a bit more about this patch. If the device is disabled (i.e status="disabled"), Xen doesn't call map_device. Futhermore, in your use case (e.g with iomem=) you might want to map memory that is not describe to the device tree. I would either: 1) give a full access to the I/O range 2) give a full access to the I/O range except on the RAM region IHMO, the second solution might be better but I don't know if it's easy to implement it. Any thoughts? Regards, -- Julien Grall