[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 0/1] [RISC-V] replace SBI early console with 8250 UART



On Mon, Sep 28, 2026 at 11:31:06AM +0200, Oleksii Kurochko wrote:
> 
> 
> On 9/28/26 10:40 AM, Zhang Zheng wrote:
> > On Mon, Sep 28, 2026 at 09:38:14AM +0200, Oleksii Kurochko wrote:
> > > 
> > > 
> > > On 9/28/26 4:38 AM, Zhang Zheng wrote:
> > > > The legacy SBI console extension is planned for deprecation. Replace the
> > > > RISC-V early printk backend with direct access to 8250 UART MMIO.
> > > 
> > > Won't it better just to start to add support of newer SBI? It provides
> > > pretty good support + faster as it supports passing of string instead of 
> > > one
> > > char.
> > > 
> > 
> > Using the newer SBI DBCN extension would indeed result in a smaller change. 
> > At
> > the time, I mainly followed the direction suggested by the TODO and referred
> > directly to the arm64 implementation, from which most of the code was 
> > adapted.
> 
> I think TODO was written at that way because I missed DBCN (or it wasn't
> ratified at that moment). Considering that it is ratified now ...
> 
> > 
> > > Also, I think it will lead to lesser changes.
> > > 
> > 
> > If falling back to SBI console putchar is acceptable, DBCN should work
> > well here.
> 
> ... I prefer to use SBI functionality (in the current case DBCN) as maximum
> as possible so if there is no any reason (and I don't see at the moment it)
> which doesn't allow us to use DBCN here, I would prefer to use DBCN.
> 

Given that Xen on RISC-V is expected to target relatively recent RVA23 hardware,
which should ship with a recent version of OpenSBI, I think you are right that
there is no real need to provide a fallback here.

> If you still want to in the way suggested by TODO then some parts which are
> common between Arm and RISC-V should be moved to common instead of
> introducing them in RISC-V specific folder.
>

I also tried to make the current patch as minimal as possible, but it would
still end up touching quite a few places.

> Let me know which approach you are going to follow. If the current one you
> already introduced then I will start to review it, if you will go SBI-way
> then I prefer to wait for your v2.
> 
> ~ Oleksii
> 

I misunderstood the TODO comment, I thought that would be the preferred
implementation. Therefore, I will switch to using DBCN and send a v2.

Best regards,

Zhang

> > > > 
> > > > This also addresses truncated output observed on SpacemiT K3 when
> > > > switching from early printk to dtuart. Direct UART access lets early
> > > > printk flush the UART after each string before the dtuart driver takes
> > > > over and clear it's FIFO, which cause the truncated uart output.>
> > > > The truncated uart looks like:
> > > > 
> > > >     (XEN) Command line: dtuart=/soc/uart@d4017000:115200/921600 
> > > > console=dtuart sync_console
> > > >     (XEN) Domain heap initialised
> > > >     (XEN) Booting using Device Tree
> > > >     (XEN) 
> > > > /home/zz/dev/git/xen_stuff/xen/xen/arch/riscv/cpufeature.c:710: SSTC 
> > > > detected; supported for Xen use, but not for guests
> > > >     (XEN) Looking for dtuart at "/soc/uart@d40 __  __            _  _   
> > > >  ____  _____                    _        _     _
> > > >      \ \/ /___ _ __   | || |  |___ \|___ /    _   _ _ __  ___| |_ __ _| 
> > > > |__ | | ___
> > > >       \  // _ \ '_ \  | || |_   __) | |_ \ __| | | | '_ \/ __| __/ _` | 
> > > > '_ \| |/ _ \
> > > >       /  \  __/ | | | |__   _| / __/ ___) |__| |_| | | | \__ \ || (_| | 
> > > > |_) | |  __/
> > > >      /_/\_\___|_| |_|    |_|(_)_____|____/    \__,_|_| 
> > > > |_|___/\__\__,_|_.__/|_|\___|
> > > > 
> > > >     (XEN) Xen version 4.23-unstable (zz@) (riscv64-linux-gnu-gcc (GCC) 
> > > > 15.1.0) debug=y ubsan=y Sat Sep 26 14:50:31 CST 2026
> > > >     (XEN) Latest ChangeSet: Fri Sep 18 10:11:27 2026 +0800 
> > > > git:77544a69ea
> > > > 
> > > > Zheng Zhang (1):
> > > >     xen/riscv: replace SBI early console with 8250 UAR
> > > > 
> > > >    xen/arch/riscv/Kconfig.debug              | 53 ++++++++++++++++++++--
> > > >    xen/arch/riscv/configs/tiny64_defconfig   |  2 +
> > > >    xen/arch/riscv/early_printk.c             | 37 +++++++---------
> > > >    xen/arch/riscv/include/asm/early_printk.h | 12 +++++
> > > >    xen/arch/riscv/include/asm/fixmap.h       |  6 ++-
> > > >    xen/arch/riscv/include/asm/sbi.h          |  7 ---
> > > >    xen/arch/riscv/mm.c                       | 41 +++++++++++++----
> > > >    xen/arch/riscv/riscv64/Makefile           |  1 +
> > > >    xen/arch/riscv/riscv64/debug-8250.inc     | 51 +++++++++++++++++++++
> > > >    xen/arch/riscv/riscv64/debug.S            | 54 
> > > > +++++++++++++++++++++++
> > > >    xen/arch/riscv/sbi.c                      |  5 ---
> > > >    11 files changed, 223 insertions(+), 46 deletions(-)
> > > >    create mode 100644 xen/arch/riscv/riscv64/debug-8250.inc
> > > >    create mode 100644 xen/arch/riscv/riscv64/debug.S
> > > > 
> > > > base-commit: 4c1aba82cff95ab11f7fe4af8965a06703537288
> > 
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.