aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2017-03-10 15:32:23 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2017-03-20 12:16:59 -0400
commit02f7760e6e5c3d726cd9622749cdae17c571b9a3 (patch)
treec32de8d89af2f29b2ef15e6e4d88916d6db93427
parent155433cb365ee4666bdf7c3c7bc2978b17be36a4 (diff)
arm64: cache: Merge cachetype.h into cache.h
cachetype.h and cache.h are small and both obviously related to caches. Merge them together to reduce clutter. Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/include/asm/cache.h31
-rw-r--r--arch/arm64/include/asm/cachetype.h55
-rw-r--r--arch/arm64/include/asm/kvm_mmu.h2
-rw-r--r--arch/arm64/kernel/cpuinfo.c2
-rw-r--r--arch/arm64/mm/flush.c2
5 files changed, 33 insertions, 59 deletions
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 5082b30bc2c0..7acb52634299 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -16,7 +16,17 @@
16#ifndef __ASM_CACHE_H 16#ifndef __ASM_CACHE_H
17#define __ASM_CACHE_H 17#define __ASM_CACHE_H
18 18
19#include <asm/cachetype.h> 19#include <asm/cputype.h>
20
21#define CTR_L1IP_SHIFT 14
22#define CTR_L1IP_MASK 3
23#define CTR_CWG_SHIFT 24
24#define CTR_CWG_MASK 15
25
26#define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)
27
28#define ICACHE_POLICY_VIPT 2
29#define ICACHE_POLICY_PIPT 3
20 30
21#define L1_CACHE_SHIFT 7 31#define L1_CACHE_SHIFT 7
22#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 32#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
@@ -32,6 +42,25 @@
32 42
33#ifndef __ASSEMBLY__ 43#ifndef __ASSEMBLY__
34 44
45#include <linux/bitops.h>
46
47#define ICACHEF_ALIASING 0
48extern unsigned long __icache_flags;
49
50/*
51 * Whilst the D-side always behaves as PIPT on AArch64, aliasing is
52 * permitted in the I-cache.
53 */
54static inline int icache_is_aliasing(void)
55{
56 return test_bit(ICACHEF_ALIASING, &__icache_flags);
57}
58
59static inline u32 cache_type_cwg(void)
60{
61 return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
62}
63
35#define __read_mostly __attribute__((__section__(".data..read_mostly"))) 64#define __read_mostly __attribute__((__section__(".data..read_mostly")))
36 65
37static inline int cache_line_size(void) 66static inline int cache_line_size(void)
diff --git a/arch/arm64/include/asm/cachetype.h b/arch/arm64/include/asm/cachetype.h
deleted file mode 100644
index fbab37c669a0..000000000000
--- a/arch/arm64/include/asm/cachetype.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __ASM_CACHETYPE_H
17#define __ASM_CACHETYPE_H
18
19#include <asm/cputype.h>
20
21#define CTR_L1IP_SHIFT 14
22#define CTR_L1IP_MASK 3
23#define CTR_CWG_SHIFT 24
24#define CTR_CWG_MASK 15
25
26#define ICACHE_POLICY_VIPT 2
27#define ICACHE_POLICY_PIPT 3
28
29#ifndef __ASSEMBLY__
30
31#include <linux/bitops.h>
32
33#define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)
34
35#define ICACHEF_ALIASING 0
36
37extern unsigned long __icache_flags;
38
39/*
40 * Whilst the D-side always behaves as PIPT on AArch64, aliasing is
41 * permitted in the I-cache.
42 */
43static inline int icache_is_aliasing(void)
44{
45 return test_bit(ICACHEF_ALIASING, &__icache_flags);
46}
47
48static inline u32 cache_type_cwg(void)
49{
50 return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
51}
52
53#endif /* __ASSEMBLY__ */
54
55#endif /* __ASM_CACHETYPE_H */
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 4be5773d4606..dc3624d8b9db 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -108,7 +108,7 @@ alternative_else_nop_endif
108#else 108#else
109 109
110#include <asm/pgalloc.h> 110#include <asm/pgalloc.h>
111#include <asm/cachetype.h> 111#include <asm/cache.h>
112#include <asm/cacheflush.h> 112#include <asm/cacheflush.h>
113#include <asm/mmu_context.h> 113#include <asm/mmu_context.h>
114#include <asm/pgtable.h> 114#include <asm/pgtable.h>
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index efe74ecc9738..260b54f415b8 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -15,7 +15,7 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17#include <asm/arch_timer.h> 17#include <asm/arch_timer.h>
18#include <asm/cachetype.h> 18#include <asm/cache.h>
19#include <asm/cpu.h> 19#include <asm/cpu.h>
20#include <asm/cputype.h> 20#include <asm/cputype.h>
21#include <asm/cpufeature.h> 21#include <asm/cpufeature.h>
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index 1e968222a544..21a8d828cbf4 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -22,7 +22,7 @@
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23 23
24#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
25#include <asm/cachetype.h> 25#include <asm/cache.h>
26#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
27 27
28void sync_icache_aliases(void *kaddr, unsigned long len) 28void sync_icache_aliases(void *kaddr, unsigned long len)