Commit e157e9f6cc for qemu.org
commit e157e9f6cc1d0394b9d7fc2cabc06550b823d57d
Author: Kuan-Wei Chiu <visitorckw@gmail.com>
Date: Mon Aug 31 19:06:12 2026 +0000
virtio-rtc: Report smeared UTC clock type
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>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260831190612.369235-1-visitorckw@gmail.com>
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));