Commit dda288d7 authored by Will Deacon's avatar Will Deacon Committed by Catalin Marinas

arm64: cache: Identify VPIPT I-caches

Add support for detecting VPIPT I-caches, as introduced by ARMv8.2.
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 02f7760e
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK) #define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)
#define ICACHE_POLICY_VPIPT 0
#define ICACHE_POLICY_VIPT 2 #define ICACHE_POLICY_VIPT 2
#define ICACHE_POLICY_PIPT 3 #define ICACHE_POLICY_PIPT 3
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#define ICACHEF_ALIASING 0 #define ICACHEF_ALIASING 0
#define ICACHEF_VPIPT 1
extern unsigned long __icache_flags; extern unsigned long __icache_flags;
/* /*
...@@ -56,6 +58,11 @@ static inline int icache_is_aliasing(void) ...@@ -56,6 +58,11 @@ static inline int icache_is_aliasing(void)
return test_bit(ICACHEF_ALIASING, &__icache_flags); return test_bit(ICACHEF_ALIASING, &__icache_flags);
} }
static inline int icache_is_vpipt(void)
{
return test_bit(ICACHEF_VPIPT, &__icache_flags);
}
static inline u32 cache_type_cwg(void) static inline u32 cache_type_cwg(void)
{ {
return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK; return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
......
...@@ -46,6 +46,7 @@ static char *icache_policy_str[] = { ...@@ -46,6 +46,7 @@ static char *icache_policy_str[] = {
[0 ... ICACHE_POLICY_PIPT] = "RESERVED/UNKNOWN", [0 ... ICACHE_POLICY_PIPT] = "RESERVED/UNKNOWN",
[ICACHE_POLICY_VIPT] = "VIPT", [ICACHE_POLICY_VIPT] = "VIPT",
[ICACHE_POLICY_PIPT] = "PIPT", [ICACHE_POLICY_PIPT] = "PIPT",
[ICACHE_POLICY_VPIPT] = "VPIPT",
}; };
unsigned long __icache_flags; unsigned long __icache_flags;
...@@ -291,6 +292,9 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info) ...@@ -291,6 +292,9 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
switch (l1ip) { switch (l1ip) {
case ICACHE_POLICY_PIPT: case ICACHE_POLICY_PIPT:
break; break;
case ICACHE_POLICY_VPIPT:
set_bit(ICACHEF_VPIPT, &__icache_flags);
break;
default: default:
/* Fallthrough */ /* Fallthrough */
case ICACHE_POLICY_VIPT: case ICACHE_POLICY_VIPT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment