linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] OF: Add a warning in case chosen node is not present
@ 2018-11-10  0:53 Nick Kossifidis
  2018-11-10  0:53 ` Nick Kossifidis
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nick Kossifidis @ 2018-11-10  0:53 UTC (permalink / raw)
  To: linux-riscv

On architectures that only get their bootargs through devicetree's
chosen node (such as RISC-V), that node is mandatory. After a
discussion with Rob [1] I'm adding a warning in case chosen node
is not present, to let users know about it.

[1]: https://patchwork.ozlabs.org/patch/984224/#2016136

Signed-off-by: Nick Kossifidis <mick@ics.forth.gr>
---
 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 bb532aae0d92..7ff67bf1f6d6 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1200,8 +1200,12 @@ bool __init early_init_dt_verify(void *params)
 
 void __init early_init_dt_scan_nodes(void)
 {
+	int rc = 0;
+
 	/* Retrieve various information from the /chosen node */
-	of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
+	rc = of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
+	if (!rc)
+		pr_warn("No chosen node found, continuing without\n");
 
 	/* Initialize {size,address}-cells info */
 	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-- 
2.16.4

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

* [PATCH] OF: Add a warning in case chosen node is not present
  2018-11-10  0:53 [PATCH] OF: Add a warning in case chosen node is not present Nick Kossifidis
@ 2018-11-10  0:53 ` Nick Kossifidis
  2018-11-11 21:52 ` Palmer Dabbelt
  2018-12-03 23:41 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Nick Kossifidis @ 2018-11-10  0:53 UTC (permalink / raw)
  To: devicetree; +Cc: Nick Kossifidis, linux-riscv, robh+dt, frowand.list, palmer

On architectures that only get their bootargs through devicetree's
chosen node (such as RISC-V), that node is mandatory. After a
discussion with Rob [1] I'm adding a warning in case chosen node
is not present, to let users know about it.

[1]: https://patchwork.ozlabs.org/patch/984224/#2016136

Signed-off-by: Nick Kossifidis <mick@ics.forth.gr>
---
 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 bb532aae0d92..7ff67bf1f6d6 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1200,8 +1200,12 @@ bool __init early_init_dt_verify(void *params)
 
 void __init early_init_dt_scan_nodes(void)
 {
+	int rc = 0;
+
 	/* Retrieve various information from the /chosen node */
-	of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
+	rc = of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
+	if (!rc)
+		pr_warn("No chosen node found, continuing without\n");
 
 	/* Initialize {size,address}-cells info */
 	of_scan_flat_dt(early_init_dt_scan_root, NULL);
-- 
2.16.4


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

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

* [PATCH] OF: Add a warning in case chosen node is not present
  2018-11-10  0:53 [PATCH] OF: Add a warning in case chosen node is not present Nick Kossifidis
  2018-11-10  0:53 ` Nick Kossifidis
@ 2018-11-11 21:52 ` Palmer Dabbelt
  2018-11-11 21:52   ` Palmer Dabbelt
  2018-12-03 23:41 ` Rob Herring
  2 siblings, 1 reply; 5+ messages in thread
From: Palmer Dabbelt @ 2018-11-11 21:52 UTC (permalink / raw)
  To: linux-riscv

On Fri, 09 Nov 2018 16:53:17 PST (-0800), mick at ics.forth.gr wrote:
> On architectures that only get their bootargs through devicetree's
> chosen node (such as RISC-V), that node is mandatory. After a
> discussion with Rob [1] I'm adding a warning in case chosen node
> is not present, to let users know about it.
>
> [1]: https://patchwork.ozlabs.org/patch/984224/#2016136
>
> Signed-off-by: Nick Kossifidis <mick@ics.forth.gr>
> ---
>  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 bb532aae0d92..7ff67bf1f6d6 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1200,8 +1200,12 @@ bool __init early_init_dt_verify(void *params)
>
>  void __init early_init_dt_scan_nodes(void)
>  {
> +	int rc = 0;
> +
>  	/* Retrieve various information from the /chosen node */
> -	of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
> +	rc = of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
> +	if (!rc)
> +		pr_warn("No chosen node found, continuing without\n");
>
>  	/* Initialize {size,address}-cells info */
>  	of_scan_flat_dt(early_init_dt_scan_root, NULL);

Thanks!  Note that in our case we actually ignore the built-in boot arguments 
without a /chosen node, which isn't clear to me from the message.  I'm not sure 
if it's sane to warn everyone of this, but it was decided that RISC-V should 
have this behavior because it's all standard code.

In other words, it might be worth adding some sort of 

    #ifdef CONFIG_CMDLINE
        pr_warn("Due to the lack of a /chosen node, we're also ignoring your builtin kernel command-line\n");
    #endif

though that wording is, of course, a bit poor :).

Either way, 

Reviewed-by: Palmer Dabbelt <palmer@sifive.com>

as this is better than nothing!  Now I can just point users to the error and 
tell them that, obviously, they should know what it means --  I just hope I can 
remember :)

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

* Re: [PATCH] OF: Add a warning in case chosen node is not present
  2018-11-11 21:52 ` Palmer Dabbelt
