Skip to content

Commit 02f7760

Browse files
wildea01ctmarinas
authored andcommitted
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 <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent 155433c commit 02f7760

File tree

5 files changed

+33
-59
lines changed

5 files changed

+33
-59
lines changed

arch/arm64/include/asm/cache.h

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@
1616
#ifndef __ASM_CACHE_H
1717
#define __ASM_CACHE_H
1818

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
2030

2131
#define L1_CACHE_SHIFT 7
2232
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
@@ -32,6 +42,25 @@
3242

3343
#ifndef __ASSEMBLY__
3444

45+
#include <linux/bitops.h>
46+
47+
#define ICACHEF_ALIASING 0
48+
extern 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+
*/
54+
static inline int icache_is_aliasing(void)
55+
{
56+
return test_bit(ICACHEF_ALIASING, &__icache_flags);
57+
}
58+
59+
static inline u32 cache_type_cwg(void)
60+
{
61+
return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
62+
}
63+
3564
#define __read_mostly __attribute__((__section__(".data..read_mostly")))
3665

3766
static inline int cache_line_size(void)

arch/arm64/include/asm/cachetype.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

arch/arm64/include/asm/kvm_mmu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ alternative_else_nop_endif
108108
#else
109109

110110
#include <asm/pgalloc.h>
111-
#include <asm/cachetype.h>
111+
#include <asm/cache.h>
112112
#include <asm/cacheflush.h>
113113
#include <asm/mmu_context.h>
114114
#include <asm/pgtable.h>

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717
#include <asm/arch_timer.h>
18-
#include <asm/cachetype.h>
18+
#include <asm/cache.h>
1919
#include <asm/cpu.h>
2020
#include <asm/cputype.h>
2121
#include <asm/cpufeature.h>

arch/arm64/mm/flush.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <linux/pagemap.h>
2323

2424
#include <asm/cacheflush.h>
25-
#include <asm/cachetype.h>
25+
#include <asm/cache.h>
2626
#include <asm/tlbflush.h>
2727

2828
void sync_icache_aliases(void *kaddr, unsigned long len)

0 commit comments

Comments
 (0)