Re: [PATCH v4 0/3] Use dma_default_coherent for devicetree default coherency

2023-04-06 Thread Jiaxun Yang
> 2023年4月1日 10:15,Jiaxun Yang 写道: > > Hi all, > > This series split out second half of my previous series > "[PATCH 0/4] MIPS DMA coherence fixes". > > It intends to use dma_default_coherent to determine the default coherency of > devicetree

[PATCH v4 3/3] of: address: Always use dma_default_coherent for default coherency

2023-04-01 Thread Jiaxun Yang
As for now all arches have dma_default_coherent reflecting default DMA coherency for of devices, so there is no need to have a standalone config option. Signed-off-by: Jiaxun Yang Reviewed-by: Rob Herring Acked-by: Michael Ellerman (powerpc) --- v3: Squash setting ARCH_DMA_DEFAULT_COHERENT

[PATCH v4 2/3] dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT

2023-04-01 Thread Jiaxun Yang
Provide a kconfig option to allow arches to manipulate default value of dma_default_coherent in Kconfig. Signed-off-by: Jiaxun Yang --- v3: Add comments --- kernel/dma/Kconfig | 7 +++ kernel/dma/mapping.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/dma

[PATCH v4 1/3] dma-mapping: Provide a fallback dma_default_coherent

2023-04-01 Thread Jiaxun Yang
dma_default_coherent was decleared unconditionally at kernel/dma/mapping.c but only decleared when any of non-coherent options is enabled in dma-map-ops.h. Guard the declaration in mapping.c with non-coherent options and provide a fallback definition. Signed-off-by: Jiaxun Yang --- v3: Style

[PATCH v4 0/3] Use dma_default_coherent for devicetree default coherency

2023-04-01 Thread Jiaxun Yang
sh setting ARCH_DMA_DEFAULT_COHERENT into PATCH 4 - Setting ARCH_DMA_DEFAULT_COHERENT for PowerPC v4: - Drop first patch Jiaxun Yang (3): dma-mapping: Provide a fallback dma_default_coherent dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT of: address: Always use dma_default_coherent f

Re: [PATCH v3 0/4] Use dma_default_coherent for devicetree default coherency

2023-03-28 Thread Jiaxun Yang
> 2023年3月28日 08:45,Thomas Bogendoerfer 写道: > > On Tue, Mar 28, 2023 at 03:18:12AM +0200, Christoph Hellwig wrote: >> On Fri, Mar 24, 2023 at 09:17:38AM +0000, Jiaxun Yang wrote: >>>> >>>> Is patch a 6.3 candidate or should all of it go int

Re: [PATCH v3 0/4] Use dma_default_coherent for devicetree default coherency

2023-03-24 Thread Jiaxun Yang
> 2023年3月23日 21:39,Christoph Hellwig 写道: > > On Thu, Mar 23, 2023 at 09:07:31PM +0000, Jiaxun Yang wrote: >> >> >>> 2023年3月23日 07:29,Christoph Hellwig 写道: >>> >>> The series looks fine to me. How should we merge it? >> >&

Re: [PATCH v3 0/4] Use dma_default_coherent for devicetree default coherency

2023-03-23 Thread Jiaxun Yang
> 2023年3月23日 07:29,Christoph Hellwig 写道: > > The series looks fine to me. How should we merge it? Perhaps go through dma-mapping tree? Thanks - Jiaxun

[PATCH v3 4/4] of: address: Always use dma_default_coherent for default coherency

2023-03-21 Thread Jiaxun Yang
As for now all arches have dma_default_coherent reflecting default DMA coherency for of devices, so there is no need to have a standalone config option. Signed-off-by: Jiaxun Yang --- v3: Squash setting ARCH_DMA_DEFAULT_COHERENT into this patch. --- arch/powerpc/Kconfig | 2 +- arch/riscv

[PATCH v3 3/4] dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT

2023-03-21 Thread Jiaxun Yang
Provide a kconfig option to allow arches to manipulate default value of dma_default_coherent in Kconfig. Signed-off-by: Jiaxun Yang --- v3: Add comments --- kernel/dma/Kconfig | 7 +++ kernel/dma/mapping.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/dma

[PATCH v3 2/4] dma-mapping: Provide a fallback dma_default_coherent

2023-03-21 Thread Jiaxun Yang
dma_default_coherent was decleared unconditionally at kernel/dma/mapping.c but only decleared when any of non-coherent options is enabled in dma-map-ops.h. Guard the declaration in mapping.c with non-coherent options and provide a fallback definition. Signed-off-by: Jiaxun Yang --- v3: Style

[PATCH v3 0/4] Use dma_default_coherent for devicetree default coherency

2023-03-21 Thread Jiaxun Yang
T_COHERENT into PATCH 4 - Setting ARCH_DMA_DEFAULT_COHERENT for PowerPC Jiaxun Yang (4): of: address: Fix default coherency for MIPS dma-mapping: Provide a fallback dma_default_coherent dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT of: address: Always use dma_default_coherent for default

[PATCH v3 1/4] of: address: Fix default coherency for MIPS

2023-03-21 Thread Jiaxun Yang
DT-based MIPS doesn't use OF_DMA_DEFAULT_COHERENT, but might override the system-wide default at runtime. Use dma_default_coherent to override default coherence for MIPS. Signed-off-by: Jiaxun Yang --- drivers/of/address.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers

Re: [PATCH v2 5/5] of: address: Always use dma_default_coherent for default coherency

2023-03-01 Thread Jiaxun Yang
> 2023年3月1日 13:06,Christoph Hellwig 写道: > >> - select OF_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE > > Doesn't powerpc need to select CONFIG_ARCH_DMA_DEFAULT_COHERENT now, > or even better should be doing that in the patch adding that > symbol? If I read the code correctly for powerpc

[PATCH v2 5/5] of: address: Always use dma_default_coherent for default coherency

2023-02-23 Thread Jiaxun Yang
will be true, so it still matches present behavior. Note for RISCV: dma_default_coherent is set to true in this series. Signed-off-by: Jiaxun Yang --- arch/powerpc/Kconfig | 1 - arch/riscv/Kconfig | 1 - drivers/of/Kconfig | 4 drivers/of/address.c | 10 +- 4 files changed

[PATCH v2 4/5] riscv: Select ARCH_DMA_DEFAULT_COHERENT

2023-02-23 Thread Jiaxun Yang
For riscv our assumption is unless a device states it is non-coherent, we take it to be DMA coherent. Select ARCH_DMA_DEFAULT_COHERENT to ensure dma_default_coherent is always initialized to true. Signed-off-by: Jiaxun Yang --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff

[PATCH v2 3/5] dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT

2023-02-23 Thread Jiaxun Yang
Provide a kconfig option to allow arches to manipulate default value of dma_default_coherent in Kconfig. Signed-off-by: Jiaxun Yang --- kernel/dma/Kconfig | 3 +++ kernel/dma/mapping.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/dma/Kconfig b/kernel/dma

[PATCH v2 2/5] dma-mapping: Provide a fallback dma_default_coherent

2023-02-23 Thread Jiaxun Yang
dma_default_coherent was decleared unconditionally at kernel/dma/mapping.c but only decleared when any of non-coherent options is enabled in dma-map-ops.h. Guard the declaration in mapping.c with non-coherent options and provide a fallback definition. Signed-off-by: Jiaxun Yang --- include

[PATCH v2 1/5] of: address: Fix default coherency for MIPS

2023-02-23 Thread Jiaxun Yang
DT-based MIPS doesn't use OF_DMA_DEFAULT_COHERENT, but might override the system-wide default at runtime. Use dma_default_coherent to override default coherence for MIPS. Signed-off-by: Jiaxun Yang --- drivers/of/address.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers

[PATCH v2 0/5] Use dma_default_coherent for devicetree default coherency

2023-02-23 Thread Jiaxun Yang
oncoherent, dma_default_coherent is a fixed value set by arch code. It's defaulted to false for most archs except RISC-V. Thanks - Jiaxun --- v2: - Add PATCH 1 to help with backporting - Use Kconfig option to set dma_default_coherent Jiaxun Yang (5): of: address: Fix default coherency for

