[PATCH] virtio-rtc: Report smeared UTC clock type

Kuan-Wei Chiu posted 1 patch 3 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260831190612.369235-1-visitorckw@gmail.com
Maintainers: Kuan-Wei Chiu <visitorckw@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>
hw/virtio/virtio-rtc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] virtio-rtc: Report smeared UTC clock type
Posted by Kuan-Wei Chiu 3 weeks, 5 days ago
The Linux virtio_rtc driver only registers an RTC class device when the
clock type is VIRTIO_RTC_CLOCK_UTC_SMEARED to avoid leap second steps on
pure UTC clocks.

Report VIRTIO_RTC_CLOCK_UTC_SMEARED in clock capabilities so the guest
can expose the device as an RTC device.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
 hw/virtio/virtio-rtc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-rtc.c b/hw/virtio/virtio-rtc.c
index 32de9c1650..0dcbe94758 100644
--- a/hw/virtio/virtio-rtc.c
+++ b/hw/virtio/virtio-rtc.c
@@ -62,7 +62,8 @@ static void virtio_rtc_handle_request(VirtIODevice *vdev, VirtQueue *vq)
                 resp.head.status = VIRTIO_RTC_S_ENODEV;
             } else {
                 resp.head.status = VIRTIO_RTC_S_OK;
-                resp.type = VIRTIO_RTC_CLOCK_UTC;
+                resp.type = VIRTIO_RTC_CLOCK_UTC_SMEARED;
+                resp.leap_second_smearing = VIRTIO_RTC_SMEAR_UNSPECIFIED;
             }
             written = iov_from_buf(elem->in_sg, elem->in_num, 0, &resp,
                                    sizeof(resp));
-- 
2.55.0.897.gb25b4bd76c-goog