qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Wagner <alexander.wagner@ulal.de>
To: Alistair Francis <alistair23@gmail.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH] hw/char: disable ibex uart receive if the buffer is full
Date: Tue, 9 Mar 2021 16:35:23 +0100	[thread overview]
Message-ID: <0f1e36fb-6ac4-b709-a9ba-2754e3f1fe78@ulal.de> (raw)
In-Reply-To: <CAKmqyKMhDyHkfn7zszhDOiKY5k=JRzmYjz7-QD9j8Ntr=T8Qag@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]


On 09.03.21 15:29, Alistair Francis wrote:
> On Tue, Mar 9, 2021 at 2:27 AM Alexander Wagner
> <alexander.wagner@ulal.de> wrote:
>>
>> On 08.03.21 14:47, Alistair Francis wrote:
>>>>    hw/char/ibex_uart.c         | 20 +++++++++++++++-----
>>>>    include/hw/char/ibex_uart.h |  4 ++++
>>>>    2 files changed, 19 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c
>>>> index 89f1182c9b..dac09d53d6 100644
>>>> --- a/hw/char/ibex_uart.c
>>>> +++ b/hw/char/ibex_uart.c
>>>> @@ -66,7 +66,8 @@ static int ibex_uart_can_receive(void *opaque)
>>>>    {
>>>>        IbexUartState *s = opaque;
>>>>
>>>> -    if (s->uart_ctrl & R_CTRL_RX_ENABLE_MASK) {
>>>> +    if ((s->uart_ctrl & R_CTRL_RX_ENABLE_MASK)
>>>> +           && !(s->uart_status & R_STATUS_RXFULL_MASK)) {
>>>>            return 1;
>>>>        }
>>>>
>>>> @@ -83,6 +84,8 @@ static void ibex_uart_receive(void *opaque, const uint8_t *buf, int size)
>>>>
>>>>        s->uart_status &= ~R_STATUS_RXIDLE_MASK;
>>>>        s->uart_status &= ~R_STATUS_RXEMPTY_MASK;
>>>> +    s->uart_status |= R_STATUS_RXFULL_MASK;
>>> Doesn't this mean we set RXFULL on every receive? Shouldn't this check
>>> the rx_level first?
>>>
>>> Alistair
>> Thank you for having a look! :)
>>
>> Yes, this is correct. The RXFULL is currently set on every receive. The
>> RXFULL is used to indicate to QEMU that the device cannot receive any
>> further bytes.
>>
>> As the FIFO buffers are currently not yet implemented I thought it would
>> make sense to behave like the OT UART could only receive one byte at a time.
> Ah, good point.
>
> Can you add a comment where it is set describing that then?
>
> Alistair
>
Sure, I just added a comment and emailed this as patch v2.

Alex


[-- Attachment #2: Type: text/html, Size: 2516 bytes --]

      reply	other threads:[~2021-03-09 15:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 23:15 [PATCH] hw/char: disable ibex uart receive if the buffer is full Alexander Wagner
2021-03-08  9:53 ` Alexander Wagner
2021-03-08 13:47 ` Alistair Francis
2021-03-09  7:27   ` Alexander Wagner
2021-03-09 14:29     ` Alistair Francis
2021-03-09 15:35       ` Alexander Wagner [this message]

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=0f1e36fb-6ac4-b709-a9ba-2754e3f1fe78@ulal.de \
    --to=alexander.wagner@ulal.de \
    --cc=Alistair.Francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).