All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: tim@xen.org, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH 4/4] dt-uart: support /chosen/stdout-path property.
Date: Wed, 07 Jan 2015 16:42:29 +0000	[thread overview]
Message-ID: <54AD61F5.2080205@linaro.org> (raw)
In-Reply-To: <1420644701-26776-4-git-send-email-ian.campbell@citrix.com>

Hi Ian,

On 07/01/15 15:31, Ian Campbell wrote:
> ePAPR v1.1 section 3.5 defines the /chosen/stdout-path property to
> refer to the device to be used for boot console output, so if no
> dtuart property is given try to use that instead. This will make Xen
> find a suitable console by default on DT platforms which include this
> property.
> 
> As it happens the dtuart option has the exact same syntax as
> stdout-path, so we can just copy the value into that buffer if it is
> empty.
> 
> FWIW support for this was added to Linux in v3.19-rc1 (7914a7c5651a
> "of: support passing console options with stdout-path") and a fairly
> large number of the dts files shipped with Linux have already included
> a stdout-path property for quite a while now.
> 
> Since there is a base of existing device trees with the property, we
> do not support the legacy ',' options separator so we remain
> compatible.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  xen/arch/arm/domain_build.c |    2 ++
>  xen/drivers/char/dt-uart.c  |   29 +++++++++++++++++++++++++++--
>  2 files changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index de180d8..c33a73c 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -424,6 +424,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
>           *   bootargs (from module #1, above).
>           * * remove bootargs,  xen,dom0-bootargs, xen,xen-bootargs,
>           *   linux,initrd-start and linux,initrd-end.
> +         * * remove stdout-path.
>           * * remove bootargs, linux,uefi-system-table,
>           *   linux,uefi-mmap-start, linux,uefi-mmap-size,
>           *   linux,uefi-mmap-desc-size, and linux,uefi-mmap-desc-ver
> @@ -434,6 +435,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
>              if ( dt_property_name_is_equal(prop, "xen,xen-bootargs") ||
>                   dt_property_name_is_equal(prop, "linux,initrd-start") ||
>                   dt_property_name_is_equal(prop, "linux,initrd-end") ||
> +                 dt_property_name_is_equal(prop, "stdout-path") ||
>                   dt_property_name_is_equal(prop, "linux,uefi-system-table") ||
>                   dt_property_name_is_equal(prop, "linux,uefi-mmap-start") ||
>                   dt_property_name_is_equal(prop, "linux,uefi-mmap-size") ||
> diff --git a/xen/drivers/char/dt-uart.c b/xen/drivers/char/dt-uart.c
> index 54e65fc..08b0d76 100644
> --- a/xen/drivers/char/dt-uart.c
> +++ b/xen/drivers/char/dt-uart.c
> @@ -22,6 +22,7 @@
>  #include <xen/console.h>
>  #include <xen/device_tree.h>
>  #include <xen/serial.h>
> +#include <xen/errno.h>
>  
>  /*
>   * Configure UART port with a string:
> @@ -38,7 +39,7 @@ void __init dt_uart_init(void)
>  {
>      struct dt_device_node *dev;
>      int ret;
> -    const char *devpath = opt_dtuart;
> +    const char *devpath = opt_dtuart, *stdout = NULL;
>      char *options;
>  
>      if ( !console_has("dtuart") )
> @@ -46,12 +47,36 @@ void __init dt_uart_init(void)
>  
>      if ( !strcmp(opt_dtuart, "") )
>      {
> +        struct dt_device_node *chosen = dt_find_node_by_path("/chosen");

const struct dt_device_node *chosen

> +
> +        if ( chosen )
> +        {
> +            ret = dt_property_read_string(chosen, "stdout-path", &stdout);
> +            if ( ret >= 0 )
> +            {
> +                printk("Taking dtuart configuration from /chosen/stdout-path\n");
> +                strlcpy(opt_dtuart, stdout, sizeof(opt_dtuart));

The final string in opt_dtuart may be truncated if stdout is bigger than
255 characters.

I would add a check to avoid hours of debugging later.

Regards,

-- 
Julien Grall

  reply	other threads:[~2015-01-07 16:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 15:31 [PATCH 0/4] dt-uart: cleanups, bugfixes and /chosen/stdout-path support Ian Campbell
2015-01-07 15:31 ` [PATCH 1/4] dt-uart: add an emacs magic block Ian Campbell
2015-01-07 16:15   ` Julien Grall
2015-01-07 15:31 ` [PATCH 2/4] dt-uart: Clarify log messages at init time Ian Campbell
2015-01-07 16:17   ` Julien Grall
2015-01-07 15:31 ` [PATCH 3/4] dt-uart: use ':' as default separator between path and options Ian Campbell
2015-01-07 16:31   ` Julien Grall
2015-01-07 16:36     ` Ian Campbell
2015-01-07 15:31 ` [PATCH 4/4] dt-uart: support /chosen/stdout-path property Ian Campbell
2015-01-07 16:42   ` Julien Grall [this message]
2015-01-07 16:47     ` Ian Campbell
2015-01-07 17:04       ` Julien Grall

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=54AD61F5.2080205@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.