Skip to content

Commit 0623c75

Browse files
quic-philbermstsirkin
authored andcommitted
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>
1 parent 169294a commit 0623c75

File tree

6 files changed

+983
-0
lines changed

6 files changed

+983
-0
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25827,6 +25827,13 @@ S: Maintained
2582725827
F: drivers/nvdimm/nd_virtio.c
2582825828
F: drivers/nvdimm/virtio_pmem.c
2582925829

25830+
VIRTIO RTC DRIVER
25831+
M: Peter Hilber <quic_philber@quicinc.com>
25832+
L: virtualization@lists.linux.dev
25833+
S: Maintained
25834+
F: drivers/virtio/virtio_rtc_*
25835+
F: include/uapi/linux/virtio_rtc.h
25836+
2583025837
VIRTIO SOUND DRIVER
2583125838
M: Anton Yakovlev <anton.yakovlev@opensynergy.com>
2583225839
M: "Michael S. Tsirkin" <mst@redhat.com>

drivers/virtio/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,17 @@ config VIRTIO_DEBUG
188188

189189
If unsure, say N.
190190

191+
config VIRTIO_RTC
192+
tristate "Virtio RTC driver"
193+
depends on VIRTIO
194+
depends on PTP_1588_CLOCK_OPTIONAL
195+
help
196+
This driver provides current time from a Virtio RTC device. The driver
197+
provides the time through one or more clocks.
198+
199+
To compile this code as a module, choose M here: the module will be
200+
called virtio_rtc.
201+
202+
If unsure, say M.
203+
191204
endif # VIRTIO_MENU

drivers/virtio/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ obj-$(CONFIG_VIRTIO_VDPA) += virtio_vdpa.o
1414
obj-$(CONFIG_VIRTIO_MEM) += virtio_mem.o
1515
obj-$(CONFIG_VIRTIO_DMA_SHARED_BUFFER) += virtio_dma_buf.o
1616
obj-$(CONFIG_VIRTIO_DEBUG) += virtio_debug.o
17+
obj-$(CONFIG_VIRTIO_RTC) += virtio_rtc.o
18+
virtio_rtc-y := virtio_rtc_driver.o

0 commit comments

Comments
 (0)