diff mbox

[1/3] ARM: debug: use kconfig choice for selecting DEBUG_LL UART

Message ID 1313530873-24961-1-git-send-email-will.deacon@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Will Deacon Aug. 16, 2011, 9:41 p.m. UTC
Enabling CONFIG_DEBUG_LL (which is required for earlyprintk) hardwires
the debug UART address into the kernel, so that we can print before the
platform is initialised.

If the user inadvertently selects multiple platforms with DEBUG_LL
enabled, the UART address may not be correct and will likely cause the
kernel to hang in the very early stages of boot.

This patch, based on a skeleton from Russell, uses a Kconfig choice for
selecting the DEBUG_LL UART, therefore allowing the user to make a
choice about the supported platform when DEBUG_LL is enabled.

Cc: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/Kconfig.debug |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)

Comments

Nicolas Pitre Aug. 18, 2011, 4:06 a.m. UTC | #1
On Tue, 16 Aug 2011, Will Deacon wrote:

> Enabling CONFIG_DEBUG_LL (which is required for earlyprintk) hardwires
> the debug UART address into the kernel, so that we can print before the
> platform is initialised.
> 
> If the user inadvertently selects multiple platforms with DEBUG_LL
> enabled, the UART address may not be correct and will likely cause the
> kernel to hang in the very early stages of boot.
> 
> This patch, based on a skeleton from Russell, uses a Kconfig choice for
> selecting the DEBUG_LL UART, therefore allowing the user to make a
> choice about the supported platform when DEBUG_LL is enabled.
> 
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

(ditto for the other 2 patches)

> ---
>  arch/arm/Kconfig.debug |   41 ++++++++++++++++++++++++-----------------
>  1 files changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 81cbe40..11604c9 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -72,6 +72,30 @@ config DEBUG_LL
>  	  in the kernel.  This is helpful if you are debugging code that
>  	  executes before the console is initialized.
>  
> +choice
> +	prompt "Kernel low-level debugging port"
> +	depends on DEBUG_LL
> +
> +	config DEBUG_DC21285_PORT
> +		bool "Kernel low-level debugging messages via footbridge serial port"
> +		depends on FOOTBRIDGE
> +		help
> +		  Say Y here if you want the debug print routines to direct
> +		  their output to the serial port in the DC21285 (Footbridge).
> +		  Saying N will cause the debug messages to appear on the first
> +		  16550 serial port.
> +
> +	config DEBUG_CLPS711X_UART2
> +		bool "Kernel low-level debugging messages via UART2"
> +		depends on ARCH_CLPS711X
> +		help
> +		  Say Y here if you want the debug print routines to direct
> +		  their output to the second serial port on these devices.
> +		  Saying N will cause the debug messages to appear on the first
> +		  serial port.
> +
> +endchoice
> +
>  config EARLY_PRINTK
>  	bool "Early printk"
>  	depends on DEBUG_LL
> @@ -100,23 +124,6 @@ config OC_ETM
>  	  buffer driver that will allow you to collect traces of the
>  	  kernel code.
>  
> -config DEBUG_DC21285_PORT
> -	bool "Kernel low-level debugging messages via footbridge serial port"
> -	depends on DEBUG_LL && FOOTBRIDGE
> -	help
> -	  Say Y here if you want the debug print routines to direct their
> -	  output to the serial port in the DC21285 (Footbridge). Saying N
> -	  will cause the debug messages to appear on the first 16550
> -	  serial port.
> -
> -config DEBUG_CLPS711X_UART2
> -	bool "Kernel low-level debugging messages via UART2"
> -	depends on DEBUG_LL && ARCH_CLPS711X
> -	help
> -	  Say Y here if you want the debug print routines to direct their
> -	  output to the second serial port on these devices.  Saying N will
> -	  cause the debug messages to appear on the first serial port.
> -
>  config DEBUG_S3C_UART
>  	depends on PLAT_SAMSUNG
>  	int "S3C UART to use for low-level debug"
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
Will Deacon Aug. 18, 2011, 9:33 a.m. UTC | #2
On Thu, Aug 18, 2011 at 05:06:25AM +0100, Nicolas Pitre wrote:
> On Tue, 16 Aug 2011, Will Deacon wrote:
> 
> > Enabling CONFIG_DEBUG_LL (which is required for earlyprintk) hardwires
> > the debug UART address into the kernel, so that we can print before the
> > platform is initialised.
> > 
> > If the user inadvertently selects multiple platforms with DEBUG_LL
> > enabled, the UART address may not be correct and will likely cause the
> > kernel to hang in the very early stages of boot.
> > 
> > This patch, based on a skeleton from Russell, uses a Kconfig choice for
> > selecting the DEBUG_LL UART, therefore allowing the user to make a
> > choice about the supported platform when DEBUG_LL is enabled.
> > 
> > Cc: Linus Walleij <linus.walleij@stericsson.com>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> (ditto for the other 2 patches)

Thanks Nicolas. Hopefully some of the other platforms will start using this
once it's merged.

Will
Will Deacon Aug. 18, 2011, 4:07 p.m. UTC | #3
Hi Shawn,

On Thu, Aug 18, 2011 at 05:11:06PM +0100, Shawn Guo wrote:
> On Tue, Aug 16, 2011 at 10:41:11PM +0100, Will Deacon wrote:
> > Enabling CONFIG_DEBUG_LL (which is required for earlyprintk) hardwires
> > the debug UART address into the kernel, so that we can print before the
> > platform is initialised.
> > 
> > If the user inadvertently selects multiple platforms with DEBUG_LL
> > enabled, the UART address may not be correct and will likely cause the
> > kernel to hang in the very early stages of boot.
> > 
> > This patch, based on a skeleton from Russell, uses a Kconfig choice for
> > selecting the DEBUG_LL UART, therefore allowing the user to make a
> > choice about the supported platform when DEBUG_LL is enabled.
> > 
> > Cc: Linus Walleij <linus.walleij@stericsson.com>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > ---
> >  arch/arm/Kconfig.debug |   41 ++++++++++++++++++++++++-----------------
> >  1 files changed, 24 insertions(+), 17 deletions(-)
> > 
> > diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> > index 81cbe40..11604c9 100644
> > --- a/arch/arm/Kconfig.debug
> > +++ b/arch/arm/Kconfig.debug
> > @@ -72,6 +72,30 @@ config DEBUG_LL
> >  	  in the kernel.  This is helpful if you are debugging code that
> >  	  executes before the console is initialized.
> >  
> > +choice
> > +	prompt "Kernel low-level debugging port"
> > +	depends on DEBUG_LL
> > +
> > +	config DEBUG_DC21285_PORT
> > +		bool "Kernel low-level debugging messages via footbridge serial port"
> > +		depends on FOOTBRIDGE
> > +		help
> > +		  Say Y here if you want the debug print routines to direct
> > +		  their output to the serial port in the DC21285 (Footbridge).
> > +		  Saying N will cause the debug messages to appear on the first
> > +		  16550 serial port.
> > +
> > +	config DEBUG_CLPS711X_UART2
> 
> I would expect this will become a long list when other platforms start
> adding CONFIG symbol here.  It may be a good idea to sort this list
> in symbol from the beginning.

I'm not sure that sorting this list in alphabetical order is a good idea.
This is a Kconfig choice, so the default value is the first one in the list
that has its dependencies satisfied. Therefore, the ordering has a direct
impact on the default UART selection.

Will
Shawn Guo Aug. 18, 2011, 4:11 p.m. UTC | #4
On Tue, Aug 16, 2011 at 10:41:11PM +0100, Will Deacon wrote:
> Enabling CONFIG_DEBUG_LL (which is required for earlyprintk) hardwires
> the debug UART address into the kernel, so that we can print before the
> platform is initialised.
> 
> If the user inadvertently selects multiple platforms with DEBUG_LL
> enabled, the UART address may not be correct and will likely cause the
> kernel to hang in the very early stages of boot.
> 
> This patch, based on a skeleton from Russell, uses a Kconfig choice for
> selecting the DEBUG_LL UART, therefore allowing the user to make a
> choice about the supported platform when DEBUG_LL is enabled.
> 
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm/Kconfig.debug |   41 ++++++++++++++++++++++++-----------------
>  1 files changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index 81cbe40..11604c9 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -72,6 +72,30 @@ config DEBUG_LL
>  	  in the kernel.  This is helpful if you are debugging code that
>  	  executes before the console is initialized.
>  
> +choice
> +	prompt "Kernel low-level debugging port"
> +	depends on DEBUG_LL
> +
> +	config DEBUG_DC21285_PORT
> +		bool "Kernel low-level debugging messages via footbridge serial port"
> +		depends on FOOTBRIDGE
> +		help
> +		  Say Y here if you want the debug print routines to direct
> +		  their output to the serial port in the DC21285 (Footbridge).
> +		  Saying N will cause the debug messages to appear on the first
> +		  16550 serial port.
> +
> +	config DEBUG_CLPS711X_UART2

I would expect this will become a long list when other platforms start
adding CONFIG symbol here.  It may be a good idea to sort this list
in symbol from the beginning.

Regards,
Shawn

> +		bool "Kernel low-level debugging messages via UART2"
> +		depends on ARCH_CLPS711X
> +		help
> +		  Say Y here if you want the debug print routines to direct
> +		  their output to the second serial port on these devices.
> +		  Saying N will cause the debug messages to appear on the first
> +		  serial port.
> +
> +endchoice
> +
>  config EARLY_PRINTK
>  	bool "Early printk"
>  	depends on DEBUG_LL
> @@ -100,23 +124,6 @@ config OC_ETM
>  	  buffer driver that will allow you to collect traces of the
>  	  kernel code.
>  
> -config DEBUG_DC21285_PORT
> -	bool "Kernel low-level debugging messages via footbridge serial port"
> -	depends on DEBUG_LL && FOOTBRIDGE
> -	help
> -	  Say Y here if you want the debug print routines to direct their
> -	  output to the serial port in the DC21285 (Footbridge). Saying N
> -	  will cause the debug messages to appear on the first 16550
> -	  serial port.
> -
> -config DEBUG_CLPS711X_UART2
> -	bool "Kernel low-level debugging messages via UART2"
> -	depends on DEBUG_LL && ARCH_CLPS711X
> -	help
> -	  Say Y here if you want the debug print routines to direct their
> -	  output to the second serial port on these devices.  Saying N will
> -	  cause the debug messages to appear on the first serial port.
> -
>  config DEBUG_S3C_UART
>  	depends on PLAT_SAMSUNG
>  	int "S3C UART to use for low-level debug"
> -- 
> 1.7.0.4
Shawn Guo Aug. 19, 2011, 4:59 a.m. UTC | #5
On Thu, Aug 18, 2011 at 05:07:12PM +0100, Will Deacon wrote:
> Hi Shawn,
> 
> On Thu, Aug 18, 2011 at 05:11:06PM +0100, Shawn Guo wrote:
> > On Tue, Aug 16, 2011 at 10:41:11PM +0100, Will Deacon wrote:
> > > Enabling CONFIG_DEBUG_LL (which is required for earlyprintk) hardwires
> > > the debug UART address into the kernel, so that we can print before the
> > > platform is initialised.
> > > 
> > > If the user inadvertently selects multiple platforms with DEBUG_LL
> > > enabled, the UART address may not be correct and will likely cause the
> > > kernel to hang in the very early stages of boot.
> > > 
> > > This patch, based on a skeleton from Russell, uses a Kconfig choice for
> > > selecting the DEBUG_LL UART, therefore allowing the user to make a
> > > choice about the supported platform when DEBUG_LL is enabled.
> > > 
> > > Cc: Linus Walleij <linus.walleij@stericsson.com>
> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > > ---
> > >  arch/arm/Kconfig.debug |   41 ++++++++++++++++++++++++-----------------
> > >  1 files changed, 24 insertions(+), 17 deletions(-)
> > > 
> > > diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> > > index 81cbe40..11604c9 100644
> > > --- a/arch/arm/Kconfig.debug
> > > +++ b/arch/arm/Kconfig.debug
> > > @@ -72,6 +72,30 @@ config DEBUG_LL
> > >  	  in the kernel.  This is helpful if you are debugging code that
> > >  	  executes before the console is initialized.
> > >  
> > > +choice
> > > +	prompt "Kernel low-level debugging port"
> > > +	depends on DEBUG_LL
> > > +
> > > +	config DEBUG_DC21285_PORT
> > > +		bool "Kernel low-level debugging messages via footbridge serial port"
> > > +		depends on FOOTBRIDGE
> > > +		help
> > > +		  Say Y here if you want the debug print routines to direct
> > > +		  their output to the serial port in the DC21285 (Footbridge).
> > > +		  Saying N will cause the debug messages to appear on the first
> > > +		  16550 serial port.
> > > +
> > > +	config DEBUG_CLPS711X_UART2
> > 
> > I would expect this will become a long list when other platforms start
> > adding CONFIG symbol here.  It may be a good idea to sort this list
> > in symbol from the beginning.
> 
> I'm not sure that sorting this list in alphabetical order is a good idea.
> This is a Kconfig choice, so the default value is the first one in the list
> that has its dependencies satisfied. Therefore, the ordering has a direct
> impact on the default UART selection.
> 
I'm unsure that the default UART selection makes much sense here.
When we build so many platforms into single image, it's hard to say
which one should be the default.  People anyway need to check if the
the UART selection matches the platform they are debugging on.

