Skip to content

Implement soc-manager-service#699

Open
kurtjd wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
kurtjd:soc-manager-service
Open

Implement soc-manager-service#699
kurtjd wants to merge 1 commit intoOpenDevicePartnership:v0.2.0from
kurtjd:soc-manager-service

Conversation

@kurtjd
Copy link
Contributor

@kurtjd kurtjd commented Jan 31, 2026

There were a few suggestions for what the soc-manager-service should handle, but for several of them I couldn't come up with abstractions I felt satisfied with after thinking about them and experimenting.

For now, this PR keeps it simple and focuses on proper power state transitioning and power regulator rollback in event of failure. In its current state it is more of a library than a service as there are no associated tasks, but that will likely change in the future.

Power state transition
I followed the docs from here for my understanding of valid power state transitions. Offline it was discussed that the embedded-power-sequence traits be renamed to match ACPI power state names, but in this context, I think it makes sense to keep them as-is. The S0, S3, etc terminology reflects a state, but we can view the embedded-power-sequence traits as state transitions which are aptly named IMO. Also just added a simple standard interface for allowing multiple listeners to power state changes (since currently platforms are just rolling their own slightly different but ultimately the same implementation for this).

Rollback
Made a simple data structure backed by a heapless vec which acts as a stack that regulator operations can be pushed to. In the event of failure, or explicitly called rollback, this just allows us to reverse every prior regulator operation. The idea is this will be used in the embedded-power-sequence trait impls for a SoC (the docs contain an example of how I pictured it being used).

Other suggestions folks offered and things I need to think about more:

  • The service should check that temps aren't too hot and there is enough power for a requested state. For power, I couldn't see a way to actually get that information currently. Does power-policy service offer this in some way? After a glance I didn't see anything.
  • The service should monitor watchdog/prochot/reset lines. Offline it was suggested user provide a callback closure that the service can call when one of these lines goes active, but playing around with it, closures are challenging when it comes to async and how they capture variables, and I couldn't yet think of a way to provide much value here that a user couldn't just get from spawning a simple task that does, e.g.:
loop {
    watchdog_rst_pin.wait_for_low().await;
    // Handle it here
}

so will need to think about this a bit more.

  • It was also suggested the service should incorporate some security management stuff, but I'm not familiar with this area yet so will need to research further.

Resolves #685

@kurtjd kurtjd self-assigned this Jan 31, 2026
@kurtjd kurtjd requested a review from a team as a code owner January 31, 2026 00:11
@kurtjd kurtjd added the enhancement New feature or request label Jan 31, 2026
@kurtjd kurtjd force-pushed the soc-manager-service branch from 620a40a to 600100c Compare January 31, 2026 00:19
@kurtjd kurtjd moved this to In review in Embedded Controller Jan 31, 2026
RobertZ2011
RobertZ2011 previously approved these changes Feb 3, 2026
Copy link
Contributor

@tullom tullom left a comment

Choose a reason for hiding this comment

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

Would it be possible to add some simple unit tests for the SocManager and PowerGuard structs?

@jerrysxie jerrysxie requested a review from ayodejiige February 4, 2026 17:06
@jerrysxie
Copy link
Contributor

@kurtjd Can we demonstrate this service on one of soc-ec's platform?

@kurtjd
Copy link
Contributor Author

kurtjd commented Feb 5, 2026

Would it be possible to add some simple unit tests for the SocManager and PowerGuard structs?

Yes, this is a good idea, will add some.

@kurtjd
Copy link
Contributor Author

kurtjd commented Feb 5, 2026

@kurtjd Can we demonstrate this service on one of soc-ec's platform?

Yes I can do this.

Copilot AI review requested due to automatic review settings February 18, 2026 17:05
@kurtjd kurtjd force-pushed the soc-manager-service branch from 600100c to adb2c81 Compare February 18, 2026 17:05
Copy link
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

Introduces a new soc-manager-service crate to centralize SoC power-state transitions (ACPI S0/S0ix/S3/S4/S5) and provide a reusable rollback helper for regulator sequencing.

Changes:

  • Added SocManager with ACPI power-state transition validation and listener support via embassy_sync::watch.
  • Added PowerGuard helper to execute regulator ops and rollback on failures.
  • Wired the new crate into the workspace and lockfile.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
soc-manager-service/src/lib.rs Implements SocManager, power-state enum, and listener API backed by Watch.
soc-manager-service/src/power_guard.rs Adds a heapless stack-based rollback mechanism for regulator enable/disable ops.
soc-manager-service/Cargo.toml Defines the new crate and dependencies (including new git deps).
Cargo.toml Adds soc-manager-service to workspace members.
Cargo.lock Records the new crate and its new git dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kurtjd
Copy link
Contributor Author

kurtjd commented Feb 18, 2026

Would it be possible to add some simple unit tests for the SocManager and PowerGuard structs?

Done. The test coverage isn't exhaustive at the moment but covers the basic functionality. Will add more once some of the interface and functionality is finalized.

tullom
tullom previously approved these changes Feb 19, 2026
@kurtjd
Copy link
Contributor Author

kurtjd commented Feb 19, 2026

@kurtjd Can we demonstrate this service on one of soc-ec's platform?

Yes I can do this.

Mentioned offline I had a branch starting to integrate this into one of our test platforms, but I don't have a working version of that platform at the moment so can't test it. Thus tomorrow I will integrate it into the platform I do have working and will share a link to the branch after I've verified it (will share the link internally since it would be on a private repo).

Copilot AI review requested due to automatic review settings February 19, 2026 22:23
@kurtjd kurtjd force-pushed the soc-manager-service branch from 87e7147 to 93622b6 Compare February 19, 2026 22:23
@kurtjd
Copy link
Contributor Author

kurtjd commented Feb 19, 2026

@kurtjd Can we demonstrate this service on one of soc-ec's platform?

Yes I can do this.

Mentioned offline I had a branch starting to integrate this into one of our test platforms, but I don't have a working version of that platform at the moment so can't test it. Thus tomorrow I will integrate it into the platform I do have working and will share a link to the branch after I've verified it (will share the link internally since it would be on a private repo).

Shared link to working integration into one of our hardware platforms.

Copy link
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

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 19, 2026 22:47
@kurtjd kurtjd force-pushed the soc-manager-service branch from e0f2746 to 02d95ea Compare February 19, 2026 22:47
Copy link
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

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

4 participants

Comments