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:
 <DU0PR04MB9417004E7A877D306DD561A1887A2@DU0PR04MB9417.eurprd04.prod.outlook.com>
Date: Thu, 25 Jan 2024 11:07:15 +0000
From: Peng Fan <peng.fan@....com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>, "rafael@...nel.org"
	<rafael@...nel.org>, "daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>
CC: "rui.zhang@...el.com" <rui.zhang@...el.com>, "linux-pm@...r.kernel.org"
	<linux-pm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, Sascha Hauer <s.hauer@...gutronix.de>
Subject: RE: [PATCH] thermal/drivers/qoriq: fix getting tmu range

Hi Daniel,

> Subject: [PATCH] thermal/drivers/qoriq: fix getting tmu range
> 

Would you pick up this patch?

Thanks,
Peng.

> From: Peng Fan <peng.fan@....com>
> 
> TMU Version 1 has 4 TTRCRs, while TMU Version >=2 has 16 TTRCRs.
> So limit the len to 4 will report "invalid range data" for i.MX93.
> 
> This patch drop the local array with allocated ttrcr array and able to support
> larger tmu ranges.
> 
> Fixes: f12d60c81fce ("thermal/drivers/qoriq: Support version 2.1")
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---
>  drivers/thermal/qoriq_thermal.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/qoriq_thermal.c
> b/drivers/thermal/qoriq_thermal.c index ccc2eea7f9f5..404f01cca4da
> 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -57,6 +57,9 @@
>  #define REGS_TTRnCR(n)	(0xf10 + 4 * (n)) /* Temperature Range n
>  					   * Control Register
>  					   */
> +#define NUM_TTRCR_V1	4
> +#define NUM_TTRCR_MAX	16
> +
>  #define REGS_IPBRR(n)		(0xbf8 + 4 * (n)) /* IP Block Revision
>  						   * Register n
>  						   */
> @@ -71,6 +74,7 @@ struct qoriq_sensor {
> 
>  struct qoriq_tmu_data {
>  	int ver;
> +	u32 ttrcr[NUM_TTRCR_MAX];
>  	struct regmap *regmap;
>  	struct clk *clk;
>  	struct qoriq_sensor	sensor[SITES_MAX];
> @@ -182,17 +186,17 @@ static int qoriq_tmu_calibration(struct device *dev,
>  				 struct qoriq_tmu_data *data)
>  {
>  	int i, val, len;
> -	u32 range[4];
>  	const u32 *calibration;
>  	struct device_node *np = dev->of_node;
> 
>  	len = of_property_count_u32_elems(np, "fsl,tmu-range");
> -	if (len < 0 || len > 4) {
> +	if (len < 0 || (data->ver == TMU_VER1 && len > NUM_TTRCR_V1) ||
> +	    (data->ver > TMU_VER1 && len > NUM_TTRCR_MAX)) {
>  		dev_err(dev, "invalid range data.\n");
>  		return len;
>  	}
> 
> -	val = of_property_read_u32_array(np, "fsl,tmu-range", range, len);
> +	val = of_property_read_u32_array(np, "fsl,tmu-range", data->ttrcr,
> +len);
>  	if (val != 0) {
>  		dev_err(dev, "failed to read range data.\n");
>  		return val;
> @@ -200,7 +204,7 @@ static int qoriq_tmu_calibration(struct device *dev,
> 
>  	/* Init temperature range registers */
>  	for (i = 0; i < len; i++)
> -		regmap_write(data->regmap, REGS_TTRnCR(i), range[i]);
> +		regmap_write(data->regmap, REGS_TTRnCR(i), data->ttrcr[i]);
> 
>  	calibration = of_get_property(np, "fsl,tmu-calibration", &len);
>  	if (calibration == NULL || len % 8) {
> --
> 2.37.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