linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16
@ 2021-09-12 20:29 Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 1/6] soc/tegra: fuse: Add stubs needed for compile testing Dmitry Osipenko
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-12 20:29 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano
  Cc: Rafael J. Wysocki, linux-pm, linux-tegra, linux-kernel

This series adds compile-testing support to Tegra cpuidle driver and fixes
a non-critical problem that should pop up only when power management patches
[1] will be merged. Previously I sent out these patches separately[2][3],
but they partially missed recent kernel release. I combined the remaining
patches into this series and added ack from Daniel Lezcano that he gave
to the "Check whether PMC is ready" patch [3].

[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=261973
[2] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=252996
[3] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=254040

Dmitry Osipenko (6):
  soc/tegra: fuse: Add stubs needed for compile testing
  soc/tegra: irq: Add stubs needed for compile testing
  soc/tegra: pm: Make stubs usable for compile testing
  clk: tegra: Add stubs needed for compile testing
  cpuidle: tegra: Enable compile testing
  cpuidle: tegra: Check whether PMC is ready

 drivers/cpuidle/Kconfig.arm     |  2 +-
 drivers/cpuidle/cpuidle-tegra.c |  3 +++
 include/linux/clk/tegra.h       |  4 ++++
 include/soc/tegra/fuse.h        | 31 ++++++++++++++++++++++++++-----
 include/soc/tegra/irq.h         |  9 ++++++++-
 include/soc/tegra/pm.h          |  2 +-
 6 files changed, 43 insertions(+), 8 deletions(-)

-- 
2.32.0


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

* [PATCH v1 1/6] soc/tegra: fuse: Add stubs needed for compile testing
  2021-09-12 20:29 [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16 Dmitry Osipenko
@ 2021-09-12 20:29 ` Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 2/6] soc/tegra: irq: " Dmitry Osipenko
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-12 20:29 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano
  Cc: Rafael J. Wysocki, linux-pm, linux-tegra, linux-kernel

Add stubs needed for compile-testing of tegra-cpuidle driver.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 include/soc/tegra/fuse.h | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
index 990701f788bc..67d2bc856fbc 100644
--- a/include/soc/tegra/fuse.h
+++ b/include/soc/tegra/fuse.h
@@ -6,6 +6,8 @@
 #ifndef __SOC_TEGRA_FUSE_H__
 #define __SOC_TEGRA_FUSE_H__
 
+#include <linux/types.h>
+
 #define TEGRA20		0x20
 #define TEGRA30		0x30
 #define TEGRA114	0x35
@@ -22,11 +24,6 @@
 
 #ifndef __ASSEMBLY__
 
-u32 tegra_read_chipid(void);
-u8 tegra_get_chip_id(void);
-u8 tegra_get_platform(void);
-bool tegra_is_silicon(void);
-
 enum tegra_revision {
 	TEGRA_REVISION_UNKNOWN = 0,
 	TEGRA_REVISION_A01,
@@ -57,6 +54,10 @@ extern struct tegra_sku_info tegra_sku_info;
 u32 tegra_read_straps(void);
 u32 tegra_read_ram_code(void);
 int tegra_fuse_readl(unsigned long offset, u32 *value);
+u32 tegra_read_chipid(void);
+u8 tegra_get_chip_id(void);
+u8 tegra_get_platform(void);
+bool tegra_is_silicon(void);
 #else
 static struct tegra_sku_info tegra_sku_info __maybe_unused;
 
@@ -74,6 +75,26 @@ static inline int tegra_fuse_readl(unsigned long offset, u32 *value)
 {
 	return -ENODEV;
 }
+
+static inline u32 tegra_read_chipid(void)
+{
+	return 0;
+}
+
+static inline u8 tegra_get_chip_id(void)
+{
+	return 0;
+}
+
+static inline u8 tegra_get_platform(void)
+{
+	return 0;
+}
+
+static inline bool tegra_is_silicon(void)
+{
+	return false;
+}
 #endif
 
 struct device *tegra_soc_device_register(void);
-- 
2.32.0


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

* [PATCH v1 2/6] soc/tegra: irq: Add stubs needed for compile testing
  2021-09-12 20:29 [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16 Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 1/6] soc/tegra: fuse: Add stubs needed for compile testing Dmitry Osipenko
@ 2021-09-12 20:29 ` Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 3/6] soc/tegra: pm: Make stubs usable " Dmitry Osipenko
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-12 20:29 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano
  Cc: Rafael J. Wysocki, linux-pm, linux-tegra, linux-kernel

Add stubs needed for compile-testing of tegra-cpuidle driver.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 include/soc/tegra/irq.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/soc/tegra/irq.h b/include/soc/tegra/irq.h
index 8eb11a7109e4..94539551c8c1 100644
--- a/include/soc/tegra/irq.h
+++ b/include/soc/tegra/irq.h
@@ -6,8 +6,15 @@
 #ifndef __SOC_TEGRA_IRQ_H
 #define __SOC_TEGRA_IRQ_H
 
-#if defined(CONFIG_ARM)
+#include <linux/types.h>
+
+#if defined(CONFIG_ARM) && defined(CONFIG_ARCH_TEGRA)
 bool tegra_pending_sgi(void);
+#else
+static inline bool tegra_pending_sgi(void)
+{
+	return false;
+}
 #endif
 
 #endif /* __SOC_TEGRA_IRQ_H */
-- 
2.32.0


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

* [PATCH v1 3/6] soc/tegra: pm: Make stubs usable for compile testing
  2021-09-12 20:29 [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16 Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 1/6] soc/tegra: fuse: Add stubs needed for compile testing Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 2/6] soc/tegra: irq: " Dmitry Osipenko
@ 2021-09-12 20:29 ` Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 4/6] clk: tegra: Add stubs needed " Dmitry Osipenko
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-12 20:29 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano
  Cc: Rafael J. Wysocki, linux-pm, linux-tegra, linux-kernel

The PM stubs need to depend on ARCH_TEGRA in order to be usable for
compile-testing of tegra-cpuidle driver. Add the dependency.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 include/soc/tegra/pm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/soc/tegra/pm.h b/include/soc/tegra/pm.h
index 433878927026..ce4d0b1bd0d6 100644
--- a/include/soc/tegra/pm.h
+++ b/include/soc/tegra/pm.h
@@ -17,7 +17,7 @@ enum tegra_suspend_mode {
 	TEGRA_SUSPEND_NOT_READY,
 };
 
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_ARM)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_ARM) && defined(CONFIG_ARCH_TEGRA)
 enum tegra_suspend_mode
 tegra_pm_validate_suspend_mode(enum tegra_suspend_mode mode);
 
-- 
2.32.0


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

* [PATCH v1 4/6] clk: tegra: Add stubs needed for compile testing
  2021-09-12 20:29 [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16 Dmitry Osipenko
                   ` (2 preceding siblings ...)
  2021-09-12 20:29 ` [PATCH v1 3/6] soc/tegra: pm: Make stubs usable " Dmitry Osipenko
@ 2021-09-12 20:29 ` Dmitry Osipenko
  2021-10-04 19:33   ` Thierry Reding
  2021-09-12 20:29 ` [PATCH v1 5/6] cpuidle: tegra: Enable " Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 6/6] cpuidle: tegra: Check whether PMC is ready Dmitry Osipenko
  5 siblings, 1 reply; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-12 20:29 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano
  Cc: Rafael J. Wysocki, linux-pm, linux-tegra, linux-kernel

Add stubs needed for compile-testing of tegra-cpuidle driver.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 include/linux/clk/tegra.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
index d128ad1570aa..9bd06d8a5436 100644
--- a/include/linux/clk/tegra.h
+++ b/include/linux/clk/tegra.h
@@ -42,7 +42,11 @@ struct tegra_cpu_car_ops {
 #endif
 };
 
