linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Atish Patra <atish.patra@wdc.com>
To: "linux-riscv@lists.infradead.org" <linux-riscv@lists.infradead.org>
Cc: Andreas Schwab <schwab@suse.de>, Anup Patel <Anup.Patel@wdc.com>
Subject: kernel after 5.0-rc2 may not boot using BBL
Date: Thu, 7 Feb 2019 22:08:14 -0800	[thread overview]
Message-ID: <4b647c0d-86de-fed3-aca6-d248b9aff762@wdc.com> (raw)

If you are building a larger kernel image, it may not boot using BBL 
after 5.0-rc2. It works fine with OpenSBI though.

Here is the reasoning in case anybody else is facing the same issue.

The following patch was added 5.0-rc2 which helps reduce the flat image 
size for Linux kernel.

"22e6a2e1 RISC-V: Make BSS section as the last section in vmlinux.lds.S"

As the BSS section is moved to the end of the ELF, flat image will not 
include it. As BBL copies the DTB at the next 2MB page boundary, BSS
section may overlap with DTB address. Kernel clears BSS section during 
early boot which may clear the DTB as well leading to a boot failure.

OpenSBI always copies the DTB far ahead in the memory (0x82200000). 
That's why you won't see any issue with OpenSBI.

Here is a BBL fix that can solve this problem. I will submit a PR to 
riscv-pk.

diff --git a/bbl/bbl.c b/bbl/bbl.c
index 1b96a9d5..0d448d82 100644
--- a/bbl/bbl.c
+++ b/bbl/bbl.c
@@ -14,7 +14,7 @@ static uintptr_t dtb_output()
  {
    extern char _payload_end;
    uintptr_t end = (uintptr_t) &_payload_end;
-  return (end + MEGAPAGE_SIZE - 1) / MEGAPAGE_SIZE * MEGAPAGE_SIZE;
+  return (end + 16 * MEGAPAGE_SIZE - 1) / MEGAPAGE_SIZE * MEGAPAGE_SIZE;
  }

Thanks Anup for the explanation and above fix.


Regards,
Atish

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

             reply	other threads:[~2019-02-08  6:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  6:08 Atish Patra [this message]
2019-02-08  8:32 ` kernel after 5.0-rc2 may not boot using BBL Christoph Hellwig
2019-02-08  9:02   ` Anup Patel
2019-02-08  9:13     ` Christoph Hellwig
2019-02-08  9:17       ` Anup Patel
2019-02-08 17:28         ` Palmer Dabbelt
2019-02-09  3:30           ` Anup Patel
2019-02-11  8:25             ` Christoph Hellwig
2019-02-11  8:45               ` Anup Patel
2019-02-12  1:24                 ` Michael Clark
2019-02-13 21:00                   ` Palmer Dabbelt
2019-02-11 19:54               ` Palmer Dabbelt

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=4b647c0d-86de-fed3-aca6-d248b9aff762@wdc.com \
    --to=atish.patra@wdc.com \
    --cc=Anup.Patel@wdc.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=schwab@suse.de \
    /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).