Linux-RISC-V Archive on lore.kernel.org
 help / Atom feed
* [PATCH] arch: riscv: support kernel command line forcing when no DTB passed
@ 2018-12-18  3:15 Paul Walmsley
  2019-01-15 15:44 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Walmsley @ 2018-12-18  3:15 UTC (permalink / raw)
  To: linux-riscv, linux-kernel; +Cc: paul, palmer, aou


CONFIG_CMDLINE_FORCE doesn't work on RISC-V when no DTB is passed into
the kernel.  This is because the code that forces the kernel command
line only runs if a valid DTB is present at boot.  During debugging,
it's useful to have the ability to force kernel command lines even
when no DTB is present.  This patch adds support for doing so.

Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-riscv@lists.infradead.org
Cc: linux-kernel@vger.kernel.org (open list)
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---

Applies on v4.20-rc7.

 arch/riscv/kernel/setup.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 2c290e6aaa6e..e6b962ff39b1 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -171,7 +171,14 @@ asmlinkage void __init setup_vm(void)
 
 void __init parse_dtb(unsigned int hartid, void *dtb)
 {
-	early_init_dt_scan(__va(dtb));
+	if (!early_init_dt_scan(__va(dtb)))
+		return;
+
+	pr_err("No DTB passed to the kernel\n");
+#ifdef CONFIG_CMDLINE_FORCE
+	strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+	pr_info("Forcing kernel command line to: %s\n", boot_command_line);
+#endif
 }
 
 static void __init setup_bootmem(void)
-- 
2.20.0


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

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

* Re: [PATCH] arch: riscv: support kernel command line forcing when no DTB passed
  2018-12-18  3:15 [PATCH] arch: riscv: support kernel command line forcing when no DTB passed Paul Walmsley
@ 2019-01-15 15:44 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2019-01-15 15:44 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: linux-riscv, paul, palmer, linux-kernel, aou

On Mon, Dec 17, 2018 at 07:15:12PM -0800, Paul Walmsley wrote:
> 
> CONFIG_CMDLINE_FORCE doesn't work on RISC-V when no DTB is passed into
> the kernel.  This is because the code that forces the kernel command
> line only runs if a valid DTB is present at boot.  During debugging,
> it's useful to have the ability to force kernel command lines even
> when no DTB is present.  This patch adds support for doing so.

This looks fine to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

I just wish all this command line magic could be moved to common
code somewhere instead of being reinvented badly in every port..

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

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18  3:15 [PATCH] arch: riscv: support kernel command line forcing when no DTB passed Paul Walmsley
2019-01-15 15:44 ` Christoph Hellwig

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org infradead-linux-riscv@archiver.kernel.org
	public-inbox-index linux-riscv


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/ public-inbox