xen/arm: Add Skeleton for using configuring early printk using Kconfig
PATCH 1/1 xen/arm: Add Skeleton for using configuring early printk using Kconfig
At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor.
Furthermore, early printk is one of the few odds one that are not using Kconfig.
So this is about time to move it to Kconfig. For now, a skeleton is added with one example based on Cadence UART. Follow-up will continue to convert all the options to Kconfig.
Because Kconfig will prefix all the config by CONFIG_, it is necessary to adapt the define within the code.
---
I have sent it as RFC because this is not complete. I will convert the rest once we agree the approach is correct.
--- xen/Kconfig.debug | 2 ++ xen/arch/arm/Kconfig.debug | 40 ++++++++++++++++++++++++++++++++++++++ xen/arch/arm/Rules.mk | 5 ++--- xen/arch/arm/arm32/head.S | 8 ++++---- xen/arch/arm/arm64/debug.S | 4 ++-- xen/arch/arm/arm64/head.S | 8 ++++---- xen/arch/x86/Kconfig.debug | 0 xen/include/asm-arm/early_printk.h | 2 +- 8 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 xen/arch/arm/Kconfig.debug create mode 100644 xen/arch/x86/Kconfig.debug
xen/Kconfig.debug +2 -0
@@ -112,6 +112,8 @@ config XMEM_POOL_POISON Poison free blocks with 0xAA bytes and verify them when a block is allocated in order to spot use-after-free issues. +source "arch/$SRCARCH/Kconfig.debug" + endif # DEBUG || EXPERT endmenu
xen/arch/arm/Kconfig.debug new file +40 -0
@@ -0,0 +1,40 @@ +choice + prompt "Enable early printk" + + optional + config EARLY_PRINTK_ZYNQMP + bool "Enable early printk on Xilinx ZynQMP" + select EARLY_UART_CADENCE + help + Say Y here if you want the early printk support on Xilinx + ZynQMP platform. + + config EARLY_PRINTK_CADENCE + bool "Enable early printk via Cadence UART" + select EARLY_UART_CADENCE + help + Say Y here if you wish the early printk to direct their + output to a Cadence UART. You can use this option to provide + the parameters for the Cadence UART rather than selecting + one of the platform specific options above if you know the + parameters for the port. + + This option is preferred over the platform specific options; + the platform specific options are deprecated and will soon + be removed. +endchoice + +config EARLY_PRINTK + bool + +config EARLY_UART_CADENCE + bool + select EARLY_PRINTK + +config EARLY_UART_BASE_ADDRESS + hex "Physical base address of debug UART" if EARLY_PRINTK + default 0xff000000 if EARLY_PRINTK_ZYNQMP + +config EARLY_PRINTK_INC + string + default "debug-cadence.inc" if EARLY_UART_CADENCE
xen/arch/arm/Rules.mk +2 -3
@@ -46,7 +46,6 @@ EARLY_PRINTK_thunderx := pl011,0x87e024000000 EARLY_PRINTK_vexpress := pl011,0x1c090000 EARLY_PRINTK_xgene-mcdivitt := 8250,0x1c021000,2 EARLY_PRINTK_xgene-storm := 8250,0x1c020000,2 -EARLY_PRINTK_zynqmp := cadence,0xff000000 ifneq ($(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)),) EARLY_PRINTK_CFG := $(subst $(comma), ,$(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)))
@@ -82,9 +81,9 @@ endif CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART -CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD) -CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS) +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS) CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT) else # !CONFIG_DEBUG
xen/arch/arm/arm32/head.S +4 -4
@@ -32,8 +32,8 @@ #define PT_UPPER(x) (PT_##x & 0xf00) #define PT_LOWER(x) (PT_##x & 0x0ff) -#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) -#include EARLY_PRINTK_INC +#if (defined (CONFIG_EARLY_PRINTK)) && (defined (CONFIG_EARLY_PRINTK_INC)) +#include CONFIG_EARLY_PRINTK_INC #endif /*
@@ -190,7 +190,7 @@ GLOBAL(init_secondary) 1: #ifdef CONFIG_EARLY_PRINTK - mov_w r11, EARLY_UART_BASE_ADDRESS /* r11 := UART base address */ + mov_w r11, CONFIG_EARLY_UART_BASE_ADDRESS /* r11 := UART base address */ PRINT("- CPU ") print_reg r7 PRINT(" booting -\r\n")
@@ -580,7 +580,7 @@ ENTRY(switch_ttbr) * Clobbers r0 - r3 */ init_uart: - mov_w r11, EARLY_UART_BASE_ADDRESS + mov_w r11, CONFIG_EARLY_UART_BASE_ADDRESS #ifdef EARLY_PRINTK_INIT_UART early_uart_init r11, r1, r2 #endif
xen/arch/arm/arm64/debug.S +2 -2
@@ -19,8 +19,8 @@ #include <asm/early_printk.h> -#ifdef EARLY_PRINTK_INC -#include EARLY_PRINTK_INC +#ifdef CONFIG_EARLY_PRINTK_INC +#include CONFIG_EARLY_PRINTK_INC #endif /*
xen/arch/arm/arm64/head.S +4 -4
@@ -40,8 +40,8 @@ #define __HEAD_FLAGS ((__HEAD_FLAG_PAGE_SIZE << 1) | \ (__HEAD_FLAG_PHYS_BASE << 3)) -#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) -#include EARLY_PRINTK_INC +#if (defined (CONFIG_EARLY_PRINTK)) && (defined (CONFIG_EARLY_PRINTK_INC)) +#include CONFIG_EARLY_PRINTK_INC #endif /*
@@ -351,7 +351,7 @@ GLOBAL(init_secondary) 1: #ifdef CONFIG_EARLY_PRINTK - ldr x23, =EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ + ldr x23, =CONFIG_EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ PRINT("- CPU ") print_reg x24 PRINT(" booting -\r\n")
@@ -753,7 +753,7 @@ ENTRY(switch_ttbr) * Clobbers x0 - x1 */ init_uart: - ldr x23, =EARLY_UART_BASE_ADDRESS + ldr x23, =CONFIG_EARLY_UART_BASE_ADDRESS #ifdef EARLY_PRINTK_INIT_UART early_uart_init x23, 0 #endif
xen/arch/x86/Kconfig.debug new file +0 -0
xen/include/asm-arm/early_printk.h +1 -1
@@ -15,7 +15,7 @@/* need to add the uart address offset in page to the fixmap address */ #define EARLY_UART_VIRTUAL_ADDRESS \ - (FIXMAP_ADDR(FIXMAP_CONSOLE) +(EARLY_UART_BASE_ADDRESS & ~PAGE_MASK)) + (FIXMAP_ADDR(FIXMAP_CONSOLE) + (CONFIG_EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))#endif /* !CONFIG_EARLY_PRINTK */
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 15 lines · Julien Grall
At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor.
Furthermore, early printk is one of the few odds one that are not using
Kconfig.So this is about time to move it to
Kconfig. For now, a skeleton is added with one example based on Cadence UART. Follow-up will continue to convert all the options toKconfig.Because
Kconfigwill prefix all the config byCONFIG_, it is necessary to adapt the define within the code.
Quoted 6 lines
Signed-off-by Julien Grall <[email protected]>---
I have sent it as RFC because this is not complete. I will convert the rest once we agree the approach is correct.
Having a top-level Kconfig.debug and includes arch specific rules is how Linux does it (albeit with different directory structure), so I think we're just following the norm here. No objection from me.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 18 lines · Wei Liu
Quoted 17 lines · Julien Grall
At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor.
Furthermore, early printk is one of the few odds one that are not using
Kconfig.So this is about time to move it to
Kconfig. For now, a skeleton is added with one example based on Cadence UART. Follow-up will continue to convert all the options toKconfig.Because
Kconfigwill prefix all the config byCONFIG_, it is necessary to adapt the define within the code.Signed-off-by Julien Grall <[email protected]>
Quoted 8 lines
Quoted 4 lines
---
I have sent it as RFC because this is not complete. I will convert the rest once we agree the approach is correct.
Having a top-level
Kconfig.debugand includes arch specific rules is how Linux does it (albeit with different directory structure), so I think we're just following the norm here. No objection from me.
I agree
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Wei Liu
Quoted 19 lines · Julien Grall
At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor.
Furthermore, early printk is one of the few odds one that are not using
Kconfig.So this is about time to move it to
Kconfig. For now, a skeleton is added with one example based on Cadence UART. Follow-up will continue to convert all the options toKconfig.Because
Kconfigwill prefix all the config byCONFIG_, it is necessary to adapt the define within the code.Signed-off-by Julien Grall <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I have sent it as RFC because this is not complete. I will convert the rest once we agree the approach is correct.
Having a top-level
Kconfig.debugand includes arch specific rules is how Linux does it (albeit with different directory structure), so I think we're just following the norm here. No objection from me.I agree
I know this is an RFC, but do you any opinion on the rest of the patch? Is the interface with the user good for you?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 57 lines · Julien Grall
At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor.
Furthermore, early printk is one of the few odds one that are not using
Kconfig.So this is about time to move it to
Kconfig. For now, a skeleton is added with one example based on Cadence UART. Follow-up will continue to convert all the options toKconfig.Because
Kconfigwill prefix all the config byCONFIG_, it is necessary to adapt the define within the code.Signed-off-by Julien Grall <[email protected]>---
I have sent it as RFC because this is not complete. I will convert the rest once we agree the approach is correct.
--- xen/Kconfig.debug | 2 ++ xen/arch/arm/Kconfig.debug | 40 ++++++++++++++++++++++++++++++++++++++ xen/arch/arm/Rules.mk | 5 ++--- xen/arch/arm/arm32/head.S | 8 ++++---- xen/arch/arm/arm64/debug.S | 4 ++-- xen/arch/arm/arm64/head.S | 8 ++++---- xen/arch/x86/Kconfig.debug | 0 xen/include/asm-arm/early_printk.h | 2 +- 8 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 xen/arch/arm/Kconfig.debug create mode 100644 xen/arch/x86/Kconfig.debugxen/Kconfig.debug +2
-0@@ -112,6 +112,8 @@ config XMEM_POOL_POISON Poison free blocks with 0xAA bytes and verify them when a block is allocated in order to spot use-after-free issues. +source "arch/$SRCARCH/Kconfig.debug" + endif # DEBUG || EXPERT endmenuxen/arch/arm/Kconfig.debug new file +4
-0@@ -0,0 +1,40 @@ +choice + prompt "Enable early printk" + + optional
xen/arch/arm/Kconfig.debug line 14
Quoted 10 lines
xen/arch/arm/Kconfig.debug new file +10
-0+ config EARLY_PRINTK_ZYNQMP + bool "Enable early printk on Xilinx ZynQMP" + select EARLY_UART_CADENCE + help + Say Y here if you want the early printk support on Xilinx + ZynQMP platform. + + config EARLY_PRINTK_CADENCE + bool "Enable early printk via Cadence UART" + select EARLY_UART_CADENCE
Why not select EARLY_PRINTK directly? Is EARLY_UART_CADENCE actually needed?
Quoted 12 lines
xen/arch/arm/Kconfig.debug new file +12
-0+ help + Say Y here if you wish the early printk to direct their + output to a Cadence UART. You can use this option to provide + the parameters for the Cadence UART rather than selecting + one of the platform specific options above if you know the + parameters for the port. + + This option is preferred over the platform specific options; + the platform specific options are deprecated and will soon + be removed. +endchoice +
xen/arch/arm/Kconfig.debug line 36
Quoted 10 lines
xen/arch/arm/Kconfig.debug new file +10
-0+config EARLY_PRINTK + bool + +config EARLY_UART_CADENCE + bool + select EARLY_PRINTK + +config EARLY_UART_BASE_ADDRESS + hex "Physical base address of debug UART" if EARLY_PRINTK + default 0xff000000 if EARLY_PRINTK_ZYNQMP
This only works for EARLY_PRINTK_ZYNQMP and not for EARLY_PRINTK_CADENCE. I imagine we need a default line for each of the possible options above.
Quoted 16 lines
xen/arch/arm/Kconfig.debug new file +3
-0+config EARLY_PRINTK_INC + string + default "debug-cadence.inc" if EARLY_UART_CADENCExen/arch/arm/Rules.mk +0
-1@@ -46,7 +46,6 @@ EARLY_PRINTK_thunderx := pl011,0x87e024000000 EARLY_PRINTK_vexpress := pl011,0x1c090000 EARLY_PRINTK_xgene-mcdivitt := 8250,0x1c021000,2 EARLY_PRINTK_xgene-storm := 8250,0x1c020000,2 -EARLY_PRINTK_zynqmp := cadence,0xff000000 ifneq ($(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)),) EARLY_PRINTK_CFG := $(subst $(comma), ,$(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)))
xen/arch/arm/Rules.mk endif · line 86
Quoted 8 lines
xen/arch/arm/Rules.mk +2
-2@@ -82,9 +81,9 @@ endif CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART -CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD) -CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS) +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
I don't have an opinion on the naming, the following is a suggestion to make the patch easier to write. It looks like we could get away without any of the renaming below if we choose to export EARLY_UART_BASE_ADDRESS and keep using EARLY_UART_BASE_ADDRESS directly in the code below.
Quoted 103 lines
xen/arch/arm/Rules.mk +0
-0CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT) else # !CONFIG_DEBUGxen/arch/arm/arm32/head.S +4
-4@@ -32,8 +32,8 @@ #define PT_UPPER(x) (PT_##x & 0xf00) #define PT_LOWER(x) (PT_##x & 0x0ff) -#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) -#include EARLY_PRINTK_INC +#if (defined (CONFIG_EARLY_PRINTK)) && (defined (CONFIG_EARLY_PRINTK_INC)) +#include CONFIG_EARLY_PRINTK_INC #endif /*@@ -190,7 +190,7 @@ GLOBAL(init_secondary) 1: #ifdef CONFIG_EARLY_PRINTK - mov_w r11, EARLY_UART_BASE_ADDRESS /* r11 := UART base address */ + mov_w r11, CONFIG_EARLY_UART_BASE_ADDRESS /* r11 := UART base address */ PRINT("- CPU ") print_reg r7 PRINT(" booting -\r\n")@@ -580,7 +580,7 @@ ENTRY(switch_ttbr) * Clobbers r0 - r3 */ init_uart: - mov_w r11, EARLY_UART_BASE_ADDRESS + mov_w r11, CONFIG_EARLY_UART_BASE_ADDRESS #ifdef EARLY_PRINTK_INIT_UART early_uart_init r11, r1, r2 #endifxen/arch/arm/arm64/debug.S +2
-2@@ -19,8 +19,8 @@ #include <asm/early_printk.h> -#ifdef EARLY_PRINTK_INC -#include EARLY_PRINTK_INC +#ifdef CONFIG_EARLY_PRINTK_INC +#include CONFIG_EARLY_PRINTK_INC #endif /*xen/arch/arm/arm64/head.S +4
-4@@ -40,8 +40,8 @@ #define __HEAD_FLAGS ((__HEAD_FLAG_PAGE_SIZE << 1) | \ (__HEAD_FLAG_PHYS_BASE << 3)) -#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) -#include EARLY_PRINTK_INC +#if (defined (CONFIG_EARLY_PRINTK)) && (defined (CONFIG_EARLY_PRINTK_INC)) +#include CONFIG_EARLY_PRINTK_INC #endif /*@@ -351,7 +351,7 @@ GLOBAL(init_secondary) 1: #ifdef CONFIG_EARLY_PRINTK - ldr x23, =EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ + ldr x23, =CONFIG_EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ PRINT("- CPU ") print_reg x24 PRINT(" booting -\r\n")@@ -753,7 +753,7 @@ ENTRY(switch_ttbr) * Clobbers x0 - x1 */ init_uart: - ldr x23, =EARLY_UART_BASE_ADDRESS + ldr x23, =CONFIG_EARLY_UART_BASE_ADDRESS #ifdef EARLY_PRINTK_INIT_UART early_uart_init x23, 0 #endifxen/arch/x86/Kconfig.debug new file +0
-0xen/include/asm-arm/early_printk.h +1
-1@@ -15,7 +15,7 @@/* need to add the uart address offset in page to the fixmap address */ #define EARLY_UART_VIRTUAL_ADDRESS \ - (FIXMAP_ADDR(FIXMAP_CONSOLE) +(EARLY_UART_BASE_ADDRESS & ~PAGE_MASK)) + (FIXMAP_ADDR(FIXMAP_CONSOLE) + (CONFIG_EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))#endif /* !CONFIG_EARLY_PRINTK */ Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Stefano,
Quoted 63 lines · Stefano Stabellini
Quoted 62 lines · Julien Grall
At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor.
Furthermore, early printk is one of the few odds one that are not using
Kconfig.So this is about time to move it to
Kconfig. For now, a skeleton is added with one example based on Cadence UART. Follow-up will continue to convert all the options toKconfig.Because
Kconfigwill prefix all the config byCONFIG_, it is necessary to adapt the define within the code.Signed-off-by Julien Grall <[email protected]>---
I have sent it as RFC because this is not complete. I will convert the rest once we agree the approach is correct.
--- xen/Kconfig.debug | 2 ++ xen/arch/arm/Kconfig.debug | 40 ++++++++++++++++++++++++++++++++++++++ xen/arch/arm/Rules.mk | 5 ++--- xen/arch/arm/arm32/head.S | 8 ++++---- xen/arch/arm/arm64/debug.S | 4 ++-- xen/arch/arm/arm64/head.S | 8 ++++---- xen/arch/x86/Kconfig.debug | 0 xen/include/asm-arm/early_printk.h | 2 +- 8 files changed, 55 insertions(+), 14 deletions(-)create mode 100644 xen/arch/arm/Kconfig.debug
create mode 100644 xen/arch/x86/Kconfig.debugxen/Kconfig.debug +2
-0@@ -112,6 +112,8 @@ config XMEM_POOL_POISON Poison free blocks with 0xAA bytes and verify them when a block is allocated in order to spot use-after-free issues. +source "arch/$SRCARCH/Kconfig.debug" + endif # DEBUG || EXPERT endmenuxen/arch/arm/Kconfig.debug new file +9
-0@@ -0,0 +1,40 @@ +choice + prompt "Enable early printk" + + optional + config EARLY_PRINTK_ZYNQMP + bool "Enable early printk on Xilinx ZynQMP" + select EARLY_UART_CADENCE + help + Say Y here if you want the early printk support on Xilinx
Quoted 8 lines
xen/arch/arm/Kconfig.debug line 14
Quoted 5 lines
xen/arch/arm/Kconfig.debug new file +5
-0+ ZynQMP platform. + + config EARLY_PRINTK_CADENCE + bool "Enable early printk via Cadence UART" + select EARLY_UART_CADENCEWhy not select
EARLY_PRINTKdirectly? IsEARLY_UART_CADENCEactually needed?
Yes to select the proper EARLY_PRINTK_INC. For other UARTs (such as 8250), it will be necessary to enable more options.
The other option is to have lengthy if in some part of the Kconfig which is not pretty and likely a way to miss some places if we ever decide to add more alias (I hope not!).
Quoted 20 lines
Quoted 20 lines
xen/arch/arm/Kconfig.debug new file +18
-0+ help + Say Y here if you wish the early printk to direct their + output to a Cadence UART. You can use this option to provide + the parameters for the Cadence UART rather than selecting + one of the platform specific options above if you know the + parameters for the port. + + This option is preferred over the platform specific options; + the platform specific options are deprecated and will soon + be removed. +endchoice + +config EARLY_PRINTK + bool + +config EARLY_UART_CADENCE + bool + select EARLY_PRINTK
Quoted 8 lines
xen/arch/arm/Kconfig.debug line 36
Quoted 4 lines
xen/arch/arm/Kconfig.debug new file +4
-0+ +config EARLY_UART_BASE_ADDRESS + hex "Physical base address of debug UART" if EARLY_PRINTK + default 0xff000000 if EARLY_PRINTK_ZYNQMPThis only works for
EARLY_PRINTK_ZYNQMPand not forEARLY_PRINTK_CADENCE. I imagine we need a default line for each of the possible options above.
If you don't set any default value, then it will be requested when compiling Xen. The risk of setting a default value for "generic" config is the user may not notice that it needs to fill it up.
So he/she may end up to compile Xen with the wrong address and will get not output later on at best. This sort of things is quite difficult to debug until you know what you are doing.
Quoted 19 lines
Quoted 19 lines
xen/arch/arm/Kconfig.debug new file +3
-0+config EARLY_PRINTK_INC + string + default "debug-cadence.inc" if EARLY_UART_CADENCExen/arch/arm/Rules.mk +0
-1@@ -46,7 +46,6 @@ EARLY_PRINTK_thunderx := pl011,0x87e024000000 EARLY_PRINTK_vexpress := pl011,0x1c090000 EARLY_PRINTK_xgene-mcdivitt := 8250,0x1c021000,2 EARLY_PRINTK_xgene-storm := 8250,0x1c020000,2 -EARLY_PRINTK_zynqmp := cadence,0xff000000 ifneq ($(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)),) EARLY_PRINTK_CFG := $(subst $(comma), ,$(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)))@@ -82,9 +81,9 @@ endif
Quoted 10 lines
xen/arch/arm/Rules.mk endif · line 86
Quoted 7 lines
xen/arch/arm/Rules.mk +2
-2CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART -CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD) -CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS) +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)I don't have an opinion on the naming, the following is a suggestion to make the patch easier to write.
I got bored enough on the plan to try to do more cleanup at the same time (see below). ;)
Quoted 4 lines
It looks like we could get away without
any of the renaming below if we choose to exportEARLY_UART_BASE_ADDRESSand keep usingEARLY_UART_BASE_ADDRESSdirectly in the code below.
I want to get rid of anything not starting with CONFIG_ because this is misleading. So they either got drop in this patch (and follow-ups) or they get renamed before hand.
I chose the former because some options will not be a straight prefixing of CONFIG_. For instance, EARLY_UART_REG_SHIFT is a specific to 8250, so I would like to rename it CONFIG_EARLY_UART_8250_SHIFT.
I can try to do the renaming before hand if you prefer.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 163 lines · Julien Grall
Hi Stefano,
Quoted 62 lines · Stefano Stabellini
Quoted 61 lines · Julien Grall
At the moment, early printk can only be configured on the make command line. It is not very handy because a user has to remove the option everytime it is using another command other than compiling the hypervisor.
Furthermore, early printk is one of the few odds one that are not using
Kconfig.So this is about time to move it to
Kconfig. For now, a skeleton is added with one example based on Cadence UART. Follow-up will continue to convert all the options toKconfig.Because
Kconfigwill prefix all the config byCONFIG_, it is necessary to adapt the define within the code.Signed-off-by Julien Grall <[email protected]>---
I have sent it as RFC because this is not complete. I will convert the rest once we agree the approach is correct.
--- xen/Kconfig.debug | 2 ++ xen/arch/arm/Kconfig.debug | 40 ++++++++++++++++++++++++++++++++++++++ xen/arch/arm/Rules.mk | 5 ++--- xen/arch/arm/arm32/head.S | 8 ++++---- xen/arch/arm/arm64/debug.S | 4 ++-- xen/arch/arm/arm64/head.S | 8 ++++---- xen/arch/x86/Kconfig.debug | 0 xen/include/asm-arm/early_printk.h | 2 +- 8 files changed, 55 insertions(+), 14 deletions(-)create mode 100644 xen/arch/arm/Kconfig.debug
create mode 100644 xen/arch/x86/Kconfig.debugxen/Kconfig.debug +1
-0@@ -112,6 +112,8 @@ config XMEM_POOL_POISON Poison free blocks with 0xAA bytes and verify them when a block is allocated in order to spot use-after-free issues. +source "arch/$SRCARCH/Kconfig.debug" + endif # DEBUG || EXPERT endmenuxen/arch/arm/Kconfig.debug new file +9
-0@@ -0,0 +1,40 @@ +choice + prompt "Enable early printk" + + optional + config EARLY_PRINTK_ZYNQMP + bool "Enable early printk on Xilinx ZynQMP" + select EARLY_UART_CADENCE + help + Say Y here if you want the early printk support on XilinxQuoted 8 lines
xen/arch/arm/Kconfig.debug line 14
Quoted 5 lines
xen/arch/arm/Kconfig.debug new file +5
-0+ ZynQMP platform. + + config EARLY_PRINTK_CADENCE + bool "Enable early printk via Cadence UART" + select EARLY_UART_CADENCEWhy not select
EARLY_PRINTKdirectly? IsEARLY_UART_CADENCEactually needed?Yes to select the proper
EARLY_PRINTK_INC. For other UARTs (such as 8250), it will be necessary to enable more options.The other option is to have lengthy if in some part of the
Kconfigwhich is not pretty and likely a way to miss some places if we ever decide to add more alias (I hope not!).Quoted 20 lines
Quoted 20 lines
xen/arch/arm/Kconfig.debug new file +18
-0+ help + Say Y here if you wish the early printk to direct their + output to a Cadence UART. You can use this option to provide + the parameters for the Cadence UART rather than selecting + one of the platform specific options above if you know the + parameters for the port. + + This option is preferred over the platform specific options; + the platform specific options are deprecated and will soon + be removed. +endchoice + +config EARLY_PRINTK + bool + +config EARLY_UART_CADENCE + bool + select EARLY_PRINTKQuoted 8 lines
xen/arch/arm/Kconfig.debug line 36
Quoted 4 lines
xen/arch/arm/Kconfig.debug new file +4
-0+ +config EARLY_UART_BASE_ADDRESS + hex "Physical base address of debug UART" if EARLY_PRINTK + default 0xff000000 if EARLY_PRINTK_ZYNQMPThis only works for
EARLY_PRINTK_ZYNQMPand not forEARLY_PRINTK_CADENCE. I imagine we need a default line for each of the possible options above.If you don't set any default value, then it will be requested when compiling Xen. The risk of setting a default value for "generic" config is the user may not notice that it needs to fill it up.
So he/she may end up to compile Xen with the wrong address and will get not output later on at best. This sort of things is quite difficult to debug until you know what you are doing.
Quoted 24 lines
Quoted 24 lines
xen/arch/arm/Kconfig.debug new file +3
-0+config EARLY_PRINTK_INC + string + default "debug-cadence.inc" if EARLY_UART_CADENCExen/arch/arm/Rules.mk +1
-4@@ -46,7 +46,6 @@ EARLY_PRINTK_thunderx := pl011,0x87e024000000 EARLY_PRINTK_vexpress := pl011,0x1c090000 EARLY_PRINTK_xgene-mcdivitt := 8250,0x1c021000,2 EARLY_PRINTK_xgene-storm := 8250,0x1c020000,2 -EARLY_PRINTK_zynqmp := cadence,0xff000000 ifneq ($(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)),) EARLY_PRINTK_CFG := $(subst $(comma), ,$(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)))@@ -82,9 +81,9 @@ endif CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART -CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\"Quoted 8 lines
xen/arch/arm/Rules.mk endif · line 90
Quoted 5 lines
xen/arch/arm/Rules.mk +1
-3CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD) -CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS) +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)I don't have an opinion on the naming, the following is a suggestion to make the patch easier to write.
I got bored enough on the plan to try to do more cleanup at the same time (see below). ;)
Quoted 4 lines
It looks like we could get away without
any of the renaming below if we choose to exportEARLY_UART_BASE_ADDRESSand keep usingEARLY_UART_BASE_ADDRESSdirectly in the code below.I want to get rid of anything not starting with
CONFIG_because this is misleading. So they either got drop in this patch (and follow-ups) or they get renamed before hand.
Quoted 5 lines
I chose the former because some options will not be a straight prefixing of
CONFIG_. For instance,EARLY_UART_REG_SHIFTis a specific to 8250, so I would like to rename itCONFIG_EARLY_UART_8250_SHIFT.I can try to do the renaming before hand if you prefer.
Yes, I prefer the renaming to be separate if it is not a problem.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel