Skip to contentSkip to conversation

clk: tegra: fix SMP build

PATCH In review Arnd Bergmann 4 participants 5 messages Dec 11, 2018 – Dec 12, 2018

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

PATCH 1/1 clk: tegra: fix SMP build

When CONFIG_SMP is disabled, the tegra clk driver now fails to build:

drivers/clk/tegra/clk-tegra30.c: In function 'tegra30_cpu_rail_off_ready':
drivers/clk/tegra/clk-tegra30.c:1151:19: error: implicit declaration of function 'tegra_pmc_cpu_is_powered'; did you mean 'tegra_powergate_is_powered'? [-Werror=implicit-function-declaration]
cpu_pwr_status = tegra_pmc_cpu_is_powered(1) ||

I don't know if tegra works without CONFIG_SMP, but we can get it to build by making the calls conditional, and removing the pointless ifdef around the declaration. The assumption now is that in a non-SMP system, the secondary CPUs are always disabled.

Fixes 61866523ed6e ("clk: tegra30: Use Tegra CPU powergate helper function")

---
Not sure if this is the best solution. If you think it's not, please submit a different fix.

---
 drivers/clk/tegra/clk-tegra30.c | 10 +++++++---
 include/soc/tegra/pmc.h         |  2 --
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/clk/tegra/clk-tegra30.c +7 -3
index fa8d573ac626..1505185936f4 100644
@@ -1148,9 +1148,13 @@ static bool tegra30_cpu_rail_off_ready(void)
 
 	cpu_rst_status = readl(clk_base +
 				TEGRA30_CLK_RST_CONTROLLER_CPU_CMPLX_STATUS);
-	cpu_pwr_status = tegra_pmc_cpu_is_powered(1) ||
-			 tegra_pmc_cpu_is_powered(2) ||
-			 tegra_pmc_cpu_is_powered(3);
+
+	if (IS_ENABLED(CONFIG_SMP))
+		cpu_pwr_status = tegra_pmc_cpu_is_powered(1) ||
+				 tegra_pmc_cpu_is_powered(2) ||
+				 tegra_pmc_cpu_is_powered(3);
+	else
+		cpu_pwr_status = 0;
 
 	if (((cpu_rst_status & 0xE) != 0xE) || cpu_pwr_status)
 		return false;
include/soc/tegra/pmc.h +0 -2
index fd816f6aa9cc..a9db1b501de1 100644
@@ -26,11 +26,9 @@
 struct clk;
 struct reset_control;
 
-#ifdef CONFIG_SMP
 bool tegra_pmc_cpu_is_powered(unsigned int cpuid);
 int tegra_pmc_cpu_power_on(unsigned int cpuid);
 int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
-#endif /* CONFIG_SMP */
 
 /*
  * powergate and I/O rail APIs
Signature · 1 line
2.20.0
maintainer
#1 lore raw

Quoting Arnd Bergmann (2018-12-11 06:35:07)

Quoted 11 lines

When CONFIG_SMP is disabled, the tegra clk driver now fails to build:

drivers/clk/tegra/clk-tegra30.c: In function 'tegra30_cpu_rail_off_ready':
drivers/clk/tegra/clk-tegra30.c:1151:19: error: implicit declaration of function 'tegra_pmc_cpu_is_powered'; did you mean 'tegra_powergate_is_powered'? [-Werror=implicit-function-declaration]
cpu_pwr_status = tegra_pmc_cpu_is_powered(1) ||

I don't know if tegra works without CONFIG_SMP, but we can get it to build by making the calls conditional, and removing the pointless ifdef around the declaration. The assumption now is that in a non-SMP system, the secondary CPUs are always disabled.

Quoted 5 lines
Fixes 61866523ed6e ("clk: tegra30: Use Tegra CPU powergate helper function")

---
Not sure if this is the best solution. If you think it's not, please submit a different fix.

Hmm.. Is there any reason why the implementation of tegra_pmc_cpu_is_powered() is under an ifdef CONFIG_SMP? I'd rather not have to think about SMP or not in this clk code and have the tegra_pmc_cpu_is_powered() function do the UP vs SMP code optimization.

maintainer
#2 lore raw
Quoted 18 lines · Stephen Boyd

Quoting Arnd Bergmann (2018-12-11 06:35:07)

Quoted 11 lines

When CONFIG_SMP is disabled, the tegra clk driver now fails to build:

drivers/clk/tegra/clk-tegra30.c: In function 'tegra30_cpu_rail_off_ready':
drivers/clk/tegra/clk-tegra30.c:1151:19: error: implicit declaration of function 'tegra_pmc_cpu_is_powered'; did you mean 'tegra_powergate_is_powered'? [-Werror=implicit-function-declaration]
cpu_pwr_status = tegra_pmc_cpu_is_powered(1) ||

I don't know if tegra works without CONFIG_SMP, but we can get it to build by making the calls conditional, and removing the pointless ifdef around the declaration. The assumption now is that in a non-SMP system, the secondary CPUs are always disabled.

Quoted 5 lines
Fixes 61866523ed6e ("clk: tegra30: Use Tegra CPU powergate helper function")

---
Not sure if this is the best solution. If you think it's not, please submit a different fix.

Quoted 4 lines

Hmm.. Is there any reason why the implementation of tegra_pmc_cpu_is_powered() is under an ifdef CONFIG_SMP? I'd rather not have to think about SMP or not in this clk code and have the tegra_pmc_cpu_is_powered() function do the UP vs SMP code optimization.

Not that I know of. I just think that the function should/would not be used for non-SMP.

I was actually thinking that we could just leave the clk code as it is and simply drop the CONFIG_SMP from pmc.h. That would be fine with me.

Cheers
Jon

Signature · 1 line
nvpublic
#3 lore raw
Quoted 25 lines · Jon Hunter
Quoted 18 lines · Stephen Boyd

Quoting Arnd Bergmann (2018-12-11 06:35:07)

Quoted 11 lines

When CONFIG_SMP is disabled, the tegra clk driver now fails to build:

drivers/clk/tegra/clk-tegra30.c: In function 'tegra30_cpu_rail_off_ready':
drivers/clk/tegra/clk-tegra30.c:1151:19: error: implicit declaration of function 'tegra_pmc_cpu_is_powered'; did you mean 'tegra_powergate_is_powered'? [-Werror=implicit-function-declaration]
cpu_pwr_status = tegra_pmc_cpu_is_powered(1) ||

I don't know if tegra works without CONFIG_SMP, but we can get it to build by making the calls conditional, and removing the pointless ifdef around the declaration. The assumption now is that in a non-SMP system, the secondary CPUs are always disabled.

Quoted 5 lines
Fixes 61866523ed6e ("clk: tegra30: Use Tegra CPU powergate helper function")

---
Not sure if this is the best solution. If you think it's not, please submit a different fix.

Quoted 4 lines

Hmm.. Is there any reason why the implementation of tegra_pmc_cpu_is_powered() is under an ifdef CONFIG_SMP? I'd rather not have to think about SMP or not in this clk code and have the tegra_pmc_cpu_is_powered() function do the UP vs SMP code optimization.

Quoted 5 lines

Not that I know of. I just think that the function should/would not be used for non-SMP.

I was actually thinking that we could just leave the clk code as it is and simply drop the CONFIG_SMP from pmc.h. That would be fine with me.

Yeah, I'd be fine keeping that code around whether or not we enable SMP. Chances are people won't disable it anyway. If they do, then most likely only for testing purposes, in which case I'm sure they won't mind the extra couple of bytes.

I think if we remove CONFIG_SMP from pmc.h we also need to remove it from drivers/soc/tegra/pmc.c to make sure these functions are available, otherwise we'll likely run into linker errors.

Jon, is that something I can interest you in? If not, I can easily do that myself.

Thierry

maintainer
#4 lore raw
Quoted 37 lines · Thierry Reding
Quoted 25 lines · Jon Hunter
Quoted 18 lines · Stephen Boyd

Quoting Arnd Bergmann (2018-12-11 06:35:07)

Quoted 11 lines

When CONFIG_SMP is disabled, the tegra clk driver now fails to build:

drivers/clk/tegra/clk-tegra30.c: In function 'tegra30_cpu_rail_off_ready':
drivers/clk/tegra/clk-tegra30.c:1151:19: error: implicit declaration of function 'tegra_pmc_cpu_is_powered'; did you mean 'tegra_powergate_is_powered'? [-Werror=implicit-function-declaration]
cpu_pwr_status = tegra_pmc_cpu_is_powered(1) ||

I don't know if tegra works without CONFIG_SMP, but we can get it to build by making the calls conditional, and removing the pointless ifdef around the declaration. The assumption now is that in a non-SMP system, the secondary CPUs are always disabled.

Quoted 5 lines
Fixes 61866523ed6e ("clk: tegra30: Use Tegra CPU powergate helper function")

---
Not sure if this is the best solution. If you think it's not, please submit a different fix.

Quoted 4 lines

Hmm.. Is there any reason why the implementation of tegra_pmc_cpu_is_powered() is under an ifdef CONFIG_SMP? I'd rather not have to think about SMP or not in this clk code and have the tegra_pmc_cpu_is_powered() function do the UP vs SMP code optimization.

Quoted 5 lines

Not that I know of. I just think that the function should/would not be used for non-SMP.

I was actually thinking that we could just leave the clk code as it is and simply drop the CONFIG_SMP from pmc.h. That would be fine with me.

Yeah, I'd be fine keeping that code around whether or not we enable SMP. Chances are people won't disable it anyway. If they do, then most likely only for testing purposes, in which case I'm sure they won't mind the extra couple of bytes.

Quoted 6 lines

I think if we remove CONFIG_SMP from pmc.h we also need to remove it from drivers/soc/tegra/pmc.c to make sure these functions are available, otherwise we'll likely run into linker errors.

Jon, is that something I can interest you in? If not, I can easily do that myself.

Yes I can do it (tomorrow).

Cheers
Jon

Signature · 1 line
nvpublic