Skip to content

Commit dda288d

Browse files
wildea01ctmarinas
authored andcommitted
arm64: cache: Identify VPIPT I-caches
Add support for detecting VPIPT I-caches, as introduced by ARMv8.2. Acked-by: Mark Rutland <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent 02f7760 commit dda288d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

arch/arm64/include/asm/cache.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

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

28+
#define ICACHE_POLICY_VPIPT 0
2829
#define ICACHE_POLICY_VIPT 2
2930
#define ICACHE_POLICY_PIPT 3
3031

@@ -45,6 +46,7 @@
4546
#include <linux/bitops.h>
4647

4748
#define ICACHEF_ALIASING 0
49+
#define ICACHEF_VPIPT 1
4850
extern unsigned long __icache_flags;
4951

5052
/*
@@ -56,6 +58,11 @@ static inline int icache_is_aliasing(void)
5658
return test_bit(ICACHEF_ALIASING, &__icache_flags);
5759
}
5860

61+
static inline int icache_is_vpipt(void)
62+
{
63+
return test_bit(ICACHEF_VPIPT, &__icache_flags);
64+
}
65+
5966
static inline u32 cache_type_cwg(void)
6067
{
6168
return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;

arch/arm64/kernel/cpuinfo.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static char *icache_policy_str[] = {
4646
[0 ... ICACHE_POLICY_PIPT] = "RESERVED/UNKNOWN",
4747
[ICACHE_POLICY_VIPT] = "VIPT",
4848
[ICACHE_POLICY_PIPT] = "PIPT",
49+
[ICACHE_POLICY_VPIPT] = "VPIPT",
4950
};
5051

5152
unsigned long __icache_flags;
@@ -291,6 +292,9 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
291292
switch (l1ip) {
292293
case ICACHE_POLICY_PIPT:
293294
break;
295+
case ICACHE_POLICY_VPIPT:
296+
set_bit(ICACHEF_VPIPT, &__icache_flags);
297+
break;
294298
default:
295299
/* Fallthrough */
296300
case ICACHE_POLICY_VIPT:

0 commit comments

Comments
 (0)