video: bochs: Remove the x86 limitation
Subsystems (2)
cover video: bochs: Remove the x86 limitation
The Bochs VGA card emulated by QEMU does not enforce any architecture. It was first introduced on x86 and indeed the x86 IO instruction is used to access the legacy VGA IO ports, but that does not mean it has to be done like this.
The first half of this series enhances the bochs video driver to remove the x86 limitation.
The second half of this series enables bochs video as the output console for QEMU RISC-V, to prove that the bochs video driver can indeed work on a non-x86 architecture. To make it actually useful, enable a usb keyboard as well, otherwise we can't just type anything :-)
This series is available at u-boot-x86/bochs for testing.
Bin Meng (17):
dm: video: Cosmetic style fix
video: bochs: Drop inclusion of <asm/mtrr.h>
video: bochs: Drop the useless argument of bochs_vga_write()
video: bochs: Avoid using IO instructions to access VGA IO port
video: bochs: Remove the x86 dependency
video: kconfig: Fix wrong text for the PCI default FB size
video: kconfig: Drop the superfluous dependency
video: kconfig: Set default FB size for Bochs
video: bochs: Set the frame buffer size per configuration
riscv: qemu: Enable Bochs video support
console: kconfig: Drop the redundant VIDEO dependency
console: Make stdio_print_current_devices() static
console: Refactor stdio_print_current_devices() a little bit
console: Print out complete stdio device list
riscv: qemu: Enable PRE_CONSOLE_BUFFER
riscv: qemu: Remove out-of-date "riscv,kernel-start" handling
riscv: qemu: Enable usb keyboard as an input device
Heinrich Schuchardt (1):
riscv: define a cache line size for the generic CPU
arch/riscv/cpu/generic/Kconfig | 1 + board/emulation/qemu-riscv/Kconfig | 13 ++++++++ board/emulation/qemu-riscv/qemu-riscv.c | 27 +++------------ common/Kconfig | 2 +- common/console.c | 44 ++++++++++++++++--------- doc/board/emulation/qemu-riscv.rst | 10 ++++++ drivers/video/Kconfig | 15 +++++---- drivers/video/bochs.c | 12 +++---- drivers/video/bochs.h | 7 ++-- drivers/video/video-uclass.c | 6 ++-- include/configs/qemu-riscv.h | 15 +++------ include/stdio_dev.h | 2 -- 12 files changed, 84 insertions(+), 70 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/18 dm: video: Cosmetic style fix
Some coding convention fixes for video_post_bind().
---
drivers/video/video-uclass.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/video/video-uclass.c +4 -2
@@ -626,10 +626,12 @@ static int video_post_bind(struct udevice *dev) addr = uc_priv->video_ptr; size =alloc_fb (dev, &addr);if (addr < gd->video_bottom) { -/* Device tree node may need the 'bootph-all' or +/* +* Device tree node may need the 'bootph-all' or * 'bootph-some-ram' tag */ -printf ("Video device '%s' cannot allocate frame buffer memory -ensure the device is set up before relocation\n" , +printf ("Video device '%s' cannot allocate frame buffer memory " +"- ensure the device is set up before relocation\n" , dev->name);return -ENOSPC ; }
Signature · 1 line
2.34.1
Re: [PATCH 01/18] dm: video: Cosmetic style fix
Quoted 8 lines · Bin Meng
Some coding convention fixes for
video_post_bind().Signed-off-by Bin Meng <[email protected]>---
drivers/video/video-uclass.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Re: [PATCH 01/18] dm: video: Cosmetic style fix
In reply to Bin MengQuoted 7 lines · On Sun, 23 Jul 2023 12:40:24 +0800 Bin Meng [email protected] wrote:
Some coding convention fixes for
video_post_bind().Signed-off-by Bin Meng <[email protected]>---
drivers/video/video-uclass.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 2/18 video: bochs: Drop inclusion of <asm/mtrr.h>
In reply to Bin MengThe driver does not call any MTRR APIs.
---
drivers/video/bochs.c | 1 - 1 file changed, 1 deletion(-)
drivers/video/bochs.c +0 -1
@@ -11,7 +11,6 @@#include <pci.h> #include <video.h> #include <asm/io.h> -#include <asm/mtrr.h> #include <linux/sizes.h> #include "bochs.h"
Signature · 1 line
2.34.1
Re: [PATCH 02/18] video: bochs: Drop inclusion of <asm/mtrr.h>
Quoted 9 lines · Bin Meng
The driver does not call any MTRR APIs.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 1 - 1 file changed, 1 deletion(-)
Re: [PATCH 02/18] video: bochs: Drop inclusion of <asm/mtrr.h>
In reply to Bin MengQuoted 7 lines · On Sun, 23 Jul 2023 12:40:25 +0800 Bin Meng [email protected] wrote:
The driver does not call any MTRR APIs.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 1 - 1 file changed, 1 deletion(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 3/18 video: bochs: Drop the useless argument of bochs_vga_write()
In reply to Bin Mengbochs_vga_write() takes 'index' as one argument, but never uses it.
While we are here, use macros instead of magic numbers for the VGA IO port register name and value.
---
drivers/video/bochs.c | 7 ++++--- drivers/video/bochs.h | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/video/bochs.c +4 -3
@@ -27,9 +27,9 @@ static int bochs_read(void *mmio, int index)return readw (mmio +MMIO_BASE + index *2 ); } -static void bochs_vga_write (int index,uint8_t val) +static void bochs_vga_write (uint8_t val) { -outb (val,VGA_INDEX ); +outb (val,VGA_ATT_W ); }static int bochs_init_fb (struct udevice *dev)
@@ -78,7 +78,8 @@ static int bochs_init_fb(struct udevice *dev)bochs_write (mmio,INDEX_Y_OFFSET ,0 );bochs_write (mmio,INDEX_ENABLE ,ENABLED |LFB_ENABLED ); -bochs_vga_write (0 ,0x20 );/* disable blanking */ +/* disable blanking */ +bochs_vga_write (VGA_AR_ENABLE_DISPLAY ); plat->base = fb;
drivers/video/bochs.h +4 -1
@@ -6,7 +6,10 @@#ifndef __BOCHS_H#define __BOCHS_H -#define VGA_INDEX 0x3c0 +#define VGA_INDEX 0x3c0 + +#define VGA_ATT_W 0x3c0 +#define VGA_AR_ENABLE_DISPLAY 0x20#define IOPORT_INDEX 0x01ce#define IOPORT_DATA 0x01cf
Signature · 1 line
2.34.1
Re: [PATCH 03/18] video: bochs: Drop the useless argument of bochs_vga_write()
Quoted 6 lines · Bin Meng
bochs_vga_write()takes 'index' as one argument, but never uses it.While we are here, use macros instead of magic numbers for the VGA IO port register name and value.
Quoted 6 lines
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 7 ++++--- drivers/video/bochs.h | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
Re: [PATCH 03/18] video: bochs: Drop the useless argument of bochs_vga_write()
In reply to Bin MengQuoted 11 lines · On Sun, 23 Jul 2023 12:40:26 +0800 Bin Meng [email protected] wrote:
bochs_vga_write()takes 'index' as one argument, but never uses it.While we are here, use macros instead of magic numbers for the VGA IO port register name and value.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 7 ++++--- drivers/video/bochs.h | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 4/18 video: bochs: Avoid using IO instructions to access VGA IO port
In reply to Bin MengAt present the driver uses IO instructions to access the legacy VGA IO ports, which unfortunately limits the driver to work only on x86. It turns out the IO instruction is not necessary as Bochs VGA card remaps the legacy VGA IO ports (0x3c0 -> 0x3df) to its memory mapped register space from offset 0x400.
Update the driver to use MMIO access for VGA IO port.
---
drivers/video/bochs.c | 6 +++--- drivers/video/bochs.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/video/bochs.c +3 -3
@@ -27,9 +27,9 @@ static int bochs_read(void *mmio, int index)return readw (mmio +MMIO_BASE + index *2 ); } -static void bochs_vga_write (uint8_t val) +static void bochs_vga_write (void *mmio,int index,uint8_t val) { -outb (val,VGA_ATT_W ); +writeb (val, mmio +VGA_BASE + index); }static int bochs_init_fb (struct udevice *dev)
@@ -79,7 +79,7 @@ static int bochs_init_fb(struct udevice *dev)bochs_write (mmio,INDEX_ENABLE ,ENABLED |LFB_ENABLED );/* disable blanking */ -bochs_vga_write (VGA_AR_ENABLE_DISPLAY ); +bochs_vga_write (mmio,VGA_ATT_W -VGA_INDEX ,VGA_AR_ENABLE_DISPLAY ); plat->base = fb;
drivers/video/bochs.h +1 -3
@@ -11,9 +11,6 @@#define VGA_ATT_W 0x3c0#define VGA_AR_ENABLE_DISPLAY 0x20 -#define IOPORT_INDEX 0x01ce -#define IOPORT_DATA 0x01cf -enum {INDEX_ID ,INDEX_XRES ,
@@ -34,6 +31,7 @@ enum {#define LFB_ENABLED BIT(6)#define NOCLEARMEM BIT(7) +#define VGA_BASE 0x400#define MMIO_BASE 0x500#endif
Signature · 1 line
2.34.1
Re: [PATCH 04/18] video: bochs: Avoid using IO instructions to access VGA IO port
Quoted 7 lines · Bin Meng
At present the driver uses IO instructions to access the legacy VGA IO ports, which unfortunately limits the driver to work only on x86. It turns out the IO instruction is not necessary as Bochs VGA card remaps the legacy VGA IO ports (
0x3c0->0x3df) to its memory mapped register space from offset0x400.
Quoted 9 lines
Update the driver to use MMIO access for VGA IO port.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 6 +++--- drivers/video/bochs.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-)
Re: [PATCH 04/18] video: bochs: Avoid using IO instructions to access VGA IO port
In reply to Bin MengQuoted 6 lines · On Sun, 23 Jul 2023 12:40:27 +0800 Bin Meng [email protected] wrote:
At present the driver uses IO instructions to access the legacy VGA IO ports, which unfortunately limits the driver to work only on x86. It turns out the IO instruction is not necessary as Bochs VGA card remaps the legacy VGA IO ports (
0x3c0->0x3df) to its memory mapped register space from offset0x400.
Quoted 8 lines
Update the driver to use MMIO access for VGA IO port.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 6 +++--- drivers/video/bochs.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 5/18 video: bochs: Remove the x86 dependency
In reply to Bin MengNow that the driver is legacy free, remove the x86 dependency so that it can be used on non-x86 architectures.
---
drivers/video/Kconfig | 1 - 1 file changed, 1 deletion(-)
drivers/video/Kconfig +0 -1
@@ -280,7 +280,6 @@ config VIDCONSOLE_AS_NAME config VIDEO_BOCHS bool "Enable Bochs video emulation for QEMU" - depends on X86 help Enable this to use the Bochs video support provided in the QEMU emulator. This appears as a PCI device which U-Boot can set up to
Signature · 1 line
2.34.1
Re: [PATCH 05/18] video: bochs: Remove the x86 dependency
Quoted 10 lines · Bin Meng
Now that the driver is legacy free, remove the x86 dependency so that it can be used on non-x86 architectures.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 1 - 1 file changed, 1 deletion(-)
Re: [PATCH 05/18] video: bochs: Remove the x86 dependency
In reply to Bin MengQuoted 8 lines · On Sun, 23 Jul 2023 12:40:28 +0800 Bin Meng [email protected] wrote:
Now that the driver is legacy free, remove the x86 dependency so that it can be used on non-x86 architectures.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 1 - 1 file changed, 1 deletion(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 6/18 video: kconfig: Fix wrong text for the PCI default FB size
In reply to Bin MengThere is an example in the VIDEO_PCI_DEFAULT_FB_SIZE help text to tell people how to calculate its value but the resolution given does not match the value. Fix it.
---
drivers/video/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/Kconfig +2 -2
@@ -77,7 +77,7 @@ config VIDEO_PCI_DEFAULT_FB_SIZE devices to have a framebuffer allocated by U-Boot. Note: the framebuffer needs to be large enough to store all pixels at - maximum resolution. For example, at 1920 x 1200 with 32 bits per + maximum resolution. For example, at 2560 x 1600 with 32 bits per pixel, 2560 * 1600 * 32 / 8 = 0xfa0000 bytes are needed. config VIDEO_COPY
@@ -1049,7 +1049,7 @@ config SPL_VIDEO_PCI_DEFAULT_FB_SIZE devices to have a framebuffer allocated by U-Boot. Note: the framebuffer needs to be large enough to store all pixels at - maximum resolution. For example, at 1920 x 1200 with 32 bits per + maximum resolution. For example, at 2560 x 1600 with 32 bits per pixel, 2560 * 1600 * 32 / 8 = 0xfa0000 bytes are needed. config SPL_CONSOLE_SCROLL_LINES
Signature · 1 line
2.34.1
Re: [PATCH 06/18] video: kconfig: Fix wrong text for the PCI default FB size
Quoted 10 lines · Bin Meng
There is an example in the
VIDEO_PCI_DEFAULT_FB_SIZEhelp text to tell people how to calculate its value but the resolution given does not match the value. Fix it.Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 06/18] video: kconfig: Fix wrong text for the PCI default FB size
In reply to Bin MengQuoted 9 lines · On Sun, 23 Jul 2023 12:40:29 +0800 Bin Meng [email protected] wrote:
There is an example in the
VIDEO_PCI_DEFAULT_FB_SIZEhelp text to tell people how to calculate its value but the resolution given does not match the value. Fix it.Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 7/18 video: kconfig: Drop the superfluous dependency
In reply to Bin MengPCI is always selected by X86 architecture hence "X86 && PCI" does not make it better.
---
drivers/video/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/Kconfig +4 -4
@@ -64,8 +64,8 @@ config BACKLIGHT config VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it" - default 0x1000000 if X86 && PCI - default 0 if !(X86 && PCI) + default 0x1000000 if X86 + default 0 if !X86 help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in
@@ -1036,8 +1036,8 @@ config SPL_SYS_WHITE_ON_BLACK config SPL_VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it at SPL" - default 0x1000000 if X86 && PCI - default 0 if !(X86 && PCI) + default 0x1000000 if X86 + default 0 if !X86 help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in
Signature · 1 line
2.34.1
Re: [PATCH 07/18] video: kconfig: Drop the superfluous dependency
Quoted 9 lines · Bin Meng
PCI is always selected by X86 architecture hence "X86 && PCI" does not make it better.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Re: [PATCH 07/18] video: kconfig: Drop the superfluous dependency
In reply to Bin MengQuoted 8 lines · On Sun, 23 Jul 2023 12:40:30 +0800 Bin Meng [email protected] wrote:
PCI is always selected by X86 architecture hence "X86 && PCI" does not make it better.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 8/18 video: kconfig: Set default FB size for Bochs
In reply to Bin MengSet up a default frame buffer size of 8MiB for Bochs for non-x86 architecturs as PCI is normally not enumerated before relocation on these architectures.
---
drivers/video/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/video/Kconfig +4 -2
@@ -65,7 +65,8 @@ config BACKLIGHT config VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it" default 0x1000000 if X86 - default 0 if !X86 + default 0x800000 if !X86 && VIDEO_BOCHS + default 0 if !X86 && !VIDEO_BOCHS help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in
@@ -1037,7 +1038,8 @@ config SPL_SYS_WHITE_ON_BLACK config SPL_VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it at SPL" default 0x1000000 if X86 - default 0 if !X86 + default 0x800000 if !X86 && VIDEO_BOCHS + default 0 if !X86 && !VIDEO_BOCHS help Generally, video drivers request the amount of memory they need for the frame buffer when they are bound, by setting the size field in
Signature · 1 line
2.34.1
Re: [PATCH 08/18] video: kconfig: Set default FB size for Bochs
Quoted 10 lines · Bin Meng
Set up a default frame buffer size of 8MiB for Bochs for non-x86 architecturs as PCI is normally not enumerated before relocation on these architectures.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Re: [PATCH 08/18] video: kconfig: Set default FB size for Bochs
In reply to Bin MengQuoted 9 lines · On Sun, 23 Jul 2023 12:40:31 +0800 Bin Meng [email protected] wrote:
Set up a default frame buffer size of 8MiB for Bochs for non-x86 architecturs as PCI is normally not enumerated before relocation on these architectures.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 9/18 video: bochs: Set the frame buffer size per configuration
In reply to Bin MengAt present the uclass stored frame buffer size is set to a hard coded value, but we can calculate the correct value based on what is configured.
---
drivers/video/bochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/bochs.c +2 -2
@@ -101,8 +101,8 @@ static int bochs_video_bind(struct udevice *dev) {struct video_uc_plat *uc_plat =dev_get_uclass_plat (dev); -/* Set the maximum supported resolution */ - uc_plat->size =2560 *1600 *4 ; +/* Set the frame buffer size per configuration */ + uc_plat->size = xsize * ysize *32 /8 ;log_debug ("%s: Frame buffer size %x\n" , __func__, uc_plat->size);return 0 ;
Signature · 1 line
2.34.1
Re: [PATCH 09/18] video: bochs: Set the frame buffer size per configuration
Quoted 11 lines · Bin Meng
At present the uclass stored frame buffer size is set to a hard coded value, but we can calculate the correct value based on what is configured.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 09/18] video: bochs: Set the frame buffer size per configuration
In reply to Bin MengQuoted 9 lines · On Sun, 23 Jul 2023 12:40:32 +0800 Bin Meng [email protected] wrote:
At present the uclass stored frame buffer size is set to a hard coded value, but we can calculate the correct value based on what is configured.
Signed-off-by Bin Meng <[email protected]>---
drivers/video/bochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
applied to u-boot-video/master, thanks!
--
Anatolij
PATCH 10/18 riscv: qemu: Enable Bochs video support
In reply to Bin MengEnable video console using the emulated Bochs VGA card.
---
board/emulation/qemu-riscv/Kconfig | 3 +++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 5 +++++ 3 files changed, 13 insertions(+)
board/emulation/qemu-riscv/Kconfig +3 -0
@@ -68,5 +68,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply MTD_NOR_FLASH imply CFI_FLASH imply OF_HAS_PRIOR_STAGE + imply VIDEO + imply VIDEO_BOCHS + imply SYS_WHITE_ON_BLACK endif
doc/board/emulation/qemu-riscv.rst +5 -0
@@ -133,6 +133,11 @@ An attached disk can be emulated in RISC-V virt machine by adding:: You will have to run 'scsi scan' to use it. +A video console can be emulated in RISC-V virt machine by removing "-nographic" +and adding:: + + -serial stdio -device VGA + Running with KVM ----------------
include/configs/qemu-riscv.h +5 -0
@@ -17,6 +17,10 @@/* Environment options */ +#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0" +#define BOOT_TARGET_DEVICES (func) \ func(QEMU, qemu, na) \ func(VIRTIO, virtio, 0) \
@@ -35,6 +39,7 @@ "qemu "#define CFG_EXTRA_ENV_SETTINGS \ + CFG_STD_DEVICES_SETTINGS \ "fdt_high=0xffffffffffffffff\0" \ "initrd_high=0xffffffffffffffff\0" \ "kernel_addr_r=0x84000000\0" \
Signature · 1 line
2.34.1
Re: [PATCH 10/18] riscv: qemu: Enable Bochs video support
Quoted 10 lines · Bin Meng
Enable video console using the emulated Bochs VGA card.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 3 +++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 5 +++++ 3 files changed, 13 insertions(+)
How about a series to move this over to txt environment?
PATCH 11/18 console: kconfig: Drop the redundant VIDEO dependency
In reply to Bin MengThe VIDEO dependency is described twice in CONSOLE_MUX.
---
common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/Kconfig +1 -1
@@ -226,7 +226,7 @@ config CONSOLE_FLUSH_SUPPORT config CONSOLE_MUX bool "Enable console multiplexing" - default y if VIDEO || VIDEO || LCD + default y if VIDEO || LCD help This allows multiple devices to be used for each console 'file'. For example, stdout can be set to go to serial and video.
Signature · 1 line
2.34.1
Re: [PATCH 11/18] console: kconfig: Drop the redundant VIDEO dependency
Quoted 3 lines · Bin Meng
The VIDEO dependency is described twice in
CONSOLE_MUX.Signed-off-by Bin Meng <[email protected]>
Quoted 18 lines
---
common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/Kconfig +1
-1@@ -226,7 +226,7 @@ config CONSOLE_FLUSH_SUPPORT config CONSOLE_MUX bool "Enable console multiplexing" - default y if VIDEO || VIDEO || LCD + default y if VIDEO || LCD help This allows multiple devices to be used for each console 'file'. For example, stdout can be set to go to serial and video.
Simon Glass
Reviewed-byRe: [PATCH 11/18] console: kconfig: Drop the redundant VIDEO dependency
Quoted 12 lines · Heinrich Schuchardt
Quoted 3 lines · Bin Meng
The VIDEO dependency is described twice in
CONSOLE_MUX.Signed-off-by Bin Meng <[email protected]>Reviewed-by Heinrich Schuchardt <[email protected]>Quoted 4 lines
---
common/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 12/18 console: Make stdio_print_current_devices() static
In reply to Bin MengAs it is only called in common/console.c
---
common/console.c | 2 +- include/stdio_dev.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
common/console.c +1 -1
@@ -1010,7 +1010,7 @@ int console_init_f(void)return 0 ; } -void stdio_print_current_devices (void ) +static void stdio_print_current_devices (void ) {/* Print information */ puts ("In: " );
include/stdio_dev.h +0 -2
@@ -84,8 +84,6 @@ int stdio_init_tables(void);*/ int stdio_add_devices (void ); -void stdio_print_current_devices (void ); -/** * stdio_deregister_dev() - deregister the device "devname". *
Signature · 1 line
2.34.1
Re: [PATCH 12/18] console: Make stdio_print_current_devices() static
Quoted 10 lines · Bin Meng
As it is only called in
common/console.cSigned-off-by Bin Meng <[email protected]>---
common/console.c | 2 +- include/stdio_dev.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
PATCH 13/18 console: Refactor stdio_print_current_devices() a little bit
In reply to Bin MengIn preparation to future changes, refactor this routine a little bit.
---
common/console.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
common/console.c +15 -15
@@ -1012,27 +1012,27 @@ int console_init_f(void)static void stdio_print_current_devices (void ) { +char *stdinname, *stdoutname, *stderrname; + + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ; + stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; +/* Print information */ puts ("In: " ); -if (stdio_devices[stdin] ==NULL ) { -puts ("No input devices available!\n" ); - }else { -printf ("%s\n" , stdio_devices[stdin]->name); - } +printf ("%s\n" , stdinname);puts ("Out: " ); -if (stdio_devices[stdout] ==NULL ) { -puts ("No output devices available!\n" ); - }else { -printf ("%s\n" , stdio_devices[stdout]->name); - } +printf ("%s\n" , stdoutname);puts ("Err: " ); -if (stdio_devices[stderr] ==NULL ) { -puts ("No error devices available!\n" ); - }else { -printf ("%s\n" , stdio_devices[stderr]->name); - } +printf ("%s\n" , stderrname); }#if CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )
Signature · 1 line
2.34.1
Re: [PATCH 13/18] console: Refactor stdio_print_current_devices() a little bit
Quoted 14 lines · Bin Meng
In preparation to future changes, refactor this routine a little bit.
Signed-off-by Bin Meng <[email protected]>---
common/console.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)common/console.c +0
-0@@ -1012,27 +1012,27 @@ int console_init_f(void)
common/console.c int console_init_f(void) · line 1022
Quoted 10 lines
common/console.c +8
-0static void stdio_print_current_devices (void ) { +char *stdinname, *stdoutname, *stderrname; + + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ;
This string will never be printed as you have no output device.
Best regards
Heinrich
Quoted 31 lines
common/console.c +7
-15+ stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; +/* Print information */ puts ("In: " ); -if (stdio_devices[stdin] ==NULL ) { -puts ("No input devices available!\n" ); - }else { -printf ("%s\n" , stdio_devices[stdin]->name); - } +printf ("%s\n" , stdinname);puts ("Out: " ); -if (stdio_devices[stdout] ==NULL ) { -puts ("No output devices available!\n" ); - }else { -printf ("%s\n" , stdio_devices[stdout]->name); - } +printf ("%s\n" , stdoutname);puts ("Err: " ); -if (stdio_devices[stderr] ==NULL ) { -puts ("No error devices available!\n" ); - }else { -printf ("%s\n" , stdio_devices[stderr]->name); - } +printf ("%s\n" , stderrname); }#if CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )
PATCH 14/18 console: Print out complete stdio device list
In reply to Bin MengAt present if both CONSOLE_MUX and SYS_CONSOLE_IS_IN_ENV are on, during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.
For such case, we can print out the stdio device name from the environment variables.
---
common/console.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
common/console.c +21 -9
@@ -1014,15 +1014,27 @@ static void stdio_print_current_devices(void) {char *stdinname, *stdoutname, *stderrname; - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : -"No input devices available!" ; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : -"No output devices available!" ; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name : -"No error devices available!" ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX ) && +CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )) { +/* stdin stdout and stderr are in environment */ + stdinname =env_get ("stdin" ); + stdoutname =env_get ("stdout" ); + stderrname =env_get ("stderr" ); + + stdinname = stdinname ? :"No input devices available!" ; + stdoutname = stdoutname ? :"No output devices available!" ; + stderrname = stderrname ? :"No error devices available!" ; + }else { + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ; + stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; + }/* Print information */ puts ("In: " );
Signature · 1 line
2.34.1
Re: [PATCH 14/18] console: Print out complete stdio device list
Quoted 29 lines · Bin Meng
At present if both
CONSOLE_MUXandSYS_CONSOLE_IS_IN_ENVare on, during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.For such case, we can print out the stdio device name from the environment variables.
Signed-off-by Bin Meng <[email protected]>---
common/console.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)common/console.c +0
-8@@ -1014,15 +1014,27 @@ static void stdio_print_current_devices(void) {char *stdinname, *stdoutname, *stderrname; - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : -"No input devices available!" ; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : -"No output devices available!" ; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name :
common/console.c static void stdio_print_current_devices(void) · line 1025
Quoted 10 lines
common/console.c +9
-1-"No error devices available!" ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX ) && +CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )) { +/* stdin stdout and stderr are in environment */ + stdinname =env_get ("stdin" ); + stdoutname =env_get ("stdout" ); + stderrname =env_get ("stderr" ); + + stdinname = stdinname ? :"No input devices available!" ; + stdoutname = stdoutname ? :"No output devices available!" ;
This string will never be printed as you have no output device.
common/console.c static void stdio_print_current_devices(void) · line 1033
Quoted 8 lines
common/console.c +8
-0+ stderrname = stderrname ? :"No error devices available!" ; + }else { + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ;
ditto
common/console.c static void stdio_print_current_devices(void) · line 1037
Quoted 4 lines
common/console.c +4
-0+ stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; + }
do_coninfo() shows how to print all muxed devices irrespective of SYS_CONSOLE_IS_IN_ENV.
Best regards
Heinrich
Quoted 3 lines
common/console.c +0
-0/* Print information */ puts ("In: " );
Re: [PATCH 14/18] console: Print out complete stdio device list
Hi Heinrich,
Quoted 35 lines · Heinrich Schuchardt
Quoted 33 lines · Bin Meng
At present if both
CONSOLE_MUXandSYS_CONSOLE_IS_IN_ENVare on, during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.For such case, we can print out the stdio device name from the environment variables.
Signed-off-by Bin Meng <[email protected]>---
common/console.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)common/console.c +3
-9@@ -1014,15 +1014,27 @@ static void stdio_print_current_devices(void) {char *stdinname, *stdoutname, *stderrname; - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : -"No input devices available!" ; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : -"No output devices available!" ; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name : -"No error devices available!" ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX ) && +CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )) { +/* stdin stdout and stderr are in environment */
Quoted 8 lines
common/console.c static void stdio_print_current_devices(void) · line 1025
Quoted 6 lines
common/console.c +6
-0+ stdinname =env_get ("stdin" ); + stdoutname =env_get ("stdout" ); + stderrname =env_get ("stderr" ); + + stdinname = stdinname ? :"No input devices available!" ; + stdoutname = stdoutname ? :"No output devices available!" ;This string will never be printed as you have no output device.
This logic follows what it was before. Yes, without a stdout device, puts() or printf() is useless.
Quoted 12 lines
common/console.c static void stdio_print_current_devices(void) · line 1033
Quoted 9 lines
common/console.c +8
-0+ stderrname = stderrname ? :"No error devices available!" ; + }else { + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ;ditto
Quoted 7 lines
common/console.c static void stdio_print_current_devices(void) · line 1037
Quoted 4 lines
common/console.c +4
-0+ stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; + }
do_coninfo()shows how to print all muxed devices irrespective ofSYS_CONSOLE_IS_IN_ENV.
Are you suggesting we refactor the codes to follow the same logic used in do_coninfo()?
Regards,
Bin
Re: [PATCH 14/18] console: Print out complete stdio device list
Am 23. Juli 2023 14:04:39 MESZ schrieb Bin Meng <[email protected]>:
Quoted 67 lines
Hi Heinrich,
Quoted 35 lines · Heinrich Schuchardt
Quoted 33 lines · Bin Meng
At present if both
CONSOLE_MUXandSYS_CONSOLE_IS_IN_ENVare on, during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.For such case, we can print out the stdio device name from the environment variables.
Signed-off-by Bin Meng <[email protected]>---
common/console.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)common/console.c +3
-9@@ -1014,15 +1014,27 @@ static void stdio_print_current_devices(void) {char *stdinname, *stdoutname, *stderrname; - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : -"No input devices available!" ; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : -"No output devices available!" ; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name : -"No error devices available!" ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX ) && +CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )) { +/* stdin stdout and stderr are in environment */ Quoted 8 lines
common/console.c static void stdio_print_current_devices(void) · line 1025
Quoted 6 lines
common/console.c +6
-0+ stdinname =env_get ("stdin" ); + stdoutname =env_get ("stdout" ); + stderrname =env_get ("stderr" ); + + stdinname = stdinname ? :"No input devices available!" ; + stdoutname = stdoutname ? :"No output devices available!" ;This string will never be printed as you have no output device.
This logic follows what it was before. Yes, without a stdout device,
puts()orprintf()is useless.Quoted 17 lines
common/console.c static void stdio_print_current_devices(void) · line 1033
Quoted 9 lines
common/console.c +8
-0+ stderrname = stderrname ? :"No error devices available!" ; + }else { + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ;ditto
Quoted 4 lines
common/console.c +4
-0+ stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; + }
Quoted 5 lines
Quoted 2 lines
do_coninfo()shows how to print all muxed devices irrespective ofSYS_CONSOLE_IS_IN_ENV.Are you suggesting we refactor the codes to follow the same logic used in
do_coninfo()?
As the coninfo command is enabled on most devices, we could use a common output function to reduce code size.
Do we need this output at all if we hsve coninfo?
Regards
Heinrich
Quoted 3 lines
Regards,
Bin
Re: [PATCH 14/18] console: Print out complete stdio device list
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Am 23. Juli 2023 14:04:39 MESZ schrieb Bin Meng <[email protected]>:
Quoted 70 lines
Hi Heinrich,
Quoted 35 lines · Heinrich Schuchardt
Quoted 33 lines · Bin Meng
At present if both
CONSOLE_MUXandSYS_CONSOLE_IS_IN_ENVare on, during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.For such case, we can print out the stdio device name from the environment variables.
Signed-off-by Bin Meng <[email protected]>---
common/console.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)common/console.c +3
-9@@ -1014,15 +1014,27 @@ static void stdio_print_current_devices(void) {char *stdinname, *stdoutname, *stderrname; - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : -"No input devices available!" ; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : -"No output devices available!" ; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name : -"No error devices available!" ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX ) && +CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )) { +/* stdin stdout and stderr are in environment */ Quoted 8 lines
common/console.c static void stdio_print_current_devices(void) · line 1025
Quoted 6 lines
common/console.c +6
-0+ stdinname =env_get ("stdin" ); + stdoutname =env_get ("stdout" ); + stderrname =env_get ("stderr" ); + + stdinname = stdinname ? :"No input devices available!" ; + stdoutname = stdoutname ? :"No output devices available!" ;This string will never be printed as you have no output device.
This logic follows what it was before. Yes, without a stdout device,
puts()orprintf()is useless.Quoted 19 lines
common/console.c static void stdio_print_current_devices(void) · line 1033
Quoted 9 lines
common/console.c +8
-0+ stderrname = stderrname ? :"No error devices available!" ; + }else { + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ;ditto
common/console.c static void stdio_print_current_devices(void) · line 1037
Quoted 4 lines
common/console.c +4
-0+ stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; + }
do_coninfo()shows how to print all muxed devices irrespective ofSYS_CONSOLE_IS_IN_ENV.
Quoted 6 lines
Quoted 2 lines
Are you suggesting we refactor the codes to follow the same logic used in
do_coninfo()?As the coninfo command is enabled on most devices, we could use a common output function to reduce code size.
Do we need this output at all if we hsve coninfo?
I think so. U-Boot has been displaying the stdio devices for quite a long time. The config option SYS_CONSOLE_INFO_QUIET was introduced for any board who does not want this.
config SYS_CONSOLE_INFO_QUIET
bool "Don't display the console devices on boot"
help
Normally U-Boot displays the current settings for stdout, stdin and stderr on boot when the post-relocation console is set up. Enable this option to suppress this output. It can be obtained by calling stdio_print_current_devices() from board code.
Tom, what's your idea?
Regards,
Bin
Simon Glass
Reviewed-byRe: [PATCH 14/18] console: Print out complete stdio device list
Quoted 97 lines · Bin Meng
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Am 23. Juli 2023 14:04:39 MESZ schrieb Bin Meng <[email protected]>:
Quoted 70 lines
Hi Heinrich,
Quoted 35 lines · Heinrich Schuchardt
Quoted 33 lines · Bin Meng
At present if both
CONSOLE_MUXandSYS_CONSOLE_IS_IN_ENVare on, during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.For such case, we can print out the stdio device name from the environment variables.
Signed-off-by Bin Meng <[email protected]>---
common/console.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)common/console.c +3
-9@@ -1014,15 +1014,27 @@ static void stdio_print_current_devices(void) {char *stdinname, *stdoutname, *stderrname; - stdinname = stdio_devices[stdin] ? - stdio_devices[stdin]->name : -"No input devices available!" ; - stdoutname = stdio_devices[stdout] ? - stdio_devices[stdout]->name : -"No output devices available!" ; - stderrname = stdio_devices[stderr] ? - stdio_devices[stderr]->name : -"No error devices available!" ; +if (CONFIG_IS_ENABLED (CONSOLE_MUX ) && +CONFIG_IS_ENABLED (SYS_CONSOLE_IS_IN_ENV )) { +/* stdin stdout and stderr are in environment */ Quoted 8 lines
common/console.c static void stdio_print_current_devices(void) · line 1025
Quoted 6 lines
common/console.c +6
-0+ stdinname =env_get ("stdin" ); + stdoutname =env_get ("stdout" ); + stderrname =env_get ("stderr" ); + + stdinname = stdinname ? :"No input devices available!" ; + stdoutname = stdoutname ? :"No output devices available!" ;This string will never be printed as you have no output device.
This logic follows what it was before. Yes, without a stdout device,
puts()orprintf()is useless.Quoted 19 lines
common/console.c static void stdio_print_current_devices(void) · line 1033
Quoted 9 lines
common/console.c +8
-0+ stderrname = stderrname ? :"No error devices available!" ; + }else { + stdinname = stdio_devices[stdin] ? + stdio_devices[stdin]->name : +"No input devices available!" ; + stdoutname = stdio_devices[stdout] ? + stdio_devices[stdout]->name : +"No output devices available!" ;ditto
common/console.c static void stdio_print_current_devices(void) · line 1037
Quoted 4 lines
common/console.c +4
-0+ stderrname = stdio_devices[stderr] ? + stdio_devices[stderr]->name : +"No error devices available!" ; + }
do_coninfo()shows how to print all muxed devices irrespective ofSYS_CONSOLE_IS_IN_ENV.Quoted 6 lines
Quoted 2 lines
Are you suggesting we refactor the codes to follow the same logic used in
do_coninfo()?As the coninfo command is enabled on most devices, we could use a common output function to reduce code size.
Do we need this output at all if we hsve coninfo?
I think so. U-Boot has been displaying the stdio devices for quite a long time. The config option
SYS_CONSOLE_INFO_QUIETwas introduced for any board who does not want this.config
SYS_CONSOLE_INFO_QUIET
bool "Don't display the console devices on boot"
help
Normally U-Boot displays the current settings for stdout, stdin and stderr on boot when the post-relocation console is set up. Enable this option to suppress this output. It can be obtained by callingstdio_print_current_devices()from board code.
Quoted 1 line
Tom, what's your idea?
I agree that we should show it, since otherwise it is misleading.
Re: [PATCH 14/18] console: Print out complete stdio device list
In reply to Bin MengQuoted 8 lines · Bin Meng
At present if both
CONSOLE_MUXandSYS_CONSOLE_IS_IN_ENVare on, during boot, the printed out stdio devices are incomplete, e.g.:
with "stdout=serial,vidconsole", only "vidconsole" is printed.For such case, we can print out the stdio device name from the environment variables.
Signed-off-by Bin Meng <[email protected]>
This approach makes sense to me.
Signature · 1 line
Tom
PATCH 15/18 riscv: qemu: Enable PRE_CONSOLE_BUFFER
In reply to Bin MengBy default the video console only outputs messages after it's ready. Messages before that won't show on the video console, but U-Boot has an option to buffer the console messages before it's ready.
Enable this support, and carefully select an address for the buffer.
---
board/emulation/qemu-riscv/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
board/emulation/qemu-riscv/Kconfig +5 -0
@@ -25,6 +25,10 @@ config SPL_OPENSBI_LOAD_ADDR hex default 0x80100000 +config PRE_CON_BUF_ADDR + hex + default 0x81000000 + config BOARD_SPECIFIC_OPTIONS # dummy def_bool y select GENERIC_RISCV
@@ -71,5 +75,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK + imply PRE_CONSOLE_BUFFER endif
Signature · 1 line
2.34.1
A message that is not in the archive (sent off-list or not yet received): SEZPR03MB806449404CFF3CB65A435E52C103A@SEZPR03MB8064.apcprd03.prod.outlook.com
Rick Chen
Reviewed-byRe: [PATCH 15/18] riscv: qemu: Enable PRE_CONSOLE_BUFFER
Quoted 9 lines
From: U-Boot <[email protected]> On Behalf Of Bin Meng
Sent: Sunday, July 23, 2023 12:41 PM
To: Simon Glass <[email protected]>; [email protected]
Cc: Bin Meng <[email protected]>
Subject: [PATCH 15/18] riscv: qemu: EnablePRE_CONSOLE_BUFFERBy default the video console only outputs messages after it's ready.
Messages before that won't show on the video console, but U-Boot has an option to buffer the console messages before it's ready.
Quoted 7 lines
Enable this support, and carefully select an address for the buffer.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
Simon Glass
Reviewed-byRe: [PATCH 15/18] riscv: qemu: Enable PRE_CONSOLE_BUFFER
Quoted 12 lines · Rick Chen
Quoted 12 lines
From: U-Boot <[email protected]> On Behalf Of Bin Meng
Sent: Sunday, July 23, 2023 12:41 PM
To: Simon Glass <[email protected]>; [email protected]
Cc: Bin Meng <[email protected]>
Subject: [PATCH 15/18] riscv: qemu: EnablePRE_CONSOLE_BUFFERBy default the video console only outputs messages after it's ready.
Messages before that won't show on the video console, but U-Boot has an option to buffer the console messages before it's ready.Enable this support, and carefully select an address for the buffer.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)Reviewed-by Rick Chen <[email protected]>
PATCH 16/18 riscv: define a cache line size for the generic CPU
In reply to Bin MengFrom: Heinrich Schuchardt <[email protected]>
The USB 3.0 driver xhci-mem.c requires CONFIG_SYS_CACHELINE_SIZE to be set.
Define the cache line size for QEMU on RISC-V to be 64 bytes.
---
arch/riscv/cpu/generic/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/riscv/cpu/generic/Kconfig +1 -0
@@ -6,6 +6,7 @@ config GENERIC_RISCV bool select BINMAN if SPL select ARCH_EARLY_INIT_R + select SYS_CACHE_SHIFT_6 imply CPU imply CPU_RISCV imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE)
Signature · 1 line
2.34.1
PATCH 17/18 riscv: qemu: Remove out-of-date "riscv, kernel-start" handling
In reply to Bin MengCommit 66ffe57 ("riscv: qemu: detect and boot the kernel passed by QEMU") added some logic to handle "riscv,kernel-start" in DT and stored the address to an environment variable kernel_start.
However this "riscv,kernel-start" has never been an upstream DT binding. The upstream QEMU never generates such a DT either. Presumably U-Boot development was based on a downstream QEMU fork.
Now we drop all codes in commit 66ffe57, except that BOARD_LATE_INIT is kept for later use.
---
board/emulation/qemu-riscv/qemu-riscv.c | 24 ------------------------ include/configs/qemu-riscv.h | 10 ---------- 2 files changed, 34 deletions(-)
board/emulation/qemu-riscv/qemu-riscv.c +0 -24
@@ -41,30 +41,6 @@ int board_init(void)int board_late_init (void ) { -ulong kernel_start; -ofnode chosen_node; -int ret; - - chosen_node =ofnode_path ("/chosen" ); -if (!ofnode_valid (chosen_node)) { -debug ("No chosen node found, can't get kernel start address\n" ); -return 0 ; - } - -#ifdef CONFIG_ARCH_RV64I - ret =ofnode_read_u64 (chosen_node,"riscv,kernel-start" , - (u64 *)&kernel_start); -#else - ret =ofnode_read_u32 (chosen_node,"riscv,kernel-start" , - (u32 *)&kernel_start); -#endif -if (ret) { -debug ("Can't find kernel start address in device tree\n" ); -return 0 ; - } - -env_set_hex ("kernel_start" , kernel_start); -return 0 ; }
include/configs/qemu-riscv.h +0 -10
@@ -22,22 +22,12 @@ "stderr=serial,vidconsole\0"#define BOOT_TARGET_DEVICES (func) \ - func(QEMU, qemu, na) \ func(VIRTIO, virtio, 0) \ func(SCSI, scsi, 0) \ func(DHCP, dhcp, na)#include <config_distro_bootcmd.h> -#define BOOTENV_DEV_QEMU (devtypeu, devtypel, instance) \ - "bootcmd_qemu=" \ - "if env exists kernel_start; then " \ - "bootm ${kernel_start} - ${fdtcontroladdr};" \ - "fi;\0" - -#define BOOTENV_DEV_NAME_QEMU (devtypeu, devtypel, instance) \ - "qemu " -#define CFG_EXTRA_ENV_SETTINGS \ CFG_STD_DEVICES_SETTINGS \ "fdt_high=0xffffffffffffffff\0" \
Signature · 1 line
2.34.1
A message that is not in the archive (sent off-list or not yet received): SEZPR03MB80646AC3947DBFA62D910A47C103A@SEZPR03MB8064.apcprd03.prod.outlook.com
Rick Chen
Reviewed-byRe: [PATCH 17/18] riscv: qemu: Remove out-of-date "riscv, kernel-start" handling
Quoted 11 lines
From: U-Boot <[email protected]> On Behalf Of Bin Meng
Sent: Sunday, July 23, 2023 12:41 PM
To: Simon Glass <[email protected]>; [email protected]
Cc: Bin Meng <[email protected]>
Subject: [PATCH 17/18] riscv: qemu: Remove out-of-date "riscv, kernel-start" handlingCommit 66ffe57 ("riscv: qemu: detect and boot the kernel passed by QEMU") added some logic to handle "riscv,kernel-start" in DT and stored the address to an environment variable
kernel_start.However this "riscv,kernel-start" has never been an upstream DT binding.
The upstream QEMU never generates such a DT either. Presumably U-Boot development was based on a downstream QEMU fork.
Quoted 8 lines
Now we drop all codes in commit 66ffe57, except that
BOARD_LATE_INITis kept for later use.Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/qemu-riscv.c | 24 ------------------------ include/configs/qemu-riscv.h | 10 ---------- 2 files changed, 34 deletions(-)
Simon Glass
Reviewed-byRe: [PATCH 17/18] riscv: qemu: Remove out-of-date "riscv, kernel-start" handling
Quoted 14 lines · Rick Chen
Quoted 14 lines
From: U-Boot <[email protected]> On Behalf Of Bin Meng
Sent: Sunday, July 23, 2023 12:41 PM
To: Simon Glass <[email protected]>; [email protected]
Cc: Bin Meng <[email protected]>
Subject: [PATCH 17/18] riscv: qemu: Remove out-of-date "riscv, kernel-start" handlingCommit 66ffe57 ("riscv: qemu: detect and boot the kernel passed by QEMU") added some logic to handle "riscv,kernel-start" in DT and stored the address to an environment variable
kernel_start.However this "riscv,kernel-start" has never been an upstream DT binding.
The upstream QEMU never generates such a DT either. Presumably U-Boot development was based on a downstream QEMU fork.Now we drop all codes in commit 66ffe57, except that
BOARD_LATE_INITis kept for later use.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/qemu-riscv.c | 24 ------------------------ include/configs/qemu-riscv.h | 10 ---------- 2 files changed, 34 deletions(-)Reviewed-by Rick Chen <[email protected]>
PATCH 18/18 riscv: qemu: Enable usb keyboard as an input device
In reply to Bin MengThis brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)
board/emulation/qemu-riscv/Kconfig +5 -0
@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCI + imply USB_KEYBOARD + imply CMD_USB endif
board/emulation/qemu-riscv/qemu-riscv.c +5 -0
@@ -12,6 +12,7 @@#include <log.h> #include <spl.h> #include <init.h> +#include <usb.h> #include <virtio_types.h> #include <virtio.h>
@@ -41,6 +42,10 @@ int board_init(void)int board_late_init (void ) { +/* start usb so that usb keyboard can be used as input device */ +if (CONFIG_IS_ENABLED (USB_KEYBOARD )) +usb_init (); +return 0 ; }
doc/board/emulation/qemu-riscv.rst +5 -0
@@ -138,6 +138,11 @@ and adding:: -serial stdio -device VGA +In addition, a usb keyboard can be attached to an emulated xHCI controller in +RISC-V virt machine as an option of input devices by adding:: + + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 + Running with KVM ----------------
include/configs/qemu-riscv.h +1 -1
@@ -17,7 +17,7 @@/* Environment options */ -#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ +#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0"
Signature · 1 line
2.34.1
Re: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
Am 23. Juli 2023 06:40:41 MESZ schrieb Bin Meng <[email protected]>:
Quoted 18 lines
This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)board/emulation/qemu-riscv/Kconfig +0
-0
board/emulation/qemu-riscv/Kconfig config BOARD_SPECIFIC_OPTIONS # dummy · line 81
Quoted 6 lines
board/emulation/qemu-riscv/Kconfig +3
-0@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCI
QEMU could alternatively use EHCI or OHCI for the keyboard. Does enabling XHCI add support for these too?
Best regards
Heinrich
Quoted 56 lines
board/emulation/qemu-riscv/Kconfig +2
-0+ imply USB_KEYBOARD + imply CMD_USBendif
board/emulation/qemu-riscv/qemu-riscv.c +5
-0@@ -12,6 +12,7 @@#include <log.h> #include <spl.h> #include <init.h> +#include <usb.h> #include <virtio_types.h> #include <virtio.h> @@ -41,6 +42,10 @@ int board_init(void)int board_late_init (void ) { +/* start usb so that usb keyboard can be used as input device */ +if (CONFIG_IS_ENABLED (USB_KEYBOARD )) +usb_init (); +return 0 ; }doc/board/emulation/qemu-riscv.rst +5
-0@@ -138,6 +138,11 @@ and adding:: -serial stdio -device VGA +In addition, a usb keyboard can be attached to an emulated xHCI controller in +RISC-V virt machine as an option of input devices by adding:: + + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 +Running with KVM
----------------include/configs/qemu-riscv.h +1
-1@@ -17,7 +17,7 @@/* Environment options */ -#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ +#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0"
Re: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
Hi Heinrich,
Quoted 17 lines · Heinrich Schuchardt
Am 23. Juli 2023 06:40:41 MESZ schrieb Bin Meng <[email protected]>:
Quoted 13 lines
This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)
Quoted 13 lines
board/emulation/qemu-riscv/Kconfig config BOARD_SPECIFIC_OPTIONS # dummy · line 81
Quoted 11 lines
board/emulation/qemu-riscv/Kconfig +3
-0@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCIQEMU could alternatively use EHCI or OHCI for the keyboard. Does enabling XHCI add support for these too?
No, EHCI or OHCI support is separate from xHCI. I don't think enabling EHCI or OHCI *by default* brings a lot of value here as xHCI is the latest and greatest and USB keyboard could work with xHCI without any problem.
Regards,
Bin
Re: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
In reply to Bin MengQuoted 44 lines
From: Bin Meng <[email protected]>
Date: Sun, 23 Jul 2023 12:40:41 +0800This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)board/emulation/qemu-riscv/Kconfig +5
-0@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCI + imply USB_KEYBOARD + imply CMD_USB endifboard/emulation/qemu-riscv/qemu-riscv.c +1
-0@@ -12,6 +12,7 @@#include <log.h> #include <spl.h> #include <init.h> +#include <usb.h> #include <virtio_types.h> #include <virtio.h>
board/emulation/qemu-riscv/qemu-riscv.c int board_init(void) · line 48
Quoted 7 lines
board/emulation/qemu-riscv/qemu-riscv.c +4
-0@@ -41,6 +42,10 @@ int board_init(void)int board_late_init (void ) { +/* start usb so that usb keyboard can be used as input device */ +if (CONFIG_IS_ENABLED (USB_KEYBOARD )) +usb_init (); +
This is typically handled by including "usb start" in CONFIG_PREBOOT, which is done by boot/Kconfig. Any reason why that doesn't work for you?
Quoted 36 lines
board/emulation/qemu-riscv/qemu-riscv.c +0
-0return 0 ; }doc/board/emulation/qemu-riscv.rst +5
-0@@ -138,6 +138,11 @@ and adding:: -serial stdio -device VGA +In addition, a usb keyboard can be attached to an emulated xHCI controller in +RISC-V virt machine as an option of input devices by adding:: + + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 + Running with KVM ----------------include/configs/qemu-riscv.h +1
-1@@ -17,7 +17,7 @@/* Environment options */ -#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ +#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0"Signature · 1 line
2.34.1
Re: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
Am 23. Juli 2023 10:38:00 MESZ schrieb Mark Kettenis <[email protected]>:
Quoted 45 lines
Quoted 45 lines
From: Bin Meng <[email protected]>
Date: Sun, 23 Jul 2023 12:40:41 +0800This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)board/emulation/qemu-riscv/Kconfig +5
-0@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCI + imply USB_KEYBOARD + imply CMD_USB endifboard/emulation/qemu-riscv/qemu-riscv.c +1
-0@@ -12,6 +12,7 @@#include <log.h> #include <spl.h> #include <init.h> +#include <usb.h> #include <virtio_types.h> #include <virtio.h> @@ -41,6 +42,10 @@ int board_init(void)
Quoted 10 lines
board/emulation/qemu-riscv/qemu-riscv.c int board_init(void) · line 48
Quoted 6 lines
board/emulation/qemu-riscv/qemu-riscv.c +4
-0int board_late_init (void ) { +/* start usb so that usb keyboard can be used as input device */ +if (CONFIG_IS_ENABLED (USB_KEYBOARD )) +usb_init (); +This is typically handled by including "usb start" in
CONFIG_PREBOOT, which is done by boot/Kconfig. Any reason why that doesn't work for you?
We run pci_init() in board_r.c. Why don't do the same for USB instead of the PREBOOT quirk?
Regards
Heinrich
Quoted 37 lines
Quoted 37 lines
board/emulation/qemu-riscv/qemu-riscv.c +0
-0return 0 ; }doc/board/emulation/qemu-riscv.rst +5
-0@@ -138,6 +138,11 @@ and adding:: -serial stdio -device VGA +In addition, a usb keyboard can be attached to an emulated xHCI controller in +RISC-V virt machine as an option of input devices by adding:: + + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 + Running with KVM ----------------include/configs/qemu-riscv.h +1
-1@@ -17,7 +17,7 @@/* Environment options */ -#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ +#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0"Signature · 1 line
2.34.1
Re: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
Quoted 60 lines
Date: Sun, 23 Jul 2023 11:30:31 +0200
From: Heinrich Schuchardt <[email protected]>Am 23. Juli 2023 10:38:00 MESZ schrieb Mark Kettenis <[email protected]>:
Quoted 45 lines
Quoted 45 lines
From: Bin Meng <[email protected]>
Date: Sun, 23 Jul 2023 12:40:41 +0800This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)board/emulation/qemu-riscv/Kconfig +5
-0@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCI + imply USB_KEYBOARD + imply CMD_USB endifboard/emulation/qemu-riscv/qemu-riscv.c +1
-0@@ -12,6 +12,7 @@#include <log.h> #include <spl.h> #include <init.h> +#include <usb.h> #include <virtio_types.h> #include <virtio.h> @@ -41,6 +42,10 @@ int board_init(void)Quoted 10 lines
board/emulation/qemu-riscv/qemu-riscv.c int board_init(void) · line 48
Quoted 6 lines
board/emulation/qemu-riscv/qemu-riscv.c +4
-0int board_late_init (void ) { +/* start usb so that usb keyboard can be used as input device */ +if (CONFIG_IS_ENABLED (USB_KEYBOARD )) +usb_init (); +This is typically handled by including "usb start" in
CONFIG_PREBOOT, which is done by boot/Kconfig. Any reason why that doesn't work for you?
Quoted 2 lines
We run
pci_init()inboard_r.c. Why don't do the same for USB instead of the PREBOOT quirk?
Well, yes, that was going to be my next question. If using PREBOOT is for some reason no longer the preferred way to do this, should there be some other generic method to make sure the USB controllers are started when a USB keyboard is configured as an input method. Doing something generic like this in board-specific code seems wrong to me.
Cheers,
Mark
Quoted 38 lines
Quoted 37 lines
Quoted 37 lines
board/emulation/qemu-riscv/qemu-riscv.c +0
-0return 0 ; }doc/board/emulation/qemu-riscv.rst +5
-0@@ -138,6 +138,11 @@ and adding:: -serial stdio -device VGA +In addition, a usb keyboard can be attached to an emulated xHCI controller in +RISC-V virt machine as an option of input devices by adding:: + + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 + Running with KVM ----------------include/configs/qemu-riscv.h +1
-1@@ -17,7 +17,7 @@/* Environment options */ -#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ +#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0"Signature · 1 line
2.34.1
Re: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
Quoted 69 lines · Mark Kettenis
Quoted 60 lines
Date: Sun, 23 Jul 2023 11:30:31 +0200
From: Heinrich Schuchardt <[email protected]>Am 23. Juli 2023 10:38:00 MESZ schrieb Mark Kettenis <[email protected]>:
Quoted 45 lines
Quoted 45 lines
From: Bin Meng <[email protected]>
Date: Sun, 23 Jul 2023 12:40:41 +0800This brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)board/emulation/qemu-riscv/Kconfig +5
-0@@ -76,5 +76,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply VIDEO_BOCHS imply SYS_WHITE_ON_BLACK imply PRE_CONSOLE_BUFFER + imply USB + imply USB_XHCI_HCD + imply USB_XHCI_PCI + imply USB_KEYBOARD + imply CMD_USB endifboard/emulation/qemu-riscv/qemu-riscv.c +1
-0@@ -12,6 +12,7 @@#include <log.h> #include <spl.h> #include <init.h> +#include <usb.h> #include <virtio_types.h> #include <virtio.h> @@ -41,6 +42,10 @@ int board_init(void)Quoted 10 lines
board/emulation/qemu-riscv/qemu-riscv.c int board_init(void) · line 48
Quoted 6 lines
board/emulation/qemu-riscv/qemu-riscv.c +4
-0int board_late_init (void ) { +/* start usb so that usb keyboard can be used as input device */ +if (CONFIG_IS_ENABLED (USB_KEYBOARD )) +usb_init (); +This is typically handled by including "usb start" in
CONFIG_PREBOOT, which is done by boot/Kconfig. Any reason why that doesn't work for you?Quoted 2 lines
We run
pci_init()inboard_r.c. Why don't do the same for USB instead of the PREBOOT quirk?Well, yes, that was going to be my next question. If using PREBOOT is for some reason no longer the preferred way to do this, should there be some other generic method to make sure the USB controllers are started when a USB keyboard is configured as an input method. Doing something generic like this in board-specific code seems wrong to me.
Quoted 3 lines
Cheers,
Mark
+CC Marek
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
board/emulation/qemu-riscv/qemu-riscv.c +0
-0return 0 ; }doc/board/emulation/qemu-riscv.rst +5
-0@@ -138,6 +138,11 @@ and adding:: -serial stdio -device VGA +In addition, a usb keyboard can be attached to an emulated xHCI controller in +RISC-V virt machine as an option of input devices by adding:: + + -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 + Running with KVM ----------------include/configs/qemu-riscv.h +1
-2@@ -17,7 +17,7 @@/* Environment options */ -#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \ +#define CFG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0" --2.34.1
A message that is not in the archive (sent off-list or not yet received): SEZPR03MB80643451FB26D109D4606A90C103A@SEZPR03MB8064.apcprd03.prod.outlook.com
Rick Chen
Reviewed-byRe: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
Quoted 10 lines
From: U-Boot <[email protected]> On Behalf Of Bin Meng
Sent: Sunday, July 23, 2023 12:41 PM
To: Simon Glass <[email protected]>; [email protected]
Cc: Bin Meng <[email protected]>; Heinrich Schuchardt <[email protected]>
Subject: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input deviceThis brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>
Quoted 7 lines
---
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)
Simon Glass
Reviewed-byRe: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input device
Quoted 13 lines · Rick Chen
Quoted 13 lines
From: U-Boot <[email protected]> On Behalf Of Bin Meng
Sent: Sunday, July 23, 2023 12:41 PM
To: Simon Glass <[email protected]>; [email protected]
Cc: Bin Meng <[email protected]>; Heinrich Schuchardt <[email protected]>
Subject: [PATCH 18/18] riscv: qemu: Enable usb keyboard as an input deviceThis brings PCI xHCI support to QEMU RISC-V and uses a usb keyboard as one of the input devices.
Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 5 lines
board/emulation/qemu-riscv/Kconfig | 5 +++++ board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++ doc/board/emulation/qemu-riscv.rst | 5 +++++ include/configs/qemu-riscv.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-)Reviewed-by Rick Chen <[email protected]>
Hi Rick,
Quoted 27 lines · Bin Meng
The Bochs VGA card emulated by QEMU does not enforce any architecture. It was first introduced on x86 and indeed the x86 IO instruction is used to access the legacy VGA IO ports, but that does not mean it has to be done like this.
The first half of this series enhances the bochs video driver to remove the x86 limitation.
The second half of this series enables bochs video as the output console for QEMU RISC-V, to prove that the bochs video driver can indeed work on a non-x86 architecture. To make it actually useful, enable a usb keyboard as well, otherwise we can't just type anything :-)
This series is available at u-boot-x86/bochs for testing.
Bin Meng (17):
dm: video: Cosmetic style fix
video: bochs: Drop inclusion of <asm/mtrr.h>
video: bochs: Drop the useless argument ofbochs_vga_write()
video: bochs: Avoid using IO instructions to access VGA IO port
video: bochs: Remove the x86 dependency
video: kconfig: Fix wrong text for the PCI default FB size
video: kconfig: Drop the superfluous dependency
video: kconfig: Set default FB size for Bochs
video: bochs: Set the frame buffer size per configuration
Quoted 8 lines
riscv: qemu: Enable Bochs video support
console: kconfig: Drop the redundant VIDEO dependency
console: Makestdio_print_current_devices()static
console: Refactorstdio_print_current_devices()a little bit
console: Print out complete stdio device list
riscv: qemu: EnablePRE_CONSOLE_BUFFER
riscv: qemu: Remove out-of-date "riscv,kernel-start" handling
riscv: qemu: Enable usb keyboard as an input device
Would you please review patch 10, 15, 17, 18? Thanks!
Regards,
Bin
Quoted 28 lines · Bin Meng
Quoted 27 lines
The Bochs VGA card emulated by QEMU does not enforce any architecture. It was first introduced on x86 and indeed the x86 IO instruction is used to access the legacy VGA IO ports, but that does not mean it has to be done like this.
The first half of this series enhances the bochs video driver to remove the x86 limitation.
The second half of this series enables bochs video as the output console for QEMU RISC-V, to prove that the bochs video driver can indeed work on a non-x86 architecture. To make it actually useful, enable a usb keyboard as well, otherwise we can't just type anything :-)
This series is available at u-boot-x86/bochs for testing.
Bin Meng (17):
dm: video: Cosmetic style fix
video: bochs: Drop inclusion of <asm/mtrr.h>
video: bochs: Drop the useless argument ofbochs_vga_write()
video: bochs: Avoid using IO instructions to access VGA IO port
video: bochs: Remove the x86 dependency
video: kconfig: Fix wrong text for the PCI default FB size
video: kconfig: Drop the superfluous dependency
video: kconfig: Set default FB size for Bochs
video: bochs: Set the frame buffer size per configuration
Quoted 9 lines
Quoted 8 lines
riscv: qemu: Enable Bochs video support
console: kconfig: Drop the redundant VIDEO dependency
console: Makestdio_print_current_devices()static
console: Refactorstdio_print_current_devices()a little bit
console: Print out complete stdio device list
riscv: qemu: EnablePRE_CONSOLE_BUFFER
riscv: qemu: Remove out-of-date "riscv,kernel-start" handling
riscv: qemu: Enable usb keyboard as an input device
Looks the first half is assigned to Anatolij and the second half to Rick.
I guess the first half should go first.
Ping for apply?
Regards,
Bin
Hi Bin,
On Mon, 31 Jul 2023 13:26:23 +0800
Bin Meng [email protected] wrote:
...
Quoted 5 lines
Looks the first half is assigned to Anatolij and the second half to Rick.
I guess the first half should go first.
Ping for apply?
I've applied patches 1/18 to 9/18 now, a pull request is pending.
--
Anatolij
Quoted 6 lines · Anatolij Gustschin
Hi Bin,
On Mon, 31 Jul 2023 13:26:23 +0800
Bin Meng [email protected] wrote:
...
Quoted 8 lines
Quoted 5 lines
Looks the first half is assigned to Anatolij and the second half to Rick.
I guess the first half should go first.
Ping for apply?
I've applied patches 1/18 to 9/18 now, a pull request is pending.
Thank you Anatolij.
Regards,
Bin