|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC 27/35] arm: acpi map mmio regions to dom0
On Wed, 4 Feb 2015, parth.dixit@xxxxxxxxxx wrote:
> From: Parth Dixit <parth.dixit@xxxxxxxxxx>
>
> map mmio regions described in uefi tables to dom0 address space
>
> Signed-off-by: Parth Dixit <parth.dixit@xxxxxxxxxx>
> ---
> xen/arch/arm/domain_build.c | 54
> +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 54 insertions(+)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index d781c63..49eb52a 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1235,6 +1235,56 @@ static int make_chosen_node(const struct domain *d,
> const struct kernel_info *ki
> return res;
> }
>
> +static int acpi_map_mmio(struct domain *d)
> +{
> + int i,res;
> + u64 addr,size;
> +
> + for( i = 0; i < acpi_mmio.nr_banks; i++ )
> + {
> + addr = acpi_mmio.bank[i].start;
> + size = acpi_mmio.bank[i].size;
> +
> + 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,
> + paddr_to_pfn(addr & PAGE_MASK),
> + DIV_ROUND_UP(size, PAGE_SIZE),
> + paddr_to_pfn(addr & PAGE_MASK));
> + if ( res )
> + {
> + printk(XENLOG_ERR "Unable to map 0x%"PRIx64
> + " - 0x%"PRIx64" in domain %d\n",
> + addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1,
> + d->domain_id);
> + return res;
> + }
> +
> + }
> +
> + return 0;
> +}
> +
> +static int map_acpi_regions(struct domain *d)
> +{
> + int res;
> +
> + res = acpi_map_mmio(d);
> + if ( res )
> + return res;
> +
> + return 0;
> +}
I don't think that splitting the code in two functions is useful. Just
implement the remapping here.
> /*
> * Prepare a minimal DTB for DOM0 which contains
> * bootargs, memory information,
> @@ -1264,6 +1314,10 @@ static int prepare_dtb_acpi(struct domain *d, struct
> kernel_info *kinfo)
> if ( ret < 0 )
> goto err;
>
> + ret = map_acpi_regions(d);
> + if ( ret < 0 )
> + goto err;
Do they also need to described in the mini dtb for dom0?
If not, how is dom0 going to retrieve the list of mmio regions? I guess
via the acpi tables?
> ret = fdt_begin_node(kinfo->fdt, "/");
> if ( ret < 0 )
> goto err;
> --
> 1.9.1
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |