Skip to contentSkip to conversation

fix a few RISC-V / renesas Kconfig dependencies

PATCH In review Christoph Hellwig 2 participants 5 messages Oct 17, 2023 – Oct 18, 2023

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

Hi all,

this small series sorts out a few Kconfig dependency issue for the rich set of RISC-V non-coherent DMA support.

Geert suggested for it to go into the soc tree, which is fine with me if I get a stable branch for it as it is required for further dma-mapping work.

#1 lore raw

PATCH 1/3 riscv: RISCV_NONSTANDARD_CACHE_OPS shouldn't depend on RISCV_DMA_NONCOHERENT

RISCV_NONSTANDARD_CACHE_OPS is also used for the pmem cache maintenance helpers, which are built into the kernel unconditionally.

---
 arch/riscv/Kconfig    | 1 -
 drivers/cache/Kconfig | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/riscv/Kconfig +0 -1
index d607ab0f7c6daf..0ac0b538379718 100644
@@ -277,7 +277,6 @@ config RISCV_DMA_NONCOHERENT
 
 config RISCV_NONSTANDARD_CACHE_OPS
 	bool
-	depends on RISCV_DMA_NONCOHERENT
 	help
 	  This enables function pointer support for non-standard noncoherent
 	  systems to handle cache management.
drivers/cache/Kconfig +1 -1
index a57677f908f3ba..d6e5e3abaad8af 100644
@@ -3,7 +3,7 @@ menu "Cache Drivers"
 
 config AX45MP_L2_CACHE
 	bool "Andes Technology AX45MP L2 Cache controller"
-	depends on RISCV_DMA_NONCOHERENT
+	depends on RISCV
 	select RISCV_NONSTANDARD_CACHE_OPS
 	help
 	  Support for the L2 cache controller on Andes Technology AX45MP platforms.
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/3 riscv: only select DMA_DIRECT_REMAP from RISCV_ISA_ZICBOM

In reply to Christoph Hellwig

RISCV_DMA_NONCOHERENT is also used for whacky non-standard non-coherent ops that use different hooks in dma-direct.

---
 arch/riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +1 -1
index 0ac0b538379718..9c48fecc671918 100644
@@ -273,7 +273,6 @@ config RISCV_DMA_NONCOHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
-	select DMA_DIRECT_REMAP if MMU
 
 config RISCV_NONSTANDARD_CACHE_OPS
 	bool
@@ -549,6 +548,7 @@ config RISCV_ISA_ZICBOM
 	depends on RISCV_ALTERNATIVE
 	default y
 	select RISCV_DMA_NONCOHERENT
+	select DMA_DIRECT_REMAP
 	help
 	   Adds support to dynamically detect the presence of the ZICBOM
 	   extension (Cache Block Management Operations) and enable its
Signature · 1 line
2.39.2
#3 lore raw

Re: [PATCH 2/3] riscv: only select DMA_DIRECT_REMAP from RISCV_ISA_ZICBOM

Quoted 16 lines · Christoph Hellwig

RISCV_DMA_NONCOHERENT is also used for whacky non-standard non-coherent ops that use different hooks in dma-direct.

---
 arch/riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +0 -0
index 0ac0b538379718..9c48fecc671918 100644

arch/riscv/Kconfig config RISCV_DMA_NONCOHERENT · line 276

Quoted 4 lines
arch/riscv/Kconfig +0 -1
@@ -273,7 +273,6 @@ config RISCV_DMA_NONCOHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB
-	select DMA_DIRECT_REMAP if MMU

This breaks ERRATA_THEAD_CMO, which also needs a select DMA_DIRECT_REMAP:

riscv64-unknown-linux-gnu-ld: kernel/dma/direct.o: in function `.L131':
direct.c:(.text+0x42a): undefined reference to arch_dma_alloc' riscv64-unknown-linux-gnu-ld: kernel/dma/direct.o: in function .L192':
direct.c:(.text+0x592): undefined reference to `arch_dma_free'

Quoted 10 lines
arch/riscv/Kconfig +1 -0
 config RISCV_NONSTANDARD_CACHE_OPS
 	bool
@@ -549,6 +548,7 @@ config RISCV_ISA_ZICBOM
 	depends on RISCV_ALTERNATIVE
 	default y
 	select RISCV_DMA_NONCOHERENT
+	select DMA_DIRECT_REMAP
 	help
 	   Adds support to dynamically detect the presence of the ZICBOM
 	   extension (Cache Block Management Operations) and enable its
#4 lore raw

PATCH 3/3 soc: renesas: ARCH_R9A07G043 depends on !RISCV_ISA_ZICBOM

In reply to Christoph Hellwig

ARCH_R9A07G043 has its own non-standard global pool based DMA coherent allocator, which conflicts with the remap based RISCV_ISA_ZICBOM version. Add a proper dependency.

---
 drivers/soc/renesas/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/soc/renesas/Kconfig +1 -0
index 335251ff6e8214..624185e09c967b 100644
@@ -341,6 +341,7 @@ config ARCH_R9A07G043
 	bool "RISC-V Platform support for RZ/Five"
 	depends on NONPORTABLE
 	depends on RISCV_ALTERNATIVE
+	depends on !RISCV_ISA_ZICBOM
 	depends on RISCV_SBI
 	select ARCH_RZG2L
 	select AX45MP_L2_CACHE
Signature · 1 line
2.39.2