* Removal of dma_cache_* functions?
@ 2007-09-04 11:56 Ralf Baechle
2007-09-04 12:42 ` Matthew Wilcox
0 siblings, 1 reply; 14+ messages in thread
From: Ralf Baechle @ 2007-09-04 11:56 UTC (permalink / raw)
To: linux-arch
Most architectures implement the dma_cache_wback, dma_cache_wback_inv
and dma_cache_wback_inv functions even though there is the more modern
and much better designed DMA API and only two MIPS-specific users (one of
which I just fixed) do remain. So should we finally start removing it?
Ralf
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-04 11:56 Removal of dma_cache_* functions? Ralf Baechle
@ 2007-09-04 12:42 ` Matthew Wilcox
2007-09-04 12:57 ` James Bottomley
2007-09-06 11:39 ` [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions Ralf Baechle
0 siblings, 2 replies; 14+ messages in thread
From: Matthew Wilcox @ 2007-09-04 12:42 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-arch
On Tue, Sep 04, 2007 at 12:56:16PM +0100, Ralf Baechle wrote:
> Most architectures implement the dma_cache_wback, dma_cache_wback_inv
> and dma_cache_wback_inv functions even though there is the more modern
> and much better designed DMA API and only two MIPS-specific users (one of
> which I just fixed) do remain. So should we finally start removing it?
There's still some users in arch/, but yes, let's remove it from the
arches that don't use it internally.
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-04 12:42 ` Matthew Wilcox
@ 2007-09-04 12:57 ` James Bottomley
2007-09-04 13:07 ` Ralf Baechle
2007-09-04 13:07 ` Matthew Wilcox
2007-09-06 11:39 ` [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions Ralf Baechle
1 sibling, 2 replies; 14+ messages in thread
From: James Bottomley @ 2007-09-04 12:57 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Ralf Baechle, linux-arch
On Tue, 2007-09-04 at 06:42 -0600, Matthew Wilcox wrote:
> On Tue, Sep 04, 2007 at 12:56:16PM +0100, Ralf Baechle wrote:
> > Most architectures implement the dma_cache_wback, dma_cache_wback_inv
> > and dma_cache_wback_inv functions even though there is the more modern
> > and much better designed DMA API and only two MIPS-specific users (one of
> > which I just fixed) do remain. So should we finally start removing it?
>
> There's still some users in arch/, but yes, let's remove it from the
> arches that don't use it internally.
There's the updated dma_cache_sync() API, which you need to keep because
the parisc lasi scsi and network drivers rely on it for our fully
incoherent boxes.
James
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-04 12:57 ` James Bottomley
@ 2007-09-04 13:07 ` Ralf Baechle
2007-09-04 23:49 ` James Bottomley
2007-09-11 13:44 ` Jes Sorensen
2007-09-04 13:07 ` Matthew Wilcox
1 sibling, 2 replies; 14+ messages in thread
From: Ralf Baechle @ 2007-09-04 13:07 UTC (permalink / raw)
To: James Bottomley; +Cc: Matthew Wilcox, linux-arch
On Tue, Sep 04, 2007 at 01:57:10PM +0100, James Bottomley wrote:
> On Tue, 2007-09-04 at 06:42 -0600, Matthew Wilcox wrote:
> > On Tue, Sep 04, 2007 at 12:56:16PM +0100, Ralf Baechle wrote:
> > > Most architectures implement the dma_cache_wback, dma_cache_wback_inv
> > > and dma_cache_wback_inv functions even though there is the more modern
> > > and much better designed DMA API and only two MIPS-specific users (one of
> > > which I just fixed) do remain. So should we finally start removing it?
> >
> > There's still some users in arch/, but yes, let's remove it from the
> > arches that don't use it internally.
>
> There's the updated dma_cache_sync() API, which you need to keep because
> the parisc lasi scsi and network drivers rely on it for our fully
> incoherent boxes.
I wasn't thinking of touching dma_cache_sync, only the three mentioned
mostly unused ones.
Ralf
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-04 12:57 ` James Bottomley
2007-09-04 13:07 ` Ralf Baechle
@ 2007-09-04 13:07 ` Matthew Wilcox
2007-09-04 13:33 ` Ralf Baechle
1 sibling, 1 reply; 14+ messages in thread
From: Matthew Wilcox @ 2007-09-04 13:07 UTC (permalink / raw)
To: James Bottomley; +Cc: Ralf Baechle, linux-arch
On Tue, Sep 04, 2007 at 01:57:10PM +0100, James Bottomley wrote:
> On Tue, 2007-09-04 at 06:42 -0600, Matthew Wilcox wrote:
> > On Tue, Sep 04, 2007 at 12:56:16PM +0100, Ralf Baechle wrote:
> > > Most architectures implement the dma_cache_wback, dma_cache_wback_inv
> > > and dma_cache_wback_inv functions even though there is the more modern
> > > and much better designed DMA API and only two MIPS-specific users (one of
> > > which I just fixed) do remain. So should we finally start removing it?
> >
> > There's still some users in arch/, but yes, let's remove it from the
> > arches that don't use it internally.
>
> There's the updated dma_cache_sync() API, which you need to keep because
> the parisc lasi scsi and network drivers rely on it for our fully
> incoherent boxes.
Sure -- I was just talking about the three functions Ralf mentioned.
BTW, Ralf, I found six MIPS users:
./arch/mips/au1000/common/dbdma.c: dma_cache_wback_inv((unsigned long)buf, nbytes);
./arch/mips/jazz/jazzdma.c: dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE);
./arch/mips/mm/dma-default.c: dma_cache_wback_inv((unsigned long) ret, size);
./drivers/net/sgiseeq.c: dma_cache_wback_inv((unsigned long)&sp->srings->rxvector,
./drivers/scsi/dec_esp.c: dma_cache_wback_inv((unsigned long) phys_to_virt(vaddress), length);
./include/asm-mips/floppy.h: dma_cache_wback_inv((unsigned long)addr,size);
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-04 13:07 ` Matthew Wilcox
@ 2007-09-04 13:33 ` Ralf Baechle
0 siblings, 0 replies; 14+ messages in thread
From: Ralf Baechle @ 2007-09-04 13:33 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: James Bottomley, linux-arch
On Tue, Sep 04, 2007 at 07:07:47AM -0600, Matthew Wilcox wrote:
> BTW, Ralf, I found six MIPS users:
>
> ./arch/mips/au1000/common/dbdma.c: dma_cache_wback_inv((unsigned long)buf, nbytes);
> ./arch/mips/jazz/jazzdma.c: dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE);
> ./arch/mips/mm/dma-default.c: dma_cache_wback_inv((unsigned long) ret, size);
> ./drivers/net/sgiseeq.c: dma_cache_wback_inv((unsigned long)&sp->srings->rxvector,
> ./drivers/scsi/dec_esp.c: dma_cache_wback_inv((unsigned long) phys_to_virt(vaddress), length);
> ./include/asm-mips/floppy.h: dma_cache_wback_inv((unsigned long)addr,size);
arch/mips/mm/dma-default.c is the implementation of the DMA API as
documented in the kernel; it needs to bang on the caches for non-coherent
I/O so will have to continue using the old functions though I may change
the function names. sgiseeq I already fixed, the rest is being fixed
once as I'm writing this.
Ralf
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-04 13:07 ` Ralf Baechle
@ 2007-09-04 23:49 ` James Bottomley
2007-09-11 13:44 ` Jes Sorensen
1 sibling, 0 replies; 14+ messages in thread
From: James Bottomley @ 2007-09-04 23:49 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Matthew Wilcox, linux-arch
On Tue, 2007-09-04 at 14:07 +0100, Ralf Baechle wrote:
> I wasn't thinking of touching dma_cache_sync, only the three mentioned
> mostly unused ones.
OK, I suspected not but your subject line:
Removal of dma_cache_* functions?
Worried me in that regard.
Jaems
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions
2007-09-04 12:42 ` Matthew Wilcox
2007-09-04 12:57 ` James Bottomley
@ 2007-09-06 11:39 ` Ralf Baechle
2007-09-06 14:55 ` Paul Mackerras
` (3 more replies)
1 sibling, 4 replies; 14+ messages in thread
From: Ralf Baechle @ 2007-09-06 11:39 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-arch
So this is looking ok? I got an ACK from Paul Mundt for SH.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/avr32/mm/dma-coherent.c | 6 ++--
arch/mips/mm/cache.c | 2 -
arch/sh/drivers/pci/dma-dreamcast.c | 2 +
arch/sh/mm/consistent.c | 8 +++---
arch/sh64/kernel/pci-dma.c | 3 +-
include/asm-alpha/io.h | 6 ----
include/asm-avr32/io.h | 7 -----
include/asm-blackfin/io.h | 4 ---
include/asm-h8300/io.h | 6 ----
include/asm-i386/io.h | 11 +-------
include/asm-ia64/io.h | 4 ---
include/asm-m68k/io.h | 6 ----
include/asm-m68knommu/io.h | 6 ----
include/asm-mips/io.h | 2 +
include/asm-parisc/io.h | 5 ----
include/asm-powerpc/io.h | 17 ------------
include/asm-ppc/io.h | 17 ------------
include/asm-sh/floppy.h | 2 +
include/asm-sh/io.h | 25 ------------------
include/asm-sh64/dma-mapping.h | 6 ++++
include/asm-sh64/io.h | 48 -----------------------------------
include/asm-sparc/io.h | 7 -----
include/asm-sparc64/io.h | 6 ----
include/asm-x86_64/io.h | 6 ----
24 files changed, 19 insertions(+), 193 deletions(-)
diff --git a/arch/avr32/mm/dma-coherent.c b/arch/avr32/mm/dma-coherent.c
index 099212d..177fea8 100644
--- a/arch/avr32/mm/dma-coherent.c
+++ b/arch/avr32/mm/dma-coherent.c
@@ -21,13 +21,13 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, int direction)
switch (direction) {
case DMA_FROM_DEVICE: /* invalidate only */
- dma_cache_inv(vaddr, size);
+ invalidate_dcache_region(vaddr, size);
break;
case DMA_TO_DEVICE: /* writeback only */
- dma_cache_wback(vaddr, size);
+ clean_dcache_region(vaddr, size);
break;
case DMA_BIDIRECTIONAL: /* writeback and invalidate */
- dma_cache_wback_inv(vaddr, size);
+ flush_dcache_region(vaddr, size);
break;
default:
BUG();
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 81f925a..49d4646 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -46,8 +46,6 @@ void (*_dma_cache_wback)(unsigned long start, unsigned long size);
void (*_dma_cache_inv)(unsigned long start, unsigned long size);
EXPORT_SYMBOL(_dma_cache_wback_inv);
-EXPORT_SYMBOL(_dma_cache_wback);
-EXPORT_SYMBOL(_dma_cache_inv);
#endif /* CONFIG_DMA_NONCOHERENT */
diff --git a/arch/sh/drivers/pci/dma-dreamcast.c b/arch/sh/drivers/pci/dma-dreamcast.c
index 230d6ec..888a340 100644
--- a/arch/sh/drivers/pci/dma-dreamcast.c
+++ b/arch/sh/drivers/pci/dma-dreamcast.c
@@ -51,7 +51,7 @@ void *dreamcast_consistent_alloc(struct device *dev, size_t size,
buf = P2SEGADDR(buf);
/* Flush the dcache before we hand off the buffer */
- dma_cache_wback_inv((void *)buf, size);
+ __flush_purge_region((void *)buf, size);
return (void *)buf;
}
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 38c82d8..e220c29 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -34,7 +34,7 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *handle)
/*
* We must flush the cache before we pass it on to the device
*/
- dma_cache_wback_inv(ret, size);
+ __flush_purge_region(ret, size);
page = virt_to_page(ret);
free = page + (size >> PAGE_SHIFT);
@@ -68,13 +68,13 @@ void consistent_sync(void *vaddr, size_t size, int direction)
switch (direction) {
case DMA_FROM_DEVICE: /* invalidate only */
- dma_cache_inv(p1addr, size);
+ __flush_invalidate_region(p1addr, size);
break;
case DMA_TO_DEVICE: /* writeback only */
- dma_cache_wback(p1addr, size);
+ __flush_wback_region(p1addr, size);
break;
case DMA_BIDIRECTIONAL: /* writeback and invalidate */
- dma_cache_wback_inv(p1addr, size);
+ __flush_purge_region(p1addr, size);
break;
default:
BUG();
diff --git a/arch/sh64/kernel/pci-dma.c b/arch/sh64/kernel/pci-dma.c
index a9328f8..e3f1d32 100644
--- a/arch/sh64/kernel/pci-dma.c
+++ b/arch/sh64/kernel/pci-dma.c
@@ -8,6 +8,7 @@
* Dynamic DMA mapping support.
*/
#include <linux/types.h>
+#include <linux/dma-mapping.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/pci.h>
@@ -31,7 +32,7 @@ void *consistent_alloc(struct pci_dev *hwdev, size_t size,
if (vp != NULL) {
memset(vp, 0, size);
*dma_handle = virt_to_phys(ret);
- dma_cache_wback_inv((unsigned long)ret, size);
+ dma_cache_sync(NULL, ret, size, DMA_BIDIRECTIONAL);
}
return vp;
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index ab5b60d..38f18cf 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -551,12 +551,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
#endif
#define RTC_ALWAYS_BCD 0
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
/*
* Some mucking forons use if[n]def writeq to check if platform has it.
* It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index 64bb92b..8be7ea9 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -298,13 +298,6 @@ extern void __iounmap(void __iomem *addr);
#define ioport_map(port, nr) ioremap(port, nr)
#define ioport_unmap(port) iounmap(port)
-#define dma_cache_wback_inv(_start, _size) \
- flush_dcache_region(_start, _size)
-#define dma_cache_inv(_start, _size) \
- invalidate_dcache_region(_start, _size)
-#define dma_cache_wback(_start, _size) \
- clean_dcache_region(_start, _size)
-
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index 142cb33..818d949 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -183,10 +183,6 @@ extern void blkfin_inv_cache_all(void);
#define ioport_map(port, nr) ((void __iomem*)(port))
#define ioport_unmap(addr)
-#define dma_cache_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
-
/* Pages to physical address... */
#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
diff --git a/include/asm-h8300/io.h b/include/asm-h8300/io.h
index 91b7487..7543a57 100644
--- a/include/asm-h8300/io.h
+++ b/include/asm-h8300/io.h
@@ -264,12 +264,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
extern void iounmap(void *addr);
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
/* H8/300 internal I/O functions */
static __inline__ unsigned char ctrl_inb(unsigned long addr)
{
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index e8e0bd6..4ea7b1a 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -237,18 +237,9 @@ static inline void flush_write_buffers(void)
__asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory");
}
-#define dma_cache_inv(_start,_size) flush_write_buffers()
-#define dma_cache_wback(_start,_size) flush_write_buffers()
-#define dma_cache_wback_inv(_start,_size) flush_write_buffers()
-
#else
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-#define flush_write_buffers()
+#define flush_write_buffers() do { } while (0)
#endif
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index eb17a86..4ebed77 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -435,10 +435,6 @@ extern void memcpy_fromio(void *dst, const volatile void __iomem *src, long n);
extern void memcpy_toio(volatile void __iomem *dst, const void *src, long n);
extern void memset_io(volatile void __iomem *s, int c, long n);
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
# endif /* __KERNEL__ */
/*
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 47bb9cf..baf4f9b 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -384,12 +384,6 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
}
-
-/* m68k caches aren't DMA coherent */
-extern void dma_cache_wback_inv(unsigned long start, unsigned long size);
-extern void dma_cache_wback(unsigned long start, unsigned long size);
-extern void dma_cache_inv(unsigned long start, unsigned long size);
-
static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
{
__builtin_memset((void __force *) addr, val, count);
diff --git a/include/asm-m68knommu/io.h b/include/asm-m68knommu/io.h
index 8df4cee..653d9b2 100644
--- a/include/asm-m68knommu/io.h
+++ b/include/asm-m68knommu/io.h
@@ -165,12 +165,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
extern void iounmap(void *addr);
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
/* Pages to physical address... */
#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 7ba9289..d79a889 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -554,6 +554,8 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
* caches. Dirty lines of the caches may be written back or simply
* be discarded. This operation is necessary before dma operations
* to the memory.
+ *
+ * This API used to be exported; it now is for arch code internal use only.
*/
#ifdef CONFIG_DMA_NONCOHERENT
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
index 4cc9bce..95f00e1 100644
--- a/include/asm-parisc/io.h
+++ b/include/asm-parisc/io.h
@@ -270,11 +270,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
/* IO Port space is : BBiiii where BB is HBA number. */
#define IO_SPACE_LIMIT 0x00ffffff
-
-#define dma_cache_inv(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0)
-#define dma_cache_wback(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0)
-#define dma_cache_wback_inv(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0)
-
/* PA machines have an MM I/O space from 0xf0000000-0xffffffff in 32
* bit mode and from 0xfffffffff0000000-0xfffffffffffffff in 64 bit
* mode (essentially just sign extending. This macro takes in a 32
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index bb8d965..a59028a 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -498,23 +498,6 @@ static inline void name at \
#define writeq writeq
#endif
-#ifdef CONFIG_NOT_COHERENT_CACHE
-
-#define dma_cache_inv(_start,_size) \
- invalidate_dcache_range(_start, (_start + _size))
-#define dma_cache_wback(_start,_size) \
- clean_dcache_range(_start, (_start + _size))
-#define dma_cache_wback_inv(_start,_size) \
- flush_dcache_range(_start, (_start + _size))
-
-#else /* CONFIG_NOT_COHERENT_CACHE */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
-#endif /* !CONFIG_NOT_COHERENT_CACHE */
-
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 95d5904..de083df 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -518,23 +518,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
#include <asm/mpc8260_pci9.h>
#endif
-#ifdef CONFIG_NOT_COHERENT_CACHE
-
-#define dma_cache_inv(_start,_size) \
- invalidate_dcache_range(_start, (_start + _size))
-#define dma_cache_wback(_start,_size) \
- clean_dcache_range(_start, (_start + _size))
-#define dma_cache_wback_inv(_start,_size) \
- flush_dcache_range(_start, (_start + _size))
-
-#else
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
-#endif
-
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
diff --git a/include/asm-sh/floppy.h b/include/asm-sh/floppy.h
index 3b59b3a..c52309f 100644
--- a/include/asm-sh/floppy.h
+++ b/include/asm-sh/floppy.h
@@ -213,7 +213,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
}
#endif
- dma_cache_wback_inv(addr, size);
+ __flush_purge_region(addr, size);
/* actual, physical DMA */
doing_pdma = 0;
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index e6a1877..cc7821f 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -301,31 +301,6 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
__iounmap((addr))
/*
- * The caches on some architectures aren't dma-coherent and have need to
- * handle this in software. There are three types of operations that
- * can be applied to dma buffers.
- *
- * - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
- * writing the content of the caches back to memory, if necessary.
- * The function also invalidates the affected part of the caches as
- * necessary before DMA transfers from outside to memory.
- * - dma_cache_inv(start, size) invalidates the affected parts of the
- * caches. Dirty lines of the caches may be written back or simply
- * be discarded. This operation is necessary before dma operations
- * to the memory.
- * - dma_cache_wback(start, size) writes back any dirty lines but does
- * not invalidate the cache. This can be used before DMA reads from
- * memory,
- */
-
-#define dma_cache_wback_inv(_start,_size) \
- __flush_purge_region(_start,_size)
-#define dma_cache_inv(_start,_size) \
- __flush_invalidate_region(_start,_size)
-#define dma_cache_wback(_start,_size) \
- __flush_wback_region(_start,_size)
-
-/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index de43099..e661857 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -42,7 +42,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction dir)
{
- dma_cache_wback_inv((unsigned long)vaddr, size);
+ unsigned long s = (unsigned long) vaddr & L1_CACHE_ALIGN_MASK;
+ unsigned long e = (vaddr + size) & L1_CACHE_ALIGN_MASK;
+
+ for (; s <= e; s += L1_CACHE_BYTES)
+ asm volatile ("ocbp %0, 0" : : "r" (s));
}
static inline dma_addr_t dma_map_single(struct device *dev,
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h
index 1f37b69..dca1669 100644
--- a/include/asm-sh64/io.h
+++ b/include/asm-sh64/io.h
@@ -175,54 +175,6 @@ unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* n
extern void onchip_unmap(unsigned long vaddr);
/*
- * The caches on some architectures aren't dma-coherent and have need to
- * handle this in software. There are three types of operations that
- * can be applied to dma buffers.
- *
- * - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
- * writing the content of the caches back to memory, if necessary.
- * The function also invalidates the affected part of the caches as
- * necessary before DMA transfers from outside to memory.
- * - dma_cache_inv(start, size) invalidates the affected parts of the
- * caches. Dirty lines of the caches may be written back or simply
- * be discarded. This operation is necessary before dma operations
- * to the memory.
- * - dma_cache_wback(start, size) writes back any dirty lines but does
- * not invalidate the cache. This can be used before DMA reads from
- * memory,
- */
-
-static __inline__ void dma_cache_wback_inv (unsigned long start, unsigned long size)
-{
- unsigned long s = start & L1_CACHE_ALIGN_MASK;
- unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
- for (; s <= e; s += L1_CACHE_BYTES)
- asm volatile ("ocbp %0, 0" : : "r" (s));
-}
-
-static __inline__ void dma_cache_inv (unsigned long start, unsigned long size)
-{
- // Note that caller has to be careful with overzealous
- // invalidation should there be partial cache lines at the extremities
- // of the specified range
- unsigned long s = start & L1_CACHE_ALIGN_MASK;
- unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
- for (; s <= e; s += L1_CACHE_BYTES)
- asm volatile ("ocbi %0, 0" : : "r" (s));
-}
-
-static __inline__ void dma_cache_wback (unsigned long start, unsigned long size)
-{
- unsigned long s = start & L1_CACHE_ALIGN_MASK;
- unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
- for (; s <= e; s += L1_CACHE_BYTES)
- asm volatile ("ocbwb %0, 0" : : "r" (s));
-}
-
-/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index c23e74a..243bf8e 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -310,13 +310,6 @@ extern void sbus_iounmap(volatile void __iomem *vaddr, unsigned long size);
#define RTC_PORT(x) (rtc_port + (x))
#define RTC_ALWAYS_BCD 0
-/* Nothing to do */
-/* P3: Only IDE DMA may need these. XXX Verify that it still does... */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
#endif
#define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 9565a89..cd7ef30 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -474,12 +474,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
#define sbus_iounmap(__addr, __size) \
release_region((unsigned long)(__addr), (__size))
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 7475095..a037b07 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -249,12 +249,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
*/
#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size) do { } while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { } while (0)
-
#define flush_write_buffers()
extern int iommu_bio_merge;
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions
2007-09-06 11:39 ` [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions Ralf Baechle
@ 2007-09-06 14:55 ` Paul Mackerras
2007-09-06 15:02 ` David Miller
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: Paul Mackerras @ 2007-09-06 14:55 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Matthew Wilcox, linux-arch
Ralf Baechle writes:
> So this is looking ok? I got an ACK from Paul Mundt for SH.
Acked-by: Paul Mackerras <paulus@samba.org>
for the powerpc/ppc bits.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions
2007-09-06 11:39 ` [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions Ralf Baechle
2007-09-06 14:55 ` Paul Mackerras
@ 2007-09-06 15:02 ` David Miller
2007-09-06 15:02 ` Kyle McMartin
2007-09-06 21:28 ` Håvard Skinnemoen
3 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2007-09-06 15:02 UTC (permalink / raw)
To: ralf; +Cc: matthew, linux-arch
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 6 Sep 2007 12:39:18 +0100
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions
2007-09-06 11:39 ` [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions Ralf Baechle
2007-09-06 14:55 ` Paul Mackerras
2007-09-06 15:02 ` David Miller
@ 2007-09-06 15:02 ` Kyle McMartin
2007-09-06 21:28 ` Håvard Skinnemoen
3 siblings, 0 replies; 14+ messages in thread
From: Kyle McMartin @ 2007-09-06 15:02 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Matthew Wilcox, linux-arch
On Thu, Sep 06, 2007 at 12:39:18PM +0100, Ralf Baechle wrote:
> So this is looking ok? I got an ACK from Paul Mundt for SH.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
>
Acked-by: Kyle McMartin <kyle@parisc-linux.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions
2007-09-06 11:39 ` [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions Ralf Baechle
` (2 preceding siblings ...)
2007-09-06 15:02 ` Kyle McMartin
@ 2007-09-06 21:28 ` Håvard Skinnemoen
3 siblings, 0 replies; 14+ messages in thread
From: Håvard Skinnemoen @ 2007-09-06 21:28 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Matthew Wilcox, linux-arch
On 9/6/07, Ralf Baechle <ralf@linux-mips.org> wrote:
> So this is looking ok? I got an ACK from Paul Mundt for SH.
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
AVR32 bits look good to me.
Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-04 13:07 ` Ralf Baechle
2007-09-04 23:49 ` James Bottomley
@ 2007-09-11 13:44 ` Jes Sorensen
2007-09-11 13:58 ` Ralf Baechle
1 sibling, 1 reply; 14+ messages in thread
From: Jes Sorensen @ 2007-09-11 13:44 UTC (permalink / raw)
To: Ralf Baechle
Cc: James Bottomley, Matthew Wilcox, linux-arch, Geert Uytterhoeven
>>>>> "Ralf" == Ralf Baechle <ralf@linux-mips.org> writes:
Ralf> On Tue, Sep 04, 2007 at 01:57:10PM +0100, James Bottomley wrote:
>> On Tue, 2007-09-04 at 06:42 -0600, Matthew Wilcox wrote:
>> > On Tue, Sep 04, 2007 at 12:56:16PM +0100, Ralf Baechle wrote:
>> > > Most architectures implement the dma_cache_wback,
>> dma_cache_wback_inv > > and dma_cache_wback_inv functions even
>> though there is the more modern > > and much better designed DMA
>> API and only two MIPS-specific users (one of > > which I just
>> fixed) do remain. So should we finally start removing it?
>> >
>> > There's still some users in arch/, but yes, let's remove it from
>> the > arches that don't use it internally.
>>
>> There's the updated dma_cache_sync() API, which you need to keep
>> because the parisc lasi scsi and network drivers rely on it for our
>> fully incoherent boxes.
Ralf> I wasn't thinking of touching dma_cache_sync, only the three
Ralf> mentioned mostly unused ones.
Ralf,
Only issue I could think off would be the m68k drivers, but I don't
know if that ever migrated to the MIPS API or stayed with the old m68k
one - Geert and comments?
Cheers,
Jes
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Removal of dma_cache_* functions?
2007-09-11 13:44 ` Jes Sorensen
@ 2007-09-11 13:58 ` Ralf Baechle
0 siblings, 0 replies; 14+ messages in thread
From: Ralf Baechle @ 2007-09-11 13:58 UTC (permalink / raw)
To: Jes Sorensen
Cc: James Bottomley, Matthew Wilcox, linux-arch, Geert Uytterhoeven
On Tue, Sep 11, 2007 at 09:44:57AM -0400, Jes Sorensen wrote:
> Only issue I could think off would be the m68k drivers, but I don't
> know if that ever migrated to the MIPS API or stayed with the old m68k
> one - Geert and comments?
That would only apply to out of tree drivers. With the patch applied
git grep -E -w -l 'dma_cache_(wback|wback_inv|inv)' only finds:
arch/mips/au1000/common/dbdma.c
arch/mips/jazz/jazzdma.c
arch/mips/mm/dma-default.c
drivers/net/sgiseeq.c
drivers/scsi/dec_esp.c
include/asm-mips/floppy.h
include/asm-mips/io.h
For sgiseeq there already is a patch in flight.
Ralf
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-09-11 13:58 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-04 11:56 Removal of dma_cache_* functions? Ralf Baechle
2007-09-04 12:42 ` Matthew Wilcox
2007-09-04 12:57 ` James Bottomley
2007-09-04 13:07 ` Ralf Baechle
2007-09-04 23:49 ` James Bottomley
2007-09-11 13:44 ` Jes Sorensen
2007-09-11 13:58 ` Ralf Baechle
2007-09-04 13:07 ` Matthew Wilcox
2007-09-04 13:33 ` Ralf Baechle
2007-09-06 11:39 ` [PATCH] Removal of dma_cache_(wback|inv|wback_inv) functions Ralf Baechle
2007-09-06 14:55 ` Paul Mackerras
2007-09-06 15:02 ` David Miller
2007-09-06 15:02 ` Kyle McMartin
2007-09-06 21:28 ` Håvard Skinnemoen
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).