diff mbox series

[V2,4/6] power: imx8: remove the resource owned check before power off

Message ID 20200504131654.17085-4-peng.fan@nxp.com
State Accepted
Commit e8f8b5ccf2b1b02f1614941d025c31cfbf78ab2b
Delegated to: Stefano Babic
Headers show
Series [V2,1/6] dt-bindings: imx_rsrc: add SC_R_NONE | expand

Commit Message

Peng Fan May 4, 2020, 1:16 p.m. UTC
For all the devices used and set ACTIVE in U-Boot, U-Boot needs
to power off all of them without the check of resource owner.

When we create software partition before booting Linux, the resource
own checkw will return false, and cause the power domain not powered
off. If without the check of resource owner, the power domain in
the other software partition could be powered off with parent
partition could access child partition resources.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/power/domain/imx8-power-domain-legacy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefano Babic May 11, 2020, 10:15 a.m. UTC | #1
> For all the devices used and set ACTIVE in U-Boot, U-Boot needs
> to power off all of them without the check of resource owner.
> When we create software partition before booting Linux, the resource
> own checkw will return false, and cause the power domain not powered
> off. If without the check of resource owner, the power domain in
> the other software partition could be powered off with parent
> partition could access child partition resources.
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/power/domain/imx8-power-domain-legacy.c b/drivers/power/domain/imx8-power-domain-legacy.c
index e6e619358c..b68be40766 100644
--- a/drivers/power/domain/imx8-power-domain-legacy.c
+++ b/drivers/power/domain/imx8-power-domain-legacy.c
@@ -137,13 +137,13 @@  static int imx8_power_domain_off_node(struct power_domain *power_domain)
 	}
 
 	if (pdata->resource_id != SC_R_LAST) {
-		if (!sc_rm_is_resource_owned(-1, pdata->resource_id)) {
-			printf("%s not owned by curr partition\n", dev->name);
-			return 0;
-		}
 		ret = sc_pm_set_resource_power_mode(-1, pdata->resource_id,
 						    SC_PM_PW_MODE_OFF);
 		if (ret) {
+			if (!sc_rm_is_resource_owned(-1, pdata->resource_id)) {
+				printf("%s not owned by curr partition %d\n", dev->name, pdata->resource_id);
+				return 0;
+			}
 			printf("Error: %s Power off failed! (error = %d)\n",
 			       dev->name, ret);
 			return -EIO;