All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 0/6] virtio: Add a virtio RTC driver
@ 2026-11-08 23:34 Hung-Chun Tseng
  2026-11-08 23:34 ` [PATCH v7 1/6] virtio: rtc: Add " Hung-Chun Tseng
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Hung-Chun Tseng @ 2026-11-08 23:34 UTC (permalink / raw)
  To: u-boot; +Cc: bmeng.cn, bin.meng, 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 U-Boot can read the time from it through the RTC uclass.

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. Patch 6 documents how to reach the virtio RTC.

Changes in v7:
- Patch 6: drop the claim that QEMU x86 does not enable DM_RTC. X86
  implies DM_RTC, so the driver is already built there (Simon).
- Cover letter: no longer claim that "date" reads the virtio RTC on
  any QEMU target, which patch 6 explains is not the case (Simon, v5).
- Rebase onto main. Patches 1-5 are unchanged.

Tested with qemu-riscv64_smode_defconfig and RTC_GOLDFISH disabled, on
QEMU v11.1.2, which reports a UTC clock, and on QEMU master, which
reports a smeared UTC clock:

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

With qemu-x86_64_defconfig on QEMU v11.1.2, "dm uclass rtc" shows the
CMOS RTC at sequence 0 and the virtio RTC at 1; with RTC_MC146818
disabled, the virtio RTC is sequence 0 and "date" reads it.

On sandbox, "ut dm virtio_rtc*" passes.

Hung-Chun Tseng (6):
  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
  doc: virtio: Explain how to reach the virtio RTC

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

-- 
2.43.0


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

end of thread, other threads:[~2026-11-09 23:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-08 23:34 [PATCH v7 0/6] virtio: Add a virtio RTC driver Hung-Chun Tseng
2026-11-08 23:34 ` [PATCH v7 1/6] virtio: rtc: Add " Hung-Chun Tseng
2026-11-08 23:34 ` [PATCH v7 2/6] doc: virtio: List the supported device types Hung-Chun Tseng
2026-11-08 23:34 ` [PATCH v7 3/6] MAINTAINERS: Add entry for virtio RTC Hung-Chun Tseng
2026-11-08 23:34 ` [PATCH v7 4/6] virtio: sandbox: Let tests emulate the device side of a virtqueue Hung-Chun Tseng
2026-11-08 23:34 ` [PATCH v7 5/6] test: dm: Add tests for the virtio RTC driver Hung-Chun Tseng
2026-11-08 23:34 ` [PATCH v7 6/6] doc: virtio: Explain how to reach the virtio RTC Hung-Chun Tseng
2026-11-09  7:55 ` [PATCH v7 0/6] virtio: Add a virtio RTC driver Heinrich Schuchardt
2026-11-09 23:35   ` 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.