diff mbox series

[v6,08/14] memory: tegra: Enable compile testing for all drivers

Message ID 20210601023119.22044-9-digetx@gmail.com
State Accepted
Commit 56ebc9b0d77e0406aba2d900c82e79204cc7dc32
Headers show
Series [v6,01/14] regulator: core: Add regulator_sync_voltage_rdev() | expand

Commit Message

Dmitry Osipenko June 1, 2021, 2:31 a.m. UTC
Enable compile testing for all Tegra memory drivers.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/memory/tegra/Kconfig | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Krzysztof Kozlowski June 7, 2021, 6:01 a.m. UTC | #1
On 01/06/2021 04:31, Dmitry Osipenko wrote:
> Enable compile testing for all Tegra memory drivers.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/memory/tegra/Kconfig | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 

Hi Dmitry,

This fails on x86_64 and i386:
https://krzk.eu/#/builders/38/builds/260
https://krzk.eu/#/builders/40/builds/261

/bin/ld: warning: orphan section `__reservedmem_of_table' from `drivers/memory/tegra/tegra210-emc-table.o' being placed in section `__reservedmem_of_table'
/bin/ld: drivers/memory/tegra/mc.o: in function `tegra_mc_probe':
mc.c:(.text+0x87a): undefined reference to `reset_controller_register'
make[1]: *** [/home/buildbot/worker/builddir/build/Makefile:1191: vmlinux] Error 1

It's a defconfig with:
scripts/config --file out/.config -e COMPILE_TEST -e OF -e SRAM -e
MEMORY -e PM_DEVFREQ -e ARM_PL172_MPMC -e ATMEL_SDRAMC -e ATMEL_EBI -e
BRCMSTB_DPFE -e BT1_L2_CTL -e TI_AEMIF -e TI_EMIF -e OMAP_GPMC -e
TI_EMIF_SRAM -e MVEBU_DEVBUS -e FSL_CORENET_CF -e FSL_IFC -e JZ4780_NEMC
-e MTK_SMI -e DA8XX_DDRCTL -e PL353_SMC -e RENESAS_RPCIF -e
STM32_FMC2_EBI -e SAMSUNG_MC -e EXYNOS5422_DMC -e EXYNOS_SROM -e
TEGRA_MC -e TEGRA20_EMC -e TEGRA30_EMC -e TEGRA124_EMC -e
TEGRA210_EMC_TABLE -e TEGRA210_EMC


