linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: compress: Fix the debug prints
@ 2020-08-07 12:26 Linus Walleij
  2020-08-07 12:59 ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2020-08-07 12:26 UTC (permalink / raw)
  To: Russell King
  Cc: Fabrizio Castro, Linus Walleij, Ard Biesheuvel, linux-arm-kernel,
	Nicolas Pitre

For some platforms such as qualcomm we need to wait for the
UART to be ready before writing in the same manner as the
macro in debug.S used with the main "Uncompressing Linux ..."
text. Pass an extra temporary variable to writeb and
make it call waituart and busyuart just like the other
decomression messages.

After this the decompression debug messages work fine on
Qualcomm platforms if you compile head.S with -DDEBUG.

Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/compressed/head.S | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index ba121eea9468..b6d01ddf6f91 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -28,19 +28,19 @@
 #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
 		.macro	loadsp, rb, tmp1, tmp2
 		.endm
-		.macro	writeb, ch, rb
+		.macro	writeb, ch, rb, tmp
 		mcr	p14, 0, \ch, c0, c5, 0
 		.endm
 #elif defined(CONFIG_CPU_XSCALE)
 		.macro	loadsp, rb, tmp1, tmp2
 		.endm
-		.macro	writeb, ch, rb
+		.macro	writeb, ch, rb, tmp
 		mcr	p14, 0, \ch, c8, c0, 0
 		.endm
 #else
 		.macro	loadsp, rb, tmp1, tmp2
 		.endm
-		.macro	writeb, ch, rb
+		.macro	writeb, ch, rb, tmp
 		mcr	p14, 0, \ch, c1, c0, 0
 		.endm
 #endif
@@ -49,8 +49,10 @@
 
 #include CONFIG_DEBUG_LL_INCLUDE
 
-		.macro	writeb,	ch, rb
+		.macro	writeb,	ch, rb, tmp
+		waituart \tmp, \rb
 		senduart \ch, \rb
+		busyuart \tmp, \rb
 		.endm
 
 #if defined(CONFIG_ARCH_SA1100)
@@ -1326,7 +1328,7 @@ puts:		loadsp	r3, r2, r1
 1:		ldrb	r2, [r0], #1
 		teq	r2, #0
 		moveq	pc, lr
-2:		writeb	r2, r3
+2:		writeb	r2, r3, r1
 		mov	r1, #0x00020000
 3:		subs	r1, r1, #1
 		bne	3b
-- 
2.26.2


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

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

* Re: [PATCH] ARM: compress: Fix the debug prints
  2020-08-07 12:26 [PATCH] ARM: compress: Fix the debug prints Linus Walleij
@ 2020-08-07 12:59 ` Russell King - ARM Linux admin
  2020-08-09 20:49   ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux admin @ 2020-08-07 12:59 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Fabrizio Castro, Ard Biesheuvel, linux-arm-kernel, Nicolas Pitre

On Fri, Aug 07, 2020 at 02:26:56PM +0200, Linus Walleij wrote:
> @@ -49,8 +49,10 @@
>  
>  #include CONFIG_DEBUG_LL_INCLUDE
>  
> -		.macro	writeb,	ch, rb
> +		.macro	writeb,	ch, rb, tmp
> +		waituart \tmp, \rb
>  		senduart \ch, \rb
> +		busyuart \tmp, \rb
>  		.endm

This could likely cause problems.

waituart does things such as waiting for CTS to be asserted, and we
really don't want to block the decompressor if CTS is deasserted.

busyuart should be mostly fine though, provided the UART is actually
functional.

We haven't used either of these, we've relied on a software loop to
wait some time before queueing the next character.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

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

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

* Re: [PATCH] ARM: compress: Fix the debug prints
  2020-08-07 12:59 ` Russell King - ARM Linux admin
@ 2020-08-09 20:49   ` Linus Walleij
  2020-08-09 21:00     ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2020-08-09 20:49 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Fabrizio Castro, Ard Biesheuvel, Linux ARM, Nicolas Pitre

On Fri, Aug 7, 2020 at 2:59 PM Russell King - ARM Linux admin
<linux@armlinux.org.uk> wrote:
> On Fri, Aug 07, 2020 at 02:26:56PM +0200, Linus Walleij wrote:
> > @@ -49,8 +49,10 @@
> >
> >  #include CONFIG_DEBUG_LL_INCLUDE
> >
> > -             .macro  writeb, ch, rb
> > +             .macro  writeb, ch, rb, tmp
> > +             waituart \tmp, \rb
> >               senduart \ch, \rb
> > +             busyuart \tmp, \rb
> >               .endm
>
> This could likely cause problems.
>
> waituart does things such as waiting for CTS to be asserted, and we
> really don't want to block the decompressor if CTS is deasserted.
>
> busyuart should be mostly fine though, provided the UART is actually
> functional.

Oh I see, yeah the 8250 driver clearly does that.
I'll test with only busyuart.

I only copied this from debug.S which looks like this:

ENTRY(putc)
        addruart r1, r2, r3
        waituart r3, r1
        senduart r0, r1
        busyuart r3, r1
        mov      pc, lr
ENDPROC(putc)

This comes from commit 3b4af9bc2447
"ARM: 7672/1: uncompress debug support for multiplatform build"
I think we were just lucky that many kernels were using e.g.
PL01x and the 8250 users on multiplatform have been scratching
their head and wondered why the can't turn on
CONFIG_DEBUG_UNCOMPRESS.

I will test to drop waituart here as well, it seems it could lead to the
same problem here with 8250 UARTs.

> We haven't used either of these, we've relied on a software loop to
> wait some time before queueing the next character.

I think it mostly works, but I was baffled that I didn't get the debug
prints on this Qualcomm platforms, while the "Uncompressing Linux..."
message was working fine. Adding this made it work.

Yours,
Linus Walleij

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

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

* Re: [PATCH] ARM: compress: Fix the debug prints
  2020-08-09 20:49   ` Linus Walleij
@ 2020-08-09 21:00     ` Russell King - ARM Linux admin
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux admin @ 2020-08-09 21:00 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Fabrizio Castro, Ard Biesheuvel, Linux ARM, Nicolas Pitre

On Sun, Aug 09, 2020 at 10:49:01PM +0200, Linus Walleij wrote:
> This comes from commit 3b4af9bc2447
> "ARM: 7672/1: uncompress debug support for multiplatform build"
> I think we were just lucky that many kernels were using e.g.
> PL01x and the 8250 users on multiplatform have been scratching
> their head and wondered why the can't turn on
> CONFIG_DEBUG_UNCOMPRESS.

Yep, it has been useful in the distant past when debugging the kernel at
a very low level to be able to "pause" the kernel, or to guarantee that
we grab all messages (using hardware flow control).  However, I suspect
we don't actually need that facility anymore.

> I think it mostly works, but I was baffled that I didn't get the debug
> prints on this Qualcomm platforms, while the "Uncompressing Linux..."
> message was working fine. Adding this made it work.

I suspect on most platforms, the messages generally fit within the
FIFO at the rate we poke the characters in vs the rate they appear
on the serial line.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

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

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

end of thread, other threads:[~2020-08-09 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-07 12:26 [PATCH] ARM: compress: Fix the debug prints Linus Walleij
2020-08-07 12:59 ` Russell King - ARM Linux admin
2020-08-09 20:49   ` Linus Walleij
2020-08-09 21:00     ` Russell King - ARM Linux admin

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