All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Zheng <zhangzheng@iscas.ac.cn>
To: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Cc: xen-devel@lists.xenproject.org,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Connor Davis" <connojdavis@gmail.com>,
	"Baptiste Le Duc" <baptiste.le-duc@vates.tech>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger@xenproject.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [PATCH v1 0/1] [RISC-V] replace SBI early console with 8250 UART
Date: Tue, 29 Sep 2026 11:10:09 +0800	[thread overview]
Message-ID: <arsr7FV_KDQpyTcS@iscas-ws> (raw)
In-Reply-To: <arpi6szfHazQg07N@iscas-ws>

On Mon, Sep 28, 2026 at 08:53:15PM +0800, Zhang Zheng wrote:
> 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
> 

Hi Oleksii,

I initially assumed that the DBCN console-write call would wait until the
whole string had been transmitted. After checking the SBI specification
and the Linux implementation, I found that this is not the case.

The DBCN Console Write function is explicitly non-blocking. Linux uses DBCN
through the HVC console driver, so the DBCN backend remains the owner of the
console and the 8250 driver does not subsequently reinitialize the same UART
or clear its FIFO.

On the other hand, when Linux uses an 8250 earlycon, it accesses the UART
directly and waits for UART_LSR_TEMT before the regular 8250 driver takes
over.

The current Xen setup combines these two paths: early printk uses the SBI
console, while the later 8250 driver initializes the same UART. During this
handover, the 8250 driver clears the TX FIFO, which can discard characters
that were accepted by SBI but have not yet been transmitted by the UART.

Therefore, if Xen is going to use the 8250 driver after early printk, I
think the early console should use the same 8250 MMIO path, as Linux does
with 8250 earlycon. This keeps the early-console backend consistent with
the driver that takes ownership of the UART and allows Xen to wait for
UART_LSR_TEMT before reinitialization.

BR

Zhang



  reply	other threads:[~2026-09-29  3:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  2:38 [PATCH v1 0/1] [RISC-V] replace SBI early console with 8250 UART Zhang Zheng
2026-09-28  2:38 ` [PATCH v1 1/1] xen/riscv: " Zhang Zheng
2026-09-28  7:38 ` [PATCH v1 0/1] [RISC-V] " Oleksii Kurochko
2026-09-28  8:40   ` Zhang Zheng
2026-09-28  9:31     ` Oleksii Kurochko
2026-09-28 12:53       ` Zhang Zheng
2026-09-29  3:10         ` Zhang Zheng [this message]
2026-09-30 11:22           ` Oleksii Kurochko
2026-10-10  3:32             ` Zhang Zheng
2026-10-12  7:39               ` Oleksii Kurochko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arsr7FV_KDQpyTcS@iscas-ws \
    --to=zhangzheng@iscas.ac.cn \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=baptiste.le-duc@vates.tech \
    --cc=connojdavis@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=roger@xenproject.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.