linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware: imx: scu-pd: ignore power domain not owned
@ 2020-09-08 10:07 peng.fan
  2020-09-13  1:46 ` Shawn Guo
  0 siblings, 1 reply; 2+ messages in thread
From: peng.fan @ 2020-09-08 10:07 UTC (permalink / raw)
  To: shawnguo, s.hauer, festevam, abel.vesa
  Cc: aisheng.dong, Peng Fan, Anson.Huang, linux-kernel, linux-imx,
	kernel, linux-arm-kernel

From: Peng Fan <peng.fan@nxp.com>

Should not register power domain that not owned by current
partition.

Alought power domains will not be registered when power on failure,
we have to let CPU waste more cycles.

Whether power on or owned check, both need communicate with SCU,
but with owned check, we no need to run more code path to save CPU
cycles.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 drivers/firmware/imx/scu-pd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/firmware/imx/scu-pd.c b/drivers/firmware/imx/scu-pd.c
index af3d6d9ead28..946eea292b52 100644
--- a/drivers/firmware/imx/scu-pd.c
+++ b/drivers/firmware/imx/scu-pd.c
@@ -46,6 +46,7 @@
 
 #include <dt-bindings/firmware/imx/rsrc.h>
 #include <linux/firmware/imx/sci.h>
+#include <linux/firmware/imx/svc/rm.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -256,6 +257,9 @@ imx_scu_add_pm_domain(struct device *dev, int idx,
 	struct imx_sc_pm_domain *sc_pd;
 	int ret;
 
+	if (!imx_sc_rm_is_resource_owned(pm_ipc_handle, pd_ranges->rsrc + idx))
+		return NULL;
+
 	sc_pd = devm_kzalloc(dev, sizeof(*sc_pd), GFP_KERNEL);
 	if (!sc_pd)
 		return ERR_PTR(-ENOMEM);
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] firmware: imx: scu-pd: ignore power domain not owned
  2020-09-08 10:07 [PATCH] firmware: imx: scu-pd: ignore power domain not owned peng.fan
@ 2020-09-13  1:46 ` Shawn Guo
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn Guo @ 2020-09-13  1:46 UTC (permalink / raw)
  To: peng.fan
  Cc: aisheng.dong, abel.vesa, Anson.Huang, s.hauer, linux-kernel,
	linux-imx, kernel, festevam, linux-arm-kernel

On Tue, Sep 08, 2020 at 06:07:01PM +0800, peng.fan@nxp.com wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Should not register power domain that not owned by current
> partition.
> 
> Alought power domains will not be registered when power on failure,
> we have to let CPU waste more cycles.
> 
> Whether power on or owned check, both need communicate with SCU,
> but with owned check, we no need to run more code path to save CPU
> cycles.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>

Applied, thanks.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-09-13  1:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-08 10:07 [PATCH] firmware: imx: scu-pd: ignore power domain not owned peng.fan
2020-09-13  1:46 ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).