arm64: mm: enable RCU fast_gup
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / include / asm / cachetype.h
index 7a2e0762cb4048a880d8b53cb552175cb0f09cb2..4c631a0a3609af25e68810afeb1a2ec03cbf3222 100644 (file)
 
 extern unsigned long __icache_flags;
 
+#define CCSIDR_EL1_LINESIZE_MASK       0x7
+#define CCSIDR_EL1_LINESIZE(x)         ((x) & CCSIDR_EL1_LINESIZE_MASK)
+
+#define CCSIDR_EL1_NUMSETS_SHIFT       13
+#define CCSIDR_EL1_NUMSETS_MASK                (0x7fff << CCSIDR_EL1_NUMSETS_SHIFT)
+#define CCSIDR_EL1_NUMSETS(x) \
+       (((x) & CCSIDR_EL1_NUMSETS_MASK) >> CCSIDR_EL1_NUMSETS_SHIFT)
+
+extern u64 __attribute_const__ icache_get_ccsidr(void);
+
+static inline int icache_get_linesize(void)
+{
+       return 16 << CCSIDR_EL1_LINESIZE(icache_get_ccsidr());
+}
+
+static inline int icache_get_numsets(void)
+{
+       return 1 + CCSIDR_EL1_NUMSETS(icache_get_ccsidr());
+}
+
 /*
  * Whilst the D-side always behaves as PIPT on AArch64, aliasing is
  * permitted in the I-cache.