This patch series introduces initial support for the virtio-rtc device
(VIRTIO_ID_CLOCK), based on the OASIS virtio-rtc specification.
This implementation provides a single read-only clock that returns
the host's QEMU_CLOCK_HOST time in nanoseconds. It handles the
basic control and read requests necessary for the device to be
successfully probed and utilized by the upstream Linux virtio_rtc
driver.
I have verified this implementation using the virtio_rtc driver from
the Linux mainline. The device probes successfully, and the host time
can be correctly read from the guest using the following commands:
$ cat /sys/class/rtc/rtc0/time
$ cat /sys/class/rtc/rtc0/date
$ hwclock -r -f /dev/rtc0
Kuan-Wei Chiu (2):
standard-headers: Add virtio_rtc.h from Linux 7.0-rc1
virtio-rtc: Add basic virtio-rtc support
MAINTAINERS | 7 +
hw/virtio/Kconfig | 5 +
hw/virtio/meson.build | 2 +
hw/virtio/virtio-rtc-pci.c | 65 ++++++
hw/virtio/virtio-rtc.c | 190 ++++++++++++++++
include/hw/virtio/virtio-rtc.h | 22 ++
include/standard-headers/linux/virtio_rtc.h | 237 ++++++++++++++++++++
7 files changed, 528 insertions(+)
create mode 100644 hw/virtio/virtio-rtc-pci.c
create mode 100644 hw/virtio/virtio-rtc.c
create mode 100644 include/hw/virtio/virtio-rtc.h
create mode 100644 include/standard-headers/linux/virtio_rtc.h
--
2.53.0.473.g4a7958ca14-goog