From: Eddie James <eajames@linux.ibm.com>
To: Joel Stanley <joel@jms.id.au>
Cc: linux-hwmon@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH 4/4] hwmon: (occ) Add soft minimum power cap attribute
Date: Wed, 16 Feb 2022 14:09:14 -0600 [thread overview]
Message-ID: <19ac1b85-842f-dfcf-93db-489ab6598ff8@linux.ibm.com> (raw)
In-Reply-To: <CACPK8Xe+M97Covu0+Qc9M-8vdCc9pTXfZjJ9y6_Xm-j1E4GUPQ@mail.gmail.com>
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
>>
next prev parent reply other threads:[~2022-02-16 20:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 15:10 [PATCH 0/4] hwmon: (occ) Add various poll response data in sysfs Eddie James
2022-02-15 15:10 ` [PATCH 1/4] hwmon: (occ) Add sysfs entry for IPS (Idle Power Saver) status Eddie James
2022-02-16 6:10 ` Joel Stanley
2022-02-19 14:36 ` Guenter Roeck
2022-02-15 15:10 ` [PATCH 2/4] hwmon: (occ) Add sysfs entry for OCC mode Eddie James
2022-02-16 6:11 ` Joel Stanley
2022-02-19 14:37 ` Guenter Roeck
2022-02-15 15:10 ` [PATCH 3/4] hwmon: (occ) Add sysfs entries for additional extended status bits Eddie James
2022-02-16 6:12 ` Joel Stanley
2022-02-19 14:37 ` Guenter Roeck
2022-02-15 15:10 ` [PATCH 4/4] hwmon: (occ) Add soft minimum power cap attribute Eddie James
2022-02-16 6:33 ` Joel Stanley
2022-02-16 20:09 ` Eddie James [this message]
2022-02-21 7:39 ` Joel Stanley
2022-02-22 16:52 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19ac1b85-842f-dfcf-93db-489ab6598ff8@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=jdelvare@suse.com \
--cc=joel@jms.id.au \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox