qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
To: Alistair Francis <alistair23@gmail.com>
Cc: Damien Hedde <damien.hedde@greensocs.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	Alistair Francis <alistair.francis@wdc.com>,
	Bin Meng <bmeng.cn@gmail.com>
Subject: Re: [PATCH 2/3] hw/char: cadence_uart: Disable transmit when input clock is disabled
Date: Mon, 23 Aug 2021 15:58:31 +0200	[thread overview]
Message-ID: <20210823135831.GB24187@toto> (raw)
In-Reply-To: <CAKmqyKMzq-F=MYMA=_7MeLTodxY7Eo91Nta4nKuncvAZ=bQUOQ@mail.gmail.com>

On Mon, Aug 23, 2021 at 02:43:26PM +1000, Alistair Francis wrote:
> On Mon, Aug 23, 2021 at 12:11 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > At present when input clock is disabled, any character transmitted
> > to tx fifo can still show on the serial line, which is wrong.
> >
> > Fixes: b636db306e06 ("hw/char/cadence_uart: add clock support")
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  hw/char/cadence_uart.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> > index b4b5e8a3ee..154be34992 100644
> > --- a/hw/char/cadence_uart.c
> > +++ b/hw/char/cadence_uart.c
> > @@ -327,6 +327,11 @@ static gboolean cadence_uart_xmit(void *do_not_use, GIOCondition cond,
> >  static void uart_write_tx_fifo(CadenceUARTState *s, const uint8_t *buf,
> >                                 int size)
> >  {
> > +    /* ignore characters when unclocked or in reset */
> > +    if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
> > +        return;
> > +    }
> 
> Should we log a guest error here?
> 


I think it's a good idea to log a guest error on the TX path.

It's not uncommon for bare-metal applications to rely on FSBL/Bootloaders
setting up clocks/resets. On QEMU, it's convenient to run applications
directly without boot-loaders, particularly FSBL since it requires Xilinx tools
to generate it. It's going to be hard for users to figure out what's going on
with no console output and no guest error.

I also wonder how Linux handles this when CCF is not active?
Do we need to use TYPE_ARM_LINUX_BOOT_IF?

Best regards,
Edgar




  parent reply	other threads:[~2021-08-23 13:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23  2:08 [PATCH 0/3] hw/arm: xilinx_zynq: Fix upstream U-Boot boot failure Bin Meng
2021-08-23  2:08 ` [PATCH 1/3] hw/misc: zynq_slcr: Correctly compute output clocks in the reset exit phase Bin Meng
2021-08-23  4:42   ` Alistair Francis
2021-08-23 13:45     ` Edgar E. Iglesias
2021-08-23  2:08 ` [PATCH 2/3] hw/char: cadence_uart: Disable transmit when input clock is disabled Bin Meng
2021-08-23  4:43   ` Alistair Francis
2021-08-23  4:52     ` Bin Meng
2021-08-23  6:52       ` Alistair Francis
2021-08-23 13:58     ` Edgar E. Iglesias [this message]
2021-08-23  8:14   ` Philippe Mathieu-Daudé
2021-08-23  9:57     ` Bin Meng
2021-08-23 10:43       ` Philippe Mathieu-Daudé
2021-08-23 13:14         ` Bin Meng
2021-08-23 13:21           ` Philippe Mathieu-Daudé
2021-08-23  2:08 ` [PATCH 3/3] hw/char: cadence_uart: Move clock/reset check to uart_can_receive() Bin Meng
2021-08-23  8:17   ` Philippe Mathieu-Daudé

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=20210823135831.GB24187@toto \
    --to=edgar.iglesias@xilinx.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=bmeng.cn@gmail.com \
    --cc=damien.hedde@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).