Kernel/riscv64: Support the Google Goldfish real-time clock#26698
Kernel/riscv64: Support the Google Goldfish real-time clock#26698spholz merged 1 commit intoSerenityOS:masterfrom
Conversation
The QEMU virt machine uses a Goldfish RTC device as its real-time clock. This means that we now display the correct time in riscv64 QEMU and date-dependent tests no longer fail! This driver is based on the PL031 driver.
| Bus/PCI/DeviceTreeHelpers.cpp | ||
| Bus/PCI/DeviceTreeInitializer.cpp | ||
|
|
||
| Devices/Time/GoldfishRTC.cpp |
There was a problem hiding this comment.
I decided to not put it in Arch/riscv64, since the device isn't RISC-V-specific. But it's only used on riscv64 currently.
There was a problem hiding this comment.
Hmm, maybe we should still put it under riscv64?
Like you said, nothing else uses that, and in case we ever want to make a system that shows what is supported or not (like kconfig on Linux), this might confuse such system.
There was a problem hiding this comment.
I don't think we should have user-configurable config options, like linux kconfig. Also, there already are other files that are only compiled on devicetree systems.
There was a problem hiding this comment.
Nothing prevents QEMU or some other emulator/VM to use a goldfish RTC device, in which case we would need to move it out of Arch/.
In fact, QEMU will need to choose a different RTC device on AArch64 before 2038, since the PL031 only exposes a 32-bit time_t.
Hendiadyoin1
left a comment
There was a problem hiding this comment.
Well this looks surprisingly simple...
The QEMU virt machine uses a Goldfish RTC device as its real-time clock. This means that we now display the correct time in riscv64 QEMU and date-dependent tests no longer fail!
This driver is based on the PL031 driver.