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

TOMOYO Linux Cross Reference
Linux/arch/mips/include/asm/mipsmtregs.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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 ] ~

Diff markup

Differences between /arch/mips/include/asm/mipsmtregs.h (Architecture mips) and /arch/ppc/include/asm-ppc/mipsmtregs.h (Architecture ppc)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 /*                                                
  3  * MT regs definitions, follows on from mipsre    
  4  * Copyright (C) 2004 - 2005 MIPS Technologies    
  5  * Elizabeth Clarke et. al.                       
  6  *                                                
  7  */                                               
  8 #ifndef _ASM_MIPSMTREGS_H                         
  9 #define _ASM_MIPSMTREGS_H                         
 10                                                   
 11 #include <asm/mipsregs.h>                         
 12                                                   
 13 #ifndef __ASSEMBLY__                              
 14                                                   
 15 /*                                                
 16  * C macros                                       
 17  */                                               
 18                                                   
 19 #define read_c0_mvpcontrol()            __read    
 20 #define write_c0_mvpcontrol(val)        __writ    
 21                                                   
 22 #define read_c0_mvpconf0()              __read    
 23 #define read_c0_mvpconf1()              __read    
 24                                                   
 25 #define read_c0_vpecontrol()            __read    
 26 #define write_c0_vpecontrol(val)        __writ    
 27                                                   
 28 #define read_c0_vpeconf0()              __read    
 29 #define write_c0_vpeconf0(val)          __writ    
 30                                                   
 31 #define read_c0_vpeconf1()              __read    
 32 #define write_c0_vpeconf1(val)          __writ    
 33                                                   
 34 #define read_c0_tcstatus()              __read    
 35 #define write_c0_tcstatus(val)          __writ    
 36                                                   
 37 #define read_c0_tcbind()                __read    
 38                                                   
 39 #define write_c0_tchalt(val)            __writ    
 40                                                   
 41 #define read_c0_tccontext()             __read    
 42 #define write_c0_tccontext(val)         __writ    
 43                                                   
 44 #else /* Assembly */                              
 45 /*                                                
 46  * Macros for use in assembly language code       
 47  */                                               
 48                                                   
 49 #define CP0_MVPCONTROL          $0, 1             
 50 #define CP0_MVPCONF0            $0, 2             
 51 #define CP0_MVPCONF1            $0, 3             
 52 #define CP0_VPECONTROL          $1, 1             
 53 #define CP0_VPECONF0            $1, 2             
 54 #define CP0_VPECONF1            $1, 3             
 55 #define CP0_YQMASK              $1, 4             
 56 #define CP0_VPESCHEDULE         $1, 5             
 57 #define CP0_VPESCHEFBK          $1, 6             
 58 #define CP0_TCSTATUS            $2, 1             
 59 #define CP0_TCBIND              $2, 2             
 60 #define CP0_TCRESTART           $2, 3             
 61 #define CP0_TCHALT              $2, 4             
 62 #define CP0_TCCONTEXT           $2, 5             
 63 #define CP0_TCSCHEDULE          $2, 6             
 64 #define CP0_TCSCHEFBK           $2, 7             
 65 #define CP0_SRSCONF0            $6, 1             
 66 #define CP0_SRSCONF1            $6, 2             
 67 #define CP0_SRSCONF2            $6, 3             
 68 #define CP0_SRSCONF3            $6, 4             
 69 #define CP0_SRSCONF4            $6, 5             
 70                                                   
 71 #endif                                            
 72                                                   
 73 /* MVPControl fields */                           
 74 #define MVPCONTROL_EVP          (_ULCAST_(1))     
 75                                                   
 76 #define MVPCONTROL_VPC_SHIFT    1                 
 77 #define MVPCONTROL_VPC          (_ULCAST_(1) <    
 78                                                   
 79 #define MVPCONTROL_STLB_SHIFT   2                 
 80 #define MVPCONTROL_STLB         (_ULCAST_(1) <    
 81                                                   
 82                                                   
 83 /* MVPConf0 fields */                             
 84 #define MVPCONF0_PTC_SHIFT      0                 
 85 #define MVPCONF0_PTC            ( _ULCAST_(0xf    
 86 #define MVPCONF0_PVPE_SHIFT     10                
 87 #define MVPCONF0_PVPE           ( _ULCAST_(0xf    
 88 #define MVPCONF0_TCA_SHIFT      15                
 89 #define MVPCONF0_TCA            ( _ULCAST_(1)     
 90 #define MVPCONF0_PTLBE_SHIFT    16                
 91 #define MVPCONF0_PTLBE          (_ULCAST_(0x3f    
 92 #define MVPCONF0_TLBS_SHIFT     29                
 93 #define MVPCONF0_TLBS           (_ULCAST_(1) <    
 94 #define MVPCONF0_M_SHIFT        31                
 95 #define MVPCONF0_M              (_ULCAST_(0x1)    
 96                                                   
 97                                                   
 98 /* config3 fields */                              
 99 #define CONFIG3_MT_SHIFT        2                 
100 #define CONFIG3_MT              (_ULCAST_(1) <    
101                                                   
102                                                   
103 /* VPEControl fields (per VPE) */                 
104 #define VPECONTROL_TARGTC       (_ULCAST_(0xff    
105                                                   
106 #define VPECONTROL_TE_SHIFT     15                
107 #define VPECONTROL_TE           (_ULCAST_(1) <    
108 #define VPECONTROL_EXCPT_SHIFT  16                
109 #define VPECONTROL_EXCPT        (_ULCAST_(0x7)    
110                                                   
111 /* Thread Exception Codes for EXCPT field */      
112 #define THREX_TU                0                 
113 #define THREX_TO                1                 
114 #define THREX_IYQ               2                 
115 #define THREX_GSX               3                 
116 #define THREX_YSCH              4                 
117 #define THREX_GSSCH             5                 
118                                                   
119 #define VPECONTROL_GSI_SHIFT    20                
120 #define VPECONTROL_GSI          (_ULCAST_(1) <    
121 #define VPECONTROL_YSI_SHIFT    21                
122 #define VPECONTROL_YSI          (_ULCAST_(1) <    
123                                                   
124 /* VPEConf0 fields (per VPE) */                   
125 #define VPECONF0_VPA_SHIFT      0                 
126 #define VPECONF0_VPA            (_ULCAST_(1) <    
127 #define VPECONF0_MVP_SHIFT      1                 
128 #define VPECONF0_MVP            (_ULCAST_(1) <    
129 #define VPECONF0_XTC_SHIFT      21                
130 #define VPECONF0_XTC            (_ULCAST_(0xff    
131                                                   
132 /* VPEConf1 fields (per VPE) */                   
133 #define VPECONF1_NCP1_SHIFT     0                 
134 #define VPECONF1_NCP1           (_ULCAST_(0xff    
135 #define VPECONF1_NCP2_SHIFT     10                
136 #define VPECONF1_NCP2           (_ULCAST_(0xff    
137 #define VPECONF1_NCX_SHIFT      20                
138 #define VPECONF1_NCX            (_ULCAST_(0xff    
139                                                   
140 /* TCStatus fields (per TC) */                    
141 #define TCSTATUS_TASID          (_ULCAST_(0xff    
142 #define TCSTATUS_IXMT_SHIFT     10                
143 #define TCSTATUS_IXMT           (_ULCAST_(1) <    
144 #define TCSTATUS_TKSU_SHIFT     11                
145 #define TCSTATUS_TKSU           (_ULCAST_(3) <    
146 #define TCSTATUS_A_SHIFT        13                
147 #define TCSTATUS_A              (_ULCAST_(1) <    
148 #define TCSTATUS_DA_SHIFT       15                
149 #define TCSTATUS_DA             (_ULCAST_(1) <    
150 #define TCSTATUS_DT_SHIFT       20                
151 #define TCSTATUS_DT             (_ULCAST_(1) <    
152 #define TCSTATUS_TDS_SHIFT      21                
153 #define TCSTATUS_TDS            (_ULCAST_(1) <    
154 #define TCSTATUS_TSST_SHIFT     22                
155 #define TCSTATUS_TSST           (_ULCAST_(1) <    
156 #define TCSTATUS_RNST_SHIFT     23                
157 #define TCSTATUS_RNST           (_ULCAST_(3) <    
158 /* Codes for RNST */                              
159 #define TC_RUNNING              0                 
160 #define TC_WAITING              1                 
161 #define TC_YIELDING             2                 
162 #define TC_GATED                3                 
163                                                   
164 #define TCSTATUS_TMX_SHIFT      27                
165 #define TCSTATUS_TMX            (_ULCAST_(1) <    
166 /* TCStatus TCU bits can use same definitions/    
167                                                   
168 /* TCBind */                                      
169 #define TCBIND_CURVPE_SHIFT     0                 
170 #define TCBIND_CURVPE           (_ULCAST_(0xf)    
171                                                   
172 #define TCBIND_CURTC_SHIFT      21                
173                                                   
174 #define TCBIND_CURTC            (_ULCAST_(0xff    
175                                                   
176 /* TCHalt */                                      
177 #define TCHALT_H                (_ULCAST_(1))     
178                                                   
179 #ifndef __ASSEMBLY__                              
180                                                   
181 static inline unsigned core_nvpes(void)           
182 {                                                 
183         unsigned conf0;                           
184                                                   
185         if (!cpu_has_mipsmt)                      
186                 return 1;                         
187                                                   
188         conf0 = read_c0_mvpconf0();               
189         return ((conf0 & MVPCONF0_PVPE) >> MVP    
190 }                                                 
191                                                   
192 #define _ASM_SET_DVPE                             
193         _ASM_MACRO_1R(dvpe, rt,                   
194                         _ASM_INSN_IF_MIPS(0x41    
195                         _ASM_INSN32_IF_MM(0x00    
196 #define _ASM_UNSET_DVPE ".purgem dvpe\n\t"        
197                                                   
198 static inline unsigned int dvpe(void)             
199 {                                                 
200         int res = 0;                              
201                                                   
202         __asm__ __volatile__(                     
203         "       .set    push                      
204         "       .set    "MIPS_ISA_LEVEL"          
205         _ASM_SET_DVPE                             
206         "       dvpe    %0                        
207         "       ehb                               
208         _ASM_UNSET_DVPE                           
209         "       .set    pop                       
210         : "=r" (res));                            
211                                                   
212         instruction_hazard();                     
213                                                   
214         return res;                               
215 }                                                 
216                                                   
217 #define _ASM_SET_EVPE                             
218         _ASM_MACRO_1R(evpe, rt,                   
219                         _ASM_INSN_IF_MIPS(0x41    
220                         _ASM_INSN32_IF_MM(0x00    
221 #define _ASM_UNSET_EVPE ".purgem evpe\n\t"        
222                                                   
223 static inline void __raw_evpe(void)               
224 {                                                 
225         __asm__ __volatile__(                     
226         "       .set    push                      
227         "       .set    "MIPS_ISA_LEVEL"          
228         _ASM_SET_EVPE                             
229         "       evpe    $0                        
230         "       ehb                               
231         _ASM_UNSET_EVPE                           
232         "       .set    pop                       
233 }                                                 
234                                                   
235 /* Enable virtual processor execution if previ    
236    EVPE_ENABLE to force */                        
237                                                   
238 #define EVPE_ENABLE MVPCONTROL_EVP                
239                                                   
240 static inline void evpe(int previous)             
241 {                                                 
242         if ((previous & MVPCONTROL_EVP))          
243                 __raw_evpe();                     
244 }                                                 
245                                                   
246 #define _ASM_SET_DMT                              
247         _ASM_MACRO_1R(dmt, rt,                    
248                         _ASM_INSN_IF_MIPS(0x41    
249                         _ASM_INSN32_IF_MM(0x00    
250 #define _ASM_UNSET_DMT ".purgem dmt\n\t"          
251                                                   
252 static inline unsigned int dmt(void)              
253 {                                                 
254         int res;                                  
255                                                   
256         __asm__ __volatile__(                     
257         "       .set    push                      
258         "       .set    "MIPS_ISA_LEVEL"          
259         _ASM_SET_DMT                              
260         "       dmt     %0                        
261         "       ehb                               
262         _ASM_UNSET_DMT                            
263         "       .set    pop                       
264         : "=r" (res));                            
265                                                   
266         instruction_hazard();                     
267                                                   
268         return res;                               
269 }                                                 
270                                                   
271 #define _ASM_SET_EMT                              
272         _ASM_MACRO_1R(emt, rt,                    
273                         _ASM_INSN_IF_MIPS(0x41    
274                         _ASM_INSN32_IF_MM(0x00    
275 #define _ASM_UNSET_EMT ".purgem emt\n\t"          
276                                                   
277 static inline void __raw_emt(void)                
278 {                                                 
279         __asm__ __volatile__(                     
280         "       .set    push                      
281         "       .set    "MIPS_ISA_LEVEL"          
282         _ASM_SET_EMT                              
283         "       emt     $0                        
284         _ASM_UNSET_EMT                            
285         "       ehb                               
286         "       .set    pop");                    
287 }                                                 
288                                                   
289 /* enable multi-threaded execution if previous    
290    EMT_ENABLE to force */                         
291                                                   
292 #define EMT_ENABLE VPECONTROL_TE                  
293                                                   
294 static inline void emt(int previous)              
295 {                                                 
296         if ((previous & EMT_ENABLE))              
297                 __raw_emt();                      
298 }                                                 
299                                                   
300 static inline void ehb(void)                      
301 {                                                 
302         __asm__ __volatile__(                     
303         "       .set    push                      
304         "       .set    "MIPS_ISA_LEVEL"          
305         "       ehb                               
306         "       .set    pop                       
307 }                                                 
308                                                   
309 #define _ASM_SET_MFTC0                            
310         _ASM_MACRO_2R_1S(mftc0, rs, rt, sel,      
311                         _ASM_INSN_IF_MIPS(0x41    
312                                 __rs << 11 | \    
313                         _ASM_INSN32_IF_MM(0x00    
314                                 __rs << 16 | \    
315 #define _ASM_UNSET_MFTC0 ".purgem mftc0\n\t"      
316                                                   
317 #define mftc0(rt, sel)                            
318 ({                                                
319         unsigned long   __res;                    
320                                                   
321         __asm__ __volatile__(                     
322         "       .set    push                      
323         "       .set    "MIPS_ISA_LEVEL"          
324         _ASM_SET_MFTC0                            
325         "       mftc0   %0, " #rt ", " #sel "     
326         _ASM_UNSET_MFTC0                          
327         "       .set    pop                       
328         : "=r" (__res));                          
329                                                   
330         __res;                                    
331 })                                                
332                                                   
333 #define _ASM_SET_MFTGPR                           
334         _ASM_MACRO_2R(mftgpr, rs, rt,             
335                         _ASM_INSN_IF_MIPS(0x41    
336                                 __rs << 11)       
337                         _ASM_INSN32_IF_MM(0x00    
338                                 __rs << 16))      
339 #define _ASM_UNSET_MFTGPR ".purgem mftgpr\n\t"    
340                                                   
341 #define mftgpr(rt)                                
342 ({                                                
343         unsigned long __res;                      
344                                                   
345         __asm__ __volatile__(                     
346         "       .set    push                      
347         "       .set    "MIPS_ISA_LEVEL"          
348         _ASM_SET_MFTGPR                           
349         "       mftgpr  %0," #rt "                
350         _ASM_UNSET_MFTGPR                         
351         "       .set    pop                       
352         : "=r" (__res));                          
353                                                   
354         __res;                                    
355 })                                                
356                                                   
357 #define mftr(rt, u, sel)                          
358 ({                                                
359         unsigned long __res;                      
360                                                   
361         __asm__ __volatile__(                     
362         "       mftr    %0, " #rt ", " #u ", "    
363         : "=r" (__res));                          
364                                                   
365         __res;                                    
366 })                                                
367                                                   
368 #define _ASM_SET_MTTGPR                           
369         _ASM_MACRO_2R(mttgpr, rt, rs,             
370                         _ASM_INSN_IF_MIPS(0x41    
371                                 __rs << 11)       
372                         _ASM_INSN32_IF_MM(0x00    
373                                 __rs << 16))      
374 #define _ASM_UNSET_MTTGPR ".purgem mttgpr\n\t"    
375                                                   
376 #define mttgpr(rs, v)                             
377 do {                                              
378         __asm__ __volatile__(                     
379         "       .set    push                      
380         "       .set    "MIPS_ISA_LEVEL"          
381         _ASM_SET_MTTGPR                           
382         "       mttgpr  %0, " #rs "               
383         _ASM_UNSET_MTTGPR                         
384         "       .set    pop                       
385         : : "r" (v));                             
386 } while (0)                                       
387                                                   
388 #define _ASM_SET_MTTC0                            
389         _ASM_MACRO_2R_1S(mttc0, rt, rs, sel,      
390                         _ASM_INSN_IF_MIPS(0x41    
391                                 __rs << 11 | \    
392                         _ASM_INSN32_IF_MM(0x00    
393                                 __rs << 16 | \    
394 #define _ASM_UNSET_MTTC0 ".purgem mttc0\n\t"      
395                                                   
396 #define mttc0(rs, sel, v)                         
397 ({                                                
398         __asm__ __volatile__(                     
399         "       .set    push                      
400         "       .set    "MIPS_ISA_LEVEL"          
401         _ASM_SET_MTTC0                            
402         "       mttc0   %0," #rs ", " #sel "      
403         _ASM_UNSET_MTTC0                          
404         "       .set    pop                       
405         :                                         
406         : "r" (v));                               
407 })                                                
408                                                   
409                                                   
410 #define mttr(rd, u, sel, v)                       
411 ({                                                
412         __asm__ __volatile__(                     
413         "mttr   %0," #rd ", " #u ", " #sel        
414         : : "r" (v));                             
415 })                                                
416                                                   
417                                                   
418 #define settc(tc)                                 
419 do {                                              
420         write_c0_vpecontrol((read_c0_vpecontro    
421         ehb();                                    
422 } while (0)                                       
423                                                   
424                                                   
425 /* you *must* set the target tc (settc) before    
426 #define read_vpe_c0_vpecontrol()        mftc0(    
427 #define write_vpe_c0_vpecontrol(val)    mttc0(    
428 #define read_vpe_c0_vpeconf0()          mftc0(    
429 #define write_vpe_c0_vpeconf0(val)      mttc0(    
430 #define read_vpe_c0_vpeconf1()          mftc0(    
431 #define write_vpe_c0_vpeconf1(val)      mttc0(    
432 #define read_vpe_c0_count()             mftc0(    
433 #define write_vpe_c0_count(val)         mttc0(    
434 #define read_vpe_c0_status()            mftc0(    
435 #define write_vpe_c0_status(val)        mttc0(    
436 #define read_vpe_c0_cause()             mftc0(    
437 #define write_vpe_c0_cause(val)         mttc0(    
438 #define read_vpe_c0_config()            mftc0(    
439 #define write_vpe_c0_config(val)        mttc0(    
440 #define read_vpe_c0_config1()           mftc0(    
441 #define write_vpe_c0_config1(val)       mttc0(    
442 #define read_vpe_c0_config7()           mftc0(    
443 #define write_vpe_c0_config7(val)       mttc0(    
444 #define read_vpe_c0_ebase()             mftc0(    
445 #define write_vpe_c0_ebase(val)         mttc0(    
446 #define write_vpe_c0_compare(val)       mttc0(    
447 #define read_vpe_c0_badvaddr()          mftc0(    
448 #define read_vpe_c0_epc()               mftc0(    
449 #define write_vpe_c0_epc(val)           mttc0(    
450                                                   
451                                                   
452 /* TC */                                          
453 #define read_tc_c0_tcstatus()           mftc0(    
454 #define write_tc_c0_tcstatus(val)       mttc0(    
455 #define read_tc_c0_tcbind()             mftc0(    
456 #define write_tc_c0_tcbind(val)         mttc0(    
457 #define read_tc_c0_tcrestart()          mftc0(    
458 #define write_tc_c0_tcrestart(val)      mttc0(    
459 #define read_tc_c0_tchalt()             mftc0(    
460 #define write_tc_c0_tchalt(val)         mttc0(    
461 #define read_tc_c0_tccontext()          mftc0(    
462 #define write_tc_c0_tccontext(val)      mttc0(    
463                                                   
464 /* GPR */                                         
465 #define read_tc_gpr_sp()                mftgpr    
466 #define write_tc_gpr_sp(val)            mttgpr    
467 #define read_tc_gpr_gp()                mftgpr    
468 #define write_tc_gpr_gp(val)            mttgpr    
469                                                   
470 __BUILD_SET_C0(mvpcontrol)                        
471                                                   
472 #endif /* Not __ASSEMBLY__ */                     
473                                                   
474 #endif                                            
475                                                   

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