lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210811231805.GA1095781@roeck-us.net>
Date:   Wed, 11 Aug 2021 16:18:05 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Chris Packham <Chris.Packham@...iedtelesis.co.nz>
Cc:     "jdelvare@...e.com" <jdelvare@...e.com>,
        "linux-hwmon@...r.kernel.org" <linux-hwmon@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] hwmon: (pmbus/bpa-rs600) Add workaround for
 incorrect Pin max

On Wed, Aug 11, 2021 at 10:19:44PM +0000, Chris Packham wrote:
> 
> On 12/08/21 7:53 am, Guenter Roeck wrote:
> > On Wed, Aug 11, 2021 at 04:17:38PM +1200, Chris Packham wrote:
> >> BPD-RS600 modules running firmware v5.70 misreport the MFR_PIN_MAX.
> >> The indicate a maximum of 1640W instead of 700W. Detect the invalid
> >> reading and return a sensible value instead.
> >>
> >> Signed-off-by: Chris Packham <chris.packham@...iedtelesis.co.nz>
> >> ---
> >>   drivers/hwmon/pmbus/bpa-rs600.c | 21 ++++++++++++++++++++-
> >>   1 file changed, 20 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/hwmon/pmbus/bpa-rs600.c b/drivers/hwmon/pmbus/bpa-rs600.c
> >> index d495faa89799..f4baed9ce8a4 100644
> >> --- a/drivers/hwmon/pmbus/bpa-rs600.c
> >> +++ b/drivers/hwmon/pmbus/bpa-rs600.c
> >> @@ -65,6 +65,24 @@ static int bpa_rs600_read_vin(struct i2c_client *client)
> >>   	return ret;
> >>   }
> >>   
> >> +/*
> >> + * The firmware on some BPD-RS600 models incorrectly reports 1640W
> >> + * for MFR_PIN_MAX. Deal with this by returning a sensible value.
> >> + */
> >> +static int bpa_rs600_read_pin_max(struct i2c_client *client)
> >> +{
> >> +	int ret;
> >> +
> >> +	ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_MFR_PIN_MAX);
> >> +	if (ret < 0)
> >> +		return ret;
> >> +
> >> +	if (ret == 0x0b34)
> >> +		return 0x095e;
> > The comments from the descriotion need to be here.
> will update
> > Thanks,
> > Guenter
> >
> >> +
> >> +	return ret;
> >> +}
> >> +
> >>   static int bpa_rs600_read_word_data(struct i2c_client *client, int page, int phase, int reg)
> >>   {
> >>   	int ret;
> >> @@ -92,7 +110,8 @@ static int bpa_rs600_read_word_data(struct i2c_client *client, int page, int pha
> >>   		ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_MFR_IOUT_MAX);
> >>   		break;
> >>   	case PMBUS_PIN_OP_WARN_LIMIT:
> >> -		ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_MFR_PIN_MAX);
> >> +	case PMBUS_MFR_PIN_MAX:
> >> +		ret = bpa_rs600_read_pin_max(client);
> > So the idea is to return the same value for PMBUS_PIN_OP_WARN_LIMIT
> > (max_alarm) and PMBUS_MFR_PIN_MAX (rated_max) ? That doesn't really
> > make sense. The meaning of those limits is distinctly different.
> For the BPA-RS600/BPD-RS600 these appear to be treated the same.

What a mess. This needs to be documented in the driver, including the
behavior if any of those attributes is written into.

Guenter

> >
> > Guenter
> >
> >>   		break;
> >>   	case PMBUS_POUT_OP_WARN_LIMIT:
> >>   		ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_MFR_POUT_MAX);
> >> -- 
> >> 2.32.0
> >>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