BTW, I just posted one patch for imx based on your series.  Are you
interested in folding it into yours?
diff mbox

Patch

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 81cbe40..11604c9 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -72,6 +72,30 @@  config DEBUG_LL
 	  in the kernel.  This is helpful if you are debugging code that
 	  executes before the console is initialized.
 
+choice
+	prompt "Kernel low-level debugging port"
+	depends on DEBUG_LL
+
+	config DEBUG_DC21285_PORT
+		bool "Kernel low-level debugging messages via footbridge serial port"
+		depends on FOOTBRIDGE
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to the serial port in the DC21285 (Footbridge).
+		  Saying N will cause the debug messages to appear on the first
+		  16550 serial port.
+
+	config DEBUG_CLPS711X_UART2
+		bool "Kernel low-level debugging messages via UART2"
+		depends on ARCH_CLPS711X
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to the second serial port on these devices.
+		  Saying N will cause the debug messages to appear on the first
+		  serial port.
+
+endchoice
+
 config EARLY_PRINTK
 	bool "Early printk"
 	depends on DEBUG_LL
@@ -100,23 +124,6 @@  config OC_ETM
 	  buffer driver that will allow you to collect traces of the
 	  kernel code.
 
-config DEBUG_DC21285_PORT
-	bool "Kernel low-level debugging messages via footbridge serial port"
-	depends on DEBUG_LL && FOOTBRIDGE
-	help
-	  Say Y here if you want the debug print routines to direct their
-	  output to the serial port in the DC21285 (Footbridge). Saying N
-	  will cause the debug messages to appear on the first 16550
-	  serial port.
-
-config DEBUG_CLPS711X_UART2
-	bool "Kernel low-level debugging messages via UART2"
-	depends on DEBUG_LL && ARCH_CLPS711X
-	help
-	  Say Y here if you want the debug print routines to direct their
-	  output to the second serial port on these devices.  Saying N will
-	  cause the debug messages to appear on the first serial port.
-
 config DEBUG_S3C_UART
 	depends on PLAT_SAMSUNG
 	int "S3C UART to use for low-level debug"