@ 2018-11-11 21:52   ` Palmer Dabbelt
  0 siblings, 0 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2018-11-11 21:52 UTC (permalink / raw)
  To: mick; +Cc: mick, devicetree, linux-riscv, robh+dt, frowand.list

On Fri, 09 Nov 2018 16:53:17 PST (-0800), mick@ics.forth.gr wrote:
> On architectures that only get their bootargs through devicetree's
> chosen node (such as RISC-V), that node is mandatory. After a
> discussion with Rob [1] I'm adding a warning in case chosen node
> is not present, to let users know about it.
>
> [1]: https://patchwork.ozlabs.org/patch/984224/#2016136
>
> Signed-off-by: Nick Kossifidis <mick@ics.forth.gr>
> ---
>  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 bb532aae0d92..7ff67bf1f6d6 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1200,8 +1200,12 @@ bool __init early_init_dt_verify(void *params)
>
>  void __init early_init_dt_scan_nodes(void)
>  {
> +	int rc = 0;
> +
>  	/* Retrieve various information from the /chosen node */
> -	of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
> +	rc = of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
> +	if (!rc)
> +		pr_warn("No chosen node found, continuing without\n");
>
>  	/* Initialize {size,address}-cells info */
>  	of_scan_flat_dt(early_init_dt_scan_root, NULL);

Thanks!  Note that in our case we actually ignore the built-in boot arguments 
without a /chosen node, which isn't clear to me from the message.  I'm not sure 
if it's sane to warn everyone of this, but it was decided that RISC-V should 
have this behavior because it's all standard code.

In other words, it might be worth adding some sort of 

    #ifdef CONFIG_CMDLINE
        pr_warn("Due to the lack of a /chosen node, we're also ignoring your builtin kernel command-line\n");
    #endif

though that wording is, of course, a bit poor :).

Either way, 

Reviewed-by: Palmer Dabbelt <palmer@sifive.com>

as this is better than nothing!  Now I can just point users to the error and 
tell them that, obviously, they should know what it means --  I just hope I can 
remember :)

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

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

* Re: [PATCH] OF: Add a warning in case chosen node is not present
  2018-11-10  0:53 [PATCH] OF: Add a warning in case chosen node is not present Nick Kossifidis
  2018-11-10  0:53 ` Nick Kossifidis
  2018-11-11 21:52 ` Palmer Dabbelt
@ 2018-12-03 23:41 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2018-12-03 23:41 UTC (permalink / raw)
  To: Nick Kossifidis; +Cc: devicetree, linux-riscv, palmer, frowand.list

On Sat, Nov 10, 2018 at 02:53:17AM +0200, Nick Kossifidis wrote:
> On architectures that only get their bootargs through devicetree's
> chosen node (such as RISC-V), that node is mandatory. After a
> discussion with Rob [1] I'm adding a warning in case chosen node
> is not present, to let users know about it.
> 
> [1]: https://patchwork.ozlabs.org/patch/984224/#2016136
> 
> Signed-off-by: Nick Kossifidis <mick@ics.forth.gr>
> ---
>  drivers/of/fdt.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Applied.

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

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

end of thread, other threads:[~2018-12-03 23:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-10  0:53 [PATCH] OF: Add a warning in case chosen node is not present Nick Kossifidis
2018-11-10  0:53 ` Nick Kossifidis
2018-11-11 21:52 ` Palmer Dabbelt
2018-11-11 21:52   ` Palmer Dabbelt
2018-12-03 23:41 ` Rob Herring

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