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

Re: [Xen-devel] Physical memory start contraints in the Linux kernel (Was: Re: Xen osstest on Calxeda midway progress (Was: Re: [xen-unstable test] 21486: tolerable FAIL - PUSHED))

On Tue, Nov 12, 2013 at 12:25:18PM +0000, Stefano Stabellini wrote:
> Arnd, Olof,

This isn't really an arm-soc thing, it's a core ARM thing...

> we have been having this discussion on xen-devel regarding whether Xen
> should be allowed to modify the start address of the physical memory
> region in device tree before passing it to dom0 or not.
> The reason why this question is coming up now, is that we realized that
> we are going to have to live with the 1:1 pseudo-physical to physical
> mapping for dom0 for a while. This limits the ability of the hypervisor
> of allocating dom0 memory wherever it wants. Xen can allocate dom0
> memory from the low end but maybe not exactly from the start.
> As a result we would adjust the start of physical memory in device tree
> to match the start of the memory region allocated for dom0. For example
> on the Arndale it could be 0x80800000 instead of 0x80000000.
> Unfortunately not all the platforms can cope with this very well. In
> particular the Arndale seems to have issues.

That should be no problem provided that:

(a) you load the kernel somewhere between 0x80800000 and 0x80ffffff -
the decompressor will decide that the start of memory is 0x80800000, and
place the kernel at 0x80808000.
(b) _at the moment_ you modify DT to specify that memory starts at
0x80800000 and not 0x80000000.

(b) is going to change soon: the shmobile and zynq platforms already have
a problem with their memory setup which needs a patch in this area, and
the patch will have the side effect of automatically removing (in your
case) 0x80000000 to 0x80800000.  See the patch below.

If there's any other issues with multiplatform, then yes, we want to hear
about them.

 arch/arm/kernel/setup.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index f52150d2ec00..1957d54198ad 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -660,6 +660,17 @@ int __init arm_add_memory(u64 start, u64 size)
+       if (aligned_start < PHYS_OFFSET) {
+               if (aligned_start + size < PHYS_OFFSET) {
+                       pr_info("Ignoring memory below PHYS_OFFSET: 
+                               aligned_start, aligned_start + size);
+                       return -EINVAL;
+               }
+               size -= PHYS_OFFSET - aligned_start;
+               aligned_start = PHYS_OFFSET;
+       }
        bank->start = aligned_start;
        bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1);

Xen-devel mailing list



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