From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: stefano.stabellini@eu.citrix.com, tim@xen.org,
ian.campbell@citrix.com, Julien Grall <julien.grall@linaro.org>,
patches@linaro.org
Subject: [PATCH] xen/arm: Allocate memory for dom0 from the bottom with the 1:1 Workaround
Date: Tue, 22 Oct 2013 11:51:48 +0100 [thread overview]
Message-ID: <1382439108-3669-1-git-send-email-julien.grall@linaro.org> (raw)
On Linux, the option CONFIG_ARM_PATCH_PHYS_VIRT (by default enabled) allows
the Kernel to be loaded anywhere (or nearly) by patching the translation
pv<->virt at boot time.
The current solution in Linux assuming that the delta physical address -
virtual address is always negative. A positive delta will destroy all the
optimisation to modify only a part of the translation instruction (add/sub).
By default, Xen is allocating memory from the top of memory and then
goes down. To avoid booting issue with Linux, we must allocate memory
from the bottom (ie starting from 0).
Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
xen/arch/arm/domain_build.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 0698f83..69ea6a0 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -70,12 +70,19 @@ static int set_memory_reg_11(struct domain *d, struct kernel_info *kinfo,
int reg_size = dt_cells_to_size(dt_n_addr_cells(np) + dt_n_size_cells(np));
paddr_t start;
paddr_t size;
- struct page_info *pg;
+ struct page_info *pg = NULL;
unsigned int order = get_order_from_bytes(dom0_mem);
int res;
paddr_t spfn;
+ unsigned int bits;
+
+ for ( bits = PAGE_SHIFT + 1; bits < PADDR_BITS; bits++ )
+ {
+ pg = alloc_domheap_pages(d, order, MEMF_bits(bits));
+ if ( pg != NULL )
+ break;
+ }
- pg = alloc_domheap_pages(d, order, 0);
if ( !pg )
panic("Failed to allocate contiguous memory for dom0\n");
--
1.8.3.1
next reply other threads:[~2013-10-22 10:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 10:51 Julien Grall [this message]
2013-10-22 11:26 ` [PATCH] xen/arm: Allocate memory for dom0 from the bottom with the 1:1 Workaround Ian Campbell
2013-10-22 13:58 ` Julien Grall
2013-10-22 14:01 ` Ian Campbell
2013-10-24 14:05 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382439108-3669-1-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=patches@linaro.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).