Re: [PATCH 3/3] of: address: Use dma_default_coherent to determine default coherency

2023-02-22 Thread Jiaxun Yang
> 2023年2月22日 17:24,Robin Murphy 写道: [...] > > AFAICS, all you should actually need is a single self-contained addition > here, something like: > > + /* > + * DT-based MIPS doesn't use OF_DMA_DEFAULT_COHERENT, but > + * might override the system-wide default at runtime. > + */ > +#if

Re: [PATCH 2/3] riscv: Set dma_default_coherent to true

2023-02-22 Thread Jiaxun Yang
> 2023年2月22日 16:02,Conor Dooley 写道: > > On Wed, Feb 22, 2023 at 03:55:19PM +0000, Jiaxun Yang wrote: >> >> >>> 2023年2月22日 14:50,Conor Dooley 写道: >>> >>> On Wed, Feb 22, 2023 at 01:37:11PM +, Jiaxun Yang wrote: >>>> For riscv

Re: [PATCH 2/3] riscv: Set dma_default_coherent to true

2023-02-22 Thread Jiaxun Yang
> 2023年2月22日 14:50,Conor Dooley 写道: > > On Wed, Feb 22, 2023 at 01:37:11PM +0000, Jiaxun Yang wrote: >> For riscv our assumption is unless a device states it is non-coherent, >> we take it to be DMA coherent. >> >> For devicetree probed devices that h

[PATCH 3/3] of: address: Use dma_default_coherent to determine default coherency

2023-02-22 Thread Jiaxun Yang
. Signed-off-by: Jiaxun Yang --- arch/powerpc/Kconfig | 1 - arch/riscv/Kconfig | 1 - drivers/of/Kconfig | 4 drivers/of/address.c | 2 +- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 2c9cdf1d8761..c67e5da714f7 100644

[PATCH 2/3] riscv: Set dma_default_coherent to true

2023-02-22 Thread Jiaxun Yang
For riscv our assumption is unless a device states it is non-coherent, we take it to be DMA coherent. For devicetree probed devices that have been true since very begining with OF_DMA_DEFAULT_COHERENT selected. Signed-off-by: Jiaxun Yang --- arch/riscv/kernel/setup.c | 3 +++ 1 file changed, 3

[PATCH 1/3] dma-mapping: Provide a fallback dma_default_coherent

2023-02-22 Thread Jiaxun Yang
dma_default_coherent was decleared unconditionally at kernel/dma/mapping.c but only decleared when any of non-coherent options is enabled in dma-map-ops.h. Guard the declaration in mapping.c with non-coherent options and provide a fallback definition. Signed-off-by: Jiaxun Yang --- include

[PATCH 0/3] Use dma_default_coherent for devicetree default coherency

2023-02-22 Thread Jiaxun Yang
oncoherent, dma_default_coherent is a fixed value set by arch code. It's defaulted to false for most archs except RISC-V. Thanks - Jiaxun Jiaxun Yang (3): dma-mapping: Provide a fallback dma_default_coherent riscv: Set dma_default_coherent to true of: address: Use dma_default_coherent to

Re: [PATCH 0/7] MIPS DMA coherence fixes

2023-02-22 Thread Jiaxun Yang
> 2023年2月22日 12:55,Robin Murphy 写道: > > On 2023-02-21 19:55, Jiaxun Yang wrote: >>> 2023年2月21日 19:46,Robin Murphy 写道: >>> >>> On 2023-02-21 18:15, Jiaxun Yang wrote: >>>>> 2023年2月21日 17:54,Christoph Hellwig 写道: >>>>>

Re: [PATCH 4/7] dma-mapping: Always provide dma_default_coherent

2023-02-21 Thread Jiaxun Yang
> 2023年2月21日 17:58,Christoph Hellwig 写道: > > On Tue, Feb 21, 2023 at 12:46:10PM +0000, Jiaxun Yang wrote: >> dma_default_coherent can be useful for determine default coherency >> even on arches without noncoherent support. > > How? I just want to make this symbol

Re: [PATCH 0/7] MIPS DMA coherence fixes

