Skip to content

expose PMBus device info from build-i2c codegen; set IS_PMBUS#2519

Open
hawkw wants to merge 4 commits into
masterfrom
eliza/hi-im-a-pmbus
Open

expose PMBus device info from build-i2c codegen; set IS_PMBUS#2519
hawkw wants to merge 4 commits into
masterfrom
eliza/hi-im-a-pmbus

Conversation

@hawkw
Copy link
Copy Markdown
Member

@hawkw hawkw commented May 18, 2026

This branch consists of three separate commits which build upon each other, and which I would like to rebase-merge as three separate commits to master. Overall, the primary goal here is to start populating the IS_PMBUS bit in the control-plane-agent inventory's DeviceCapabilities, which was added in oxidecomputer/management-gateway-service#488. In addition, I also tried to do some prep for future changes that want to generate more code for all PMBus devices, such as what @jamesmunns is working on in #2463.

In particular, the three commits do the following:

  1. Update the management-gateway-service dep to pick up the new DeviceCapabilities flags

  2. Add code in build-i2c's public API that is exposed to other build scripts (the device_descriptions() API) to indicate which devices are PMBus devices. In particular, I2cDeviceDescription now includes an optional PmbusDeviceDescription field, which is Some for PMBus devices. The presence of this field can be used to determine when a device is a PMBus device, such as when determining if the IS_PMBUS capability should be advertised.

    I did this by adding a whole new optional struct rather than just sticking an is_pmbus bool on I2cDeviceDescription, because I felt like future code, such as what @jamesmunns is working on for want to read PMBus status registers via MGS #2463, will almost certainly want a way to get a PMBus device's rail and phase names in codegen that lives outside of build-i2c (i.e. in
    task-validate-api's build script). Currently, there isn't a nice way
    to get this stuff in codegen that lives outside of build-i2c, so this
    should help make that nicer.

    Then, I've modified the codegen in task-validate-api, which is what control-plane-agent ultimately consumes for its codegen inventory devices, to include an is_pmbus field so that we can use this to populate the DeviceCapabilities flag.

  3. Finally, actually set the flag in control-plane-agent. :)

hawkw added 3 commits May 20, 2026 09:32
This commit updates our Git dep on the `management-gateway-service`
repo to
oxidecomputer/management-gateway-service@745a508.

This is primarily in order to pick up
oxidecomputer/management-gateway-service#488, which adds new
`DeviceCapabilities` bits for PMBus devices and for devices which have
VPD.
This commit adds a new `PmbusDeviceDescription` to the `build-i2c`
crate. `I2cDeviceDescription` now includes an optional
`PmbusDeviceDescription` field which is `Some` for PMBus devices.
The presence of this field can be used to determine when a device
is a PMBus device, such as when determining if the `IS_PMBUS`
capability should be advertised.

I did this by adding a whole new optional struct rather than just
sticking an `is_pmbus` bool on `I2cDeviceDescription`, because I felt
like future code, such as what @jamesmunns is working on for #2463,
will almost certainly want a way to get a PMBus device's rail and phase
names in codegen that lives outside of `build-i2c` (i.e. in
`task-validate-api`'s build script). Currently, there isn't a nice way
to get this stuff in codegen that lives outside of `build-i2c`, so this
should help make that nicer.
Now that we have the appropriate information available at codegen-time
to know if an I2C device is a PMbus device, we can actually set this
flag. Yay! Now the control plane can know which devices are PMBus!
@hawkw hawkw force-pushed the eliza/hi-im-a-pmbus branch from 732ab05 to 9526186 Compare May 20, 2026 16:47
@hawkw hawkw changed the title Eliza/hi im a pmbus expose PMBus device info from build-i2c codegen; set IS_PMBUS May 20, 2026
@hawkw hawkw marked this pull request as ready for review May 20, 2026 16:53
@hawkw hawkw added service processor Related to the service processor. fault-management Everything related to the Oxide's Fault Management architecture implementation control-plane-agent labels May 20, 2026
Comment thread build/i2c/src/lib.rs
.flatten()
.enumerate()
.map(|(i, rail)| {
let phases = if let Some(ref phases_list) = power.phases
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Might be worth hoisting this up to the top level, and doing one arm for "has phases" and one for "doesn't have phases"? Then we could do a single assert for "lengths match", and then zip together rails and phases_list, instead of doing .get/indexing by i.

@mkeeter
Copy link
Copy Markdown
Collaborator

mkeeter commented May 21, 2026

@hawkw This generally looks good; can you do a smoke test to make sure this didn't break humility validate or faux-mgs inventory?

@hawkw
Copy link
Copy Markdown
Member Author

hawkw commented May 21, 2026

@jamesmunns
Copy link
Copy Markdown
Contributor

what the heck happened here: https://github.com/oxidecomputer/hubris/actions/runs/26239754200/job/77222643916?pr=2519#step:4:288

I've been seeing these pretty often in other PRs. I'm not sure if it's some kind of cache failure, a build getting cancelled when it shouldn't, or just GitHub jank. It's starting to happen often enough to worry about imo.

@hawkw
Copy link
Copy Markdown
Member Author

hawkw commented May 21, 2026

sigh...

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

Labels

control-plane-agent fault-management Everything related to the Oxide's Fault Management architecture implementation service processor Related to the service processor.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants