Skip to content

Add CMOS RTC time source support to chipset resources#3349

Open
moor-coding wants to merge 1 commit intomicrosoft:mainfrom
moor-coding:rtc-time-source-resourcify
Open

Add CMOS RTC time source support to chipset resources#3349
moor-coding wants to merge 1 commit intomicrosoft:mainfrom
moor-coding:rtc-time-source-resourcify

Conversation

@moor-coding
Copy link
Copy Markdown
Contributor

  • Add CmosRtcTimeSourceHandleKind resource kind with SystemTimeClockHandle as a shared static resolver for system-time-backed clocks.
  • Change CMOS RTC deps time_source from Box to Resource, resolved during chipset build.
  • Add UnderhillCmosRtcTimeSourceResolver for Underhill's GET-backed clock.

- Add CmosRtcTimeSourceHandleKind resource kind with SystemTimeClockHandle
  as a shared static resolver for system-time-backed clocks.
- Change CMOS RTC deps time_source from Box<dyn InspectableLocalClock> to
  Resource<CmosRtcTimeSourceHandleKind>, resolved during chipset build.
- Add UnderhillCmosRtcTimeSourceResolver for Underhill's GET-backed clock.
Copilot AI review requested due to automatic review settings April 21, 2026 21:21
@moor-coding moor-coding marked this pull request as ready for review April 21, 2026 21:21
@moor-coding moor-coding requested a review from a team as a code owner April 21, 2026 21:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a resource-kind based mechanism for supplying CMOS RTC “real time” sources, so RTC devices can resolve their clock implementation during chipset build (supporting both host system-time clocks and Underhill’s GET-backed clock).

Changes:

  • Introduces CmosRtcTimeSourceHandleKind plus a SystemTimeClockHandle + static resolver in chipset_resources.
  • Switches CMOS RTC deps in vmotherboard from Box<dyn InspectableLocalClock> to Resource<CmosRtcTimeSourceHandleKind> and resolves them during chipset build.
  • Wires OpenVMM to use SystemTimeClockHandle and Underhill to provide a platform clock via UnderhillCmosRtcTimeSourceResolver.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vmm_core/vmotherboard/src/base_chipset.rs Resolve RTC time-source resources during chipset build; update deps types; add resolve error variant
vm/devices/chipset_resources/src/lib.rs Add CMOS RTC time-source resource kind and system-time-backed resolver
vm/devices/chipset_resources/Cargo.toml Add local_clock dependency for new resolver
openvmm/openvmm_resources/src/lib.rs Register SystemTimeClockResolver as a static resolver
openvmm/openvmm_resources/Cargo.toml Add chipset_resources dependency
openvmm/openvmm_core/src/worker/dispatch.rs Construct RTC time-source resources via SystemTimeClockHandle
openhcl/underhill_core/src/worker.rs Add dynamic PlatformResource resolver for Underhill RTC time source; pass platform resource into RTC deps
openhcl/underhill_core/Cargo.toml Add chipset_resources dependency
openhcl/openvmm_hcl_resources/src/lib.rs Register SystemTimeClockResolver as a static resolver
openhcl/openvmm_hcl_resources/Cargo.toml Add chipset_resources dependency
Cargo.lock Lockfile updates for new deps

FeatureGatedDevice(&'static str),
#[error("no valid ISA DMA controller for floppy")]
NoDmaForFloppy,
#[error("failed to resolve resource")]
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

ResolveResource uses the generic message "failed to resolve resource" for CMOS RTC time-source resolution. Since this error can occur in multiple call sites (generic RTC vs PIIX4 RTC) and ResolveError typically only identifies kind/id, it’s hard to tell which device path failed from the top-level error. Consider making the variant/message RTC-specific (or splitting into separate variants per device) so the error context includes which RTC device was being built/resolved.

Suggested change
#[error("failed to resolve resource")]
#[error("failed to resolve CMOS RTC time-source resource")]

Copilot uses AI. Check for mistakes.
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.

2 participants