Skip to content

Commit

Permalink
arm64: cache: Merge cachetype.h into cache.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Will Deacon authored and Catalin Marinas committed Mar 20, 2017
1 parent 155433c commit 02f7760
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 59 deletions.
31 changes: 30 additions & 1 deletion arch/arm64/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
#ifndef __ASM_CACHE_H
#define __ASM_CACHE_H

#include <asm/cachetype.h>
#include <asm/cputype.h>

#define CTR_L1IP_SHIFT 14
#define CTR_L1IP_MASK 3
#define CTR_CWG_SHIFT 24
#define CTR_CWG_MASK 15

#define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)

#define ICACHE_POLICY_VIPT 2
#define ICACHE_POLICY_PIPT 3

#define L1_CACHE_SHIFT 7
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
Expand All @@ -32,6 +42,25 @@

#ifndef __ASSEMBLY__

#include <linux/bitops.h>

#define ICACHEF_ALIASING 0
extern unsigned long __icache_flags;

/*
* Whilst the D-side always behaves as PIPT on AArch64, aliasing is
* permitted in the I-cache.
*/
static inline int icache_is_aliasing(void)
{
return test_bit(ICACHEF_ALIASING, &__icache_flags);
}

static inline u32 cache_type_cwg(void)
{
return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
}

#define __read_mostly __attribute__((__section__(".data..read_mostly")))

static inline int cache_line_size(void)
Expand Down
55 changes: 0 additions & 55 deletions arch/arm64/include/asm/cachetype.h

This file was deleted.

2 changes: 1 addition & 1 deletion arch/arm64/include/asm/kvm_mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ alternative_else_nop_endif
#else

#include <asm/pgalloc.h>
#include <asm/cachetype.h>
#include <asm/cache.h>
#include <asm/cacheflush.h>
#include <asm/mmu_context.h>
#include <asm/pgtable.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <asm/arch_timer.h>
#include <asm/cachetype.h>
#include <asm/cache.h>
#include <asm/cpu.h>
#include <asm/cputype.h>
#include <asm/cpufeature.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/pagemap.h>

#include <asm/cacheflush.h>
#include <asm/cachetype.h>
#include <asm/cache.h>
#include <asm/tlbflush.h>

void sync_icache_aliases(void *kaddr, unsigned long len)
Expand Down

0 comments on commit 02f7760

Please sign in to comment.