linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* kernel after 5.0-rc2 may not boot using BBL
@ 2019-02-08  6:08 Atish Patra
  2019-02-08  8:32 ` Christoph Hellwig
  0 siblings, 1 reply; 12+ messages in thread
From: Atish Patra @ 2019-02-08  6:08 UTC (permalink / raw)
  To: linux-riscv; +Cc: Andreas Schwab, Anup Patel

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-02-13 21:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08  6:08 kernel after 5.0-rc2 may not boot using BBL Atish Patra
2019-02-08  8:32 ` 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

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).