Skip to content

Commit 2d69fbf

Browse files
riscv: fix build break after macro-to-function conversion in generic cacheflush.h
Commit c296d4d ("asm-generic: fix a compilation warning") converted the various flush_*cache_* macros in asm-generic/cacheflush.h to static inline functions. This breaks RISC-V builds, since RISC-V's cacheflush.h includes the generic cacheflush.h and then undefines the macros to be overridden. Fix by copying the subset of the no-op functions that are reused from the generic cacheflush.h into the RISC-V cacheflush.h, and dropping the include of the generic cacheflush.h. Fixes: c296d4d ("asm-generic: fix a compilation warning") Signed-off-by: Paul Walmsley <[email protected]> Cc: Qian Cai <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Linus Torvalds <[email protected]>
1 parent 0f327f2 commit 2d69fbf

File tree

1 file changed

+59
-4
lines changed

1 file changed

+59
-4
lines changed

arch/riscv/include/asm/cacheflush.h

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,66 @@
66
#ifndef _ASM_RISCV_CACHEFLUSH_H
77
#define _ASM_RISCV_CACHEFLUSH_H
88

9-
#include <asm-generic/cacheflush.h>
9+
#include <linux/mm.h>
1010

11-
#undef flush_icache_range
12-
#undef flush_icache_user_range
13-
#undef flush_dcache_page
11+
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
12+
13+
/*
14+
* The cache doesn't need to be flushed when TLB entries change when
15+
* the cache is mapped to physical memory, not virtual memory
16+
*/
17+
static inline void flush_cache_all(void)
18+
{
19+
}
20+
21+
static inline void flush_cache_mm(struct mm_struct *mm)
22+
{
23+
}
24+
25+
static inline void flush_cache_dup_mm(struct mm_struct *mm)
26+
{
27+
}
28+
29+
static inline void flush_cache_range(struct vm_area_struct *vma,
30+
unsigned long start,
31+
unsigned long end)
32+
{
33+
}
34+
35+
static inline void flush_cache_page(struct vm_area_struct *vma,
36+
unsigned long vmaddr,
37+
unsigned long pfn)
38+
{
39+
}
40+
41+
static inline void flush_dcache_mmap_lock(struct address_space *mapping)
42+
{
43+
}
44+
45+
static inline void flush_dcache_mmap_unlock(struct address_space *mapping)
46+
{
47+
}
48+
49+
static inline void flush_icache_page(struct vm_area_struct *vma,
50+
struct page *page)
51+
{
52+
}
53+
54+
static inline void flush_cache_vmap(unsigned long start, unsigned long end)
55+
{
56+
}
57+
58+
static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
59+
{
60+
}
61+
62+
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
63+
do { \
64+
memcpy(dst, src, len); \
65+
flush_icache_user_range(vma, page, vaddr, len); \
66+
} while (0)
67+
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
68+
memcpy(dst, src, len)
1469

1570
static inline void local_flush_icache_all(void)
1671
{

0 commit comments

Comments
 (0)