All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] xen: improve console outputs
@ 2020-10-15  4:25 AKASHI Takahiro
  2020-10-15  4:25 ` [PATCH 1/4] serial: serial_xen: print U-Boot banner and others AKASHI Takahiro
                   ` (3 more replies)
  0 siblings, 4 replies; 35+ messages in thread
From: AKASHI Takahiro @ 2020-10-15  4:25 UTC (permalink / raw)
  To: u-boot

This patch series improves the behavior and functionality of console
output on Xen:

Patch#1: allow for U-Boot banner
Patch#2-4: enable DEBUG_UART (or early printf)

AKASHI Takahiro (4):
  serial: serial_xen: print U-Boot banner and others
  arch: arm/xen: add putc() for debugging
  xen: add definitions for console_io
  serial: serial_xen: add DEBUG_UART support

 arch/arm/include/asm/xen/hypercall.h |  6 ++++++
 drivers/serial/Kconfig               | 14 +++++++++++---
 drivers/serial/serial_xen.c          | 22 ++++++++++++++++++++--
 include/xen/interface/xen.h          |  6 ++++++
 4 files changed, 43 insertions(+), 5 deletions(-)

-- 
2.28.0

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

* [PATCH 1/4] serial: serial_xen: print U-Boot banner and others
  2020-10-15  4:25 [PATCH 0/4] xen: improve console outputs AKASHI Takahiro
@ 2020-10-15  4:25 ` AKASHI Takahiro
  2020-10-15  6:51   ` Peng Fan
                     ` (2 more replies)
  2020-10-15  4:25 ` [PATCH 2/4] arch: arm/xen: add putc() for debugging AKASHI Takahiro
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 35+ messages in thread
From: AKASHI Takahiro @ 2020-10-15  4:25 UTC (permalink / raw)
  To: u-boot

At present, DM_FLAG_PRE_RELOC is set only if !OF_CONTROL.
It doesn't make sense for this para-virtualized driver.

With this patch applied, you will be able to see early boot messages:

U-Boot 2020.10-00001-ge442e71a6c52-dirty (Oct 15 2020 - 11:02:25 +0900)
xenguest

Xen virtual CPU
Model: XENVM-4.15
DRAM:  128 MiB
PVBLOCK:
(XEN) gnttab_mark_dirty not implemented yet
pvblock: 0
In:    hypervisor
Out:   hypervisor
Err:   hypervisor
xenguest#

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 drivers/serial/serial_xen.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c
index ba6504b94796..ed191829f059 100644
--- a/drivers/serial/serial_xen.c
+++ b/drivers/serial/serial_xen.c
@@ -175,8 +175,6 @@ U_BOOT_DRIVER(serial_xen) = {
 	.priv_auto_alloc_size	= sizeof(struct xen_uart_priv),
 	.probe			= xen_serial_probe,
 	.ops			= &xen_serial_ops,
-#if !CONFIG_IS_ENABLED(OF_CONTROL)
 	.flags			= DM_FLAG_PRE_RELOC,
-#endif
 };
 
-- 
2.28.0

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

* [PATCH 2/4] arch: arm/xen: add putc() for debugging
  2020-10-15  4:25 [PATCH 0/4] xen: improve console outputs AKASHI Takahiro
  2020-10-15  4:25 ` [PATCH 1/4] serial: serial_xen: print U-Boot banner and others AKASHI Takahiro
@ 2020-10-15  4:25 ` AKASHI Takahiro
  2020-10-15  6:52   ` Peng Fan
  2020-10-23  0:31   ` Tom Rini
  2020-10-15  4:25 ` [PATCH 3/4] xen: add definitions for console_io AKASHI Takahiro
  2020-10-15  4:25 ` [PATCH 4/4] serial: serial_xen: add DEBUG_UART support AKASHI Takahiro
  3 siblings, 2 replies; 35+ messages in thread
From: AKASHI Takahiro @ 2020-10-15  4:25 UTC (permalink / raw)
  To: u-boot

This new function, xen_debug_putc(), is intended to be used to
enable CONFIG_DEBUG_UART on xen guest.

Please note that the underlying functionality in Xen is available
only when Xen is configured with !NDEBUG but is much simpler than
a generic HYPERVISOR_console_io().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 arch/arm/include/asm/xen/hypercall.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
index a4fd077079a9..121ccfcc608f 100644
--- a/arch/arm/include/asm/xen/hypercall.h
+++ b/arch/arm/include/asm/xen/hypercall.h
@@ -19,4 +19,10 @@ int HYPERVISOR_sched_op(int cmd, void *arg);
 int HYPERVISOR_event_channel_op(int cmd, void *arg);
 unsigned long HYPERVISOR_hvm_op(int op, void *arg);
 int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
+
+static inline void xen_debug_putc(int c)
+{
+	register int v __asm__ ("x0") = c;
+	__asm__ __volatile__("hvc 0xfffe" : "=r" (v) : "0" (v));
+}
 #endif /* _ASM_ARM_XEN_HYPERCALL_H */
-- 
2.28.0

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

* [PATCH 3/4] xen: add definitions for console_io
  2020-10-15  4:25 [PATCH 0/4] xen: improve console outputs AKASHI Takahiro
  2020-10-15  4:25 ` [PATCH 1/4] serial: serial_xen: print U-Boot banner and others AKASHI Takahiro
  2020-10-15  4:25 ` [PATCH 2/4] arch: arm/xen: add putc() for debugging AKASHI Takahiro
@ 2020-10-15  4:25 ` AKASHI Takahiro
  2020-10-15  6:52   ` Peng Fan
  2020-10-23  0:31   ` Tom Rini
  2020-10-15  4:25 ` [PATCH 4/4] serial: serial_xen: add DEBUG_UART support AKASHI Takahiro
  3 siblings, 2 replies; 35+ messages in thread
From: AKASHI Takahiro @ 2020-10-15  4:25 UTC (permalink / raw)
  To: u-boot

Those definitions added are used with HYPERVISOR_console_io().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 include/xen/interface/xen.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index eec8ab75b9ce..a7c8ed781b34 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -76,6 +76,12 @@
 #define __HYPERVISOR_arch_6               54
 #define __HYPERVISOR_arch_7               55
 
+/*
+ * Commands to HYPERVISOR_console_io().
+ */
+#define CONSOLEIO_write         0
+#define CONSOLEIO_read          1
+
 #ifndef __ASSEMBLY__
 
 typedef u16 domid_t;
-- 
2.28.0

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-15  4:25 [PATCH 0/4] xen: improve console outputs AKASHI Takahiro
                   ` (2 preceding siblings ...)
  2020-10-15  4:25 ` [PATCH 3/4] xen: add definitions for console_io AKASHI Takahiro
@ 2020-10-15  4:25 ` AKASHI Takahiro
  2020-10-15  6:50   ` Peng Fan
                     ` (2 more replies)
  3 siblings, 3 replies; 35+ messages in thread
From: AKASHI Takahiro @ 2020-10-15  4:25 UTC (permalink / raw)
  To: u-boot

By using a hypervisor call, we can implement DEBUG_UART on xen.
This will allow us to see messages even earlier than serial_init().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 drivers/serial/Kconfig      | 14 +++++++++++---
 drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index e344677f91f6..536cf0641773 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -401,11 +401,19 @@ config DEBUG_UART_MTK
 	  driver will be available until the real driver model serial is
 	  running.
 
+config DEBUG_UART_XEN
+	bool "XEN Hypervisor Console"
+	depends on XEN_SERIAL
+	help
+	  Select this to enable a debug UART using the serial_xen driver. You
+	  will not have to provide any parameters to make this work. The driver
+          will be available until the real driver-model serial is running.
+
 endchoice
 
 config DEBUG_UART_BASE
 	hex "Base address of UART"
-	depends on DEBUG_UART
+	depends on DEBUG_UART && !DEBUG_UART_XEN
 	default 0 if DEBUG_UART_SANDBOX
 	help
 	  This is the base address of your UART for memory-mapped UARTs.
@@ -415,7 +423,7 @@ config DEBUG_UART_BASE
 
 config DEBUG_UART_CLOCK
 	int "UART input clock"
-	depends on DEBUG_UART
+	depends on DEBUG_UART && !DEBUG_UART_XEN
 	default 0 if DEBUG_UART_SANDBOX
 	help
 	  The UART input clock determines the speed of the internal UART
@@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
 
 config DEBUG_UART_SHIFT
 	int "UART register shift"
-	depends on DEBUG_UART
+	depends on DEBUG_UART && !DEBUG_UART_XEN
 	default 0 if DEBUG_UART
 	help
 	  Some UARTs (notably ns16550) support different register layouts
diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c
index ed191829f059..34c90ece40fc 100644
--- a/drivers/serial/serial_xen.c
+++ b/drivers/serial/serial_xen.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <cpu_func.h>
+#include <debug_uart.h>
 #include <dm.h>
 #include <serial.h>
 #include <watchdog.h>
@@ -15,11 +16,14 @@
 #include <xen/events.h>
 
 #include <xen/interface/sched.h>
+#include <xen/interface/xen.h>
 #include <xen/interface/hvm/hvm_op.h>
 #include <xen/interface/hvm/params.h>
 #include <xen/interface/io/console.h>
 #include <xen/interface/io/ring.h>
 
+#include <asm/xen/hypercall.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 
 u32 console_evtchn;
@@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
 	.flags			= DM_FLAG_PRE_RELOC,
 };
 
+#if defined(CONFIG_DEBUG_UART_XEN)
+static inline void _debug_uart_init(void) {}
+
+static inline void _debug_uart_putc(int c)
+{
+#if CONFIG_IS_ENABLED(ARM)
+	xen_debug_putc(c);
+#else
+	/* the type cast should work on LE only */
+	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
+#endif
+}
+
+DEBUG_UART_FUNCS
+
+#endif
-- 
2.28.0

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-15  4:25 ` [PATCH 4/4] serial: serial_xen: add DEBUG_UART support AKASHI Takahiro
@ 2020-10-15  6:50   ` Peng Fan
  2020-10-22  9:19   ` Anastasiia Lukianenko
  2020-10-23  0:31   ` Tom Rini
  2 siblings, 0 replies; 35+ messages in thread
From: Peng Fan @ 2020-10-15  6:50 UTC (permalink / raw)
  To: u-boot

> Subject: [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
> 
> By using a hypervisor call, we can implement DEBUG_UART on xen.
> This will allow us to see messages even earlier than serial_init().
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  drivers/serial/Kconfig      | 14 +++++++++++---
>  drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>  2 files changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index
> e344677f91f6..536cf0641773 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>  	  driver will be available until the real driver model serial is
>  	  running.
> 
> +config DEBUG_UART_XEN
> +	bool "XEN Hypervisor Console"
> +	depends on XEN_SERIAL
> +	help
> +	  Select this to enable a debug UART using the serial_xen driver. You
> +	  will not have to provide any parameters to make this work. The driver
> +          will be available until the real driver-model serial is running.

Please add one more line that it needs XEN debug enabled. without xen debug,
you will not able to see any outputs.

Regards,
Peng.

> +
>  endchoice
> 
>  config DEBUG_UART_BASE
>  	hex "Base address of UART"
> -	depends on DEBUG_UART
> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>  	default 0 if DEBUG_UART_SANDBOX
>  	help
>  	  This is the base address of your UART for memory-mapped UARTs.
> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> 
>  config DEBUG_UART_CLOCK
>  	int "UART input clock"
> -	depends on DEBUG_UART
> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>  	default 0 if DEBUG_UART_SANDBOX
>  	help
>  	  The UART input clock determines the speed of the internal UART @@
> -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> 
>  config DEBUG_UART_SHIFT
>  	int "UART register shift"
> -	depends on DEBUG_UART
> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>  	default 0 if DEBUG_UART
>  	help
>  	  Some UARTs (notably ns16550) support different register layouts diff
> --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c index
> ed191829f059..34c90ece40fc 100644
> --- a/drivers/serial/serial_xen.c
> +++ b/drivers/serial/serial_xen.c
> @@ -5,6 +5,7 @@
>   */
>  #include <common.h>
>  #include <cpu_func.h>
> +#include <debug_uart.h>
>  #include <dm.h>
>  #include <serial.h>
>  #include <watchdog.h>
> @@ -15,11 +16,14 @@
>  #include <xen/events.h>
> 
>  #include <xen/interface/sched.h>
> +#include <xen/interface/xen.h>
>  #include <xen/interface/hvm/hvm_op.h>
>  #include <xen/interface/hvm/params.h>
>  #include <xen/interface/io/console.h>
>  #include <xen/interface/io/ring.h>
> 
> +#include <asm/xen/hypercall.h>
> +
>  DECLARE_GLOBAL_DATA_PTR;
> 
>  u32 console_evtchn;
> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>  	.flags			= DM_FLAG_PRE_RELOC,
>  };
> 
> +#if defined(CONFIG_DEBUG_UART_XEN)
> +static inline void _debug_uart_init(void) {}
> +
> +static inline void _debug_uart_putc(int c) { #if CONFIG_IS_ENABLED(ARM)
> +	xen_debug_putc(c);
> +#else
> +	/* the type cast should work on LE only */
> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch); #endif }
> +
> +DEBUG_UART_FUNCS
> +
> +#endif
> --
> 2.28.0

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

* [PATCH 1/4] serial: serial_xen: print U-Boot banner and others
  2020-10-15  4:25 ` [PATCH 1/4] serial: serial_xen: print U-Boot banner and others AKASHI Takahiro
@ 2020-10-15  6:51   ` Peng Fan
  2020-10-22  9:18   ` Anastasiia Lukianenko
  2020-10-23  0:30   ` Tom Rini
  2 siblings, 0 replies; 35+ messages in thread
From: Peng Fan @ 2020-10-15  6:51 UTC (permalink / raw)
  To: u-boot

> Subject: [PATCH 1/4] serial: serial_xen: print U-Boot banner and others
> 
> At present, DM_FLAG_PRE_RELOC is set only if !OF_CONTROL.
> It doesn't make sense for this para-virtualized driver.
> 
> With this patch applied, you will be able to see early boot messages:
> 
> U-Boot 2020.10-00001-ge442e71a6c52-dirty (Oct 15 2020 - 11:02:25 +0900)
> xenguest
> 
> Xen virtual CPU
> Model: XENVM-4.15
> DRAM:  128 MiB
> PVBLOCK:
> (XEN) gnttab_mark_dirty not implemented yet
> pvblock: 0
> In:    hypervisor
> Out:   hypervisor
> Err:   hypervisor
> xenguest#
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  drivers/serial/serial_xen.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c index
> ba6504b94796..ed191829f059 100644
> --- a/drivers/serial/serial_xen.c
> +++ b/drivers/serial/serial_xen.c
> @@ -175,8 +175,6 @@ U_BOOT_DRIVER(serial_xen) = {
>  	.priv_auto_alloc_size	= sizeof(struct xen_uart_priv),
>  	.probe			= xen_serial_probe,
>  	.ops			= &xen_serial_ops,
> -#if !CONFIG_IS_ENABLED(OF_CONTROL)
>  	.flags			= DM_FLAG_PRE_RELOC,
> -#endif
>  };
> 

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> --
> 2.28.0

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

* [PATCH 2/4] arch: arm/xen: add putc() for debugging
  2020-10-15  4:25 ` [PATCH 2/4] arch: arm/xen: add putc() for debugging AKASHI Takahiro
@ 2020-10-15  6:52   ` Peng Fan
  2020-10-23  0:31   ` Tom Rini
  1 sibling, 0 replies; 35+ messages in thread
From: Peng Fan @ 2020-10-15  6:52 UTC (permalink / raw)
  To: u-boot

> Subject: [PATCH 2/4] arch: arm/xen: add putc() for debugging
> 
> This new function, xen_debug_putc(), is intended to be used to enable
> CONFIG_DEBUG_UART on xen guest.
> 
> Please note that the underlying functionality in Xen is available only when Xen
> is configured with !NDEBUG but is much simpler than a generic
> HYPERVISOR_console_io().
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  arch/arm/include/asm/xen/hypercall.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/include/asm/xen/hypercall.h
> b/arch/arm/include/asm/xen/hypercall.h
> index a4fd077079a9..121ccfcc608f 100644
> --- a/arch/arm/include/asm/xen/hypercall.h
> +++ b/arch/arm/include/asm/xen/hypercall.h
> @@ -19,4 +19,10 @@ int HYPERVISOR_sched_op(int cmd, void *arg);  int
> HYPERVISOR_event_channel_op(int cmd, void *arg);  unsigned long
> HYPERVISOR_hvm_op(int op, void *arg);  int
> HYPERVISOR_memory_op(unsigned int cmd, void *arg);
> +
> +static inline void xen_debug_putc(int c) {
> +	register int v __asm__ ("x0") = c;
> +	__asm__ __volatile__("hvc 0xfffe" : "=r" (v) : "0" (v)); }
>  #endif /* _ASM_ARM_XEN_HYPERCALL_H */

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> --
> 2.28.0

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

* [PATCH 3/4] xen: add definitions for console_io
  2020-10-15  4:25 ` [PATCH 3/4] xen: add definitions for console_io AKASHI Takahiro
@ 2020-10-15  6:52   ` Peng Fan
  2020-10-23  0:31   ` Tom Rini
  1 sibling, 0 replies; 35+ messages in thread
From: Peng Fan @ 2020-10-15  6:52 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of AKASHI
> Takahiro
> Sent: 2020?10?15? 12:25
> To: anastasiia_lukianenko at epam.com;
> oleksandr_andrushchenko at epam.com
> Cc: u-boot at lists.denx.de; AKASHI Takahiro <takahiro.akashi@linaro.org>
> Subject: [PATCH 3/4] xen: add definitions for console_io
> 
> Those definitions added are used with HYPERVISOR_console_io().
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  include/xen/interface/xen.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h index
> eec8ab75b9ce..a7c8ed781b34 100644
> --- a/include/xen/interface/xen.h
> +++ b/include/xen/interface/xen.h
> @@ -76,6 +76,12 @@
>  #define __HYPERVISOR_arch_6               54
>  #define __HYPERVISOR_arch_7               55
> 
> +/*
> + * Commands to HYPERVISOR_console_io().
> + */
> +#define CONSOLEIO_write         0
> +#define CONSOLEIO_read          1
> +
>  #ifndef __ASSEMBLY__
> 
>  typedef u16 domid_t;

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> --
> 2.28.0

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

* [PATCH 1/4] serial: serial_xen: print U-Boot banner and others
  2020-10-15  4:25 ` [PATCH 1/4] serial: serial_xen: print U-Boot banner and others AKASHI Takahiro
  2020-10-15  6:51   ` Peng Fan
@ 2020-10-22  9:18   ` Anastasiia Lukianenko
  2020-10-22  9:49     ` takahiro.akashi at linaro.org
  2020-10-23  0:30   ` Tom Rini
  2 siblings, 1 reply; 35+ messages in thread
From: Anastasiia Lukianenko @ 2020-10-22  9:18 UTC (permalink / raw)
  To: u-boot

Hi,

On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> At present, DM_FLAG_PRE_RELOC is set only if !OF_CONTROL.
> It doesn't make sense for this para-virtualized driver.
> 
> With this patch applied, you will be able to see early boot messages:
> 
> U-Boot 2020.10-00001-ge442e71a6c52-dirty (Oct 15 2020 - 11:02:25
> +0900)
> xenguest
> 
> Xen virtual CPU
> Model: XENVM-4.15
> DRAM:  128 MiB
> PVBLOCK:
> (XEN) gnttab_mark_dirty not implemented yet
> pvblock: 0
> In:    hypervisor
> Out:   hypervisor
> Err:   hypervisor
> xenguest#
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  drivers/serial/serial_xen.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/serial/serial_xen.c
> b/drivers/serial/serial_xen.c
> index ba6504b94796..ed191829f059 100644
> --- a/drivers/serial/serial_xen.c
> +++ b/drivers/serial/serial_xen.c
> @@ -175,8 +175,6 @@ U_BOOT_DRIVER(serial_xen) = {
>  	.priv_auto_alloc_size	= sizeof(struct xen_uart_priv),
>  	.probe			= xen_serial_probe,
>  	.ops			= &xen_serial_ops,
> -#if !CONFIG_IS_ENABLED(OF_CONTROL)
>  	.flags			= DM_FLAG_PRE_RELOC,
> -#endif
>  };
>  

I applied this patch and unfortunately on ARM there were no logs. I
think this series should be improved a little.

Regards,
Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-15  4:25 ` [PATCH 4/4] serial: serial_xen: add DEBUG_UART support AKASHI Takahiro
  2020-10-15  6:50   ` Peng Fan
@ 2020-10-22  9:19   ` Anastasiia Lukianenko
  2020-10-22  9:53     ` takahiro.akashi at linaro.org
  2020-10-23  0:31   ` Tom Rini
  2 siblings, 1 reply; 35+ messages in thread
From: Anastasiia Lukianenko @ 2020-10-22  9:19 UTC (permalink / raw)
  To: u-boot

Hi,

On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> By using a hypervisor call, we can implement DEBUG_UART on xen.
> This will allow us to see messages even earlier than serial_init().
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  drivers/serial/Kconfig      | 14 +++++++++++---
>  drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>  2 files changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index e344677f91f6..536cf0641773 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>  	  driver will be available until the real driver model serial
> is
>  	  running.
>  
> +config DEBUG_UART_XEN
> +	bool "XEN Hypervisor Console"
> +	depends on XEN_SERIAL
> +	help
> +	  Select this to enable a debug UART using the serial_xen
> driver. You
> +	  will not have to provide any parameters to make this work.
> The driver
> +          will be available until the real driver-model serial is
> running.
> +
>  endchoice
>  
>  config DEBUG_UART_BASE
>  	hex "Base address of UART"
> -	depends on DEBUG_UART
> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>  	default 0 if DEBUG_UART_SANDBOX
>  	help
>  	  This is the base address of your UART for memory-mapped
> UARTs.
> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
>  
>  config DEBUG_UART_CLOCK
>  	int "UART input clock"
> -	depends on DEBUG_UART
> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>  	default 0 if DEBUG_UART_SANDBOX
>  	help
>  	  The UART input clock determines the speed of the internal
> UART
> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
>  
>  config DEBUG_UART_SHIFT
>  	int "UART register shift"
> -	depends on DEBUG_UART
> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>  	default 0 if DEBUG_UART
>  	help
>  	  Some UARTs (notably ns16550) support different register
> layouts
> diff --git a/drivers/serial/serial_xen.c
> b/drivers/serial/serial_xen.c
> index ed191829f059..34c90ece40fc 100644
> --- a/drivers/serial/serial_xen.c
> +++ b/drivers/serial/serial_xen.c
> @@ -5,6 +5,7 @@
>   */
>  #include <common.h>
>  #include <cpu_func.h>
> +#include <debug_uart.h>
>  #include <dm.h>
>  #include <serial.h>
>  #include <watchdog.h>
> @@ -15,11 +16,14 @@
>  #include <xen/events.h>
>  
>  #include <xen/interface/sched.h>
> +#include <xen/interface/xen.h>
>  #include <xen/interface/hvm/hvm_op.h>
>  #include <xen/interface/hvm/params.h>
>  #include <xen/interface/io/console.h>
>  #include <xen/interface/io/ring.h>
>  
> +#include <asm/xen/hypercall.h>
> +
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  u32 console_evtchn;
> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>  	.flags			= DM_FLAG_PRE_RELOC,
>  };
>  
> +#if defined(CONFIG_DEBUG_UART_XEN)
> +static inline void _debug_uart_init(void) {}
> +
> +static inline void _debug_uart_putc(int c)
> +{
> +#if CONFIG_IS_ENABLED(ARM)
> +	xen_debug_putc(c);
> +#else
> +	/* the type cast should work on LE only */
> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);

An error occurs during compilation:
drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in this
function); did you mean ?c??
        HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);

> +#endif
> +}
> +
> +DEBUG_UART_FUNCS
> +
> +#endif

Regards,
Anastasiia

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

* [PATCH 1/4] serial: serial_xen: print U-Boot banner and others
  2020-10-22  9:18   ` Anastasiia Lukianenko
@ 2020-10-22  9:49     ` takahiro.akashi at linaro.org
  2020-10-23  8:58       ` Anastasiia Lukianenko
  0 siblings, 1 reply; 35+ messages in thread
From: takahiro.akashi at linaro.org @ 2020-10-22  9:49 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 22, 2020 at 09:18:02AM +0000, Anastasiia Lukianenko wrote:
> Hi,
> 
> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> > At present, DM_FLAG_PRE_RELOC is set only if !OF_CONTROL.
> > It doesn't make sense for this para-virtualized driver.
> > 
> > With this patch applied, you will be able to see early boot messages:
> > 
> > U-Boot 2020.10-00001-ge442e71a6c52-dirty (Oct 15 2020 - 11:02:25
> > +0900)
> > xenguest
> > 
> > Xen virtual CPU
> > Model: XENVM-4.15
> > DRAM:  128 MiB
> > PVBLOCK:
> > (XEN) gnttab_mark_dirty not implemented yet
> > pvblock: 0
> > In:    hypervisor
> > Out:   hypervisor
> > Err:   hypervisor
> > xenguest#
> > 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  drivers/serial/serial_xen.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/serial/serial_xen.c
> > b/drivers/serial/serial_xen.c
> > index ba6504b94796..ed191829f059 100644
> > --- a/drivers/serial/serial_xen.c
> > +++ b/drivers/serial/serial_xen.c
> > @@ -175,8 +175,6 @@ U_BOOT_DRIVER(serial_xen) = {
> >  	.priv_auto_alloc_size	= sizeof(struct xen_uart_priv),
> >  	.probe			= xen_serial_probe,
> >  	.ops			= &xen_serial_ops,
> > -#if !CONFIG_IS_ENABLED(OF_CONTROL)
> >  	.flags			= DM_FLAG_PRE_RELOC,
> > -#endif
> >  };
> >  
> 
> I applied this patch and unfortunately on ARM there were no logs. I
> think this series should be improved a little.

I will check.
Please tell me
 - the board that you're using
 - the version of Xen
   (and .config)

Thanks,
-Takahiro Akashi

> Regards,
> Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-22  9:19   ` Anastasiia Lukianenko
@ 2020-10-22  9:53     ` takahiro.akashi at linaro.org
  2020-10-23  8:50       ` Anastasiia Lukianenko
  2020-10-23  8:53       ` Anastasiia Lukianenko
  0 siblings, 2 replies; 35+ messages in thread
From: takahiro.akashi at linaro.org @ 2020-10-22  9:53 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko wrote:
> Hi,
> 
> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > This will allow us to see messages even earlier than serial_init().
> > 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  drivers/serial/Kconfig      | 14 +++++++++++---
> >  drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> >  2 files changed, 31 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > index e344677f91f6..536cf0641773 100644
> > --- a/drivers/serial/Kconfig
> > +++ b/drivers/serial/Kconfig
> > @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> >  	  driver will be available until the real driver model serial
> > is
> >  	  running.
> >  
> > +config DEBUG_UART_XEN
> > +	bool "XEN Hypervisor Console"
> > +	depends on XEN_SERIAL
> > +	help
> > +	  Select this to enable a debug UART using the serial_xen
> > driver. You
> > +	  will not have to provide any parameters to make this work.
> > The driver
> > +          will be available until the real driver-model serial is
> > running.
> > +
> >  endchoice
> >  
> >  config DEBUG_UART_BASE
> >  	hex "Base address of UART"
> > -	depends on DEBUG_UART
> > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >  	default 0 if DEBUG_UART_SANDBOX
> >  	help
> >  	  This is the base address of your UART for memory-mapped
> > UARTs.
> > @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> >  
> >  config DEBUG_UART_CLOCK
> >  	int "UART input clock"
> > -	depends on DEBUG_UART
> > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >  	default 0 if DEBUG_UART_SANDBOX
> >  	help
> >  	  The UART input clock determines the speed of the internal
> > UART
> > @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> >  
> >  config DEBUG_UART_SHIFT
> >  	int "UART register shift"
> > -	depends on DEBUG_UART
> > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >  	default 0 if DEBUG_UART
> >  	help
> >  	  Some UARTs (notably ns16550) support different register
> > layouts
> > diff --git a/drivers/serial/serial_xen.c
> > b/drivers/serial/serial_xen.c
> > index ed191829f059..34c90ece40fc 100644
> > --- a/drivers/serial/serial_xen.c
> > +++ b/drivers/serial/serial_xen.c
> > @@ -5,6 +5,7 @@
> >   */
> >  #include <common.h>
> >  #include <cpu_func.h>
> > +#include <debug_uart.h>
> >  #include <dm.h>
> >  #include <serial.h>
> >  #include <watchdog.h>
> > @@ -15,11 +16,14 @@
> >  #include <xen/events.h>
> >  
> >  #include <xen/interface/sched.h>
> > +#include <xen/interface/xen.h>
> >  #include <xen/interface/hvm/hvm_op.h>
> >  #include <xen/interface/hvm/params.h>
> >  #include <xen/interface/io/console.h>
> >  #include <xen/interface/io/ring.h>
> >  
> > +#include <asm/xen/hypercall.h>
> > +
> >  DECLARE_GLOBAL_DATA_PTR;
> >  
> >  u32 console_evtchn;
> > @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> >  	.flags			= DM_FLAG_PRE_RELOC,
> >  };
> >  
> > +#if defined(CONFIG_DEBUG_UART_XEN)
> > +static inline void _debug_uart_init(void) {}
> > +
> > +static inline void _debug_uart_putc(int c)
> > +{
> > +#if CONFIG_IS_ENABLED(ARM)
> > +	xen_debug_putc(c);
> > +#else
> > +	/* the type cast should work on LE only */
> > +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> 
> An error occurs during compilation:
> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in this
> function); did you mean ?c??
>         HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);

Ah, yes. You're now using x86, right?

So what happens if you have made the fix above?
Does it work in your environment?
(I have confirmed that HYPERVISOR_console_io version works on arm(64).)

Thanks,
-Takahiro Akashi


> > +#endif
> > +}
> > +
> > +DEBUG_UART_FUNCS
> > +
> > +#endif
> 
> Regards,
> Anastasiia

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

* [PATCH 1/4] serial: serial_xen: print U-Boot banner and others
  2020-10-15  4:25 ` [PATCH 1/4] serial: serial_xen: print U-Boot banner and others AKASHI Takahiro
  2020-10-15  6:51   ` Peng Fan
  2020-10-22  9:18   ` Anastasiia Lukianenko
@ 2020-10-23  0:30   ` Tom Rini
  2 siblings, 0 replies; 35+ messages in thread
From: Tom Rini @ 2020-10-23  0:30 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 15, 2020 at 01:25:13PM +0900, AKASHI Takahiro wrote:

> At present, DM_FLAG_PRE_RELOC is set only if !OF_CONTROL.
> It doesn't make sense for this para-virtualized driver.
> 
> With this patch applied, you will be able to see early boot messages:
> 
> U-Boot 2020.10-00001-ge442e71a6c52-dirty (Oct 15 2020 - 11:02:25 +0900)
> xenguest
> 
> Xen virtual CPU
> Model: XENVM-4.15
> DRAM:  128 MiB
> PVBLOCK:
> (XEN) gnttab_mark_dirty not implemented yet
> pvblock: 0
> In:    hypervisor
> Out:   hypervisor
> Err:   hypervisor
> xenguest#
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201022/e3786f3e/attachment.sig>

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

* [PATCH 2/4] arch: arm/xen: add putc() for debugging
  2020-10-15  4:25 ` [PATCH 2/4] arch: arm/xen: add putc() for debugging AKASHI Takahiro
  2020-10-15  6:52   ` Peng Fan
@ 2020-10-23  0:31   ` Tom Rini
  1 sibling, 0 replies; 35+ messages in thread
From: Tom Rini @ 2020-10-23  0:31 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 15, 2020 at 01:25:14PM +0900, AKASHI Takahiro wrote:

> This new function, xen_debug_putc(), is intended to be used to
> enable CONFIG_DEBUG_UART on xen guest.
> 
> Please note that the underlying functionality in Xen is available
> only when Xen is configured with !NDEBUG but is much simpler than
> a generic HYPERVISOR_console_io().
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201022/1f337ced/attachment.sig>

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

* [PATCH 3/4] xen: add definitions for console_io
  2020-10-15  4:25 ` [PATCH 3/4] xen: add definitions for console_io AKASHI Takahiro
  2020-10-15  6:52   ` Peng Fan
@ 2020-10-23  0:31   ` Tom Rini
  1 sibling, 0 replies; 35+ messages in thread
From: Tom Rini @ 2020-10-23  0:31 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 15, 2020 at 01:25:15PM +0900, AKASHI Takahiro wrote:

> Those definitions added are used with HYPERVISOR_console_io().
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201022/3c4df5b2/attachment.sig>

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-15  4:25 ` [PATCH 4/4] serial: serial_xen: add DEBUG_UART support AKASHI Takahiro
  2020-10-15  6:50   ` Peng Fan
  2020-10-22  9:19   ` Anastasiia Lukianenko
@ 2020-10-23  0:31   ` Tom Rini
  2020-10-23  9:22     ` Anastasiia Lukianenko
  2 siblings, 1 reply; 35+ messages in thread
From: Tom Rini @ 2020-10-23  0:31 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 15, 2020 at 01:25:16PM +0900, AKASHI Takahiro wrote:

> By using a hypervisor call, we can implement DEBUG_UART on xen.
> This will allow us to see messages even earlier than serial_init().
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201022/4d10d60c/attachment.sig>

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-22  9:53     ` takahiro.akashi at linaro.org
@ 2020-10-23  8:50       ` Anastasiia Lukianenko
  2020-10-26  5:58         ` takahiro.akashi at linaro.org
  2020-10-23  8:53       ` Anastasiia Lukianenko
  1 sibling, 1 reply; 35+ messages in thread
From: Anastasiia Lukianenko @ 2020-10-23  8:50 UTC (permalink / raw)
  To: u-boot

Hello,

On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
> wrote:
> > Hi,
> > 
> > On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> > > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > > This will allow us to see messages even earlier than
> > > serial_init().
> > > 
> > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > ---
> > >  drivers/serial/Kconfig      | 14 +++++++++++---
> > >  drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> > >  2 files changed, 31 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > > index e344677f91f6..536cf0641773 100644
> > > --- a/drivers/serial/Kconfig
> > > +++ b/drivers/serial/Kconfig
> > > @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> > >  	  driver will be available until the real driver model serial
> > > is
> > >  	  running.
> > >  
> > > +config DEBUG_UART_XEN
> > > +	bool "XEN Hypervisor Console"
> > > +	depends on XEN_SERIAL
> > > +	help
> > > +	  Select this to enable a debug UART using the serial_xen
> > > driver. You
> > > +	  will not have to provide any parameters to make this work.
> > > The driver
> > > +          will be available until the real driver-model serial
> > > is
> > > running.
> > > +
> > >  endchoice
> > >  
> > >  config DEBUG_UART_BASE
> > >  	hex "Base address of UART"
> > > -	depends on DEBUG_UART
> > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > >  	default 0 if DEBUG_UART_SANDBOX
> > >  	help
> > >  	  This is the base address of your UART for memory-mapped
> > > UARTs.
> > > @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> > >  
> > >  config DEBUG_UART_CLOCK
> > >  	int "UART input clock"
> > > -	depends on DEBUG_UART
> > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > >  	default 0 if DEBUG_UART_SANDBOX
> > >  	help
> > >  	  The UART input clock determines the speed of the internal
> > > UART
> > > @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> > >  
> > >  config DEBUG_UART_SHIFT
> > >  	int "UART register shift"
> > > -	depends on DEBUG_UART
> > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > >  	default 0 if DEBUG_UART
> > >  	help
> > >  	  Some UARTs (notably ns16550) support different register
> > > layouts
> > > diff --git a/drivers/serial/serial_xen.c
> > > b/drivers/serial/serial_xen.c
> > > index ed191829f059..34c90ece40fc 100644
> > > --- a/drivers/serial/serial_xen.c
> > > +++ b/drivers/serial/serial_xen.c
> > > @@ -5,6 +5,7 @@
> > >   */
> > >  #include <common.h>
> > >  #include <cpu_func.h>
> > > +#include <debug_uart.h>
> > >  #include <dm.h>
> > >  #include <serial.h>
> > >  #include <watchdog.h>
> > > @@ -15,11 +16,14 @@
> > >  #include <xen/events.h>
> > >  
> > >  #include <xen/interface/sched.h>
> > > +#include <xen/interface/xen.h>
> > >  #include <xen/interface/hvm/hvm_op.h>
> > >  #include <xen/interface/hvm/params.h>
> > >  #include <xen/interface/io/console.h>
> > >  #include <xen/interface/io/ring.h>
> > >  
> > > +#include <asm/xen/hypercall.h>
> > > +
> > >  DECLARE_GLOBAL_DATA_PTR;
> > >  
> > >  u32 console_evtchn;
> > > @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> > >  	.flags			= DM_FLAG_PRE_RELOC,
> > >  };
> > >  
> > > +#if defined(CONFIG_DEBUG_UART_XEN)
> > > +static inline void _debug_uart_init(void) {}
> > > +
> > > +static inline void _debug_uart_putc(int c)
> > > +{
> > > +#if CONFIG_IS_ENABLED(ARM)
> > > +	xen_debug_putc(c);
> > > +#else
> > > +	/* the type cast should work on LE only */
> > > +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> > 
> > An error occurs during compilation:
> > drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
> > this
> > function); did you mean ?c??
> >         HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> 
> Ah, yes. You're now using x86, right?

No, I just tried different options and accidentally discovered this
error.

> 
> So what happens if you have made the fix above?
> Does it work in your environment?
> (I have confirmed that HYPERVISOR_console_io version works on
> arm(64).)

Unfortunately, nothing happened (there are no logs mentioned earlier).

Regards,
Anastasiia
> 
> Thanks,
> -Takahiro Akashi
> 
> 
> > > +#endif
> > > +}
> > > +
> > > +DEBUG_UART_FUNCS
> > > +
> > > +#endif
> > 
> > Regards,
> > Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-22  9:53     ` takahiro.akashi at linaro.org
  2020-10-23  8:50       ` Anastasiia Lukianenko
@ 2020-10-23  8:53       ` Anastasiia Lukianenko
  2020-10-26  6:02         ` takahiro.akashi at linaro.org
  1 sibling, 1 reply; 35+ messages in thread
From: Anastasiia Lukianenko @ 2020-10-23  8:53 UTC (permalink / raw)
  To: u-boot

Hi,

On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
> wrote:
> > Hi,
> > 
> > On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> > > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > > This will allow us to see messages even earlier than
> > > serial_init().
> > > 
> > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > ---
> > >  drivers/serial/Kconfig      | 14 +++++++++++---
> > >  drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> > >  2 files changed, 31 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > > index e344677f91f6..536cf0641773 100644
> > > --- a/drivers/serial/Kconfig
> > > +++ b/drivers/serial/Kconfig
> > > @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> > >  	  driver will be available until the real driver model serial
> > > is
> > >  	  running.
> > >  
> > > +config DEBUG_UART_XEN
> > > +	bool "XEN Hypervisor Console"
> > > +	depends on XEN_SERIAL
> > > +	help
> > > +	  Select this to enable a debug UART using the serial_xen
> > > driver. You
> > > +	  will not have to provide any parameters to make this work.
> > > The driver
> > > +          will be available until the real driver-model serial
> > > is
> > > running.
> > > +
> > >  endchoice
> > >  
> > >  config DEBUG_UART_BASE
> > >  	hex "Base address of UART"
> > > -	depends on DEBUG_UART
> > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > >  	default 0 if DEBUG_UART_SANDBOX
> > >  	help
> > >  	  This is the base address of your UART for memory-mapped
> > > UARTs.
> > > @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> > >  
> > >  config DEBUG_UART_CLOCK
> > >  	int "UART input clock"
> > > -	depends on DEBUG_UART
> > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > >  	default 0 if DEBUG_UART_SANDBOX
> > >  	help
> > >  	  The UART input clock determines the speed of the internal
> > > UART
> > > @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> > >  
> > >  config DEBUG_UART_SHIFT
> > >  	int "UART register shift"
> > > -	depends on DEBUG_UART
> > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > >  	default 0 if DEBUG_UART
> > >  	help
> > >  	  Some UARTs (notably ns16550) support different register
> > > layouts
> > > diff --git a/drivers/serial/serial_xen.c
> > > b/drivers/serial/serial_xen.c
> > > index ed191829f059..34c90ece40fc 100644
> > > --- a/drivers/serial/serial_xen.c
> > > +++ b/drivers/serial/serial_xen.c
> > > @@ -5,6 +5,7 @@
> > >   */
> > >  #include <common.h>
> > >  #include <cpu_func.h>
> > > +#include <debug_uart.h>
> > >  #include <dm.h>
> > >  #include <serial.h>
> > >  #include <watchdog.h>
> > > @@ -15,11 +16,14 @@
> > >  #include <xen/events.h>
> > >  
> > >  #include <xen/interface/sched.h>
> > > +#include <xen/interface/xen.h>
> > >  #include <xen/interface/hvm/hvm_op.h>
> > >  #include <xen/interface/hvm/params.h>
> > >  #include <xen/interface/io/console.h>
> > >  #include <xen/interface/io/ring.h>
> > >  
> > > +#include <asm/xen/hypercall.h>
> > > +
> > >  DECLARE_GLOBAL_DATA_PTR;
> > >  
> > >  u32 console_evtchn;
> > > @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> > >  	.flags			= DM_FLAG_PRE_RELOC,
> > >  };
> > >  
> > > +#if defined(CONFIG_DEBUG_UART_XEN)
> > > +static inline void _debug_uart_init(void) {}
> > > +
> > > +static inline void _debug_uart_putc(int c)
> > > +{
> > > +#if CONFIG_IS_ENABLED(ARM)
> > > +	xen_debug_putc(c);
> > > +#else
> > > +	/* the type cast should work on LE only */
> > > +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> > 
> > An error occurs during compilation:
> > drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
> > this
> > function); did you mean ?c??
> >         HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> 
> Ah, yes. You're now using x86, right?
> 
> So what happens if you have made the fix above?
> Does it work in your environment?
> (I have confirmed that HYPERVISOR_console_io version works on
> arm(64).)
> 

Sorry, I forgot to write in the last letter the question:
Why can't we simply use HYPERVISOR_console_io(CONSOLEIO_write, 1, (char
*)&ch); for both ARM and Xen?

Regards,
Anastasiia

> Thanks,
> -Takahiro Akashi
> 
> 
> > > +#endif
> > > +}
> > > +
> > > +DEBUG_UART_FUNCS
> > > +
> > > +#endif
> > 
> > Regards,
> > Anastasiia

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

* [PATCH 1/4] serial: serial_xen: print U-Boot banner and others
  2020-10-22  9:49     ` takahiro.akashi at linaro.org
