* [PATCH v2 0/4] MIPS DMA coherence fixes
@ 2023-02-22 13:24 Jiaxun Yang
2023-02-22 13:24 ` [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT Jiaxun Yang
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Jiaxun Yang @ 2023-02-22 13:24 UTC (permalink / raw)
To: linux-mips; +Cc: linux-kernel, tsbogend, hch, Jiaxun Yang
Hi all,
This series fixes MIPS per-device DMA coherence support. It's mostly adjusting
Kconfig options.
The v1 series had some extra patches that fixing default coherency settings
for OF probing but I decided to send them as a dedicated series.
Thanks.
- Jiaxun
Jiaxun Yang (4):
MIPS: Remove DMA_PERDEV_COHERENT
MIPS: Always select ARCH_HAS_SETUP_DMA_OPS
MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent
platforms
MIPS: c-r4k: Always install dma flush functions
arch/mips/Kconfig | 16 ++--------------
arch/mips/mm/c-r4k.c | 12 +++---------
2 files changed, 5 insertions(+), 23 deletions(-)
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT
2023-02-22 13:24 [PATCH v2 0/4] MIPS DMA coherence fixes Jiaxun Yang
@ 2023-02-22 13:24 ` Jiaxun Yang
2023-02-26 22:18 ` Philippe Mathieu-Daudé
2023-02-27 22:55 ` Thomas Bogendoerfer
2023-02-22 13:24 ` [PATCH v2 2/4] MIPS: Always select ARCH_HAS_SETUP_DMA_OPS Jiaxun Yang
` (2 subsequent siblings)
3 siblings, 2 replies; 10+ messages in thread
From: Jiaxun Yang @ 2023-02-22 13:24 UTC (permalink / raw)
To: linux-mips; +Cc: linux-kernel, tsbogend, hch, Jiaxun Yang
As now we are always managing DMA coherence on per dev bias,
there is no need to have such option. And it's not selected
by any platform.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
v2: Remove unrelated change.
---
arch/mips/Kconfig | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 37072e15b263..a1170f0a0c04 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1080,11 +1080,6 @@ config FW_CFE
config ARCH_SUPPORTS_UPROBES
bool
-config DMA_PERDEV_COHERENT
- bool
- select ARCH_HAS_SETUP_DMA_OPS
- select DMA_NONCOHERENT
-
config DMA_NONCOHERENT
bool
#
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/4] MIPS: Always select ARCH_HAS_SETUP_DMA_OPS
2023-02-22 13:24 [PATCH v2 0/4] MIPS DMA coherence fixes Jiaxun Yang
2023-02-22 13:24 ` [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT Jiaxun Yang
@ 2023-02-22 13:24 ` Jiaxun Yang
2023-03-24 13:12 ` Thomas Bogendoerfer
2023-02-22 13:24 ` [PATCH v2 3/4] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms Jiaxun Yang
2023-02-22 13:24 ` [PATCH v2 4/4] MIPS: c-r4k: Always install dma flush functions Jiaxun Yang
3 siblings, 1 reply; 10+ messages in thread
From: Jiaxun Yang @ 2023-02-22 13:24 UTC (permalink / raw)
To: linux-mips; +Cc: linux-kernel, tsbogend, hch, Jiaxun Yang
arch_setup_dma_ops on MIPS sets coherency information in struct device.
It's essential for per-device coherency to work.
Select it for all non-coherent platforms.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a1170f0a0c04..dae894b7d857 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -134,7 +134,6 @@ choice
config MIPS_GENERIC_KERNEL
bool "Generic board-agnostic MIPS kernel"
- select ARCH_HAS_SETUP_DMA_OPS
select MIPS_GENERIC
select BOOT_RAW
select BUILTIN_DTB
@@ -1089,6 +1088,7 @@ config DMA_NONCOHERENT
# by pgprot_writcombine can be mixed, and the latter sometimes provides
# significant advantages.
#
+ select ARCH_HAS_SETUP_DMA_OPS
select ARCH_HAS_DMA_WRITE_COMBINE
select ARCH_HAS_DMA_PREP_COHERENT
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/4] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms
2023-02-22 13:24 [PATCH v2 0/4] MIPS DMA coherence fixes Jiaxun Yang
2023-02-22 13:24 ` [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT Jiaxun Yang
2023-02-22 13:24 ` [PATCH v2 2/4] MIPS: Always select ARCH_HAS_SETUP_DMA_OPS Jiaxun Yang
@ 2023-02-22 13:24 ` Jiaxun Yang
2023-03-24 13:12 ` Thomas Bogendoerfer
2023-02-22 13:24 ` [PATCH v2 4/4] MIPS: c-r4k: Always install dma flush functions Jiaxun Yang
3 siblings, 1 reply; 10+ messages in thread
From: Jiaxun Yang @ 2023-02-22 13:24 UTC (permalink / raw)
To: linux-mips; +Cc: linux-kernel, tsbogend, hch, Jiaxun Yang
As now we are telling the necessity of post DMA flush per CPU type,
there is no need to select ARCH_HAS_SYNC_DMA_FOR_CPU on per platform
bias, just select it unconditionally and we can sort it at runtime.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
arch/mips/Kconfig | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index dae894b7d857..bcca65b25f62 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -115,7 +115,6 @@ config MACH_INGENIC
select SYS_SUPPORTS_LITTLE_ENDIAN
select SYS_SUPPORTS_ZBOOT
select DMA_NONCOHERENT
- select ARCH_HAS_SYNC_DMA_FOR_CPU
select IRQ_MIPS_CPU
select PINCTRL
select GPIOLIB
@@ -1091,6 +1090,7 @@ config DMA_NONCOHERENT
select ARCH_HAS_SETUP_DMA_OPS
select ARCH_HAS_DMA_WRITE_COMBINE
select ARCH_HAS_DMA_PREP_COHERENT
+ select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
select ARCH_HAS_DMA_SET_UNCACHED
select DMA_NONCOHERENT_MMAP
@@ -1854,11 +1854,9 @@ config SYS_HAS_CPU_MIPS32_R3_5
config SYS_HAS_CPU_MIPS32_R5
bool
- select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_MIPS32_R6
bool
- select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_MIPS64_R1
bool
@@ -1868,15 +1866,12 @@ config SYS_HAS_CPU_MIPS64_R2
config SYS_HAS_CPU_MIPS64_R5
bool
- select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_MIPS64_R6
bool
- select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_P5600
bool
- select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_R3000
bool
@@ -1901,7 +1896,6 @@ config SYS_HAS_CPU_NEVADA
config SYS_HAS_CPU_R10000
bool
- select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
config SYS_HAS_CPU_RM7000
bool
@@ -1930,7 +1924,6 @@ config SYS_HAS_CPU_BMIPS4380
config SYS_HAS_CPU_BMIPS5000
bool
select SYS_HAS_CPU_BMIPS
- select ARCH_HAS_SYNC_DMA_FOR_CPU
#
# CPU may reorder R->R, R->W, W->R, W->W
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/4] MIPS: c-r4k: Always install dma flush functions
2023-02-22 13:24 [PATCH v2 0/4] MIPS DMA coherence fixes Jiaxun Yang
` (2 preceding siblings ...)
2023-02-22 13:24 ` [PATCH v2 3/4] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms Jiaxun Yang
@ 2023-02-22 13:24 ` Jiaxun Yang
2023-03-24 13:13 ` Thomas Bogendoerfer
3 siblings, 1 reply; 10+ messages in thread
From: Jiaxun Yang @ 2023-02-22 13:24 UTC (permalink / raw)
To: linux-mips; +Cc: linux-kernel, tsbogend, hch, Jiaxun Yang
As nowadays DMA coherence is managed per device, it is possible
to have a system that is defaulted to coherent dma but still
have noncoherent device that needs to use those flush functions.
Just install them unconditionally.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
arch/mips/mm/c-r4k.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index a549fa98c2f4..7d447050a20b 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1867,15 +1867,9 @@ void r4k_cache_init(void)
__local_flush_icache_user_range = local_r4k_flush_icache_user_range;
#ifdef CONFIG_DMA_NONCOHERENT
- if (dma_default_coherent) {
- _dma_cache_wback_inv = (void *)cache_noop;
- _dma_cache_wback = (void *)cache_noop;
- _dma_cache_inv = (void *)cache_noop;
- } else {
- _dma_cache_wback_inv = r4k_dma_cache_wback_inv;
- _dma_cache_wback = r4k_dma_cache_wback_inv;
- _dma_cache_inv = r4k_dma_cache_inv;
- }
+ _dma_cache_wback_inv = r4k_dma_cache_wback_inv;
+ _dma_cache_wback = r4k_dma_cache_wback_inv;
+ _dma_cache_inv = r4k_dma_cache_inv;
#endif /* CONFIG_DMA_NONCOHERENT */
build_clear_page();
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT
2023-02-22 13:24 ` [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT Jiaxun Yang
@ 2023-02-26 22:18 ` Philippe Mathieu-Daudé
2023-02-27 22:55 ` Thomas Bogendoerfer
1 sibling, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-26 22:18 UTC (permalink / raw)
To: Jiaxun Yang, linux-mips; +Cc: linux-kernel, tsbogend, Christoph Hellwig
On 22/2/23 14:24, Jiaxun Yang wrote:
> As now we are always managing DMA coherence on per dev bias,
> there is no need to have such option. And it's not selected
> by any platform.
Leftover from 4e0664416c70 ("MIPS: remove CONFIG_DMA_PERDEV_COHERENT").
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> v2: Remove unrelated change.
> ---
> arch/mips/Kconfig | 5 -----
> 1 file changed, 5 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT
2023-02-22 13:24 ` [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT Jiaxun Yang
2023-02-26 22:18 ` Philippe Mathieu-Daudé
@ 2023-02-27 22:55 ` Thomas Bogendoerfer
1 sibling, 0 replies; 10+ messages in thread
From: Thomas Bogendoerfer @ 2023-02-27 22:55 UTC (permalink / raw)
To: Jiaxun Yang; +Cc: linux-mips, linux-kernel, hch
On Wed, Feb 22, 2023 at 01:24:22PM +0000, Jiaxun Yang wrote:
> As now we are always managing DMA coherence on per dev bias,
> there is no need to have such option. And it's not selected
> by any platform.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> v2: Remove unrelated change.
> ---
> arch/mips/Kconfig | 5 -----
> 1 file changed, 5 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/4] MIPS: Always select ARCH_HAS_SETUP_DMA_OPS
2023-02-22 13:24 ` [PATCH v2 2/4] MIPS: Always select ARCH_HAS_SETUP_DMA_OPS Jiaxun Yang
@ 2023-03-24 13:12 ` Thomas Bogendoerfer
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Bogendoerfer @ 2023-03-24 13:12 UTC (permalink / raw)
To: Jiaxun Yang; +Cc: linux-mips, linux-kernel, hch
On Wed, Feb 22, 2023 at 01:24:23PM +0000, Jiaxun Yang wrote:
> arch_setup_dma_ops on MIPS sets coherency information in struct device.
> It's essential for per-device coherency to work.
>
> Select it for all non-coherent platforms.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> arch/mips/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/4] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms
2023-02-22 13:24 ` [PATCH v2 3/4] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms Jiaxun Yang
@ 2023-03-24 13:12 ` Thomas Bogendoerfer
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Bogendoerfer @ 2023-03-24 13:12 UTC (permalink / raw)
To: Jiaxun Yang; +Cc: linux-mips, linux-kernel, hch
On Wed, Feb 22, 2023 at 01:24:24PM +0000, Jiaxun Yang wrote:
> As now we are telling the necessity of post DMA flush per CPU type,
> there is no need to select ARCH_HAS_SYNC_DMA_FOR_CPU on per platform
> bias, just select it unconditionally and we can sort it at runtime.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> arch/mips/Kconfig | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] MIPS: c-r4k: Always install dma flush functions
2023-02-22 13:24 ` [PATCH v2 4/4] MIPS: c-r4k: Always install dma flush functions Jiaxun Yang
@ 2023-03-24 13:13 ` Thomas Bogendoerfer
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Bogendoerfer @ 2023-03-24 13:13 UTC (permalink / raw)
To: Jiaxun Yang; +Cc: linux-mips, linux-kernel, hch
On Wed, Feb 22, 2023 at 01:24:25PM +0000, Jiaxun Yang wrote:
> As nowadays DMA coherence is managed per device, it is possible
> to have a system that is defaulted to coherent dma but still
> have noncoherent device that needs to use those flush functions.
>
> Just install them unconditionally.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> arch/mips/mm/c-r4k.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-03-24 13:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 13:24 [PATCH v2 0/4] MIPS DMA coherence fixes Jiaxun Yang
2023-02-22 13:24 ` [PATCH v2 1/4] MIPS: Remove DMA_PERDEV_COHERENT Jiaxun Yang
2023-02-26 22:18 ` Philippe Mathieu-Daudé
2023-02-27 22:55 ` Thomas Bogendoerfer
2023-02-22 13:24 ` [PATCH v2 2/4] MIPS: Always select ARCH_HAS_SETUP_DMA_OPS Jiaxun Yang
2023-03-24 13:12 ` Thomas Bogendoerfer
2023-02-22 13:24 ` [PATCH v2 3/4] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms Jiaxun Yang
2023-03-24 13:12 ` Thomas Bogendoerfer
2023-02-22 13:24 ` [PATCH v2 4/4] MIPS: c-r4k: Always install dma flush functions Jiaxun Yang
2023-03-24 13:13 ` Thomas Bogendoerfer
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).