generic noncoherent dma ops for sparc32, 2nd resend
Dave, can you take a review this and apply if ok? I've been sending this twice already but never got an answer. Out of my batch of conversion sparc is one of only two that haven't been merged yet.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 sparc: use generic dma_noncoherent_ops
Switch to the generic noncoherent direct mapping implementation.
This removes the previous sync_single_for_device implementation, which looks bogus given that no syncing is happening in the similar but more important map_single case.
--- arch/sparc/Kconfig | 2 + arch/sparc/include/asm/dma-mapping.h | 5 +- arch/sparc/kernel/ioport.c | 151 ++------------------------- 3 files changed, 14 insertions(+), 144 deletions(-)
arch/sparc/Kconfig +2 -0
@@ -48,6 +48,8 @@ config SPARC config SPARC32 def_bool !64BIT + select ARCH_HAS_SYNC_DMA_FOR_CPU + select DMA_NONCOHERENT_OPS select GENERIC_ATOMIC64 select CLZ_TAB select HAVE_UID16
arch/sparc/include/asm/dma-mapping.h +2 -3
@@ -7,7 +7,6 @@#include <linux/dma-debug.h> extern const struct dma_map_ops *dma_ops; -extern const struct dma_map_ops pci32_dma_ops;extern struct bus_type pci_bus_type;
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) {#ifdef CONFIG_SPARC_LEON if (sparc_cpu_model == sparc_leon) -return &pci32_dma_ops; +return &dma_noncoherent_ops;#endif #if defined(CONFIG_SPARC32 ) && defined(CONFIG_PCI )if (bus == &pci_bus_type) -return &pci32_dma_ops; +return &dma_noncoherent_ops;#endif return dma_ops; }
arch/sparc/kernel/ioport.c +10 -141
179 lines not on this page · raw message
Signature · 1 line
2.18.0
A message that is not in the archive (sent off-list or not yet received): [email protected]
Sam Ravnborg
Acked-byRe: [PATCH] sparc: use generic dma_noncoherent_ops
Hi Christoph.
Some observations below - nitpick and bikeshedding only.
The parameter of phys_addr_t is sometimes renamed to use the same name as in the original prototype (good), and sometimes uses the old name (bad).
This makes it inconsistent as the local name changes in the different functions, but they represents the same.
I really like how you managed to kill a lot of code with this patch.
You can add my:
But that does imply that this is OK, you
must wait for davem.
Sam
Quoted 18 lines · Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation.
This removes the previous
sync_single_for_deviceimplementation, which looks bogus given that no syncing is happening in the similar but more importantmap_singlecase.Signed-off-by Christoph Hellwig <[email protected]>--- arch/sparc/Kconfig | 2 + arch/sparc/include/asm/dma-mapping.h | 5 +- arch/sparc/kernel/ioport.c | 151 ++------------------------- 3 files changed, 14 insertions(+), 144 deletions(-)arch/sparc/Kconfig +0
-0
arch/sparc/Kconfig config SPARC · line 52
Quoted 5 lines
arch/sparc/Kconfig +2
-0@@ -48,6 +48,8 @@ config SPARC config SPARC32 def_bool !64BIT + select ARCH_HAS_SYNC_DMA_FOR_CPU + select DMA_NONCOHERENT_OPS
The current implementation has both:pci32_sync_single_for_cpu() ANDpci32_sync_single_for_device
Yet, the new implementation only include arch_sync_dma_for_cpu() You addressed this in the changelog - so I guess it is OK.
Quoted 37 lines
arch/sparc/include/asm/dma-mapping.h +2
-3@@ -7,7 +7,6 @@#include <linux/dma-debug.h> extern const struct dma_map_ops *dma_ops; -extern const struct dma_map_ops pci32_dma_ops;extern struct bus_type pci_bus_type;@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) {#ifdef CONFIG_SPARC_LEON if (sparc_cpu_model == sparc_leon) -return &pci32_dma_ops; +return &dma_noncoherent_ops;#endif #if defined(CONFIG_SPARC32 ) && defined(CONFIG_PCI )if (bus == &pci_bus_type) -return &pci32_dma_ops; +return &dma_noncoherent_ops;#endif return dma_ops; }arch/sparc/kernel/ioport.c +1
-0@@ -38,6 +38,7 @@#include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/scatterlist.h> +#include <linux/dma-noncoherent.h> #include <linux/of_device.h> #include <asm/io.h>
arch/sparc/kernel/ioport.c arch_initcall(sparc_register_ioport); · line 439
Quoted 8 lines
arch/sparc/kernel/ioport.c +2
-3@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);/* Allocate and map kernel buffer using consistent mode DMA for a device. * hwdev should be valid struct pci_dev pointer for PCI devices. */ -static void *pci32_alloc_coherent (struct device *dev,size_t len, -dma_addr_t *pba,gfp_t gfp, -unsigned long attrs) +void *arch_dma_alloc (struct device *dev,size_t len,dma_addr_t *pba,gfp_t gfp, +unsigned long attrs)
This function was renamed in ee664a9252d24 and is now renamed again. The printk statements should be updated to use arch_dma_alloc.
arch/sparc/kernel/ioport.c static void *pci32_alloc_coherent(struct device *dev, size_t len, · line 492
Quoted 11 lines
arch/sparc/kernel/ioport.c +2
-2{unsigned long len_total =PAGE_ALIGN (len);void *va;@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,* References to the memory and mappings associated with cpu_addr/dma_addr * past this call are illegal. */ -static void pci32_free_coherent (struct device *dev,size_t n,void *p, -dma_addr_t ba,unsigned long attrs) +void arch_dma_free (struct device *dev,size_t n,void *p,dma_addr_t ba, +unsigned long attrs)
Likewise, use arch_dma_free in printk statements
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH] sparc: use generic dma_noncoherent_ops
Quoted 9 lines · Sam Ravnborg
Hi Christoph.
Some observations below - nitpick and bikeshedding only.
The parameter of
phys_addr_tis sometimes renamed to use the same name as in the original prototype (good), and sometimes uses the old name (bad).
This makes it inconsistent as the local name changes in the different functions, but they represents the same.
I'll change it.
Quoted 2 lines
You can add my:
Acked-by Sam Ravnborg <[email protected]>
I will resend it with your nitpicks addressed and your ack added.
Quoted 5 lines
arch/sparc/kernel/ioport.c arch_initcall(sparc_register_ioport); · line 439
Quoted 2 lines
arch/sparc/kernel/ioport.c +2
-0+void *arch_dma_alloc (struct device *dev,size_t len,dma_addr_t *pba,gfp_t gfp, +unsigned long attrs)This function was renamed in
ee664a9252d24and is now renamed again. The printk statements should be updated to usearch_dma_alloc.
I've switched the printk statements to use __func__ instead, not that I plan for another rename any time soon.
I've also update the comments referring to this function to use the right name.