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

TOMOYO Linux Cross Reference
Linux/arch/um/include/asm/cpufeature.h

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 /arch/um/include/asm/cpufeature.h (Architecture alpha) and /arch/m68k/include/asm-m68k/cpufeature.h (Architecture m68k)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _ASM_UM_CPUFEATURE_H                      
  3 #define _ASM_UM_CPUFEATURE_H                      
  4                                                   
  5 #include <asm/processor.h>                        
  6                                                   
  7 #if defined(__KERNEL__) && !defined(__ASSEMBLY    
  8                                                   
  9 #include <asm/asm.h>                              
 10 #include <linux/bitops.h>                         
 11                                                   
 12 extern const char * const x86_cap_flags[NCAPIN    
 13 extern const char * const x86_power_flags[32];    
 14 #define X86_CAP_FMT "%s"                          
 15 #define x86_cap_flag(flag) x86_cap_flags[flag]    
 16                                                   
 17 /*                                                
 18  * In order to save room, we index into this a    
 19  * X86_BUG_<name> - NCAPINTS*32.                  
 20  */                                               
 21 extern const char * const x86_bug_flags[NBUGIN    
 22                                                   
 23 #define test_cpu_cap(c, bit)                      
 24          test_bit(bit, (unsigned long *)((c)->    
 25                                                   
 26 /*                                                
 27  * There are 32 bits/features in each mask wor    
 28  * (selected with (bit>>5) give us the word nu    
 29  * bits give us the bit/feature number inside     
 30  * (1UL<<((bit)&31) gives us a mask for the fe    
 31  * see if it is set in the mask word.             
 32  */                                               
 33 #define CHECK_BIT_IN_MASK_WORD(maskname, word,    
 34         (((bit)>>5)==(word) && (1UL<<((bit)&31    
 35                                                   
 36 #define cpu_has(c, bit)                           
 37          test_cpu_cap(c, bit)                     
 38                                                   
 39 #define this_cpu_has(bit)                         
 40         (__builtin_constant_p(bit) && REQUIRED    
 41          x86_this_cpu_test_bit(bit, cpu_info.x    
 42                                                   
 43 /*                                                
 44  * This macro is for detection of features whi    
 45  * infrastructure to be used.  It may *not* di    
 46  * itself.  Use the cpu_has() family if you wa    
 47  * testing of CPU features, like in hypervisor    
 48  * supporting a possible guest feature where h    
 49  * is not relevant.                               
 50  */                                               
 51 #define cpu_feature_enabled(bit)        \         
 52         (__builtin_constant_p(bit) && DISABLED    
 53                                                   
 54 #define boot_cpu_has(bit)       cpu_has(&boot_    
 55                                                   
 56 #define set_cpu_cap(c, bit)     set_bit(bit, (    
 57                                                   
 58 extern void setup_clear_cpu_cap(unsigned int b    
 59                                                   
 60 #define setup_force_cpu_cap(bit) do { \           
 61         set_cpu_cap(&boot_cpu_data, bit);         
 62         set_bit(bit, (unsigned long *)cpu_caps    
 63 } while (0)                                       
 64                                                   
 65 #define setup_force_cpu_bug(bit) setup_force_c    
 66                                                   
 67 /*                                                
 68  * Static testing of CPU features. Used the sa    
 69  * statically patches the target code for addi    
 70  * static_cpu_has() only in fast paths, where     
 71  * means that the boot_cpu_has() variant is al    
 72  * majority of cases and you should stick to u    
 73  * only two instructions: a RIP-relative MOV a    
 74  */                                               
 75 static __always_inline bool _static_cpu_has(u1    
 76 {                                                 
 77         asm goto("1: jmp 6f\n"                    
 78                  "2:\n"                           
 79                  ".skip -(((5f-4f) - (2b-1b))     
 80                          "((5f-4f) - (2b-1b)),    
 81                  "3:\n"                           
 82                  ".section .altinstructions,\"    
 83                  " .long 1b - .\n"                
 84                  " .long 4f - .\n"                
 85                  " .word %P[always]\n"            
 86                  " .byte 3b - 1b\n"               
 87                  " .byte 5f - 4f\n"               
 88                  " .byte 3b - 2b\n"               
 89                  ".previous\n"                    
 90                  ".section .altinstr_replaceme    
 91                  "4: jmp %l[t_no]\n"              
 92                  "5:\n"                           
 93                  ".previous\n"                    
 94                  ".section .altinstructions,\"    
 95                  " .long 1b - .\n"                
 96                  " .long 0\n"                     
 97                  " .word %P[feature]\n"           
 98                  " .byte 3b - 1b\n"               
 99                  " .byte 0\n"                     
100                  " .byte 0\n"                     
101                  ".previous\n"                    
102                  ".section .altinstr_aux,\"ax\    
103                  "6:\n"                           
104                  " testb %[bitnum],%[cap_byte]    
105                  " jnz %l[t_yes]\n"               
106                  " jmp %l[t_no]\n"                
107                  ".previous\n"                    
108                  : : [feature]  "i" (bit),        
109                      [always]   "i" (X86_FEATU    
110                      [bitnum]   "i" (1 << (bit    
111                      [cap_byte] "m" (((const c    
112                  : : t_yes, t_no);                
113 t_yes:                                            
114         return true;                              
115 t_no:                                             
116         return false;                             
117 }                                                 
118                                                   
119 #define static_cpu_has(bit)                       
120 (                                                 
121         __builtin_constant_p(boot_cpu_has(bit)    
122                 boot_cpu_has(bit) :               
123                 _static_cpu_has(bit)              
124 )                                                 
125                                                   
126 #define cpu_has_bug(c, bit)             cpu_ha    
127 #define set_cpu_bug(c, bit)             set_cp    
128                                                   
129 #define static_cpu_has_bug(bit)         static    
130 #define boot_cpu_has_bug(bit)           cpu_ha    
131 #define boot_cpu_set_bug(bit)           set_cp    
132                                                   
133 #define MAX_CPU_FEATURES                (NCAPI    
134 #define cpu_have_feature                boot_c    
135                                                   
136 #define CPU_FEATURE_TYPEFMT             "x86,v    
137 #define CPU_FEATURE_TYPEVAL             boot_c    
138                                         boot_c    
139                                                   
140 #endif /* defined(__KERNEL__) && !defined(__AS    
141 #endif /* _ASM_UM_CPUFEATURE_H */                 
142                                                   

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