Skip to content

Commit 5c0541e

Browse files
x-y-zakpm00
authored andcommitted
mm: introduce cpu_icache_is_aliasing() across all architectures
In commit eacd0e9 ("ARC: [mm] Lazy D-cache flush (non aliasing VIPT)"), arc adds the need to flush dcache to make icache see the code page change. This also requires special handling for clear_user_(high)page(). Introduce cpu_icache_is_aliasing() to make MM code query special clear_user_(high)page() easier. This will be used by the following commit. Link: https://lkml.kernel.org/r/20241209182326.2955963-1-ziy@nvidia.com Fixes: 5708d96 ("mm: avoid zeroing user movable page twice with init_on_alloc=1") Signed-off-by: Zi Yan <ziy@nvidia.com> Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Alexander Potapenko <glider@google.com> Cc: David Hildenbrand <david@redhat.com> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Kees Cook <keescook@chromium.org> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Miaohe Lin <linmiaohe@huawei.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Vineet Gupta <vgupta@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 31c5629 commit 5c0541e

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

arch/arc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
config ARC
77
def_bool y
88
select ARC_TIMERS
9+
select ARCH_HAS_CPU_CACHE_ALIASING
910
select ARCH_HAS_CACHE_LINE_SIZE
1011
select ARCH_HAS_DEBUG_VM_PGTABLE
1112
select ARCH_HAS_DMA_PREP_COHERENT

arch/arc/include/asm/cachetype.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __ASM_ARC_CACHETYPE_H
3+
#define __ASM_ARC_CACHETYPE_H
4+
5+
#define cpu_dcache_is_aliasing() false
6+
#define cpu_icache_is_aliasing() true
7+
8+
#endif

include/linux/cacheinfo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,14 @@ static inline int get_cpu_cacheinfo_id(int cpu, int level)
155155

156156
#ifndef CONFIG_ARCH_HAS_CPU_CACHE_ALIASING
157157
#define cpu_dcache_is_aliasing() false
158+
#define cpu_icache_is_aliasing() cpu_dcache_is_aliasing()
158159
#else
159160
#include <asm/cachetype.h>
161+
162+
#ifndef cpu_icache_is_aliasing
163+
#define cpu_icache_is_aliasing() cpu_dcache_is_aliasing()
164+
#endif
165+
160166
#endif
161167

162168
#endif /* _LINUX_CACHEINFO_H */

0 commit comments

Comments
 (0)