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

TOMOYO Linux Cross Reference
Linux/arch/s390/tools/gen_facilities.c

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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/s390/tools/gen_facilities.c (Architecture alpha) and /arch/m68k/tools/gen_facilities.c (Architecture m68k)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*                                                
  3  * Simple program to generate defines out of f    
  4  * numbering scheme from the Princples of Oper    
  5  * has bit number 0.                              
  6  *                                                
  7  *    Copyright IBM Corp. 2015, 2018              
  8  *                                                
  9  */                                               
 10                                                   
 11 #include <strings.h>                              
 12 #include <string.h>                               
 13 #include <stdlib.h>                               
 14 #include <stdio.h>                                
 15                                                   
 16 struct facility_def {                             
 17         char *name;                               
 18         int *bits;                                
 19 };                                                
 20                                                   
 21 static struct facility_def facility_defs[] = {    
 22         {                                         
 23                 /*                                
 24                  * FACILITIES_ALS contains the    
 25                  * required to run a kernel th    
 26                  * -march=<machine>.              
 27                  */                               
 28                 .name = "FACILITIES_ALS",         
 29                 .bits = (int[]){                  
 30                         0,  /* N3 instructions    
 31                         1,  /* z/Arch mode ins    
 32                         18, /* long displaceme    
 33                         21, /* extended-immedi    
 34                         25, /* store clock fas    
 35                         27, /* mvcos */           
 36                         32, /* compare and swa    
 37                         33, /* compare and swa    
 38                         34, /* general instruc    
 39                         35, /* execute extensi    
 40 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES            
 41                         45, /* fast-BCR, etc.     
 42 #endif                                            
 43 #ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES           
 44                         49, /* misc-instructio    
 45                         52, /* interlocked fac    
 46 #endif                                            
 47 #ifdef CONFIG_HAVE_MARCH_Z13_FEATURES             
 48                         53, /* load-and-zero-r    
 49                         129, /* vector */         
 50 #endif                                            
 51 #ifdef CONFIG_HAVE_MARCH_Z14_FEATURES             
 52                         58, /* miscellaneous-i    
 53 #endif                                            
 54 #ifdef CONFIG_HAVE_MARCH_Z15_FEATURES             
 55                         61, /* miscellaneous-i    
 56 #endif                                            
 57                         -1 /* END */              
 58                 }                                 
 59         },                                        
 60         {                                         
 61                 /*                                
 62                  * FACILITIES_KVM contains the    
 63                  * of the default facility mas    
 64                  * initial CPU model. If no CP    
 65                  * with the non-hypervisor man    
 66                  * guest facilities supported     
 67                  */                               
 68                 .name = "FACILITIES_KVM",         
 69                 .bits = (int[]){                  
 70                         0,  /* N3 instructions    
 71                         1,  /* z/Arch mode ins    
 72                         2,  /* z/Arch mode act    
 73                         3,  /* DAT-enhancement    
 74                         4,  /* idte segment ta    
 75                         5,  /* idte region tab    
 76                         6,  /* ASN-and-LX reus    
 77                         7,  /* stfle */           
 78                         8,  /* enhanced-DAT 1     
 79                         9,  /* sense-running-s    
 80                         10, /* conditional ssk    
 81                         13, /* ipte-range */      
 82                         14, /* nonquiescing ke    
 83                         73, /* transactional e    
 84                         75, /* access-exceptio    
 85                         76, /* msa extension 3    
 86                         77, /* msa extension 4    
 87                         78, /* enhanced-DAT 2     
 88                         130, /* instruction-ex    
 89                         131, /* enhanced-SOP 2    
 90                         139, /* multiple epoch    
 91                         146, /* msa extension     
 92                         150, /* enhanced sort     
 93                         151, /* deflate conver    
 94                         155, /* msa extension     
 95                         -1  /* END */             
 96                 }                                 
 97         },                                        
 98         {                                         
 99                 /*                                
100                  * FACILITIES_KVM_CPUMODEL con    
101                  * that can be enabled by CPU     
102                  * it. These facilities are no    
103                  * CPU model support.             
104                  */                               
105                                                   
106                 .name = "FACILITIES_KVM_CPUMOD    
107                 .bits = (int[]){                  
108                         12, /* AP Query Config    
109                         15, /* AP Facilities T    
110                         156, /* etoken facilit    
111                         165, /* nnpa facility     
112                         193, /* bear enhanceme    
113                         194, /* rdp enhancemen    
114                         196, /* processor acti    
115                         197, /* processor acti    
116                         -1  /* END */             
117                 }                                 
118         },                                        
119 };                                                
120                                                   
121 static void print_facility_list(struct facilit    
122 {                                                 
123         unsigned int high, bit, dword, i;         
124         unsigned long long *array;                
125                                                   
126         array = calloc(1, 8);                     
127         if (!array)                               
128                 exit(EXIT_FAILURE);               
129         high = 0;                                 
130         for (i = 0; def->bits[i] != -1; i++) {    
131                 bit = 63 - (def->bits[i] & 63)    
132                 dword = def->bits[i] / 64;        
133                 if (dword > high) {               
134                         array = realloc(array,    
135                         if (!array)               
136                                 exit(EXIT_FAIL    
137                         memset(array + high +     
138                         high = dword;             
139                 }                                 
140                 array[dword] |= 1ULL << bit;      
141         }                                         
142         printf("#define %s ", def->name);         
143         for (i = 0; i <= high; i++)               
144                 printf("_AC(0x%016llx,UL)%c",     
145         free(array);                              
146 }                                                 
147                                                   
148 static void print_facility_lists(void)            
149 {                                                 
150         unsigned int i;                           
151                                                   
152         for (i = 0; i < sizeof(facility_defs)     
153                 print_facility_list(&facility_    
154 }                                                 
155                                                   
156 int main(int argc, char **argv)                   
157 {                                                 
158         printf("#ifndef __ASM_S390_FACILITY_DE    
159         printf("#define __ASM_S390_FACILITY_DE    
160         printf("/*\n");                           
161         printf(" * DO NOT MODIFY.\n");            
162         printf(" *\n");                           
163         printf(" * This file was generated by     
164         printf(" */\n\n");                        
165         printf("#include <linux/const.h>\n\n")    
166         print_facility_lists();                   
167         printf("\n#endif\n");                     
168         return 0;                                 
169 }                                                 
170                                                   

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