The date command only uses RTC sequence 0. On the ARM and RISC-V virt machines that is the PL031 or Goldfish RTC, so date never reads the virtio RTC unless that driver is disabled. rtc dev does not help, as rtc read reads raw registers, which the virtio RTC does not have.
Say this in the virtio documentation, and that x86 needs DM_RTC. Suggested-by: Simon Glass <[email protected]> Signed-off-by: Hung-Chun Tseng <[email protected]> --- This is the follow-up Simon suggested on v5. It applies on top of the v5 series. In my reply to the v5 cover letter I said the doc would point to "rtc dev" and "rtc read". That was wrong: "rtc dev 1" selects the virtio RTC, but "rtc read" then fails with -ENOSYS, as the driver has no register access. doc/develop/driver-model/virtio.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/develop/driver-model/virtio.rst b/doc/develop/driver-model/virtio.rst index 30df0e944..94d3dabbd 100644 --- a/doc/develop/driver-model/virtio.rst +++ b/doc/develop/driver-model/virtio.rst @@ -81,6 +81,14 @@ on QEMU ARM and x86, and v2.12.0+ on QEMU RISC-V. The VirtIO RTC device (``-device virtio-rtc-pci`` or ``-device virtio-rtc-device``) requires QEMU v11.1.0+. +The ``date`` command only uses RTC sequence 0. The ARM and RISC-V ``virt`` +machines also have a PL031 or Goldfish RTC, which gets sequence 0, so +``date`` reads the VirtIO RTC there only if ``CONFIG_RTC_PL031`` or +``CONFIG_RTC_GOLDFISH`` is disabled. ``rtc list`` shows the sequence numbers. +``rtc dev`` does not help, as ``rtc read`` reads raw registers, which the +VirtIO RTC does not have. On x86, ``CONFIG_DM_RTC`` must be enabled for the +driver to be built. + Testing ------- The following QEMU command line is used to get U-Boot up and running with -- 2.43.0
