Skip to contentSkip to conversation

ARM: imx: gpc: Initialize all power domains

PATCH New Fabio Estevam 4 participants 6 messages Oct 11, 2016 – Oct 27, 2016

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: imx: gpc: Initialize all power domains

When booting a kernel built with multi_v7_defconfig the following probe error is seen:

imx-gpc: probe of 20dc000.gpc failed with error -22

Later on the kernel crashes like this:

[    1.723358] Unable to handle kernel NULL pointer dereference at virtual address 00000040
[    1.731500] pgd = c0204000
[    1.731863] hctosys: unable to open rtc device (rtc0)
[    1.739301] [00000040] *pgd=00000000
[    1.739310] Internal error: Oops: 5 [#1] SMP ARM
[    1.739319] Modules linked in:
[    1.739328] CPU: 1 PID: 95 Comm: kworker/1:4 Not tainted 4.8.0-11897-g6b5e09a #1
[    1.739331] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[    1.739352] Workqueue: pm genpd_power_off_work_fn
[    1.739356] task: ee63d400 task.stack: ee70a000
[    1.739365] PC is at mutex_lock+0xc/0x4c
[    1.739374] LR is at regulator_disable+0x2c/0x60
[    1.739379] pc : [<c0bc0da0>]    lr : [<c06e4b10>]    psr: 60000013
[    1.739379] sp : ee70beb0  ip : 10624dd3  fp : ee6e6280
[    1.739382] r10: eefb0900  r9 : 00000000  r8 : c1309918
[    1.739385] r7 : 00000000  r6 : 00000040  r5 : 00000000  r4 : 00000040
[    1.739390] r3 : 0000004c  r2 : 7fffd540  r1 : 000001e4  r0 : 00000040

The gpc probe fails because of_genpd_add_provider_onecell() checks if all the domains are initialized via pm_genpd_present() function and it returns an error on the multi_v7_defconfig case.

In order to fix this error, initialize all the imx_gpc_domains, not only the imx6q_pu_domain.base one.

---
 arch/arm/mach-imx/gpc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/gpc.c +2 -1
index 0df062d..d0463e9 100644
@@ -430,7 +430,8 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg)
 	if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
 		return 0;
 
-	pm_genpd_init(&imx6q_pu_domain.base, NULL, false);
+	for (i = 0; i < ARRAY_SIZE(imx_gpc_domains); i++)
+		pm_genpd_init(imx_gpc_domains[i], NULL, false);
 	return of_genpd_add_provider_onecell(dev->of_node,
 					     &imx_gpc_onecell_data);
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 ARM: imx: gpc: Initialize all power domains

Am Dienstag, den 11.10.2016, 14:53 -0300 schrieb Fabio Estevam:

Quoted 29 lines

When booting a kernel built with multi_v7_defconfig the following probe error is seen:

imx-gpc: probe of 20dc000.gpc failed with error -22

Later on the kernel crashes like this:

[    1.723358] Unable to handle kernel NULL pointer dereference at virtual address 00000040
[    1.731500] pgd = c0204000
[    1.731863] hctosys: unable to open rtc device (rtc0)
[    1.739301] [00000040] *pgd=00000000
[    1.739310] Internal error: Oops: 5 [#1] SMP ARM
[    1.739319] Modules linked in:
[    1.739328] CPU: 1 PID: 95 Comm: kworker/1:4 Not tainted 4.8.0-11897-g6b5e09a #1
[    1.739331] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[    1.739352] Workqueue: pm genpd_power_off_work_fn
[    1.739356] task: ee63d400 task.stack: ee70a000
[    1.739365] PC is at mutex_lock+0xc/0x4c
[    1.739374] LR is at regulator_disable+0x2c/0x60
[    1.739379] pc : [<c0bc0da0>]    lr : [<c06e4b10>]    psr: 60000013
[    1.739379] sp : ee70beb0  ip : 10624dd3  fp : ee6e6280
[    1.739382] r10: eefb0900  r9 : 00000000  r8 : c1309918
[    1.739385] r7 : 00000000  r6 : 00000040  r5 : 00000000  r4 : 00000040
[    1.739390] r3 : 0000004c  r2 : 7fffd540  r1 : 000001e4  r0 : 00000040

The gpc probe fails because of_genpd_add_provider_onecell() checks if all the domains are initialized via pm_genpd_present() function and it returns an error on the multi_v7_defconfig case.

Quoted 5 lines

In order to fix this error, initialize all the imx_gpc_domains, not only the imx6q_pu_domain.base one.

Quoted 18 lines
---
 arch/arm/mach-imx/gpc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/gpc.c +2 -1
index 0df062d..d0463e9 100644
@@ -430,7 +430,8 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg)
 	if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
 		return 0;
 
-	pm_genpd_init(&imx6q_pu_domain.base, NULL, false);
+	for (i = 0; i < ARRAY_SIZE(imx_gpc_domains); i++)
+		pm_genpd_init(imx_gpc_domains[i], NULL, false);
 	return of_genpd_add_provider_onecell(dev->of_node,
 					     &imx_gpc_onecell_data);
 
#2 lore raw

PATCH 1/1 ARM: imx: gpc: Initialize all power domains

In reply to Fabio Estevam
Quoted 25 lines · Fabio Estevam

When booting a kernel built with multi_v7_defconfig the following probe error is seen:

imx-gpc: probe of 20dc000.gpc failed with error -22

Later on the kernel crashes like this:

[    1.723358] Unable to handle kernel NULL pointer dereference at virtual address 00000040
[    1.731500] pgd = c0204000
[    1.731863] hctosys: unable to open rtc device (rtc0)
[    1.739301] [00000040] *pgd=00000000
[    1.739310] Internal error: Oops: 5 [#1] SMP ARM
[    1.739319] Modules linked in:
[    1.739328] CPU: 1 PID: 95 Comm: kworker/1:4 Not tainted 4.8.0-11897-g6b5e09a #1
[    1.739331] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[    1.739352] Workqueue: pm genpd_power_off_work_fn
[    1.739356] task: ee63d400 task.stack: ee70a000
[    1.739365] PC is at mutex_lock+0xc/0x4c
[    1.739374] LR is at regulator_disable+0x2c/0x60
[    1.739379] pc : [<c0bc0da0>]    lr : [<c06e4b10>]    psr: 60000013
[    1.739379] sp : ee70beb0  ip : 10624dd3  fp : ee6e6280
[    1.739382] r10: eefb0900  r9 : 00000000  r8 : c1309918
[    1.739385] r7 : 00000000  r6 : 00000040  r5 : 00000000  r4 : 00000040
[    1.739390] r3 : 0000004c  r2 : 7fffd540  r1 : 000001e4  r0 : 00000040
Quoted 3 lines

The gpc probe fails because of_genpd_add_provider_onecell() checks if all the domains are initialized via pm_genpd_present() function and it returns an error on the multi_v7_defconfig case.

It's not clear to me why this is only with multi_v7_defconfig, not imx_v6_v7_defconfig. Also, is it a regression or long-standing issue?

Shawn

Quoted 32 lines

In order to fix this error, initialize all the imx_gpc_domains, not only the imx6q_pu_domain.base one.

---
 arch/arm/mach-imx/gpc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/gpc.c +2 -1
index 0df062d..d0463e9 100644
@@ -430,7 +430,8 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg)
 	if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
 		return 0;
 
-	pm_genpd_init(&imx6q_pu_domain.base, NULL, false);
+	for (i = 0; i < ARRAY_SIZE(imx_gpc_domains); i++)
+		pm_genpd_init(imx_gpc_domains[i], NULL, false);
 	return of_genpd_add_provider_onecell(dev->of_node,
 					     &imx_gpc_onecell_data);
 
Signature · 7 lines
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer
#3 lore raw

PATCH 1/1 ARM: imx: gpc: Initialize all power domains

Hi Shawn,

Quoted 2 lines · Shawn Guo

It's not clear to me why this is only with multi_v7_defconfig, not imx_v6_v7_defconfig. Also, is it a regression or long-standing issue?

Investigated this a bit further and the problem seems to be in the power domain driver.

The change below fixes the problem on mx6:

drivers/base/power/domain.c +0 -2
index e023066..461d03c 100644
@@ -1572,8 +1572,6 @@ int of_genpd_add_provider_onecell(struct device_node *np,
        for (i = 0; i < data->num_domains; i++) {
                if (!data->domains[i])
                        continue;
-               if (!pm_genpd_present(data->domains[i]))
-                       goto error;
 
                data->domains[i]->provider = &np->fwnode;
                data->domains[i]->has_provider = true;

, will submit this to the power domain folks.

reviewer
#4 lore raw

PATCH 1/1 ARM: imx: gpc: Initialize all power domains

Quoted 26 lines · Fabio Estevam

Hi Shawn,

Quoted 2 lines · Shawn Guo

It's not clear to me why this is only with multi_v7_defconfig, not imx_v6_v7_defconfig. Also, is it a regression or long-standing issue?

Investigated this a bit further and the problem seems to be in the power domain driver.

The change below fixes the problem on mx6:

drivers/base/power/domain.c +0 -2
index e023066..461d03c 100644
@@ -1572,8 +1572,6 @@ int of_genpd_add_provider_onecell(struct device_node *np,
        for (i = 0; i < data->num_domains; i++) {
                if (!data->domains[i])
                        continue;
-               if (!pm_genpd_present(data->domains[i]))
-                       goto error;
 
                data->domains[i]->provider = &np->fwnode;
                data->domains[i]->has_provider = true;
Quoted 1 line

, will submit this to the power domain folks.

Actually the above change would go against:

Author: Jon Hunter <[email protected]>
Date:   Mon Sep 12 12:01:10 2016 +0100

PM / Domains: Verify the PM domain is present when adding a provider

When a PM domain provider is added, there is currently no way to tell if any PM domains associated with the provider are present. Naturally, the PM domain provider should not be registered if the PM domains have not been added. Nonetheless, verify that the PM domain(s) associated with a provider are present when registering the PM domain provider.

This change adds a dependency on the function pm_genpd_present() when CONFIG_PM_GENERIC_DOMAINS_OF is enabled and so ensure this function is available when CONFIG_PM_GENERIC_DOMAINS_OF selected.

,so it seems the original patch in this thread is correct.

I will update the commit log and submit a v2.

#5 lore raw

PATCH 1/1 ARM: imx: gpc: Initialize all power domains

In reply to Shawn Guo

Am Mittwoch, den 19.10.2016, 22:15 +0800 schrieb Shawn Guo:

Quoted 26 lines · Fabio Estevam
Quoted 25 lines

When booting a kernel built with multi_v7_defconfig the following probe error is seen:

imx-gpc: probe of 20dc000.gpc failed with error -22

Later on the kernel crashes like this:

[    1.723358] Unable to handle kernel NULL pointer dereference at virtual address 00000040
[    1.731500] pgd = c0204000
[    1.731863] hctosys: unable to open rtc device (rtc0)
[    1.739301] [00000040] *pgd=00000000
[    1.739310] Internal error: Oops: 5 [#1] SMP ARM
[    1.739319] Modules linked in:
[    1.739328] CPU: 1 PID: 95 Comm: kworker/1:4 Not tainted 4.8.0-11897-g6b5e09a #1
[    1.739331] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[    1.739352] Workqueue: pm genpd_power_off_work_fn
[    1.739356] task: ee63d400 task.stack: ee70a000
[    1.739365] PC is at mutex_lock+0xc/0x4c
[    1.739374] LR is at regulator_disable+0x2c/0x60
[    1.739379] pc : [<c0bc0da0>]    lr : [<c06e4b10>]    psr: 60000013
[    1.739379] sp : ee70beb0  ip : 10624dd3  fp : ee6e6280
[    1.739382] r10: eefb0900  r9 : 00000000  r8 : c1309918
[    1.739385] r7 : 00000000  r6 : 00000040  r5 : 00000000  r4 : 00000040
[    1.739390] r3 : 0000004c  r2 : 7fffd540  r1 : 000001e4  r0 : 00000040
Quoted 6 lines
Quoted 3 lines

The gpc probe fails because of_genpd_add_provider_onecell() checks if all the domains are initialized via pm_genpd_present() function and it returns an error on the multi_v7_defconfig case.

It's not clear to me why this is only with multi_v7_defconfig, not imx_v6_v7_defconfig. Also, is it a regression or long-standing issue?

It's a regression in v4.9 and should be applied as a fix.

I don't see the crash on imx_v6_v7_defconfig, but without this patch the GPC no longer probes correctly on v4.9 and other dependent devices will not show up at all.

Regards,
Lucas