Skip to contentSkip to conversation

misc: Kconfig: add a new dependency for MARVELL_CN10K_DPI

PATCH In review Vamsi Attunuru 3 participants 6 messages Jul 11, 2024 – Jul 17, 2024 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: Kconfig: add a new dependency for MARVELL_CN10K_DPI

DPI hardware is an on-chip PCIe device on Marvell's arm64 SoC platforms. As Arnd suggested, CN10K belongs to ARCH_THUNDER lineage.

Patch makes mrvl_cn10k_dpi driver dependent on CONFIG_ARCH_THUNDER.

---
 drivers/misc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/Kconfig +1 -0
index 64fcca9e44d7..f3bb75384627 100644
@@ -588,6 +588,7 @@ config NSM
 config MARVELL_CN10K_DPI
 	tristate "Octeon CN10K DPI driver"
 	depends on PCI
+	depends on ARCH_THUNDER || COMPILE_TEST
 	help
 	  Enables Octeon CN10K DMA packet interface (DPI) driver which
 	  intializes DPI hardware's physical function (PF) device's
Signature · 1 line
2.25.1
#1 lore raw

Hi Vamsi,

Quoted 26 lines · Vamsi Attunuru

DPI hardware is an on-chip PCIe device on Marvell's arm64 SoC platforms. As Arnd suggested, CN10K belongs to ARCH_THUNDER lineage.

Patch makes mrvl_cn10k_dpi driver dependent on CONFIG_ARCH_THUNDER.

---
 drivers/misc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/Kconfig +1 -0
index 64fcca9e44d7..f3bb75384627 100644
@@ -588,6 +588,7 @@ config NSM
 config MARVELL_CN10K_DPI
 	tristate "Octeon CN10K DPI driver"
 	depends on PCI
+	depends on ARCH_THUNDER || COMPILE_TEST
 	help
 	  Enables Octeon CN10K DMA packet interface (DPI) driver which
 	  intializes DPI hardware's physical function (PF) device's
Signature · 1 line
2.25.1

After this change, ARCH=arm allmodconfig fails with:

drivers/misc/mrvl_cn10k_dpi.c: In function 'dpi_reg_write':
drivers/misc/mrvl_cn10k_dpi.c:190:9: error: implicit declaration of function 'writeq'; did you mean 'writeb'? [-Wimplicit-function-declaration]

    190 |         writeq(val, dpi->reg_base + offset);
        |         ^~~~~~
        |         writeb
  drivers/misc/mrvl_cn10k_dpi.c: In function 'dpi_reg_read':
  drivers/misc/mrvl_cn10k_dpi.c:195:16: error: implicit declaration of function 'readq'; did you mean 'readb'? [-Wimplicit-function-declaration]
    195 |         return readq(dpi->reg_base + offset);
        |                ^~~~~
        |                readb

Including one of the io-64-nonatomic headers would resolve this but I am not sure which one would be appropriate (or perhaps the dependency should be tightened to requiring 64BIT, as some other drivers have done).

Cheers,
Nathan

maintainer
#2 lore raw
Quoted 16 lines · Nathan Chancellor
Quoted 1 line · Vamsi Attunuru

After this change, ARCH=arm allmodconfig fails with:

drivers/misc/mrvl_cn10k_dpi.c: In function 'dpi_reg_write':
drivers/misc/mrvl_cn10k_dpi.c:190:9: error: implicit declaration of
function 'writeq'; did you mean 'writeb'? [-Wimplicit-function-declaration]

    190 |         writeq(val, dpi->reg_base + offset);
        |         ^~~~~~
        |         writeb

drivers/misc/mrvl_cn10k_dpi.c: In function 'dpi_reg_read':
drivers/misc/mrvl_cn10k_dpi.c:195:16: error: implicit declaration of
function 'readq'; did you mean 'readb'? [-Wimplicit-function-declaration]

Quoted 8 lines
    195 |         return readq(dpi->reg_base + offset);
        |                ^~~~~
        |                readb

Including one of the io-64-nonatomic headers would resolve this but I am not sure which one would be appropriate (or perhaps the dependency should be tightened to requiring 64BIT, as some other drivers have done).

