All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhenbaii <wxchen0913@gmail.com>
To: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>,
	qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Chao Liu" <chao.liu.zevorn@gmail.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Weiwei Li" <liwei1518@gmail.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	qemu-riscv@nongnu.org, "Fabiano Rosas" <farosas@suse.de>,
	"Laurent Vivier" <lvivier@redhat.com>
Subject: Re: [PATCH RESEND v2 1/3] hw/char: add K230 DW 8250-compatible UART
Date: Fri, 7 Aug 2026 17:49:19 +0800	[thread overview]
Message-ID: <33f15edb-9bce-4f12-b205-eaa4b4d5290d@gmail.com> (raw)
In-Reply-To: <d079904c-e1c7-4495-bb3c-88c133bf1508@oss.qualcomm.com>


Hi Daniel,

Thanks for the review!


On 8/6/26 04:01, Daniel Henrique Barboza wrote:
> I believe a helper like 'static bool k230_uart_receiver_status_int' that
> encapsulates it is more idiomatic. 


Agreed. I'll make it into a helper in v3.


> If I have to make a guess I think these macros were being used as easy 
> knobs to test
> the emulation, i.e. manually enabling/disabling things in the header 
> file, rebuilding
> and see if the behaves as expected.  Which is of course fine, but 
> unless we're
> willing to make these knobs available to users (either by making these 
> available during
> ./configure or create device properties we can set in the command 
> line) I think we
> shouldn't use them in the logic since they're all hardwired.
>
> This is more pronounced down there in k230_uart_read().  We have this:
>
> > +            /* DLL accessible only when not busy. */
> > +            ret = (K230_UART_16550_COMPATIBLE || 
> !k230_uart_is_busy(s))
> > +                  ? s->dll : 0;
>
> K230_UART_16550_COMPATIBLE is hardwired to 0, hence this is equal to:
>
> ret = !k230_uart_is_busy(s) ? s->dll : 0;
>
> I believe we have more instances where we have a hardwired macro being 
> used
> as conditionals in the logic.  We should eliminate all of them to make 
> the
> logic simpler.


Yes as you say I use them for testing the emulation. Indeed it shouldn't 
be left in the logic. I will remove them in v3.


> These are all hardwired thus I recommend creating a macro in the 
> header like
> #define K230_UART_R_CPR (....)
> that encapsulates this value. 


Agreed. I will fix add K230_UART_R_CPR and the UCV macro in v3.


Regards,

WX Chen




  reply	other threads:[~2026-08-07  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25  3:52 [PATCH RESEND v2 0/3] riscv: Add K230 DW 8250-compatible UART WX Chen
2026-07-25  3:52 ` [PATCH RESEND v2 1/3] hw/char: add " WX Chen
2026-08-05 20:01   ` Daniel Henrique Barboza
2026-08-07  9:49     ` zhenbaii [this message]
2026-07-25  3:52 ` [PATCH RESEND v2 2/3] hw/riscv: k230: connect DW 8250 UART WX Chen
2026-08-05 20:02   ` Daniel Henrique Barboza
2026-07-25  3:52 ` [PATCH RESEND v2 3/3] tests/qtest: add K230 UART test WX Chen
2026-08-05 20:10   ` Daniel Henrique Barboza
2026-08-07 11:53     ` WX Chen

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=33f15edb-9bce-4f12-b205-eaa4b4d5290d@gmail.com \
    --to=wxchen0913@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=chao.liu.zevorn@gmail.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=farosas@suse.de \
    --cc=liwei1518@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.com \
    /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.