2023-02-21 Thread Jiaxun Yang
> 2023年2月21日 19:46,Robin Murphy 写道: > > On 2023-02-21 18:15, Jiaxun Yang wrote: >>> 2023年2月21日 17:54,Christoph Hellwig 写道: >>> >>> Can you explain the motivation here? Also why riscv patches are at >>> the end of a mips fіxes series? >>

Re: [PATCH 6/7] riscv: Select ARCH_DMA_DEFAULT_COHERENT

2023-02-21 Thread Jiaxun Yang
> 2023年2月21日 18:14,Conor Dooley 写道: > > On Tue, Feb 21, 2023 at 12:46:12PM +0000, Jiaxun Yang wrote: >> For RISCV we always assume devices are DMA coherent. > > "Always assume", I'm not keen on that wording as it is unclear as to > whether you are suggest

Re: [PATCH 5/7] dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT

2023-02-21 Thread Jiaxun Yang
> 2023年2月21日 17:58,Christoph Hellwig 写道: > > On Tue, Feb 21, 2023 at 12:46:11PM +0000, Jiaxun Yang wrote: >> Provide a kconfig option to allow arches to manipulate default >> value of dma_default_coherent in Kconfig. > > I don't see the win over

Re: [PATCH 0/7] MIPS DMA coherence fixes

2023-02-21 Thread Jiaxun Yang
> 2023年2月21日 17:54,Christoph Hellwig 写道: > > Can you explain the motivation here? Also why riscv patches are at > the end of a mips fіxes series? Ah sorry for any confusion. So the main purpose of this patch is to fix MIPS’s broken per-device coherency. To be more precise, we want to be

[PATCH 0/7] MIPS DMA coherence fixes

2023-02-21 Thread Jiaxun Yang
Jiaxun Yang (7): MIPS: Remove DMA_PERDEV_COHERENT MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms MIPS: c-r4k: Always install dma flush functions dma-mapping: Always provide dma_default_coherent dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT riscv

[PATCH 4/7] dma-mapping: Always provide dma_default_coherent

2023-02-21 Thread Jiaxun Yang
dma_default_coherent can be useful for determine default coherency even on arches without noncoherent support. Signed-off-by: Jiaxun Yang --- include/linux/dma-map-ops.h | 1 + kernel/dma/mapping.c| 4 2 files changed, 5 insertions(+) diff --git a/include/linux/dma-map-ops.h b

[PATCH 5/7] dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT

2023-02-21 Thread Jiaxun Yang
Provide a kconfig option to allow arches to manipulate default value of dma_default_coherent in Kconfig. Signed-off-by: Jiaxun Yang --- kernel/dma/Kconfig | 3 +++ kernel/dma/mapping.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/dma/Kconfig b/kernel/dma

[PATCH 7/7] of: address: Use dma_default_coherent to determine default coherency

2023-02-21 Thread Jiaxun Yang
dma_default_coherent at early boot. Note for PowerPC: CONFIG_OF_DMA_DEFUALT_COHERENT was only selected when CONFIG_NOT_COHERENT_CACHE is false, in this case dma_default_coherent will be ture, so we don't need to select CONFIG_ARCH_DMA_DEFAULT_COHERENT for PowerPC. Signed-off-by: Jiaxun Yang --- arch/powerpc

[PATCH 3/7] MIPS: c-r4k: Always install dma flush functions

2023-02-21 Thread 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 --- arch/mips/mm/c-r4k.c | 12

[PATCH 6/7] riscv: Select ARCH_DMA_DEFAULT_COHERENT

2023-02-21 Thread Jiaxun Yang
For RISCV we always assume devices are DMA coherent. Select ARCH_DMA_DEFAULT_COHERENT to ensure dev->dma_conherent is always initialized to true. Signed-off-by: Jiaxun Yang --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig in

[PATCH 2/7] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms

2023-02-21 Thread 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 --- arch/mips/Kconfig | 9 + 1 file changed, 1

[PATCH 1/7] MIPS: Remove DMA_PERDEV_COHERENT

2023-02-21 Thread 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 --- arch/mips/Kconfig | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips