hw/char/renesas_sci: Add fifo buffer to backend interface.
PATCH 2/2 test/avocado: Update machibe_rx_gdbsim tests.
In reply to Yoshinori SatoSince SCI supports continuous data receive, Added that test.
--- tests/avocado/machine_rx_gdbsim.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
tests/avocado/machine_rx_gdbsim.py +17 -12
@@ -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')
Signature · 1 line
2.30.2
PATCH 1/2 hw/char/renesas_sci: Add fifo buffer to backend interface.
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.
--- include/hw/char/renesas_sci.h | 11 ++- hw/char/renesas_sci.c | 124 +++++++++++++++++++++++++--------- 2 files changed, 101 insertions(+), 34 deletions(-)
include/hw/char/renesas_sci.h +9 -2
@@ -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
hw/char/renesas_sci.c +92 -32
236 lines not on this page · raw message
Signature · 1 line
2.30.2
Quoted 6 lines · 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.
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
Quoted 9 lines · Thomas Huth
Quoted 6 lines · 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.
Quoted 6 lines
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.
Quoted 3 lines
Anyway, please use
scripts/get_maintainer.plto 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.
Quoted 4 lines
Thomas
--
Yoshinori Sato
Quoted 10 lines · Yoshinori Sato
Quoted 6 lines · Thomas Huth
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?
Quoted 6 lines
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
Quoted 19 lines · Peter Maydell
Quoted 10 lines · Yoshinori Sato
Quoted 6 lines · Thomas Huth
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?Quoted 6 lines
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.
Quoted 2 lines
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.
Quoted 6 lines
I don't think we should model a FIFO that doesn't exist in the real hardware.
thanks
-- PMM
Signature · 1 line
Yosinori Sato