All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
@ 2017-06-27  2:17 ` Stephen Boyd
  0 siblings, 0 replies; 12+ messages in thread
From: Stephen Boyd @ 2017-06-27  2:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel,
	Abhijeet Dharmapurikar, Kiran Gunda

After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
lookups") we always need the ppid_to_apid table regardless of the
version of pmic arbiter we have. Otherwise, we will try to deref
the array when we don't allocate it on v2 hardware like the
msm8974 SoCs.

Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Cc: Kiran Gunda <kgunda@codeaurora.org>
Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 2afe3597982e..f4b7a98a7913 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -134,7 +134,6 @@ struct apid_data {
  * @spmic:		SPMI controller object
  * @ver_ops:		version dependent operations.
  * @ppid_to_apid	in-memory copy of PPID -> channel (APID) mapping table.
- *			v2 only.
  */
 struct spmi_pmic_arb {
 	void __iomem		*rd_base;
@@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 		goto err_put_ctrl;
 	}
 
+	pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
+					sizeof(*pa->ppid_to_apid), GFP_KERNEL);
+	if (!pa->ppid_to_apid) {
+		err = -ENOMEM;
+		goto err_put_ctrl;
+	}
+
 	hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
 
 	if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
@@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 			err = PTR_ERR(pa->wr_base);
 			goto err_put_ctrl;
 		}
-
-		pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
-						PMIC_ARB_MAX_PPID,
-						sizeof(*pa->ppid_to_apid),
-						GFP_KERNEL);
-		if (!pa->ppid_to_apid) {
-			err = -ENOMEM;
-			goto err_put_ctrl;
-		}
 	}
 
 	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
@ 2017-06-27  2:17 ` Stephen Boyd
  0 siblings, 0 replies; 12+ messages in thread
From: Stephen Boyd @ 2017-06-27  2:17 UTC (permalink / raw)
  To: linux-arm-kernel

After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
lookups") we always need the ppid_to_apid table regardless of the
version of pmic arbiter we have. Otherwise, we will try to deref
the array when we don't allocate it on v2 hardware like the
msm8974 SoCs.

Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Cc: Kiran Gunda <kgunda@codeaurora.org>
Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 2afe3597982e..f4b7a98a7913 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -134,7 +134,6 @@ struct apid_data {
  * @spmic:		SPMI controller object
  * @ver_ops:		version dependent operations.
  * @ppid_to_apid	in-memory copy of PPID -> channel (APID) mapping table.
- *			v2 only.
  */
 struct spmi_pmic_arb {
 	void __iomem		*rd_base;
@@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 		goto err_put_ctrl;
 	}
 
+	pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
+					sizeof(*pa->ppid_to_apid), GFP_KERNEL);
+	if (!pa->ppid_to_apid) {
+		err = -ENOMEM;
+		goto err_put_ctrl;
+	}
+
 	hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
 
 	if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
@@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 			err = PTR_ERR(pa->wr_base);
 			goto err_put_ctrl;
 		}
-
-		pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
-						PMIC_ARB_MAX_PPID,
-						sizeof(*pa->ppid_to_apid),
-						GFP_KERNEL);
-		if (!pa->ppid_to_apid) {
-			err = -ENOMEM;
-			goto err_put_ctrl;
-		}
 	}
 
 	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
  2017-06-27  2:17 ` Stephen Boyd
@ 2017-06-28  6:58   ` kgunda at codeaurora.org
  -1 siblings, 0 replies; 12+ messages in thread
From: kgunda @ 2017-06-28  6:58 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Greg Kroah-Hartman, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Abhijeet Dharmapurikar, linux-arm-msm-owner

On 2017-06-27 07:47, Stephen Boyd wrote:
> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> lookups") we always need the ppid_to_apid table regardless of the
> version of pmic arbiter we have. Otherwise, we will try to deref
> the array when we don't allocate it on v2 hardware like the
> msm8974 SoCs.
> 
> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> Cc: Kiran Gunda <kgunda@codeaurora.org>
> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Kiran Gunda <kgunda@codeaurora.org>
> ---
>  drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/spmi/spmi-pmic-arb.c 
> b/drivers/spmi/spmi-pmic-arb.c
> index 2afe3597982e..f4b7a98a7913 100644
> --- a/drivers/spmi/spmi-pmic-arb.c
> +++ b/drivers/spmi/spmi-pmic-arb.c
> @@ -134,7 +134,6 @@ struct apid_data {
>   * @spmic:		SPMI controller object
>   * @ver_ops:		version dependent operations.
>   * @ppid_to_apid	in-memory copy of PPID -> channel (APID) mapping 
> table.
> - *			v2 only.
>   */
>  struct spmi_pmic_arb {
>  	void __iomem		*rd_base;
> @@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct
> platform_device *pdev)
>  		goto err_put_ctrl;
>  	}
> 
> +	pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
> +					sizeof(*pa->ppid_to_apid), GFP_KERNEL);
> +	if (!pa->ppid_to_apid) {
> +		err = -ENOMEM;
> +		goto err_put_ctrl;
> +	}
> +
>  	hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
> 
>  	if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
> @@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct
> platform_device *pdev)
>  			err = PTR_ERR(pa->wr_base);
>  			goto err_put_ctrl;
>  		}
> -
> -		pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
> -						PMIC_ARB_MAX_PPID,
> -						sizeof(*pa->ppid_to_apid),
> -						GFP_KERNEL);
> -		if (!pa->ppid_to_apid) {
> -			err = -ENOMEM;
> -			goto err_put_ctrl;
> -		}
>  	}
> 
>  	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
Thanks for the fix !

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
@ 2017-06-28  6:58   ` kgunda at codeaurora.org
  0 siblings, 0 replies; 12+ messages in thread
From: kgunda at codeaurora.org @ 2017-06-28  6:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 2017-06-27 07:47, Stephen Boyd wrote:
> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> lookups") we always need the ppid_to_apid table regardless of the
> version of pmic arbiter we have. Otherwise, we will try to deref
> the array when we don't allocate it on v2 hardware like the
> msm8974 SoCs.
> 
> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> Cc: Kiran Gunda <kgunda@codeaurora.org>
> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Kiran Gunda <kgunda@codeaurora.org>
> ---
>  drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/spmi/spmi-pmic-arb.c 
> b/drivers/spmi/spmi-pmic-arb.c
> index 2afe3597982e..f4b7a98a7913 100644
> --- a/drivers/spmi/spmi-pmic-arb.c
> +++ b/drivers/spmi/spmi-pmic-arb.c
> @@ -134,7 +134,6 @@ struct apid_data {
>   * @spmic:		SPMI controller object
>   * @ver_ops:		version dependent operations.
>   * @ppid_to_apid	in-memory copy of PPID -> channel (APID) mapping 
> table.
> - *			v2 only.
>   */
>  struct spmi_pmic_arb {
>  	void __iomem		*rd_base;
> @@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct
> platform_device *pdev)
>  		goto err_put_ctrl;
>  	}
> 
> +	pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
> +					sizeof(*pa->ppid_to_apid), GFP_KERNEL);
> +	if (!pa->ppid_to_apid) {
> +		err = -ENOMEM;
> +		goto err_put_ctrl;
> +	}
> +
>  	hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
> 
>  	if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
> @@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct
> platform_device *pdev)
>  			err = PTR_ERR(pa->wr_base);
>  			goto err_put_ctrl;
>  		}
> -
> -		pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
> -						PMIC_ARB_MAX_PPID,
> -						sizeof(*pa->ppid_to_apid),
> -						GFP_KERNEL);
> -		if (!pa->ppid_to_apid) {
> -			err = -ENOMEM;
> -			goto err_put_ctrl;
> -		}
>  	}
> 
>  	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
Thanks for the fix !

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: spmi: pmic-arb: Always allocate ppid_to_apid table
  2017-06-27  2:17 ` Stephen Boyd