Best regards,
Krzysztof
Dmitry Osipenko June 7, 2021, 1:37 p.m. UTC | #2
07.06.2021 16:36, Thierry Reding пишет:
> On Mon, Jun 07, 2021 at 08:01:28AM +0200, Krzysztof Kozlowski wrote:
>> On 01/06/2021 04:31, Dmitry Osipenko wrote:
>>> Enable compile testing for all Tegra memory drivers.
>>>
>>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>> ---
>>>  drivers/memory/tegra/Kconfig | 16 ++++++++++------
>>>  1 file changed, 10 insertions(+), 6 deletions(-)
>>>
>>
>> Hi Dmitry,
>>
>> This fails on x86_64 and i386:
>> https://krzk.eu/#/builders/38/builds/260
>> https://krzk.eu/#/builders/40/builds/261
>>
>> /bin/ld: warning: orphan section `__reservedmem_of_table' from `drivers/memory/tegra/tegra210-emc-table.o' being placed in section `__reservedmem_of_table'
>> /bin/ld: drivers/memory/tegra/mc.o: in function `tegra_mc_probe':
>> mc.c:(.text+0x87a): undefined reference to `reset_controller_register'
>> make[1]: *** [/home/buildbot/worker/builddir/build/Makefile:1191: vmlinux] Error 1
>>
>> It's a defconfig with:
>> scripts/config --file out/.config -e COMPILE_TEST -e OF -e SRAM -e
>> MEMORY -e PM_DEVFREQ -e ARM_PL172_MPMC -e ATMEL_SDRAMC -e ATMEL_EBI -e
>> BRCMSTB_DPFE -e BT1_L2_CTL -e TI_AEMIF -e TI_EMIF -e OMAP_GPMC -e
>> TI_EMIF_SRAM -e MVEBU_DEVBUS -e FSL_CORENET_CF -e FSL_IFC -e JZ4780_NEMC
>> -e MTK_SMI -e DA8XX_DDRCTL -e PL353_SMC -e RENESAS_RPCIF -e
>> STM32_FMC2_EBI -e SAMSUNG_MC -e EXYNOS5422_DMC -e EXYNOS_SROM -e
>> TEGRA_MC -e TEGRA20_EMC -e TEGRA30_EMC -e TEGRA124_EMC -e
>> TEGRA210_EMC_TABLE -e TEGRA210_EMC
> 
> Ugh... that's exactly one of the reasons why I dislike COMPILE_TEST...
> though admittedly it does point out a missing dependency here. I think
> we need to add && RESET_CONTROLLER to that || branch of the depends on
> to fix that. ARCH_TEGRA selects RESET_CONTROLLER explicitly, so the
> COMPILE_TEST branch needs to mirror that.
> 
> Either that, or I suppose we could add the depends on RESET_CONTROLLER
> explicitly to TEGRA_MC, or perhaps even select it (although that could
> cause conflicts down the road, but should be fine right now because
> RESET_CONTROLLER doesn't have any other dependencies right now).

The select will work.

The other option is to add stubs for the reset controller API.
Dmitry Osipenko June 7, 2021, 2:01 p.m. UTC | #3
07.06.2021 16:36, Thierry Reding пишет:
>> /bin/ld: warning: orphan section `__reservedmem_of_table' from `drivers/memory/tegra/tegra210-emc-table.o' being placed in section `__reservedmem_of_table'

>> /bin/ld: drivers/memory/tegra/mc.o: in function `tegra_mc_probe':

>> mc.c:(.text+0x87a): undefined reference to `reset_controller_register'

>> make[1]: *** [/home/buildbot/worker/builddir/build/Makefile:1191: vmlinux] Error 1

...

> Not sure what to do about that orphaned __reservedmem_of_table section.

> Maybe all we need to do is to select OF_RESERVED_MEM from

> TEGRA210_EMC_TABLE?


Select won't work easily, but the dependency for TEGRA210_EMC should.
Thierry Reding June 7, 2021, 2:19 p.m. UTC | #4
On Mon, Jun 07, 2021 at 05:01:02PM +0300, Dmitry Osipenko wrote:
> 07.06.2021 16:36, Thierry Reding пишет:
> >> /bin/ld: warning: orphan section `__reservedmem_of_table' from `drivers/memory/tegra/tegra210-emc-table.o' being placed in section `__reservedmem_of_table'
> >> /bin/ld: drivers/memory/tegra/mc.o: in function `tegra_mc_probe':
> >> mc.c:(.text+0x87a): undefined reference to `reset_controller_register'
> >> make[1]: *** [/home/buildbot/worker/builddir/build/Makefile:1191: vmlinux] Error 1
> ...
> 
> > Not sure what to do about that orphaned __reservedmem_of_table section.
> > Maybe all we need to do is to select OF_RESERVED_MEM from
> > TEGRA210_EMC_TABLE?
> 
> Select won't work easily, but the dependency for TEGRA210_EMC should.

Select works if I also select OF_EARLY_FLATTREE. That's slightly odd
because typically that's something that the platform would select, but
there's precedent for doing this in drivers/clk/x86/Kconfig, so I think
it'd be fine.

The attached patch resolves both of the above issues for me.

Krzysztof: do you want to squash that into the problematic patch or do
you want me to send this as a follow-up patch for you to apply? I guess
the latter since you've already sent out the PR for Will and ARM SoC?

Thierry

--- >8 ---
diff --git a/drivers/memory/tegra/Kconfig b/drivers/memory/tegra/Kconfig
index f9bae36c03a3..ae8c57b921e6 100644
--- a/drivers/memory/tegra/Kconfig
+++ b/drivers/memory/tegra/Kconfig
@@ -4,6 +4,7 @@ config TEGRA_MC
 	default y
 	depends on ARCH_TEGRA || (COMPILE_TEST && COMMON_CLK)
 	select INTERCONNECT
+	select RESET_CONTROLLER
 	help
 	  This driver supports the Memory Controller (MC) hardware found on
 	  NVIDIA Tegra SoCs.
@@ -48,6 +49,8 @@ config TEGRA124_EMC
 config TEGRA210_EMC_TABLE
 	bool
 	depends on ARCH_TEGRA_210_SOC || COMPILE_TEST
+	select OF_EARLY_FLATTREE
+	select OF_RESERVED_MEM
 
 config TEGRA210_EMC
 	tristate "NVIDIA Tegra210 External Memory Controller driver"
--- >8 ---
Krzysztof Kozlowski June 7, 2021, 2:42 p.m. UTC | #5
On 07/06/2021 16:19, Thierry Reding wrote:
> On Mon, Jun 07, 2021 at 05:01:02PM +0300, Dmitry Osipenko wrote:

>> 07.06.2021 16:36, Thierry Reding пишет:

>>>> /bin/ld: warning: orphan section `__reservedmem_of_table' from `drivers/memory/tegra/tegra210-emc-table.o' being placed in section `__reservedmem_of_table'

>>>> /bin/ld: drivers/memory/tegra/mc.o: in function `tegra_mc_probe':

>>>> mc.c:(.text+0x87a): undefined reference to `reset_controller_register'

>>>> make[1]: *** [/home/buildbot/worker/builddir/build/Makefile:1191: vmlinux] Error 1

>> ...

>>

>>> Not sure what to do about that orphaned __reservedmem_of_table section.

>>> Maybe all we need to do is to select OF_RESERVED_MEM from

>>> TEGRA210_EMC_TABLE?

>>

>> Select won't work easily, but the dependency for TEGRA210_EMC should.

> 

> Select works if I also select OF_EARLY_FLATTREE. That's slightly odd

> because typically that's something that the platform would select, but

> there's precedent for doing this in drivers/clk/x86/Kconfig, so I think

> it'd be fine.

> 

> The attached patch resolves both of the above issues for me.

> 

> Krzysztof: do you want to squash that into the problematic patch or do

> you want me to send this as a follow-up patch for you to apply? I guess

> the latter since you've already sent out the PR for Will and ARM SoC?


Follow up, please, but I am not sure about selecting reset controller.
From the tegra/mc.c code I see it can be optional - if "reset_ops" is
provided. Therefore I think:
1. Reset controller should provide proper stubs. This will fix building
of mc.c when reset controller is not chosen (regardless of point #2 below).

2. Specific drivers should depend on it. Selecting user-visible symbols
is rather discourage because might lead to circular dependencies.

Best regards,
Krzysztof
Dmitry Osipenko June 8, 2021, 3:18 p.m. UTC | #6
07.06.2021 17:42, Krzysztof Kozlowski пишет:
> On 07/06/2021 16:19, Thierry Reding wrote:

>> On Mon, Jun 07, 2021 at 05:01:02PM +0300, Dmitry Osipenko wrote:

>>> 07.06.2021 16:36, Thierry Reding пишет:

>>>>> /bin/ld: warning: orphan section `__reservedmem_of_table' from `drivers/memory/tegra/tegra210-emc-table.o' being placed in section `__reservedmem_of_table'

>>>>> /bin/ld: drivers/memory/tegra/mc.o: in function `tegra_mc_probe':

>>>>> mc.c:(.text+0x87a): undefined reference to `reset_controller_register'

>>>>> make[1]: *** [/home/buildbot/worker/builddir/build/Makefile:1191: vmlinux] Error 1

>>> ...

>>>

>>>> Not sure what to do about that orphaned __reservedmem_of_table section.

>>>> Maybe all we need to do is to select OF_RESERVED_MEM from

>>>> TEGRA210_EMC_TABLE?

>>>

>>> Select won't work easily, but the dependency for TEGRA210_EMC should.

>>

>> Select works if I also select OF_EARLY_FLATTREE. That's slightly odd

>> because typically that's something that the platform would select, but

>> there's precedent for doing this in drivers/clk/x86/Kconfig, so I think

>> it'd be fine.

>>

>> The attached patch resolves both of the above issues for me.

>>

>> Krzysztof: do you want to squash that into the problematic patch or do

>> you want me to send this as a follow-up patch for you to apply? I guess

>> the latter since you've already sent out the PR for Will and ARM SoC?

> 

> Follow up, please, but I am not sure about selecting reset controller.

> From the tegra/mc.c code I see it can be optional - if "reset_ops" is

> provided. Therefore I think:

> 1. Reset controller should provide proper stubs. This will fix building

> of mc.c when reset controller is not chosen (regardless of point #2 below).

> 

> 2. Specific drivers should depend on it. Selecting user-visible symbols

> is rather discourage because might lead to circular dependencies.


Thierry, should I send the patches or you're willing to do it?
diff mbox series

Patch

diff --git a/drivers/memory/tegra/Kconfig b/drivers/memory/tegra/Kconfig
index a70967a56e52..71bba2345bce 100644
--- a/drivers/memory/tegra/Kconfig
+++ b/drivers/memory/tegra/Kconfig
@@ -2,16 +2,18 @@ 
 config TEGRA_MC
 	bool "NVIDIA Tegra Memory Controller support"
 	default y
-	depends on ARCH_TEGRA
+	depends on ARCH_TEGRA || (COMPILE_TEST && COMMON_CLK)
 	select INTERCONNECT
 	help
 	  This driver supports the Memory Controller (MC) hardware found on
 	  NVIDIA Tegra SoCs.
 
+if TEGRA_MC
+
 config TEGRA20_EMC
 	tristate "NVIDIA Tegra20 External Memory Controller driver"
 	default y
-	depends on TEGRA_MC && ARCH_TEGRA_2x_SOC
+	depends on ARCH_TEGRA_2x_SOC || COMPILE_TEST
 	select DEVFREQ_GOV_SIMPLE_ONDEMAND
 	select PM_DEVFREQ
 	help
@@ -23,7 +25,7 @@  config TEGRA20_EMC
 config TEGRA30_EMC
 	tristate "NVIDIA Tegra30 External Memory Controller driver"
 	default y
-	depends on TEGRA_MC && ARCH_TEGRA_3x_SOC
+	depends on ARCH_TEGRA_3x_SOC || COMPILE_TEST
 	select PM_OPP
 	help
 	  This driver is for the External Memory Controller (EMC) found on
@@ -34,8 +36,8 @@  config TEGRA30_EMC
 config TEGRA124_EMC
 	tristate "NVIDIA Tegra124 External Memory Controller driver"
 	default y
-	depends on TEGRA_MC && ARCH_TEGRA_124_SOC
-	select TEGRA124_CLK_EMC
+	depends on ARCH_TEGRA_124_SOC || COMPILE_TEST
+	select TEGRA124_CLK_EMC if ARCH_TEGRA
 	select PM_OPP
 	help
 	  This driver is for the External Memory Controller (EMC) found on
@@ -49,10 +51,12 @@  config TEGRA210_EMC_TABLE
 
 config TEGRA210_EMC
 	tristate "NVIDIA Tegra210 External Memory Controller driver"
-	depends on TEGRA_MC && ARCH_TEGRA_210_SOC
+	depends on ARCH_TEGRA_210_SOC || COMPILE_TEST
 	select TEGRA210_EMC_TABLE
 	help
 	  This driver is for the External Memory Controller (EMC) found on
 	  Tegra210 chips. The EMC controls the external DRAM on the board.
 	  This driver is required to change memory timings / clock rate for
 	  external memory.
+
+endif