aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/zcrypt_pcixcc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/crypto/zcrypt_pcixcc.c')
-rw-r--r--drivers/s390/crypto/zcrypt_pcixcc.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c
index cdaa401f20cd..d5f770a71d6c 100644
--- a/drivers/s390/crypto/zcrypt_pcixcc.c
+++ b/drivers/s390/crypto/zcrypt_pcixcc.c
@@ -43,10 +43,13 @@
43#define PCIXCC_MIN_MOD_SIZE 16 /* 128 bits */ 43#define PCIXCC_MIN_MOD_SIZE 16 /* 128 bits */
44#define PCIXCC_MIN_MOD_SIZE_OLD 64 /* 512 bits */ 44#define PCIXCC_MIN_MOD_SIZE_OLD 64 /* 512 bits */
45#define PCIXCC_MAX_MOD_SIZE 256 /* 2048 bits */ 45#define PCIXCC_MAX_MOD_SIZE 256 /* 2048 bits */
46#define CEX3C_MIN_MOD_SIZE PCIXCC_MIN_MOD_SIZE
47#define CEX3C_MAX_MOD_SIZE PCIXCC_MAX_MOD_SIZE
46 48
47#define PCIXCC_MCL2_SPEED_RATING 7870 /* FIXME: needs finetuning */ 49#define PCIXCC_MCL2_SPEED_RATING 7870 /* FIXME: needs finetuning */
48#define PCIXCC_MCL3_SPEED_RATING 7870 50#define PCIXCC_MCL3_SPEED_RATING 7870
49#define CEX2C_SPEED_RATING 8540 51#define CEX2C_SPEED_RATING 8540
52#define CEX3C_SPEED_RATING 10000 /* FIXME: needs finetuning */
50 53
51#define PCIXCC_MAX_ICA_MESSAGE_SIZE 0x77c /* max size type6 v2 crt message */ 54#define PCIXCC_MAX_ICA_MESSAGE_SIZE 0x77c /* max size type6 v2 crt message */
52#define PCIXCC_MAX_ICA_RESPONSE_SIZE 0x77c /* max size type86 v2 reply */ 55#define PCIXCC_MAX_ICA_RESPONSE_SIZE 0x77c /* max size type86 v2 reply */
@@ -1026,14 +1029,15 @@ out_free:
1026static int zcrypt_pcixcc_probe(struct ap_device *ap_dev) 1029static int zcrypt_pcixcc_probe(struct ap_device *ap_dev)
1027{ 1030{
1028 struct zcrypt_device *zdev; 1031 struct zcrypt_device *zdev;
1029 int rc; 1032 int rc = 0;
1030 1033
1031 zdev = zcrypt_device_alloc(PCIXCC_MAX_RESPONSE_SIZE); 1034 zdev = zcrypt_device_alloc(PCIXCC_MAX_RESPONSE_SIZE);
1032 if (!zdev) 1035 if (!zdev)
1033 return -ENOMEM; 1036 return -ENOMEM;
1034 zdev->ap_dev = ap_dev; 1037 zdev->ap_dev = ap_dev;
1035 zdev->online = 1; 1038 zdev->online = 1;
1036 if (ap_dev->device_type == AP_DEVICE_TYPE_PCIXCC) { 1039 switch (ap_dev->device_type) {
1040 case AP_DEVICE_TYPE_PCIXCC:
1037 rc = zcrypt_pcixcc_mcl(ap_dev); 1041 rc = zcrypt_pcixcc_mcl(ap_dev);
1038 if (rc < 0) { 1042 if (rc < 0) {
1039 zcrypt_device_free(zdev); 1043 zcrypt_device_free(zdev);
@@ -1051,13 +1055,25 @@ static int zcrypt_pcixcc_probe(struct ap_device *ap_dev)
1051 zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE; 1055 zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE;
1052 zdev->max_mod_size = PCIXCC_MAX_MOD_SIZE; 1056 zdev->max_mod_size = PCIXCC_MAX_MOD_SIZE;
1053 } 1057 }
1054 } else { 1058 break;
1059 case AP_DEVICE_TYPE_CEX2C:
1055 zdev->user_space_type = ZCRYPT_CEX2C; 1060 zdev->user_space_type = ZCRYPT_CEX2C;
1056 zdev->type_string = "CEX2C"; 1061 zdev->type_string = "CEX2C";
1057 zdev->speed_rating = CEX2C_SPEED_RATING; 1062 zdev->speed_rating = CEX2C_SPEED_RATING;
1058 zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE; 1063 zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE;
1059 zdev->max_mod_size = PCIXCC_MAX_MOD_SIZE; 1064 zdev->max_mod_size = PCIXCC_MAX_MOD_SIZE;
1065 break;
1066 case AP_DEVICE_TYPE_CEX3C:
1067 zdev->user_space_type = ZCRYPT_CEX3C;
1068 zdev->type_string = "CEX3C";
1069 zdev->speed_rating = CEX3C_SPEED_RATING;
1070 zdev->min_mod_size = CEX3C_MIN_MOD_SIZE;
1071 zdev->max_mod_size = CEX3C_MAX_MOD_SIZE;
1072 break;
1073 default:
1074 goto out_free;
1060 } 1075 }
1076
1061 rc = zcrypt_pcixcc_rng_supported(ap_dev); 1077 rc = zcrypt_pcixcc_rng_supported(ap_dev);
1062 if (rc < 0) { 1078 if (rc < 0) {
1063 zcrypt_device_free(zdev); 1079 zcrypt_device_free(zdev);