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

TOMOYO Linux Cross Reference
Linux/Documentation/arch/arm/tcm.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/arch/arm/tcm.rst (Version linux-6.12-rc7) and /Documentation/arch/i386/tcm.rst (Version linux-2.4.37.11)


  1 ==============================================    
  2 ARM TCM (Tightly-Coupled Memory) handling in L    
  3 ==============================================    
  4                                                   
  5 Written by Linus Walleij <linus.walleij@sterics    
  6                                                   
  7 Some ARM SoCs have a so-called TCM (Tightly-Co    
  8 This is usually just a few (4-64) KiB of RAM i    
  9 processor.                                        
 10                                                   
 11 Due to being embedded inside the CPU, the TCM     
 12 Harvard-architecture, so there is an ITCM (ins    
 13 and a DTCM (data TCM). The DTCM can not contai    
 14 instructions, but the ITCM can actually contai    
 15 The size of DTCM or ITCM is minimum 4KiB so th    
 16 minimum configuration is 4KiB ITCM and 4KiB DT    
 17                                                   
 18 ARM CPUs have special registers to read out st    
 19 location and size of TCM memories. arch/arm/in    
 20 defines a CPUID_TCM register that you can read    
 21 system control coprocessor. Documentation from    
 22 at http://infocenter.arm.com, search for "TCM     
 23 to see documents for all CPUs. Reading this re    
 24 determine if ITCM (bits 1-0) and/or DTCM (bit     
 25 in the machine.                                   
 26                                                   
 27 There is further a TCM region register (search    
 28 Registers" at the ARM site) that can report an    
 29 size of TCM memories at runtime. This is used     
 30 TCM location and size. Notice that this is not    
 31 actually move the physical location of the TCM    
 32 place you put it, it will mask any underlying     
 33 CPU so it is usually wise not to overlap any p    
 34 the TCM.                                          
 35                                                   
 36 The TCM memory can then be remapped to another    
 37 the MMU, but notice that the TCM is often used    
 38 the MMU is turned off. To avoid confusion the     
 39 implementation will map the TCM 1 to 1 from ph    
 40 memory in the location specified by the kernel    
 41 will map ITCM to 0xfffe0000 and on, and DTCM t    
 42 on, supporting a maximum of 32KiB of ITCM and     
 43                                                   
 44 Newer versions of the region registers also su    
 45 TCMs in two separate banks, so for example an     
 46 into two 4KiB banks with its own control regis    
 47 be able to lock and hide one of the banks for     
 48 world (TrustZone).                                
 49                                                   
 50 TCM is used for a few things:                     
 51                                                   
 52 - FIQ and other interrupt handlers that need d    
 53   timing and cannot wait for cache misses.        
 54                                                   
 55 - Idle loops where all external RAM is set to     
 56   retention mode, so only on-chip RAM is acces    
 57   the CPU and then we hang inside ITCM waiting    
 58   interrupt.                                      
 59                                                   
 60 - Other operations which implies shutting off     
 61   the external RAM controller.                    
 62                                                   
 63 There is an interface for using TCM on the ARM    
 64 in <asm/tcm.h>. Using this interface it is pos    
 65                                                   
 66 - Define the physical address and size of ITCM    
 67                                                   
 68 - Tag functions to be compiled into ITCM.         
 69                                                   
 70 - Tag data and constants to be allocated to DT    
 71                                                   
 72 - Have the remaining TCM RAM added to a specia    
 73   allocation pool with gen_pool_create() and g    
 74   and provide tcm_alloc() and tcm_free() for t    
 75   memory. Such a heap is great for things like    
 76   device state when shutting off device power     
 77                                                   
 78 A machine that has TCM memory shall select HAV    
 79 arch/arm/Kconfig for itself. Code that needs t    
 80 #include <asm/tcm.h>                              
 81                                                   
 82 Functions to go into itcm can be tagged like t    
 83 int __tcmfunc foo(int bar);                       
 84                                                   
 85 Since these are marked to become long_calls an    
 86 to have functions called locally inside the TC    
 87 wasting space, there is also the __tcmlocalfun    
 88 will make the call relative.                      
 89                                                   
 90 Variables to go into dtcm can be tagged like t    
 91                                                   
 92   int __tcmdata foo;                              
 93                                                   
 94 Constants can be tagged like this::               
 95                                                   
 96   int __tcmconst foo;                             
 97                                                   
 98 To put assembler into TCM just use::              
 99                                                   
100   .section ".tcm.text" or .section ".tcm.data"    
101                                                   
102 respectively.                                     
103                                                   
104 Example code::                                    
105                                                   
106   #include <asm/tcm.h>                            
107                                                   
108   /* Uninitialized data */                        
109   static u32 __tcmdata tcmvar;                    
110   /* Initialized data */                          
111   static u32 __tcmdata tcmassigned = 0x2BADBAB    
112   /* Constant */                                  
113   static const u32 __tcmconst tcmconst = 0xCAF    
114                                                   
115   static void __tcmlocalfunc tcm_to_tcm(void)     
116   {                                               
117         int i;                                    
118         for (i = 0; i < 100; i++)                 
119                 tcmvar ++;                        
120   }                                               
121                                                   
122   static void __tcmfunc hello_tcm(void)           
123   {                                               
124         /* Some abstract code that runs in ITC    
125         int i;                                    
126         for (i = 0; i < 100; i++) {               
127                 tcmvar ++;                        
128         }                                         
129         tcm_to_tcm();                             
130   }                                               
131                                                   
132   static void __init test_tcm(void)               
133   {                                               
134         u32 *tcmem;                               
135         int i;                                    
136                                                   
137         hello_tcm();                              
138         printk("Hello TCM executed from ITCM R    
139                                                   
140         printk("TCM variable from testrun: %u     
141         tcmvar = 0xDEADBEEFU;                     
142         printk("TCM variable: 0x%x @ %p\n", tc    
143                                                   
144         printk("TCM assigned variable: 0x%x @     
145                                                   
146         printk("TCM constant: 0x%x @ %p\n", tc    
147                                                   
148         /* Allocate some TCM memory from the p    
149         tcmem = tcm_alloc(20);                    
150         if (tcmem) {                              
151                 printk("TCM Allocated 20 bytes    
152                 tcmem[0] = 0xDEADBEEFU;           
153                 tcmem[1] = 0x2BADBABEU;           
154                 tcmem[2] = 0xCAFEBABEU;           
155                 tcmem[3] = 0xDEADBEEFU;           
156                 tcmem[4] = 0x2BADBABEU;           
157                 for (i = 0; i < 5; i++)           
158                         printk("TCM tcmem[%d]     
159                 tcm_free(tcmem, 20);              
160         }                                         
161   }                                               
                                                      

~ [ 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