@ 2020-10-23  8:58       ` Anastasiia Lukianenko
  0 siblings, 0 replies; 35+ messages in thread
From: Anastasiia Lukianenko @ 2020-10-23  8:58 UTC (permalink / raw)
  To: u-boot

Hello,

On Thu, 2020-10-22 at 18:49 +0900, takahiro.akashi at linaro.org wrote:
> On Thu, Oct 22, 2020 at 09:18:02AM +0000, Anastasiia Lukianenko
> wrote:
> > Hi,
> > 
> > On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> > > At present, DM_FLAG_PRE_RELOC is set only if !OF_CONTROL.
> > > It doesn't make sense for this para-virtualized driver.
> > > 
> > > With this patch applied, you will be able to see early boot
> > > messages:
> > > 
> > > U-Boot 2020.10-00001-ge442e71a6c52-dirty (Oct 15 2020 - 11:02:25
> > > +0900)
> > > xenguest
> > > 
> > > Xen virtual CPU
> > > Model: XENVM-4.15
> > > DRAM:  128 MiB
> > > PVBLOCK:
> > > (XEN) gnttab_mark_dirty not implemented yet
> > > pvblock: 0
> > > In:    hypervisor
> > > Out:   hypervisor
> > > Err:   hypervisor
> > > xenguest#
> > > 
> > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > ---
> > >  drivers/serial/serial_xen.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/drivers/serial/serial_xen.c
> > > b/drivers/serial/serial_xen.c
> > > index ba6504b94796..ed191829f059 100644
> > > --- a/drivers/serial/serial_xen.c
> > > +++ b/drivers/serial/serial_xen.c
> > > @@ -175,8 +175,6 @@ U_BOOT_DRIVER(serial_xen) = {
> > >  	.priv_auto_alloc_size	= sizeof(struct xen_uart_priv),
> > >  	.probe			= xen_serial_probe,
> > >  	.ops			= &xen_serial_ops,
> > > -#if !CONFIG_IS_ENABLED(OF_CONTROL)
> > >  	.flags			= DM_FLAG_PRE_RELOC,
> > > -#endif
> > >  };
> > >  
> > 
> > I applied this patch and unfortunately on ARM there were no logs. I
> > think this series should be improved a little.
> 
> I will check.
> Please tell me
>  - the board that you're using
>  - the version of Xen
>    (and .config)
> 
Board is based on imx8qm
Xen version 4.13.0
.config:
#
# Automatically generated file; DO NOT EDIT.
# U-Boot 2020.10 Configuration
#

#
# Compiler: aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
7.5.0
#
CONFIG_CREATE_ARCH_SYMLINK=y
# CONFIG_ARC is not set
CONFIG_ARM=y
# CONFIG_M68K is not set
# CONFIG_MICROBLAZE is not set
# CONFIG_MIPS is not set
# CONFIG_NDS32 is not set
# CONFIG_NIOS2 is not set
# CONFIG_PPC is not set
# CONFIG_RISCV is not set
# CONFIG_SANDBOX is not set
# CONFIG_SH is not set
# CONFIG_X86 is not set
# CONFIG_XTENSA is not set
CONFIG_SYS_ARCH="arm"
CONFIG_SYS_CPU="armv8"
CONFIG_SYS_VENDOR="xen"
CONFIG_SYS_BOARD="xenguest_arm64"
CONFIG_SYS_CONFIG_NAME="xenguest_arm64"
# CONFIG_SYS_ICACHE_OFF is not set
# CONFIG_SYS_DCACHE_OFF is not set

#
# ARM architecture
#
CONFIG_ARM64=y
CONFIG_POSITION_INDEPENDENT=y
CONFIG_INIT_SP_RELATIVE=y
CONFIG_SYS_INIT_SP_BSS_OFFSET=524288
CONFIG_LINUX_KERNEL_IMAGE_HEADER=y
# CONFIG_GIC_V3_ITS is not set
CONFIG_STATIC_RELA=y
CONFIG_DMA_ADDR_T_64BIT=y
CONFIG_ARM_ASM_UNIFIED=y
# CONFIG_SYS_ARM_CACHE_CP15 is not set
# CONFIG_SYS_ARM_MMU is not set
# CONFIG_SYS_ARM_MPU is not set
CONFIG_SYS_ARM_ARCH=8
CONFIG_SYS_CACHE_SHIFT_6=y
CONFIG_SYS_CACHELINE_SIZE=64
CONFIG_SYS_ARM_CACHE_WRITEBACK=y
# CONFIG_SYS_ARM_CACHE_WRITETHROUGH is not set
# CONFIG_SYS_ARM_CACHE_WRITEALLOC is not set
# CONFIG_ARCH_CPU_INIT is not set
CONFIG_SYS_ARCH_TIMER=y
CONFIG_ARM_SMCCC=y
# CONFIG_SEMIHOSTING is not set
# CONFIG_SYS_L2CACHE_OFF is not set
# CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK is not set
CONFIG_ARM64_SUPPORT_AARCH32=y
# CONFIG_ARCH_AT91 is not set
# CONFIG_TARGET_EDB93XX is not set
# CONFIG_TARGET_ASPENITE is not set
# CONFIG_TARGET_GPLUGD is not set
# CONFIG_ARCH_DAVINCI is not set
# CONFIG_ARCH_KIRKWOOD is not set
# CONFIG_ARCH_MVEBU is not set
# CONFIG_TARGET_APF27 is not set
# CONFIG_ARCH_ORION5X is not set
# CONFIG_TARGET_SPEAR300 is not set
# CONFIG_TARGET_SPEAR310 is not set
# CONFIG_TARGET_SPEAR320 is not set
# CONFIG_TARGET_SPEAR600 is not set
# CONFIG_TARGET_STV0991 is not set
# CONFIG_TARGET_X600 is not set
# CONFIG_TARGET_FLEA3 is not set
# CONFIG_TARGET_MX35PDK is not set
# CONFIG_ARCH_BCM283X is not set
# CONFIG_ARCH_BCM63158 is not set
# CONFIG_ARCH_BCM68360 is not set
# CONFIG_ARCH_BCM6858 is not set
# CONFIG_TARGET_VEXPRESS_CA15_TC2 is not set
# CONFIG_ARCH_BCMSTB is not set
# CONFIG_TARGET_VEXPRESS_CA5X2 is not set
# CONFIG_TARGET_VEXPRESS_CA9X4 is not set
# CONFIG_TARGET_BCM23550_W1D is not set
# CONFIG_TARGET_BCM28155_AP is not set
# CONFIG_TARGET_BCMCYGNUS is not set
# CONFIG_TARGET_BCMNSP is not set
# CONFIG_TARGET_BCMNS2 is not set
# CONFIG_TARGET_BCMNS3 is not set
# CONFIG_ARCH_EXYNOS is not set
# CONFIG_ARCH_S5PC1XX is not set
# CONFIG_ARCH_HIGHBANK is not set
# CONFIG_ARCH_INTEGRATOR is not set
# CONFIG_ARCH_IPQ40XX is not set
# CONFIG_ARCH_KEYSTONE is not set
# CONFIG_ARCH_K3 is not set
# CONFIG_ARCH_OMAP2PLUS is not set
# CONFIG_ARCH_MESON is not set
# CONFIG_ARCH_MEDIATEK is not set
# CONFIG_ARCH_LPC32XX is not set
# CONFIG_ARCH_IMX8 is not set
# CONFIG_ARCH_IMX8M is not set
# CONFIG_ARCH_IMXRT is not set
# CONFIG_ARCH_MX23 is not set
# CONFIG_ARCH_MX25 is not set
# CONFIG_ARCH_MX28 is not set
# CONFIG_ARCH_MX31 is not set
# CONFIG_ARCH_MX7ULP is not set
# CONFIG_ARCH_MX7 is not set
# CONFIG_ARCH_MX6 is not set
CONFIG_SPL_LDSCRIPT="arch/arm/cpu/armv8/u-boot-spl.lds"
# CONFIG_ARCH_MX5 is not set
# CONFIG_ARCH_NEXELL is not set
# CONFIG_ARCH_OWL is not set
# CONFIG_ARCH_QEMU is not set
# CONFIG_ARCH_RMOBILE is not set
# CONFIG_TARGET_S32V234EVB is not set
# CONFIG_ARCH_SNAPDRAGON is not set
# CONFIG_ARCH_SOCFPGA is not set
# CONFIG_ARCH_SUNXI is not set
# CONFIG_ARCH_U8500 is not set
# CONFIG_ARCH_VERSAL is not set
# CONFIG_ARCH_VF610 is not set
# CONFIG_ARCH_ZYNQ is not set
# CONFIG_ARCH_ZYNQMP_R5 is not set
# CONFIG_ARCH_ZYNQMP is not set
# CONFIG_ARCH_TEGRA is not set
# CONFIG_TARGET_VEXPRESS64_AEMV8A is not set
# CONFIG_TARGET_VEXPRESS64_BASE_FVP is not set
# CONFIG_TARGET_VEXPRESS64_JUNO is not set
# CONFIG_TARGET_TOTAL_COMPUTE is not set
# CONFIG_TARGET_LS2080A_EMU is not set
# CONFIG_TARGET_LS2080A_SIMU is not set
# CONFIG_TARGET_LS1088AQDS is not set
# CONFIG_TARGET_LS2080AQDS is not set
# CONFIG_TARGET_LS2080ARDB is not set
# CONFIG_TARGET_LS2081ARDB is not set
# CONFIG_TARGET_LX2160ARDB is not set
# CONFIG_TARGET_LX2160AQDS is not set
# CONFIG_TARGET_HIKEY is not set
# CONFIG_TARGET_HIKEY960 is not set
# CONFIG_TARGET_POPLAR is not set
# CONFIG_TARGET_LS1012AQDS is not set
# CONFIG_TARGET_LS1012ARDB is not set
# CONFIG_TARGET_LS1012A2G5RDB is not set
# CONFIG_TARGET_LS1012AFRWY is not set
# CONFIG_TARGET_LS1012AFRDM is not set
# CONFIG_TARGET_LS1028AQDS is not set
# CONFIG_TARGET_LS1028ARDB is not set
# CONFIG_TARGET_LS1088ARDB is not set
# CONFIG_TARGET_LS1021AQDS is not set
# CONFIG_TARGET_LS1021ATWR is not set
# CONFIG_TARGET_LS1021ATSN is not set
# CONFIG_TARGET_LS1021AIOT is not set
# CONFIG_TARGET_LS1043AQDS is not set
# CONFIG_TARGET_LS1043ARDB is not set
# CONFIG_TARGET_LS1046AQDS is not set
# CONFIG_TARGET_LS1046ARDB is not set
# CONFIG_TARGET_LS1046AFRWY is not set
# CONFIG_TARGET_COLIBRI_PXA270 is not set
# CONFIG_ARCH_UNIPHIER is not set
# CONFIG_ARCH_STM32 is not set
# CONFIG_ARCH_STI is not set
# CONFIG_ARCH_STM32MP is not set
# CONFIG_ARCH_ROCKCHIP is not set
# CONFIG_ARCH_OCTEONTX is not set
# CONFIG_ARCH_OCTEONTX2 is not set
# CONFIG_TARGET_THUNDERX_88XX is not set
# CONFIG_ARCH_ASPEED is not set
# CONFIG_TARGET_DURIAN is not set
# CONFIG_TARGET_PRESIDIO_ASIC is not set
CONFIG_TARGET_XENGUEST_ARM64=y
CONFIG_SYS_TEXT_BASE=0x40080000
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_NR_DRAM_BANKS=4
CONFIG_ENV_SIZE=0x1f000
# CONFIG_DM_GPIO is not set
CONFIG_ERR_PTR_OFFSET=0x0
CONFIG_BOOTSTAGE_STASH_ADDR=0
# CONFIG_DEBUG_UART_BOARD_INIT is not set
CONFIG_IDENT_STRING=" xenguest"
# CONFIG_ARMV8_MULTIENTRY is not set
# CONFIG_ARMV8_SET_SMPEN is not set

#
# ARMv8 secure monitor firmware
#
# CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT is not set
# CONFIG_SPL_ARMV8_SEC_FIRMWARE_SUPPORT is not set
# CONFIG_SPL_RECOVER_DATA_SECTION is not set
CONFIG_PSCI_RESET=y
# CONFIG_ARMV8_PSCI is not set
# CONFIG_ARMV8_EA_EL3_FIRST is not set
# CONFIG_CMD_DEKBLOB is not set
# CONFIG_CMD_HDMIDETECT is not set
CONFIG_IMX_DCD_ADDR=0x00910000

#
# ARM debug
#
CONFIG_BUILD_TARGET=""
CONFIG_DEFAULT_DEVICE_TREE=""
CONFIG_DEBUG_UART=y
# CONFIG_AHCI is not set
# CONFIG_OF_BOARD_FIXUP is not set

#
# General setup
#
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
# CONFIG_OPTIMIZE_INLINING is not set
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_XEN=y
# CONFIG_DISTRO_DEFAULTS is not set
# CONFIG_ENV_VARS_UBOOT_CONFIG is not set
# CONFIG_SYS_BOOT_GET_CMDLINE is not set
# CONFIG_SYS_BOOT_GET_KBD is not set
CONFIG_SYS_MALLOC_F=y
CONFIG_EXPERT=y
CONFIG_SYS_MALLOC_CLEAR_ON_INIT=y
# CONFIG_SYS_MALLOC_DEFAULT_TO_INIT is not set
# CONFIG_TOOLS_DEBUG is not set
CONFIG_PHYS_64BIT=y
# CONFIG_SYS_CUSTOM_LDSCRIPT is not set
CONFIG_PLATFORM_ELFENTRY="_start"
CONFIG_STACK_SIZE=0x1000000
CONFIG_SYS_SRAM_BASE=0x0
CONFIG_SYS_SRAM_SIZE=0x0
# CONFIG_EXAMPLES is not set

#
# API
#
# CONFIG_API is not set

#
# Boot options
#

#
# Boot images
#
# CONFIG_ANDROID_BOOT_IMAGE is not set
# CONFIG_FIT is not set
CONFIG_LEGACY_IMAGE_FORMAT=y
# CONFIG_SUPPORT_RAW_INITRD is not set
# CONFIG_OF_BOARD_SETUP is not set
# CONFIG_OF_SYSTEM_SETUP is not set
# CONFIG_OF_STDOUT_VIA_ALIAS is not set
CONFIG_SYS_EXTRA_OPTIONS=""
CONFIG_HAVE_SYS_TEXT_BASE=y
CONFIG_ARCH_FIXUP_FDT_MEMORY=y

#
# Boot timing
#
# CONFIG_BOOTSTAGE is not set
CONFIG_BOOTSTAGE_RECORD_COUNT=30
CONFIG_SPL_BOOTSTAGE_RECORD_COUNT=5
CONFIG_TPL_BOOTSTAGE_RECORD_COUNT=5
CONFIG_BOOTSTAGE_STASH_SIZE=0x1000
# CONFIG_SHOW_BOOT_PROGRESS is not set

#
# Boot media
#
# CONFIG_NAND_BOOT is not set
# CONFIG_ONENAND_BOOT is not set
# CONFIG_QSPI_BOOT is not set
# CONFIG_SATA_BOOT is not set
# CONFIG_SD_BOOT is not set
# CONFIG_SPI_BOOT is not set

#
# Autoboot options
#
CONFIG_AUTOBOOT=y
CONFIG_BOOTDELAY=10
# CONFIG_AUTOBOOT_KEYED is not set
# CONFIG_AUTOBOOT_USE_MENUKEY is not set
# CONFIG_USE_BOOTARGS is not set
# CONFIG_USE_BOOTCOMMAND is not set
# CONFIG_USE_PREBOOT is not set
CONFIG_DEFAULT_FDT_FILE=""

#
# Console
#
# CONFIG_CONSOLE_RECORD is not set
# CONFIG_DISABLE_CONSOLE is not set
CONFIG_LOGLEVEL=4
CONFIG_SPL_LOGLEVEL=4
CONFIG_TPL_LOGLEVEL=4
# CONFIG_SILENT_CONSOLE is not set
# CONFIG_PRE_CONSOLE_BUFFER is not set
# CONFIG_CONSOLE_MUX is not set
# CONFIG_SYS_CONSOLE_IS_IN_ENV is not set
# CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE is not set
# CONFIG_SYS_CONSOLE_ENV_OVERWRITE is not set
# CONFIG_SYS_CONSOLE_INFO_QUIET is not set
# CONFIG_SYS_STDIO_DEREGISTER is not set
# CONFIG_SPL_SYS_STDIO_DEREGISTER is not set
# CONFIG_SYS_DEVICE_NULLDEV is not set

#
# Logging
#
# CONFIG_LOG is not set

#
# Init options
#
# CONFIG_BOARD_TYPES is not set
CONFIG_DISPLAY_CPUINFO=y
CONFIG_DISPLAY_BOARDINFO=y
# CONFIG_DISPLAY_BOARDINFO_LATE is not set

#
# Start-up hooks
#
# CONFIG_ARCH_EARLY_INIT_R is not set
# CONFIG_ARCH_MISC_INIT is not set
# CONFIG_BOARD_EARLY_INIT_F is not set
# CONFIG_BOARD_EARLY_INIT_R is not set
# CONFIG_BOARD_LATE_INIT is not set
# CONFIG_LAST_STAGE_INIT is not set
# CONFIG_MISC_INIT_R is not set

#
# Security support
#

#
# Update support
#
# CONFIG_ANDROID_AB is not set

#
# Blob list
#
# CONFIG_BLOBLIST is not set

#
# SPL / TPL
#
CONFIG_SPL_SYS_STACK_F_CHECK_BYTE=0xaa
# CONFIG_SPL_SYS_REPORT_STACK_F_USAGE is not set

#
# PowerPC and LayerScape SPL Boot options
#

#
# Command line interface
#
CONFIG_CMDLINE=y
# CONFIG_HUSH_PARSER is not set
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_SYS_LONGHELP=y
CONFIG_SYS_PROMPT="xenguest# "
CONFIG_SYS_XTRACE="y"

#
# Commands
#

#
# Info commands
#
# CONFIG_CMD_ACPI is not set
# CONFIG_CMD_BDI is not set
# CONFIG_CMD_CONFIG is not set
CONFIG_CMD_CONSOLE=y
# CONFIG_CMD_CPU is not set
# CONFIG_CMD_LICENSE is not set
# CONFIG_CMD_PMC is not set

#
# Boot commands
#
# CONFIG_CMD_BOOTD is not set
CONFIG_CMD_BOOTM=y
# CONFIG_CMD_BOOTZ is not set
CONFIG_CMD_BOOTI=y
CONFIG_BOOTM_LINUX=y
CONFIG_BOOTM_NETBSD=y
# CONFIG_BOOTM_OPENRTOS is not set
# CONFIG_BOOTM_OSE is not set
CONFIG_BOOTM_PLAN9=y
CONFIG_BOOTM_RTEMS=y
CONFIG_BOOTM_VXWORKS=y
# CONFIG_CMD_BOOTMENU is not set
# CONFIG_CMD_ADTIMG is not set
# CONFIG_CMD_ELF is not set
CONFIG_CMD_FDT=y
# CONFIG_CMD_GO is not set
CONFIG_CMD_RUN=y
# CONFIG_CMD_IMI is not set
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_XIMG is not set
# CONFIG_CMD_THOR_DOWNLOAD is not set
# CONFIG_CMD_ZBOOT is not set

#
# Environment commands
#
# CONFIG_CMD_ASKENV is not set
# CONFIG_CMD_EXPORTENV is not set
# CONFIG_CMD_IMPORTENV is not set
# CONFIG_CMD_EDITENV is not set
# CONFIG_CMD_GREPENV is not set
# CONFIG_CMD_SAVEENV is not set
# CONFIG_CMD_ENV_EXISTS is not set
# CONFIG_CMD_ENV_CALLBACK is not set
# CONFIG_CMD_ENV_FLAGS is not set
# CONFIG_CMD_NVEDIT_INFO is not set
# CONFIG_CMD_NVEDIT_LOAD is not set
# CONFIG_CMD_NVEDIT_SELECT is not set

#
# Memory commands
#
# CONFIG_CMD_BINOP is not set
# CONFIG_CMD_BLOBLIST is not set
# CONFIG_CMD_CRC32 is not set
# CONFIG_CMD_EEPROM is not set
# CONFIG_LOOPW is not set
# CONFIG_CMD_MD5SUM is not set
# CONFIG_CMD_MEMINFO is not set
CONFIG_CMD_MEMORY=y
# CONFIG_CMD_MEM_SEARCH is not set
# CONFIG_CMD_MX_CYCLIC is not set
# CONFIG_CMD_MEMTEST is not set
# CONFIG_CMD_SHA1SUM is not set
# CONFIG_CMD_STRINGS is not set

#
# Compression commands
#
# CONFIG_CMD_LZMADEC is not set
CONFIG_CMD_UNLZ4=y
# CONFIG_CMD_UNZIP is not set
# CONFIG_CMD_ZIP is not set

#
# Device access commands
#
# CONFIG_CMD_ARMFLASH is not set
# CONFIG_CMD_BIND is not set
# CONFIG_CMD_CLK is not set
# CONFIG_CMD_DEMO is not set
# CONFIG_CMD_DFU is not set
# CONFIG_CMD_DM is not set
# CONFIG_CMD_FPGAD is not set
# CONFIG_CMD_FUSE is not set
# CONFIG_CMD_GPIO is not set
# CONFIG_CMD_GPT is not set
# CONFIG_RANDOM_UUID is not set
# CONFIG_CMD_IDE is not set
# CONFIG_CMD_IO is not set
# CONFIG_CMD_IOTRACE is not set
# CONFIG_CMD_I2C is not set
# CONFIG_CMD_LOADB is not set
# CONFIG_CMD_LOADS is not set
# CONFIG_CMD_LSBLK is not set
# CONFIG_CMD_MMC is not set
# CONFIG_CMD_CLONE is not set
# CONFIG_CMD_OSD is not set
# CONFIG_CMD_PART is not set
# CONFIG_CMD_PCI is not set
# CONFIG_CMD_PINMUX is not set
# CONFIG_CMD_POWEROFF is not set
# CONFIG_CMD_READ is not set
# CONFIG_CMD_SATA is not set
# CONFIG_CMD_SAVES is not set
# CONFIG_CMD_SCSI is not set
# CONFIG_CMD_SDRAM is not set
# CONFIG_CMD_TSI148 is not set
# CONFIG_CMD_UNIVERSE is not set
# CONFIG_CMD_USB is not set
# CONFIG_CMD_USB_SDP is not set
# CONFIG_CMD_USB_MASS_STORAGE is not set
CONFIG_CMD_PVBLOCK=y

#
# Shell scripting commands
#
# CONFIG_CMD_ECHO is not set
# CONFIG_CMD_ITEST is not set
# CONFIG_CMD_SOURCE is not set
# CONFIG_CMD_SETEXPR is not set

#
# Android support commands
#
# CONFIG_CMD_NET is not set
# CONFIG_CMD_ETHSW is not set
# CONFIG_CMD_PXE is not set
# CONFIG_CMD_WOL is not set

#
# Misc commands
#
# CONFIG_CMD_BSP is not set
CONFIG_CMD_BLOCK_CACHE=y
# CONFIG_CMD_CACHE is not set
# CONFIG_CMD_CONITRACE is not set
# CONFIG_CMD_EXCEPTION is not set
# CONFIG_CMD_DATE is not set
# CONFIG_CMD_TIME is not set
# CONFIG_CMD_GETTIME is not set
# CONFIG_CMD_MISC is not set
# CONFIG_MP is not set
# CONFIG_CMD_TIMER is not set
# CONFIG_CMD_SYSBOOT is not set
# CONFIG_CMD_QFW is not set
# CONFIG_CMD_PSTORE is not set
# CONFIG_CMD_TERMINAL is not set
# CONFIG_CMD_UUID is not set

#
# TI specific command line interface
#
# CONFIG_CMD_DDR3 is not set

#
# Power commands
#

#
# Security commands
#
# CONFIG_CMD_AES is not set
# CONFIG_CMD_BLOB is not set
# CONFIG_CMD_HASH is not set
# CONFIG_CMD_HVC is not set
# CONFIG_CMD_SMC is not set

#
# Firmware commands
#

#
# Filesystem commands
#
# CONFIG_CMD_BTRFS is not set
# CONFIG_CMD_EXT2 is not set
CONFIG_CMD_EXT4=y
# CONFIG_CMD_EXT4_WRITE is not set
CONFIG_CMD_FAT=y
# CONFIG_CMD_SQUASHFS is not set
# CONFIG_CMD_FS_GENERIC is not set
# CONFIG_CMD_FS_UUID is not set
# CONFIG_CMD_JFFS2 is not set
# CONFIG_CMD_REISER is not set
# CONFIG_CMD_ZFS is not set

#
# Debug commands
#
# CONFIG_CMD_BEDBUG is not set
# CONFIG_CMD_DIAG is not set
# CONFIG_CMD_LOG is not set
# CONFIG_CMD_TRACE is not set
# CONFIG_CMD_UBI is not set

#
# Partition Types
#
CONFIG_PARTITIONS=y
# CONFIG_MAC_PARTITION is not set
CONFIG_DOS_PARTITION=y
# CONFIG_ISO_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_EFI_PARTITION is not set
# CONFIG_PARTITION_UUIDS is not set
CONFIG_SUPPORT_OF_CONTROL=y
CONFIG_DTC=y

#
# Device Tree Control
#
CONFIG_OF_CONTROL=y
# CONFIG_OF_LIVE is not set
# CONFIG_OF_SEPARATE is not set
# CONFIG_OF_EMBED is not set
CONFIG_OF_BOARD=y
# CONFIG_OF_PRIOR_STAGE is not set
# CONFIG_MULTI_DTB_FIT is not set
# CONFIG_OF_DTB_PROPS_REMOVE is not set

#
# Environment
#
CONFIG_ENV_SUPPORT=y
# CONFIG_ENV_OVERWRITE is not set
CONFIG_ENV_IS_NOWHERE=y
# CONFIG_ENV_IS_IN_EEPROM is not set
# CONFIG_ENV_IS_IN_FAT is not set
# CONFIG_ENV_IS_IN_EXT4 is not set
# CONFIG_ENV_IS_IN_FLASH is not set
# CONFIG_ENV_IS_IN_NAND is not set
# CONFIG_ENV_IS_IN_NVRAM is not set
# CONFIG_ENV_IS_IN_ONENAND is not set
# CONFIG_ENV_IS_IN_REMOTE is not set
# CONFIG_SYS_RELOC_GD_ENV_ADDR is not set
# CONFIG_USE_DEFAULT_ENV_FILE is not set
# CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is not set
# CONFIG_ENV_APPEND is not set
# CONFIG_ENV_WRITEABLE_LIST is not set
# CONFIG_ENV_ACCESS_IGNORE_FORCE is not set
# CONFIG_VERSION_VARIABLE is not set
CONFIG_NET=y
# CONFIG_PROT_UDP is not set
# CONFIG_BOOTP_SEND_HOSTNAME is not set
# CONFIG_NET_RANDOM_ETHADDR is not set
# CONFIG_NETCONSOLE is not set
# CONFIG_IP_DEFRAG is not set
CONFIG_TFTP_BLOCKSIZE=1468
CONFIG_TFTP_WINDOWSIZE=1

#
# Device Drivers
#

#
# Generic Driver Options
#
CONFIG_DM=y
CONFIG_DM_WARN=y
# CONFIG_DM_DEBUG is not set
CONFIG_DM_DEVICE_REMOVE=y
CONFIG_DM_STDIO=y
CONFIG_DM_SEQ_ALIAS=y
# CONFIG_REGMAP is not set
# CONFIG_DEVRES is not set
CONFIG_SIMPLE_BUS=y
CONFIG_OF_TRANSLATE=y
# CONFIG_TRANSLATION_OFFSET is not set
CONFIG_DM_DEV_READ_INLINE=y
# CONFIG_ACPIGEN is not set
# CONFIG_BOUNCE_BUFFER is not set
# CONFIG_ADC is not set
# CONFIG_ADC_EXYNOS is not set
# CONFIG_ADC_SANDBOX is not set
# CONFIG_SARADC_MESON is not set
# CONFIG_SARADC_ROCKCHIP is not set
# CONFIG_SATA is not set
# CONFIG_SCSI_AHCI is not set

#
# SATA/SCSI device support
#
# CONFIG_DWC_AHSATA is not set
# CONFIG_FSL_SATA is not set
# CONFIG_MVSATA_IDE is not set
# CONFIG_SATA_MV is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIL3114 is not set
# CONFIG_AXI is not set

#
# Bus devices
#
CONFIG_BLK=y
CONFIG_HAVE_BLOCK_DEVICE=y
CONFIG_BLOCK_CACHE=y
# CONFIG_IDE is not set
# CONFIG_BOOTCOUNT_LIMIT is not set

#
# Button Support
#
# CONFIG_BUTTON is not set

#
# Cache Controller drivers
#
# CONFIG_CACHE is not set
# CONFIG_L2X0_CACHE is not set
# CONFIG_NCORE_CACHE is not set

#
# Clock
#
# CONFIG_CLK is not set
# CONFIG_CLK_CCF is not set
# CONFIG_CPU is not set

#
# Hardware crypto devices
#
# CONFIG_FSL_CAAM is not set
# CONFIG_SYS_FSL_SEC_BE is not set
# CONFIG_SYS_FSL_SEC_LE is not set

#
# Demo for driver model
#
# CONFIG_DM_DEMO is not set
# CONFIG_BOARD is not set

#
# DFU support
#

#
# DMA Support
#
# CONFIG_DMA is not set
# CONFIG_TI_EDMA3 is not set

#
# Fastboot support
#
# CONFIG_UDP_FUNCTION_FASTBOOT is not set
CONFIG_FIRMWARE=y
# CONFIG_SPL_FIRMWARE is not set
CONFIG_ARM_PSCI_FW=y
# CONFIG_ZYNQMP_FIRMWARE is not set
# CONFIG_SCMI_FIRMWARE is not set

#
# FPGA support
#
# CONFIG_FPGA_ALTERA is not set
# CONFIG_FPGA_SOCFPGA is not set
# CONFIG_FPGA_XILINX is not set

#
# GPIO Support
#
# CONFIG_AT91_GPIO is not set
# CONFIG_DA8XX_GPIO is not set
# CONFIG_INTEL_BROADWELL_GPIO is not set
# CONFIG_IMX_RGPIO2P is not set
# CONFIG_IPROC_GPIO is not set
# CONFIG_LPC32XX_GPIO is not set
# CONFIG_MXC_GPIO is not set
# CONFIG_MXS_GPIO is not set
# CONFIG_CMD_PCA953X is not set
# CONFIG_CMD_TCA642X is not set
# CONFIG_VYBRID_GPIO is not set

#
# Hardware Spinlock Support
#
# CONFIG_DM_HWSPINLOCK is not set

#
# I2C support
#
# CONFIG_DM_I2C is not set
# CONFIG_SYS_I2C_DW is not set
# CONFIG_SYS_I2C_IMX_LPI2C is not set
# CONFIG_SYS_I2C_MXC is not set
CONFIG_INPUT=y
# CONFIG_DM_KEYBOARD is not set
# CONFIG_CROS_EC_KEYB is not set
# CONFIG_TEGRA_KEYBOARD is not set
# CONFIG_TWL4030_INPUT is not set

#
# LED Support
#
# CONFIG_LED is not set
# CONFIG_LED_STATUS is not set

#
# Mailbox Controller Support
#
# CONFIG_DM_MAILBOX is not set

#
# Memory Controller drivers
#

#
# Multifunction device drivers
#
# CONFIG_MISC is not set
# CONFIG_CROS_EC is not set
# CONFIG_DS4510 is not set
# CONFIG_FSL_SEC_MON is not set
# CONFIG_NUVOTON_NCT6102D is not set
# CONFIG_PWRSEQ is not set
# CONFIG_PCA9551_LED is not set
# CONFIG_TWL4030_LED is not set
# CONFIG_WINBOND_W83627 is not set
# CONFIG_FS_LOADER is not set

#
# MMC Host controller Support
#
# CONFIG_MMC is not set
# CONFIG_MMC_BROKEN_CD is not set
# CONFIG_DM_MMC is not set
# CONFIG_FSL_ESDHC is not set
# CONFIG_FSL_ESDHC_IMX is not set

#
# MTD Support
#
# CONFIG_MTD is not set
# CONFIG_DM_MTD is not set
# CONFIG_MTD_NOR_FLASH is not set
# CONFIG_FLASH_CFI_DRIVER is not set
# CONFIG_MTD_RAW_NAND is not set

#
# SPI Flash Support
#
# CONFIG_SPI_FLASH is not set

#
# UBI support
#
# CONFIG_UBI_SILENCE_MSG is not set
# CONFIG_MTD_UBI is not set
# CONFIG_BITBANGMII is not set
# CONFIG_MV88E6352_SWITCH is not set
# CONFIG_PHYLIB is not set
# CONFIG_FSL_PFE is not set
# CONFIG_DM_ETH is not set
# CONFIG_DM_ETH_PHY is not set
# CONFIG_NETDEVICES is not set
# CONFIG_PCI is not set

#
# PCI Endpoint
#
# CONFIG_PCI_ENDPOINT is not set
# CONFIG_X86_PCH7 is not set
# CONFIG_X86_PCH9 is not set

#
# PHY Subsystem
#
# CONFIG_PHY is not set

#
# Rockchip PHY driver
#
# CONFIG_MVEBU_COMPHY_SUPPORT is not set

#
# Pin controllers
#
# CONFIG_PINCTRL is not set

#
# Power
#
# CONFIG_ACPI_PMC is not set
# CONFIG_SPL_ACPI_PMC is not set
# CONFIG_TPL_ACPI_PMC is not set

#
# Power Domain Support
#
# CONFIG_POWER_DOMAIN is not set
# CONFIG_DM_PMIC is not set
# CONFIG_PMIC_AS3722 is not set
# CONFIG_POWER_MC34VR500 is not set
# CONFIG_DM_REGULATOR is not set
# CONFIG_POWER_MT6323 is not set
# CONFIG_DM_PWM is not set
# CONFIG_PWM_IMX is not set
# CONFIG_PWM_SANDBOX is not set
# CONFIG_U_QE is not set
# CONFIG_RAM is not set

#
# Remote Processor drivers
#

#
# Reset Controller Support
#
# CONFIG_DM_RESET is not set
# CONFIG_RESET_SCMI is not set
# CONFIG_DM_RNG is not set

#
# Real Time Clock
#
# CONFIG_DM_RTC is not set
# CONFIG_RTC_ENABLE_32KHZ_OUTPUT is not set
# CONFIG_RTC_RX8025 is not set
# CONFIG_RTC_PL031 is not set
# CONFIG_RTC_S35392A is not set
# CONFIG_RTC_MC146818 is not set
# CONFIG_RTC_M41T62 is not set
# CONFIG_SCSI is not set
# CONFIG_DM_SCSI is not set

#
# Serial drivers
#
CONFIG_BAUDRATE=115200
# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
# CONFIG_SPECIFY_CONSOLE_INDEX is not set
CONFIG_SERIAL_PRESENT=y
CONFIG_DM_SERIAL=y
# CONFIG_SERIAL_RX_BUFFER is not set
# CONFIG_SERIAL_SEARCH_ALL is not set
CONFIG_DEBUG_UART_XEN=y
# CONFIG_DEBUG_UART_ANNOUNCE is not set
# CONFIG_DEBUG_UART_SKIP_INIT is not set
# CONFIG_ALTERA_JTAG_UART is not set
# CONFIG_ALTERA_UART is not set
# CONFIG_ARC_SERIAL is not set
# CONFIG_ARM_DCC is not set
# CONFIG_ATMEL_USART is not set
# CONFIG_BCM6345_SERIAL is not set
# CONFIG_COREBOOT_SERIAL is not set
# CONFIG_CORTINA_UART is not set
# CONFIG_FSL_LINFLEXUART is not set
# CONFIG_FSL_LPUART is not set
# CONFIG_MVEBU_A3700_UART is not set
# CONFIG_MCFUART is not set
# CONFIG_NULLDEV_SERIAL is not set
# CONFIG_SYS_NS16550 is not set
# CONFIG_NS16550_DYNAMIC is not set
# CONFIG_PL01X_SERIAL is not set
# CONFIG_XILINX_UARTLITE is not set
# CONFIG_MSM_SERIAL is not set
# CONFIG_OMAP_SERIAL is not set
# CONFIG_PXA_SERIAL is not set
# CONFIG_SIFIVE_SERIAL is not set
# CONFIG_ZYNQ_SERIAL is not set
# CONFIG_MTK_SERIAL is not set
CONFIG_XEN_SERIAL=y
# CONFIG_SMEM is not set

#
# Sound support
#
# CONFIG_SOUND is not set

#
# SOC (System On Chip) specific Drivers
#
# CONFIG_SOC_DEVICE is not set
# CONFIG_SOC_TI is not set
# CONFIG_SPI is not set

#
# SPMI support
#
# CONFIG_SPMI is not set

#
# System reset device drivers
#
# CONFIG_SYSRESET is not set
# CONFIG_SYSRESET_SYSCON is not set
# CONFIG_SYSRESET_WATCHDOG is not set
# CONFIG_SYSRESET_RESETCTL is not set
# CONFIG_SYSRESET_MPC83XX is not set
# CONFIG_TEE is not set
# CONFIG_OPTEE is not set
# CONFIG_DM_THERMAL is not set

#
# Timer Support
#
# CONFIG_TIMER is not set

#
# TPM support
#
# CONFIG_USB is not set

#
# UFS Host Controller Support
#
# CONFIG_TI_J721E_UFS is not set

#
# Graphics support
#
# CONFIG_DM_VIDEO is not set
# CONFIG_SYS_WHITE_ON_BLACK is not set
# CONFIG_NO_FB_CLEAR is not set

#
# TrueType Fonts
#
# CONFIG_VIDEO_VESA is not set
# CONFIG_VIDEO_LCD_ANX9804 is not set
# CONFIG_VIDEO_LCD_SSD2828 is not set
# CONFIG_VIDEO_MVEBU is not set
# CONFIG_I2C_EDID is not set
# CONFIG_DISPLAY is not set
# CONFIG_ATMEL_HLCD is not set
# CONFIG_AM335X_LCD is not set
# CONFIG_VIDEO_TEGRA20 is not set
# CONFIG_VIDEO_BRIDGE is not set
# CONFIG_VIDEO is not set
# CONFIG_LCD is not set
# CONFIG_VIDEO_SIMPLE is not set
# CONFIG_VIDEO_DT_SIMPLEFB is not set
# CONFIG_OSD is not set
# CONFIG_SPLASH_SCREEN is not set

#
# VirtIO Drivers
#
# CONFIG_VIRTIO_MMIO is not set

#
# 1-Wire support
#
# CONFIG_W1 is not set

#
# 1-wire EEPROM support
#
# CONFIG_W1_EEPROM is not set

#
# Watchdog Timer Support
#
# CONFIG_WATCHDOG is not set
CONFIG_WATCHDOG_TIMEOUT_MSECS=60000
# CONFIG_WATCHDOG_RESET_DISABLE is not set
# CONFIG_IMX_WATCHDOG is not set
# CONFIG_ULP_WATCHDOG is not set
# CONFIG_DESIGNWARE_WATCHDOG is not set
# CONFIG_WDT is not set
CONFIG_PVBLOCK=y
# CONFIG_PHYS_TO_BUS is not set

#
# File systems
#
# CONFIG_FS_BTRFS is not set
# CONFIG_FS_CBFS is not set
# CONFIG_SPL_FS_CBFS is not set
CONFIG_FS_EXT4=y
# CONFIG_EXT4_WRITE is not set
CONFIG_FS_FAT=y
# CONFIG_FAT_WRITE is not set
CONFIG_FS_FAT_MAX_CLUSTSIZE=65536
# CONFIG_FS_JFFS2 is not set
# CONFIG_UBIFS_SILENCE_MSG is not set
# CONFIG_FS_CRAMFS is not set
# CONFIG_YAFFS2 is not set
# CONFIG_FS_SQUASHFS is not set

#
# Library routines
#
# CONFIG_ADDR_MAP is not set
# CONFIG_BCH is not set
# CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED is not set
# CONFIG_DYNAMIC_CRC_TABLE is not set
CONFIG_PRINTF=y
CONFIG_SPRINTF=y
CONFIG_SSCANF=y
CONFIG_STRTO=y
CONFIG_SYS_HZ=1000
# CONFIG_PANIC_HANG is not set
CONFIG_REGEX=y
# CONFIG_SPL_TINY_MEMSET is not set
# CONFIG_TPL_TINY_MEMSET is not set
# CONFIG_BITREVERSE is not set
# CONFIG_TRACE is not set
# CONFIG_CMD_DHRYSTONE is not set

#
# Security support
#
# CONFIG_AES is not set
# CONFIG_RSA is not set
# CONFIG_ASYMMETRIC_KEY_TYPE is not set
# CONFIG_TPM is not set

#
# Android Verified Boot
#

#
# Hashing Support
#
# CONFIG_SHA1 is not set
# CONFIG_SHA256 is not set
# CONFIG_SHA512_ALGO is not set
# CONFIG_SHA_HW_ACCEL is not set
# CONFIG_MD5 is not set
# CONFIG_SPL_MD5 is not set

#
# Compression Support
#
CONFIG_LZ4=y
# CONFIG_LZMA is not set
# CONFIG_LZO is not set
CONFIG_GZIP=y
# CONFIG_ZLIB_UNCOMPRESS is not set
# CONFIG_BZIP2 is not set
CONFIG_ZLIB=y
# CONFIG_ZSTD is not set
# CONFIG_SPL_LZ4 is not set
# CONFIG_SPL_LZMA is not set
# CONFIG_SPL_LZO is not set
# CONFIG_SPL_GZIP is not set
# CONFIG_SPL_ZSTD is not set
# CONFIG_ERRNO_STR is not set
# CONFIG_HEXDUMP is not set
CONFIG_OF_LIBFDT=y
CONFIG_OF_LIBFDT_ASSUME_MASK=0
# CONFIG_OF_LIBFDT_OVERLAY is not set
# CONFIG_SPL_OF_LIBFDT is not set
# CONFIG_TPL_OF_LIBFDT is not set

#
# System tables
#
# CONFIG_EFI_LOADER is not set
# CONFIG_TEST_FDTDEC is not set
# CONFIG_UNIT_TEST is not set

#
# Tools options
#
CONFIG_MKIMAGE_DTC_PATH="dtc"

Regards,
Anastasiia

> Thanks,
> -Takahiro Akashi
> 
> > Regards,
> > Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-23  0:31   ` Tom Rini
@ 2020-10-23  9:22     ` Anastasiia Lukianenko
  2020-10-23 12:34       ` Tom Rini
  0 siblings, 1 reply; 35+ messages in thread
From: Anastasiia Lukianenko @ 2020-10-23  9:22 UTC (permalink / raw)
  To: u-boot

Hello,

On Thu, 2020-10-22 at 20:31 -0400, Tom Rini wrote:
> On Thu, Oct 15, 2020 at 01:25:16PM +0900, AKASHI Takahiro wrote:
> 
> > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > This will allow us to see messages even earlier than serial_init().
> > 
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> 
> Applied to u-boot/master, thanks!
> 
Sorry, I thought there was still discussion on the series. May I ask
why it was merged?

Regards,
Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-23  9:22     ` Anastasiia Lukianenko
@ 2020-10-23 12:34       ` Tom Rini
  2020-10-23 13:06         ` Anastasiia Lukianenko
  0 siblings, 1 reply; 35+ messages in thread
From: Tom Rini @ 2020-10-23 12:34 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 23, 2020 at 09:22:20AM +0000, Anastasiia Lukianenko wrote:
> Hello,
> 
> On Thu, 2020-10-22 at 20:31 -0400, Tom Rini wrote:
> > On Thu, Oct 15, 2020 at 01:25:16PM +0900, AKASHI Takahiro wrote:
> > 
> > > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > > This will allow us to see messages even earlier than serial_init().
> > > 
> > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > 
> > Applied to u-boot/master, thanks!
> > 
> Sorry, I thought there was still discussion on the series. May I ask
> why it was merged?

I just missed it, sorry.  Do you want me too revert the series for now
or should i just expect a small follow-up soon?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201023/203f4d5c/attachment.sig>

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-23 12:34       ` Tom Rini
@ 2020-10-23 13:06         ` Anastasiia Lukianenko
  2020-10-23 13:18           ` Tom Rini
  0 siblings, 1 reply; 35+ messages in thread
From: Anastasiia Lukianenko @ 2020-10-23 13:06 UTC (permalink / raw)
  To: u-boot

On Fri, 2020-10-23 at 08:34 -0400, Tom Rini wrote:
> On Fri, Oct 23, 2020 at 09:22:20AM +0000, Anastasiia Lukianenko
> wrote:
> > Hello,
> > 
> > On Thu, 2020-10-22 at 20:31 -0400, Tom Rini wrote:
> > > On Thu, Oct 15, 2020 at 01:25:16PM +0900, AKASHI Takahiro wrote:
> > > 
> > > > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > > > This will allow us to see messages even earlier than
> > > > serial_init().
> > > > 
> > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > 
> > > Applied to u-boot/master, thanks!
> > > 
> > 
> > Sorry, I thought there was still discussion on the series. May I
> > ask
> > why it was merged?
> 
> I just missed it, sorry.  Do you want me too revert the series for
> now
> or should i just expect a small follow-up soon?
> 
I have no strong opinion here: on one hand there are patches which
won't compile for at least x86 which is obviously not good. On the
other hand we are discussing the rest of the patches as I was not able
to run them on my ARM board, so it either can be that I miss something
and the pacthes are ok or it can also be that the pacthes need to be
re-worked.
So, best was not to have them in the tree yet...

Regards,
Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-23 13:06         ` Anastasiia Lukianenko
@ 2020-10-23 13:18           ` Tom Rini
  0 siblings, 0 replies; 35+ messages in thread
From: Tom Rini @ 2020-10-23 13:18 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 23, 2020 at 01:06:16PM +0000, Anastasiia Lukianenko wrote:
> On Fri, 2020-10-23 at 08:34 -0400, Tom Rini wrote:
> > On Fri, Oct 23, 2020 at 09:22:20AM +0000, Anastasiia Lukianenko
> > wrote:
> > > Hello,
> > > 
> > > On Thu, 2020-10-22 at 20:31 -0400, Tom Rini wrote:
> > > > On Thu, Oct 15, 2020 at 01:25:16PM +0900, AKASHI Takahiro wrote:
> > > > 
> > > > > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > > > > This will allow us to see messages even earlier than
> > > > > serial_init().
> > > > > 
> > > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > > 
> > > > Applied to u-boot/master, thanks!
> > > > 
> > > 
> > > Sorry, I thought there was still discussion on the series. May I
> > > ask
> > > why it was merged?
> > 
> > I just missed it, sorry.  Do you want me too revert the series for
> > now
> > or should i just expect a small follow-up soon?
> > 
> I have no strong opinion here: on one hand there are patches which
> won't compile for at least x86 which is obviously not good. On the
> other hand we are discussing the rest of the patches as I was not able
> to run them on my ARM board, so it either can be that I miss something
> and the pacthes are ok or it can also be that the pacthes need to be
> re-worked.
> So, best was not to have them in the tree yet...

OK, I've reverted the series.  Sorry for the confusion!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201023/cacf67e2/attachment.sig>

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-23  8:50       ` Anastasiia Lukianenko
@ 2020-10-26  5:58         ` takahiro.akashi at linaro.org
  2020-10-26  6:18           ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 35+ messages in thread
