Message ID | 20220215151022.7498-5-eajames@linux.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | hwmon: (occ) Add various poll response data in sysfs | expand |
On Tue, 15 Feb 2022 at 15:11, Eddie James <eajames@linux.ibm.com> wrote: > > Export the power caps data for the soft minimum power cap through hwmon. > > Signed-off-by: Eddie James <eajames@linux.ibm.com> > --- > drivers/hwmon/occ/common.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c > index 0cb4a0a6cbc1..f00cd59f1d19 100644 > --- a/drivers/hwmon/occ/common.c > +++ b/drivers/hwmon/occ/common.c > @@ -674,6 +674,9 @@ static ssize_t occ_show_caps_3(struct device *dev, > case 7: > val = caps->user_source; > break; > + case 8: > + val = get_unaligned_be16(&caps->soft_min) * 1000000ULL; > + break; > default: > return -EINVAL; > } > @@ -835,12 +838,13 @@ static int occ_setup_sensor_attrs(struct occ *occ) > case 1: > num_attrs += (sensors->caps.num_sensors * 7); > break; > - case 3: > - show_caps = occ_show_caps_3; > - fallthrough; > case 2: > num_attrs += (sensors->caps.num_sensors * 8); > break; > + case 3: > + show_caps = occ_show_caps_3; > + num_attrs += (sensors->caps.num_sensors * 9); How do we know this changed from 8 to 9? We should start adding links to the occ source code, or a similar reference, when making these changes so they can be reviewed. > + break; > default: > sensors->caps.num_sensors = 0; > } > @@ -1047,6 +1051,15 @@ static int occ_setup_sensor_attrs(struct occ *occ) > attr->sensor = OCC_INIT_ATTR(attr->name, 0444, > show_caps, NULL, 7, 0); > attr++; > + > + if (sensors->caps.version > 2) { > + snprintf(attr->name, sizeof(attr->name), > + "power%d_cap_min_soft", s); > + attr->sensor = OCC_INIT_ATTR(attr->name, 0444, > + show_caps, NULL, > + 8, 0); > + attr++; > + } > } > } > > -- > 2.27.0 >
On 2/16/22 00:33, Joel Stanley wrote: > On Tue, 15 Feb 2022 at 15:11, Eddie James <eajames@linux.ibm.com> wrote: >> Export the power caps data for the soft minimum power cap through hwmon. >> >> Signed-off-by: Eddie James <eajames@linux.ibm.com> >> --- >> drivers/hwmon/occ/common.c | 19 ++++++++++++++++--- >> 1 file changed, 16 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c >> index 0cb4a0a6cbc1..f00cd59f1d19 100644 >> --- a/drivers/hwmon/occ/common.c >> +++ b/drivers/hwmon/occ/common.c >> @@ -674,6 +674,9 @@ static ssize_t occ_show_caps_3(struct device *dev, >> case 7: >> val = caps->user_source; >> break; >> + case 8: >> + val = get_unaligned_be16(&caps->soft_min) * 1000000ULL; >> + break; >> default: >> return -EINVAL; >> } >> @@ -835,12 +838,13 @@ static int occ_setup_sensor_attrs(struct occ *occ) >> case 1: >> num_attrs += (sensors->caps.num_sensors * 7); >> break; >> - case 3: >> - show_caps = occ_show_caps_3; >> - fallthrough; >> case 2: >> num_attrs += (sensors->caps.num_sensors * 8); >> break; >> + case 3: >> + show_caps = occ_show_caps_3; >> + num_attrs += (sensors->caps.num_sensors * 9); > How do we know this changed from 8 to 9? Well we made the structure change a while back when adding P10 support, but didn't bother to export the "soft min" field. Now it's needed. > > We should start adding links to the occ source code, or a similar > reference, when making these changes so they can be reviewed. I would but it doesn't appear to be public for P10 yet... at least, no one has updated the P9 OCC spec hosted in the open-power repo: https://github.com/open-power/docs Thanks, Eddie > >> + break; >> default: >> sensors->caps.num_sensors = 0; >> } >> @@ -1047,6 +1051,15 @@ static int occ_setup_sensor_attrs(struct occ *occ) >> attr->sensor = OCC_INIT_ATTR(attr->name, 0444, >> show_caps, NULL, 7, 0); >> attr++; >> + >> + if (sensors->caps.version > 2) { >> + snprintf(attr->name, sizeof(attr->name), >> + "power%d_cap_min_soft", s); >> + attr->sensor = OCC_INIT_ATTR(attr->name, 0444, >> + show_caps, NULL, >> + 8, 0); >> + attr++; >> + } >> } >> } >> >> -- >> 2.27.0 >>
On Wed, 16 Feb 2022 at 20:09, Eddie James <eajames@linux.ibm.com> wrote: > > > On 2/16/22 00:33, Joel Stanley wrote: > > On Tue, 15 Feb 2022 at 15:11, Eddie James <eajames@linux.ibm.com> wrote: > >> Export the power caps data for the soft minimum power cap through hwmon. > >> > >> Signed-off-by: Eddie James <eajames@linux.ibm.com> > >> --- > >> drivers/hwmon/occ/common.c | 19 ++++++++++++++++--- > >> 1 file changed, 16 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c > >> index 0cb4a0a6cbc1..f00cd59f1d19 100644 > >> --- a/drivers/hwmon/occ/common.c > >> +++ b/drivers/hwmon/occ/common.c > >> @@ -674,6 +674,9 @@ static ssize_t occ_show_caps_3(struct device *dev, > >> case 7: > >> val = caps->user_source; > >> break; > >> + case 8: > >> + val = get_unaligned_be16(&caps->soft_min) * 1000000ULL; > >> + break; > >> default: > >> return -EINVAL; > >> } > >> @@ -835,12 +838,13 @@ static int occ_setup_sensor_attrs(struct occ *occ) > >> case 1: > >> num_attrs += (sensors->caps.num_sensors * 7); > >> break; > >> - case 3: > >> - show_caps = occ_show_caps_3; > >> - fallthrough; > >> case 2: > >> num_attrs += (sensors->caps.num_sensors * 8); > >> break; > >> + case 3: > >> + show_caps = occ_show_caps_3; > >> + num_attrs += (sensors->caps.num_sensors * 9); > > How do we know this changed from 8 to 9? > > > Well we made the structure change a while back when adding P10 support, > but didn't bother to export the "soft min" field. Now it's needed. > > > > > > We should start adding links to the occ source code, or a similar > > reference, when making these changes so they can be reviewed. > > > I would but it doesn't appear to be public for P10 yet... at least, no > one has updated the P9 OCC spec hosted in the open-power repo: > https://github.com/open-power/docs Ok. Lets follow that up internally. For this patch: Reviewed-by: Joel Stanley <joel@jms.id.au> Cheers, Joel
On Tue, Feb 15, 2022 at 09:10:22AM -0600, Eddie James wrote: > Export the power caps data for the soft minimum power cap through hwmon. > > Signed-off-by: Eddie James <eajames@linux.ibm.com> > Reviewed-by: Joel Stanley <joel@jms.id.au> Applied to hwmon-next. Thanks, Guenter > --- > drivers/hwmon/occ/common.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c > index 0cb4a0a6cbc1..f00cd59f1d19 100644 > --- a/drivers/hwmon/occ/common.c > +++ b/drivers/hwmon/occ/common.c > @@ -674,6 +674,9 @@ static ssize_t occ_show_caps_3(struct device *dev, > case 7: > val = caps->user_source; > break; > + case 8: > + val = get_unaligned_be16(&caps->soft_min) * 1000000ULL; > + break; > default: > return -EINVAL; > } > @@ -835,12 +838,13 @@ static int occ_setup_sensor_attrs(struct occ *occ) > case 1: > num_attrs += (sensors->caps.num_sensors * 7); > break; > - case 3: > - show_caps = occ_show_caps_3; > - fallthrough; > case 2: > num_attrs += (sensors->caps.num_sensors * 8); > break; > + case 3: > + show_caps = occ_show_caps_3; > + num_attrs += (sensors->caps.num_sensors * 9); > + break; > default: > sensors->caps.num_sensors = 0; > } > @@ -1047,6 +1051,15 @@ static int occ_setup_sensor_attrs(struct occ *occ) > attr->sensor = OCC_INIT_ATTR(attr->name, 0444, > show_caps, NULL, 7, 0); > attr++; > + > + if (sensors->caps.version > 2) { > + snprintf(attr->name, sizeof(attr->name), > + "power%d_cap_min_soft", s); > + attr->sensor = OCC_INIT_ATTR(attr->name, 0444, > + show_caps, NULL, > + 8, 0); > + attr++; > + } > } > } >
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index 0cb4a0a6cbc1..f00cd59f1d19 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c @@ -674,6 +674,9 @@ static ssize_t occ_show_caps_3(struct device *dev, case 7: val = caps->user_source; break; + case 8: + val = get_unaligned_be16(&caps->soft_min) * 1000000ULL; + break; default: return -EINVAL; } @@ -835,12 +838,13 @@ static int occ_setup_sensor_attrs(struct occ *occ) case 1: num_attrs += (sensors->caps.num_sensors * 7); break; - case 3: - show_caps = occ_show_caps_3; - fallthrough; case 2: num_attrs += (sensors->caps.num_sensors * 8); break; + case 3: + show_caps = occ_show_caps_3; + num_attrs += (sensors->caps.num_sensors * 9); + break; default: sensors->caps.num_sensors = 0; } @@ -1047,6 +1051,15 @@ static int occ_setup_sensor_attrs(struct occ *occ) attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_caps, NULL, 7, 0); attr++; + + if (sensors->caps.version > 2) { + snprintf(attr->name, sizeof(attr->name), + "power%d_cap_min_soft", s); + attr->sensor = OCC_INIT_ATTR(attr->name, 0444, + show_caps, NULL, + 8, 0); + attr++; + } } }
Export the power caps data for the soft minimum power cap through hwmon. Signed-off-by: Eddie James <eajames@linux.ibm.com> --- drivers/hwmon/occ/common.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)