xen/arm: Find automatically the gnttab region for DOM0
authorJulien Grall <julien.grall@citrix.com>
Wed, 17 Jun 2015 13:58:27 +0000 (14:58 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Jul 2015 09:02:04 +0000 (10:02 +0100)
commit7e02c881606eb94f177becfa284494d89a3dba2e
treedb36d6360a381a0ab301e037931fbd18ad3fd5df
parent1123da20d30b696269484aa037e2ee5d5d7d9e06
xen/arm: Find automatically the gnttab region for DOM0

Currently, the grant table region is hardcoded per-platform. When a new
board is coming up, we have to check the spec in order to find a space
in the memory layout free. Depending on the platform it may be tedious.

A good candidate for the gnttab region is the one used by Xen binary as
some part will never be mapped to the DOM0 address, MMIO are mapped 1:1
and the RAM will be either:
    - direct mapped: 1:1 mapping is used => no problem
    - non direct mapped: Xen always relocates himself as high as possible
    (limited to 4GB on ARM32) and the RAM bank are filled from the first
    one. It's very unlikely that the gnttab region will overlap with the
    RAM. Although for safety a check may be necessary when we will reenable
    the option.

Furthermore, there is plenty of space to contain a big gnttab, the default
size is 32 frame (i.e 128KB) but it can be changed via a command option.

It's not possible to use the whole region used by Xen, as some part of
the binary will be freed after Xen boot and can be used by DOM0 and other
guest. A sensible choice is the text secion as it will always reside in
memory never be mapped to the guest and the size is big enough (~300KB
on ARM64). It could be extended later to use other contiguous sections
such as data...

Note that on ARM64, the grant table region may be after 4GB (Xen is
relocated to the highest address) using DOM0 32 bit with short page table
may not work. Although, I don't think this is a big deal as device may not
work and/or the RAM is too high due to the 1:1 mapping.

This patch also drop the platforms thunderx and xilinx-zynqmp which became
dummy by dropping the hardcoding DOM0 grant table region.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 files changed:
xen/arch/arm/domain_build.c
xen/arch/arm/kernel.h
xen/arch/arm/platform.c
xen/arch/arm/platforms/Makefile
xen/arch/arm/platforms/midway.c
xen/arch/arm/platforms/omap5.c
xen/arch/arm/platforms/rcar2.c
xen/arch/arm/platforms/seattle.c
xen/arch/arm/platforms/sunxi.c
xen/arch/arm/platforms/thunderx.c [deleted file]
xen/arch/arm/platforms/vexpress.c
xen/arch/arm/platforms/xgene-storm.c
xen/arch/arm/platforms/xilinx-zynqmp.c [deleted file]
xen/include/asm-arm/platform.h