+#ifdef CONFIG_ARCH_TEGRA
 extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
+#else
+static struct tegra_cpu_car_ops *tegra_cpu_car_ops __maybe_unused;
+#endif
 
 static inline void tegra_wait_cpu_in_reset(u32 cpu)
 {
-- 
2.32.0


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

* [PATCH v1 5/6] cpuidle: tegra: Enable compile testing
  2021-09-12 20:29 [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16 Dmitry Osipenko
                   ` (3 preceding siblings ...)
  2021-09-12 20:29 ` [PATCH v1 4/6] clk: tegra: Add stubs needed " Dmitry Osipenko
@ 2021-09-12 20:29 ` Dmitry Osipenko
  2021-09-27 16:33   ` Dmitry Osipenko
  2021-09-12 20:29 ` [PATCH v1 6/6] cpuidle: tegra: Check whether PMC is ready Dmitry Osipenko
  5 siblings, 1 reply; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-12 20:29 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano
  Cc: Rafael J. Wysocki, linux-pm, linux-tegra, linux-kernel

Enable compile testing of tegra-cpuidle driver.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/cpuidle/Kconfig.arm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index 334f83e56120..599286fc0b08 100644
--- a/drivers/cpuidle/Kconfig.arm
+++ b/drivers/cpuidle/Kconfig.arm
@@ -99,7 +99,7 @@ config ARM_MVEBU_V7_CPUIDLE
 
 config ARM_TEGRA_CPUIDLE
 	bool "CPU Idle Driver for NVIDIA Tegra SoCs"
-	depends on ARCH_TEGRA && !ARM64
+	depends on (ARCH_TEGRA || COMPILE_TEST) && !ARM64 && MMU
 	select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
 	select ARM_CPU_SUSPEND
 	help
-- 
2.32.0


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

* [PATCH v1 6/6] cpuidle: tegra: Check whether PMC is ready
  2021-09-12 20:29 [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16 Dmitry Osipenko
                   ` (4 preceding siblings ...)
  2021-09-12 20:29 ` [PATCH v1 5/6] cpuidle: tegra: Enable " Dmitry Osipenko
@ 2021-09-12 20:29 ` Dmitry Osipenko
  5 siblings, 0 replies; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-12 20:29 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano
  Cc: Rafael J. Wysocki, linux-pm, linux-tegra, linux-kernel

Check whether PMC is ready before proceeding with the cpuidle registration.
This fixes racing with the PMC driver probe order, which results in a
disabled deepest CC6 idling state if cpuidle driver is probed before the
PMC.

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/cpuidle/cpuidle-tegra.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
index 508bd9f23792..9845629aeb6d 100644
--- a/drivers/cpuidle/cpuidle-tegra.c
+++ b/drivers/cpuidle/cpuidle-tegra.c
@@ -337,6 +337,9 @@ static void tegra_cpuidle_setup_tegra114_c7_state(void)
 
 static int tegra_cpuidle_probe(struct platform_device *pdev)
 {
+	if (tegra_pmc_get_suspend_mode() == TEGRA_SUSPEND_NOT_READY)
+		return -EPROBE_DEFER;
+
 	/* LP2 could be disabled in device-tree */
 	if (tegra_pmc_get_suspend_mode() < TEGRA_SUSPEND_LP2)
 		tegra_cpuidle_disable_state(TEGRA_CC6);
-- 
2.32.0


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

* Re: [PATCH v1 5/6] cpuidle: tegra: Enable compile testing
  2021-09-12 20:29 ` [PATCH v1 5/6] cpuidle: tegra: Enable " Dmitry Osipenko
@ 2021-09-27 16:33   ` Dmitry Osipenko
  2021-09-29 10:32     ` Daniel Lezcano
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Osipenko @ 2021-09-27 16:33 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Daniel Lezcano, Rafael J. Wysocki
  Cc: linux-pm, linux-tegra, linux-kernel

12.09.2021 23:29, Dmitry Osipenko пишет:
> Enable compile testing of tegra-cpuidle driver.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/cpuidle/Kconfig.arm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
> index 334f83e56120..599286fc0b08 100644
> --- a/drivers/cpuidle/Kconfig.arm
> +++ b/drivers/cpuidle/Kconfig.arm
> @@ -99,7 +99,7 @@ config ARM_MVEBU_V7_CPUIDLE
>  
>  config ARM_TEGRA_CPUIDLE
>  	bool "CPU Idle Driver for NVIDIA Tegra SoCs"
> -	depends on ARCH_TEGRA && !ARM64
> +	depends on (ARCH_TEGRA || COMPILE_TEST) && !ARM64 && MMU
>  	select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
>  	select ARM_CPU_SUSPEND
>  	help
> 

Daniel / Rafael, could you please ack this patch to allow Thierry to
take this whole series via the Tegra tree?

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

* Re: [PATCH v1 5/6] cpuidle: tegra: Enable compile testing
  2021-09-27 16:33   ` Dmitry Osipenko
@ 2021-09-29 10:32     ` Daniel Lezcano
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2021-09-29 10:32 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding, Jonathan Hunter, Rafael J. Wysocki
  Cc: linux-pm, linux-tegra, linux-kernel

On 27/09/2021 18:33, Dmitry Osipenko wrote:
> 12.09.2021 23:29, Dmitry Osipenko пишет:
>> Enable compile testing of tegra-cpuidle driver.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  drivers/cpuidle/Kconfig.arm | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
>> index 334f83e56120..599286fc0b08 100644
>> --- a/drivers/cpuidle/Kconfig.arm
>> +++ b/drivers/cpuidle/Kconfig.arm
>> @@ -99,7 +99,7 @@ config ARM_MVEBU_V7_CPUIDLE
>>  
>>  config ARM_TEGRA_CPUIDLE
>>  	bool "CPU Idle Driver for NVIDIA Tegra SoCs"
>> -	depends on ARCH_TEGRA && !ARM64
>> +	depends on (ARCH_TEGRA || COMPILE_TEST) && !ARM64 && MMU
>>  	select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
>>  	select ARM_CPU_SUSPEND
>>  	help
>>
> 
> Daniel / Rafael, could you please ack this patch to allow Thierry to
> take this whole series via the Tegra tree?
> 

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH v1 4/6] clk: tegra: Add stubs needed for compile testing
  2021-09-12 20:29 ` [PATCH v1 4/6] clk: tegra: Add stubs needed " Dmitry Osipenko
@ 2021-10-04 19:33   ` Thierry Reding
  2021-10-04 20:02     ` Thierry Reding
  0 siblings, 1 reply; 12+ messages in thread
From: Thierry Reding @ 2021-10-04 19:33 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Jonathan Hunter, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On Sun, Sep 12, 2021 at 11:29:05PM +0300, Dmitry Osipenko wrote:
> Add stubs needed for compile-testing of tegra-cpuidle driver.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  include/linux/clk/tegra.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
> index d128ad1570aa..9bd06d8a5436 100644
> --- a/include/linux/clk/tegra.h
> +++ b/include/linux/clk/tegra.h
> @@ -42,7 +42,11 @@ struct tegra_cpu_car_ops {
>  #endif
>  };
>  
> +#ifdef CONFIG_ARCH_TEGRA
>  extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
> +#else
> +static struct tegra_cpu_car_ops *tegra_cpu_car_ops __maybe_unused;
> +#endif

Ugh... this one seems a bit over the top, to be honest. The only place
where this seems to be used is in arch/arm/mach-tegra/pm.c, but that
already uses one of the stubs from include/linux/clk/tegra.h, so I'm
wondering if we can't define that latter stub in a way to make it
unnecessary to declare this bogus pointer.

I'll play around with this a little bit.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v1 4/6] clk: tegra: Add stubs needed for compile testing
  2021-10-04 19:33   ` Thierry Reding
@ 2021-10-04 20:02     ` Thierry Reding
  2021-10-04 20:41       ` Dmitry Osipenko
  0 siblings, 1 reply; 12+ messages in thread
From: Thierry Reding @ 2021-10-04 20:02 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Jonathan Hunter, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2353 bytes --]

On Mon, Oct 04, 2021 at 09:33:57PM +0200, Thierry Reding wrote:
> On Sun, Sep 12, 2021 at 11:29:05PM +0300, Dmitry Osipenko wrote:
> > Add stubs needed for compile-testing of tegra-cpuidle driver.
> > 
> > Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> > ---
> >  include/linux/clk/tegra.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
> > index d128ad1570aa..9bd06d8a5436 100644
> > --- a/include/linux/clk/tegra.h
> > +++ b/include/linux/clk/tegra.h
> > @@ -42,7 +42,11 @@ struct tegra_cpu_car_ops {
> >  #endif
> >  };
> >  
> > +#ifdef CONFIG_ARCH_TEGRA
> >  extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
> > +#else
> > +static struct tegra_cpu_car_ops *tegra_cpu_car_ops __maybe_unused;
> > +#endif
> 
> Ugh... this one seems a bit over the top, to be honest. The only place
> where this seems to be used is in arch/arm/mach-tegra/pm.c, but that
> already uses one of the stubs from include/linux/clk/tegra.h, so I'm
> wondering if we can't define that latter stub in a way to make it
> unnecessary to declare this bogus pointer.
> 
> I'll play around with this a little bit.

The below does the trick for me as well:

--- >8 ---
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
index d128ad1570aa..d261db7e6060 100644
--- a/include/linux/clk/tegra.h
+++ b/include/linux/clk/tegra.h
@@ -42,6 +42,7 @@ struct tegra_cpu_car_ops {
 #endif
 };

+#ifdef CONFIG_ARCH_TEGRA
 extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;

 static inline void tegra_wait_cpu_in_reset(u32 cpu)
@@ -83,6 +84,27 @@ static inline void tegra_disable_cpu_clock(u32 cpu)

 	tegra_cpu_car_ops->disable_clock(cpu);
 }
+#else
+static inline void tegra_wait_cpu_in_reset(u32 cpu)
+{
+}
+
+static inline void tegra_put_cpu_in_reset(u32 cpu)
+{
+}
+
+static inline void tegra_cpu_out_of_reset(u32 cpu)
+{
+}
+
+static inline void tegra_enable_cpu_clock(u32 cpu)
+{
+}
+
+static inline void tegra_disable_cpu_clock(u32 cpu)
+{
+}
+#endif

 #ifdef CONFIG_PM_SLEEP
 static inline bool tegra_cpu_rail_off_ready(void)
--- >8 ---

Do you mind if I replace your version with that? I think that's a little
bit cleaner because it should be easier for the compiler to completely
compile it out.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v1 4/6] clk: tegra: Add stubs needed for compile testing
  2021-10-04 20:02     ` Thierry Reding
@ 2021-10-04 20:41       ` Dmitry Osipenko
  0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Osipenko @ 2021-10-04 20:41 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jonathan Hunter, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	linux-tegra, linux-kernel

04.10.2021 23:02, Thierry Reding пишет:
> On Mon, Oct 04, 2021 at 09:33:57PM +0200, Thierry Reding wrote:
>> On Sun, Sep 12, 2021 at 11:29:05PM +0300, Dmitry Osipenko wrote:
>>> Add stubs needed for compile-testing of tegra-cpuidle driver.
>>>
>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>> ---
>>>  include/linux/clk/tegra.h | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
>>> index d128ad1570aa..9bd06d8a5436 100644
>>> --- a/include/linux/clk/tegra.h
>>> +++ b/include/linux/clk/tegra.h
>>> @@ -42,7 +42,11 @@ struct tegra_cpu_car_ops {
>>>  #endif
>>>  };
>>>  
>>> +#ifdef CONFIG_ARCH_TEGRA
>>>  extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
>>> +#else
>>> +static struct tegra_cpu_car_ops *tegra_cpu_car_ops __maybe_unused;
>>> +#endif
>>
>> Ugh... this one seems a bit over the top, to be honest. The only place
>> where this seems to be used is in arch/arm/mach-tegra/pm.c, but that
>> already uses one of the stubs from include/linux/clk/tegra.h, so I'm
>> wondering if we can't define that latter stub in a way to make it
>> unnecessary to declare this bogus pointer.
>>
>> I'll play around with this a little bit.
> 
> The below does the trick for me as well:
> 
> --- >8 ---
> diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
> index d128ad1570aa..d261db7e6060 100644
> --- a/include/linux/clk/tegra.h
> +++ b/include/linux/clk/tegra.h
> @@ -42,6 +42,7 @@ struct tegra_cpu_car_ops {
>  #endif
>  };
> 
> +#ifdef CONFIG_ARCH_TEGRA
>  extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
> 
>  static inline void tegra_wait_cpu_in_reset(u32 cpu)
> @@ -83,6 +84,27 @@ static inline void tegra_disable_cpu_clock(u32 cpu)
> 
>  	tegra_cpu_car_ops->disable_clock(cpu);
>  }
> +#else
> +static inline void tegra_wait_cpu_in_reset(u32 cpu)
> +{
> +}
> +
> +static inline void tegra_put_cpu_in_reset(u32 cpu)
> +{
> +}
> +
> +static inline void tegra_cpu_out_of_reset(u32 cpu)
> +{
> +}
> +
> +static inline void tegra_enable_cpu_clock(u32 cpu)
> +{
> +}
> +
> +static inline void tegra_disable_cpu_clock(u32 cpu)
> +{
> +}
> +#endif
> 
>  #ifdef CONFIG_PM_SLEEP
>  static inline bool tegra_cpu_rail_off_ready(void)
> --- >8 ---
> 
> Do you mind if I replace your version with that? I think that's a little
> bit cleaner because it should be easier for the compiler to completely
> compile it out.

I don't mind, please choose what you prefer more. This was one of the
first variants of this patch, it adds more lines and it won't be
compiled with ARCH_TEGRA=n and COMPILE_TEST=n anyways.

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

end of thread, other threads:[~2021-10-04 20:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-12 20:29 [PATCH v1 0/6] Tegra cpuidle driver fixes and improvements for 5.16 Dmitry Osipenko
2021-09-12 20:29 ` [PATCH v1 1/6] soc/tegra: fuse: Add stubs needed for compile testing Dmitry Osipenko
2021-09-12 20:29 ` [PATCH v1 2/6] soc/tegra: irq: " Dmitry Osipenko
2021-09-12 20:29 ` [PATCH v1 3/6] soc/tegra: pm: Make stubs usable " Dmitry Osipenko
2021-09-12 20:29 ` [PATCH v1 4/6] clk: tegra: Add stubs needed " Dmitry Osipenko
2021-10-04 19:33   ` Thierry Reding
2021-10-04 20:02     ` Thierry Reding
2021-10-04 20:41       ` Dmitry Osipenko
2021-09-12 20:29 ` [PATCH v1 5/6] cpuidle: tegra: Enable " Dmitry Osipenko
2021-09-27 16:33   ` Dmitry Osipenko
2021-09-29 10:32     ` Daniel Lezcano
2021-09-12 20:29 ` [PATCH v1 6/6] cpuidle: tegra: Check whether PMC is ready Dmitry Osipenko

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).