Skip to contentSkip to conversation

virtio-rtc: Report smeared UTC clock type

PATCH New Kuan-Wei Chiu 1 participant 1 message Aug 31

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 hw/virtio/virtio-rtc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/virtio-rtc.c +2 -1
index 32de9c1650..0dcbe94758 100644
@@ -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));
Signature · 1 line
2.55.0.897.gb25b4bd76c-goog