[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC PATCH v2 1/3] arch, arm: allow dom0 access to I/O memory of mapped devices



On Mon, 2014-03-10 at 09:25 +0100, Arianna Avanzini wrote:
> Currently, dom0 is not allowed access to the I/O memory ranges
> used to access devices exposed to it. This commit attempts
> to give it access to those memory ranges during domain build
> by adding the ranges to dom0's iomem_caps.

Just to make sure I've got it straight: Strictly speaking dom0 is
allowed this access, because we unconditionally create the required
mappings. What this commit changes is to make sure that the bookkeeping
actually reflects that reality.

> Signed-off-by: Arianna Avanzini <avanzini.arianna@xxxxxxxxx>
> Cc: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> Cc: Paolo Valente <paolo.valente@xxxxxxxxxx>
> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> Cc: Julien Grall <julien.grall@xxxxxxxxxx>

With Julien's comment addressed please add:
Acked-by: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>

> Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> Cc: Eric Trudeau <etrudeau@xxxxxxxxxxxx>
> Cc: Viktor Kleinik <viktor.kleinik@xxxxxxxxxxxxxxx>
> ---
>  xen/arch/arm/domain_build.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 5ca2f15..0b283d8 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -11,6 +11,7 @@
>  #include <xen/device_tree.h>
>  #include <xen/libfdt/libfdt.h>
>  #include <xen/guest_access.h>
> +#include <xen/iocap.h>
>  #include <asm/setup.h>
>  #include <asm/platform.h>
>  #include <asm/psci.h>
> @@ -733,6 +734,15 @@ 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 dom0 access to"
> +                   " 0x%"PRIx64" - 0x%"PRIx64"\n",
> +                   addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);

Not your fault but I wonder why we are using u64 here for addr and
friends and not paddr_t.

> +            return res;
> +        }
>          res = map_mmio_regions(d, addr & PAGE_MASK,
>                                 PAGE_ALIGN(addr + size) - 1,
>                                 addr & PAGE_MASK);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.