diff mbox

[v2,3/3] xen/arm: allow console=hvc0 to be omitted for guests

Message ID 1424267513-15836-4-git-send-email-julien.grall@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Julien Grall Feb. 18, 2015, 1:51 p.m. UTC
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

This patch registers hvc0 as the preferred console if no console
has been specified explicitly on the kernel command line.

The purpose is to allow platform agnostic kernels and boot images
(such as distro installers) to boot in a Xen/ARM domU without the
need to modify the command line by hand.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
---
 arch/arm/xen/enlighten.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ian Campbell Feb. 18, 2015, 3:25 p.m. UTC | #1
On Wed, 2015-02-18 at 13:51 +0000, Julien Grall wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> This patch registers hvc0 as the preferred console if no console
> has been specified explicitly on the kernel command line.
> 
> The purpose is to allow platform agnostic kernels and boot images
> (such as distro installers) to boot in a Xen/ARM domU without the
> need to modify the command line by hand.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Rob Herring Feb. 18, 2015, 3:50 p.m. UTC | #2
On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> This patch registers hvc0 as the preferred console if no console
> has been specified explicitly on the kernel command line.
>
> The purpose is to allow platform agnostic kernels and boot images
> (such as distro installers) to boot in a Xen/ARM domU without the
> need to modify the command line by hand.

How does this interact with DT chosen stdout-path?

Is there a node for hvc0?

Rob

>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Julien Grall <julien.grall@linaro.org>
> ---
>  arch/arm/xen/enlighten.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 1660432..904bd2d 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -24,6 +24,7 @@
>  #include <linux/cpuidle.h>
>  #include <linux/cpufreq.h>
>  #include <linux/cpu.h>
> +#include <linux/console.h>
>
>  #include <linux/mm.h>
>
> @@ -255,6 +256,9 @@ void __init xen_early_init(void)
>                 xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
>         else
>                 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
> +
> +       if (!console_set_on_cmdline && !xen_initial_domain())
> +               add_preferred_console("hvc", 0, NULL);
>  }
>
>  static int __init xen_guest_init(void)
> --
> 2.1.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Ian Campbell Feb. 18, 2015, 4:03 p.m. UTC | #3
On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> >
> > This patch registers hvc0 as the preferred console if no console
> > has been specified explicitly on the kernel command line.
> >
> > The purpose is to allow platform agnostic kernels and boot images
> > (such as distro installers) to boot in a Xen/ARM domU without the
> > need to modify the command line by hand.
> 
> How does this interact with DT chosen stdout-path?

I think it shouldn't any more than the existing calls from e.g. the 8250
driver to preferred_console do.

> Is there a node for hvc0?

Not a direct one, it is inferred from the presence of the general Xen
node. I did vaguely consider handling a stdout-path pointing to that --
but it seemed a bit of an abuse.

Ian.
Stefano Stabellini Feb. 26, 2015, 6:22 p.m. UTC | #4
On Wed, 18 Feb 2015, Ian Campbell wrote:
> On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > >
> > > This patch registers hvc0 as the preferred console if no console
> > > has been specified explicitly on the kernel command line.
> > >
> > > The purpose is to allow platform agnostic kernels and boot images
> > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > need to modify the command line by hand.
> > 
> > How does this interact with DT chosen stdout-path?
> 
> I think it shouldn't any more than the existing calls from e.g. the 8250
> driver to preferred_console do.
>
> > Is there a node for hvc0?
> 
> Not a direct one, it is inferred from the presence of the general Xen
> node.

Xen PV consoles, including hvc0, as all the other Xen PV devices are
advertised on xenstore.


> I did vaguely consider handling a stdout-path pointing to that --
> but it seemed a bit of an abuse.
Ian Campbell Feb. 27, 2015, 9:34 a.m. UTC | #5
On Thu, 2015-02-26 at 18:22 +0000, Stefano Stabellini wrote:
> On Wed, 18 Feb 2015, Ian Campbell wrote:
> > On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > >
> > > > This patch registers hvc0 as the preferred console if no console
> > > > has been specified explicitly on the kernel command line.
> > > >
> > > > The purpose is to allow platform agnostic kernels and boot images
> > > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > > need to modify the command line by hand.
> > > 
> > > How does this interact with DT chosen stdout-path?
> > 
> > I think it shouldn't any more than the existing calls from e.g. the 8250
> > driver to preferred_console do.
> >
> > > Is there a node for hvc0?
> > 
> > Not a direct one, it is inferred from the presence of the general Xen
> > node.
> 
> Xen PV consoles, including hvc0, as all the other Xen PV devices are
> advertised on xenstore.

Do we actually use the xenstore node for hvc0? I thought we got it from
hvmparams (so the primary it can be used before xenstore is up)

> 
> 
> > I did vaguely consider handling a stdout-path pointing to that --
> > but it seemed a bit of an abuse.
>
Stefano Stabellini Feb. 27, 2015, 9:47 a.m. UTC | #6
On Fri, 27 Feb 2015, Ian Campbell wrote:
> On Thu, 2015-02-26 at 18:22 +0000, Stefano Stabellini wrote:
> > On Wed, 18 Feb 2015, Ian Campbell wrote:
> > > On Wed, 2015-02-18 at 09:50 -0600, Rob Herring wrote:
> > > > On Wed, Feb 18, 2015 at 7:51 AM, Julien Grall <julien.grall@linaro.org> wrote:
> > > > > From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > > >
> > > > > This patch registers hvc0 as the preferred console if no console
> > > > > has been specified explicitly on the kernel command line.
> > > > >
> > > > > The purpose is to allow platform agnostic kernels and boot images
> > > > > (such as distro installers) to boot in a Xen/ARM domU without the
> > > > > need to modify the command line by hand.
> > > > 
> > > > How does this interact with DT chosen stdout-path?
> > > 
> > > I think it shouldn't any more than the existing calls from e.g. the 8250
> > > driver to preferred_console do.
> > >
> > > > Is there a node for hvc0?
> > > 
> > > Not a direct one, it is inferred from the presence of the general Xen
> > > node.
> > 
> > Xen PV consoles, including hvc0, as all the other Xen PV devices are
> > advertised on xenstore.
> 
> Do we actually use the xenstore node for hvc0? I thought we got it from
> hvmparams (so the primary it can be used before xenstore is up)

We always assume that at least one PV console is available and the first
one is a bit special because it can be setup before the xenstore driver
for early boot messages and debugging purposes. However even the first
console is advertised on xenstore.
diff mbox

Patch

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 1660432..904bd2d 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -24,6 +24,7 @@ 
 #include <linux/cpuidle.h>
 #include <linux/cpufreq.h>
 #include <linux/cpu.h>
+#include <linux/console.h>
 
 #include <linux/mm.h>
 
@@ -255,6 +256,9 @@  void __init xen_early_init(void)
 		xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
 	else
 		xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+
+	if (!console_set_on_cmdline && !xen_initial_domain())
+		add_preferred_console("hvc", 0, NULL);
 }
 
 static int __init xen_guest_init(void)