~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/include/asm/cachetype.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __ASM_ARM_CACHETYPE_H
  3 #define __ASM_ARM_CACHETYPE_H
  4 
  5 #define CACHEID_VIVT                    (1 << 0)
  6 #define CACHEID_VIPT_NONALIASING        (1 << 1)
  7 #define CACHEID_VIPT_ALIASING           (1 << 2)
  8 #define CACHEID_VIPT                    (CACHEID_VIPT_ALIASING|CACHEID_VIPT_NONALIASING)
  9 #define CACHEID_ASID_TAGGED             (1 << 3)
 10 #define CACHEID_VIPT_I_ALIASING         (1 << 4)
 11 #define CACHEID_PIPT                    (1 << 5)
 12 
 13 extern unsigned int cacheid;
 14 
 15 #define cache_is_vivt()                 cacheid_is(CACHEID_VIVT)
 16 #define cache_is_vipt()                 cacheid_is(CACHEID_VIPT)
 17 #define cache_is_vipt_nonaliasing()     cacheid_is(CACHEID_VIPT_NONALIASING)
 18 #define cache_is_vipt_aliasing()        cacheid_is(CACHEID_VIPT_ALIASING)
 19 #define icache_is_vivt_asid_tagged()    cacheid_is(CACHEID_ASID_TAGGED)
 20 #define icache_is_vipt_aliasing()       cacheid_is(CACHEID_VIPT_I_ALIASING)
 21 #define icache_is_pipt()                cacheid_is(CACHEID_PIPT)
 22 
 23 #define cpu_dcache_is_aliasing()        (cache_is_vivt() || cache_is_vipt_aliasing())
 24 
 25 /*
 26  * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture
 27  * Mask out support which will never be present on newer CPUs.
 28  * - v6+ is never VIVT
 29  * - v7+ VIPT never aliases on D-side
 30  */
 31 #if __LINUX_ARM_ARCH__ >= 7
 32 #define __CACHEID_ARCH_MIN      (CACHEID_VIPT_NONALIASING |\
 33                                  CACHEID_ASID_TAGGED |\
 34                                  CACHEID_VIPT_I_ALIASING |\
 35                                  CACHEID_PIPT)
 36 #elif __LINUX_ARM_ARCH__ >= 6
 37 #define __CACHEID_ARCH_MIN      (~CACHEID_VIVT)
 38 #else
 39 #define __CACHEID_ARCH_MIN      (~0)
 40 #endif
 41 
 42 /*
 43  * Mask out support which isn't configured
 44  */
 45 #if defined(CONFIG_CPU_CACHE_VIVT) && !defined(CONFIG_CPU_CACHE_VIPT)
 46 #define __CACHEID_ALWAYS        (CACHEID_VIVT)
 47 #define __CACHEID_NEVER         (~CACHEID_VIVT)
 48 #elif !defined(CONFIG_CPU_CACHE_VIVT) && defined(CONFIG_CPU_CACHE_VIPT)
 49 #define __CACHEID_ALWAYS        (0)
 50 #define __CACHEID_NEVER         (CACHEID_VIVT)
 51 #else
 52 #define __CACHEID_ALWAYS        (0)
 53 #define __CACHEID_NEVER         (0)
 54 #endif
 55 
 56 static inline unsigned int __attribute__((pure)) cacheid_is(unsigned int mask)
 57 {
 58         return (__CACHEID_ALWAYS & mask) |
 59                (~__CACHEID_NEVER & __CACHEID_ARCH_MIN & mask & cacheid);
 60 }
 61 
 62 #define CSSELR_ICACHE   1
 63 #define CSSELR_DCACHE   0
 64 
 65 #define CSSELR_L1       (0 << 1)
 66 #define CSSELR_L2       (1 << 1)
 67 #define CSSELR_L3       (2 << 1)
 68 #define CSSELR_L4       (3 << 1)
 69 #define CSSELR_L5       (4 << 1)
 70 #define CSSELR_L6       (5 << 1)
 71 #define CSSELR_L7       (6 << 1)
 72 
 73 #ifndef CONFIG_CPU_V7M
 74 static inline void set_csselr(unsigned int cache_selector)
 75 {
 76         asm volatile("mcr p15, 2, %0, c0, c0, 0" : : "r" (cache_selector));
 77 }
 78 
 79 static inline unsigned int read_ccsidr(void)
 80 {
 81         unsigned int val;
 82 
 83         asm volatile("mrc p15, 1, %0, c0, c0, 0" : "=r" (val));
 84         return val;
 85 }
 86 #else /* CONFIG_CPU_V7M */
 87 #include <linux/io.h>
 88 #include "asm/v7m.h"
 89 
 90 static inline void set_csselr(unsigned int cache_selector)
 91 {
 92         writel(cache_selector, BASEADDR_V7M_SCB + V7M_SCB_CTR);
 93 }
 94 
 95 static inline unsigned int read_ccsidr(void)
 96 {
 97         return readl(BASEADDR_V7M_SCB + V7M_SCB_CCSIDR);
 98 }
 99 #endif
100 
101 #endif
102 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php