From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: stefano.stabellini@eu.citrix.com, andre.przywara@linaro.org,
patches@linaro.org, xen-devel@lists.xen.org
Subject: Re: [PATCH 1/2] xen/arm: Add support to load initrd in dom0
Date: Wed, 25 Sep 2013 16:36:54 +0100 [thread overview]
Message-ID: <52430316.6080205@linaro.org> (raw)
In-Reply-To: <1380123014.4910.29.camel@kazak.uk.xensource.com>
On 09/25/2013 04:30 PM, Ian Campbell wrote:
> On Wed, 2013-09-25 at 16:23 +0100, Julien Grall wrote:
>> On 09/25/2013 04:15 PM, Ian Campbell wrote:
>>> On Mon, 2013-09-16 at 16:20 +0100, Julien Grall wrote:
>>>> @@ -806,7 +821,8 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
>>>> goto err;
>>>>
>>>> /* Actual new size */
>>>> - new_size = fdt_totalsize(kinfo->fdt);
>>>> + initrd_len = early_info.modules.module[MOD_INITRD].size;
>>>
>>> I think you need to check nr_modules here and in write_properties (which
>>> I already trimmed by mistake.
>>>
>>
>> Even if we check nr_modules, we can't assume MOD_INITRD is the last
>> modules in the array, so it's possible to have nr_modules greater than
>> MOD_INITRD but the module is not set. That's why I only choose to rely
>> on size.
>
> Hrm that's true.
>
>>> .size may not be initialised otherwise. (in reality it's probably
>>> in .bss not sure I want to rely on that though)
>>
>> It's in .bss, on common/device_tree.c we already rely that this
>> structure is zeroed (nr_modules is never initialized to 0).
>
> OK, I guess its fine then.
>
>>
>>
>>>
>>>> + new_size = fdt_totalsize(kinfo->fdt) + initrd_len;
>>>>
>>>> /*
>>>> * DTB must be loaded such that it does not conflict with the
>>>> @@ -815,15 +831,20 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
>>>> * the recommendation in Documentation/arm64/booting.txt is below
>>>> * 512MB. Place at 128MB, (or, if we have less RAM, as high as
>>>> * possible) in order to satisfy both.
>>>> + * If the bootloader provides an initrd, it will be loaded just
>>>> + * after the DTB.
>>>> */
>>>> end = kinfo->mem.bank[0].start + kinfo->mem.bank[0].size;
>>>> end = MIN(kinfo->mem.bank[0].start + (128<<20) + new_size, end);
>>>>
>>>> - kinfo->dtb_paddr = end - fdt_totalsize(kinfo->fdt);
>>>> + kinfo->initrd_paddr = end - initrd_len;
>>>> + kinfo->initrd_paddr &= ~((1 << 20) - 1);
>>>
>>> 1MB aligned, why not 2 like most things?
>>
>> A mistake, I will fix it in the next patch series.
>
> Actually, this extra alignment makes me think that maybe new_size needs
> to account for the slop too? Does it?
> Otherwise start + 128M + new_size doesn't make it such that
> {dtb,initrd}_paddr are actually above 128M?
>
Right, what about?
#define ALIGN_2MB(size) ((len) + ((1 << 20 - 1)) & (~((1 << 20) - 1))
new_size = ALIGN_2MB(dtb_size) + ALIGN_2MB(initrd_size)
--
Julien Grall
next prev parent reply other threads:[~2013-09-25 15:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 15:20 [PATCH 0/2] ARM: Support initrd loading Julien Grall
2013-09-16 15:20 ` [PATCH 1/2] xen/arm: Add support to load initrd in dom0 Julien Grall
2013-09-25 15:15 ` Ian Campbell
2013-09-25 15:23 ` Julien Grall
2013-09-25 15:30 ` Ian Campbell
2013-09-25 15:36 ` Julien Grall [this message]
2013-09-25 15:44 ` Ian Campbell
2013-09-25 15:48 ` Julien Grall
2013-09-16 15:20 ` [PATCH 2/2] xen/dts: Support Linux initrd DT bindings Julien Grall
2013-09-25 15:16 ` 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=52430316.6080205@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=andre.przywara@linaro.org \
--cc=patches@linaro.org \
--cc=stefano.stabellini@eu.citrix.com \
--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).