virtio_rtc: Add module and driver core

Add the virtio_rtc module and driver core. The virtio_rtc module implements
a driver compatible with the proposed Virtio RTC device specification.
The Virtio RTC (Real Time Clock) device provides information about current
time. The device can provide different clocks, e.g. for the UTC or TAI time
standards, or for physical time elapsed since some past epoch. The driver
can read the clocks with simple or more accurate methods.

Implement the core, which interacts with the Virtio RTC device. Apart from
this, the core does not expose functionality outside of the virtio_rtc
module. Follow-up patches will expose PTP clocks and an RTC Class device.

Provide synchronous messaging, which is enough for the expected time
synchronization use cases through PTP clocks (similar to ptp_kvm) or RTC
Class device.

Signed-off-by: Peter Hilber <quic_philber@quicinc.com>
Message-Id: <20250509160734.1772-2-quic_philber@quicinc.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Peter Hilber
2025-05-09 18:07:22 +02:00
committed by Michael S. Tsirkin
parent 169294a14b
commit 0623c75927
6 changed files with 983 additions and 0 deletions

View File

@@ -188,4 +188,17 @@ config VIRTIO_DEBUG
If unsure, say N.
config VIRTIO_RTC
tristate "Virtio RTC driver"
depends on VIRTIO
depends on PTP_1588_CLOCK_OPTIONAL
help
This driver provides current time from a Virtio RTC device. The driver
provides the time through one or more clocks.
To compile this code as a module, choose M here: the module will be
called virtio_rtc.
If unsure, say M.
endif # VIRTIO_MENU