Skip to contentSkip to conversation

Uncompress debug for multiplatform

PATCH New Shawn Guo 5 participants 22 messages Jan 17, 2013 – Feb 8, 2013 1 message not in the archive

Subsystems (8)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

cover Uncompress debug for multiplatform

It's not about running single zImage on multiple platforms with uncompress debug output, but having uncompress debug work for platform that DEBUG_LL is enabled for. But still it's better than nothing.

Shawn Guo (2):
ARM: use Kconfig to select uncompress.h
ARM: use DEBUG_LL infrastructural for multiplatform uncompress debug

 arch/arm/Kconfig.debug              |    5 +++++
 arch/arm/boot/compressed/Makefile   |    3 +++
 arch/arm/boot/compressed/debug.S    |    3 +++
 arch/arm/boot/compressed/misc.c     |    8 +-------
 arch/arm/include/debug/highbank.S   |    3 +++
 arch/arm/include/debug/imx.S        |    3 +++
 arch/arm/include/debug/mvebu.S      |    3 +++
 arch/arm/include/debug/picoxcell.S  |    3 +++
 arch/arm/include/debug/socfpga.S    |    3 +++
 arch/arm/include/debug/sunxi.S      |    3 +++
 arch/arm/include/debug/tegra.S      |    3 +++
 arch/arm/include/debug/uncompress.h |    9 +++++++++
 arch/arm/include/debug/vexpress.S   |    3 +++
 arch/arm/include/debug/zynq.S       |    3 +++
 14 files changed, 48 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/boot/compressed/debug.S
 create mode 100644 arch/arm/include/debug/uncompress.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/2 ARM: use Kconfig to select uncompress.h

Following the approach handling DEBUG_LL inclusion, the patch creates a Kconfig symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct uncompress header. For traditional build, mach/uncompress.h will be included in arch/arm/boot/compressed/misc.c. For multiplatform build, debug/uncompress.h which contains a suite of empty functions will be used. In this way, a platform with particular uncompress.h implementation could choose its own uncompress.h with this Kconfig option.

---
 arch/arm/Kconfig.debug              |    5 +++++
 arch/arm/boot/compressed/misc.c     |    8 +-------
 arch/arm/include/debug/uncompress.h |    3 +++
 3 files changed, 9 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/include/debug/uncompress.h
arch/arm/Kconfig.debug +5 -0
index 05f83c8..86b273f8 100644
@@ -523,6 +523,11 @@ config DEBUG_LL_INCLUDE
 	default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
 	default "mach/debug-macro.S"
 
+config UNCOMPRESS_INCLUDE
+	string
+	default "debug/uncompress.h" if ARCH_MULTIPLATFORM
+	default "mach/uncompress.h"
+
 config EARLY_PRINTK
 	bool "Early printk"
 	depends on DEBUG_LL
arch/arm/boot/compressed/misc.c +1 -7
index df89983..31bd43b 100644
@@ -25,13 +25,7 @@ unsigned int __machine_arch_type;
 static void putstr(const char *ptr);
 extern void error(char *x);
 
-#ifdef CONFIG_ARCH_MULTIPLATFORM
-static inline void putc(int c) {}
-static inline void flush(void) {}
-static inline void arch_decomp_setup(void) {}
-#else
-#include <mach/uncompress.h>
-#endif
+#include CONFIG_UNCOMPRESS_INCLUDE
 
 #ifdef CONFIG_DEBUG_ICEDCC
 
arch/arm/include/debug/uncompress.h new file +3 -0
new file mode 100644
index 0000000..e19955d
@@ -0,0 +1,3 @@
+static inline void putc(int c) {}
+static inline void flush(void) {}
+static inline void arch_decomp_setup(void) {}
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/2 ARM: use Kconfig to select uncompress.h

Quoted 13 lines · Shawn Guo

Spam Status: Spamassassin 0% probability of being spam.

Full report:
No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Following the approach handling DEBUG_LL inclusion, the patch creates
a Kconfig symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct
uncompress header. For traditional build, mach/uncompress.h will be
included in arch/arm/boot/compressed/misc.c. For multiplatform build,
debug/uncompress.h which contains a suite of empty functions will be
used. In this way, a platform with particular uncompress.h
implementation could choose its own uncompress.h with this Kconfig
option.