From: takahiro.akashi at linaro.org @ 2020-10-26  5:58 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
> Hello,
> 
> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
> > On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
> > wrote:
> > > Hi,
> > > 
> > > On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> > > > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > > > This will allow us to see messages even earlier than
> > > > serial_init().
> > > > 
> > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > > ---
> > > >  drivers/serial/Kconfig      | 14 +++++++++++---
> > > >  drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> > > >  2 files changed, 31 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > > > index e344677f91f6..536cf0641773 100644
> > > > --- a/drivers/serial/Kconfig
> > > > +++ b/drivers/serial/Kconfig
> > > > @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> > > >  	  driver will be available until the real driver model serial
> > > > is
> > > >  	  running.
> > > >  
> > > > +config DEBUG_UART_XEN
> > > > +	bool "XEN Hypervisor Console"
> > > > +	depends on XEN_SERIAL
> > > > +	help
> > > > +	  Select this to enable a debug UART using the serial_xen
> > > > driver. You
> > > > +	  will not have to provide any parameters to make this work.
> > > > The driver
> > > > +          will be available until the real driver-model serial
> > > > is
> > > > running.
> > > > +
> > > >  endchoice
> > > >  
> > > >  config DEBUG_UART_BASE
> > > >  	hex "Base address of UART"
> > > > -	depends on DEBUG_UART
> > > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > > >  	default 0 if DEBUG_UART_SANDBOX
> > > >  	help
> > > >  	  This is the base address of your UART for memory-mapped
> > > > UARTs.
> > > > @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> > > >  
> > > >  config DEBUG_UART_CLOCK
> > > >  	int "UART input clock"
> > > > -	depends on DEBUG_UART
> > > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > > >  	default 0 if DEBUG_UART_SANDBOX
> > > >  	help
> > > >  	  The UART input clock determines the speed of the internal
> > > > UART
> > > > @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> > > >  
> > > >  config DEBUG_UART_SHIFT
> > > >  	int "UART register shift"
> > > > -	depends on DEBUG_UART
> > > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > > >  	default 0 if DEBUG_UART
> > > >  	help
> > > >  	  Some UARTs (notably ns16550) support different register
> > > > layouts
> > > > diff --git a/drivers/serial/serial_xen.c
> > > > b/drivers/serial/serial_xen.c
> > > > index ed191829f059..34c90ece40fc 100644
> > > > --- a/drivers/serial/serial_xen.c
> > > > +++ b/drivers/serial/serial_xen.c
> > > > @@ -5,6 +5,7 @@
> > > >   */
> > > >  #include <common.h>
> > > >  #include <cpu_func.h>
> > > > +#include <debug_uart.h>
> > > >  #include <dm.h>
> > > >  #include <serial.h>
> > > >  #include <watchdog.h>
> > > > @@ -15,11 +16,14 @@
> > > >  #include <xen/events.h>
> > > >  
> > > >  #include <xen/interface/sched.h>
> > > > +#include <xen/interface/xen.h>
> > > >  #include <xen/interface/hvm/hvm_op.h>
> > > >  #include <xen/interface/hvm/params.h>
> > > >  #include <xen/interface/io/console.h>
> > > >  #include <xen/interface/io/ring.h>
> > > >  
> > > > +#include <asm/xen/hypercall.h>
> > > > +
> > > >  DECLARE_GLOBAL_DATA_PTR;
> > > >  
> > > >  u32 console_evtchn;
> > > > @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> > > >  	.flags			= DM_FLAG_PRE_RELOC,
> > > >  };
> > > >  
> > > > +#if defined(CONFIG_DEBUG_UART_XEN)
> > > > +static inline void _debug_uart_init(void) {}
> > > > +
> > > > +static inline void _debug_uart_putc(int c)
> > > > +{
> > > > +#if CONFIG_IS_ENABLED(ARM)
> > > > +	xen_debug_putc(c);
> > > > +#else
> > > > +	/* the type cast should work on LE only */
> > > > +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> > > 
> > > An error occurs during compilation:
> > > drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
> > > this
> > > function); did you mean ?c??
> > >         HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> > 
> > Ah, yes. You're now using x86, right?
> 
> No, I just tried different options and accidentally discovered this
> error.

No?
My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
you have no chance of building "else" clause unless you use x86.

Anyway,

> > 
> > So what happens if you have made the fix above?
> > Does it work in your environment?
> > (I have confirmed that HYPERVISOR_console_io version works on
> > arm(64).)
> 
> Unfortunately, nothing happened (there are no logs mentioned earlier).

1. Have you ever executed HYPERVISOR_console_io on your platform before?
2. If possible, please try to my code on qemu, as my patch intended, so that
   we can determine if your issue is generic or specific on your environment?

Thanks,
-Takahiro Akashi


> Regards,
> Anastasiia
> > 
> > Thanks,
> > -Takahiro Akashi
> > 
> > 
> > > > +#endif
> > > > +}
> > > > +
> > > > +DEBUG_UART_FUNCS
> > > > +
> > > > +#endif
> > > 
> > > Regards,
> > > Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-23  8:53       ` Anastasiia Lukianenko
@ 2020-10-26  6:02         ` takahiro.akashi at linaro.org
  2020-10-26  6:12           ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 35+ messages in thread
From: takahiro.akashi at linaro.org @ 2020-10-26  6:02 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 23, 2020 at 08:53:52AM +0000, Anastasiia Lukianenko wrote:
> Hi,
> 
> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
> > On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
> > wrote:
> > > Hi,
> > > 
> > > On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> > > > By using a hypervisor call, we can implement DEBUG_UART on xen.
> > > > This will allow us to see messages even earlier than
> > > > serial_init().
> > > > 
> > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > > > ---
> > > >  drivers/serial/Kconfig      | 14 +++++++++++---
> > > >  drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> > > >  2 files changed, 31 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > > > index e344677f91f6..536cf0641773 100644
> > > > --- a/drivers/serial/Kconfig
> > > > +++ b/drivers/serial/Kconfig
> > > > @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> > > >  	  driver will be available until the real driver model serial
> > > > is
> > > >  	  running.
> > > >  
> > > > +config DEBUG_UART_XEN
> > > > +	bool "XEN Hypervisor Console"
> > > > +	depends on XEN_SERIAL
> > > > +	help
> > > > +	  Select this to enable a debug UART using the serial_xen
> > > > driver. You
> > > > +	  will not have to provide any parameters to make this work.
> > > > The driver
> > > > +          will be available until the real driver-model serial
> > > > is
> > > > running.
> > > > +
> > > >  endchoice
> > > >  
> > > >  config DEBUG_UART_BASE
> > > >  	hex "Base address of UART"
> > > > -	depends on DEBUG_UART
> > > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > > >  	default 0 if DEBUG_UART_SANDBOX
> > > >  	help
> > > >  	  This is the base address of your UART for memory-mapped
> > > > UARTs.
> > > > @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> > > >  
> > > >  config DEBUG_UART_CLOCK
> > > >  	int "UART input clock"
> > > > -	depends on DEBUG_UART
> > > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > > >  	default 0 if DEBUG_UART_SANDBOX
> > > >  	help
> > > >  	  The UART input clock determines the speed of the internal
> > > > UART
> > > > @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> > > >  
> > > >  config DEBUG_UART_SHIFT
> > > >  	int "UART register shift"
> > > > -	depends on DEBUG_UART
> > > > +	depends on DEBUG_UART && !DEBUG_UART_XEN
> > > >  	default 0 if DEBUG_UART
> > > >  	help
> > > >  	  Some UARTs (notably ns16550) support different register
> > > > layouts
> > > > diff --git a/drivers/serial/serial_xen.c
> > > > b/drivers/serial/serial_xen.c
> > > > index ed191829f059..34c90ece40fc 100644
> > > > --- a/drivers/serial/serial_xen.c
> > > > +++ b/drivers/serial/serial_xen.c
> > > > @@ -5,6 +5,7 @@
> > > >   */
> > > >  #include <common.h>
> > > >  #include <cpu_func.h>
> > > > +#include <debug_uart.h>
> > > >  #include <dm.h>
> > > >  #include <serial.h>
> > > >  #include <watchdog.h>
> > > > @@ -15,11 +16,14 @@
> > > >  #include <xen/events.h>
> > > >  
> > > >  #include <xen/interface/sched.h>
> > > > +#include <xen/interface/xen.h>
> > > >  #include <xen/interface/hvm/hvm_op.h>
> > > >  #include <xen/interface/hvm/params.h>
> > > >  #include <xen/interface/io/console.h>
> > > >  #include <xen/interface/io/ring.h>
> > > >  
> > > > +#include <asm/xen/hypercall.h>
> > > > +
> > > >  DECLARE_GLOBAL_DATA_PTR;
> > > >  
> > > >  u32 console_evtchn;
> > > > @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> > > >  	.flags			= DM_FLAG_PRE_RELOC,
> > > >  };
> > > >  
> > > > +#if defined(CONFIG_DEBUG_UART_XEN)
> > > > +static inline void _debug_uart_init(void) {}
> > > > +
> > > > +static inline void _debug_uart_putc(int c)
> > > > +{
> > > > +#if CONFIG_IS_ENABLED(ARM)
> > > > +	xen_debug_putc(c);
> > > > +#else
> > > > +	/* the type cast should work on LE only */
> > > > +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> > > 
> > > An error occurs during compilation:
> > > drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
> > > this
> > > function); did you mean ?c??
> > >         HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> > 
> > Ah, yes. You're now using x86, right?
> > 
> > So what happens if you have made the fix above?
> > Does it work in your environment?
> > (I have confirmed that HYPERVISOR_console_io version works on
> > arm(64).)
> > 
> 
> Sorry, I forgot to write in the last letter the question:
> Why can't we simply use HYPERVISOR_console_io(CONSOLEIO_write, 1, (char
> *)&ch); for both ARM and Xen?

Simply because the executed code on Xen side is quite simple.
I assume that simpler it is, more chance of output.

-Takahiro Akashi


> Regards,
> Anastasiia
> 
> > Thanks,
> > -Takahiro Akashi
> > 
> > 
> > > > +#endif
> > > > +}
> > > > +
> > > > +DEBUG_UART_FUNCS
> > > > +
> > > > +#endif
> > > 
> > > Regards,
> > > Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  6:02         ` takahiro.akashi at linaro.org
@ 2020-10-26  6:12           ` Oleksandr Andrushchenko
  0 siblings, 0 replies; 35+ messages in thread
From: Oleksandr Andrushchenko @ 2020-10-26  6:12 UTC (permalink / raw)
  To: u-boot

Hi,

On 10/26/20 8:02 AM, takahiro.akashi at linaro.org wrote:
> On Fri, Oct 23, 2020 at 08:53:52AM +0000, Anastasiia Lukianenko wrote:
>> Hi,
>>
>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
>>> wrote:
>>>> Hi,
>>>>
>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
>>>>> This will allow us to see messages even earlier than
>>>>> serial_init().
>>>>>
>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>> ---
>>>>>   drivers/serial/Kconfig      | 14 +++++++++++---
>>>>>   drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>>>>>   2 files changed, 31 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>>>> index e344677f91f6..536cf0641773 100644
>>>>> --- a/drivers/serial/Kconfig
>>>>> +++ b/drivers/serial/Kconfig
>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>>>>>   	  driver will be available until the real driver model serial
>>>>> is
>>>>>   	  running.
>>>>>   
>>>>> +config DEBUG_UART_XEN
>>>>> +	bool "XEN Hypervisor Console"
>>>>> +	depends on XEN_SERIAL
>>>>> +	help
>>>>> +	  Select this to enable a debug UART using the serial_xen
>>>>> driver. You
>>>>> +	  will not have to provide any parameters to make this work.
>>>>> The driver
>>>>> +          will be available until the real driver-model serial
>>>>> is
>>>>> running.
>>>>> +
>>>>>   endchoice
>>>>>   
>>>>>   config DEBUG_UART_BASE
>>>>>   	hex "Base address of UART"
>>>>> -	depends on DEBUG_UART
>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>   	default 0 if DEBUG_UART_SANDBOX
>>>>>   	help
>>>>>   	  This is the base address of your UART for memory-mapped
>>>>> UARTs.
>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
>>>>>   
>>>>>   config DEBUG_UART_CLOCK
>>>>>   	int "UART input clock"
>>>>> -	depends on DEBUG_UART
>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>   	default 0 if DEBUG_UART_SANDBOX
>>>>>   	help
>>>>>   	  The UART input clock determines the speed of the internal
>>>>> UART
>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
>>>>>   
>>>>>   config DEBUG_UART_SHIFT
>>>>>   	int "UART register shift"
>>>>> -	depends on DEBUG_UART
>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>   	default 0 if DEBUG_UART
>>>>>   	help
>>>>>   	  Some UARTs (notably ns16550) support different register
>>>>> layouts
>>>>> diff --git a/drivers/serial/serial_xen.c
>>>>> b/drivers/serial/serial_xen.c
>>>>> index ed191829f059..34c90ece40fc 100644
>>>>> --- a/drivers/serial/serial_xen.c
>>>>> +++ b/drivers/serial/serial_xen.c
>>>>> @@ -5,6 +5,7 @@
>>>>>    */
>>>>>   #include <common.h>
>>>>>   #include <cpu_func.h>
>>>>> +#include <debug_uart.h>
>>>>>   #include <dm.h>
>>>>>   #include <serial.h>
>>>>>   #include <watchdog.h>
>>>>> @@ -15,11 +16,14 @@
>>>>>   #include <xen/events.h>
>>>>>   
>>>>>   #include <xen/interface/sched.h>
>>>>> +#include <xen/interface/xen.h>
>>>>>   #include <xen/interface/hvm/hvm_op.h>
>>>>>   #include <xen/interface/hvm/params.h>
>>>>>   #include <xen/interface/io/console.h>
>>>>>   #include <xen/interface/io/ring.h>
>>>>>   
>>>>> +#include <asm/xen/hypercall.h>
>>>>> +
>>>>>   DECLARE_GLOBAL_DATA_PTR;
>>>>>   
>>>>>   u32 console_evtchn;
>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>>>>>   	.flags			= DM_FLAG_PRE_RELOC,
>>>>>   };
>>>>>   
>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
>>>>> +static inline void _debug_uart_init(void) {}
>>>>> +
>>>>> +static inline void _debug_uart_putc(int c)
>>>>> +{
>>>>> +#if CONFIG_IS_ENABLED(ARM)
>>>>> +	xen_debug_putc(c);
>>>>> +#else
>>>>> +	/* the type cast should work on LE only */
>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>> An error occurs during compilation:
>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
>>>> this
>>>> function); did you mean ?c??
>>>>          HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>> Ah, yes. You're now using x86, right?
>>>
>>> So what happens if you have made the fix above?
>>> Does it work in your environment?
>>> (I have confirmed that HYPERVISOR_console_io version works on
>>> arm(64).)
>>>
>> Sorry, I forgot to write in the last letter the question:
>> Why can't we simply use HYPERVISOR_console_io(CONSOLEIO_write, 1, (char
>> *)&ch); for both ARM and Xen?
> Simply because the executed code on Xen side is quite simple.
> I assume that simpler it is, more chance of output.

This is true that the simpler the better. And we already have a proper platform

agnostic definition for that:

arch/arm/cpu/armv8/xen/hypercall.S:73:HYPERCALL3(console_io);
arch/arm/include/asm/xen/hypercall.h:16:int HYPERVISOR_console_io(int cmd, int count, char *str);
include/xen/interface/xen.h:44:#define __HYPERVISOR_console_io?????????? 18

So, we are not only adding an ARM specific implementation in the patch, but also add

#ifdef's in the code while we can simply avoid that. So, to me, it would make

much more sense if we use what we already have the way Xen has it rather than adding

the code which may require maintenance and make the code harder to read

Thank you,

Oleksandr