@ 2017-07-09 11:31   ` Luca Weiss
  -1 siblings, 0 replies; 12+ messages in thread
From: Luca Weiss @ 2017-07-09 11:31 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Greg Kroah-Hartman, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Abhijeet Dharmapurikar, Kiran Gunda

On Dienstag, 27. Juni 2017 04:17:46 CEST Stephen Boyd wrote:
> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> lookups") we always need the ppid_to_apid table regardless of the
> version of pmic arbiter we have. Otherwise, we will try to deref
> the array when we don't allocate it on v2 hardware like the
> msm8974 SoCs.
> 
> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> Cc: Kiran Gunda <kgunda@codeaurora.org>
> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> Reviewed-by: Kiran Gunda <kgunda@codeaurora.org>
> ---
>  drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
> index 2afe3597982e..f4b7a98a7913 100644
> --- a/drivers/spmi/spmi-pmic-arb.c
> +++ b/drivers/spmi/spmi-pmic-arb.c
> @@ -134,7 +134,6 @@ struct apid_data {
>   * @spmic:		SPMI controller object
>   * @ver_ops:		version dependent operations.
>   * @ppid_to_apid	in-memory copy of PPID -> channel (APID) mapping table.
> - *			v2 only.
>   */
>  struct spmi_pmic_arb {
>  	void __iomem		*rd_base;
> @@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct platform_device
> *pdev) goto err_put_ctrl;
>  	}
> 
> +	pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
> +					sizeof(*pa->ppid_to_apid), GFP_KERNEL);
> +	if (!pa->ppid_to_apid) {
> +		err = -ENOMEM;
> +		goto err_put_ctrl;
> +	}
> +
>  	hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
> 
>  	if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
> @@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct platform_device
> *pdev) err = PTR_ERR(pa->wr_base);
>  			goto err_put_ctrl;
>  		}
> -
> -		pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
> -						PMIC_ARB_MAX_PPID,
> -						sizeof(*pa->ppid_to_apid),
> -						GFP_KERNEL);
> -		if (!pa->ppid_to_apid) {
> -			err = -ENOMEM;
> -			goto err_put_ctrl;
> -		}
>  	}
> 
>  	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",

Tested-by: Luca Weiss <luca@z3ntu.xyz>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* spmi: pmic-arb: Always allocate ppid_to_apid table
@ 2017-07-09 11:31   ` Luca Weiss
  0 siblings, 0 replies; 12+ messages in thread
From: Luca Weiss @ 2017-07-09 11:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Dienstag, 27. Juni 2017 04:17:46 CEST Stephen Boyd wrote:
> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> lookups") we always need the ppid_to_apid table regardless of the
> version of pmic arbiter we have. Otherwise, we will try to deref
> the array when we don't allocate it on v2 hardware like the
> msm8974 SoCs.
> 
> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> Cc: Kiran Gunda <kgunda@codeaurora.org>
> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> Reviewed-by: Kiran Gunda <kgunda@codeaurora.org>
> ---
>  drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
> index 2afe3597982e..f4b7a98a7913 100644
> --- a/drivers/spmi/spmi-pmic-arb.c
> +++ b/drivers/spmi/spmi-pmic-arb.c
> @@ -134,7 +134,6 @@ struct apid_data {
>   * @spmic:		SPMI controller object
>   * @ver_ops:		version dependent operations.
>   * @ppid_to_apid	in-memory copy of PPID -> channel (APID) mapping table.
> - *			v2 only.
>   */
>  struct spmi_pmic_arb {
>  	void __iomem		*rd_base;
> @@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct platform_device
> *pdev) goto err_put_ctrl;
>  	}
> 
> +	pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
> +					sizeof(*pa->ppid_to_apid), GFP_KERNEL);
> +	if (!pa->ppid_to_apid) {
> +		err = -ENOMEM;
> +		goto err_put_ctrl;
> +	}
> +
>  	hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
> 
>  	if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
> @@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct platform_device
> *pdev) err = PTR_ERR(pa->wr_base);
>  			goto err_put_ctrl;
>  		}
> -
> -		pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
> -						PMIC_ARB_MAX_PPID,
> -						sizeof(*pa->ppid_to_apid),
> -						GFP_KERNEL);
> -		if (!pa->ppid_to_apid) {
> -			err = -ENOMEM;
> -			goto err_put_ctrl;
> -		}
>  	}
> 
>  	dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",

Tested-by: Luca Weiss <luca@z3ntu.xyz>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
  2017-06-27  2:17 ` Stephen Boyd
@ 2017-07-14 16:54   ` Andy Gross
  -1 siblings, 0 replies; 12+ messages in thread
From: Andy Gross @ 2017-07-14 16:54 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Greg Kroah-Hartman, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Abhijeet Dharmapurikar, Kiran Gunda

On Mon, Jun 26, 2017 at 07:17:46PM -0700, Stephen Boyd wrote:
> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> lookups") we always need the ppid_to_apid table regardless of the
> version of pmic arbiter we have. Otherwise, we will try to deref
> the array when we don't allocate it on v2 hardware like the
> msm8974 SoCs.
> 
> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> Cc: Kiran Gunda <kgunda@codeaurora.org>
> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Greg,

