All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface.
@ 2022-01-31  9:42 Yoshinori Sato
  2022-01-31  9:42 ` [PATCH 2/2] test/avocado: Update machibe_rx_gdbsim tests Yoshinori Sato
  2022-02-01  6:48 ` [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface Thomas Huth
  0 siblings, 2 replies; 6+ messages in thread
From: Yoshinori Sato @ 2022-01-31  9:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yoshinori Sato

SCI does not have a fifo, it is necessary to send and receive
 at a bit rate speed.
But, qemu's chardev backend does not have a buffer,
 so it sends received data continuously.
By buffering the received data with the FIFO, continuous
 received data can be received.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 include/hw/char/renesas_sci.h |  11 ++-
 hw/char/renesas_sci.c         | 124 +++++++++++++++++++++++++---------
 2 files changed, 101 insertions(+), 34 deletions(-)

diff --git a/include/hw/char/renesas_sci.h b/include/hw/char/renesas_sci.h
index a4764e3eee..017711867a 100644
--- a/include/hw/char/renesas_sci.h
+++ b/include/hw/char/renesas_sci.h
@@ -12,6 +12,7 @@
 #include "chardev/char-fe.h"
 #include "hw/sysbus.h"
 #include "qom/object.h"
+#include "qemu/fifo8.h"
 
 #define TYPE_RENESAS_SCI "renesas-sci"
 typedef struct RSCIState RSCIState;
@@ -26,13 +27,18 @@ enum {
     SCI_NR_IRQ = 4
 };
 
+enum {
+    TXTIMER = 0,
+    RXTIMER = 1,
+    NR_TIMER = 2,
+};
+
 struct RSCIState {
     /*< private >*/
     SysBusDevice parent_obj;
     /*< public >*/
 
     MemoryRegion memory;
-    QEMUTimer timer;
     CharBackend chr;
     qemu_irq irq[SCI_NR_IRQ];
 
@@ -47,8 +53,9 @@ struct RSCIState {
 
     uint8_t read_ssr;
     int64_t trtime;
-    int64_t rx_next;
     uint64_t input_freq;
+    Fifo8 rxfifo;
+    QEMUTimer timer[NR_TIMER];
 };
 
 #endif
diff --git a/hw/char/renesas_sci.c b/hw/char/renesas_sci.c
index 1c63467290..e6513a24b6 100644
--- a/hw/char/renesas_sci.c
+++ b/hw/char/renesas_sci.c
@@ -69,32 +69,63 @@ REG8(SEMR, 7)
   FIELD(SEMR, ACS0, 0, 1)
   FIELD(SEMR, ABCS, 4, 1)
 
-static int can_receive(void *opaque)
+enum {
+    RXFIFO_DEPTH = 16,
+};
+
+static void set_next_event(RSCIState *sci, int evt, int64_t expire)
 {
-    RSCIState *sci = RSCI(opaque);
-    if (sci->rx_next > qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)) {
-        return 0;
+    int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+
+    if (expire > 0) {
+        timer_mod(&sci->timer[evt], now + expire);
     } else {
-        return FIELD_EX8(sci->scr, SCR, RE);
+        timer_del(&sci->timer[evt]);
     }
 }
 
-static void receive(void *opaque, const uint8_t *buf, int size)
+static int can_receive(void *opaque)
 {
     RSCIState *sci = RSCI(opaque);
-    sci->rx_next = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + sci->trtime;
-    if (FIELD_EX8(sci->ssr, SSR, RDRF) || size > 1) {
+    return FIELD_EX8(sci->scr, SCR, RE) ? fifo8_num_free(&sci->rxfifo) : 0;
+}
+
+static void sci_rx_event(void *opaque)
+{
+    RSCIState *sci = RSCI(opaque);
+    uint32_t rd;
+
+    if (fifo8_is_empty(&sci->rxfifo)) {
+        /* receiver idle state */
+        set_next_event(sci, RXTIMER, 0);
+        return;
+    }
+    rd = fifo8_pop(&sci->rxfifo);
+    if (FIELD_EX8(sci->ssr, SSR, RDRF)) {
+        /* Don't receive last byte */
         sci->ssr = FIELD_DP8(sci->ssr, SSR, ORER, 1);
         if (FIELD_EX8(sci->scr, SCR, RIE)) {
             qemu_set_irq(sci->irq[ERI], 1);
         }
     } else {
-        sci->rdr = buf[0];
+        sci->rdr = rd;
         sci->ssr = FIELD_DP8(sci->ssr, SSR, RDRF, 1);
         if (FIELD_EX8(sci->scr, SCR, RIE)) {
             qemu_irq_pulse(sci->irq[RXI]);
         }
     }
+    set_next_event(sci, RXTIMER, sci->trtime);
+}
+
+static void receive(void *opaque, const uint8_t *buf, int size)
+{
+    RSCIState *sci = RSCI(opaque);
+    fifo8_push_all(&sci->rxfifo, buf, size);
+
+    if (!timer_pending(&sci->timer[RXTIMER])) {
+        /* reciever idle state, start rx */
+        sci_rx_event(sci);
+    }
 }
 
 static void send_byte(RSCIState *sci)
@@ -102,22 +133,26 @@ static void send_byte(RSCIState *sci)
     if (qemu_chr_fe_backend_connected(&sci->chr)) {
         qemu_chr_fe_write_all(&sci->chr, &sci->tdr, 1);
     }
-    timer_mod(&sci->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + sci->trtime);
+    set_next_event(sci, TXTIMER, sci->trtime);
     sci->ssr = FIELD_DP8(sci->ssr, SSR, TEND, 0);
     sci->ssr = FIELD_DP8(sci->ssr, SSR, TDRE, 1);
     qemu_set_irq(sci->irq[TEI], 0);
-    if (FIELD_EX8(sci->scr, SCR, TIE)) {
+    if (FIELD_EX8(sci->scr, SCR, TE) && FIELD_EX8(sci->scr, SCR, TIE)) {
         qemu_irq_pulse(sci->irq[TXI]);
     }
 }
 
-static void txend(void *opaque)
+static void sci_tx_event(void *opaque)
 {
     RSCIState *sci = RSCI(opaque);
-    if (!FIELD_EX8(sci->ssr, SSR, TDRE)) {
+
+    if (FIELD_EX8(sci->ssr, SSR, TDRE) == 0) {
+        /* next tx ready */
         send_byte(sci);
     } else {
+        /* no next tx */
         sci->ssr = FIELD_DP8(sci->ssr, SSR, TEND, 1);
+        set_next_event(sci, TXTIMER, 0);
         if (FIELD_EX8(sci->scr, SCR, TEIE)) {
             qemu_set_irq(sci->irq[TEI], 1);
         }
@@ -126,15 +161,15 @@ static void txend(void *opaque)
 
 static void update_trtime(RSCIState *sci)
 {
+    int64_t baseclk = NANOSECONDS_PER_SECOND / sci->input_freq;
+    baseclk *= 64 - 32 * FIELD_EX8(sci->semr, SEMR, ABCS);
+    baseclk *= 1 << (2 * FIELD_EX8(sci->smr, SMR, CKS));
+    baseclk *= sci->brr + 1;
     /* char per bits */
     sci->trtime = 8 - FIELD_EX8(sci->smr, SMR, CHR);
     sci->trtime += FIELD_EX8(sci->smr, SMR, PE);
     sci->trtime += FIELD_EX8(sci->smr, SMR, STOP) + 1;
-    /* x bit transmit time (32 * divrate * brr) / base freq */
-    sci->trtime *= 32 * sci->brr;
-    sci->trtime *= 1 << (2 * FIELD_EX8(sci->smr, SMR, CKS));
-    sci->trtime *= NANOSECONDS_PER_SECOND;
-    sci->trtime /= sci->input_freq;
+    sci->trtime *= baseclk;
 }
 
 static bool sci_is_tr_enabled(RSCIState *sci)
@@ -151,23 +186,37 @@ static void sci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
         if (!sci_is_tr_enabled(sci)) {
             sci->smr = val;
             update_trtime(sci);
+        } else {
+            qemu_log_mask(LOG_GUEST_ERROR, "reneas_sci: Register 0x%"
+                          HWADDR_PRIX " write protected.\n", offset);
         }
         break;
     case A_BRR:
         if (!sci_is_tr_enabled(sci)) {
             sci->brr = val;
             update_trtime(sci);
+        } else {
+            qemu_log_mask(LOG_GUEST_ERROR, "reneas_sci: Register 0x%"
+                          HWADDR_PRIX " write protected.\n", offset);
         }
         break;
     case A_SCR:
-        sci->scr = val;
-        if (FIELD_EX8(sci->scr, SCR, TE)) {
-            sci->ssr = FIELD_DP8(sci->ssr, SSR, TDRE, 1);
-            sci->ssr = FIELD_DP8(sci->ssr, SSR, TEND, 1);
-            if (FIELD_EX8(sci->scr, SCR, TIE)) {
-                qemu_irq_pulse(sci->irq[TXI]);
+        if (FIELD_EX8(sci->scr, SCR, TE) != FIELD_EX8(val, SCR, TE)) {
+            if (FIELD_EX8(val, SCR, TE)) {
+                /* Disable -> Enable to reset TX*/
+                sci->ssr = FIELD_DP8(sci->ssr, SSR, TDRE, 1);
+                sci->ssr = FIELD_DP8(sci->ssr, SSR, TEND, 1);
+                if (FIELD_EX8(val, SCR, TIE)) {
+                    qemu_irq_pulse(sci->irq[TXI]);
+                }
+            } else {
+                /* disable TX clock */
+                set_next_event(sci, TXTIMER, 0);
+                sci->ssr = FIELD_DP8(sci->ssr, SSR, TDRE, 0);
+                sci->ssr = FIELD_DP8(sci->ssr, SSR, TEND, 1);
             }
         }
+        sci->scr = val;
         if (!FIELD_EX8(sci->scr, SCR, TEIE)) {
             qemu_set_irq(sci->irq[TEI], 0);
         }
@@ -177,10 +226,14 @@ static void sci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
         break;
     case A_TDR:
         sci->tdr = val;
-        if (FIELD_EX8(sci->ssr, SSR, TEND)) {
-            send_byte(sci);
+        if (FIELD_EX8(sci->scr, SCR, TE)) {
+            if (FIELD_EX8(sci->ssr, SSR, TEND)) {
+                send_byte(sci);
+            } else {
+                sci->ssr = FIELD_DP8(sci->ssr, SSR, TDRE, 0);
+            }
         } else {
-            sci->ssr = FIELD_DP8(sci->ssr, SSR, TDRE, 0);
+            qemu_log_mask(LOG_GUEST_ERROR, "reneas_sci: Transmit disabled.\n");
         }
         break;
     case A_SSR:
@@ -224,6 +277,9 @@ static uint64_t sci_read(void *opaque, hwaddr offset, unsigned size)
         sci->read_ssr = sci->ssr;
         return sci->ssr;
     case A_RDR:
+        if (!FIELD_EX8(sci->scr, SCR, RE)) {
+            qemu_log_mask(LOG_GUEST_ERROR, "reneas_sci: Receive disabled.\n");
+        }
         sci->ssr = FIELD_DP8(sci->ssr, SSR, RDRF, 0);
         return sci->rdr;
     case A_SCMR:
@@ -255,7 +311,7 @@ static void rsci_reset(DeviceState *dev)
     sci->ssr = 0x84;
     sci->scmr = 0x00;
     sci->semr = 0x00;
-    sci->rx_next = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+    update_trtime(sci);
 }
 
 static void sci_event(void *opaque, QEMUChrEvent event)
@@ -263,6 +319,7 @@ static void sci_event(void *opaque, QEMUChrEvent event)
     RSCIState *sci = RSCI(opaque);
     if (event == CHR_EVENT_BREAK) {
         sci->ssr = FIELD_DP8(sci->ssr, SSR, FER, 1);
+        sci->rdr = 0;
         if (FIELD_EX8(sci->scr, SCR, RIE)) {
             qemu_set_irq(sci->irq[ERI], 1);
         }
@@ -295,16 +352,19 @@ static void rsci_init(Object *obj)
     for (i = 0; i < SCI_NR_IRQ; i++) {
         sysbus_init_irq(d, &sci->irq[i]);
     }
-    timer_init_ns(&sci->timer, QEMU_CLOCK_VIRTUAL, txend, sci);
+    timer_init_ns(&sci->timer[TXTIMER],
+                  QEMU_CLOCK_VIRTUAL, sci_tx_event, sci);
+    timer_init_ns(&sci->timer[RXTIMER],
+                  QEMU_CLOCK_VIRTUAL, sci_rx_event, sci);
+    fifo8_create(&sci->rxfifo, RXFIFO_DEPTH);
 }
 
 static const VMStateDescription vmstate_rsci = {
     .name = "renesas-sci",
-    .version_id = 1,
+    .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT64(trtime, RSCIState),
-        VMSTATE_INT64(rx_next, RSCIState),
         VMSTATE_UINT8(smr, RSCIState),
         VMSTATE_UINT8(brr, RSCIState),
         VMSTATE_UINT8(scr, RSCIState),
@@ -314,7 +374,7 @@ static const VMStateDescription vmstate_rsci = {
         VMSTATE_UINT8(scmr, RSCIState),
         VMSTATE_UINT8(semr, RSCIState),
         VMSTATE_UINT8(read_ssr, RSCIState),
-        VMSTATE_TIMER(timer, RSCIState),
+        VMSTATE_TIMER_ARRAY(timer, RSCIState, NR_TIMER),
         VMSTATE_END_OF_LIST()
     }
 };
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] test/avocado: Update machibe_rx_gdbsim tests.
  2022-01-31  9:42 [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface Yoshinori Sato
@ 2022-01-31  9:42 ` Yoshinori Sato
  2022-02-01  6:48 ` [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface Thomas Huth
  1 sibling, 0 replies; 6+ messages in thread
From: Yoshinori Sato @ 2022-01-31  9:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yoshinori Sato

Since SCI supports continuous data receive, Added that test.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 tests/avocado/machine_rx_gdbsim.py | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/tests/avocado/machine_rx_gdbsim.py b/tests/avocado/machine_rx_gdbsim.py
index 6cd8704b01..04ba1e3ca3 100644
--- a/tests/avocado/machine_rx_gdbsim.py
+++ b/tests/avocado/machine_rx_gdbsim.py
@@ -9,6 +9,7 @@
 # later.  See the COPYING file in the top-level directory.
 
 import os
+import time
 
 from avocado import skipIf
 from avocado_qemu import QemuSystemTest
@@ -20,7 +21,7 @@
 class RxGdbSimMachine(QemuSystemTest):
 
     timeout = 30
-    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=ttySC0,9600'
 
     @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
     def test_uboot(self):
@@ -31,8 +32,8 @@ def test_uboot(self):
         :avocado: tags=machine:gdbsim-r5f562n8
         :avocado: tags=endian:little
         """
-        uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz')
-        uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb'
+        uboot_url = ('https://osdn.dl.osdn.net/users/37/37476/u-boot.bin.gz')
+        uboot_hash = '5299a1deb6540ed8699a21ab32b61d862f8d3e32'
         uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash)
         uboot_path = archive.uncompress(uboot_path, self.workdir)
 
@@ -40,11 +41,14 @@ def test_uboot(self):
         self.vm.add_args('-bios', uboot_path,
                          '-no-reboot')
         self.vm.launch()
-        uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty'
+        uboot_version = 'U-Boot 2021.10-rc3-00012-g92f3eb4647 ' \
+            '(Jan 02 2022 - 21:06:23 +0900)'
         wait_for_console_pattern(self, uboot_version)
-        gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)'
-        # FIXME limit baudrate on chardev, else we type too fast
-        #exec_command_and_wait_for_pattern(self, 'version', gcc_version)
+        gcc_version = 'rx-unknown-linux-gcc (GCC) 12.0.0 20210903 ' \
+            '(experimental)'
+        # Wait for prompt
+        time.sleep(1)
+        exec_command_and_wait_for_pattern(self, 'version', gcc_version)
 
     @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
     def test_linux_sash(self):
@@ -55,18 +59,19 @@ def test_linux_sash(self):
         :avocado: tags=machine:gdbsim-r5f562n7
         :avocado: tags=endian:little
         """
-        dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-virt.dtb')
-        dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18'
+        dtb_url = ('https://osdn.dl.osdn.net/users/37/37625/rx-virt.dtb')
+        dtb_hash = 'c69ee47d322285d1fc359d18d50b74e385b4d76c'
         dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash)
-        kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage')
-        kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99'
+        kernel_url = ('https://osdn.dl.osdn.net/users/37/37623/zImage')
+        kernel_hash = '7aa396cd62d81d05fb5f8d7e56154cf4bf20e029'
         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
 
         self.vm.set_console()
         kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon'
         self.vm.add_args('-kernel', kernel_path,
                          '-dtb', dtb_path,
-                         '-no-reboot')
+                         '-no-reboot',
+                         '-append', kernel_command_line)
         self.vm.launch()
         wait_for_console_pattern(self, 'Sash command shell (version 1.1.1)',
                                  failure_message='Kernel panic - not syncing')
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface.
  2022-01-31  9:42 [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface Yoshinori Sato
  2022-01-31  9:42 ` [PATCH 2/2] test/avocado: Update machibe_rx_gdbsim tests Yoshinori Sato
@ 2022-02-01  6:48 ` Thomas Huth
  2022-02-01 15:52   ` Yoshinori Sato
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Huth @ 2022-02-01  6:48 UTC (permalink / raw)
  To: Yoshinori Sato, qemu-devel
  Cc: Marc-André Lureau, Magnus Damm, Philippe Mathieu-Daudé,
	Paolo Bonzini

On 31/01/2022 10.42, Yoshinori Sato wrote:
> SCI does not have a fifo, it is necessary to send and receive
>   at a bit rate speed.
> But, qemu's chardev backend does not have a buffer,
>   so it sends received data continuously.
> By buffering the received data with the FIFO, continuous
>   received data can be received.

  Hi!

If you describe it like this, it sounds like you're now emulating a buffer 
that is not there with real hardware? Is that really what you want here, 
i.e. wouldn't this hide problems with the real hardware that are mitigated 
in QEMU with this buffer?

Anyway, please use scripts/get_maintainer.pl to get a list of people who 
should be put on CC:, otherwise your patches might get lost in the high 
traffic of the mailing list.

  Thomas



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface.
  2022-02-01  6:48 ` [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface Thomas Huth
@ 2022-02-01 15:52   ` Yoshinori Sato
  2022-02-01 18:54     ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Yoshinori Sato @ 2022-02-01 15:52 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Marc-André Lureau, Paolo Bonzini, Magnus Damm, qemu-devel,
	Philippe Mathieu-Daudé

On Tue, 01 Feb 2022 15:48:58 +0900,
Thomas Huth wrote:
> 
> On 31/01/2022 10.42, Yoshinori Sato wrote:
> > SCI does not have a fifo, it is necessary to send and receive
> >   at a bit rate speed.
> > But, qemu's chardev backend does not have a buffer,
> >   so it sends received data continuously.
> > By buffering the received data with the FIFO, continuous
> >   received data can be received.
> 
>  Hi!
> 
> If you describe it like this, it sounds like you're now emulating a
> buffer that is not there with real hardware? Is that really what you
> want here, i.e. wouldn't this hide problems with the real hardware
> that are mitigated in QEMU with this buffer?

There is no such buffer in the real hardware.
It's not possible with real hardware, but the chardev backend passes
data faster than the bitrate.
There is no problem if the received data is supplied at the timing when
it can be received, but since it is difficult to match the timing accurately,
we expect that the buffer will absorb the difference in timing.

> Anyway, please use scripts/get_maintainer.pl to get a list of people
> who should be put on CC:, otherwise your patches might get lost in the
> high traffic of the mailing list.

OK.

> 
>  Thomas
> 
> 

--
Yoshinori Sato


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface.
  2022-02-01 15:52   ` Yoshinori Sato
@ 2022-02-01 18:54     ` Peter Maydell
  2022-02-03 13:38       ` Yoshinori Sato
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2022-02-01 18:54 UTC (permalink / raw)
  To: Yoshinori Sato
  Cc: Thomas Huth, Magnus Damm, Philippe Mathieu-Daudé,
	qemu-devel, Paolo Bonzini, Marc-André Lureau

On Tue, 1 Feb 2022 at 17:47, Yoshinori Sato <ysato@users.sourceforge.jp> wrote:
>
> On Tue, 01 Feb 2022 15:48:58 +0900,
> Thomas Huth wrote:
> >
> > On 31/01/2022 10.42, Yoshinori Sato wrote:
> > If you describe it like this, it sounds like you're now emulating a
> > buffer that is not there with real hardware? Is that really what you
> > want here, i.e. wouldn't this hide problems with the real hardware
> > that are mitigated in QEMU with this buffer?
>
> There is no such buffer in the real hardware.
> It's not possible with real hardware, but the chardev backend passes
> data faster than the bitrate.
> There is no problem if the received data is supplied at the timing when
> it can be received, but since it is difficult to match the timing accurately,
> we expect that the buffer will absorb the difference in timing.

If you can't accept receiving more data from the chardev backend,
your serial device model should be returning 0 from can_receive.

I don't think we should model a FIFO that doesn't exist in
the real hardware.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface.
  2022-02-01 18:54     ` Peter Maydell
@ 2022-02-03 13:38       ` Yoshinori Sato
  0 siblings, 0 replies; 6+ messages in thread
From: Yoshinori Sato @ 2022-02-03 13:38 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Thomas Huth, Magnus Damm, Philippe Mathieu-Daudé,
	qemu-devel, Marc-André Lureau, Paolo Bonzini

On Wed, 02 Feb 2022 03:54:45 +0900,
Peter Maydell wrote:
> 
> On Tue, 1 Feb 2022 at 17:47, Yoshinori Sato <ysato@users.sourceforge.jp> wrote:
> >
> > On Tue, 01 Feb 2022 15:48:58 +0900,
> > Thomas Huth wrote:
> > >
> > > On 31/01/2022 10.42, Yoshinori Sato wrote:
> > > If you describe it like this, it sounds like you're now emulating a
> > > buffer that is not there with real hardware? Is that really what you
> > > want here, i.e. wouldn't this hide problems with the real hardware
> > > that are mitigated in QEMU with this buffer?
> >
> > There is no such buffer in the real hardware.
> > It's not possible with real hardware, but the chardev backend passes
> > data faster than the bitrate.
> > There is no problem if the received data is supplied at the timing when
> > it can be received, but since it is difficult to match the timing accurately,
> > we expect that the buffer will absorb the difference in timing.
> 
> If you can't accept receiving more data from the chardev backend,
> your serial device model should be returning 0 from can_receive.

If 0 is returned, the character to be received will be dropped.
There is no problem if it is an interactive operation,
but when connecting to a socket and communicating continuously,
data will be lost if the timing does not match.

> I don't think we should model a FIFO that doesn't exist in
> the real hardware.
> 
> thanks
> -- PMM
> 

-- 
Yosinori Sato


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-03 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31  9:42 [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface Yoshinori Sato
2022-01-31  9:42 ` [PATCH 2/2] test/avocado: Update machibe_rx_gdbsim tests Yoshinori Sato
2022-02-01  6:48 ` [PATCH 1/2] hw/char/renesas_sci: Add fifo buffer to backend interface Thomas Huth
2022-02-01 15:52   ` Yoshinori Sato
2022-02-01 18:54     ` Peter Maydell
2022-02-03 13:38       ` Yoshinori Sato

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.