Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/zcrypt: Remove deprecated zcrypt proc interface.

This patch removes the deprecated zcrypt proc interface.
It is outdated and deprecated and does not support the
latest 3 generations of CEX cards.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Harald Freudenberger and committed by
Martin Schwidefsky
71cbbff8 2a80786d

-231
-231
drivers/s390/crypto/zcrypt_api.c
··· 18 18 #include <linux/interrupt.h> 19 19 #include <linux/miscdevice.h> 20 20 #include <linux/fs.h> 21 - #include <linux/proc_fs.h> 22 - #include <linux/seq_file.h> 23 21 #include <linux/compat.h> 24 22 #include <linux/slab.h> 25 23 #include <linux/atomic.h> ··· 737 739 return requestq_count; 738 740 } 739 741 740 - static int zcrypt_count_type(int type) 741 - { 742 - struct zcrypt_card *zc; 743 - struct zcrypt_queue *zq; 744 - int device_count; 745 - 746 - device_count = 0; 747 - spin_lock(&zcrypt_list_lock); 748 - for_each_zcrypt_card(zc) { 749 - if (zc->card->id != type) 750 - continue; 751 - for_each_zcrypt_queue(zq, zc) { 752 - if (AP_QID_QUEUE(zq->queue->qid) != ap_domain_index) 753 - continue; 754 - device_count++; 755 - } 756 - } 757 - spin_unlock(&zcrypt_list_lock); 758 - return device_count; 759 - } 760 - 761 742 static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd, 762 743 unsigned long arg) 763 744 { ··· 1069 1092 .fops = &zcrypt_fops, 1070 1093 }; 1071 1094 1072 - /* 1073 - * Deprecated /proc entry support. 1074 - */ 1075 - static struct proc_dir_entry *zcrypt_entry; 1076 - 1077 - static void sprintcl(struct seq_file *m, unsigned char *addr, unsigned int len) 1078 - { 1079 - int i; 1080 - 1081 - for (i = 0; i < len; i++) 1082 - seq_printf(m, "%01x", (unsigned int) addr[i]); 1083 - seq_putc(m, ' '); 1084 - } 1085 - 1086 - static void sprintrw(struct seq_file *m, unsigned char *addr, unsigned int len) 1087 - { 1088 - int inl, c, cx; 1089 - 1090 - seq_printf(m, " "); 1091 - inl = 0; 1092 - for (c = 0; c < (len / 16); c++) { 1093 - sprintcl(m, addr+inl, 16); 1094 - inl += 16; 1095 - } 1096 - cx = len%16; 1097 - if (cx) { 1098 - sprintcl(m, addr+inl, cx); 1099 - inl += cx; 1100 - } 1101 - seq_putc(m, '\n'); 1102 - } 1103 - 1104 - static void sprinthx(unsigned char *title, struct seq_file *m, 1105 - unsigned char *addr, unsigned int len) 1106 - { 1107 - int inl, r, rx; 1108 - 1109 - seq_printf(m, "\n%s\n", title); 1110 - inl = 0; 1111 - for (r = 0; r < (len / 64); r++) { 1112 - sprintrw(m, addr+inl, 64); 1113 - inl += 64; 1114 - } 1115 - rx = len % 64; 1116 - if (rx) { 1117 - sprintrw(m, addr+inl, rx); 1118 - inl += rx; 1119 - } 1120 - seq_putc(m, '\n'); 1121 - } 1122 - 1123 - static void sprinthx4(unsigned char *title, struct seq_file *m, 1124 - unsigned int *array, unsigned int len) 1125 - { 1126 - seq_printf(m, "\n%s\n", title); 1127 - seq_hex_dump(m, " ", DUMP_PREFIX_NONE, 32, 4, array, len, false); 1128 - seq_putc(m, '\n'); 1129 - } 1130 - 1131 - static int zcrypt_proc_show(struct seq_file *m, void *v) 1132 - { 1133 - char workarea[sizeof(int) * AP_DEVICES]; 1134 - 1135 - seq_printf(m, "\nzcrypt version: %d.%d.%d\n", 1136 - ZCRYPT_VERSION, ZCRYPT_RELEASE, ZCRYPT_VARIANT); 1137 - seq_printf(m, "Cryptographic domain: %d\n", ap_domain_index); 1138 - seq_printf(m, "Total device count: %d\n", zcrypt_device_count); 1139 - seq_printf(m, "PCICA count: %d\n", zcrypt_count_type(ZCRYPT_PCICA)); 1140 - seq_printf(m, "PCICC count: %d\n", zcrypt_count_type(ZCRYPT_PCICC)); 1141 - seq_printf(m, "PCIXCC MCL2 count: %d\n", 1142 - zcrypt_count_type(ZCRYPT_PCIXCC_MCL2)); 1143 - seq_printf(m, "PCIXCC MCL3 count: %d\n", 1144 - zcrypt_count_type(ZCRYPT_PCIXCC_MCL3)); 1145 - seq_printf(m, "CEX2C count: %d\n", zcrypt_count_type(ZCRYPT_CEX2C)); 1146 - seq_printf(m, "CEX2A count: %d\n", zcrypt_count_type(ZCRYPT_CEX2A)); 1147 - seq_printf(m, "CEX3C count: %d\n", zcrypt_count_type(ZCRYPT_CEX3C)); 1148 - seq_printf(m, "CEX3A count: %d\n", zcrypt_count_type(ZCRYPT_CEX3A)); 1149 - seq_printf(m, "requestq count: %d\n", zcrypt_requestq_count()); 1150 - seq_printf(m, "pendingq count: %d\n", zcrypt_pendingq_count()); 1151 - seq_printf(m, "Total open handles: %d\n\n", 1152 - atomic_read(&zcrypt_open_count)); 1153 - zcrypt_status_mask(workarea); 1154 - sprinthx("Online devices: 1=PCICA 2=PCICC 3=PCIXCC(MCL2) " 1155 - "4=PCIXCC(MCL3) 5=CEX2C 6=CEX2A 7=CEX3C 8=CEX3A", 1156 - m, workarea, AP_DEVICES); 1157 - zcrypt_qdepth_mask(workarea); 1158 - sprinthx("Waiting work element counts", m, workarea, AP_DEVICES); 1159 - zcrypt_perdev_reqcnt((int *) workarea); 1160 - sprinthx4("Per-device successfully completed request counts", 1161 - m, (unsigned int *) workarea, AP_DEVICES); 1162 - return 0; 1163 - } 1164 - 1165 - static int zcrypt_proc_open(struct inode *inode, struct file *file) 1166 - { 1167 - return single_open(file, zcrypt_proc_show, NULL); 1168 - } 1169 - 1170 - static void zcrypt_disable_card(int index) 1171 - { 1172 - struct zcrypt_card *zc; 1173 - struct zcrypt_queue *zq; 1174 - 1175 - spin_lock(&zcrypt_list_lock); 1176 - for_each_zcrypt_card(zc) { 1177 - for_each_zcrypt_queue(zq, zc) { 1178 - if (AP_QID_QUEUE(zq->queue->qid) != ap_domain_index) 1179 - continue; 1180 - zq->online = 0; 1181 - ap_flush_queue(zq->queue); 1182 - } 1183 - } 1184 - spin_unlock(&zcrypt_list_lock); 1185 - } 1186 - 1187 - static void zcrypt_enable_card(int index) 1188 - { 1189 - struct zcrypt_card *zc; 1190 - struct zcrypt_queue *zq; 1191 - 1192 - spin_lock(&zcrypt_list_lock); 1193 - for_each_zcrypt_card(zc) { 1194 - for_each_zcrypt_queue(zq, zc) { 1195 - if (AP_QID_QUEUE(zq->queue->qid) != ap_domain_index) 1196 - continue; 1197 - zq->online = 1; 1198 - ap_flush_queue(zq->queue); 1199 - } 1200 - } 1201 - spin_unlock(&zcrypt_list_lock); 1202 - } 1203 - 1204 - static ssize_t zcrypt_proc_write(struct file *file, const char __user *buffer, 1205 - size_t count, loff_t *pos) 1206 - { 1207 - unsigned char *lbuf, *ptr; 1208 - size_t local_count; 1209 - int j; 1210 - 1211 - if (count <= 0) 1212 - return 0; 1213 - 1214 - #define LBUFSIZE 1200UL 1215 - lbuf = kmalloc(LBUFSIZE, GFP_KERNEL); 1216 - if (!lbuf) 1217 - return 0; 1218 - 1219 - local_count = min(LBUFSIZE - 1, count); 1220 - if (copy_from_user(lbuf, buffer, local_count) != 0) { 1221 - kfree(lbuf); 1222 - return -EFAULT; 1223 - } 1224 - lbuf[local_count] = '\0'; 1225 - 1226 - ptr = strstr(lbuf, "Online devices"); 1227 - if (!ptr) 1228 - goto out; 1229 - ptr = strstr(ptr, "\n"); 1230 - if (!ptr) 1231 - goto out; 1232 - ptr++; 1233 - 1234 - if (strstr(ptr, "Waiting work element counts") == NULL) 1235 - goto out; 1236 - 1237 - for (j = 0; j < 64 && *ptr; ptr++) { 1238 - /* 1239 - * '0' for no device, '1' for PCICA, '2' for PCICC, 1240 - * '3' for PCIXCC_MCL2, '4' for PCIXCC_MCL3, 1241 - * '5' for CEX2C and '6' for CEX2A' 1242 - * '7' for CEX3C and '8' for CEX3A 1243 - */ 1244 - if (*ptr >= '0' && *ptr <= '8') 1245 - j++; 1246 - else if (*ptr == 'd' || *ptr == 'D') 1247 - zcrypt_disable_card(j++); 1248 - else if (*ptr == 'e' || *ptr == 'E') 1249 - zcrypt_enable_card(j++); 1250 - else if (*ptr != ' ' && *ptr != '\t') 1251 - break; 1252 - } 1253 - out: 1254 - kfree(lbuf); 1255 - return count; 1256 - } 1257 - 1258 - static const struct file_operations zcrypt_proc_fops = { 1259 - .owner = THIS_MODULE, 1260 - .open = zcrypt_proc_open, 1261 - .read = seq_read, 1262 - .llseek = seq_lseek, 1263 - .release = single_release, 1264 - .write = zcrypt_proc_write, 1265 - }; 1266 - 1267 1095 static int zcrypt_rng_device_count; 1268 1096 static u32 *zcrypt_rng_buffer; 1269 1097 static int zcrypt_rng_buffer_index; ··· 1170 1388 if (rc) 1171 1389 goto out; 1172 1390 1173 - atomic_set(&zcrypt_rescan_req, 0); 1174 - 1175 1391 /* Register the request sprayer. */ 1176 1392 rc = misc_register(&zcrypt_misc_device); 1177 1393 if (rc < 0) 1178 1394 goto out; 1179 1395 1180 - /* Set up the proc file system */ 1181 - zcrypt_entry = proc_create("driver/z90crypt", 0644, NULL, 1182 - &zcrypt_proc_fops); 1183 - if (!zcrypt_entry) { 1184 - rc = -ENOMEM; 1185 - goto out_misc; 1186 - } 1187 - 1188 1396 zcrypt_msgtype6_init(); 1189 1397 zcrypt_msgtype50_init(); 1190 1398 return 0; 1191 1399 1192 - out_misc: 1193 - misc_deregister(&zcrypt_misc_device); 1194 1400 out: 1195 1401 return rc; 1196 1402 } ··· 1190 1420 */ 1191 1421 void __exit zcrypt_api_exit(void) 1192 1422 { 1193 - remove_proc_entry("driver/z90crypt", NULL); 1194 1423 misc_deregister(&zcrypt_misc_device); 1195 1424 zcrypt_msgtype6_exit(); 1196 1425 zcrypt_msgtype50_exit();