Can you pick this up?  This is an urgent fix for Qualcomm 8x74 platforms.

Thanks!

Andy

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
@ 2017-07-14 16:54   ` Andy Gross
  0 siblings, 0 replies; 12+ messages in thread
From: Andy Gross @ 2017-07-14 16:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 26, 2017 at 07:17:46PM -0700, Stephen Boyd wrote:
> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> lookups") we always need the ppid_to_apid table regardless of the
> version of pmic arbiter we have. Otherwise, we will try to deref
> the array when we don't allocate it on v2 hardware like the
> msm8974 SoCs.
> 
> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> Cc: Kiran Gunda <kgunda@codeaurora.org>
> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Greg,

Can you pick this up?  This is an urgent fix for Qualcomm 8x74 platforms.

Thanks!

Andy

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
  2017-07-14 16:54   ` Andy Gross
@ 2017-07-17 12:57     ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2017-07-17 12:57 UTC (permalink / raw)
  To: Andy Gross
  Cc: Stephen Boyd, linux-kernel, linux-arm-msm, linux-arm-kernel,
	Abhijeet Dharmapurikar, Kiran Gunda

On Fri, Jul 14, 2017 at 11:54:53AM -0500, Andy Gross wrote:
> On Mon, Jun 26, 2017 at 07:17:46PM -0700, Stephen Boyd wrote:
> > After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> > lookups") we always need the ppid_to_apid table regardless of the
> > version of pmic arbiter we have. Otherwise, we will try to deref
> > the array when we don't allocate it on v2 hardware like the
> > msm8974 SoCs.
> > 
> > Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> > Cc: Kiran Gunda <kgunda@codeaurora.org>
> > Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> 
> Greg,
> 
> Can you pick this up?  This is an urgent fix for Qualcomm 8x74 platforms.

Will get it now, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
@ 2017-07-17 12:57     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2017-07-17 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 14, 2017 at 11:54:53AM -0500, Andy Gross wrote:
> On Mon, Jun 26, 2017 at 07:17:46PM -0700, Stephen Boyd wrote:
> > After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
> > lookups") we always need the ppid_to_apid table regardless of the
> > version of pmic arbiter we have. Otherwise, we will try to deref
> > the array when we don't allocate it on v2 hardware like the
> > msm8974 SoCs.
> > 
> > Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
> > Cc: Kiran Gunda <kgunda@codeaurora.org>
> > Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> 
> Greg,
> 
> Can you pick this up?  This is an urgent fix for Qualcomm 8x74 platforms.

Will get it now, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
  2017-06-28  6:58   ` kgunda at codeaurora.org
@ 2017-07-18 23:46     ` Frank Rowand
  -1 siblings, 0 replies; 12+ messages in thread
From: Frank Rowand @ 2017-07-18 23:46 UTC (permalink / raw)
  To: kgunda, Stephen Boyd
  Cc: Greg Kroah-Hartman, linux-kernel, linux-arm-msm,
	linux-arm-kernel, Abhijeet Dharmapurikar, linux-arm-msm-owner

On 06/27/17 23:58, kgunda@codeaurora.org wrote:
> On 2017-06-27 07:47, Stephen Boyd wrote:
>> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
>> lookups") we always need the ppid_to_apid table regardless of the
>> version of pmic arbiter we have. Otherwise, we will try to deref
>> the array when we don't allocate it on v2 hardware like the
>> msm8974 SoCs.
>>
>> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
>> Cc: Kiran Gunda <kgunda@codeaurora.org>
>> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
>> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> Reviewed-by: Kiran Gunda <kgunda@codeaurora.org>

Tested on a qcom-apq8074-dragonboard on 4.13-rc1

Tested-by: Frank Rowand <frank.rowand@sony.com>

