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

s390/zcrypt: zcrypt device driver cleanup

Some cleanup in the s390 zcrypt device driver:
- Removed fragments of pcixx crypto card code. This code
can't be reached anymore because the hardware detection
function does not recognize crypto cards < CEX2 since
commit f56545430736 ("s390/zcrypt: Introduce QACT support
for AP bus devices.")
- Rename of some files and driver names which where still
reflecting pcixx support to cex2a/cex2c.
- Removed all the zcrypt version strings in the file headers.
There is only one place left - the zcrypt.h header file is
now the only place for zcrypt device driver version info.
- Zcrypt version pump up from 2.2.0 to 2.2.1.

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

authored by

Harald Freudenberger and committed by
Martin Schwidefsky
ee410de8 78333d1f

+117 -191
+2 -2
arch/s390/include/uapi/asm/zcrypt.h
··· 2 2 /* 3 3 * include/asm-s390/zcrypt.h 4 4 * 5 - * zcrypt 2.2.0 (user-visible header) 5 + * zcrypt 2.2.1 (user-visible header) 6 6 * 7 7 * Copyright IBM Corp. 2001, 2018 8 8 * Author(s): Robert Burroughs ··· 16 16 17 17 #define ZCRYPT_VERSION 2 18 18 #define ZCRYPT_RELEASE 2 19 - #define ZCRYPT_VARIANT 0 19 + #define ZCRYPT_VARIANT 1 20 20 21 21 #include <linux/ioctl.h> 22 22 #include <linux/compiler.h>
+1 -1
drivers/s390/crypto/Makefile
··· 10 10 zcrypt-objs += zcrypt_msgtype6.o zcrypt_msgtype50.o 11 11 obj-$(CONFIG_ZCRYPT) += zcrypt.o 12 12 # adapter drivers depend on ap.o and zcrypt.o 13 - obj-$(CONFIG_ZCRYPT) += zcrypt_pcixcc.o zcrypt_cex2a.o zcrypt_cex4.o 13 + obj-$(CONFIG_ZCRYPT) += zcrypt_cex2c.o zcrypt_cex2a.o zcrypt_cex4.o 14 14 15 15 # pkey kernel module 16 16 pkey-objs := pkey_api.o
-2
drivers/s390/crypto/zcrypt_api.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * zcrypt 2.2.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2018 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com)
+2 -13
drivers/s390/crypto/zcrypt_api.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 - * Copyright IBM Corp. 2001, 2012 3 + * Copyright IBM Corp. 2001, 2018 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) 8 6 * Cornelia Huck <cornelia.huck@de.ibm.com> ··· 20 22 #include "ap_bus.h" 21 23 22 24 /** 23 - * device type for an actual device is either PCICA, PCICC, PCIXCC_MCL2, 24 - * PCIXCC_MCL3, CEX2C, or CEX2A 25 - * 26 - * NOTE: PCIXCC_MCL3 refers to a PCIXCC with May 2004 version of Licensed 27 - * Internal Code (LIC) (EC J12220 level 29). 28 - * PCIXCC_MCL2 refers to any LIC before this level. 25 + * Supported device types 29 26 */ 30 - #define ZCRYPT_PCICA 1 31 - #define ZCRYPT_PCICC 2 32 - #define ZCRYPT_PCIXCC_MCL2 3 33 - #define ZCRYPT_PCIXCC_MCL3 4 34 27 #define ZCRYPT_CEX2C 5 35 28 #define ZCRYPT_CEX2A 6 36 29 #define ZCRYPT_CEX3C 7
-2
drivers/s390/crypto/zcrypt_card.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2012 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com)
-2
drivers/s390/crypto/zcrypt_cca_key.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2006 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com)
+2 -4
drivers/s390/crypto/zcrypt_cex2a.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2012 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) ··· 41 43 #define CEX3A_CLEANUP_TIME CEX2A_CLEANUP_TIME 42 44 43 45 MODULE_AUTHOR("IBM Corporation"); 44 - MODULE_DESCRIPTION("CEX2A Cryptographic Coprocessor device driver, " \ 45 - "Copyright IBM Corp. 2001, 2012"); 46 + MODULE_DESCRIPTION("CEX2A/CEX3A Cryptographic Coprocessor device driver, " \ 47 + "Copyright IBM Corp. 2001, 2018"); 46 48 MODULE_LICENSE("GPL"); 47 49 48 50 static struct ap_device_id zcrypt_cex2a_card_ids[] = {
+2 -4
drivers/s390/crypto/zcrypt_cex2a.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2006 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) ··· 12 14 #define _ZCRYPT_CEX2A_H_ 13 15 14 16 /** 15 - * The type 50 message family is associated with a CEX2A card. 17 + * The type 50 message family is associated with CEXxA cards. 16 18 * 17 19 * The four members of the family are described below. 18 20 * ··· 109 111 } __packed; 110 112 111 113 /** 112 - * The type 80 response family is associated with a CEX2A card. 114 + * The type 80 response family is associated with a CEXxA cards. 113 115 * 114 116 * Note that all unsigned char arrays are right-justified and left-padded 115 117 * with zeroes.
+11 -9
drivers/s390/crypto/zcrypt_cex4.c
··· 37 37 #define CEX4_CLEANUP_TIME (900*HZ) 38 38 39 39 MODULE_AUTHOR("IBM Corporation"); 40 - MODULE_DESCRIPTION("CEX4 Cryptographic Card device driver, " \ 41 - "Copyright IBM Corp. 2012"); 40 + MODULE_DESCRIPTION("CEX4/CEX5/CEX6 Cryptographic Card device driver, " \ 41 + "Copyright IBM Corp. 2018"); 42 42 MODULE_LICENSE("GPL"); 43 43 44 44 static struct ap_device_id zcrypt_cex4_card_ids[] = { ··· 66 66 MODULE_DEVICE_TABLE(ap, zcrypt_cex4_queue_ids); 67 67 68 68 /** 69 - * Probe function for CEX4 card device. It always accepts the AP device 70 - * since the bus_match already checked the hardware type. 69 + * Probe function for CEX4/CEX5/CEX6 card device. It always 70 + * accepts the AP device since the bus_match already checked 71 + * the hardware type. 71 72 * @ap_dev: pointer to the AP device. 72 73 */ 73 74 static int zcrypt_cex4_card_probe(struct ap_device *ap_dev) ··· 200 199 } 201 200 202 201 /** 203 - * This is called to remove the CEX4 card driver information 202 + * This is called to remove the CEX4/CEX5/CEX6 card driver information 204 203 * if an AP card device is removed. 205 204 */ 206 205 static void zcrypt_cex4_card_remove(struct ap_device *ap_dev) ··· 219 218 }; 220 219 221 220 /** 222 - * Probe function for CEX4 queue device. It always accepts the AP device 223 - * since the bus_match already checked the hardware type. 221 + * Probe function for CEX4/CEX5/CEX6 queue device. It always 222 + * accepts the AP device since the bus_match already checked 223 + * the hardware type. 224 224 * @ap_dev: pointer to the AP device. 225 225 */ 226 226 static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev) ··· 267 265 } 268 266 269 267 /** 270 - * This is called to remove the CEX4 queue driver information 271 - * if an AP queue device is removed. 268 + * This is called to remove the CEX4/CEX5/CEX6 queue driver 269 + * information if an AP queue device is removed. 272 270 */ 273 271 static void zcrypt_cex4_queue_remove(struct ap_device *ap_dev) 274 272 {
-2
drivers/s390/crypto/zcrypt_error.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2006 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com)
+11 -13
drivers/s390/crypto/zcrypt_msgtype50.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2012 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) ··· 25 27 #include "zcrypt_error.h" 26 28 #include "zcrypt_msgtype50.h" 27 29 28 - /* 4096 bits */ 30 + /* >= CEX3A: 4096 bits */ 29 31 #define CEX3A_MAX_MOD_SIZE 512 30 32 31 - /* max outputdatalength + type80_hdr */ 33 + /* CEX2A: max outputdatalength + type80_hdr */ 32 34 #define CEX2A_MAX_RESPONSE_SIZE 0x110 33 35 34 - /* 512 bit modulus, (max outputdatalength) + type80_hdr */ 36 + /* >= CEX3A: 512 bit modulus, (max outputdatalength) + type80_hdr */ 35 37 #define CEX3A_MAX_RESPONSE_SIZE 0x210 36 38 37 39 MODULE_AUTHOR("IBM Corporation"); ··· 40 42 MODULE_LICENSE("GPL"); 41 43 42 44 /** 43 - * The type 50 message family is associated with a CEX2A card. 45 + * The type 50 message family is associated with a CEXxA cards. 44 46 * 45 47 * The four members of the family are described below. 46 48 * ··· 137 139 } __packed; 138 140 139 141 /** 140 - * The type 80 response family is associated with a CEX2A card. 142 + * The type 80 response family is associated with a CEXxA cards. 141 143 * 142 144 * Note that all unsigned char arrays are right-justified and left-padded 143 145 * with zeroes. ··· 271 273 /* 272 274 * CEX2A and CEX3A w/o FW update can handle requests up to 273 275 * 256 byte modulus (2k keys). 274 - * CEX3A with FW update and CEX4A cards are able to handle 276 + * CEX3A with FW update and newer CEXxA cards are able to handle 275 277 * 512 byte modulus (4k keys). 276 278 */ 277 279 if (mod_len <= 128) { /* up to 1024 bit key size */ ··· 354 356 unsigned char *data; 355 357 356 358 if (t80h->len < sizeof(*t80h) + outputdatalength) { 357 - /* The result is too short, the CEX2A card may not do that.. */ 359 + /* The result is too short, the CEXxA card may not do that.. */ 358 360 zq->online = 0; 359 361 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 360 362 AP_QID_CARD(zq->queue->qid), ··· 445 447 static atomic_t zcrypt_step = ATOMIC_INIT(0); 446 448 447 449 /** 448 - * The request distributor calls this function if it picked the CEX2A 450 + * The request distributor calls this function if it picked the CEXxA 449 451 * device to handle a modexpo request. 450 452 * @zq: pointer to zcrypt_queue structure that identifies the 451 - * CEX2A device to the request distributor 453 + * CEXxA device to the request distributor 452 454 * @mex: pointer to the modexpo request buffer 453 455 */ 454 456 static long zcrypt_cex2a_modexpo(struct zcrypt_queue *zq, ··· 491 493 } 492 494 493 495 /** 494 - * The request distributor calls this function if it picked the CEX2A 496 + * The request distributor calls this function if it picked the CEXxA 495 497 * device to handle a modexpo_crt request. 496 498 * @zq: pointer to zcrypt_queue structure that identifies the 497 - * CEX2A device to the request distributor 499 + * CEXxA device to the request distributor 498 500 * @crt: pointer to the modexpoc_crt request buffer 499 501 */ 500 502 static long zcrypt_cex2a_modexpo_crt(struct zcrypt_queue *zq,
-2
drivers/s390/crypto/zcrypt_msgtype50.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2012 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com)
+26 -39
drivers/s390/crypto/zcrypt_msgtype6.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2012 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) ··· 27 29 #include "zcrypt_msgtype6.h" 28 30 #include "zcrypt_cca_key.h" 29 31 30 - #define PCIXCC_MIN_MOD_SIZE_OLD 64 /* 512 bits */ 31 - #define PCIXCC_MAX_ICA_RESPONSE_SIZE 0x77c /* max size type86 v2 reply */ 32 + #define CEXXC_MAX_ICA_RESPONSE_SIZE 0x77c /* max size type86 v2 reply */ 32 33 33 34 #define CEIL4(x) ((((x)+3)/4)*4) 34 35 ··· 35 38 struct completion work; 36 39 int type; 37 40 }; 38 - #define PCIXCC_RESPONSE_TYPE_ICA 0 39 - #define PCIXCC_RESPONSE_TYPE_XCRB 1 40 - #define PCIXCC_RESPONSE_TYPE_EP11 2 41 + #define CEXXC_RESPONSE_TYPE_ICA 0 42 + #define CEXXC_RESPONSE_TYPE_XCRB 1 43 + #define CEXXC_RESPONSE_TYPE_EP11 2 41 44 42 45 MODULE_AUTHOR("IBM Corporation"); 43 46 MODULE_DESCRIPTION("Cryptographic Coprocessor (message type 6), " \ ··· 108 111 } __packed; 109 112 110 113 /** 111 - * The following is used to initialize the CPRBX passed to the PCIXCC/CEX2C 114 + * The following is used to initialize the CPRBX passed to the CEXxC/CEXxP 112 115 * card in a type6 message. The 3 fields that must be filled in at execution 113 116 * time are req_parml, rpl_parml and usage_domain. 114 117 * Everything about this interface is ascii/big-endian, since the ··· 291 294 /* message header, cprbx and f&r */ 292 295 msg->hdr = static_type6_hdrX; 293 296 msg->hdr.ToCardLen1 = size - sizeof(msg->hdr); 294 - msg->hdr.FromCardLen1 = PCIXCC_MAX_ICA_RESPONSE_SIZE - sizeof(msg->hdr); 297 + msg->hdr.FromCardLen1 = CEXXC_MAX_ICA_RESPONSE_SIZE - sizeof(msg->hdr); 295 298 296 299 msg->cprbx = static_cprbx; 297 300 msg->cprbx.domain = AP_QID_QUEUE(zq->queue->qid); ··· 361 364 /* message header, cprbx and f&r */ 362 365 msg->hdr = static_type6_hdrX; 363 366 msg->hdr.ToCardLen1 = size - sizeof(msg->hdr); 364 - msg->hdr.FromCardLen1 = PCIXCC_MAX_ICA_RESPONSE_SIZE - sizeof(msg->hdr); 367 + msg->hdr.FromCardLen1 = CEXXC_MAX_ICA_RESPONSE_SIZE - sizeof(msg->hdr); 365 368 366 369 msg->cprbx = static_cprbx; 367 370 msg->cprbx.domain = AP_QID_QUEUE(zq->queue->qid); ··· 655 658 (int) service_rc, (int) service_rs); 656 659 return -EINVAL; 657 660 } 658 - if (service_rc == 8 && service_rs == 783) { 659 - zq->zcard->min_mod_size = 660 - PCIXCC_MIN_MOD_SIZE_OLD; 661 - ZCRYPT_DBF(DBF_DEBUG, 662 - "device=%02x.%04x rc/rs=%d/%d => rc=EAGAIN\n", 663 - AP_QID_CARD(zq->queue->qid), 664 - AP_QID_QUEUE(zq->queue->qid), 665 - (int) service_rc, (int) service_rs); 666 - return -EAGAIN; 667 - } 668 661 zq->online = 0; 669 662 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 670 663 AP_QID_CARD(zq->queue->qid), ··· 684 697 if (pad_len > 0) { 685 698 if (pad_len < 10) 686 699 return -EINVAL; 687 - /* 'restore' padding left in the PCICC/PCIXCC card. */ 700 + /* 'restore' padding left in the CEXXC card. */ 688 701 if (copy_to_user(outputdata, static_pad, pad_len - 1)) 689 702 return -EFAULT; 690 703 if (put_user(0, outputdata + pad_len - 1)) ··· 942 955 if (t86r->hdr.type == TYPE86_RSP_CODE && 943 956 t86r->cprbx.cprb_ver_id == 0x02) { 944 957 switch (resp_type->type) { 945 - case PCIXCC_RESPONSE_TYPE_ICA: 958 + case CEXXC_RESPONSE_TYPE_ICA: 946 959 length = sizeof(struct type86x_reply) 947 960 + t86r->length - 2; 948 - length = min(PCIXCC_MAX_ICA_RESPONSE_SIZE, length); 961 + length = min(CEXXC_MAX_ICA_RESPONSE_SIZE, length); 949 962 memcpy(msg->message, reply->message, length); 950 963 break; 951 - case PCIXCC_RESPONSE_TYPE_XCRB: 964 + case CEXXC_RESPONSE_TYPE_XCRB: 952 965 length = t86r->fmt2.offset2 + t86r->fmt2.count2; 953 966 length = min(MSGTYPE06_MAX_MSG_SIZE, length); 954 967 memcpy(msg->message, reply->message, length); ··· 991 1004 if (t86r->hdr.type == TYPE86_RSP_CODE && 992 1005 t86r->cprbx.cprb_ver_id == 0x04) { 993 1006 switch (resp_type->type) { 994 - case PCIXCC_RESPONSE_TYPE_EP11: 1007 + case CEXXC_RESPONSE_TYPE_EP11: 995 1008 length = t86r->fmt2.offset1 + t86r->fmt2.count1; 996 1009 length = min(MSGTYPE06_MAX_MSG_SIZE, length); 997 1010 memcpy(msg->message, reply->message, length); ··· 1009 1022 static atomic_t zcrypt_step = ATOMIC_INIT(0); 1010 1023 1011 1024 /** 1012 - * The request distributor calls this function if it picked the PCIXCC/CEX2C 1025 + * The request distributor calls this function if it picked the CEXxC 1013 1026 * device to handle a modexpo request. 1014 1027 * @zq: pointer to zcrypt_queue structure that identifies the 1015 - * PCIXCC/CEX2C device to the request distributor 1028 + * CEXxC device to the request distributor 1016 1029 * @mex: pointer to the modexpo request buffer 1017 1030 */ 1018 1031 static long zcrypt_msgtype6_modexpo(struct zcrypt_queue *zq, ··· 1020 1033 { 1021 1034 struct ap_message ap_msg; 1022 1035 struct response_type resp_type = { 1023 - .type = PCIXCC_RESPONSE_TYPE_ICA, 1036 + .type = CEXXC_RESPONSE_TYPE_ICA, 1024 1037 }; 1025 1038 int rc; 1026 1039 ··· 1053 1066 } 1054 1067 1055 1068 /** 1056 - * The request distributor calls this function if it picked the PCIXCC/CEX2C 1069 + * The request distributor calls this function if it picked the CEXxC 1057 1070 * device to handle a modexpo_crt request. 1058 1071 * @zq: pointer to zcrypt_queue structure that identifies the 1059 - * PCIXCC/CEX2C device to the request distributor 1072 + * CEXxC device to the request distributor 1060 1073 * @crt: pointer to the modexpoc_crt request buffer 1061 1074 */ 1062 1075 static long zcrypt_msgtype6_modexpo_crt(struct zcrypt_queue *zq, ··· 1064 1077 { 1065 1078 struct ap_message ap_msg; 1066 1079 struct response_type resp_type = { 1067 - .type = PCIXCC_RESPONSE_TYPE_ICA, 1080 + .type = CEXXC_RESPONSE_TYPE_ICA, 1068 1081 }; 1069 1082 int rc; 1070 1083 ··· 1109 1122 unsigned int *func_code, unsigned short **dom) 1110 1123 { 1111 1124 struct response_type resp_type = { 1112 - .type = PCIXCC_RESPONSE_TYPE_XCRB, 1125 + .type = CEXXC_RESPONSE_TYPE_XCRB, 1113 1126 }; 1114 1127 1115 1128 ap_msg->message = kmalloc(MSGTYPE06_MAX_MSG_SIZE, GFP_KERNEL); ··· 1125 1138 } 1126 1139 1127 1140 /** 1128 - * The request distributor calls this function if it picked the PCIXCC/CEX2C 1141 + * The request distributor calls this function if it picked the CEXxC 1129 1142 * device to handle a send_cprb request. 1130 1143 * @zq: pointer to zcrypt_queue structure that identifies the 1131 - * PCIXCC/CEX2C device to the request distributor 1144 + * CEXxC device to the request distributor 1132 1145 * @xcRB: pointer to the send_cprb request buffer 1133 1146 */ 1134 1147 static long zcrypt_msgtype6_send_cprb(struct zcrypt_queue *zq, ··· 1164 1177 unsigned int *func_code) 1165 1178 { 1166 1179 struct response_type resp_type = { 1167 - .type = PCIXCC_RESPONSE_TYPE_EP11, 1180 + .type = CEXXC_RESPONSE_TYPE_EP11, 1168 1181 }; 1169 1182 1170 1183 ap_msg->message = kmalloc(MSGTYPE06_MAX_MSG_SIZE, GFP_KERNEL); ··· 1258 1271 unsigned int *domain) 1259 1272 { 1260 1273 struct response_type resp_type = { 1261 - .type = PCIXCC_RESPONSE_TYPE_XCRB, 1274 + .type = CEXXC_RESPONSE_TYPE_XCRB, 1262 1275 }; 1263 1276 1264 1277 ap_msg->message = kmalloc(MSGTYPE06_MAX_MSG_SIZE, GFP_KERNEL); ··· 1278 1291 } 1279 1292 1280 1293 /** 1281 - * The request distributor calls this function if it picked the PCIXCC/CEX2C 1294 + * The request distributor calls this function if it picked the CEXxC 1282 1295 * device to generate random data. 1283 1296 * @zq: pointer to zcrypt_queue structure that identifies the 1284 - * PCIXCC/CEX2C device to the request distributor 1297 + * CEXxC device to the request distributor 1285 1298 * @buffer: pointer to a memory page to return random data 1286 1299 */ 1287 1300 static long zcrypt_msgtype6_rng(struct zcrypt_queue *zq, ··· 1316 1329 } 1317 1330 1318 1331 /** 1319 - * The crypto operations for a PCIXCC/CEX2C card. 1332 + * The crypto operations for a CEXxC card. 1320 1333 */ 1321 1334 static struct zcrypt_ops zcrypt_msgtype6_norng_ops = { 1322 1335 .owner = THIS_MODULE,
+4 -11
drivers/s390/crypto/zcrypt_msgtype6.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2012 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) ··· 22 24 #define MSGTYPE06_MAX_MSG_SIZE (12*1024) 23 25 24 26 /** 25 - * The type 6 message family is associated with PCICC or PCIXCC cards. 27 + * The type 6 message family is associated with CEXxC/CEXxP cards. 26 28 * 27 29 * It contains a message header followed by a CPRB, both of which 28 30 * are described below. ··· 41 43 unsigned int offset2; /* 0x00000000 */ 42 44 unsigned int offset3; /* 0x00000000 */ 43 45 unsigned int offset4; /* 0x00000000 */ 44 - unsigned char agent_id[16]; /* PCICC: */ 45 - /* 0x0100 */ 46 - /* 0x4343412d4150504c202020 */ 47 - /* 0x010101 */ 48 - /* PCIXCC: */ 49 - /* 0x4341000000000000 */ 50 - /* 0x0000000000000000 */ 46 + unsigned char agent_id[16]; /* 0x4341000000000000 */ 47 + /* 0x0000000000000000 */ 51 48 unsigned char rqid[2]; /* rqid. internal to 603 */ 52 49 unsigned char reserved5[2]; /* 0x0000 */ 53 50 unsigned char function_code[2]; /* for PKD, 0x5044 (ascii 'PD') */ ··· 58 65 } __packed; 59 66 60 67 /** 61 - * The type 86 message family is associated with PCICC and PCIXCC cards. 68 + * The type 86 message family is associated with CEXxC/CEXxP cards. 62 69 * 63 70 * It contains a message header followed by a CPRB. The CPRB is 64 71 * the same as the request CPRB, which is described above.
+50 -75
drivers/s390/crypto/zcrypt_pcixcc.c drivers/s390/crypto/zcrypt_cex2c.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 - * Copyright IBM Corp. 2001, 2012 3 + * Copyright IBM Corp. 2001, 2018 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) 8 6 * ··· 23 25 #include "zcrypt_api.h" 24 26 #include "zcrypt_error.h" 25 27 #include "zcrypt_msgtype6.h" 26 - #include "zcrypt_pcixcc.h" 28 + #include "zcrypt_cex2c.h" 27 29 #include "zcrypt_cca_key.h" 28 30 29 - #define PCIXCC_MIN_MOD_SIZE 16 /* 128 bits */ 30 - #define PCIXCC_MIN_MOD_SIZE_OLD 64 /* 512 bits */ 31 - #define PCIXCC_MAX_MOD_SIZE 256 /* 2048 bits */ 32 - #define CEX3C_MIN_MOD_SIZE PCIXCC_MIN_MOD_SIZE 31 + #define CEX2C_MIN_MOD_SIZE 16 /* 128 bits */ 32 + #define CEX2C_MAX_MOD_SIZE 256 /* 2048 bits */ 33 + #define CEX3C_MIN_MOD_SIZE 16 /* 128 bits */ 33 34 #define CEX3C_MAX_MOD_SIZE 512 /* 4096 bits */ 34 - 35 - #define PCIXCC_MAX_ICA_MESSAGE_SIZE 0x77c /* max size type6 v2 crt message */ 36 - #define PCIXCC_MAX_ICA_RESPONSE_SIZE 0x77c /* max size type86 v2 reply */ 37 - 38 - #define PCIXCC_MAX_XCRB_MESSAGE_SIZE (12*1024) 39 - 40 - #define PCIXCC_CLEANUP_TIME (15*HZ) 41 - 42 - #define CEIL4(x) ((((x)+3)/4)*4) 43 - 44 - struct response_type { 45 - struct completion work; 46 - int type; 47 - }; 48 - #define PCIXCC_RESPONSE_TYPE_ICA 0 49 - #define PCIXCC_RESPONSE_TYPE_XCRB 1 35 + #define CEX2C_MAX_XCRB_MESSAGE_SIZE (12*1024) 36 + #define CEX2C_CLEANUP_TIME (15*HZ) 50 37 51 38 MODULE_AUTHOR("IBM Corporation"); 52 - MODULE_DESCRIPTION("PCIXCC Cryptographic Coprocessor device driver, " \ 53 - "Copyright IBM Corp. 2001, 2012"); 39 + MODULE_DESCRIPTION("CEX2C/CEX3C Cryptographic Coprocessor device driver, " \ 40 + "Copyright IBM Corp. 2001, 2018"); 54 41 MODULE_LICENSE("GPL"); 55 42 56 - static struct ap_device_id zcrypt_pcixcc_card_ids[] = { 57 - { .dev_type = AP_DEVICE_TYPE_PCIXCC, 58 - .match_flags = AP_DEVICE_ID_MATCH_CARD_TYPE }, 43 + static struct ap_device_id zcrypt_cex2c_card_ids[] = { 59 44 { .dev_type = AP_DEVICE_TYPE_CEX2C, 60 45 .match_flags = AP_DEVICE_ID_MATCH_CARD_TYPE }, 61 46 { .dev_type = AP_DEVICE_TYPE_CEX3C, ··· 46 65 { /* end of list */ }, 47 66 }; 48 67 49 - MODULE_DEVICE_TABLE(ap, zcrypt_pcixcc_card_ids); 68 + MODULE_DEVICE_TABLE(ap, zcrypt_cex2c_card_ids); 50 69 51 - static struct ap_device_id zcrypt_pcixcc_queue_ids[] = { 52 - { .dev_type = AP_DEVICE_TYPE_PCIXCC, 53 - .match_flags = AP_DEVICE_ID_MATCH_QUEUE_TYPE }, 70 + static struct ap_device_id zcrypt_cex2c_queue_ids[] = { 54 71 { .dev_type = AP_DEVICE_TYPE_CEX2C, 55 72 .match_flags = AP_DEVICE_ID_MATCH_QUEUE_TYPE }, 56 73 { .dev_type = AP_DEVICE_TYPE_CEX3C, ··· 56 77 { /* end of list */ }, 57 78 }; 58 79 59 - MODULE_DEVICE_TABLE(ap, zcrypt_pcixcc_queue_ids); 80 + MODULE_DEVICE_TABLE(ap, zcrypt_cex2c_queue_ids); 60 81 61 82 /** 62 - * Large random number detection function. Its sends a message to a pcixcc 83 + * Large random number detection function. Its sends a message to a CEX2C/CEX3C 63 84 * card to find out if large random numbers are supported. 64 85 * @ap_dev: pointer to the AP device. 65 86 * 66 87 * Returns 1 if large random numbers are supported, 0 if not and < 0 on error. 67 88 */ 68 - static int zcrypt_pcixcc_rng_supported(struct ap_queue *aq) 89 + static int zcrypt_cex2c_rng_supported(struct ap_queue *aq) 69 90 { 70 91 struct ap_message ap_msg; 71 92 unsigned long long psmid; ··· 126 147 } 127 148 128 149 /** 129 - * Probe function for PCIXCC/CEX2C card devices. It always accepts the 130 - * AP device since the bus_match already checked the hardware type. The 131 - * PCIXCC cards come in two flavours: micro code level 2 and micro code 132 - * level 3. This is checked by sending a test message to the device. 150 + * Probe function for CEX2C/CEX3C card devices. It always accepts the 151 + * AP device since the bus_match already checked the hardware type. 133 152 * @ap_dev: pointer to the AP card device. 134 153 */ 135 - static int zcrypt_pcixcc_card_probe(struct ap_device *ap_dev) 154 + static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev) 136 155 { 137 156 /* 138 157 * Normalized speed ratings per crypto adapter ··· 156 179 zc->type_string = "CEX2C"; 157 180 memcpy(zc->speed_rating, CEX2C_SPEED_IDX, 158 181 sizeof(CEX2C_SPEED_IDX)); 159 - zc->min_mod_size = PCIXCC_MIN_MOD_SIZE; 160 - zc->max_mod_size = PCIXCC_MAX_MOD_SIZE; 161 - zc->max_exp_bit_length = PCIXCC_MAX_MOD_SIZE; 182 + zc->min_mod_size = CEX2C_MIN_MOD_SIZE; 183 + zc->max_mod_size = CEX2C_MAX_MOD_SIZE; 184 + zc->max_exp_bit_length = CEX2C_MAX_MOD_SIZE; 162 185 break; 163 186 case AP_DEVICE_TYPE_CEX3C: 164 187 zc->user_space_type = ZCRYPT_CEX3C; ··· 185 208 } 186 209 187 210 /** 188 - * This is called to remove the PCIXCC/CEX2C card driver information 211 + * This is called to remove the CEX2C/CEX3C card driver information 189 212 * if an AP card device is removed. 190 213 */ 191 - static void zcrypt_pcixcc_card_remove(struct ap_device *ap_dev) 214 + static void zcrypt_cex2c_card_remove(struct ap_device *ap_dev) 192 215 { 193 216 struct zcrypt_card *zc = to_ap_card(&ap_dev->device)->private; 194 217 ··· 196 219 zcrypt_card_unregister(zc); 197 220 } 198 221 199 - static struct ap_driver zcrypt_pcixcc_card_driver = { 200 - .probe = zcrypt_pcixcc_card_probe, 201 - .remove = zcrypt_pcixcc_card_remove, 202 - .ids = zcrypt_pcixcc_card_ids, 222 + static struct ap_driver zcrypt_cex2c_card_driver = { 223 + .probe = zcrypt_cex2c_card_probe, 224 + .remove = zcrypt_cex2c_card_remove, 225 + .ids = zcrypt_cex2c_card_ids, 203 226 .flags = AP_DRIVER_FLAG_DEFAULT, 204 227 }; 205 228 206 229 /** 207 - * Probe function for PCIXCC/CEX2C queue devices. It always accepts the 208 - * AP device since the bus_match already checked the hardware type. The 209 - * PCIXCC cards come in two flavours: micro code level 2 and micro code 210 - * level 3. This is checked by sending a test message to the device. 230 + * Probe function for CEX2C/CEX3C queue devices. It always accepts the 231 + * AP device since the bus_match already checked the hardware type. 211 232 * @ap_dev: pointer to the AP card device. 212 233 */ 213 - static int zcrypt_pcixcc_queue_probe(struct ap_device *ap_dev) 234 + static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev) 214 235 { 215 236 struct ap_queue *aq = to_ap_queue(&ap_dev->device); 216 237 struct zcrypt_queue *zq; 217 238 int rc; 218 239 219 - zq = zcrypt_queue_alloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE); 240 + zq = zcrypt_queue_alloc(CEX2C_MAX_XCRB_MESSAGE_SIZE); 220 241 if (!zq) 221 242 return -ENOMEM; 222 243 zq->queue = aq; 223 244 zq->online = 1; 224 245 atomic_set(&zq->load, 0); 225 - rc = zcrypt_pcixcc_rng_supported(aq); 246 + rc = zcrypt_cex2c_rng_supported(aq); 226 247 if (rc < 0) { 227 248 zcrypt_queue_free(zq); 228 249 return rc; ··· 232 257 zq->ops = zcrypt_msgtype(MSGTYPE06_NAME, 233 258 MSGTYPE06_VARIANT_NORNG); 234 259 ap_queue_init_reply(aq, &zq->reply); 235 - aq->request_timeout = PCIXCC_CLEANUP_TIME, 260 + aq->request_timeout = CEX2C_CLEANUP_TIME; 236 261 aq->private = zq; 237 262 rc = zcrypt_queue_register(zq); 238 263 if (rc) { ··· 243 268 } 244 269 245 270 /** 246 - * This is called to remove the PCIXCC/CEX2C queue driver information 271 + * This is called to remove the CEX2C/CEX3C queue driver information 247 272 * if an AP queue device is removed. 248 273 */ 249 - static void zcrypt_pcixcc_queue_remove(struct ap_device *ap_dev) 274 + static void zcrypt_cex2c_queue_remove(struct ap_device *ap_dev) 250 275 { 251 276 struct ap_queue *aq = to_ap_queue(&ap_dev->device); 252 277 struct zcrypt_queue *zq = aq->private; ··· 256 281 zcrypt_queue_unregister(zq); 257 282 } 258 283 259 - static struct ap_driver zcrypt_pcixcc_queue_driver = { 260 - .probe = zcrypt_pcixcc_queue_probe, 261 - .remove = zcrypt_pcixcc_queue_remove, 284 + static struct ap_driver zcrypt_cex2c_queue_driver = { 285 + .probe = zcrypt_cex2c_queue_probe, 286 + .remove = zcrypt_cex2c_queue_remove, 262 287 .suspend = ap_queue_suspend, 263 288 .resume = ap_queue_resume, 264 - .ids = zcrypt_pcixcc_queue_ids, 289 + .ids = zcrypt_cex2c_queue_ids, 265 290 .flags = AP_DRIVER_FLAG_DEFAULT, 266 291 }; 267 292 268 - int __init zcrypt_pcixcc_init(void) 293 + int __init zcrypt_cex2c_init(void) 269 294 { 270 295 int rc; 271 296 272 - rc = ap_driver_register(&zcrypt_pcixcc_card_driver, 273 - THIS_MODULE, "pcixcccard"); 297 + rc = ap_driver_register(&zcrypt_cex2c_card_driver, 298 + THIS_MODULE, "cex2card"); 274 299 if (rc) 275 300 return rc; 276 301 277 - rc = ap_driver_register(&zcrypt_pcixcc_queue_driver, 278 - THIS_MODULE, "pcixccqueue"); 302 + rc = ap_driver_register(&zcrypt_cex2c_queue_driver, 303 + THIS_MODULE, "cex2cqueue"); 279 304 if (rc) 280 - ap_driver_unregister(&zcrypt_pcixcc_card_driver); 305 + ap_driver_unregister(&zcrypt_cex2c_card_driver); 281 306 282 307 return rc; 283 308 } 284 309 285 - void zcrypt_pcixcc_exit(void) 310 + void zcrypt_cex2c_exit(void) 286 311 { 287 - ap_driver_unregister(&zcrypt_pcixcc_queue_driver); 288 - ap_driver_unregister(&zcrypt_pcixcc_card_driver); 312 + ap_driver_unregister(&zcrypt_cex2c_queue_driver); 313 + ap_driver_unregister(&zcrypt_cex2c_card_driver); 289 314 } 290 315 291 - module_init(zcrypt_pcixcc_init); 292 - module_exit(zcrypt_pcixcc_exit); 316 + module_init(zcrypt_cex2c_init); 317 + module_exit(zcrypt_cex2c_exit);
+6 -8
drivers/s390/crypto/zcrypt_pcixcc.h drivers/s390/crypto/zcrypt_cex2c.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 - * Copyright IBM Corp. 2001, 2012 3 + * Copyright IBM Corp. 2001, 2018 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com) 8 6 * ··· 9 11 * MSGTYPE restruct: Holger Dengler <hd@linux.vnet.ibm.com> 10 12 */ 11 13 12 - #ifndef _ZCRYPT_PCIXCC_H_ 13 - #define _ZCRYPT_PCIXCC_H_ 14 + #ifndef _ZCRYPT_CEX2C_H_ 15 + #define _ZCRYPT_CEX2C_H_ 14 16 15 - int zcrypt_pcixcc_init(void); 16 - void zcrypt_pcixcc_exit(void); 17 + int zcrypt_cex2c_init(void); 18 + void zcrypt_cex2c_exit(void); 17 19 18 - #endif /* _ZCRYPT_PCIXCC_H_ */ 20 + #endif /* _ZCRYPT_CEX2C_H_ */
-2
drivers/s390/crypto/zcrypt_queue.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0+ 2 2 /* 3 - * zcrypt 2.1.0 4 - * 5 3 * Copyright IBM Corp. 2001, 2012 6 4 * Author(s): Robert Burroughs 7 5 * Eric Rossman (edrossma@us.ibm.com)