Skip to content

Kernel/riscv64: Support the Google Goldfish real-time clock#26698

Merged
spholz merged 1 commit intoSerenityOS:masterfrom
spholz:kernel-goldfish-rtc-driver
Apr 6, 2026
Merged

Kernel/riscv64: Support the Google Goldfish real-time clock#26698
spholz merged 1 commit intoSerenityOS:masterfrom
spholz:kernel-goldfish-rtc-driver

Conversation

@spholz
Copy link
Copy Markdown
Member

@spholz spholz commented Apr 5, 2026

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.

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.
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Apr 5, 2026
Comment thread Kernel/CMakeLists.txt
Bus/PCI/DeviceTreeHelpers.cpp
Bus/PCI/DeviceTreeInitializer.cpp

Devices/Time/GoldfishRTC.cpp
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

@supercomputer7 supercomputer7 Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

@Hendiadyoin1 Hendiadyoin1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this looks surprisingly simple...

@spholz spholz merged commit 14cc6d8 into SerenityOS:master Apr 6, 2026
18 checks passed
@spholz spholz deleted the kernel-goldfish-rtc-driver branch April 6, 2026 14:18
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Apr 6, 2026
@spholz spholz mentioned this pull request Apr 6, 2026
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants