Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve PMBus handling for PSC #252

Merged
merged 5 commits into from
Oct 27, 2022
Merged

Improve PMBus handling for PSC #252

merged 5 commits into from
Oct 27, 2022

Conversation

mkeeter
Copy link
Contributor

@mkeeter mkeeter commented Oct 26, 2022

When bringing up the PSC firmware, I ran into a few issues.

Both Hubris and Humility assume that for an I2C device with a power = { rails = [ ... ] } field, all sensors (voltage / current / temperature / etc) correspond one-to-one with power rails.

This is problematic for the power shelves, which have two rails (54V and 12V), two fans (uncorrelated to voltage rails), and three temperature sensors (also unrelated to rails!).

This PR adds support for an optional sensors = [ ... ] field within power, e.g.

[[config.i2c.devices]]
bus = "backplane"
name = "psu0mcu"
address = 0b1011_000
device = "mwocp68"
description = "PSU 0 MCU"
power = { rails = [ "V54_PSU0", "V12_PSU0" ], sensors = ["voltage", "current"] }
sensors = { voltage = 2, current = 2, temperature = 3, speed = 2 }

The sensors field indicates that only voltage and current correspond one-to-one with rails; other sensor types are treated as independent.

If the sensors field is blank (i.e. all of our existing TOML files), then every sensor corresponds one-to-one with rails, matching the current behavior.

In addition, humility pmbus --summarize is modified to not bail! on an error; instead, it prints the error and continues. This makes working with the PSC nicer, because not all 6 PSUs will be populated at all times.

Screen Shot 2022-10-26 at 3 13 52 PM

@mkeeter mkeeter requested a review from bcantrill October 26, 2022 19:21
Copy link
Contributor

@bcantrill bcantrill left a comment

Choose a reason for hiding this comment

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

Looks great!

if let Some(rails) = &power.rails {
} else if d.power.is_some()
&& d.power
.as_ref()
Copy link
Contributor

Choose a reason for hiding this comment

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

/me shakes fist at rust-lang/rustfmt#4306

@mkeeter mkeeter merged commit 470e5db into master Oct 27, 2022
@mkeeter mkeeter deleted the power-optional-sensors branch October 27, 2022 17:24
beezow pushed a commit to rivosinc/humility that referenced this pull request Nov 10, 2022
When bringing up the PSC firmware, I ran into a few issues.

Both Hubris and Humility assume that for an I2C device with a
```toml
power = { rails = [ ... ] }
```
field, all sensors (voltage / current / temperature / etc) correspond one-to-one
with power rails.

This is problematic for the power shelves, which have two rails (54V and 12V),
two fans (uncorrelated to voltage rails), and _three_ temperature sensors (also
unrelated to rails!).

This PR adds support for an optional `sensors = [ ... ]` field within power, e.g.
```toml
[[config.i2c.devices]]
bus = "backplane"
name = "psu0mcu"
address = 0b1011_000
device = "mwocp68"
description = "PSU 0 MCU"
power = { rails = [ "V54_PSU0", "V12_PSU0" ], sensors = ["voltage", "current"] }
sensors = { voltage = 2, current = 2, temperature = 3, speed = 2 }
```

The `sensors` field indicates that only `voltage` and `current` correspond
one-to-one with rails; other sensor types are treated as independent.

If the `sensors` field is blank (i.e. all of our existing TOML files), then
every sensor corresponds one-to-one with rails, matching the current behavior.

In addition, `humility pmbus --summarize` is modified to not `bail!` on an
error; instead, it prints the error and continues.  This makes working with the
PSC nicer, because not all 6 PSUs will be populated at all times.
beezow pushed a commit to rivosinc/humility that referenced this pull request Nov 11, 2022
When bringing up the PSC firmware, I ran into a few issues.

Both Hubris and Humility assume that for an I2C device with a
```toml
power = { rails = [ ... ] }
```
field, all sensors (voltage / current / temperature / etc) correspond one-to-one
with power rails.

This is problematic for the power shelves, which have two rails (54V and 12V),
two fans (uncorrelated to voltage rails), and _three_ temperature sensors (also
unrelated to rails!).

This PR adds support for an optional `sensors = [ ... ]` field within power, e.g.
```toml
[[config.i2c.devices]]
bus = "backplane"
name = "psu0mcu"
address = 0b1011_000
device = "mwocp68"
description = "PSU 0 MCU"
power = { rails = [ "V54_PSU0", "V12_PSU0" ], sensors = ["voltage", "current"] }
sensors = { voltage = 2, current = 2, temperature = 3, speed = 2 }
```

The `sensors` field indicates that only `voltage` and `current` correspond
one-to-one with rails; other sensor types are treated as independent.

If the `sensors` field is blank (i.e. all of our existing TOML files), then
every sensor corresponds one-to-one with rails, matching the current behavior.

In addition, `humility pmbus --summarize` is modified to not `bail!` on an
error; instead, it prints the error and continues.  This makes working with the
PSC nicer, because not all 6 PSUs will be populated at all times.
bcantrill pushed a commit that referenced this pull request Jun 22, 2023
When bringing up the PSC firmware, I ran into a few issues.

Both Hubris and Humility assume that for an I2C device with a
```toml
power = { rails = [ ... ] }
```
field, all sensors (voltage / current / temperature / etc) correspond one-to-one
with power rails.

This is problematic for the power shelves, which have two rails (54V and 12V),
two fans (uncorrelated to voltage rails), and _three_ temperature sensors (also
unrelated to rails!).

This PR adds support for an optional `sensors = [ ... ]` field within power, e.g.
```toml
[[config.i2c.devices]]
bus = "backplane"
name = "psu0mcu"
address = 0b1011_000
device = "mwocp68"
description = "PSU 0 MCU"
power = { rails = [ "V54_PSU0", "V12_PSU0" ], sensors = ["voltage", "current"] }
sensors = { voltage = 2, current = 2, temperature = 3, speed = 2 }
```

The `sensors` field indicates that only `voltage` and `current` correspond
one-to-one with rails; other sensor types are treated as independent.

If the `sensors` field is blank (i.e. all of our existing TOML files), then
every sensor corresponds one-to-one with rails, matching the current behavior.

In addition, `humility pmbus --summarize` is modified to not `bail!` on an
error; instead, it prints the error and continues.  This makes working with the
PSC nicer, because not all 6 PSUs will be populated at all times.
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