From: Wang Nan <wangnan0@huawei.com>
To: Simon Horman <horms@verge.net.au>, Daniel Mack <zonque@gmail.com>
Cc: kexec@lists.infradead.org, s.neumann@raumfeld.com
Subject: Re: [PATCH v2] zImage-arm: get rid of static offset
Date: Mon, 5 May 2014 20:21:53 +0800 [thread overview]
Message-ID: <53678261.1000006@huawei.com> (raw)
In-Reply-To: <20140502021105.GF2265@verge.net.au>
On 2014/5/2 10:11, Simon Horman wrote:
> On Thu, May 01, 2014 at 12:42:05PM +0200, Daniel Mack wrote:
>> The code in arch/arm/kexec-zImage-arm.c currently enforces a hard limit
>> on the maximum size a dtb blob can occupy. This limit is set to 32k,
>> which is quite low for device tree blobs nowadays.
>>
>> Get rid of this assumption, and calculate the added size dynamically.
>> For this, we need to slurp in the dtb file earlier in order to
>> determine its size, because the memory hole allocation for 'base'
>> takes this size into account.
>>
>> For ATAGs, we keep the current value of 32k, which should in fact be
>> enough.
>>
>> With this change in place, the 'DTB too large!' error message can go
>> away. Successfully tested on a AM335x board.
>>
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> [s.neumann@raumfeld.com: Fix ATAGs case]
>> Reported-and-tested-by: Sven Neumann <s.neumann@raumfeld.com>
>> ---
>> v2 includes a fixup from Sven Neumann for ATAGs driven boards.
>> The patch is in tested on a larger number of machines by now.
>
> Thanks, applied.
>
After applying this patch, the second kernel on qemu never works. I have
posted a patch on it to solve this problem:
[kexec-tools][PATCH] zImage-arm: bugfix: load kernel at TEXT_OFFSET
I think there must be some misunderstanding about "DTB too large!" problem.
DTB is pasted after initrd by kexec, not before the kernel. See following figures:
When using DTB:
|<--- TEXT_OFFSET (0x8000) ------->|
|<-- atags, DTB *is not here* ---->|<-- zImage -->|<-- initrd -->|<-- *DTB is here* -->|
When using ATAGS:
|<-- TEXT_OFFSET (0x8000) ->|
|<-- 0x1000 --|<-- atags -->|<-- zImage -->|<-- initrd -->|
It seems the original code is incorrect:
if (base + atag_offset + dtb_length > base + offset) { // offset is TEXT_OFFSET
fprintf(stderr, "DTB too large!\n");
return -1;
}
This code assumes dtb is loaded between atags_offset and zImage, can use only 28KiB memory,
same as atags. However, dtb is loaded after initrd, no upper limit is taken place, so simply
remove the above checking is enough. In my patch, I use locate_holes() to endure there is enough
space for initrd and dtb.
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2014-05-05 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 10:42 [PATCH v2] zImage-arm: get rid of static offset Daniel Mack
2014-05-02 2:11 ` Simon Horman
2014-05-05 12:21 ` Wang Nan [this message]
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=53678261.1000006@huawei.com \
--to=wangnan0@huawei.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=s.neumann@raumfeld.com \
--cc=zonque@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.