xen: arm: allocate more than one bank for 1:1 domain 0 if needed
authorIan Campbell <ian.campbell@citrix.com>
Wed, 9 Jul 2014 12:07:46 +0000 (13:07 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 10 Jul 2014 14:36:51 +0000 (15:36 +0100)
commit90447d7f1f4e02490c3808f019a90742f7a3de89
treec97d968666aa0d805938a0f9c33a7dad6fa7e09a
parent5df01f6e2653ba38b3c55ef137dfc83fb99fad70
xen: arm: allocate more than one bank for 1:1 domain 0 if needed

Depending on where Xen and the initial modules were loaded into RAM we may not
be able to allocate a suitably contiguous block of memory for dom0. Especially
since the allocations made by alloc_domheap_pages are naturally aligned (e.g. a
1GB allocation must be at a 1GB boundary).

The alignment requirement in particular is a huge limitation, meaning that even
dom0_mem0=1G on a 2GB system is pretty likely to fail unless you are very
careful with your load addresses. People were also having trouble with dom0 >
128MB on the 1GB cubieboard2 when using fairly standard load addresses for
things.

This patch tries to allocate multiple banks of memory in order to try and
satisfy the entire requested domain 0 allocation. Sadly this turns out to be
pretty tricky to arrange (see the large comment in the code).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Karim Raslan <karim.allah.ahmed@gmail.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
xen/arch/arm/domain_build.c