>> ---
>>  drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
>>  1 file changed, 7 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
>> index 2afe3597982e..f4b7a98a7913 100644
>> --- a/drivers/spmi/spmi-pmic-arb.c
>> +++ b/drivers/spmi/spmi-pmic-arb.c
>> @@ -134,7 +134,6 @@ struct apid_data {
>>   * @spmic:        SPMI controller object
>>   * @ver_ops:        version dependent operations.
>>   * @ppid_to_apid    in-memory copy of PPID -> channel (APID) mapping table.
>> - *            v2 only.
>>   */
>>  struct spmi_pmic_arb {
>>      void __iomem        *rd_base;
>> @@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct
>> platform_device *pdev)
>>          goto err_put_ctrl;
>>      }
>>
>> +    pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
>> +                    sizeof(*pa->ppid_to_apid), GFP_KERNEL);
>> +    if (!pa->ppid_to_apid) {
>> +        err = -ENOMEM;
>> +        goto err_put_ctrl;
>> +    }
>> +
>>      hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
>>
>>      if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
>> @@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct
>> platform_device *pdev)
>>              err = PTR_ERR(pa->wr_base);
>>              goto err_put_ctrl;
>>          }
>> -
>> -        pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
>> -                        PMIC_ARB_MAX_PPID,
>> -                        sizeof(*pa->ppid_to_apid),
>> -                        GFP_KERNEL);
>> -        if (!pa->ppid_to_apid) {
>> -            err = -ENOMEM;
>> -            goto err_put_ctrl;
>> -        }
>>      }
>>
>>      dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
> Thanks for the fix !
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table
@ 2017-07-18 23:46     ` Frank Rowand
  0 siblings, 0 replies; 12+ messages in thread
From: Frank Rowand @ 2017-07-18 23:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/27/17 23:58, kgunda at codeaurora.org wrote:
> On 2017-06-27 07:47, Stephen Boyd wrote:
>> After commit 7f1d4e58dabb ("spmi: pmic-arb: optimize table
>> lookups") we always need the ppid_to_apid table regardless of the
>> version of pmic arbiter we have. Otherwise, we will try to deref
>> the array when we don't allocate it on v2 hardware like the
>> msm8974 SoCs.
>>
>> Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
>> Cc: Kiran Gunda <kgunda@codeaurora.org>
>> Fixes: 7f1d4e58dabb ("spmi: pmic-arb: optimize table lookups")
>> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> Reviewed-by: Kiran Gunda <kgunda@codeaurora.org>

Tested on a qcom-apq8074-dragonboard on 4.13-rc1

Tested-by: Frank Rowand <frank.rowand@sony.com>

>> ---
>>  drivers/spmi/spmi-pmic-arb.c | 17 +++++++----------
>>  1 file changed, 7 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
>> index 2afe3597982e..f4b7a98a7913 100644
>> --- a/drivers/spmi/spmi-pmic-arb.c
>> +++ b/drivers/spmi/spmi-pmic-arb.c
>> @@ -134,7 +134,6 @@ struct apid_data {
>>   * @spmic:        SPMI controller object
>>   * @ver_ops:        version dependent operations.
>>   * @ppid_to_apid    in-memory copy of PPID -> channel (APID) mapping table.
>> - *            v2 only.
>>   */
>>  struct spmi_pmic_arb {
>>      void __iomem        *rd_base;
>> @@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct
>> platform_device *pdev)
>>          goto err_put_ctrl;
>>      }
>>
>> +    pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
>> +                    sizeof(*pa->ppid_to_apid), GFP_KERNEL);
>> +    if (!pa->ppid_to_apid) {
>> +        err = -ENOMEM;
>> +        goto err_put_ctrl;
>> +    }
>> +
>>      hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
>>
>>      if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
>> @@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct
>> platform_device *pdev)
>>              err = PTR_ERR(pa->wr_base);
>>              goto err_put_ctrl;
>>          }
>> -
>> -        pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
>> -                        PMIC_ARB_MAX_PPID,
>> -                        sizeof(*pa->ppid_to_apid),
>> -                        GFP_KERNEL);
>> -        if (!pa->ppid_to_apid) {
>> -            err = -ENOMEM;
>> -            goto err_put_ctrl;
>> -        }
>>      }
>>
>>      dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
> Thanks for the fix !
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-07-18 23:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27  2:17 [PATCH] spmi: pmic-arb: Always allocate ppid_to_apid table Stephen Boyd
2017-06-27  2:17 ` Stephen Boyd
2017-06-28  6:58 ` kgunda
2017-06-28  6:58   ` kgunda at codeaurora.org
2017-07-18 23:46   ` Frank Rowand
2017-07-18 23:46     ` Frank Rowand
2017-07-09 11:31 ` Luca Weiss
2017-07-09 11:31   ` Luca Weiss
2017-07-14 16:54 ` [PATCH] " Andy Gross
2017-07-14 16:54   ` Andy Gross
2017-07-17 12:57   ` Greg Kroah-Hartman
2017-07-17 12:57     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.