>
> -Takahiro Akashi
>
>
>> Regards,
>> Anastasiia
>>
>>> Thanks,
>>> -Takahiro Akashi
>>>
>>>
>>>>> +#endif
>>>>> +}
>>>>> +
>>>>> +DEBUG_UART_FUNCS
>>>>> +
>>>>> +#endif
>>>> Regards,
>>>> Anastasiia

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  5:58         ` takahiro.akashi at linaro.org
@ 2020-10-26  6:18           ` Oleksandr Andrushchenko
  2020-10-26  6:50             ` takahiro.akashi at linaro.org
  0 siblings, 1 reply; 35+ messages in thread
From: Oleksandr Andrushchenko @ 2020-10-26  6:18 UTC (permalink / raw)
  To: u-boot

Hi,

On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
> On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
>> Hello,
>>
>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
>>> wrote:
>>>> Hi,
>>>>
>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
>>>>> This will allow us to see messages even earlier than
>>>>> serial_init().
>>>>>
>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>> ---
>>>>>   drivers/serial/Kconfig      | 14 +++++++++++---
>>>>>   drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>>>>>   2 files changed, 31 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>>>> index e344677f91f6..536cf0641773 100644
>>>>> --- a/drivers/serial/Kconfig
>>>>> +++ b/drivers/serial/Kconfig
>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>>>>>   	  driver will be available until the real driver model serial
>>>>> is
>>>>>   	  running.
>>>>>   
>>>>> +config DEBUG_UART_XEN
>>>>> +	bool "XEN Hypervisor Console"
>>>>> +	depends on XEN_SERIAL
>>>>> +	help
>>>>> +	  Select this to enable a debug UART using the serial_xen
>>>>> driver. You
>>>>> +	  will not have to provide any parameters to make this work.
>>>>> The driver
>>>>> +          will be available until the real driver-model serial
>>>>> is
>>>>> running.
>>>>> +
>>>>>   endchoice
>>>>>   
>>>>>   config DEBUG_UART_BASE
>>>>>   	hex "Base address of UART"
>>>>> -	depends on DEBUG_UART
>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>   	default 0 if DEBUG_UART_SANDBOX
>>>>>   	help
>>>>>   	  This is the base address of your UART for memory-mapped
>>>>> UARTs.
>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
>>>>>   
>>>>>   config DEBUG_UART_CLOCK
>>>>>   	int "UART input clock"
>>>>> -	depends on DEBUG_UART
>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>   	default 0 if DEBUG_UART_SANDBOX
>>>>>   	help
>>>>>   	  The UART input clock determines the speed of the internal
>>>>> UART
>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
>>>>>   
>>>>>   config DEBUG_UART_SHIFT
>>>>>   	int "UART register shift"
>>>>> -	depends on DEBUG_UART
>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>   	default 0 if DEBUG_UART
>>>>>   	help
>>>>>   	  Some UARTs (notably ns16550) support different register
>>>>> layouts
>>>>> diff --git a/drivers/serial/serial_xen.c
>>>>> b/drivers/serial/serial_xen.c
>>>>> index ed191829f059..34c90ece40fc 100644
>>>>> --- a/drivers/serial/serial_xen.c
>>>>> +++ b/drivers/serial/serial_xen.c
>>>>> @@ -5,6 +5,7 @@
>>>>>    */
>>>>>   #include <common.h>
>>>>>   #include <cpu_func.h>
>>>>> +#include <debug_uart.h>
>>>>>   #include <dm.h>
>>>>>   #include <serial.h>
>>>>>   #include <watchdog.h>
>>>>> @@ -15,11 +16,14 @@
>>>>>   #include <xen/events.h>
>>>>>   
>>>>>   #include <xen/interface/sched.h>
>>>>> +#include <xen/interface/xen.h>
>>>>>   #include <xen/interface/hvm/hvm_op.h>
>>>>>   #include <xen/interface/hvm/params.h>
>>>>>   #include <xen/interface/io/console.h>
>>>>>   #include <xen/interface/io/ring.h>
>>>>>   
>>>>> +#include <asm/xen/hypercall.h>
>>>>> +
>>>>>   DECLARE_GLOBAL_DATA_PTR;
>>>>>   
>>>>>   u32 console_evtchn;
>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>>>>>   	.flags			= DM_FLAG_PRE_RELOC,
>>>>>   };
>>>>>   
>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
>>>>> +static inline void _debug_uart_init(void) {}
>>>>> +
>>>>> +static inline void _debug_uart_putc(int c)
>>>>> +{
>>>>> +#if CONFIG_IS_ENABLED(ARM)
>>>>> +	xen_debug_putc(c);
>>>>> +#else
>>>>> +	/* the type cast should work on LE only */
>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>> An error occurs during compilation:
>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
>>>> this
>>>> function); did you mean ?c??
>>>>          HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>> Ah, yes. You're now using x86, right?
>> No, I just tried different options and accidentally discovered this
>> error.
> No?
> My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
> you have no chance of building "else" clause unless you use x86.

The question here is that if x86 is selected it won't compile. Another

question if we tested that with x86: no, we didn't. The reason we tried x86

part was that HYPERVISOR_console_io is a generic definition for all the platforms,

so it was natural to try that as a way to debug things.

>
> Anyway,
>
>>> So what happens if you have made the fix above?
>>> Does it work in your environment?
>>> (I have confirmed that HYPERVISOR_console_io version works on
>>> arm(64).)
>> Unfortunately, nothing happened (there are no logs mentioned earlier).
> 1. Have you ever executed HYPERVISOR_console_io on your platform before?

Yes, we did that. You may have noticed that in [1] which I referred earlier

and the problems we faced with that.

> 2. If possible, please try to my code on qemu, as my patch intended, so that
>     we can determine if your issue is generic or specific on your environment?

The code runs on two different platforms with the same result (non-QEMU though).

Thank you,

Oleksandr

>
> Thanks,
> -Takahiro Akashi
>
>
>> Regards,
>> Anastasiia
>>> Thanks,
>>> -Takahiro Akashi
>>>
>>>
>>>>> +#endif
>>>>> +}
>>>>> +
>>>>> +DEBUG_UART_FUNCS
>>>>> +
>>>>> +#endif
>>>> Regards,
>>>> Anastasiia
[1] https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  6:18           ` Oleksandr Andrushchenko
@ 2020-10-26  6:50             ` takahiro.akashi at linaro.org
  2020-10-26  6:54               ` Oleksandr Andrushchenko
  2020-10-26  7:16               ` Oleksandr Andrushchenko
  0 siblings, 2 replies; 35+ messages in thread
From: takahiro.akashi at linaro.org @ 2020-10-26  6:50 UTC (permalink / raw)
  To: u-boot

On Mon, Oct 26, 2020 at 06:18:08AM +0000, Oleksandr Andrushchenko wrote:
> Hi,
> 
> On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
> > On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
> >> Hello,
> >>
> >> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
> >>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
> >>> wrote:
> >>>> Hi,
> >>>>
> >>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> >>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
> >>>>> This will allow us to see messages even earlier than
> >>>>> serial_init().
> >>>>>
> >>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >>>>> ---
> >>>>>   drivers/serial/Kconfig      | 14 +++++++++++---
> >>>>>   drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> >>>>>   2 files changed, 31 insertions(+), 3 deletions(-)
> >>>>>
> >>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> >>>>> index e344677f91f6..536cf0641773 100644
> >>>>> --- a/drivers/serial/Kconfig
> >>>>> +++ b/drivers/serial/Kconfig
> >>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> >>>>>   	  driver will be available until the real driver model serial
> >>>>> is
> >>>>>   	  running.
> >>>>>   
> >>>>> +config DEBUG_UART_XEN
> >>>>> +	bool "XEN Hypervisor Console"
> >>>>> +	depends on XEN_SERIAL
> >>>>> +	help
> >>>>> +	  Select this to enable a debug UART using the serial_xen
> >>>>> driver. You
> >>>>> +	  will not have to provide any parameters to make this work.
> >>>>> The driver
> >>>>> +          will be available until the real driver-model serial
> >>>>> is
> >>>>> running.
> >>>>> +
> >>>>>   endchoice
> >>>>>   
> >>>>>   config DEBUG_UART_BASE
> >>>>>   	hex "Base address of UART"
> >>>>> -	depends on DEBUG_UART
> >>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>   	default 0 if DEBUG_UART_SANDBOX
> >>>>>   	help
> >>>>>   	  This is the base address of your UART for memory-mapped
> >>>>> UARTs.
> >>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> >>>>>   
> >>>>>   config DEBUG_UART_CLOCK
> >>>>>   	int "UART input clock"
> >>>>> -	depends on DEBUG_UART
> >>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>   	default 0 if DEBUG_UART_SANDBOX
> >>>>>   	help
> >>>>>   	  The UART input clock determines the speed of the internal
> >>>>> UART
> >>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> >>>>>   
> >>>>>   config DEBUG_UART_SHIFT
> >>>>>   	int "UART register shift"
> >>>>> -	depends on DEBUG_UART
> >>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>   	default 0 if DEBUG_UART
> >>>>>   	help
> >>>>>   	  Some UARTs (notably ns16550) support different register
> >>>>> layouts
> >>>>> diff --git a/drivers/serial/serial_xen.c
> >>>>> b/drivers/serial/serial_xen.c
> >>>>> index ed191829f059..34c90ece40fc 100644
> >>>>> --- a/drivers/serial/serial_xen.c
> >>>>> +++ b/drivers/serial/serial_xen.c
> >>>>> @@ -5,6 +5,7 @@
> >>>>>    */
> >>>>>   #include <common.h>
> >>>>>   #include <cpu_func.h>
> >>>>> +#include <debug_uart.h>
> >>>>>   #include <dm.h>
> >>>>>   #include <serial.h>
> >>>>>   #include <watchdog.h>
> >>>>> @@ -15,11 +16,14 @@
> >>>>>   #include <xen/events.h>
> >>>>>   
> >>>>>   #include <xen/interface/sched.h>
> >>>>> +#include <xen/interface/xen.h>
> >>>>>   #include <xen/interface/hvm/hvm_op.h>
> >>>>>   #include <xen/interface/hvm/params.h>
> >>>>>   #include <xen/interface/io/console.h>
> >>>>>   #include <xen/interface/io/ring.h>
> >>>>>   
> >>>>> +#include <asm/xen/hypercall.h>
> >>>>> +
> >>>>>   DECLARE_GLOBAL_DATA_PTR;
> >>>>>   
> >>>>>   u32 console_evtchn;
> >>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> >>>>>   	.flags			= DM_FLAG_PRE_RELOC,
> >>>>>   };
> >>>>>   
> >>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
> >>>>> +static inline void _debug_uart_init(void) {}
> >>>>> +
> >>>>> +static inline void _debug_uart_putc(int c)
> >>>>> +{
> >>>>> +#if CONFIG_IS_ENABLED(ARM)
> >>>>> +	xen_debug_putc(c);
> >>>>> +#else
> >>>>> +	/* the type cast should work on LE only */
> >>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> >>>> An error occurs during compilation:
> >>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
> >>>> this
> >>>> function); did you mean ?c??
> >>>>          HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> >>> Ah, yes. You're now using x86, right?
> >> No, I just tried different options and accidentally discovered this
> >> error.
> > No?
> > My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
> > you have no chance of building "else" clause unless you use x86.
> 
> The question here is that if x86 is selected it won't compile. Another
> 
> question if we tested that with x86: no, we didn't. The reason we tried x86
> 
> part was that HYPERVISOR_console_io is a generic definition for all the platforms,
> 
> so it was natural to try that as a way to debug things.

Anastasiia said, "No, I just tried different options."
Instead of different options, you tried modified code.

> 
> >
> > Anyway,
> >
> >>> So what happens if you have made the fix above?
> >>> Does it work in your environment?
> >>> (I have confirmed that HYPERVISOR_console_io version works on
> >>> arm(64).)
> >> Unfortunately, nothing happened (there are no logs mentioned earlier).
> > 1. Have you ever executed HYPERVISOR_console_io on your platform before?
> 
> Yes, we did that. You may have noticed that in [1] which I referred earlier
> and the problems we faced with that.

Okay. Since I started to play with Xen just a few weeks ago,
I actually don't know the past discussions at all.

So the issue you have mentioned has been fixed, hasn't it?
Even if so, you must have submitted your patch in June or later
this year.

Anastasiia said that she had used xen 4.13(+?) to test my code.
So obviously, there will be no chance that you patch be merged
in her test environment.

> 
> > 2. If possible, please try to my code on qemu, as my patch intended, so that
> >     we can determine if your issue is generic or specific on your environment?
> 
> The code runs on two different platforms with the same result (non-QEMU though).

Please check on qemu with the latest Xen so that, as I said, we can
determine if the issue is platform or environment (including a difference
of version used) specific or not.
I believe that it is quite easy for you to run U-Boot on qemu.

-Takahiro Akashi

> 
> Thank you,
> 
> Oleksandr
> 
> >
> > Thanks,
> > -Takahiro Akashi
> >
> >
> >> Regards,
> >> Anastasiia
> >>> Thanks,
> >>> -Takahiro Akashi
> >>>
> >>>
> >>>>> +#endif
> >>>>> +}
> >>>>> +
> >>>>> +DEBUG_UART_FUNCS
> >>>>> +
> >>>>> +#endif
> >>>> Regards,
> >>>> Anastasiia
> [1] https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  6:50             ` takahiro.akashi at linaro.org
@ 2020-10-26  6:54               ` Oleksandr Andrushchenko
  2020-10-26  7:10                 ` takahiro.akashi at linaro.org
  2020-10-26  7:16               ` Oleksandr Andrushchenko
  1 sibling, 1 reply; 35+ messages in thread
From: Oleksandr Andrushchenko @ 2020-10-26  6:54 UTC (permalink / raw)
  To: u-boot


On 10/26/20 8:50 AM, takahiro.akashi at linaro.org wrote:
> On Mon, Oct 26, 2020 at 06:18:08AM +0000, Oleksandr Andrushchenko wrote:
>> Hi,
>>
>> On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
>>> On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
>>>> Hello,
>>>>
>>>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
>>>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
>>>>> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
>>>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
>>>>>>> This will allow us to see messages even earlier than
>>>>>>> serial_init().
>>>>>>>
>>>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>>>> ---
>>>>>>>    drivers/serial/Kconfig      | 14 +++++++++++---
>>>>>>>    drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>>>>>>>    2 files changed, 31 insertions(+), 3 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>>>>>> index e344677f91f6..536cf0641773 100644
>>>>>>> --- a/drivers/serial/Kconfig
>>>>>>> +++ b/drivers/serial/Kconfig
>>>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>>>>>>>    	  driver will be available until the real driver model serial
>>>>>>> is
>>>>>>>    	  running.
>>>>>>>    
>>>>>>> +config DEBUG_UART_XEN
>>>>>>> +	bool "XEN Hypervisor Console"
>>>>>>> +	depends on XEN_SERIAL
>>>>>>> +	help
>>>>>>> +	  Select this to enable a debug UART using the serial_xen
>>>>>>> driver. You
>>>>>>> +	  will not have to provide any parameters to make this work.
>>>>>>> The driver
>>>>>>> +          will be available until the real driver-model serial
>>>>>>> is
>>>>>>> running.
>>>>>>> +
>>>>>>>    endchoice
>>>>>>>    
>>>>>>>    config DEBUG_UART_BASE
>>>>>>>    	hex "Base address of UART"
>>>>>>> -	depends on DEBUG_UART
>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>    	default 0 if DEBUG_UART_SANDBOX
>>>>>>>    	help
>>>>>>>    	  This is the base address of your UART for memory-mapped
>>>>>>> UARTs.
>>>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
>>>>>>>    
>>>>>>>    config DEBUG_UART_CLOCK
>>>>>>>    	int "UART input clock"
>>>>>>> -	depends on DEBUG_UART
>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>    	default 0 if DEBUG_UART_SANDBOX
>>>>>>>    	help
>>>>>>>    	  The UART input clock determines the speed of the internal
>>>>>>> UART
>>>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
>>>>>>>    
>>>>>>>    config DEBUG_UART_SHIFT
>>>>>>>    	int "UART register shift"
>>>>>>> -	depends on DEBUG_UART
>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>    	default 0 if DEBUG_UART
>>>>>>>    	help
>>>>>>>    	  Some UARTs (notably ns16550) support different register
>>>>>>> layouts
>>>>>>> diff --git a/drivers/serial/serial_xen.c
>>>>>>> b/drivers/serial/serial_xen.c
>>>>>>> index ed191829f059..34c90ece40fc 100644
>>>>>>> --- a/drivers/serial/serial_xen.c
>>>>>>> +++ b/drivers/serial/serial_xen.c
>>>>>>> @@ -5,6 +5,7 @@
>>>>>>>     */
>>>>>>>    #include <common.h>
>>>>>>>    #include <cpu_func.h>
>>>>>>> +#include <debug_uart.h>
>>>>>>>    #include <dm.h>
>>>>>>>    #include <serial.h>
>>>>>>>    #include <watchdog.h>
>>>>>>> @@ -15,11 +16,14 @@
>>>>>>>    #include <xen/events.h>
>>>>>>>    
>>>>>>>    #include <xen/interface/sched.h>
>>>>>>> +#include <xen/interface/xen.h>
>>>>>>>    #include <xen/interface/hvm/hvm_op.h>
>>>>>>>    #include <xen/interface/hvm/params.h>
>>>>>>>    #include <xen/interface/io/console.h>
>>>>>>>    #include <xen/interface/io/ring.h>
>>>>>>>    
>>>>>>> +#include <asm/xen/hypercall.h>
>>>>>>> +
>>>>>>>    DECLARE_GLOBAL_DATA_PTR;
>>>>>>>    
>>>>>>>    u32 console_evtchn;
>>>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>>>>>>>    	.flags			= DM_FLAG_PRE_RELOC,
>>>>>>>    };
>>>>>>>    
>>>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
>>>>>>> +static inline void _debug_uart_init(void) {}
>>>>>>> +
>>>>>>> +static inline void _debug_uart_putc(int c)
>>>>>>> +{
>>>>>>> +#if CONFIG_IS_ENABLED(ARM)
>>>>>>> +	xen_debug_putc(c);
>>>>>>> +#else
>>>>>>> +	/* the type cast should work on LE only */
>>>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>>> An error occurs during compilation:
>>>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
>>>>>> this
>>>>>> function); did you mean ?c??
>>>>>>           HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>> Ah, yes. You're now using x86, right?
>>>> No, I just tried different options and accidentally discovered this
>>>> error.
>>> No?
>>> My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
>>> you have no chance of building "else" clause unless you use x86.
>> The question here is that if x86 is selected it won't compile. Another
>>
>> question if we tested that with x86: no, we didn't. The reason we tried x86
>>
>> part was that HYPERVISOR_console_io is a generic definition for all the platforms,
>>
>> so it was natural to try that as a way to debug things.
> Anastasiia said, "No, I just tried different options."
> Instead of different options, you tried modified code.

That was to debug why the original code didn't work, I see nothing wrong

in that she tried helping you to figure out why...

>
>>> Anyway,
>>>
>>>>> So what happens if you have made the fix above?
>>>>> Does it work in your environment?
>>>>> (I have confirmed that HYPERVISOR_console_io version works on
>>>>> arm(64).)
>>>> Unfortunately, nothing happened (there are no logs mentioned earlier).
>>> 1. Have you ever executed HYPERVISOR_console_io on your platform before?
>> Yes, we did that. You may have noticed that in [1] which I referred earlier
>> and the problems we faced with that.
> Okay. Since I started to play with Xen just a few weeks ago,
> I actually don't know the past discussions at all.
>
> So the issue you have mentioned has been fixed, hasn't it?
> Even if so, you must have submitted your patch in June or later
> this year.
>
> Anastasiia said that she had used xen 4.13(+?) to test my code.
> So obviously, there will be no chance that you patch be merged
> in her test environment.
>
>>> 2. If possible, please try to my code on qemu, as my patch intended, so that
>>>      we can determine if your issue is generic or specific on your environment?
>> The code runs on two different platforms with the same result (non-QEMU though).
> Please check on qemu with the latest Xen so that, as I said, we can
> determine if the issue is platform or environment (including a difference
> of version used) specific or not.
> I believe that it is quite easy for you to run U-Boot on qemu.
>
> -Takahiro Akashi
>
>> Thank you,
>>
>> Oleksandr
>>
>>> Thanks,
>>> -Takahiro Akashi
>>>
>>>
>>>> Regards,
>>>> Anastasiia
>>>>> Thanks,
>>>>> -Takahiro Akashi
>>>>>
>>>>>
>>>>>>> +#endif
>>>>>>> +}
>>>>>>> +
>>>>>>> +DEBUG_UART_FUNCS
>>>>>>> +
>>>>>>> +#endif
>>>>>> Regards,
>>>>>> Anastasiia
>> [1] https://urldefense.com/v3/__https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html__;!!GF_29dbcQIUBPA!lbY6WN0YDxFiqUvVTZI8ZkwzoiY08y_oHciOZ7lrUxxpdo-aX37PHDwcSwc3Mb_7uRivJJpP0A$ [lists[.]xenproject[.]org]

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  6:54               ` Oleksandr Andrushchenko
@ 2020-10-26  7:10                 ` takahiro.akashi at linaro.org
  2020-10-26  7:30                   ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 35+ messages in thread
From: takahiro.akashi at linaro.org @ 2020-10-26  7:10 UTC (permalink / raw)
  To: u-boot

On Mon, Oct 26, 2020 at 06:54:29AM +0000, Oleksandr Andrushchenko wrote:
> 
> On 10/26/20 8:50 AM, takahiro.akashi at linaro.org wrote:
> > On Mon, Oct 26, 2020 at 06:18:08AM +0000, Oleksandr Andrushchenko wrote:
> >> Hi,
> >>
> >> On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
> >>> On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
> >>>> Hello,
> >>>>
> >>>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
> >>>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
> >>>>> wrote:
> >>>>>> Hi,
> >>>>>>
> >>>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> >>>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
> >>>>>>> This will allow us to see messages even earlier than
> >>>>>>> serial_init().
> >>>>>>>
> >>>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >>>>>>> ---
> >>>>>>>    drivers/serial/Kconfig      | 14 +++++++++++---
> >>>>>>>    drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> >>>>>>>    2 files changed, 31 insertions(+), 3 deletions(-)
> >>>>>>>
> >>>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> >>>>>>> index e344677f91f6..536cf0641773 100644
> >>>>>>> --- a/drivers/serial/Kconfig
> >>>>>>> +++ b/drivers/serial/Kconfig
> >>>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> >>>>>>>    	  driver will be available until the real driver model serial
> >>>>>>> is
> >>>>>>>    	  running.
> >>>>>>>    
> >>>>>>> +config DEBUG_UART_XEN
> >>>>>>> +	bool "XEN Hypervisor Console"
> >>>>>>> +	depends on XEN_SERIAL
> >>>>>>> +	help
> >>>>>>> +	  Select this to enable a debug UART using the serial_xen
> >>>>>>> driver. You
> >>>>>>> +	  will not have to provide any parameters to make this work.
> >>>>>>> The driver
> >>>>>>> +          will be available until the real driver-model serial
> >>>>>>> is
> >>>>>>> running.
> >>>>>>> +
> >>>>>>>    endchoice
> >>>>>>>    
> >>>>>>>    config DEBUG_UART_BASE
> >>>>>>>    	hex "Base address of UART"
> >>>>>>> -	depends on DEBUG_UART
> >>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>>>    	default 0 if DEBUG_UART_SANDBOX
> >>>>>>>    	help
> >>>>>>>    	  This is the base address of your UART for memory-mapped
> >>>>>>> UARTs.
> >>>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> >>>>>>>    
> >>>>>>>    config DEBUG_UART_CLOCK
> >>>>>>>    	int "UART input clock"
> >>>>>>> -	depends on DEBUG_UART
> >>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>>>    	default 0 if DEBUG_UART_SANDBOX
> >>>>>>>    	help
> >>>>>>>    	  The UART input clock determines the speed of the internal
> >>>>>>> UART
> >>>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> >>>>>>>    
> >>>>>>>    config DEBUG_UART_SHIFT
> >>>>>>>    	int "UART register shift"
> >>>>>>> -	depends on DEBUG_UART
> >>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>>>    	default 0 if DEBUG_UART
> >>>>>>>    	help
> >>>>>>>    	  Some UARTs (notably ns16550) support different register
> >>>>>>> layouts
> >>>>>>> diff --git a/drivers/serial/serial_xen.c
> >>>>>>> b/drivers/serial/serial_xen.c
> >>>>>>> index ed191829f059..34c90ece40fc 100644
> >>>>>>> --- a/drivers/serial/serial_xen.c
> >>>>>>> +++ b/drivers/serial/serial_xen.c
> >>>>>>> @@ -5,6 +5,7 @@
> >>>>>>>     */
> >>>>>>>    #include <common.h>
> >>>>>>>    #include <cpu_func.h>
> >>>>>>> +#include <debug_uart.h>
> >>>>>>>    #include <dm.h>
> >>>>>>>    #include <serial.h>
> >>>>>>>    #include <watchdog.h>
> >>>>>>> @@ -15,11 +16,14 @@
> >>>>>>>    #include <xen/events.h>
> >>>>>>>    
> >>>>>>>    #include <xen/interface/sched.h>
> >>>>>>> +#include <xen/interface/xen.h>
> >>>>>>>    #include <xen/interface/hvm/hvm_op.h>
> >>>>>>>    #include <xen/interface/hvm/params.h>
> >>>>>>>    #include <xen/interface/io/console.h>
> >>>>>>>    #include <xen/interface/io/ring.h>
> >>>>>>>    
> >>>>>>> +#include <asm/xen/hypercall.h>
> >>>>>>> +
> >>>>>>>    DECLARE_GLOBAL_DATA_PTR;
> >>>>>>>    
> >>>>>>>    u32 console_evtchn;
> >>>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> >>>>>>>    	.flags			= DM_FLAG_PRE_RELOC,
> >>>>>>>    };
> >>>>>>>    
> >>>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
> >>>>>>> +static inline void _debug_uart_init(void) {}
> >>>>>>> +
> >>>>>>> +static inline void _debug_uart_putc(int c)
> >>>>>>> +{
> >>>>>>> +#if CONFIG_IS_ENABLED(ARM)
> >>>>>>> +	xen_debug_putc(c);
> >>>>>>> +#else
> >>>>>>> +	/* the type cast should work on LE only */
> >>>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> >>>>>> An error occurs during compilation:
> >>>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
> >>>>>> this
> >>>>>> function); did you mean ?c??
> >>>>>>           HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> >>>>> Ah, yes. You're now using x86, right?
> >>>> No, I just tried different options and accidentally discovered this
> >>>> error.
> >>> No?
> >>> My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
> >>> you have no chance of building "else" clause unless you use x86.
> >> The question here is that if x86 is selected it won't compile. Another
> >>
> >> question if we tested that with x86: no, we didn't. The reason we tried x86
> >>
> >> part was that HYPERVISOR_console_io is a generic definition for all the platforms,
> >>
> >> so it was natural to try that as a way to debug things.
> > Anastasiia said, "No, I just tried different options."
> > Instead of different options, you tried modified code.
> 
> That was to debug why the original code didn't work, I see nothing wrong
> 
> in that she tried helping you to figure out why...

I really appreciate your assistance here.

But without knowing the detailed environment on your side, it may sometimes
be difficult to find out the root cause.

> >
> >>> Anyway,
> >>>
> >>>>> So what happens if you have made the fix above?
> >>>>> Does it work in your environment?
> >>>>> (I have confirmed that HYPERVISOR_console_io version works on
> >>>>> arm(64).)
> >>>> Unfortunately, nothing happened (there are no logs mentioned earlier).
> >>> 1. Have you ever executed HYPERVISOR_console_io on your platform before?
> >> Yes, we did that. You may have noticed that in [1] which I referred earlier
> >> and the problems we faced with that.
> > Okay. Since I started to play with Xen just a few weeks ago,
> > I actually don't know the past discussions at all.
> >
> > So the issue you have mentioned has been fixed, hasn't it?

Please confirm this.

> > Even if so, you must have submitted your patch in June or later
> > this year.
> >
> > Anastasiia said that she had used xen 4.13(+?) to test my code.
> > So obviously, there will be no chance that you patch be merged
> > in her test environment.
> >
> >>> 2. If possible, please try to my code on qemu, as my patch intended, so that
> >>>      we can determine if your issue is generic or specific on your environment?
> >> The code runs on two different platforms with the same result (non-QEMU though).
> > Please check on qemu with the latest Xen so that, as I said, we can
> > determine if the issue is platform or environment (including a difference
> > of version used) specific or not.
> > I believe that it is quite easy for you to run U-Boot on qemu.

Please try this first. I believe that it is the first step to take.

Since I don't have any real hardwrare at this moment,
it will be difficult for me to dig into the issue
unless it can be reproduced on qemu.

Thanks,
-Takahiro Akashi


> >
> > -Takahiro Akashi
> >
> >> Thank you,
> >>
> >> Oleksandr
> >>
> >>> Thanks,
> >>> -Takahiro Akashi
> >>>
> >>>
> >>>> Regards,
> >>>> Anastasiia
> >>>>> Thanks,
> >>>>> -Takahiro Akashi
> >>>>>
> >>>>>
> >>>>>>> +#endif
> >>>>>>> +}
> >>>>>>> +
> >>>>>>> +DEBUG_UART_FUNCS
> >>>>>>> +
> >>>>>>> +#endif
> >>>>>> Regards,
> >>>>>> Anastasiia
> >> [1] https://urldefense.com/v3/__https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html__;!!GF_29dbcQIUBPA!lbY6WN0YDxFiqUvVTZI8ZkwzoiY08y_oHciOZ7lrUxxpdo-aX37PHDwcSwc3Mb_7uRivJJpP0A$ [lists[.]xenproject[.]org]

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  6:50             ` takahiro.akashi at linaro.org
  2020-10-26  6:54               ` Oleksandr Andrushchenko
@ 2020-10-26  7:16               ` Oleksandr Andrushchenko
  1 sibling, 0 replies; 35+ messages in thread
From: Oleksandr Andrushchenko @ 2020-10-26  7:16 UTC (permalink / raw)
  To: u-boot

Hi,

On 10/26/20 8:50 AM, takahiro.akashi at linaro.org wrote:
> On Mon, Oct 26, 2020 at 06:18:08AM +0000, Oleksandr Andrushchenko wrote:
>> Hi,
>>
>> On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
>>> On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
>>>> Hello,
>>>>
>>>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
>>>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
>>>>> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
>>>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
>>>>>>> This will allow us to see messages even earlier than
>>>>>>> serial_init().
>>>>>>>
>>>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>>>> ---
>>>>>>>    drivers/serial/Kconfig      | 14 +++++++++++---
>>>>>>>    drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>>>>>>>    2 files changed, 31 insertions(+), 3 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>>>>>> index e344677f91f6..536cf0641773 100644
>>>>>>> --- a/drivers/serial/Kconfig
>>>>>>> +++ b/drivers/serial/Kconfig
>>>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>>>>>>>    	  driver will be available until the real driver model serial
>>>>>>> is
>>>>>>>    	  running.
>>>>>>>    
>>>>>>> +config DEBUG_UART_XEN
>>>>>>> +	bool "XEN Hypervisor Console"
>>>>>>> +	depends on XEN_SERIAL
>>>>>>> +	help
>>>>>>> +	  Select this to enable a debug UART using the serial_xen
>>>>>>> driver. You
>>>>>>> +	  will not have to provide any parameters to make this work.
>>>>>>> The driver
>>>>>>> +          will be available until the real driver-model serial
>>>>>>> is
>>>>>>> running.
>>>>>>> +
>>>>>>>    endchoice
>>>>>>>    
>>>>>>>    config DEBUG_UART_BASE
>>>>>>>    	hex "Base address of UART"
>>>>>>> -	depends on DEBUG_UART
>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>    	default 0 if DEBUG_UART_SANDBOX
>>>>>>>    	help
>>>>>>>    	  This is the base address of your UART for memory-mapped
>>>>>>> UARTs.
>>>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
>>>>>>>    
>>>>>>>    config DEBUG_UART_CLOCK
>>>>>>>    	int "UART input clock"
>>>>>>> -	depends on DEBUG_UART
>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>    	default 0 if DEBUG_UART_SANDBOX
>>>>>>>    	help
>>>>>>>    	  The UART input clock determines the speed of the internal
>>>>>>> UART
>>>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
>>>>>>>    
>>>>>>>    config DEBUG_UART_SHIFT
>>>>>>>    	int "UART register shift"
>>>>>>> -	depends on DEBUG_UART
>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>    	default 0 if DEBUG_UART
>>>>>>>    	help
>>>>>>>    	  Some UARTs (notably ns16550) support different register
>>>>>>> layouts
>>>>>>> diff --git a/drivers/serial/serial_xen.c
>>>>>>> b/drivers/serial/serial_xen.c
>>>>>>> index ed191829f059..34c90ece40fc 100644
>>>>>>> --- a/drivers/serial/serial_xen.c
>>>>>>> +++ b/drivers/serial/serial_xen.c
>>>>>>> @@ -5,6 +5,7 @@
>>>>>>>     */
>>>>>>>    #include <common.h>
>>>>>>>    #include <cpu_func.h>
>>>>>>> +#include <debug_uart.h>
>>>>>>>    #include <dm.h>
>>>>>>>    #include <serial.h>
>>>>>>>    #include <watchdog.h>
>>>>>>> @@ -15,11 +16,14 @@
>>>>>>>    #include <xen/events.h>
>>>>>>>    
>>>>>>>    #include <xen/interface/sched.h>
>>>>>>> +#include <xen/interface/xen.h>
>>>>>>>    #include <xen/interface/hvm/hvm_op.h>
>>>>>>>    #include <xen/interface/hvm/params.h>
>>>>>>>    #include <xen/interface/io/console.h>
>>>>>>>    #include <xen/interface/io/ring.h>
>>>>>>>    
>>>>>>> +#include <asm/xen/hypercall.h>
>>>>>>> +
>>>>>>>    DECLARE_GLOBAL_DATA_PTR;
>>>>>>>    
>>>>>>>    u32 console_evtchn;
>>>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>>>>>>>    	.flags			= DM_FLAG_PRE_RELOC,
>>>>>>>    };
>>>>>>>    
>>>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
>>>>>>> +static inline void _debug_uart_init(void) {}
>>>>>>> +
>>>>>>> +static inline void _debug_uart_putc(int c)
>>>>>>> +{
>>>>>>> +#if CONFIG_IS_ENABLED(ARM)
>>>>>>> +	xen_debug_putc(c);
>>>>>>> +#else
>>>>>>> +	/* the type cast should work on LE only */
>>>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>>> An error occurs during compilation:
>>>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
>>>>>> this
>>>>>> function); did you mean ?c??
>>>>>>           HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>> Ah, yes. You're now using x86, right?
>>>> No, I just tried different options and accidentally discovered this
>>>> error.
>>> No?
>>> My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
>>> you have no chance of building "else" clause unless you use x86.
>> The question here is that if x86 is selected it won't compile. Another
>>
>> question if we tested that with x86: no, we didn't. The reason we tried x86
>>
>> part was that HYPERVISOR_console_io is a generic definition for all the platforms,
>>
>> so it was natural to try that as a way to debug things.
> Anastasiia said, "No, I just tried different options."
> Instead of different options, you tried modified code.
>
>>> Anyway,
>>>
>>>>> So what happens if you have made the fix above?
>>>>> Does it work in your environment?
>>>>> (I have confirmed that HYPERVISOR_console_io version works on
>>>>> arm(64).)
>>>> Unfortunately, nothing happened (there are no logs mentioned earlier).
>>> 1. Have you ever executed HYPERVISOR_console_io on your platform before?
>> Yes, we did that. You may have noticed that in [1] which I referred earlier
>> and the problems we faced with that.
> Okay. Since I started to play with Xen just a few weeks ago,
> I actually don't know the past discussions at all.

So, this is why I provided you with a link to previous discussion we had on

Xen development list: that was with respect to console_io and D-cache maintenance.

That was actually the reason we didn't put debug console as a part of the initial

submission.

>
> So the issue you have mentioned has been fixed, hasn't it?

No, why? It is all defined in Xen ARM's ABI and u-boot must take care of it on its end

as it violates the ABI before the MMU is on.

> Even if so, you must have submitted your patch in June or later
> this year.
Hm...
>
> Anastasiia said that she had used xen 4.13(+?) to test my code.
> So obviously, there will be no chance that you patch be merged
> in her test environment.

Ok, once again. This is about the ABI which is stable. Do you think more recent Xen

broke something?

>
>>> 2. If possible, please try to my code on qemu, as my patch intended, so that
>>>      we can determine if your issue is generic or specific on your environment?
>> The code runs on two different platforms with the same result (non-QEMU though).
> Please check on qemu with the latest Xen so that, as I said, we can
> determine if the issue is platform or environment (including a difference
> of version used) specific or not.
> I believe that it is quite easy for you to run U-Boot on qemu.

Well, I have probably missed something, but you neither mentioned you are running

under QEMU (my apologies if this is not true) nor you have provided the exact configuration

of your setup, e.g. QEMU's command line, what is used as a root fs etc. so one interested

in the topic can actually reproduce your setup.

Thank you,

Oleksandr

>
> -Takahiro Akashi
>
>> Thank you,
>>
>> Oleksandr
>>
>>> Thanks,
>>> -Takahiro Akashi
>>>
>>>
>>>> Regards,
>>>> Anastasiia
>>>>> Thanks,
>>>>> -Takahiro Akashi
>>>>>
>>>>>
>>>>>>> +#endif
>>>>>>> +}
>>>>>>> +
>>>>>>> +DEBUG_UART_FUNCS
>>>>>>> +
>>>>>>> +#endif
>>>>>> Regards,
>>>>>> Anastasiia
>> [1] https://urldefense.com/v3/__https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html__;!!GF_29dbcQIUBPA!lbY6WN0YDxFiqUvVTZI8ZkwzoiY08y_oHciOZ7lrUxxpdo-aX37PHDwcSwc3Mb_7uRivJJpP0A$ [lists[.]xenproject[.]org]

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  7:10                 ` takahiro.akashi at linaro.org
@ 2020-10-26  7:30                   ` Oleksandr Andrushchenko
  2020-10-26  8:03                     ` takahiro.akashi at linaro.org
  0 siblings, 1 reply; 35+ messages in thread
From: Oleksandr Andrushchenko @ 2020-10-26  7:30 UTC (permalink / raw)
  To: u-boot


On 10/26/20 9:10 AM, takahiro.akashi at linaro.org wrote:
> On Mon, Oct 26, 2020 at 06:54:29AM +0000, Oleksandr Andrushchenko wrote:
>> On 10/26/20 8:50 AM, takahiro.akashi at linaro.org wrote:
>>> On Mon, Oct 26, 2020 at 06:18:08AM +0000, Oleksandr Andrushchenko wrote:
>>>> Hi,
>>>>
>>>> On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
>>>>> On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
>>>>>> Hello,
>>>>>>
>>>>>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
>>>>>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
>>>>>>> wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
>>>>>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
>>>>>>>>> This will allow us to see messages even earlier than
>>>>>>>>> serial_init().
>>>>>>>>>
>>>>>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>>>>>> ---
>>>>>>>>>     drivers/serial/Kconfig      | 14 +++++++++++---
>>>>>>>>>     drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>>>>>>>>>     2 files changed, 31 insertions(+), 3 deletions(-)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>>>>>>>> index e344677f91f6..536cf0641773 100644
>>>>>>>>> --- a/drivers/serial/Kconfig
>>>>>>>>> +++ b/drivers/serial/Kconfig
>>>>>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>>>>>>>>>     	  driver will be available until the real driver model serial
>>>>>>>>> is
>>>>>>>>>     	  running.
>>>>>>>>>     
>>>>>>>>> +config DEBUG_UART_XEN
>>>>>>>>> +	bool "XEN Hypervisor Console"
>>>>>>>>> +	depends on XEN_SERIAL
>>>>>>>>> +	help
>>>>>>>>> +	  Select this to enable a debug UART using the serial_xen
>>>>>>>>> driver. You
>>>>>>>>> +	  will not have to provide any parameters to make this work.
>>>>>>>>> The driver
>>>>>>>>> +          will be available until the real driver-model serial
>>>>>>>>> is
>>>>>>>>> running.
>>>>>>>>> +
>>>>>>>>>     endchoice
>>>>>>>>>     
>>>>>>>>>     config DEBUG_UART_BASE
>>>>>>>>>     	hex "Base address of UART"
>>>>>>>>> -	depends on DEBUG_UART
>>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>>>     	default 0 if DEBUG_UART_SANDBOX
>>>>>>>>>     	help
>>>>>>>>>     	  This is the base address of your UART for memory-mapped
>>>>>>>>> UARTs.
>>>>>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
>>>>>>>>>     
>>>>>>>>>     config DEBUG_UART_CLOCK
>>>>>>>>>     	int "UART input clock"
>>>>>>>>> -	depends on DEBUG_UART
>>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>>>     	default 0 if DEBUG_UART_SANDBOX
>>>>>>>>>     	help
>>>>>>>>>     	  The UART input clock determines the speed of the internal
>>>>>>>>> UART
>>>>>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
>>>>>>>>>     
>>>>>>>>>     config DEBUG_UART_SHIFT
>>>>>>>>>     	int "UART register shift"
>>>>>>>>> -	depends on DEBUG_UART
>>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>>>     	default 0 if DEBUG_UART
>>>>>>>>>     	help
>>>>>>>>>     	  Some UARTs (notably ns16550) support different register
>>>>>>>>> layouts
>>>>>>>>> diff --git a/drivers/serial/serial_xen.c
>>>>>>>>> b/drivers/serial/serial_xen.c
>>>>>>>>> index ed191829f059..34c90ece40fc 100644
>>>>>>>>> --- a/drivers/serial/serial_xen.c
>>>>>>>>> +++ b/drivers/serial/serial_xen.c
>>>>>>>>> @@ -5,6 +5,7 @@
>>>>>>>>>      */
>>>>>>>>>     #include <common.h>
>>>>>>>>>     #include <cpu_func.h>
>>>>>>>>> +#include <debug_uart.h>
>>>>>>>>>     #include <dm.h>
>>>>>>>>>     #include <serial.h>
>>>>>>>>>     #include <watchdog.h>
>>>>>>>>> @@ -15,11 +16,14 @@
>>>>>>>>>     #include <xen/events.h>
>>>>>>>>>     
>>>>>>>>>     #include <xen/interface/sched.h>
>>>>>>>>> +#include <xen/interface/xen.h>
>>>>>>>>>     #include <xen/interface/hvm/hvm_op.h>
>>>>>>>>>     #include <xen/interface/hvm/params.h>
>>>>>>>>>     #include <xen/interface/io/console.h>
>>>>>>>>>     #include <xen/interface/io/ring.h>
>>>>>>>>>     
>>>>>>>>> +#include <asm/xen/hypercall.h>
>>>>>>>>> +
>>>>>>>>>     DECLARE_GLOBAL_DATA_PTR;
>>>>>>>>>     
>>>>>>>>>     u32 console_evtchn;
>>>>>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>>>>>>>>>     	.flags			= DM_FLAG_PRE_RELOC,
>>>>>>>>>     };
>>>>>>>>>     
>>>>>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
>>>>>>>>> +static inline void _debug_uart_init(void) {}
>>>>>>>>> +
>>>>>>>>> +static inline void _debug_uart_putc(int c)
>>>>>>>>> +{
>>>>>>>>> +#if CONFIG_IS_ENABLED(ARM)
>>>>>>>>> +	xen_debug_putc(c);
>>>>>>>>> +#else
>>>>>>>>> +	/* the type cast should work on LE only */
>>>>>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>>>>> An error occurs during compilation:
>>>>>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
>>>>>>>> this
>>>>>>>> function); did you mean ?c??
>>>>>>>>            HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>>>> Ah, yes. You're now using x86, right?
>>>>>> No, I just tried different options and accidentally discovered this
>>>>>> error.
>>>>> No?
>>>>> My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
>>>>> you have no chance of building "else" clause unless you use x86.
>>>> The question here is that if x86 is selected it won't compile. Another
>>>>
>>>> question if we tested that with x86: no, we didn't. The reason we tried x86
>>>>
>>>> part was that HYPERVISOR_console_io is a generic definition for all the platforms,
>>>>
>>>> so it was natural to try that as a way to debug things.
>>> Anastasiia said, "No, I just tried different options."
>>> Instead of different options, you tried modified code.
>> That was to debug why the original code didn't work, I see nothing wrong
>>
>> in that she tried helping you to figure out why...
> I really appreciate your assistance here.

We are really interested in what you do as we didn't have enough cycles to do the same

at the time of the initial submission. And we can help testing that on 2 different

HW platforms: Renesas and iMX8. Also, Xen devel community and us will be glad to

help you with this

>
> But without knowing the detailed environment on your side, it may sometimes
> be difficult to find out the root cause.

I believe this part must be platform agnostic, e.g. it should work the same way

on any platform

>
>>>>> Anyway,
>>>>>
>>>>>>> So what happens if you have made the fix above?
>>>>>>> Does it work in your environment?
>>>>>>> (I have confirmed that HYPERVISOR_console_io version works on
>>>>>>> arm(64).)
>>>>>> Unfortunately, nothing happened (there are no logs mentioned earlier).
>>>>> 1. Have you ever executed HYPERVISOR_console_io on your platform before?
>>>> Yes, we did that. You may have noticed that in [1] which I referred earlier
>>>> and the problems we faced with that.
>>> Okay. Since I started to play with Xen just a few weeks ago,
>>> I actually don't know the past discussions at all.
>>>
>>> So the issue you have mentioned has been fixed, hasn't it?
> Please confirm this.

Xen ARM ABI is stable for a long time now, so it is confirmed as not related

to possible code changes, but ABI violation on u-boot side before the MMU is on

(this is basically where we need debug console most of the time).

>
>>> Even if so, you must have submitted your patch in June or later
>>> this year.
>>>
>>> Anastasiia said that she had used xen 4.13(+?) to test my code.
>>> So obviously, there will be no chance that you patch be merged
>>> in her test environment.
>>>
>>>>> 2. If possible, please try to my code on qemu, as my patch intended, so that
>>>>>       we can determine if your issue is generic or specific on your environment?
>>>> The code runs on two different platforms with the same result (non-QEMU though).
>>> Please check on qemu with the latest Xen so that, as I said, we can
>>> determine if the issue is platform or environment (including a difference
>>> of version used) specific or not.
>>> I believe that it is quite easy for you to run U-Boot on qemu.
> Please try this first. I believe that it is the first step to take.
Please provide the exact environment you use, so we can have the same on our side
>
> Since I don't have any real hardwrare at this moment,
> it will be difficult for me to dig into the issue
> unless it can be reproduced on qemu.

Understand you and as I said above we can help testing this on real HW

Thank you,

Oleksandr

>
> Thanks,
> -Takahiro Akashi
>
>
>>> -Takahiro Akashi
>>>
>>>> Thank you,
>>>>
>>>> Oleksandr
>>>>
>>>>> Thanks,
>>>>> -Takahiro Akashi
>>>>>
>>>>>
>>>>>> Regards,
>>>>>> Anastasiia
>>>>>>> Thanks,
>>>>>>> -Takahiro Akashi
>>>>>>>
>>>>>>>
>>>>>>>>> +#endif
>>>>>>>>> +}
>>>>>>>>> +
>>>>>>>>> +DEBUG_UART_FUNCS
>>>>>>>>> +
>>>>>>>>> +#endif
>>>>>>>> Regards,
>>>>>>>> Anastasiia
>>>> [1] https://urldefense.com/v3/__https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html__;!!GF_29dbcQIUBPA!lbY6WN0YDxFiqUvVTZI8ZkwzoiY08y_oHciOZ7lrUxxpdo-aX37PHDwcSwc3Mb_7uRivJJpP0A$ [lists[.]xenproject[.]org]

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  7:30                   ` Oleksandr Andrushchenko
@ 2020-10-26  8:03                     ` takahiro.akashi at linaro.org
  2020-10-26  8:19                       ` Oleksandr Andrushchenko
  0 siblings, 1 reply; 35+ messages in thread
From: takahiro.akashi at linaro.org @ 2020-10-26  8:03 UTC (permalink / raw)
  To: u-boot

Oleksandr,

It seems that we now stand on the same page.

On Mon, Oct 26, 2020 at 07:30:06AM +0000, Oleksandr Andrushchenko wrote:
> 
> On 10/26/20 9:10 AM, takahiro.akashi at linaro.org wrote:
> > On Mon, Oct 26, 2020 at 06:54:29AM +0000, Oleksandr Andrushchenko wrote:
> >> On 10/26/20 8:50 AM, takahiro.akashi at linaro.org wrote:
> >>> On Mon, Oct 26, 2020 at 06:18:08AM +0000, Oleksandr Andrushchenko wrote:
> >>>> Hi,
> >>>>
> >>>> On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
> >>>>> On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
> >>>>>> Hello,
> >>>>>>
> >>>>>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
> >>>>>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
> >>>>>>> wrote:
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
> >>>>>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
> >>>>>>>>> This will allow us to see messages even earlier than
> >>>>>>>>> serial_init().
> >>>>>>>>>
> >>>>>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >>>>>>>>> ---
> >>>>>>>>>     drivers/serial/Kconfig      | 14 +++++++++++---
> >>>>>>>>>     drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
> >>>>>>>>>     2 files changed, 31 insertions(+), 3 deletions(-)
> >>>>>>>>>
> >>>>>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> >>>>>>>>> index e344677f91f6..536cf0641773 100644
> >>>>>>>>> --- a/drivers/serial/Kconfig
> >>>>>>>>> +++ b/drivers/serial/Kconfig
> >>>>>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
> >>>>>>>>>     	  driver will be available until the real driver model serial
> >>>>>>>>> is
> >>>>>>>>>     	  running.
> >>>>>>>>>     
> >>>>>>>>> +config DEBUG_UART_XEN
> >>>>>>>>> +	bool "XEN Hypervisor Console"
> >>>>>>>>> +	depends on XEN_SERIAL
> >>>>>>>>> +	help
> >>>>>>>>> +	  Select this to enable a debug UART using the serial_xen
> >>>>>>>>> driver. You
> >>>>>>>>> +	  will not have to provide any parameters to make this work.
> >>>>>>>>> The driver
> >>>>>>>>> +          will be available until the real driver-model serial
> >>>>>>>>> is
> >>>>>>>>> running.
> >>>>>>>>> +
> >>>>>>>>>     endchoice
> >>>>>>>>>     
> >>>>>>>>>     config DEBUG_UART_BASE
> >>>>>>>>>     	hex "Base address of UART"
> >>>>>>>>> -	depends on DEBUG_UART
> >>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>>>>>     	default 0 if DEBUG_UART_SANDBOX
> >>>>>>>>>     	help
> >>>>>>>>>     	  This is the base address of your UART for memory-mapped
> >>>>>>>>> UARTs.
> >>>>>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
> >>>>>>>>>     
> >>>>>>>>>     config DEBUG_UART_CLOCK
> >>>>>>>>>     	int "UART input clock"
> >>>>>>>>> -	depends on DEBUG_UART
> >>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>>>>>     	default 0 if DEBUG_UART_SANDBOX
> >>>>>>>>>     	help
> >>>>>>>>>     	  The UART input clock determines the speed of the internal
> >>>>>>>>> UART
> >>>>>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
> >>>>>>>>>     
> >>>>>>>>>     config DEBUG_UART_SHIFT
> >>>>>>>>>     	int "UART register shift"
> >>>>>>>>> -	depends on DEBUG_UART
> >>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
> >>>>>>>>>     	default 0 if DEBUG_UART
> >>>>>>>>>     	help
> >>>>>>>>>     	  Some UARTs (notably ns16550) support different register
> >>>>>>>>> layouts
> >>>>>>>>> diff --git a/drivers/serial/serial_xen.c
> >>>>>>>>> b/drivers/serial/serial_xen.c
> >>>>>>>>> index ed191829f059..34c90ece40fc 100644
> >>>>>>>>> --- a/drivers/serial/serial_xen.c
> >>>>>>>>> +++ b/drivers/serial/serial_xen.c
> >>>>>>>>> @@ -5,6 +5,7 @@
> >>>>>>>>>      */
> >>>>>>>>>     #include <common.h>
> >>>>>>>>>     #include <cpu_func.h>
> >>>>>>>>> +#include <debug_uart.h>
> >>>>>>>>>     #include <dm.h>
> >>>>>>>>>     #include <serial.h>
> >>>>>>>>>     #include <watchdog.h>
> >>>>>>>>> @@ -15,11 +16,14 @@
> >>>>>>>>>     #include <xen/events.h>
> >>>>>>>>>     
> >>>>>>>>>     #include <xen/interface/sched.h>
> >>>>>>>>> +#include <xen/interface/xen.h>
> >>>>>>>>>     #include <xen/interface/hvm/hvm_op.h>
> >>>>>>>>>     #include <xen/interface/hvm/params.h>
> >>>>>>>>>     #include <xen/interface/io/console.h>
> >>>>>>>>>     #include <xen/interface/io/ring.h>
> >>>>>>>>>     
> >>>>>>>>> +#include <asm/xen/hypercall.h>
> >>>>>>>>> +
> >>>>>>>>>     DECLARE_GLOBAL_DATA_PTR;
> >>>>>>>>>     
> >>>>>>>>>     u32 console_evtchn;
> >>>>>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
> >>>>>>>>>     	.flags			= DM_FLAG_PRE_RELOC,
> >>>>>>>>>     };
> >>>>>>>>>     
> >>>>>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
> >>>>>>>>> +static inline void _debug_uart_init(void) {}
> >>>>>>>>> +
> >>>>>>>>> +static inline void _debug_uart_putc(int c)
> >>>>>>>>> +{
> >>>>>>>>> +#if CONFIG_IS_ENABLED(ARM)
> >>>>>>>>> +	xen_debug_putc(c);
> >>>>>>>>> +#else
> >>>>>>>>> +	/* the type cast should work on LE only */
> >>>>>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> >>>>>>>> An error occurs during compilation:
> >>>>>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
> >>>>>>>> this
> >>>>>>>> function); did you mean ?c??
> >>>>>>>>            HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
> >>>>>>> Ah, yes. You're now using x86, right?
> >>>>>> No, I just tried different options and accidentally discovered this
> >>>>>> error.
> >>>>> No?
> >>>>> My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
> >>>>> you have no chance of building "else" clause unless you use x86.
> >>>> The question here is that if x86 is selected it won't compile. Another
> >>>>
> >>>> question if we tested that with x86: no, we didn't. The reason we tried x86
> >>>>
> >>>> part was that HYPERVISOR_console_io is a generic definition for all the platforms,
> >>>>
> >>>> so it was natural to try that as a way to debug things.
> >>> Anastasiia said, "No, I just tried different options."
> >>> Instead of different options, you tried modified code.
> >> That was to debug why the original code didn't work, I see nothing wrong
> >>
> >> in that she tried helping you to figure out why...
> > I really appreciate your assistance here.
> 
> We are really interested in what you do as we didn't have enough cycles to do the same
> at the time of the initial submission. And we can help testing that on 2 different
> HW platforms: Renesas and iMX8. Also, Xen devel community and us will be glad to
> help you with this

Thank you again.

> >
> > But without knowing the detailed environment on your side, it may sometimes
> > be difficult to find out the root cause.
> 
> I believe this part must be platform agnostic, e.g. it should work the same way
> 
> on any platform

Of course, agree.

> >
> >>>>> Anyway,
> >>>>>
> >>>>>>> So what happens if you have made the fix above?
> >>>>>>> Does it work in your environment?
> >>>>>>> (I have confirmed that HYPERVISOR_console_io version works on
> >>>>>>> arm(64).)
> >>>>>> Unfortunately, nothing happened (there are no logs mentioned earlier).
> >>>>> 1. Have you ever executed HYPERVISOR_console_io on your platform before?
> >>>> Yes, we did that. You may have noticed that in [1] which I referred earlier
> >>>> and the problems we faced with that.
> >>> Okay. Since I started to play with Xen just a few weeks ago,
> >>> I actually don't know the past discussions at all.
> >>>
> >>> So the issue you have mentioned has been fixed, hasn't it?
> > Please confirm this.
> 
> Xen ARM ABI is stable for a long time now, so it is confirmed as not related
> to possible code changes, but ABI violation on u-boot side before the MMU is on
> (this is basically where we need debug console most of the time).

Still I'm a bit confused.

After all, HYPERBVISOR_console_io doesn't work yet on arm/arm64,
at least, in an early boot stage of U-Boot.

Is this the right understanding about current HYPERVISOR_console_io support?

> >
> >>> Even if so, you must have submitted your patch in June or later
> >>> this year.
> >>>
> >>> Anastasiia said that she had used xen 4.13(+?) to test my code.
> >>> So obviously, there will be no chance that you patch be merged
> >>> in her test environment.
> >>>
> >>>>> 2. If possible, please try to my code on qemu, as my patch intended, so that
> >>>>>       we can determine if your issue is generic or specific on your environment?
> >>>> The code runs on two different platforms with the same result (non-QEMU though).
> >>> Please check on qemu with the latest Xen so that, as I said, we can
> >>> determine if the issue is platform or environment (including a difference
> >>> of version used) specific or not.
> >>> I believe that it is quite easy for you to run U-Boot on qemu.
> > Please try this first. I believe that it is the first step to take.
> Please provide the exact environment you use, so we can have the same on our side

host: debian 20.04
qemu: debian's qemu (4.2.1) or my own build (of 5.1.0)

qemu cmd params:
        -serial mon:stdio -nographic -boot menu=on
        -machine virt,gic-version=3,virtualization=on,secure=on
        -cpu cortex-a57 -smp 2 -m 4G -d unimp
        ... (misc virtio disks)
        -rtc base=utc
        -bios /path/to/rom.bin
        (I use tf-a + u-boot to boot xen+debian.)

xen: upstream 4.15+ (25849c8b16f2 "xen/rpi4: implement watchdog-based reset")
     with default configuration (maybe adding "#undef NDEBUG")
xen boot params:
        sync_console dom0_mem=2G loglvl=all guest_loglvl=all

dom0: debian testing (as of Oct 5th?) + my own built xen/xentools (see above)

u-boot: upstream v2020.10 (or pre-v2021.01-rc1) + my patch
     with xenguest_arm64_defconfig + CONFIG_DEBUG_UART
          (+ misc configurations)
domU config:
        kernel = "/boot/u-boot.bin"
        memory = 128
        vcpus = 1

Please let me know if you need more information.

Thanks,
-Takahiro Akashi

> >
> > Since I don't have any real hardwrare at this moment,
> > it will be difficult for me to dig into the issue
> > unless it can be reproduced on qemu.
> 
> Understand you and as I said above we can help testing this on real HW
> 
> Thank you,
> 
> Oleksandr
> 
> >
> > Thanks,
> > -Takahiro Akashi
> >
> >
> >>> -Takahiro Akashi
> >>>
> >>>> Thank you,
> >>>>
> >>>> Oleksandr
> >>>>
> >>>>> Thanks,
> >>>>> -Takahiro Akashi
> >>>>>
> >>>>>
> >>>>>> Regards,
> >>>>>> Anastasiia
> >>>>>>> Thanks,
> >>>>>>> -Takahiro Akashi
> >>>>>>>
> >>>>>>>
> >>>>>>>>> +#endif
> >>>>>>>>> +}
> >>>>>>>>> +
> >>>>>>>>> +DEBUG_UART_FUNCS
> >>>>>>>>> +
> >>>>>>>>> +#endif
> >>>>>>>> Regards,
> >>>>>>>> Anastasiia
> >>>> [1] https://urldefense.com/v3/__https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html__;!!GF_29dbcQIUBPA!lbY6WN0YDxFiqUvVTZI8ZkwzoiY08y_oHciOZ7lrUxxpdo-aX37PHDwcSwc3Mb_7uRivJJpP0A$ [lists[.]xenproject[.]org]

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

* [PATCH 4/4] serial: serial_xen: add DEBUG_UART support
  2020-10-26  8:03                     ` takahiro.akashi at linaro.org
@ 2020-10-26  8:19                       ` Oleksandr Andrushchenko
  0 siblings, 0 replies; 35+ messages in thread
From: Oleksandr Andrushchenko @ 2020-10-26  8:19 UTC (permalink / raw)
  To: u-boot


On 10/26/20 10:03 AM, takahiro.akashi at linaro.org wrote:
> Oleksandr,
>
> It seems that we now stand on the same page.
Great, hope all together we can make it happen
>
> On Mon, Oct 26, 2020 at 07:30:06AM +0000, Oleksandr Andrushchenko wrote:
>> On 10/26/20 9:10 AM, takahiro.akashi at linaro.org wrote:
>>> On Mon, Oct 26, 2020 at 06:54:29AM +0000, Oleksandr Andrushchenko wrote:
>>>> On 10/26/20 8:50 AM, takahiro.akashi at linaro.org wrote:
>>>>> On Mon, Oct 26, 2020 at 06:18:08AM +0000, Oleksandr Andrushchenko wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On 10/26/20 7:58 AM, takahiro.akashi at linaro.org wrote:
>>>>>>> On Fri, Oct 23, 2020 at 08:50:56AM +0000, Anastasiia Lukianenko wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> On Thu, 2020-10-22 at 18:53 +0900, takahiro.akashi at linaro.org wrote:
>>>>>>>>> On Thu, Oct 22, 2020 at 09:19:41AM +0000, Anastasiia Lukianenko
>>>>>>>>> wrote:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> On Thu, 2020-10-15 at 13:25 +0900, AKASHI Takahiro wrote:
>>>>>>>>>>> By using a hypervisor call, we can implement DEBUG_UART on xen.
>>>>>>>>>>> This will allow us to see messages even earlier than
>>>>>>>>>>> serial_init().
>>>>>>>>>>>
>>>>>>>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>>>>>>>> ---
>>>>>>>>>>>      drivers/serial/Kconfig      | 14 +++++++++++---
>>>>>>>>>>>      drivers/serial/serial_xen.c | 20 ++++++++++++++++++++
>>>>>>>>>>>      2 files changed, 31 insertions(+), 3 deletions(-)
>>>>>>>>>>>
>>>>>>>>>>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>>>>>>>>>>> index e344677f91f6..536cf0641773 100644
>>>>>>>>>>> --- a/drivers/serial/Kconfig
>>>>>>>>>>> +++ b/drivers/serial/Kconfig
>>>>>>>>>>> @@ -401,11 +401,19 @@ config DEBUG_UART_MTK
>>>>>>>>>>>      	  driver will be available until the real driver model serial
>>>>>>>>>>> is
>>>>>>>>>>>      	  running.
>>>>>>>>>>>      
>>>>>>>>>>> +config DEBUG_UART_XEN
>>>>>>>>>>> +	bool "XEN Hypervisor Console"
>>>>>>>>>>> +	depends on XEN_SERIAL
>>>>>>>>>>> +	help
>>>>>>>>>>> +	  Select this to enable a debug UART using the serial_xen
>>>>>>>>>>> driver. You
>>>>>>>>>>> +	  will not have to provide any parameters to make this work.
>>>>>>>>>>> The driver
>>>>>>>>>>> +          will be available until the real driver-model serial
>>>>>>>>>>> is
>>>>>>>>>>> running.
>>>>>>>>>>> +
>>>>>>>>>>>      endchoice
>>>>>>>>>>>      
>>>>>>>>>>>      config DEBUG_UART_BASE
>>>>>>>>>>>      	hex "Base address of UART"
>>>>>>>>>>> -	depends on DEBUG_UART
>>>>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>>>>>      	default 0 if DEBUG_UART_SANDBOX
>>>>>>>>>>>      	help
>>>>>>>>>>>      	  This is the base address of your UART for memory-mapped
>>>>>>>>>>> UARTs.
>>>>>>>>>>> @@ -415,7 +423,7 @@ config DEBUG_UART_BASE
>>>>>>>>>>>      
>>>>>>>>>>>      config DEBUG_UART_CLOCK
>>>>>>>>>>>      	int "UART input clock"
>>>>>>>>>>> -	depends on DEBUG_UART
>>>>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>>>>>      	default 0 if DEBUG_UART_SANDBOX
>>>>>>>>>>>      	help
>>>>>>>>>>>      	  The UART input clock determines the speed of the internal
>>>>>>>>>>> UART
>>>>>>>>>>> @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK
>>>>>>>>>>>      
>>>>>>>>>>>      config DEBUG_UART_SHIFT
>>>>>>>>>>>      	int "UART register shift"
>>>>>>>>>>> -	depends on DEBUG_UART
>>>>>>>>>>> +	depends on DEBUG_UART && !DEBUG_UART_XEN
>>>>>>>>>>>      	default 0 if DEBUG_UART
>>>>>>>>>>>      	help
>>>>>>>>>>>      	  Some UARTs (notably ns16550) support different register
>>>>>>>>>>> layouts
>>>>>>>>>>> diff --git a/drivers/serial/serial_xen.c
>>>>>>>>>>> b/drivers/serial/serial_xen.c
>>>>>>>>>>> index ed191829f059..34c90ece40fc 100644
>>>>>>>>>>> --- a/drivers/serial/serial_xen.c
>>>>>>>>>>> +++ b/drivers/serial/serial_xen.c
>>>>>>>>>>> @@ -5,6 +5,7 @@
>>>>>>>>>>>       */
>>>>>>>>>>>      #include <common.h>
>>>>>>>>>>>      #include <cpu_func.h>
>>>>>>>>>>> +#include <debug_uart.h>
>>>>>>>>>>>      #include <dm.h>
>>>>>>>>>>>      #include <serial.h>
>>>>>>>>>>>      #include <watchdog.h>
>>>>>>>>>>> @@ -15,11 +16,14 @@
>>>>>>>>>>>      #include <xen/events.h>
>>>>>>>>>>>      
>>>>>>>>>>>      #include <xen/interface/sched.h>
>>>>>>>>>>> +#include <xen/interface/xen.h>
>>>>>>>>>>>      #include <xen/interface/hvm/hvm_op.h>
>>>>>>>>>>>      #include <xen/interface/hvm/params.h>
>>>>>>>>>>>      #include <xen/interface/io/console.h>
>>>>>>>>>>>      #include <xen/interface/io/ring.h>
>>>>>>>>>>>      
>>>>>>>>>>> +#include <asm/xen/hypercall.h>
>>>>>>>>>>> +
>>>>>>>>>>>      DECLARE_GLOBAL_DATA_PTR;
>>>>>>>>>>>      
>>>>>>>>>>>      u32 console_evtchn;
>>>>>>>>>>> @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = {
>>>>>>>>>>>      	.flags			= DM_FLAG_PRE_RELOC,
>>>>>>>>>>>      };
>>>>>>>>>>>      
>>>>>>>>>>> +#if defined(CONFIG_DEBUG_UART_XEN)
>>>>>>>>>>> +static inline void _debug_uart_init(void) {}
>>>>>>>>>>> +
>>>>>>>>>>> +static inline void _debug_uart_putc(int c)
>>>>>>>>>>> +{
>>>>>>>>>>> +#if CONFIG_IS_ENABLED(ARM)
>>>>>>>>>>> +	xen_debug_putc(c);
>>>>>>>>>>> +#else
>>>>>>>>>>> +	/* the type cast should work on LE only */
>>>>>>>>>>> +	HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>>>>>>> An error occurs during compilation:
>>>>>>>>>> drivers/serial/serial_xen.c: error: ?ch? undeclared (first use in
>>>>>>>>>> this
>>>>>>>>>> function); did you mean ?c??
>>>>>>>>>>             HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch);
>>>>>>>>> Ah, yes. You're now using x86, right?
>>>>>>>> No, I just tried different options and accidentally discovered this
>>>>>>>> error.
>>>>>>> No?
>>>>>>> My code is protected with "if CONFIG_IS_ENABLED(ARM)", and so
>>>>>>> you have no chance of building "else" clause unless you use x86.
>>>>>> The question here is that if x86 is selected it won't compile. Another
>>>>>>
>>>>>> question if we tested that with x86: no, we didn't. The reason we tried x86
>>>>>>
>>>>>> part was that HYPERVISOR_console_io is a generic definition for all the platforms,
>>>>>>
>>>>>> so it was natural to try that as a way to debug things.
>>>>> Anastasiia said, "No, I just tried different options."
>>>>> Instead of different options, you tried modified code.
>>>> That was to debug why the original code didn't work, I see nothing wrong
>>>>
>>>> in that she tried helping you to figure out why...
>>> I really appreciate your assistance here.
>> We are really interested in what you do as we didn't have enough cycles to do the same
>> at the time of the initial submission. And we can help testing that on 2 different
>> HW platforms: Renesas and iMX8. Also, Xen devel community and us will be glad to
>> help you with this
> Thank you again.
>
>>> But without knowing the detailed environment on your side, it may sometimes
>>> be difficult to find out the root cause.
>> I believe this part must be platform agnostic, e.g. it should work the same way
>>
>> on any platform
> Of course, agree.
>
>>>>>>> Anyway,
>>>>>>>
>>>>>>>>> So what happens if you have made the fix above?
>>>>>>>>> Does it work in your environment?
>>>>>>>>> (I have confirmed that HYPERVISOR_console_io version works on
>>>>>>>>> arm(64).)
>>>>>>>> Unfortunately, nothing happened (there are no logs mentioned earlier).
>>>>>>> 1. Have you ever executed HYPERVISOR_console_io on your platform before?
>>>>>> Yes, we did that. You may have noticed that in [1] which I referred earlier
>>>>>> and the problems we faced with that.
>>>>> Okay. Since I started to play with Xen just a few weeks ago,
>>>>> I actually don't know the past discussions at all.
>>>>>
>>>>> So the issue you have mentioned has been fixed, hasn't it?
>>> Please confirm this.
>> Xen ARM ABI is stable for a long time now, so it is confirmed as not related
>> to possible code changes, but ABI violation on u-boot side before the MMU is on
>> (this is basically where we need debug console most of the time).
> Still I'm a bit confused.
>
> After all, HYPERBVISOR_console_io doesn't work yet on arm/arm64,
> at least, in an early boot stage of U-Boot.
>
> Is this the right understanding about current HYPERVISOR_console_io support?

I do suggest you read [1] for better understanding of the issue we faced with

early debug console. In our setup we, without having debug UART implementation,

use the two following for debugging:

staticvoidxen_serial_putc(constcharc)
{
 ????invalidate_dcache_range((unsignedlong)&c,
 ????????????????(unsignedlong)&c + 1);
 ????(void)HYPERVISOR_console_io(CONSOLEIO_write, 1, (char*)&c);
}
staticvoidxen_serial_puts(constchar*str)
{
intlen = strlen(str);
 ????invalidate_dcache_range((unsignedlong)str,
 ????????????????(unsignedlong)str + len);
 ????(void)HYPERVISOR_console_io(CONSOLEIO_write, len, (char*)str);
}
Please not those invalidate_dcache_range calls. With the above we can see
debug prints way before the DM based serial driver is initialized and MMU is set up
(this is required because of D-cache on ARM).
>
>>>>> Even if so, you must have submitted your patch in June or later
>>>>> this year.
>>>>>
>>>>> Anastasiia said that she had used xen 4.13(+?) to test my code.
>>>>> So obviously, there will be no chance that you patch be merged
>>>>> in her test environment.
>>>>>
>>>>>>> 2. If possible, please try to my code on qemu, as my patch intended, so that
>>>>>>>        we can determine if your issue is generic or specific on your environment?
>>>>>> The code runs on two different platforms with the same result (non-QEMU though).
>>>>> Please check on qemu with the latest Xen so that, as I said, we can
>>>>> determine if the issue is platform or environment (including a difference
>>>>> of version used) specific or not.
>>>>> I believe that it is quite easy for you to run U-Boot on qemu.
>>> Please try this first. I believe that it is the first step to take.
>> Please provide the exact environment you use, so we can have the same on our side
> host: debian 20.04
> qemu: debian's qemu (4.2.1) or my own build (of 5.1.0)
>
> qemu cmd params:
>          -serial mon:stdio -nographic -boot menu=on
>          -machine virt,gic-version=3,virtualization=on,secure=on
>          -cpu cortex-a57 -smp 2 -m 4G -d unimp
>          ... (misc virtio disks)
>          -rtc base=utc
>          -bios /path/to/rom.bin
>          (I use tf-a + u-boot to boot xen+debian.)
>
> xen: upstream 4.15+ (25849c8b16f2 "xen/rpi4: implement watchdog-based reset")
>       with default configuration (maybe adding "#undef NDEBUG")
> xen boot params:
>          sync_console dom0_mem=2G loglvl=all guest_loglvl=all
>
> dom0: debian testing (as of Oct 5th?) + my own built xen/xentools (see above)
>
> u-boot: upstream v2020.10 (or pre-v2021.01-rc1) + my patch
>       with xenguest_arm64_defconfig + CONFIG_DEBUG_UART
>            (+ misc configurations)
> domU config:
>          kernel = "/boot/u-boot.bin"
>          memory = 128
>          vcpus = 1
>
> Please let me know if you need more information.
Thank you
>
> Thanks,
> -Takahiro Akashi

Thank you,

Oleksandr

>
>>> Since I don't have any real hardwrare at this moment,
>>> it will be difficult for me to dig into the issue
>>> unless it can be reproduced on qemu.
>> Understand you and as I said above we can help testing this on real HW
>>
>> Thank you,
>>
>> Oleksandr
>>
>>> Thanks,
>>> -Takahiro Akashi
>>>
>>>
>>>>> -Takahiro Akashi
>>>>>
>>>>>> Thank you,
>>>>>>
>>>>>> Oleksandr
>>>>>>
>>>>>>> Thanks,
>>>>>>> -Takahiro Akashi
>>>>>>>
>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Anastasiia
>>>>>>>>> Thanks,
>>>>>>>>> -Takahiro Akashi
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>> +#endif
>>>>>>>>>>> +}
>>>>>>>>>>> +
>>>>>>>>>>> +DEBUG_UART_FUNCS
>>>>>>>>>>> +
>>>>>>>>>>> +#endif
>>>>>>>>>> Regards,
>>>>>>>>>> Anastasiia
>>>>>> [1] https://urldefense.com/v3/__https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00737.html__;!!GF_29dbcQIUBPA!lbY6WN0YDxFiqUvVTZI8ZkwzoiY08y_oHciOZ7lrUxxpdo-aX37PHDwcSwc3Mb_7uRivJJpP0A$ [lists[.]xenproject[.]org]

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

end of thread, other threads:[~2020-10-26  8:19 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15  4:25 [PATCH 0/4] xen: improve console outputs AKASHI Takahiro
2020-10-15  4:25 ` [PATCH 1/4] serial: serial_xen: print U-Boot banner and others AKASHI Takahiro
2020-10-15  6:51   ` Peng Fan
2020-10-22  9:18   ` Anastasiia Lukianenko
2020-10-22  9:49     ` takahiro.akashi at linaro.org
2020-10-23  8:58       ` Anastasiia Lukianenko
2020-10-23  0:30   ` Tom Rini
2020-10-15  4:25 ` [PATCH 2/4] arch: arm/xen: add putc() for debugging AKASHI Takahiro
2020-10-15  6:52   ` Peng Fan
2020-10-23  0:31   ` Tom Rini
2020-10-15  4:25 ` [PATCH 3/4] xen: add definitions for console_io AKASHI Takahiro
2020-10-15  6:52   ` Peng Fan
2020-10-23  0:31   ` Tom Rini
2020-10-15  4:25 ` [PATCH 4/4] serial: serial_xen: add DEBUG_UART support AKASHI Takahiro
2020-10-15  6:50   ` Peng Fan
2020-10-22  9:19   ` Anastasiia Lukianenko
2020-10-22  9:53     ` takahiro.akashi at linaro.org
2020-10-23  8:50       ` Anastasiia Lukianenko
2020-10-26  5:58         ` takahiro.akashi at linaro.org
2020-10-26  6:18           ` Oleksandr Andrushchenko
2020-10-26  6:50             ` takahiro.akashi at linaro.org
2020-10-26  6:54               ` Oleksandr Andrushchenko
2020-10-26  7:10                 ` takahiro.akashi at linaro.org
2020-10-26  7:30                   ` Oleksandr Andrushchenko
2020-10-26  8:03                     ` takahiro.akashi at linaro.org
2020-10-26  8:19                       ` Oleksandr Andrushchenko
2020-10-26  7:16               ` Oleksandr Andrushchenko
2020-10-23  8:53       ` Anastasiia Lukianenko
2020-10-26  6:02         ` takahiro.akashi at linaro.org
2020-10-26  6:12           ` Oleksandr Andrushchenko
2020-10-23  0:31   ` Tom Rini
2020-10-23  9:22     ` Anastasiia Lukianenko
2020-10-23 12:34       ` Tom Rini
2020-10-23 13:06         ` Anastasiia Lukianenko
2020-10-23 13:18           ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.