Right, a dependency on 64BIT makes sense here. The alternative is to include linux/io-64-nonatomic-hi-lo.h or linux/io-64-nonatomic-lo-hi.h in order to have a replacement readq/writeq implementation that works on 32-bit architectures. However, doing this requires understanding whether what the side-effects of accessing the 64-bit registers are and whether they require writing the upper or lower half of the register last.

Arnd

#3 lore raw
Quoted 42 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Tuesday, July 16, 2024 7:21 PM
To: Nathan Chancellor <[email protected]>; Vamsi Krishna Attunuru <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>; linux- [email protected]
Subject: [EXTERNAL] Re: [PATCH] misc: Kconfig: add a new dependency for MARVELL_CN10K_DPI

On Tue, Jul 16, 2024, at 15: 26, Nathan Chancellor wrote: > On Thu, Jul 11, 2024 at 05: 01: 15AM -0700, Vamsi Attunuru wrote: >> > > After this change, ARCH=arm allmodconfig fails with: > > drivers/misc/mrvl_cn10k_dpi. c: In

Quoted 16 lines · Nathan Chancellor
Quoted 1 line · Vamsi Attunuru

After this change, ARCH=arm allmodconfig fails with:

drivers/misc/mrvl_cn10k_dpi.c: In function 'dpi_reg_write':
drivers/misc/mrvl_cn10k_dpi.c:190:9: error: implicit declaration of
function 'writeq'; did you mean 'writeb'? [-Wimplicit-function-declaration]

    190 |         writeq(val, dpi->reg_base + offset);
        |         ^~~~~~
        |         writeb

drivers/misc/mrvl_cn10k_dpi.c: In function 'dpi_reg_read':
drivers/misc/mrvl_cn10k_dpi.c:195:16: error: implicit declaration of
function 'readq'; did you mean 'readb'? [-Wimplicit-function-declaration]

Quoted 8 lines
    195 |         return readq(dpi->reg_base + offset);
        |                ^~~~~
        |                readb

Including one of the io-64-nonatomic headers would resolve this but I am not sure which one would be appropriate (or perhaps the dependency should be tightened to requiring 64BIT, as some other drivers have done).

Quoted 7 lines

Right, a dependency on 64BIT makes sense here. The alternative is to include linux/io-64-nonatomic-hi-lo.h or linux/io-64-nonatomic-lo-hi.h in order to have a replacement readq/writeq implementation that works on 32-bit architectures. However, doing this requires understanding whether what the side-effects of accessing the 64-bit registers are and whether they require writing the upper or lower half of the register last.

Yes Arnd, I am checking the functionality using lo-hi calls that you suggested. If it has any implications, I will fix it with the 64BIT dependency.

Thanks, Nathan, for reaching out. Could you please advise on the branch where I should implement the fix.

Quoted 1 line

Arnd

maintainer
#4 lore raw
Quoted 13 lines · Vamsi Krishna Attunuru
Quoted 5 lines
Quoted 4 lines

Including one of the io-64-nonatomic headers would resolve this but I am not sure which one would be appropriate (or perhaps the dependency should be tightened to requiring 64BIT, as some other drivers have done).

Quoted 7 lines

Right, a dependency on 64BIT makes sense here. The alternative is to include linux/io-64-nonatomic-hi-lo.h or linux/io-64-nonatomic-lo-hi.h in order to have a replacement readq/writeq implementation that works on 32-bit architectures. However, doing this requires understanding whether what the side-effects of accessing the 64-bit registers are and whether they require writing the upper or lower half of the register last.

Quoted 3 lines

Yes Arnd, I am checking the functionality using lo-hi calls that you suggested. If it has any implications, I will fix it with the 64BIT dependency.

If the datasheet does not give you any insight about how it works, you can try it out on a 64-bit kernel by changing all the readq/writeq into lo_hi_readq()/lo_hi_writeq() or hi_lo_readq()/hi_lo_writeq() after including the corresponding header.

Usually only one of the two works, or possibly neither if the registers require 64-bit access. If you figure out which one works, you can change the calls back to readq/writeq and leave the correct header included that will provide fallback implementations on 32-bit architectures but use the native 64-bit access on 64-bit architectures.

In practice this is not really important because nobody will ever need to use this driver on a 32-bit kernel, given that this SoC only supports 32-bit usermode but not kernel.

Arnd