From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arianna Avanzini Subject: [PATCH v6 01/11] arch, arm: domain build: let dom0 access I/O memory of mapped devices Date: Mon, 21 Apr 2014 15:44:54 +0200 Message-ID: <1398087904-16594-2-git-send-email-avanzini.arianna@gmail.com> References: <1398087904-16594-1-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-1-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: xen-devel@lists.xen.org Cc: Ian.Campbell@eu.citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, Ian.Jackson@eu.citrix.com, dario.faggioli@citrix.com, tim@xen.org, julien.grall@citrix.com, etrudeau@broadcom.com, JBeulich@suse.com, avanzini.arianna@gmail.com, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org Currently, dom0 is allowed access to the I/O memory ranges used to access devices exposed to it, but it doesn't have those ranges in its iomem_caps. This commit attempts to implement the correct bookkeeping in the generic function which actually maps a device's I/O memory to the domain, adding the ranges to the domain's iomem_caps. Signed-off-by: Arianna Avanzini Acked-by: Ian Campbell Acked-by: Julien Grall Cc: Dario Faggioli Cc: Paolo Valente Cc: Stefano Stabellini Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan Cc: Ian Jackson Cc: Eric Trudeau Cc: Viktor Kleinik --- v4: - Hopefully improve commit description. v3: - Print the domain id in the error message instead of always printing "dom0". - Fix commit description. --- xen/arch/arm/domain_build.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); -- 1.9.1