[2/2] ata: octeon: Add compile test support

Message ID 20230614173633.2430653-2-robh@kernel.org
State New
Headers
Series [1/2] MIPS: octeon: Fix cvmx_writeq_csr/cvmx_readq_csr on 32-bit builds |

Commit Message

Rob Herring June 14, 2023, 5:36 p.m. UTC
  Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
so other arches can't be enabled.

Signed-off-by: Rob Herring <robh@kernel.org>
---
Tested on allmodconfig build. Not sure if there's other MIPS configs 
where this doesn't work. We'll see what 0-day says.

 drivers/ata/Kconfig          | 4 ++--
 drivers/ata/pata_octeon_cf.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Damien Le Moal June 15, 2023, 12:45 a.m. UTC | #1
On 6/15/23 02:36, Rob Herring wrote:
> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
> so other arches can't be enabled.

Yes, I tried... That is unfortunate.

Looks good to me though. If I get an Ack for patch 1, I can queue this up
through the ata tree.

> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Tested on allmodconfig build. Not sure if there's other MIPS configs 
> where this doesn't work. We'll see what 0-day says.
> 
>  drivers/ata/Kconfig          | 4 ++--
>  drivers/ata/pata_octeon_cf.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 42b51c9812a0..4572f837e504 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -239,7 +239,7 @@ config AHCI_MVEBU
>  
>  config AHCI_OCTEON
>  	tristate "Cavium Octeon Soc Serial ATA"
> -	depends on SATA_AHCI_PLATFORM && CAVIUM_OCTEON_SOC
> +	depends on SATA_AHCI_PLATFORM && MIPS && (CAVIUM_OCTEON_SOC || COMPILE_TEST)
>  	default y
>  	help
>  	  This option enables support for Cavium Octeon SoC Serial ATA.
> @@ -373,7 +373,7 @@ config PDC_ADMA
>  
>  config PATA_OCTEON_CF
>  	tristate "OCTEON Boot Bus Compact Flash support"
> -	depends on CAVIUM_OCTEON_SOC
> +	depends on MIPS && (CAVIUM_OCTEON_SOC || COMPILE_TEST)
>  	select PATA_TIMINGS
>  	help
>  	  This option enables a polled compact flash driver for use with
> diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
> index 57b2166a6d5d..cc9e4b63ded9 100644
> --- a/drivers/ata/pata_octeon_cf.c
> +++ b/drivers/ata/pata_octeon_cf.c
> @@ -853,8 +853,8 @@ static int octeon_cf_probe(struct platform_device *pdev)
>  					of_node_put(dma_node);
>  					return -EINVAL;
>  				}
> -				cf_port->dma_base = (u64)devm_ioremap(&pdev->dev, res_dma->start,
> -									 resource_size(res_dma));
> +				cf_port->dma_base = (uintptr_t)devm_ioremap(&pdev->dev, res_dma->start,
> +									    resource_size(res_dma));
>  				if (!cf_port->dma_base) {
>  					put_device(&dma_dev->dev);
>  					of_node_put(dma_node);
  
Damien Le Moal June 16, 2023, 2:08 a.m. UTC | #2
On 6/15/23 02:36, Rob Herring wrote:
> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
> so other arches can't be enabled.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

Applied this and 1/2 to for-6.5. Thanks !
  
Guenter Roeck June 21, 2023, 4:51 p.m. UTC | #3
On Wed, Jun 14, 2023 at 11:36:33AM -0600, Rob Herring wrote:
> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
> so other arches can't be enabled.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Tested on allmodconfig build. Not sure if there's other MIPS configs 
> where this doesn't work. We'll see what 0-day says.

Odd, in next-20230621 I get:

Building mips:allmodconfig ... failed
--------------
Error log:
ERROR: modpost: "__udivdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
ERROR: modpost: "octeon_get_io_clock_rate" [drivers/ata/pata_octeon_cf.ko] undefined!
ERROR: modpost: "__tracepoint_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
ERROR: modpost: "__traceiter_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
ERROR: modpost: "__divdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
make[2]: [scripts/Makefile.modpost:144: Module.symvers] Error 1 (ignored)
make[2]: *** No rule to make target 'kernel/locking/locktorture.ko', needed by '__modfinal'.  Stop.
make[1]: [Makefile:1933: modules] Error 2 (ignored)

Guenter
  
Damien Le Moal June 22, 2023, 12:57 a.m. UTC | #4
On 6/22/23 01:51, Guenter Roeck wrote:
> On Wed, Jun 14, 2023 at 11:36:33AM -0600, Rob Herring wrote:
>> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
>> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
>> so other arches can't be enabled.
>>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>> Tested on allmodconfig build. Not sure if there's other MIPS configs 
>> where this doesn't work. We'll see what 0-day says.
> 
> Odd, in next-20230621 I get:
> 
> Building mips:allmodconfig ... failed

Indeed odd. Given that this is an allmodconfig, I would assume that
CONFIG_CAVIUM_OCTEON_SOC is set ?

> --------------
> Error log:
> ERROR: modpost: "__udivdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
> ERROR: modpost: "octeon_get_io_clock_rate" [drivers/ata/pata_octeon_cf.ko] undefined!
> ERROR: modpost: "__tracepoint_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
> ERROR: modpost: "__traceiter_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
> ERROR: modpost: "__divdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
> make[2]: [scripts/Makefile.modpost:144: Module.symvers] Error 1 (ignored)
> make[2]: *** No rule to make target 'kernel/locking/locktorture.ko', needed by '__modfinal'.  Stop.
> make[1]: [Makefile:1933: modules] Error 2 (ignored)
> 
> Guenter
  
Guenter Roeck June 22, 2023, 3:01 a.m. UTC | #5
On 6/21/23 17:57, Damien Le Moal wrote:
> On 6/22/23 01:51, Guenter Roeck wrote:
>> On Wed, Jun 14, 2023 at 11:36:33AM -0600, Rob Herring wrote:
>>> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
>>> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
>>> so other arches can't be enabled.
>>>
>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>> ---
>>> Tested on allmodconfig build. Not sure if there's other MIPS configs
>>> where this doesn't work. We'll see what 0-day says.
>>
>> Odd, in next-20230621 I get:
>>
>> Building mips:allmodconfig ... failed
> 
> Indeed odd. Given that this is an allmodconfig, I would assume that
> CONFIG_CAVIUM_OCTEON_SOC is set ?
> 

No, it is not. CONFIG_CAVIUM_OCTEON_SOC is a choice option,
meaning only one of the choices can be set, and mips:allmodconfig
selects a different choice.

Guenter

>> --------------
>> Error log:
>> ERROR: modpost: "__udivdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
>> ERROR: modpost: "octeon_get_io_clock_rate" [drivers/ata/pata_octeon_cf.ko] undefined!
>> ERROR: modpost: "__tracepoint_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
>> ERROR: modpost: "__traceiter_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
>> ERROR: modpost: "__divdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
>> make[2]: [scripts/Makefile.modpost:144: Module.symvers] Error 1 (ignored)
>> make[2]: *** No rule to make target 'kernel/locking/locktorture.ko', needed by '__modfinal'.  Stop.
>> make[1]: [Makefile:1933: modules] Error 2 (ignored)
>>
>> Guenter
>
  
Damien Le Moal June 22, 2023, 4:26 a.m. UTC | #6
On 6/22/23 12:01, Guenter Roeck wrote:
> On 6/21/23 17:57, Damien Le Moal wrote:
>> On 6/22/23 01:51, Guenter Roeck wrote:
>>> On Wed, Jun 14, 2023 at 11:36:33AM -0600, Rob Herring wrote:
>>>> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
>>>> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
>>>> so other arches can't be enabled.
>>>>
>>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>>> ---
>>>> Tested on allmodconfig build. Not sure if there's other MIPS configs
>>>> where this doesn't work. We'll see what 0-day says.
>>>
>>> Odd, in next-20230621 I get:
>>>
>>> Building mips:allmodconfig ... failed
>>
>> Indeed odd. Given that this is an allmodconfig, I would assume that
>> CONFIG_CAVIUM_OCTEON_SOC is set ?
>>
> 
> No, it is not. CONFIG_CAVIUM_OCTEON_SOC is a choice option,
> meaning only one of the choices can be set, and mips:allmodconfig
> selects a different choice.

OK. Then I think I need to drop this patch as I do not see how to allow
COMPILE_TEST without CONFIG_CAVIUM_OCTEON_SOC being set.

Rob ?

> 
> Guenter
> 
>>> --------------
>>> Error log:
>>> ERROR: modpost: "__udivdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
>>> ERROR: modpost: "octeon_get_io_clock_rate" [drivers/ata/pata_octeon_cf.ko] undefined!
>>> ERROR: modpost: "__tracepoint_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
>>> ERROR: modpost: "__traceiter_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
>>> ERROR: modpost: "__divdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
>>> make[2]: [scripts/Makefile.modpost:144: Module.symvers] Error 1 (ignored)
>>> make[2]: *** No rule to make target 'kernel/locking/locktorture.ko', needed by '__modfinal'.  Stop.
>>> make[1]: [Makefile:1933: modules] Error 2 (ignored)
>>>
>>> Guenter
>>
>
  
Guenter Roeck June 22, 2023, 5:10 a.m. UTC | #7
On 6/21/23 21:26, Damien Le Moal wrote:
> On 6/22/23 12:01, Guenter Roeck wrote:
>> On 6/21/23 17:57, Damien Le Moal wrote:
>>> On 6/22/23 01:51, Guenter Roeck wrote:
>>>> On Wed, Jun 14, 2023 at 11:36:33AM -0600, Rob Herring wrote:
>>>>> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
>>>>> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
>>>>> so other arches can't be enabled.
>>>>>
>>>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>>>> ---
>>>>> Tested on allmodconfig build. Not sure if there's other MIPS configs
>>>>> where this doesn't work. We'll see what 0-day says.
>>>>
>>>> Odd, in next-20230621 I get:
>>>>
>>>> Building mips:allmodconfig ... failed
>>>
>>> Indeed odd. Given that this is an allmodconfig, I would assume that
>>> CONFIG_CAVIUM_OCTEON_SOC is set ?
>>>
>>
>> No, it is not. CONFIG_CAVIUM_OCTEON_SOC is a choice option,
>> meaning only one of the choices can be set, and mips:allmodconfig
>> selects a different choice.
> 
> OK. Then I think I need to drop this patch as I do not see how to allow
> COMPILE_TEST without CONFIG_CAVIUM_OCTEON_SOC being set.
> 

That is a contradiction anyway. COMPILE_TEST implies that the target is
independent of any other compile flags. If it depends on CONFIG_CAVIUM_OCTEON_SOC,
overriding that with COMPILE_TEST does not make sense.

Guenter

> Rob ?
> 
>>
>> Guenter
>>
>>>> --------------
>>>> Error log:
>>>> ERROR: modpost: "__udivdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
>>>> ERROR: modpost: "octeon_get_io_clock_rate" [drivers/ata/pata_octeon_cf.ko] undefined!
>>>> ERROR: modpost: "__tracepoint_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
>>>> ERROR: modpost: "__traceiter_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
>>>> ERROR: modpost: "__divdi3" [drivers/ata/pata_octeon_cf.ko] undefined!
>>>> make[2]: [scripts/Makefile.modpost:144: Module.symvers] Error 1 (ignored)
>>>> make[2]: *** No rule to make target 'kernel/locking/locktorture.ko', needed by '__modfinal'.  Stop.
>>>> make[1]: [Makefile:1933: modules] Error 2 (ignored)
>>>>
>>>> Guenter
>>>
>>
>
  
Rob Herring June 22, 2023, 1:41 p.m. UTC | #8
On Wed, Jun 21, 2023 at 10:26 PM Damien Le Moal <dlemoal@kernel.org> wrote:
>
> On 6/22/23 12:01, Guenter Roeck wrote:
> > On 6/21/23 17:57, Damien Le Moal wrote:
> >> On 6/22/23 01:51, Guenter Roeck wrote:
> >>> On Wed, Jun 14, 2023 at 11:36:33AM -0600, Rob Herring wrote:
> >>>> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
> >>>> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
> >>>> so other arches can't be enabled.
> >>>>
> >>>> Signed-off-by: Rob Herring <robh@kernel.org>
> >>>> ---
> >>>> Tested on allmodconfig build. Not sure if there's other MIPS configs
> >>>> where this doesn't work. We'll see what 0-day says.
> >>>
> >>> Odd, in next-20230621 I get:
> >>>
> >>> Building mips:allmodconfig ... failed
> >>
> >> Indeed odd. Given that this is an allmodconfig, I would assume that
> >> CONFIG_CAVIUM_OCTEON_SOC is set ?
> >>
> >
> > No, it is not. CONFIG_CAVIUM_OCTEON_SOC is a choice option,
> > meaning only one of the choices can be set, and mips:allmodconfig
> > selects a different choice.
>
> OK. Then I think I need to drop this patch as I do not see how to allow
> COMPILE_TEST without CONFIG_CAVIUM_OCTEON_SOC being set.
>
> Rob ?

These could be fixed, but not sure it's worth the effort.

> >
> > Guenter
> >
> >>> --------------
> >>> Error log:
> >>> ERROR: modpost: "__udivdi3" [drivers/ata/pata_octeon_cf.ko] undefined!

This is due to 64-bit divides on 32-bit build, so do_div() needs to be used.

> >>> ERROR: modpost: "octeon_get_io_clock_rate" [drivers/ata/pata_octeon_cf.ko] undefined!

We'd need a static inline in the header for octeon_get_io_clock_rate().

Of course the real fix is Octeon needs to move to use the clock framework.

> >>> ERROR: modpost: "__tracepoint_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!
> >>> ERROR: modpost: "__traceiter_ata_bmdma_stop" [drivers/ata/pata_octeon_cf.ko] undefined!

Probably can just drop the trace_ata_bmdma_stop() call. It was added
to replace a printk.

Rob
  
Damien Le Moal June 22, 2023, 9:52 p.m. UTC | #9
On 6/22/23 22:41, Rob Herring wrote:
> On Wed, Jun 21, 2023 at 10:26 PM Damien Le Moal <dlemoal@kernel.org> wrote:
>>
>> On 6/22/23 12:01, Guenter Roeck wrote:
>>> On 6/21/23 17:57, Damien Le Moal wrote:
>>>> On 6/22/23 01:51, Guenter Roeck wrote:
>>>>> On Wed, Jun 14, 2023 at 11:36:33AM -0600, Rob Herring wrote:
>>>>>> Add COMPILE_TEST to enable building Cavium Octeon drivers in MIPS
>>>>>> allyesconfig/allmodconfig builds. There's a dependency on MIPS headers,
>>>>>> so other arches can't be enabled.
>>>>>>
>>>>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>>>>> ---
>>>>>> Tested on allmodconfig build. Not sure if there's other MIPS configs
>>>>>> where this doesn't work. We'll see what 0-day says.
>>>>>
>>>>> Odd, in next-20230621 I get:
>>>>>
>>>>> Building mips:allmodconfig ... failed
>>>>
>>>> Indeed odd. Given that this is an allmodconfig, I would assume that
>>>> CONFIG_CAVIUM_OCTEON_SOC is set ?
>>>>
>>>
>>> No, it is not. CONFIG_CAVIUM_OCTEON_SOC is a choice option,
>>> meaning only one of the choices can be set, and mips:allmodconfig
>>> selects a different choice.
>>
>> OK. Then I think I need to drop this patch as I do not see how to allow
>> COMPILE_TEST without CONFIG_CAVIUM_OCTEON_SOC being set.
>>
>> Rob ?
> 
> These could be fixed, but not sure it's worth the effort.

Agreed. And given that we are at rc7 already, this effort should not be now
anyway. I will drop this patch.
  

Patch

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 42b51c9812a0..4572f837e504 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -239,7 +239,7 @@  config AHCI_MVEBU
 
 config AHCI_OCTEON
 	tristate "Cavium Octeon Soc Serial ATA"
-	depends on SATA_AHCI_PLATFORM && CAVIUM_OCTEON_SOC
+	depends on SATA_AHCI_PLATFORM && MIPS && (CAVIUM_OCTEON_SOC || COMPILE_TEST)
 	default y
 	help
 	  This option enables support for Cavium Octeon SoC Serial ATA.
@@ -373,7 +373,7 @@  config PDC_ADMA
 
 config PATA_OCTEON_CF
 	tristate "OCTEON Boot Bus Compact Flash support"
-	depends on CAVIUM_OCTEON_SOC
+	depends on MIPS && (CAVIUM_OCTEON_SOC || COMPILE_TEST)
 	select PATA_TIMINGS
 	help
 	  This option enables a polled compact flash driver for use with
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 57b2166a6d5d..cc9e4b63ded9 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -853,8 +853,8 @@  static int octeon_cf_probe(struct platform_device *pdev)
 					of_node_put(dma_node);
 					return -EINVAL;
 				}
-				cf_port->dma_base = (u64)devm_ioremap(&pdev->dev, res_dma->start,
-									 resource_size(res_dma));
+				cf_port->dma_base = (uintptr_t)devm_ioremap(&pdev->dev, res_dma->start,
+									    resource_size(res_dma));
 				if (!cf_port->dma_base) {
 					put_device(&dma_dev->dev);
 					of_node_put(dma_node);