Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Simple program to generate defines out of facility lists that use the bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * numbering scheme from the Princples of Operations: most significant bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * has bit number 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *    Copyright IBM Corp. 2015, 2018
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <strings.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <stdlib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct facility_def {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	int *bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) static struct facility_def facility_defs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 		 * FACILITIES_ALS contains the list of facilities that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 		 * required to run a kernel that is compiled e.g. with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 		 * -march=<machine>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 		.name = "FACILITIES_ALS",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 		.bits = (int[]){
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #ifdef CONFIG_HAVE_MARCH_Z900_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 			0,  /* N3 instructions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 			1,  /* z/Arch mode installed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #ifdef CONFIG_HAVE_MARCH_Z990_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 			18, /* long displacement facility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 			21, /* extended-immediate facility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 			25, /* store clock fast */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 			27, /* mvcos */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 			32, /* compare and swap and store */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 			33, /* compare and swap and store 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 			34, /* general instructions extension */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 			35, /* execute extensions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 			45, /* fast-BCR, etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 			49, /* misc-instruction-extensions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 			52, /* interlocked facility 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #ifdef CONFIG_HAVE_MARCH_Z13_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 			53, /* load-and-zero-rightmost-byte, etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #ifdef CONFIG_HAVE_MARCH_Z14_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 			58, /* miscellaneous-instruction-extension 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #ifdef CONFIG_HAVE_MARCH_Z15_FEATURES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 			61, /* miscellaneous-instruction-extension 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 			-1 /* END */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		 * FACILITIES_KVM contains the list of facilities that are part
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		 * of the default facility mask and list that are passed to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		 * initial CPU model. If no CPU model is used, this, together
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		 * with the non-hypervisor managed bits, is the maximum list of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		 * guest facilities supported by KVM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		.name = "FACILITIES_KVM",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		.bits = (int[]){
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 			0,  /* N3 instructions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 			1,  /* z/Arch mode installed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 			2,  /* z/Arch mode active */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			3,  /* DAT-enhancement */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 			4,  /* idte segment table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			5,  /* idte region table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			6,  /* ASN-and-LX reuse */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			7,  /* stfle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			8,  /* enhanced-DAT 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			9,  /* sense-running-status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 			10, /* conditional sske */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 			13, /* ipte-range */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			14, /* nonquiescing key-setting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 			73, /* transactional execution */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 			75, /* access-exception-fetch/store indication */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 			76, /* msa extension 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			77, /* msa extension 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 			78, /* enhanced-DAT 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 			130, /* instruction-execution-protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			131, /* enhanced-SOP 2 and side-effect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			139, /* multiple epoch facility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 			146, /* msa extension 8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 			150, /* enhanced sort */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			151, /* deflate conversion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			155, /* msa extension 9 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 			-1  /* END */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		 * FACILITIES_KVM_CPUMODEL contains the list of facilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		 * that can be enabled by CPU model code if the host supports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		 * it. These facilities are not passed to the guest without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		 * CPU model support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		.name = "FACILITIES_KVM_CPUMODEL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		.bits = (int[]){
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			12, /* AP Query Configuration Information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			15, /* AP Facilities Test */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			156, /* etoken facility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			-1  /* END */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static void print_facility_list(struct facility_def *def)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	unsigned int high, bit, dword, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	unsigned long long *array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	array = calloc(1, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	if (!array)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		exit(EXIT_FAILURE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	high = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	for (i = 0; def->bits[i] != -1; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		bit = 63 - (def->bits[i] & 63);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		dword = def->bits[i] / 64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		if (dword > high) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			array = realloc(array, (dword + 1) * 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			if (!array)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 				exit(EXIT_FAILURE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			memset(array + high + 1, 0, (dword - high) * 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			high = dword;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		array[dword] |= 1ULL << bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	printf("#define %s ", def->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	for (i = 0; i <= high; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		printf("_AC(0x%016llx,UL)%c", array[i], i < high ? ',' : '\n');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	free(array);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static void print_facility_lists(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	for (i = 0; i < sizeof(facility_defs) / sizeof(facility_defs[0]); i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		print_facility_list(&facility_defs[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) int main(int argc, char **argv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	printf("#ifndef __ASM_S390_FACILITY_DEFS__\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	printf("#define __ASM_S390_FACILITY_DEFS__\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	printf("/*\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	printf(" * DO NOT MODIFY.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	printf(" *\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	printf(" * This file was generated by %s\n", __FILE__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	printf(" */\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	printf("#include <linux/const.h>\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	print_facility_lists();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	printf("\n#endif\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }