From: Alistair Francis <alistair23@gmail.com>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: "Damien Hedde" <damien.hedde@greensocs.com>,
"Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>,
"Alistair Francis" <alistair.francis@wdc.com>
Subject: Re: [PATCH v3 6/6] hw/char: cadence_uart: Log a guest error when device is unclocked or in reset
Date: Thu, 2 Sep 2021 12:52:18 +1000 [thread overview]
Message-ID: <CAKmqyKOFoNDXksQtWkF8BgGzNH+sirFMb_0TV3Qu82CB0L2Asg@mail.gmail.com> (raw)
In-Reply-To: <20210901124521.30599-7-bmeng.cn@gmail.com>
On Wed, Sep 1, 2021 at 10:52 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> We've got SW that expects FSBL (Bootlooader) to setup clocks and
> resets. It's quite common that users run that SW on QEMU without
> FSBL (FSBL typically requires the Xilinx tools installed). That's
> fine, since users can stil use -device loader to enable clocks etc.
>
> To help folks understand what's going, a log (guest-error) message
> would be helpful here. In particular with the serial port since
> things will go very quiet if they get things wrong.
>
> Suggested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
>
> ---
>
> Changes in v3:
> - new patch: hw/char: cadence_uart: Log a guest error when unclocked or in reset
>
> hw/char/cadence_uart.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> index 5f5a4645ac..c069a30842 100644
> --- a/hw/char/cadence_uart.c
> +++ b/hw/char/cadence_uart.c
> @@ -240,6 +240,8 @@ static int uart_can_receive(void *opaque)
>
> /* ignore characters when unclocked or in reset */
> if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
> + qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
> + __func__);
> return 0;
> }
>
> @@ -376,6 +378,8 @@ static void uart_event(void *opaque, QEMUChrEvent event)
>
> /* ignore characters when unclocked or in reset */
> if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
> + qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
> + __func__);
> return;
> }
>
> @@ -413,6 +417,8 @@ static MemTxResult uart_write(void *opaque, hwaddr offset,
>
> /* ignore access when unclocked or in reset */
> if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
> + qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
> + __func__);
> return MEMTX_ERROR;
> }
>
> @@ -478,6 +484,8 @@ static MemTxResult uart_read(void *opaque, hwaddr offset,
>
> /* ignore access when unclocked or in reset */
> if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
> + qemu_log_mask(LOG_GUEST_ERROR, "%s: uart is unclocked or in reset\n",
> + __func__);
> return MEMTX_ERROR;
> }
>
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2021-09-02 2:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 12:45 [PATCH v3 0/6] hw/arm: xilinx_zynq: Fix upstream U-Boot boot failure Bin Meng
2021-09-01 12:45 ` [PATCH v3 1/6] hw/misc: zynq_slcr: Correctly compute output clocks in the reset exit phase Bin Meng
2021-09-01 12:45 ` [PATCH v3 2/6] hw/char: cadence_uart: Disable transmit when input clock is disabled Bin Meng
2021-09-01 12:45 ` [PATCH v3 3/6] hw/char: cadence_uart: Move clock/reset check to uart_can_receive() Bin Meng
2021-09-02 2:50 ` Alistair Francis
2021-09-01 12:45 ` [PATCH v3 4/6] hw/char: cadence_uart: Convert to memop_with_attrs() ops Bin Meng
2021-09-02 2:50 ` Alistair Francis
2021-09-01 12:45 ` [PATCH v3 5/6] hw/char: cadence_uart: Ignore access when unclocked or in reset for uart_{read, write}() Bin Meng
2021-09-02 2:51 ` Alistair Francis
2021-09-01 12:45 ` [PATCH v3 6/6] hw/char: cadence_uart: Log a guest error when device is unclocked or in reset Bin Meng
2021-09-02 2:52 ` Alistair Francis [this message]
2021-09-02 5:39 ` [PATCH v3 0/6] hw/arm: xilinx_zynq: Fix upstream U-Boot boot failure Edgar E. Iglesias
2021-09-07 10:48 ` Peter Maydell
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=CAKmqyKOFoNDXksQtWkF8BgGzNH+sirFMb_0TV3Qu82CB0L2Asg@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=bmeng.cn@gmail.com \
--cc=damien.hedde@greensocs.com \
--cc=edgar.iglesias@xilinx.com \
--cc=f4bug@amsat.org \
--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).