From: Grant Likely <grant.likely@linaro.org>
To: Geert Uytterhoeven <geert+renesas@glider.be>,
Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH] of: Fix memory block alignment in early_init_dt_add_memory_arch()
Date: Wed, 27 Aug 2014 11:30:48 +0100 [thread overview]
Message-ID: <20140827103048.80BBBC409CB@trevor.secretlab.ca> (raw)
In-Reply-To: <1408547431-24001-1-git-send-email-geert+renesas@glider.be>
On Wed, 20 Aug 2014 17:10:31 +0200, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> If a memory block is not aligned to PAGE_SIZE, its base address must be
> rounded up, not down, and its size must be reduced.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Looks reasonable. What is the situation that exposed this problem?
Should size be checked for page alignment also?
g.
> ---
> drivers/of/fdt.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index f46a24ffa3fe..95fa81b8ca19 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -928,7 +928,11 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
> {
> const u64 phys_offset = __pa(PAGE_OFFSET);
> - base &= PAGE_MASK;
> +
> + if (!PAGE_ALIGNED(base)) {
> + size -= PAGE_SIZE - (base & ~PAGE_MASK);
> + base = PAGE_ALIGN(base);
> + }
> size &= PAGE_MASK;
>
> if (base > MAX_PHYS_ADDR) {
> --
> 1.9.1
>
next prev parent reply other threads:[~2014-08-27 10:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 15:10 Geert Uytterhoeven
2014-08-27 10:30 ` Grant Likely [this message]
2014-08-27 11:08 ` Geert Uytterhoeven
2014-09-08 13:55 ` Grant Likely
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=20140827103048.80BBBC409CB@trevor.secretlab.ca \
--to=grant.likely@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.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
all inboxes | Powered by JetHome®