From: "Stephen Neuendorffer" <stephen.neuendorffer@xilinx.com>
To: monstr@seznam.cz, linux-kernel@vger.kernel.org
Cc: arnd@arndb.de, linux-arch@vger.kernel.org,
John Linn <linnj@xilinx.com>,
john.williams@petalogix.com, matthew@wil.cx,
will.newton@gmail.com, drepper@redhat.com,
microblaze-uclinux@itee.uq.edu.au, grant.likely@secretlab.ca,
Michal Simek <monstr@monstr.eu>
Subject: RE: [PATCH 09/56] microblaze_v2: cache support
Date: Mon, 5 May 2008 15:37:53 -0700 [thread overview]
Message-ID: <20080505223752.71802BD0054@mail54-dub.bigfish.com> (raw)
In-Reply-To: <2f801c33caee22e112af51ae927c264ce99ead01.1209897266.git.monstr@monstr.eu>
Primarily, this patch implements the dma-coherent API. In addition,
it cleans up some of the code that deals with caches, in order to
match the usage in dma-coherent.
In particular, the dcache in the microblaze is write through, so the
existing code is more easily thought of as 'invalidation' than
'flushing'. In addition, some of the flush_* methods were old, and
some shouldn't need to be implemented (since currently no mmu is
supported).
I'd appreciate if someone would ACK my interpretation of
Documentation/cachetlb.txt. In particular:
flush_cache_mm(mm) (NOOP because nommu)
flush_cache_range(mm, start, end) (Does this need to be implemented
since nommu?)
flush_cache_page(vma, vmaddr) (NOOP because nommu)
flush_dcache_page(page) (NOOP because write through cache.)
flush_dcache_range(start, end) (NOOP because write through cache.)
flush_dcache_mmap_lock(mapping) (NOOP because nommu)
flush_dcache_mmap_unlock(mapping) (NOOP because nommu)
flush_icache_page(vma,pg) (Does this need to be implemented? Doc is
unclear, but I assume it is used as flush_icache_range)
flush_icache_range(start, end) (Must be implemented because icache
doesn't snoop dcache on code loads)
Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
---
arch/microblaze/kernel/cpu/cache.c | 37 +---------
arch/microblaze/kernel/setup.c | 4 +-
arch/microblaze/mm/dma-coherent.c | 122
+++++++++++++++++++++++++++++++++++
include/asm-microblaze/cacheflush.h | 71 +++++++++------------
4 files changed, 158 insertions(+), 76 deletions(-)
create mode 100644 arch/microblaze/mm/dma-coherent.c
diff --git a/arch/microblaze/kernel/cpu/cache.c
b/arch/microblaze/kernel/cpu/cache.c
index d6a1eab..1247b9e 100644
--- a/arch/microblaze/kernel/cpu/cache.c
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -129,7 +129,7 @@ void _invalidate_dcache(unsigned int addr)
: "r" (addr));
}
-void __flush_icache_all(void)
+void __invalidate_icache_all(void)
{
unsigned int i;
unsigned flags;
@@ -149,7 +149,7 @@ void __flush_icache_all(void)
}
}
-void __flush_icache_range(unsigned long start, unsigned long end)
+void __invalidate_icache_range(unsigned long start, unsigned long end)
{
unsigned int i;
unsigned flags;
@@ -177,24 +177,7 @@ void __flush_icache_range(unsigned long start,
unsigned long end)
}
}
-void __flush_icache_page(struct vm_area_struct *vma, struct page *page)
-{
- __flush_icache_all();
-}
-
-void __flush_icache_user_range(struct vm_area_struct *vma,
- struct page *page, unsigned long adr,
- int len)
-{
- __flush_icache_all();
-}
-
-void __flush_cache_sigtramp(unsigned long addr)
-{
- __flush_icache_range(addr, addr + 8);
-}
-
-void __flush_dcache_all(void)
+void __invalidate_dcache_all(void)
{
unsigned int i;
unsigned flags;
@@ -216,7 +199,7 @@ void __flush_dcache_all(void)
}
}
-void __flush_dcache_range(unsigned long start, unsigned long end)
+void __invalidate_dcache_range(unsigned long start, unsigned long end)
{
unsigned int i;
unsigned flags;
@@ -242,15 +225,3 @@ void __flush_dcache_range(unsigned long start,
unsigned long end)
local_irq_restore(flags);
}
}
-
-void __flush_dcache_page(struct vm_area_struct *vma, struct page *page)
-{
- __flush_dcache_all();
-}
-
-void __flush_dcache_user_range(struct vm_area_struct *vma,
- struct page *page, unsigned long adr,
- int len)
-{
- __flush_dcache_all();
-}
diff --git a/arch/microblaze/kernel/setup.c
b/arch/microblaze/kernel/setup.c
index 43d53d9..241fb21 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -51,10 +51,10 @@ void __init setup_arch(char **cmdline_p)
/* irq_early_init(); */
setup_cpuinfo();
- __flush_icache_all();
+ __invalidate_icache_all();
__enable_icache();
- __flush_dcache_all();
+ __invalidate_icache_all();
__enable_dcache();
panic_timeout = 120;
diff --git a/arch/microblaze/mm/dma-coherent.c
b/arch/microblaze/mm/dma-coherent.c
new file mode 100644
index 0000000..308654f
--- /dev/null
+++ b/arch/microblaze/mm/dma-coherent.c
@@ -0,0 +1,122 @@
+/*
+ * Microblaze support for cache consistent memory.
+ *
+ * Copyright (C) 2007 Xilinx, Inc.
+ *
+ * Based on arch/microblaze/mm/consistent.c
+ * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au>
+ * Based on arch/avr32/mm/dma-coherent.c
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * Consistent memory allocators. Used for DMA devices that want to
+ * share memory with the processor core.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/dma-mapping.h>
+
+#include <asm/cacheflush.h>
+
+void dma_cache_sync(struct device *dev, void *vaddr, size_t size, int
direction)
+{
+ switch (direction) {
+ case DMA_FROM_DEVICE: /* invalidate only */
+ invalidate_dcache_range(vaddr, vaddr + size);
+ break;
+ case DMA_TO_DEVICE: /* writeback only */
+ flush_dcache_range(vaddr, vaddr + size);
+ break;
+ case DMA_BIDIRECTIONAL: /* writeback and invalidate */
+ invalidate_dcache_range(vaddr, vaddr + size);
+ flush_dcache_range(vaddr, vaddr + size);
+ break;
+ default:
+ BUG();
+ }
+}
+EXPORT_SYMBOL(dma_cache_sync);
+
+static struct page *__dma_alloc(struct device *dev, size_t size,
+ dma_addr_t *handle, gfp_t gfp)
+{
+ struct page *page, *free, *end;
+ int order;
+
+ if (in_interrupt())
+ BUG();
+
+ size = PAGE_ALIGN(size);
+ order = get_order(size);
+
+ page = alloc_pages(gfp, order);
+ if (!page)
+ return NULL;
+
+ split_page(page, order);
+
+ /*
+ * When accessing physical memory with valid cache data, we
+ * get a cache hit even if the virtual memory region is marked
+ * as uncached.
+ *
+ * Since the memory is newly allocated, there is no point in
+ * doing a writeback. If the previous owner cares, he should
+ * have flushed the cache before releasing the memory.
+ */
+ invalidate_dcache_range(phys_to_virt(page_to_phys(page)), size);
+
+ *handle = page_to_bus(page);
+ free = page + (size >> PAGE_SHIFT);
+ end = page + (1 << order);
+
+ /*
+ * Free any unused pages
+ */
+ while (free < end) {
+ __free_page(free);
+ free++;
+ }
+
+ return page;
+}
+
+static void __dma_free(struct device *dev, size_t size,
+ struct page *page, dma_addr_t handle)
+{
+ struct page *end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT);
+
+ while (page < end)
+ __free_page(page++);
+}
+
+void *dma_alloc_coherent(struct device *dev, size_t size,
+ dma_addr_t *handle, gfp_t gfp)
+{
+ struct page *page;
+ void *ret = NULL;
+
+ page = __dma_alloc(dev, size, handle, gfp);
+ if (page) {
+ ret = (void *)page_to_phys(page);
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL(dma_alloc_coherent);
+
+void dma_free_coherent(struct device *dev, size_t size,
+ void *cpu_addr, dma_addr_t handle)
+{
+ void *addr;
+ struct page *page;
+
+ pr_debug("dma_free_coherent addr %p (phys %08lx) size %u\n",
+ cpu_addr, (unsigned long)handle, (unsigned)size);
+ BUG_ON(!virt_addr_valid(addr));
+ page = virt_to_page(addr);
+ __dma_free(dev, size, page, handle);
+}
+EXPORT_SYMBOL(dma_free_coherent);
diff --git a/include/asm-microblaze/cacheflush.h
b/include/asm-microblaze/cacheflush.h
index ba7339d..782f01b 100644
--- a/include/asm-microblaze/cacheflush.h
+++ b/include/asm-microblaze/cacheflush.h
@@ -1,6 +1,7 @@
/*
* include/asm-microblaze/cacheflush.h
*
+ * Copyright (C) 2008 Xilinx, Inc.
* Copyright (C) 2007 PetaLogix
* Copyright (C) 2007 John Williams <john.williams@petalogix.com>
* based on v850 version which was
@@ -15,58 +16,46 @@
#ifndef _ASM_MICROBLAZE_CACHEFLUSH_H
#define _ASM_MICROBLAZE_CACHEFLUSH_H
+#include <linux/kernel.h> /* For min/max macros */
+#include <linux/mm.h> /* For min/max macros */
+#include <asm/setup.h>
+#include <asm/page.h>
+#include <asm/cache.h>
-/* Somebody depends on this; sigh... */
-#include <linux/mm.h>
-
-#define flush_cache_all() __flush_cache_all()
-#define flush_cache_mm(mm) do { } while (0)
-#define flush_cache_range(vma, start, end) __flush_cache_all()
-#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
-
-#define flush_dcache_range(start, end) __flush_dcache_range(start, end)
-#define flush_dcache_page(page) do { } while (0)
-#define flush_dcache_mmap_lock(mapping) do { } while (0)
-#define flush_dcache_mmap_unlock(mapping) do { } while (0)
+/*
+ * Cache handling functions.
+ * Microblaze has a write-through data cache, and no icache snooping of
dcache.
+ */
+#define flush_cache_mm(mm) do { } while(0)
+#define flush_cache_range(mm, start, end) invalidate_cache_all()
+#define flush_cache_page(vma, vmaddr) do { } while(0)
-#define flush_icache_range(start, len) __flush_icache_range(start, len)
-#define flush_icache_page(vma, pg) do { } while (0)
-#define flush_icache_user_range(start, len) do { } while (0)
+#define flush_dcache_page(page) do { } while(0)
+#define flush_dcache_range(start, end) do { } while(0)
+#define flush_dcache_mmap_lock(mapping) do { } while(0)
+#define flush_dcache_mmap_unlock(mapping) do { } while(0)
-#define flush_cache_vmap(start, end) do { } while (0)
-#define flush_cache_vunmap(start, end) do { } while (0)
+#define flush_icache_page(vma,pg)
__invalidate_icache_all()
+#define flush_icache_range(start, end)
__invalidate_icache_range(start, end)
-struct page;
-struct mm_struct;
-struct vm_area_struct;
/* see arch/microblaze/kernel/cache.c */
-extern void __flush_icache_all(void);
-extern void __flush_icache_range(unsigned long start, unsigned long
end);
-extern void __flush_icache_page(struct vm_area_struct *vma, struct page
*page);
-extern void __flush_icache_user_range(struct vm_area_struct *vma,
- struct page *page,
- unsigned long adr, int len);
-extern void __flush_cache_sigtramp(unsigned long addr);
-
-extern void __flush_dcache_all(void);
-extern void __flush_dcache_range(unsigned long start, unsigned long
end);
-extern void __flush_dcache_page(struct vm_area_struct *vma, struct page
*page);
-extern void __flush_dcache_user_range(struct vm_area_struct *vma,
- struct page *page,
- unsigned long adr, int len);
+void __invalidate_icache_all(void);
+void __invalidate_icache_range(unsigned long start, unsigned long end);
+void __invalidate_dcache_all(void);
+void __invalidate_dcache_range(unsigned long start, unsigned long end);
-extern inline void __flush_cache_all(void)
-{
- __flush_icache_all();
- __flush_dcache_all();
-}
+#define invalidate_cache_all()
__invalidate_icache_all(); __invalidate_dcache_all()
+#define invalidate_dcache()
__invalidate_dcache_all()
+#define invalidate_icache()
__invalidate_icache_all()
+#define invalidate_dcache_range(start, end)
__invalidate_dcache_range(start,end)
+#define invalidate_icache_range(start, end)
__invalidate_icache_range(start,end)
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
do { memcpy(dst, src, len); \
- flush_icache_user_range(vma, page, vaddr, len); \
+ flush_icache_range ((unsigned) (dst), (unsigned) (dst) + (len));
\
} while (0)
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
- memcpy(dst, src, len)
+ memcpy((dst), (src), (len))
#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
--
1.5.3.4
> -----Original Message-----
> From: monstr@seznam.cz [mailto:monstr@seznam.cz]
> Sent: Sunday, May 04, 2008 4:41 AM
> To: linux-kernel@vger.kernel.org
> Cc: arnd@arndb.de; linux-arch@vger.kernel.org; Stephen Neuendorffer;
John Linn;
> john.williams@petalogix.com; matthew@wil.cx; will.newton@gmail.com;
drepper@redhat.com; microblaze-
> uclinux@itee.uq.edu.au; grant.likely@secretlab.ca; Michal Simek
> Subject: [PATCH 09/56] microblaze_v2: cache support
>
> From: Michal Simek <monstr@monstr.eu>
>
>
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
> arch/microblaze/kernel/cpu/cache.c | 256
+++++++++++++++++++++++++++++++++++
> include/asm-microblaze/cache.h | 47 +++++++
> include/asm-microblaze/cacheflush.h | 72 ++++++++++
> 3 files changed, 375 insertions(+), 0 deletions(-)
> create mode 100644 arch/microblaze/kernel/cpu/cache.c
> create mode 100644 include/asm-microblaze/cache.h
> create mode 100644 include/asm-microblaze/cacheflush.h
>
> diff --git a/arch/microblaze/kernel/cpu/cache.c
b/arch/microblaze/kernel/cpu/cache.c
> new file mode 100644
> index 0000000..d6a1eab
> --- /dev/null
> +++ b/arch/microblaze/kernel/cpu/cache.c
> @@ -0,0 +1,256 @@
> +/*
> + * arch/microblaze/kernel/cpu/cache.c
> + * Cache control for MicroBlaze cache memories
> + *
> + * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
> + * Copyright (C) 2007 PetaLogix
> + * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
> + *
> + * This file is subject to the terms and conditions of the GNU
General
> + * Public License. See the file COPYING in the main directory of this
> + * archive for more details.
> + *
> + */
> +
> +#include <asm/cacheflush.h>
> +#include <asm/cache.h>
> +#include <asm/cpuinfo.h>
> +
> +/* Exported functions */
> +
> +void _enable_icache(void)
> +{
> + if (cpuinfo.use_icache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> + __asm__ __volatile__ ("
\
> + msrset r0, %0;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_ICE)
\
> + : "memory");
> +#else
> + __asm__ __volatile__ ("
\
> + mfs r12, rmsr;
\
> + ori r12, r12, %0;
\
> + mts rmsr, r12;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_ICE)
\
> + : "memory", "r12");
> +#endif
> + }
> +}
> +
> +void _disable_icache(void)
> +{
> + if (cpuinfo.use_icache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> + __asm__ __volatile__ ("
\
> + msrclr r0, %0;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_ICE)
\
> + : "memory");
> +#else
> + __asm__ __volatile__ ("
\
> + mfs r12, rmsr;
\
> + andi r12, r12, ~%0;
\
> + mts rmsr, r12;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_ICE)
\
> + : "memory", "r12");
> +#endif
> + }
> +}
> +
> +void _invalidate_icache(unsigned int addr)
> +{
> + if (cpuinfo.use_icache) {
> + __asm__ __volatile__ ("
\
> + wic %0, r0"
\
> + :
\
> + : "r" (addr));
> + }
> +}
> +
> +void _enable_dcache(void)
> +{
> + if (cpuinfo.use_dcache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> + __asm__ __volatile__ ("
\
> + msrset r0, %0;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_DCE)
\
> + : "memory");
> +#else
> + __asm__ __volatile__ ("
\
> + mfs r12, rmsr;
\
> + ori r12, r12, %0;
\
> + mts rmsr, r12;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_DCE) \
> + : "memory", "r12");
> +#endif
> + }
> +}
> +
> +void _disable_dcache(void)
> +{
> + if (cpuinfo.use_dcache) {
> +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
> + __asm__ __volatile__ ("
\
> + msrclr r0, %0;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_DCE) \
> + : "memory");
> +#else
> + __asm__ __volatile__ ("
\
> + mfs r12, rmsr;
\
> + andi r12, r12, ~%0;
\
> + mts rmsr, r12;
\
> + nop; "
\
> + :
\
> + : "i" (MSR_DCE) \
> + : "memory", "r12");
> +#endif
> + }
> +}
> +
> +void _invalidate_dcache(unsigned int addr)
> +{
> + if (cpuinfo.use_dcache)
> + __asm__ __volatile__ ("
\
> + wdc %0, r0"
\
> + :
\
> + : "r" (addr));
> +}
> +
> +void __flush_icache_all(void)
> +{
> + unsigned int i;
> + unsigned flags;
> +
> + if (cpuinfo.use_icache) {
> + local_irq_save(flags);
> + __disable_icache();
> +
> + /* Just loop through cache size and invalidate, no need
to add
> + CACHE_BASE address */
> + for (i = 0; i < cpuinfo.icache_size;
> + i += cpuinfo.icache_line)
> + __invalidate_icache(i);
> +
> + __enable_icache();
> + local_irq_restore(flags);
> + }
> +}
> +
> +void __flush_icache_range(unsigned long start, unsigned long end)
> +{
> + unsigned int i;
> + unsigned flags;
> + unsigned int align;
> +
> + if (cpuinfo.use_icache) {
> + /*
> + * No need to cover entire cache range,
> + * just cover cache footprint
> + */
> + end = min(start + cpuinfo.icache_size, end);
> + align = ~(cpuinfo.icache_line - 1);
> + start &= align; /* Make sure we are aligned */
> + /* Push end up to the next cache line */
> + end = ((end & align) + cpuinfo.icache_line);
> +
> + local_irq_save(flags);
> + __disable_icache();
> +
> + for (i = start; i < end; i += cpuinfo.icache_line)
> + __invalidate_icache(i);
> +
> + __enable_icache();
> + local_irq_restore(flags);
> + }
> +}
> +
> +void __flush_icache_page(struct vm_area_struct *vma, struct page
*page)
> +{
> + __flush_icache_all();
> +}
> +
> +void __flush_icache_user_range(struct vm_area_struct *vma,
> + struct page *page, unsigned long adr,
> + int len)
> +{
> + __flush_icache_all();
> +}
> +
> +void __flush_cache_sigtramp(unsigned long addr)
> +{
> + __flush_icache_range(addr, addr + 8);
> +}
> +
> +void __flush_dcache_all(void)
> +{
> + unsigned int i;
> + unsigned flags;
> +
> + if (cpuinfo.use_dcache) {
> + local_irq_save(flags);
> + __disable_dcache();
> +
> + /*
> + * Just loop through cache size and invalidate,
> + * no need to add CACHE_BASE address
> + */
> + for (i = 0; i < cpuinfo.dcache_size;
> + i += cpuinfo.dcache_line)
> + __invalidate_dcache(i);
> +
> + __enable_dcache();
> + local_irq_restore(flags);
> + }
> +}
> +
> +void __flush_dcache_range(unsigned long start, unsigned long end)
> +{
> + unsigned int i;
> + unsigned flags;
> + unsigned int align;
> +
> + if (cpuinfo.use_dcache) {
> + /*
> + * No need to cover entire cache range,
> + * just cover cache footprint
> + */
> + end = min(start + cpuinfo.dcache_size, end);
> + align = ~(cpuinfo.dcache_line - 1);
> + start &= align; /* Make sure we are aligned */
> + /* Push end up to the next cache line */
> + end = ((end & align) + cpuinfo.dcache_line);
> + local_irq_save(flags);
> + __disable_dcache();
> +
> + for (i = start; i < end; i += cpuinfo.dcache_line)
> + __invalidate_dcache(i);
> +
> + __enable_dcache();
> + local_irq_restore(flags);
> + }
> +}
> +
> +void __flush_dcache_page(struct vm_area_struct *vma, struct page
*page)
> +{
> + __flush_dcache_all();
> +}
> +
> +void __flush_dcache_user_range(struct vm_area_struct *vma,
> + struct page *page, unsigned long adr,
> + int len)
> +{
> + __flush_dcache_all();
> +}
> diff --git a/include/asm-microblaze/cache.h
b/include/asm-microblaze/cache.h
> new file mode 100644
> index 0000000..6aa1abd
> --- /dev/null
> +++ b/include/asm-microblaze/cache.h
> @@ -0,0 +1,47 @@
> +/*
> + * include/asm-microblaze/cache.h
> + *
> + * Cache operations
> + *
> + * Copyright (C) 2007 Michal Simek <monstr@monstr.eu>
> + * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
> + *
> + * This file is subject to the terms and conditions of the GNU
General
> + * Public License. See the file COPYING in the main directory of this
> + * archive for more details.
> + *
> + */
> +
> +#ifndef _ASM_MICROBLAZE_CACHE_H
> +#define _ASM_MICROBLAZE_CACHE_H
> +
> +#include <asm/registers.h>
> +#include <linux/autoconf.h>
> +
> +#ifndef L1_CACHE_BYTES
> +/* word-granular cache in microblaze */
> +#define L1_CACHE_BYTES 4
> +#endif
> +
> +void _enable_icache(void);
> +void _disable_icache(void);
> +void _invalidate_icache(unsigned int addr);
> +
> +#define __enable_icache() _enable_icache()
> +#define __disable_icache() _disable_icache()
> +#define __invalidate_icache(addr) _invalidate_icache(addr)
> +
> +void _enable_dcache(void);
> +void _disable_dcache(void);
> +void _invalidate_dcache(unsigned int addr);
> +
> +#define __enable_dcache() _enable_dcache()
> +#define __disable_dcache() _disable_dcache()
> +#define __invalidate_dcache(addr) _invalidate_dcache(addr)
> +
> +/* FIXME - I don't think this is right */
> +#ifdef CONFIG_XILINX_UNCACHED_SHADOW
> +#define UNCACHED_SHADOW_MASK (CONFIG_XILINX_ERAM_SIZE)
> +#endif
> +
> +#endif /* _ASM_MICROBLAZE_CACHE_H */
> diff --git a/include/asm-microblaze/cacheflush.h
b/include/asm-microblaze/cacheflush.h
> new file mode 100644
> index 0000000..ba7339d
> --- /dev/null
> +++ b/include/asm-microblaze/cacheflush.h
> @@ -0,0 +1,72 @@
> +/*
> + * include/asm-microblaze/cacheflush.h
> + *
> + * Copyright (C) 2007 PetaLogix
> + * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
> + * based on v850 version which was
> + * Copyright (C) 2001,02,03 NEC Electronics Corporation
> + * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
> + *
> + * This file is subject to the terms and conditions of the GNU
General
> + * Public License. See the file COPYING in the main directory of this
> + * archive for more details.
> + *
> + */
> +
> +#ifndef _ASM_MICROBLAZE_CACHEFLUSH_H
> +#define _ASM_MICROBLAZE_CACHEFLUSH_H
> +
> +/* Somebody depends on this; sigh... */
> +#include <linux/mm.h>
> +
> +#define flush_cache_all() __flush_cache_all()
> +#define flush_cache_mm(mm) do { } while (0)
> +#define flush_cache_range(vma, start, end) __flush_cache_all()
> +#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
> +
> +#define flush_dcache_range(start, end)
__flush_dcache_range(start, end)
> +#define flush_dcache_page(page) do { } while (0)
> +#define flush_dcache_mmap_lock(mapping) do { } while (0)
> +#define flush_dcache_mmap_unlock(mapping) do { } while (0)
> +
> +#define flush_icache_range(start, len)
__flush_icache_range(start, len)
> +#define flush_icache_page(vma, pg) do { } while (0)
> +#define flush_icache_user_range(start, len) do { } while (0)
> +
> +#define flush_cache_vmap(start, end) do { } while (0)
> +#define flush_cache_vunmap(start, end) do { } while (0)
> +
> +struct page;
> +struct mm_struct;
> +struct vm_area_struct;
> +
> +/* see arch/microblaze/kernel/cache.c */
> +extern void __flush_icache_all(void);
> +extern void __flush_icache_range(unsigned long start, unsigned long
end);
> +extern void __flush_icache_page(struct vm_area_struct *vma, struct
page *page);
> +extern void __flush_icache_user_range(struct vm_area_struct *vma,
> + struct page *page,
> + unsigned long adr, int len);
> +extern void __flush_cache_sigtramp(unsigned long addr);
> +
> +extern void __flush_dcache_all(void);
> +extern void __flush_dcache_range(unsigned long start, unsigned long
end);
> +extern void __flush_dcache_page(struct vm_area_struct *vma, struct
page *page);
> +extern void __flush_dcache_user_range(struct vm_area_struct *vma,
> + struct page *page,
> + unsigned long adr, int len);
> +
> +extern inline void __flush_cache_all(void)
> +{
> + __flush_icache_all();
> + __flush_dcache_all();
> +}
> +
> +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
> +do { memcpy(dst, src, len); \
> + flush_icache_user_range(vma, page, vaddr, len); \
> +} while (0)
> +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
> + memcpy(dst, src, len)
> +
> +#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
> --
> 1.5.4.GIT
>
next prev parent reply other threads:[~2008-05-05 22:38 UTC|newest]
Thread overview: 192+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-04 11:40 Microblaze patches V2 monstr
2008-05-04 11:40 ` [PATCH 01/56] microblaze_v2: Kconfig patches monstr
2008-05-04 11:40 ` [PATCH 02/56] microblaze_v2: Makefiles for Microblaze cpu monstr
2008-05-05 1:47 ` John Williams
2008-05-06 8:51 ` Michal Simek
2008-05-04 11:40 ` [PATCH 03/56] microblaze_v2: Cpuinfo handling monstr
2008-05-05 1:52 ` John Williams
2008-05-05 14:19 ` Michal Simek
2008-05-04 11:40 ` [PATCH 04/56] microblaze_v2: Open firmware files monstr
2008-05-05 14:24 ` Grant Likely
2008-05-05 21:56 ` Stephen Neuendorffer
2008-05-06 7:27 ` Michal Simek
2008-05-07 16:04 ` [microblaze-uclinux] " Stephen Neuendorffer
2008-05-07 18:40 ` Michal Simek
2008-05-07 18:59 ` Grant Likely
2008-05-07 19:12 ` Michal Simek
2008-05-07 20:14 ` Stephen Neuendorffer
2008-05-04 11:40 ` [PATCH 05/56] microblaze_v2: Support for semaphores monstr
2008-05-04 11:40 ` [PATCH 06/56] microblaze_v2: exception handling monstr
2008-05-04 11:40 ` [PATCH 07/56] microblaze_v2: Signal support monstr
2008-05-04 19:52 ` Arnd Bergmann
2008-05-05 21:32 ` Stephen Neuendorffer
2008-05-05 23:33 ` John Williams
2008-05-06 0:13 ` Stephen Neuendorffer
2008-05-06 0:25 ` John Williams
2008-05-06 0:33 ` Stephen Neuendorffer
2008-05-06 9:41 ` Michal Simek
2008-05-04 11:40 ` [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function monstr
2008-05-05 1:58 ` John Williams
2008-05-05 14:20 ` Michal Simek
2008-05-05 14:20 ` Michal Simek
2008-05-07 7:04 ` Thomas Gleixner
2008-05-11 13:55 ` Michal Simek
2008-05-11 14:35 ` Thomas Gleixner
2008-05-11 21:55 ` Michal Simek
2008-05-11 21:55 ` Michal Simek
2008-05-04 11:40 ` [PATCH 09/56] microblaze_v2: cache support monstr
2008-05-05 2:09 ` John Williams
2008-05-05 17:37 ` [microblaze-uclinux] " Stephen Neuendorffer
2008-05-06 9:22 ` Michal Simek
2008-05-05 22:37 ` Stephen Neuendorffer [this message]
2008-05-04 11:40 ` [PATCH 10/56] microblaze_v2: Generic dts file for platforms monstr
2008-05-05 14:31 ` Grant Likely
2008-05-05 20:07 ` Michal Simek
2008-05-05 17:25 ` Stephen Neuendorffer
2008-05-05 23:16 ` John Williams
2008-05-05 23:32 ` Stephen Neuendorffer
2008-05-06 0:10 ` John Williams
2008-05-06 0:17 ` Stephen Neuendorffer
2008-05-06 7:50 ` Michal Simek
2008-05-06 7:38 ` Michal Simek
2008-05-04 11:41 ` [PATCH 11/56] microblaze_v2: kernel modules support monstr
2008-05-04 11:41 ` [PATCH 12/56] microblaze_v2: lmb support monstr
2008-05-05 2:11 ` John Williams
2008-05-05 21:32 ` Segher Boessenkool
2008-05-05 21:32 ` Segher Boessenkool
2008-05-04 11:41 ` [PATCH 13/56] microblaze_v2: PVR support, cpuinfo support monstr
2008-05-05 2:14 ` John Williams
2008-05-05 14:20 ` Michal Simek
2008-05-05 14:20 ` Michal Simek
2008-05-04 11:41 ` [PATCH 14/56] microblaze_v2: defconfig file monstr
2008-05-04 11:41 ` [PATCH 15/56] microblaze_v2: head.S + linker script monstr
2008-05-04 11:41 ` [PATCH 16/56] microblaze_v2: supported function for memory - kernel/lib monstr
2008-05-04 11:41 ` [PATCH 17/56] microblaze_v2: checksum support monstr
2008-05-04 19:59 ` Arnd Bergmann
2008-05-05 14:05 ` Michal Simek
2008-05-04 11:41 ` [PATCH 18/56] microblaze_v2: early_printk support monstr
2008-05-05 14:36 ` Grant Likely
2008-05-05 20:10 ` Michal Simek
2008-05-05 23:22 ` John Williams
2008-05-06 8:14 ` Michal Simek
2008-05-06 8:14 ` Michal Simek
2008-05-04 11:41 ` [PATCH 19/56] microblaze_v2: uaccess files monstr
2008-05-04 11:41 ` [PATCH 20/56] microblaze_v2: heartbeat file monstr
2008-05-04 11:41 ` [PATCH 21/56] microblaze_v2: setup.c - system setting monstr
2008-05-05 2:15 ` John Williams
2008-05-05 14:21 ` Michal Simek
2008-05-05 14:21 ` Michal Simek
2008-05-04 11:41 ` [PATCH 22/56] microblaze_v2: asm-offsets monstr
2008-05-04 11:41 ` [PATCH 23/56] microblaze_v2: process and init task function monstr
2008-05-04 11:41 ` [PATCH 24/56] microblaze_v2: time support monstr
2008-05-05 2:19 ` John Williams
2008-05-05 14:22 ` Michal Simek
2008-05-05 14:22 ` Michal Simek
2008-05-06 0:30 ` John Williams
2008-05-06 9:56 ` Michal Simek
2008-05-06 9:56 ` Michal Simek
2008-05-06 10:02 ` Michal Simek
2008-05-06 10:02 ` Michal Simek
2008-05-06 11:38 ` Arnd Bergmann
2008-05-06 13:26 ` Michal Simek
2008-05-06 22:50 ` John Williams
2008-05-06 14:28 ` Grant Likely
2008-05-06 14:28 ` Grant Likely
2008-05-06 16:36 ` Stephen Neuendorffer
2008-05-07 7:22 ` Thomas Gleixner
2008-05-04 11:41 ` [PATCH 25/56] microblaze_v2: ptrace support monstr
2008-05-04 11:41 ` [PATCH 26/56] microblaze_v2: traps support monstr
2008-05-04 11:41 ` [PATCH 27/56] microblaze_v2: support for a.out monstr
2008-05-04 11:41 ` [PATCH 28/56] microblaze_v2: memory inicialization, MMU, TLB monstr
2008-05-04 11:41 ` [PATCH 29/56] microblaze_v2: page.h, segment.h, unaligned.h monstr
2008-05-04 11:41 ` [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf monstr
2008-05-04 21:10 ` Arnd Bergmann
2008-05-04 11:41 ` [PATCH 31/56] microblaze_v2: bug headers files monstr
2008-05-04 11:41 ` [PATCH 32/56] microblaze_v2: definitions of types monstr
2008-05-04 21:28 ` Arnd Bergmann
2008-05-04 11:41 ` [PATCH 33/56] microblaze_v2: ioctl support monstr
2008-05-04 21:34 ` Arnd Bergmann
2008-05-05 14:06 ` Michal Simek
2008-05-05 14:06 ` Michal Simek
2008-05-04 11:41 ` [PATCH 34/56] microblaze_v2: io.h IO operations monstr
2008-05-04 11:41 ` [PATCH 35/56] microblaze_v2: headers for executables format FLAT, ELF monstr
2008-05-05 2:24 ` John Williams
2008-05-04 11:41 ` [PATCH 36/56] microblaze_v2: dma support monstr
2008-05-05 2:25 ` John Williams
2008-05-05 6:45 ` Geert Uytterhoeven
2008-05-05 6:45 ` Geert Uytterhoeven
2008-05-06 9:16 ` Michal Simek
2008-05-06 9:16 ` Michal Simek
2008-05-06 9:48 ` Geert Uytterhoeven
2008-05-06 9:53 ` Michal Simek
2008-05-06 9:53 ` Michal Simek
2008-05-06 11:17 ` Geert Uytterhoeven
2008-05-06 11:17 ` Geert Uytterhoeven
2008-05-06 11:24 ` Arnd Bergmann
2008-05-06 13:20 ` Michal Simek
2008-05-06 15:36 ` Arnd Bergmann
2008-05-07 6:24 ` Michal Simek
2008-05-07 7:17 ` Geert Uytterhoeven
2008-05-07 9:21 ` Arnd Bergmann
2008-05-07 18:43 ` Michal Simek
2008-05-07 18:43 ` Michal Simek
2008-05-04 11:41 ` [PATCH 37/56] microblaze_v2: headers for irq monstr
2008-05-07 7:26 ` Thomas Gleixner
2008-05-11 13:56 ` Michal Simek
2008-05-11 13:56 ` Michal Simek
2008-05-04 11:41 ` [PATCH 38/56] microblaze_v2: atomic.h bitops.h byteorder.h monstr
2008-05-04 21:58 ` Arnd Bergmann
2008-05-05 2:28 ` John Williams
2008-05-06 8:42 ` Michal Simek
2008-05-04 11:41 ` [PATCH 39/56] microblaze_v2: headers pgalloc.h pgtable.h monstr
2008-05-04 11:41 ` [PATCH 40/56] microblaze_v2: system.h pvr.h processor.h monstr
2008-05-04 11:41 ` [PATCH 41/56] microblaze_v2: clinkage.h linkage.h sections.h kmap_types.h monstr
2008-05-04 11:41 ` [PATCH 42/56] microblaze_v2: stats headers monstr
2008-05-04 22:31 ` Arnd Bergmann
2008-05-04 11:41 ` [PATCH 43/56] microblaze_v2: termbits.h termios.h monstr
2008-05-05 9:50 ` Arnd Bergmann
2008-05-05 9:50 ` Arnd Bergmann
2008-05-04 11:41 ` [PATCH 44/56] microblaze_v2: sigcontext.h siginfo.h monstr
2008-05-04 11:41 ` [PATCH 45/56] microblaze_v2: headers simple files - empty or redirect to asm-generic monstr
2008-05-05 2:34 ` John Williams
2008-05-05 15:10 ` Grant Likely
2008-05-06 9:02 ` Arnd Bergmann
2008-05-06 14:47 ` Stephen Rothwell
2008-05-06 15:23 ` Michal Simek
2008-05-06 15:23 ` Michal Simek
2008-05-06 15:38 ` Grant Likely
2008-05-06 16:21 ` Arnd Bergmann
2008-05-06 16:21 ` Arnd Bergmann
2008-05-07 18:46 ` Michal Simek
2008-05-04 11:41 ` [PATCH 46/56] microblaze_v2: headers files entry.h current.h mman.h registers.h sembuf.h monstr
2008-05-05 9:54 ` Arnd Bergmann
2008-05-06 9:07 ` Michal Simek
2008-05-06 20:57 ` Geert Uytterhoeven
2008-05-04 11:41 ` [PATCH 47/56] microblaze_v2: device.h param.h topology.h monstr
2008-05-04 22:37 ` Arnd Bergmann
2008-05-05 14:07 ` Michal Simek
2008-05-04 11:41 ` [PATCH 48/56] microblaze_v2: pool.h socket.h monstr
2008-05-04 22:39 ` Arnd Bergmann
2008-05-04 11:41 ` [PATCH 49/56] microblaze_v2: fcntl.h sockios.h ucontext.h monstr
2008-05-04 22:43 ` Arnd Bergmann
2008-05-05 14:08 ` Michal Simek
2008-05-04 11:41 ` [PATCH 50/56] microblaze_v2: setup.h string.h thread_info.h monstr
2008-05-05 2:39 ` John Williams
2008-05-05 14:24 ` Michal Simek
2008-05-05 14:24 ` Michal Simek
2008-05-04 11:41 ` [PATCH 51/56] microblaze_v2: Kbuild file monstr
2008-05-04 11:41 ` [PATCH 52/56] microblaze_v2: pci headers monstr
2008-05-04 22:45 ` Arnd Bergmann
2008-05-05 14:08 ` Michal Simek
2008-05-04 11:41 ` [PATCH 53/56] microblaze_v2: IPC headers monstr
2008-05-04 11:41 ` [PATCH 54/56] microblaze_v2: entry.S monstr
2008-05-04 11:41 ` [PATCH 55/56] microblaze_v2: sys_microblaze.c monstr
2008-05-04 11:41 ` [PATCH 56/56] microblaze_v2: syscall_table.S and unistd.h monstr
2008-05-04 11:41 ` monstr
2008-05-04 21:24 ` [PATCH 01/56] microblaze_v2: Kconfig patches Grant Likely
2008-05-05 6:36 ` Michal Simek
2008-05-05 1:42 ` John Williams
2008-05-05 6:46 ` Michal Simek
2008-05-05 14:16 ` Michal Simek
2008-05-05 2:30 ` Microblaze patches V2 John Williams
2008-05-05 7:02 ` Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080505223752.71802BD0054@mail54-dub.bigfish.com \
--to=stephen.neuendorffer@xilinx.com \
--cc=arnd@arndb.de \
--cc=drepper@redhat.com \
--cc=grant.likely@secretlab.ca \
--cc=john.williams@petalogix.com \
--cc=linnj@xilinx.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=microblaze-uclinux@itee.uq.edu.au \
--cc=monstr@monstr.eu \
--cc=monstr@seznam.cz \
--cc=will.newton@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox