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] [day] [month] [year] [list]
Message-ID: <06000105-9438-6803-1ef9-0bfec7c09360@roeck-us.net>
Date:   Wed, 9 Sep 2020 19:26:54 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Andrew Jeffery <andrew@...id.au>, linux-hwmon@...r.kernel.org
Cc:     jdelvare@...e.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] hwmon: (pmbus) Expose PEC debugfs attribute

On 9/9/20 7:11 PM, Andrew Jeffery wrote:
> Enable runtime debug control of whether the PEC byte is exchanged with
> the PMBus device.
> 
> Some manufacturers have asked for the PEC to be disabled as part of
> debugging driver communication issues with devices.
> 
> Signed-off-by: Andrew Jeffery <andrew@...id.au>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/pmbus_core.c | 39 ++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 44535add3a4a..9e7d5f7f0cd0 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2346,6 +2346,42 @@ static int pmbus_debugfs_get_status(void *data, u64 *val)
>  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status,
>  			 NULL, "0x%04llx\n");
>  
> +static int pmbus_debugfs_get_pec(void *data, u64 *val)
> +{
> +	struct i2c_client *client = data;
> +
> +	*val = !!(client->flags & I2C_CLIENT_PEC);
> +
> +	return 0;
> +}
> +
> +static int pmbus_debugfs_set_pec(void *data, u64 val)
> +{
> +	int rc;
> +	struct i2c_client *client = data;
> +
> +	if (!val) {
> +		client->flags &= ~I2C_CLIENT_PEC;
> +		return 0;
> +	}
> +
> +	if (val != 1)
> +		return -EINVAL;
> +
> +	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> +	if (rc < 0)
> +		return rc;
> +
> +	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
> +		return -EOPNOTSUPP;
> +
> +	client->flags |= I2C_CLIENT_PEC;
> +
> +	return 0;
> +}
> +DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
> +			 pmbus_debugfs_set_pec, "%1llu\n");
> +
>  static int pmbus_init_debugfs(struct i2c_client *client,
>  			      struct pmbus_data *data)
>  {
> @@ -2374,6 +2410,9 @@ static int pmbus_init_debugfs(struct i2c_client *client,
>  	if (!entries)
>  		return -ENOMEM;
>  
> +	debugfs_create_file("pec", 0664, data->debugfs, client,
> +			    &pmbus_debugfs_ops_pec);
> +
>  	for (i = 0; i < data->info->pages; ++i) {
>  		/* Check accessibility of status register if it's not page 0 */
>  		if (!i || pmbus_check_status_register(client, i)) {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