All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] virtio: Add a virtio RTC driver
@ 2026-10-17 18:46 Hung-Chun Tseng
  2026-10-17 18:46 ` [PATCH v3 1/5] virtio: rtc: Add " Hung-Chun Tseng
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Hung-Chun Tseng @ 2026-10-17 18:46 UTC (permalink / raw)
  To: u-boot; +Cc: bmeng.cn, trini, visitorckw, sjg, xypron.glpk

QEMU v11.1.0 added a virtio RTC device (virtio-rtc-pci and
virtio-rtc-device), but U-Boot has no driver for it. This series adds
one, so that "date" and anything else using dm_rtc_get() work on any
virtio-capable QEMU target, not only on machines that also have a
goldfish or PL031 RTC.

Patch 1 adds the driver, patch 2 updates the virtio documentation and
patch 3 adds a MAINTAINERS entry. Patch 4 lets sandbox tests answer
virtqueue requests as the device would, which patch 5 uses to test the
driver.

The main change in v3 is how the clock is chosen. Following Kuan-Wei's
review, the driver now prefers a clock which smears leap seconds, as
the Linux RTC class does, but falls back to the first other UTC clock,
since QEMU only provides a VIRTIO_RTC_CLOCK_UTC clock. Patch 1
explains this in more detail.

Tested on QEMU v11.1.2 with qemu-riscv64_smode_defconfig and
RTC_GOLDFISH disabled, so that the virtio RTC is the only RTC:

- With -device virtio-rtc-pci and with -device virtio-rtc-device,
  "date" reads the host time and advances between reads.
- Setting the time fails with -ENOSYS, as the clocks are read-only.
- With no virtio RTC device, "date" fails cleanly with err=-19.

On sandbox, "ut dm virtio_rtc*" passes.

Hung-Chun Tseng (5):
  virtio: rtc: Add virtio RTC driver
  doc: virtio: List the supported device types
  MAINTAINERS: Add entry for virtio RTC
  virtio: sandbox: Let tests emulate the device side of a virtqueue
  test: dm: Add tests for the virtio RTC driver

 MAINTAINERS                         |   6 +
 arch/sandbox/dts/test.dts           |   5 +
 arch/sandbox/include/asm/test.h     |  25 +++
 doc/develop/driver-model/virtio.rst |  10 +-
 drivers/virtio/Kconfig              |  11 +
 drivers/virtio/Makefile             |   1 +
 drivers/virtio/virtio-uclass.c      |   1 +
 drivers/virtio/virtio_rtc.c         | 249 ++++++++++++++++++++++
 drivers/virtio/virtio_sandbox.c     |  15 ++
 include/virtio.h                    |   4 +-
 test/dm/Makefile                    |   1 +
 test/dm/virtio_rtc.c                | 306 ++++++++++++++++++++++++++++
 12 files changed, 632 insertions(+), 2 deletions(-)
 create mode 100644 drivers/virtio/virtio_rtc.c
 create mode 100644 test/dm/virtio_rtc.c


base-commit: 32ebe922e574a733d01c3f106fa77d9176bfecad
-- 
2.43.0


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

end of thread, other threads:[~2026-10-18  1:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17 18:46 [PATCH v3 0/5] virtio: Add a virtio RTC driver Hung-Chun Tseng
2026-10-17 18:46 ` [PATCH v3 1/5] virtio: rtc: Add " Hung-Chun Tseng
2026-10-17 19:06   ` Kuan-Wei Chiu
2026-10-18  1:05     ` Hung-Chun Tseng
2026-10-17 19:13   ` Kuan-Wei Chiu
2026-10-17 19:32     ` Kuan-Wei Chiu
2026-10-18  1:05       ` Hung-Chun Tseng
2026-10-18  1:05     ` Hung-Chun Tseng
2026-10-17 18:46 ` [PATCH v3 2/5] doc: virtio: List the supported device types Hung-Chun Tseng
2026-10-17 18:46 ` [PATCH v3 3/5] MAINTAINERS: Add entry for virtio RTC Hung-Chun Tseng
2026-10-17 18:46 ` [PATCH v3 4/5] virtio: sandbox: Let tests emulate the device side of a virtqueue Hung-Chun Tseng
2026-10-17 18:46 ` [PATCH v3 5/5] test: dm: Add tests for the virtio RTC driver Hung-Chun Tseng

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.