Quoted 1 line

Nice trick!

author
#3 lore raw

PATCH 2/2 ARM: use DEBUG_LL infrastructural for multiplatform uncompress debug

In reply to Shawn Guo

Instead of providing a dummy uncompress.h and losing the uncompress debug capability completely for multiplatform build, the patch turns the uncompress debug into part of DEBUG_LL support. Thus, when DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

To have the uncompress debug work, what most platforms need is only a putc() implementation. Meanwhile, DEBUG_LL infrastructural already has printch() there. We direct putc() call to printch() by creating arch/arm/boot/compressed/debug.S which simply includes arch/arm/kernel/debug.S.

However, there is a problem with above approach. DEBUG_LL routines will check MMU enable bit to decide whether physical or virtual address should be used to access debug port. In case virtual address needs to be used, the address returned by addruart will not work for decompressor who uses a different mapping from what kernel uses. Fortunately, decompressor uses a flat mapping (same physical and virtual addresses). So we can easily work it around by asking platform addruart return physical address as virtual address when it runs in decompressor. The macro UNCOMPRESS_DEBUG is defined for this use.

---
 arch/arm/boot/compressed/Makefile   |    3 +++
 arch/arm/boot/compressed/debug.S    |    3 +++
 arch/arm/include/debug/highbank.S   |    3 +++
 arch/arm/include/debug/imx.S        |    3 +++
 arch/arm/include/debug/mvebu.S      |    3 +++
 arch/arm/include/debug/picoxcell.S  |    3 +++
 arch/arm/include/debug/socfpga.S    |    3 +++
 arch/arm/include/debug/sunxi.S      |    3 +++
 arch/arm/include/debug/tegra.S      |    3 +++
 arch/arm/include/debug/uncompress.h |    8 +++++++-
 arch/arm/include/debug/vexpress.S   |    3 +++
 arch/arm/include/debug/zynq.S       |    3 +++
 12 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/compressed/debug.S
arch/arm/boot/compressed/Makefile +3 -0
index 5cad8a6..c9865f6 100644
@@ -24,6 +24,9 @@ endif
 AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
 HEAD	= head.o
 OBJS	+= misc.o decompress.o
+ifeq ($(CONFIG_DEBUG_LL),y)
+OBJS	+= debug.o
+endif
 FONTC	= $(srctree)/drivers/video/console/font_acorn_8x8.c
 
 # string library code (-Os is enforced to keep it much smaller)
arch/arm/boot/compressed/debug.S new file +3 -0
new file mode 100644
index 0000000..7283d5c
@@ -0,0 +1,3 @@
+#define UNCOMPRESS_DEBUG
+
+#include "../../kernel/debug.S"
arch/arm/include/debug/highbank.S +3 -0
index 8cad432..13056cf 100644
@@ -12,6 +12,9 @@
 		.macro	addruart,rp,rv,tmp
 		ldr	\rv, =0xfee36000
 		ldr	\rp, =0xfff36000
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 
 #include <asm/hardware/debug-pl01x.S>
arch/arm/include/debug/imx.S +3 -0
index 619d8cc..257f160 100644
@@ -31,6 +31,9 @@
 		.macro	addruart, rp, rv, tmp
 		ldr	\rp, =UART_PADDR	@ physical
 		ldr	\rv, =UART_VADDR	@ virtual
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 
 		.macro	senduart,rd,rx
arch/arm/include/debug/mvebu.S +3 -0
index 865c6d0..2024c1c 100644
@@ -19,6 +19,9 @@
 	ldr	\rv, =ARMADA_370_XP_REGS_VIRT_BASE
 	orr	\rp, \rp, #0x00012000
 	orr	\rv, \rv, #0x00012000
+#ifdef UNCOMPRESS_DEBUG
+	mov	\rv, \rp
+#endif
 	.endm
 
 #define UART_SHIFT	2
arch/arm/include/debug/picoxcell.S +3 -0
index bc1f07c..0869efc 100644
@@ -14,6 +14,9 @@
 		.macro	addruart, rp, rv, tmp
 		ldr	\rv, =PHYS_TO_IO(PICOXCELL_UART1_BASE)
 		ldr	\rp, =PICOXCELL_UART1_BASE
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 
 #include "8250_32.S"
arch/arm/include/debug/socfpga.S +3 -0
index 966b2f9..0298e12 100644
@@ -15,6 +15,9 @@
 		orr	\rp, \rp, #0x00c00000
 		orr	\rv, \rp, #0xfe000000	@ virtual base
 		orr	\rp, \rp, #0xff000000	@ physical base
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 
 #include "8250_32.S"
arch/arm/include/debug/sunxi.S +3 -0
index 04eb56d..5c40a3a 100644
@@ -21,6 +21,9 @@
 	.macro	addruart, rp, rv, tmp
 	ldr	\rp, =SUNXI_UART_DEBUG_PHYS_BASE
 	ldr	\rv, =SUNXI_UART_DEBUG_VIRT_BASE
+#ifdef UNCOMPRESS_DEBUG
+	mov	\rv, \rp
+#endif
 	.endm
 
 #define UART_SHIFT	2
arch/arm/include/debug/tegra.S +3 -0
index 883d7c2..789fcb4 100644
@@ -188,6 +188,9 @@
 		/* Load previously selected UART address */
 100:		ldr	\rp, [\tmp, #4]		@ Load tegra_uart_phys
 		ldr	\rv, [\tmp, #8]		@ Load tegra_uart_virt
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 
 /*
arch/arm/include/debug/uncompress.h +7 -1
index e19955d..b142a84 100644
@@ -1,3 +1,9 @@
-static inline void putc(int c) {}
+#ifdef CONFIG_DEBUG_LL
+extern void printch(int c);
+#else
+static inline void printch(int c) {}
+#endif
+
+static inline void putc(int c) { printch(c); }
 static inline void flush(void) {}
 static inline void arch_decomp_setup(void) {}
arch/arm/include/debug/vexpress.S +3 -0
index dc8e882..5015a01 100644
@@ -43,6 +43,9 @@
 		orrne	\rv, \rp, #DEBUG_LL_VIRT_BASE
 		orrne	\rp, \rp, #DEBUG_LL_PHYS_BASE_RS1
 
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 
 #include <asm/hardware/debug-pl01x.S>
arch/arm/include/debug/zynq.S +3 -0
index f9aa974..2795a64 100644
@@ -35,6 +35,9 @@
 		.macro	addruart, rp, rv, tmp
 		ldr	\rp, =LL_UART_PADDR	@ physical
 		ldr	\rv, =LL_UART_VADDR	@ virtual
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 
 		.macro	senduart,rd,rx
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH 2/2 ARM: use DEBUG_LL infrastructural for multiplatform uncompress debug

Russell,

Quoted 15 lines · Shawn Guo
 arch/arm/boot/compressed/Makefile   |    3 +++
 arch/arm/boot/compressed/debug.S    |    3 +++
 arch/arm/include/debug/highbank.S   |    3 +++
 arch/arm/include/debug/imx.S        |    3 +++
 arch/arm/include/debug/mvebu.S      |    3 +++
 arch/arm/include/debug/picoxcell.S  |    3 +++
 arch/arm/include/debug/socfpga.S    |    3 +++
 arch/arm/include/debug/sunxi.S      |    3 +++
 arch/arm/include/debug/tegra.S      |    3 +++
 arch/arm/include/debug/uncompress.h |    8 +++++++-
 arch/arm/include/debug/vexpress.S   |    3 +++
 arch/arm/include/debug/zynq.S       |    3 +++
 12 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/compressed/debug.S

...

Quoted 14 lines
arch/arm/boot/compressed/debug.S new file +3 -0
new file mode 100644
index 0000000..7283d5c
@@ -0,0 +1,3 @@
+#define UNCOMPRESS_DEBUG
+
+#include "../../kernel/debug.S"
arch/arm/include/debug/highbank.S +0 -0
index 8cad432..13056cf 100644

arch/arm/include/debug/highbank.S line 19

Quoted 8 lines
arch/arm/include/debug/highbank.S +3 -0
@@ -12,6 +12,9 @@
 		.macro	addruart,rp,rv,tmp
 		ldr	\rv, =0xfee36000
 		ldr	\rp, =0xfff36000
+#ifdef UNCOMPRESS_DEBUG
+		mov	\rv, \rp
+#endif
 		.endm
 

Are you fine with patching arch/arm/kernel/debug.S to have UNCOMPRESS_DEBUG checked, so that we can avoid patching addruart for all those platforms?

Shawn

#5 lore raw

PATCH 2/2 ARM: use DEBUG_LL infrastructural for multiplatform uncompress debug

In reply to Shawn Guo
Quoted 9 lines · Shawn Guo

However, there is a problem with above approach. DEBUG_LL routines will check MMU enable bit to decide whether physical or virtual address should be used to access debug port. In case virtual address needs to be used, the address returned by addruart will not work for decompressor who uses a different mapping from what kernel uses. Fortunately, decompressor uses a flat mapping (same physical and virtual addresses). So we can easily work it around by asking platform addruart return physical address as virtual address when it runs in decompressor. The macro UNCOMPRESS_DEBUG is defined for this use.

Can't you just create a new copy of kernel/debug.S in boot/compressed/ that provides only a putc() function and uses the physical address unconditionally?

For all I can tell, that should be little more than just

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

(I'm not sure about the actual semantics of the above, take that as an approximation)

Arnd

author
#6 lore raw

PATCH 2/2 ARM: use DEBUG_LL infrastructural for multiplatform uncompress debug

Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Shawn Guo

However, there is a problem with above approach. DEBUG_LL routines will check MMU enable bit to decide whether physical or virtual address should be used to access debug port. In case virtual address needs to be used, the address returned by addruart will not work for decompressor who uses a different mapping from what kernel uses. Fortunately, decompressor uses a flat mapping (same physical and virtual addresses). So we can easily work it around by asking platform addruart return physical address as virtual address when it runs in decompressor. The macro UNCOMPRESS_DEBUG is defined for this use.

Quoted 4 lines

Can't you just create a new copy of kernel/debug.S in boot/compressed/ that provides only a putc() function and uses the physical address unconditionally?

Why did I not think of this? The approach is obviously simpler. Please check the updated version I just sent out. Thanks.

Shawn

author
#7 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

In reply to Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

---
 arch/arm/boot/compressed/Makefile   |    3 +++
 arch/arm/boot/compressed/debug.S    |   11 +++++++++++
 arch/arm/include/debug/uncompress.h |    4 ++++
 3 files changed, 18 insertions(+)
 create mode 100644 arch/arm/boot/compressed/debug.S
arch/arm/boot/compressed/Makefile +3 -0
index 5cad8a6..c9865f6 100644
@@ -24,6 +24,9 @@ endif
 AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
 HEAD	= head.o
 OBJS	+= misc.o decompress.o
+ifeq ($(CONFIG_DEBUG_LL),y)
+OBJS	+= debug.o
+endif
 FONTC	= $(srctree)/drivers/video/console/font_acorn_8x8.c
 
 # string library code (-Os is enforced to keep it much smaller)
arch/arm/boot/compressed/debug.S new file +11 -0
new file mode 100644
index 0000000..bdb0e25
@@ -0,0 +1,11 @@
+#include <linux/linkage.h>
+
+#include CONFIG_DEBUG_LL_INCLUDE
+
+ENTRY(putc)
+	addruart r1, r2, r3
+	waituart r3, r1
+	senduart r0, r1
+	busyuart r3, r1
+	mov	 pc, lr
+ENDPROC(putc)
arch/arm/include/debug/uncompress.h +4 -0
index e19955d..9aa5314 100644
@@ -1,3 +1,7 @@
+#ifdef CONFIG_DEBUG_LL
+extern void putc(int c);
+#else
 static inline void putc(int c) {}
+#endif
 static inline void flush(void) {}
 static inline void arch_decomp_setup(void) {}
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

arch/arm/boot/compressed/debug.S line 11

Quoted 7 lines · Shawn Guo
arch/arm/boot/compressed/debug.S new file +7 -0
+ENTRY(putc)
+       addruart r1, r2, r3
+       waituart r3, r1
+       senduart r0, r1
+       busyuart r3, r1
+       mov      pc, lr
+ENDPROC(putc)

Ah, so it actually worked? I was expecting at least some part of my code to be wrong ;-) My assembler skills are very much lacking and I had not tried it.

Upon closer inspection, it seems that the CR/LF logic from the printascii function is not here, and it probably should be.

I also saw that some similar code is already present in arch/arm/boot/compressed/head.S as a local version of putc, maybe that can be combined with this rather than adding a new file.

Arnd

#9 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

Quoted 13 lines · Arnd Bergmann

arch/arm/boot/compressed/debug.S line 11

Quoted 7 lines · Shawn Guo
arch/arm/boot/compressed/debug.S new file +7 -0
+ENTRY(putc)
+       addruart r1, r2, r3
+       waituart r3, r1
+       senduart r0, r1
+       busyuart r3, r1
+       mov      pc, lr
+ENDPROC(putc)

Ah, so it actually worked? I was expecting at least some part of my code to be wrong ;-) My assembler skills are very much lacking and I had not tried it.

Quoted 2 lines

Upon closer inspection, it seems that the CR/LF logic from the printascii function is not here, and it probably should be.

No it shouldn't. The CR/LF handling is already done (so actually aliasing it to printch in arch/arm/kernel/debug.S will result in two CRs per LF.

author
#10 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

In reply to Arnd Bergmann
Quoted 13 lines · Arnd Bergmann

arch/arm/boot/compressed/debug.S line 11

Quoted 7 lines · Shawn Guo
arch/arm/boot/compressed/debug.S new file +7 -0
+ENTRY(putc)
+       addruart r1, r2, r3
+       waituart r3, r1
+       senduart r0, r1
+       busyuart r3, r1
+       mov      pc, lr
+ENDPROC(putc)

Ah, so it actually worked? I was expecting at least some part of my code to be wrong ;-) My assembler skills are very much lacking and I had not tried it.

Yes, it worked. Actually, I wrote it myself after reading your comment saying take your code as approximation. And then I compared my code with yours and found the only difference is the indent of the last statement :)

Quoted 3 lines

Upon closer inspection, it seems that the CR/LF logic from the printascii function is not here, and it probably should be.

No. As Russell already pointed out, the current implementation of putc() is exactly what putstr() expect, with no CR/LF logic.

Shawn

#11 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

In reply to Shawn Guo
Quoted 10 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

This looks great, and it's even cleaner than I was hoping it'd be based on my suggestion. Nice! :)

Russell, do you want to apply this or should we? If the former, for the patch tracker:

If the latter, let me know and I'll pick it up.

Thanks!

-Olof

#12 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

In reply to Shawn Guo
Quoted 8 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

Ok, I've applied this on the previso that _no one_ in future whinges if the debug infrastructure doesn't quite meet their expectation. The debug infrastructure remains first and foremost that: a simple debug infrastructure suitable for use in the early assembly and the like.

That is its primary concern and trumps any requirements from consoles, early printk, decompressor output, and the like.

#13 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

Quoted 10 lines · Russell King - ARM Linux
Quoted 8 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

Quoted 7 lines

Ok, I've applied this on the previso that _no one_ in future whinges if the debug infrastructure doesn't quite meet their expectation. The debug infrastructure remains first and foremost that: a simple debug infrastructure suitable for use in the early assembly and the like.

That is its primary concern and trumps any requirements from consoles, early printk, decompressor output, and the like.

... and now I've dropped the two patches because it causes build failures for all OMAP and PXA platforms.

#14 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

Quoted 16 lines · Russell King - ARM Linux
Quoted 15 lines · Russell King - ARM Linux
Quoted 8 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

Ok, I've applied this on the previso that _no one_ in future whinges if the debug infrastructure doesn't quite meet their expectation. The debug infrastructure remains first and foremost that: a simple debug infrastructure suitable for use in the early assembly and the like.

Quoted 5 lines
Quoted 2 lines

That is its primary concern and trumps any requirements from consoles, early printk, decompressor output, and the like.

... and now I've dropped the two patches because it causes build failures for all OMAP and PXA platforms.

It also breaks tegra_defconfig. For reference, the (or perhaps just a) reason here is that arch/arm/include/debug/tegra.S references symbol tegra_uart_config, which is declared in arch/arm/mach-tegra/common.c, which isn't part of the decompressor build. Tegra's uncompress.h doesn't touch this symbol, hence avoids this problem.

I'd guess OMAP is broken for similar reasons, since when I created the tegra_uart_config symbol I was inspired by the OMAP DEBUG_LL code.

Perhaps the patch can be re-cast to only affect multi-platform kernels, and leave unconverted platforms using uncompress.h (at least, I assume that must be the problem).

author
#15 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

Quoted 20 lines · Stephen Warren
Quoted 19 lines · Russell King - ARM Linux
Quoted 17 lines · Russell King - ARM Linux
Quoted 8 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

Ok, I've applied this on the previso that _no one_ in future whinges if the debug infrastructure doesn't quite meet their expectation. The debug infrastructure remains first and foremost that: a simple debug infrastructure suitable for use in the early assembly and the like.

That is its primary concern and trumps any requirements from consoles, early printk, decompressor output, and the like.

Quoted 9 lines
Quoted 2 lines

... and now I've dropped the two patches because it causes build failures for all OMAP and PXA platforms.

It also breaks tegra_defconfig. For reference, the (or perhaps just a) reason here is that arch/arm/include/debug/tegra.S references symbol tegra_uart_config, which is declared in arch/arm/mach-tegra/common.c, which isn't part of the decompressor build. Tegra's uncompress.h doesn't touch this symbol, hence avoids this problem.

Thanks for the info, Stephen.

Quoted 1 line

From what I see, the patch breaks omap, pxa and tegra build by

different causes.

=== omap ===

AS arch/arm/boot/compressed/debug.o
LD arch/arm/boot/compressed/vmlinux
.data' referenced in section .text' of arch/arm/boot/compressed/debug.o: defined in discarded section `.data' of arch/arm/boot/compressed/debug.o make[3]: *** [arch/arm/boot/compressed/vmlinux] Error 1

The following change moving the variables out of stack section seems fixing the failure, but I'm not quite sure if it works.

8<---

arch/arm/mach-omap2/include/mach/debug-macro.S +0 -2
index cfaed13..7b2877e 100644
@@ -17,11 +17,9 @@
 
 #define UART_OFFSET(addr)      ((addr) & 0x00ffffff)
 
-               .pushsection .data
 omap_uart_phys:        .word   0
 omap_uart_virt:        .word   0
 omap_uart_lsr: .word   0
-               .popsection
 
                /*
                 * Note that this code won't work if the bootloader passes

--->8

=== pxa/mmp ===

AS arch/arm/boot/compressed/debug.o
arch/arm/boot/compressed/debug.S: Assembler messages:
arch/arm/boot/compressed/debug.S:8: Error: garbage following instruction -- `ldr r2,=IOMEM(0xfe000000)' make[3]: *** [arch/arm/boot/compressed/debug.o] Error 1

This is fairly easy to fix with the following change.

8<---

arch/arm/boot/compressed/debug.S +1 -0
index bdb0e25..6e8382d 100644
@@ -1,4 +1,5 @@
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 #include CONFIG_DEBUG_LL_INCLUDE
 

--->8

=== tegra ===

LD arch/arm/boot/compressed/vmlinux
arch/arm/boot/compressed/debug.o: In function `putc':
arch/arm/boot/compressed/debug.S:7: undefined reference to `tegra_uart_config' make[3]: *** [arch/arm/boot/compressed/vmlinux] Error 1

You have explained the cause clearly.

Quoted 6 lines

I'd guess OMAP is broken for similar reasons, since when I created the tegra_uart_config symbol I was inspired by the OMAP DEBUG_LL code.

Perhaps the patch can be re-cast to only affect multi-platform kernels, and leave unconverted platforms using uncompress.h (at least, I assume that must be the problem).

Indeed. The arch/arm/boot/compressed/debug.S shouldn't be part of traditional build but only multiplatform. Let's force that with the change below.

8<---

arch/arm/boot/compressed/Makefile +2 -0
index c9865f6..13bdd10 100644
@@ -24,9 +24,11 @@ endif
 AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
 HEAD   = head.o
 OBJS   += misc.o decompress.o
+ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
 ifeq ($(CONFIG_DEBUG_LL),y)
 OBJS   += debug.o
 endif
+endif
 FONTC  = $(srctree)/drivers/video/console/font_acorn_8x8.c
 
 # string library code (-Os is enforced to keep it much smaller)

--->8

Shawn

#16 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

Quoted 34 lines · Shawn Guo
Quoted 20 lines · Stephen Warren
Quoted 19 lines · Russell King - ARM Linux
Quoted 17 lines · Russell King - ARM Linux
Quoted 8 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

Ok, I've applied this on the previso that _no one_ in future whinges if the debug infrastructure doesn't quite meet their expectation. The debug infrastructure remains first and foremost that: a simple debug infrastructure suitable for use in the early assembly and the like.

That is its primary concern and trumps any requirements from consoles, early printk, decompressor output, and the like.

Quoted 9 lines
Quoted 2 lines

... and now I've dropped the two patches because it causes build failures for all OMAP and PXA platforms.

It also breaks tegra_defconfig. For reference, the (or perhaps just a) reason here is that arch/arm/include/debug/tegra.S references symbol tegra_uart_config, which is declared in arch/arm/mach-tegra/common.c, which isn't part of the decompressor build. Tegra's uncompress.h doesn't touch this symbol, hence avoids this problem.

Thanks for the info, Stephen.

From what I see, the patch breaks omap, pxa and tegra build by different causes.

...

Quoted 16 lines
Quoted 3 lines

Perhaps the patch can be re-cast to only affect multi-platform kernels, and leave unconverted platforms using uncompress.h (at least, I assume that must be the problem).

Indeed. The arch/arm/boot/compressed/debug.S shouldn't be part of traditional build but only multiplatform. Let's force that with the change below.

8<---

arch/arm/boot/compressed/Makefile +0 -0
index c9865f6..13bdd10 100644
@@ -24,9 +24,11 @@ endif
 AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
 HEAD   = head.o

arch/arm/boot/compressed/Makefile endif

Quoted 10 lines
arch/arm/boot/compressed/Makefile +2 -1
 OBJS   += misc.o decompress.o
+ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
 ifeq ($(CONFIG_DEBUG_LL),y)
 OBJS   += debug.o
 endif
+endif
 FONTC  = $(srctree)/drivers/video/console/font_acorn_8x8.c
 
 # string library code (-Os is enforced to keep it much smaller)
--->8

Yes, that patch fixes the build problem for me, and all decompressor output and earlyprintk works. Thanks.

#17 lore raw

PATCH v2 2/2 ARM: uncompress debug support for multiplatform build

In reply to Shawn Guo
Quoted 16 lines · Shawn Guo

=== omap ===

AS arch/arm/boot/compressed/debug.o
LD arch/arm/boot/compressed/vmlinux
.data' referenced in section .text' of arch/arm/boot/compressed/debug.o: defined in discarded section `.data' of arch/arm/boot/compressed/debug.o make[3]: *** [arch/arm/boot/compressed/vmlinux] Error 1

The following change moving the variables out of stack section seems fixing the failure, but I'm not quite sure if it works.

8<---

arch/arm/mach-omap2/include/mach/debug-macro.S +0 -0
index cfaed13..7b2877e 100644

arch/arm/mach-omap2/include/mach/debug-macro.S line 24

Quoted 8 lines
arch/arm/mach-omap2/include/mach/debug-macro.S +0 -2
@@ -17,11 +17,9 @@
 
 #define UART_OFFSET(addr)      ((addr) & 0x00ffffff)
 
-               .pushsection .data
 omap_uart_phys:        .word   0
 omap_uart_virt:        .word   0
 omap_uart_lsr: .word   0
-               .popsection

No, this won't work, because now these variables are located in the text section which may not be writable. I don't know what the answer is to this, but as things stand it's not something that can go into v3.8 until these problems are addressed (because if it does it _will_ cause regressions.)

We're basically on the last day of -rc6, so I think it's all too late to try and get this sorted for this merge window.

author
#18 lore raw

PATCH v3 2/2 ARM: uncompress debug support for multiplatform build

In reply to Russell King - ARM Linux

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

---
Changes since v2:
* Build arch/arm/boot/compressed/debug.S only for multiplatform kernel to fix the breakage on traditional platform build
* Include asm/assembler.h in arch/arm/boot/compressed/debug.S, as it may commonly be needed by platforms to be converted to multiplatform

Russell,

I will put it into patch system if I do not receive any comment tomorrow.

Shawn

 arch/arm/boot/compressed/Makefile   |    5 +++++
 arch/arm/boot/compressed/debug.S    |   12 ++++++++++++
 arch/arm/include/debug/uncompress.h |    4 ++++
 3 files changed, 21 insertions(+)
 create mode 100644 arch/arm/boot/compressed/debug.S
arch/arm/boot/compressed/Makefile +5 -0
index 5cad8a6..13bdd10 100644
@@ -24,6 +24,11 @@ endif
 AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
 HEAD	= head.o
 OBJS	+= misc.o decompress.o
+ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y)
+ifeq ($(CONFIG_DEBUG_LL),y)
+OBJS	+= debug.o
+endif
+endif
 FONTC	= $(srctree)/drivers/video/console/font_acorn_8x8.c
 
 # string library code (-Os is enforced to keep it much smaller)
arch/arm/boot/compressed/debug.S new file +12 -0
new file mode 100644
index 0000000..6e8382d
@@ -0,0 +1,12 @@
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+
+#include CONFIG_DEBUG_LL_INCLUDE
+
+ENTRY(putc)
+	addruart r1, r2, r3
+	waituart r3, r1
+	senduart r0, r1
+	busyuart r3, r1
+	mov	 pc, lr
+ENDPROC(putc)
arch/arm/include/debug/uncompress.h +4 -0
index e19955d..9aa5314 100644
@@ -1,3 +1,7 @@
+#ifdef CONFIG_DEBUG_LL
+extern void putc(int c);
+#else
 static inline void putc(int c) {}
+#endif
 static inline void flush(void) {}
 static inline void arch_decomp_setup(void) {}
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH v3 2/2 ARM: uncompress debug support for multiplatform build

Quoted 18 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

---
Changes since v2:
* Build arch/arm/boot/compressed/debug.S only for multiplatform kernel to fix the breakage on traditional platform build
* Include asm/assembler.h in arch/arm/boot/compressed/debug.S, as it may commonly be needed by platforms to be converted to multiplatform

Quoted 4 lines

Russell,

I will put it into patch system if I do not receive any comment tomorrow.

This doesn't address the problem with OMAP, which is that the OMAP debug code places data into the .data section, and that is not allowed in the decompressor.

author
#20 lore raw

PATCH v3 2/2 ARM: uncompress debug support for multiplatform build

Quoted 19 lines · Russell King - ARM Linux
Quoted 18 lines · Shawn Guo

Instead of giving zero support of uncompress debug for multiplatform build, the patch turns uncompress debug into one part of DEBUG_LL support. When DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform.

It reuses the platform DEBUG_LL macros by creating a simple arch/arm/boot/compressed/debug.S with CONFIG_DEBUG_LL_INCLUDE included there, and implements a generic putc() using those macros.

---
Changes since v2:
* Build arch/arm/boot/compressed/debug.S only for multiplatform kernel to fix the breakage on traditional platform build
* Include asm/assembler.h in arch/arm/boot/compressed/debug.S, as it may commonly be needed by platforms to be converted to multiplatform

Quoted 8 lines
Quoted 4 lines

Russell,

I will put it into patch system if I do not receive any comment tomorrow.

This doesn't address the problem with OMAP, which is that the OMAP debug code places data into the .data section, and that is not allowed in the decompressor.

My patches are based on v3.8-rc where OMAP hasn't been converted to multiplatform. But you are right, when the patches get into linux-next it will cause problem for OMAP, since multiplatform is enabled for OMAP on linux-next. So should I base my patches on linux-next and fold a fix for OMAP into the series?

Shawn

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#22 lore raw

cover Uncompress debug for multiplatform

Sorry, Russell. I meant to put your email address on To.

Shawn

Quoted 13 lines · Russell King
Quoted 7 lines · Shawn Guo

It's not about running single zImage on multiple platforms with uncompress debug output, but having uncompress debug work for platform that DEBUG_LL is enabled for. But still it's better than nothing.

Shawn Guo (2):
ARM: use Kconfig to select uncompress.h
ARM: use DEBUG_LL infrastructural for multiplatform uncompress debug

Just put them into patch tracker as #7633 and #7634.

Shawn