Revisão | 5dacbe23d23c7f0395fa0e65ff1698f632846714 (tree) |
---|---|
Hora | 2019-05-21 23:59:16 |
Autor | Christian Borntraeger <borntraeger@de.i...> |
Commiter | Cornelia Huck |
s390x/cpumodel: msa9 facility
Provide the MSA9 facility (stfle.155). This also contains pckmo
subfunctions for key wrapping. Keep them in a separate group to disable
those as a block if necessary. This is for example needed when disabling
key wrapping via the HMC.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20190429090250.7648-5-borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
@@ -108,6 +108,7 @@ static const S390FeatDef s390_features[] = { | ||
108 | 108 | FEAT_INIT("irbm", S390_FEAT_TYPE_STFL, 145, "Insert-reference-bits-multiple facility"), |
109 | 109 | FEAT_INIT("msa8-base", S390_FEAT_TYPE_STFL, 146, "Message-security-assist-extension-8 facility (excluding subfunctions)"), |
110 | 110 | FEAT_INIT("cmmnt", S390_FEAT_TYPE_STFL, 147, "CMM: ESSA-enhancement (no translate) facility"), |
111 | + FEAT_INIT("msa9-base", S390_FEAT_TYPE_STFL, 155, "Message-security-assist-extension-9 facility (excluding subfunctions)"), | |
111 | 112 | FEAT_INIT("etoken", S390_FEAT_TYPE_STFL, 156, "Etoken facility"), |
112 | 113 | |
113 | 114 | /* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */ |
@@ -242,6 +243,11 @@ static const S390FeatDef s390_features[] = { | ||
242 | 243 | FEAT_INIT("pckmo-aes-128", S390_FEAT_TYPE_PCKMO, 18, "PCKMO Encrypted-AES-128-Key"), |
243 | 244 | FEAT_INIT("pckmo-aes-192", S390_FEAT_TYPE_PCKMO, 19, "PCKMO Encrypted-AES-192-Key"), |
244 | 245 | FEAT_INIT("pckmo-aes-256", S390_FEAT_TYPE_PCKMO, 20, "PCKMO Encrypted-AES-256-Key"), |
246 | + FEAT_INIT("pckmo-ecc-p256", S390_FEAT_TYPE_PCKMO, 32, "PCKMO Encrypt-ECC-P256-Key"), | |
247 | + FEAT_INIT("pckmo-ecc-p384", S390_FEAT_TYPE_PCKMO, 33, "PCKMO Encrypt-ECC-P384-Key"), | |
248 | + FEAT_INIT("pckmo-ecc-p521", S390_FEAT_TYPE_PCKMO, 34, "PCKMO Encrypt-ECC-P521-Key"), | |
249 | + FEAT_INIT("pckmo-ecc-ed25519", S390_FEAT_TYPE_PCKMO, 40 , "PCKMO Encrypt-ECC-Ed25519-Key"), | |
250 | + FEAT_INIT("pckmo-ecc-ed448", S390_FEAT_TYPE_PCKMO, 41 , "PCKMO Encrypt-ECC-Ed448-Key"), | |
245 | 251 | |
246 | 252 | FEAT_INIT("kmctr-dea", S390_FEAT_TYPE_KMCTR, 1, "KMCTR DEA"), |
247 | 253 | FEAT_INIT("kmctr-tdea-128", S390_FEAT_TYPE_KMCTR, 2, "KMCTR TDEA-128"), |
@@ -298,6 +304,13 @@ static const S390FeatDef s390_features[] = { | ||
298 | 304 | FEAT_INIT("pcc-xts-aes-256", S390_FEAT_TYPE_PCC, 52, "PCC Compute-XTS-Parameter-Using-AES-256"), |
299 | 305 | FEAT_INIT("pcc-xts-eaes-128", S390_FEAT_TYPE_PCC, 58, "PCC Compute-XTS-Parameter-Using-Encrypted-AES-128"), |
300 | 306 | FEAT_INIT("pcc-xts-eaes-256", S390_FEAT_TYPE_PCC, 60, "PCC Compute-XTS-Parameter-Using-Encrypted-AES-256"), |
307 | + FEAT_INIT("pcc-scalar-mult-p256", S390_FEAT_TYPE_PCC, 64, "PCC Scalar-Multiply-P256"), | |
308 | + FEAT_INIT("pcc-scalar-mult-p384", S390_FEAT_TYPE_PCC, 65, "PCC Scalar-Multiply-P384"), | |
309 | + FEAT_INIT("pcc-scalar-mult-p521", S390_FEAT_TYPE_PCC, 66, "PCC Scalar-Multiply-P521"), | |
310 | + FEAT_INIT("pcc-scalar-mult-ed25519", S390_FEAT_TYPE_PCC, 72, "PCC Scalar-Multiply-Ed25519"), | |
311 | + FEAT_INIT("pcc-scalar-mult-ed448", S390_FEAT_TYPE_PCC, 73, "PCC Scalar-Multiply-Ed448"), | |
312 | + FEAT_INIT("pcc-scalar-mult-x25519", S390_FEAT_TYPE_PCC, 80, "PCC Scalar-Multiply-X25519"), | |
313 | + FEAT_INIT("pcc-scalar-mult-x448", S390_FEAT_TYPE_PCC, 81, "PCC Scalar-Multiply-X448"), | |
301 | 314 | |
302 | 315 | FEAT_INIT("ppno-sha-512-drng", S390_FEAT_TYPE_PPNO, 3, "PPNO SHA-512-DRNG"), |
303 | 316 | FEAT_INIT("prno-trng-qrtcr", S390_FEAT_TYPE_PPNO, 112, "PRNO TRNG-Query-Raw-to-Conditioned-Ratio"), |
@@ -309,6 +322,22 @@ static const S390FeatDef s390_features[] = { | ||
309 | 322 | FEAT_INIT("kma-gcm-eaes-128", S390_FEAT_TYPE_KMA, 26, "KMA GCM-Encrypted-AES-128"), |
310 | 323 | FEAT_INIT("kma-gcm-eaes-192", S390_FEAT_TYPE_KMA, 27, "KMA GCM-Encrypted-AES-192"), |
311 | 324 | FEAT_INIT("kma-gcm-eaes-256", S390_FEAT_TYPE_KMA, 28, "KMA GCM-Encrypted-AES-256"), |
325 | + | |
326 | + FEAT_INIT("kdsa-ecdsa-verify-p256", S390_FEAT_TYPE_KDSA, 1, "KDSA ECDSA-Verify-P256"), | |
327 | + FEAT_INIT("kdsa-ecdsa-verify-p384", S390_FEAT_TYPE_KDSA, 2, "KDSA ECDSA-Verify-P384"), | |
328 | + FEAT_INIT("kdsa-ecdsa-verify-p521", S390_FEAT_TYPE_KDSA, 3, "KDSA ECDSA-Verify-P521"), | |
329 | + FEAT_INIT("kdsa-ecdsa-sign-p256", S390_FEAT_TYPE_KDSA, 9, "KDSA ECDSA-Sign-P256"), | |
330 | + FEAT_INIT("kdsa-ecdsa-sign-p384", S390_FEAT_TYPE_KDSA, 10, "KDSA ECDSA-Sign-P384"), | |
331 | + FEAT_INIT("kdsa-ecdsa-sign-p521", S390_FEAT_TYPE_KDSA, 11, "KDSA ECDSA-Sign-P521"), | |
332 | + FEAT_INIT("kdsa-eecdsa-sign-p256", S390_FEAT_TYPE_KDSA, 17, "KDSA Encrypted-ECDSA-Sign-P256"), | |
333 | + FEAT_INIT("kdsa-eecdsa-sign-p384", S390_FEAT_TYPE_KDSA, 18, "KDSA Encrypted-ECDSA-Sign-P384"), | |
334 | + FEAT_INIT("kdsa-eecdsa-sign-p521", S390_FEAT_TYPE_KDSA, 19, "KDSA Encrypted-ECDSA-Sign-P521"), | |
335 | + FEAT_INIT("kdsa-eddsa-verify-ed25519", S390_FEAT_TYPE_KDSA, 32, "KDSA EdDSA-Verify-Ed25519"), | |
336 | + FEAT_INIT("kdsa-eddsa-verify-ed448", S390_FEAT_TYPE_KDSA, 36, "KDSA EdDSA-Verify-Ed448"), | |
337 | + FEAT_INIT("kdsa-eddsa-sign-ed25519", S390_FEAT_TYPE_KDSA, 40, "KDSA EdDSA-Sign-Ed25519"), | |
338 | + FEAT_INIT("kdsa-eddsa-sign-ed448", S390_FEAT_TYPE_KDSA, 44, "KDSA EdDSA-Sign-Ed448"), | |
339 | + FEAT_INIT("kdsa-eeddsa-sign-ed25519", S390_FEAT_TYPE_KDSA, 48, "KDSA Encrypted-EdDSA-Sign-Ed25519"), | |
340 | + FEAT_INIT("kdsa-eeddsa-sign-ed448", S390_FEAT_TYPE_KDSA, 52, "KDSA Encrypted-EdDSA-Sign-Ed448"), | |
312 | 341 | }; |
313 | 342 | |
314 | 343 | const S390FeatDef *s390_feat_def(S390Feat feat) |
@@ -371,6 +400,7 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type, | ||
371 | 400 | case S390_FEAT_TYPE_PCC: |
372 | 401 | case S390_FEAT_TYPE_PPNO: |
373 | 402 | case S390_FEAT_TYPE_KMA: |
403 | + case S390_FEAT_TYPE_KDSA: | |
374 | 404 | set_be_bit(0, data); /* query is always available */ |
375 | 405 | break; |
376 | 406 | default: |
@@ -466,6 +496,8 @@ static S390FeatGroupDef s390_feature_groups[] = { | ||
466 | 496 | FEAT_GROUP_INIT("msa6", MSA_EXT_6, "Message-security-assist-extension 6 facility"), |
467 | 497 | FEAT_GROUP_INIT("msa7", MSA_EXT_7, "Message-security-assist-extension 7 facility"), |
468 | 498 | FEAT_GROUP_INIT("msa8", MSA_EXT_8, "Message-security-assist-extension 8 facility"), |
499 | + FEAT_GROUP_INIT("msa9", MSA_EXT_9, "Message-security-assist-extension 9 facility"), | |
500 | + FEAT_GROUP_INIT("msa9_pckmo", MSA_EXT_9_PCKMO, "Message-security-assist-extension 9 PCKMO subfunctions"), | |
469 | 501 | FEAT_GROUP_INIT("mepochptff", MULTIPLE_EPOCH_PTFF, "PTFF enhancements introduced with Multiple-epoch facility"), |
470 | 502 | }; |
471 | 503 |
@@ -39,6 +39,7 @@ typedef enum { | ||
39 | 39 | S390_FEAT_TYPE_PCC, |
40 | 40 | S390_FEAT_TYPE_PPNO, |
41 | 41 | S390_FEAT_TYPE_KMA, |
42 | + S390_FEAT_TYPE_KDSA, | |
42 | 43 | } S390FeatType; |
43 | 44 | |
44 | 45 | /* Definition of a CPU feature */ |
@@ -96,6 +96,7 @@ typedef enum { | ||
96 | 96 | S390_FEAT_INSERT_REFERENCE_BITS_MULT, |
97 | 97 | S390_FEAT_MSA_EXT_8, |
98 | 98 | S390_FEAT_CMM_NT, |
99 | + S390_FEAT_MSA_EXT_9, | |
99 | 100 | S390_FEAT_ETOKEN, |
100 | 101 | |
101 | 102 | /* Sclp Conf Char */ |
@@ -240,6 +241,11 @@ typedef enum { | ||
240 | 241 | S390_FEAT_PCKMO_AES_128, |
241 | 242 | S390_FEAT_PCKMO_AES_192, |
242 | 243 | S390_FEAT_PCKMO_AES_256, |
244 | + S390_FEAT_PCKMO_ECC_P256, | |
245 | + S390_FEAT_PCKMO_ECC_P384, | |
246 | + S390_FEAT_PCKMO_ECC_P521, | |
247 | + S390_FEAT_PCKMO_ECC_ED25519, | |
248 | + S390_FEAT_PCKMO_ECC_ED448, | |
243 | 249 | |
244 | 250 | /* KMCTR */ |
245 | 251 | S390_FEAT_KMCTR_DEA, |
@@ -300,6 +306,13 @@ typedef enum { | ||
300 | 306 | S390_FEAT_PCC_XTS_AES_256, |
301 | 307 | S390_FEAT_PCC_XTS_EAES_128, |
302 | 308 | S390_FEAT_PCC_XTS_EAES_256, |
309 | + S390_FEAT_PCC_SCALAR_MULT_P256, | |
310 | + S390_FEAT_PCC_SCALAR_MULT_P384, | |
311 | + S390_FEAT_PCC_SCALAR_MULT_P512, | |
312 | + S390_FEAT_PCC_SCALAR_MULT_ED25519, | |
313 | + S390_FEAT_PCC_SCALAR_MULT_ED448, | |
314 | + S390_FEAT_PCC_SCALAR_MULT_X25519, | |
315 | + S390_FEAT_PCC_SCALAR_MULT_X448, | |
303 | 316 | |
304 | 317 | /* PPNO/PRNO */ |
305 | 318 | S390_FEAT_PPNO_SHA_512_DRNG, |
@@ -313,6 +326,24 @@ typedef enum { | ||
313 | 326 | S390_FEAT_KMA_GCM_EAES_128, |
314 | 327 | S390_FEAT_KMA_GCM_EAES_192, |
315 | 328 | S390_FEAT_KMA_GCM_EAES_256, |
329 | + | |
330 | + /* KDSA */ | |
331 | + S390_FEAT_ECDSA_VERIFY_P256, | |
332 | + S390_FEAT_ECDSA_VERIFY_P384, | |
333 | + S390_FEAT_ECDSA_VERIFY_P512, | |
334 | + S390_FEAT_ECDSA_SIGN_P256, | |
335 | + S390_FEAT_ECDSA_SIGN_P384, | |
336 | + S390_FEAT_ECDSA_SIGN_P512, | |
337 | + S390_FEAT_EECDSA_SIGN_P256, | |
338 | + S390_FEAT_EECDSA_SIGN_P384, | |
339 | + S390_FEAT_EECDSA_SIGN_P512, | |
340 | + S390_FEAT_EDDSA_VERIFY_ED25519, | |
341 | + S390_FEAT_EDDSA_VERIFY_ED448, | |
342 | + S390_FEAT_EDDSA_SIGN_ED25519, | |
343 | + S390_FEAT_EDDSA_SIGN_ED448, | |
344 | + S390_FEAT_EEDDSA_SIGN_ED25519, | |
345 | + S390_FEAT_EEDDSA_SIGN_ED448, | |
346 | + | |
316 | 347 | S390_FEAT_MAX, |
317 | 348 | } S390Feat; |
318 | 349 |
@@ -782,6 +782,8 @@ static void check_consistency(const S390CPUModel *model) | ||
782 | 782 | { S390_FEAT_SIE_CMMA, S390_FEAT_SIE_GSLS }, |
783 | 783 | { S390_FEAT_SIE_PFMFI, S390_FEAT_EDAT }, |
784 | 784 | { S390_FEAT_MSA_EXT_8, S390_FEAT_MSA_EXT_3 }, |
785 | + { S390_FEAT_MSA_EXT_9, S390_FEAT_MSA_EXT_3 }, | |
786 | + { S390_FEAT_MSA_EXT_9, S390_FEAT_MSA_EXT_4 }, | |
785 | 787 | { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, |
786 | 788 | { S390_FEAT_VECTOR_PACKED_DECIMAL, S390_FEAT_VECTOR }, |
787 | 789 | { S390_FEAT_VECTOR_ENH, S390_FEAT_VECTOR }, |
@@ -213,6 +213,38 @@ | ||
213 | 213 | S390_FEAT_KMA_GCM_EAES_192, \ |
214 | 214 | S390_FEAT_KMA_GCM_EAES_256 |
215 | 215 | |
216 | +#define S390_FEAT_GROUP_MSA_EXT_9 \ | |
217 | + S390_FEAT_MSA_EXT_9, \ | |
218 | + S390_FEAT_ECDSA_VERIFY_P256, \ | |
219 | + S390_FEAT_ECDSA_VERIFY_P384, \ | |
220 | + S390_FEAT_ECDSA_VERIFY_P512, \ | |
221 | + S390_FEAT_ECDSA_SIGN_P256, \ | |
222 | + S390_FEAT_ECDSA_SIGN_P384, \ | |
223 | + S390_FEAT_ECDSA_SIGN_P512, \ | |
224 | + S390_FEAT_EECDSA_SIGN_P256, \ | |
225 | + S390_FEAT_EECDSA_SIGN_P384, \ | |
226 | + S390_FEAT_EECDSA_SIGN_P512, \ | |
227 | + S390_FEAT_EDDSA_VERIFY_ED25519, \ | |
228 | + S390_FEAT_EDDSA_VERIFY_ED448, \ | |
229 | + S390_FEAT_EDDSA_SIGN_ED25519, \ | |
230 | + S390_FEAT_EDDSA_SIGN_ED448, \ | |
231 | + S390_FEAT_EEDDSA_SIGN_ED25519, \ | |
232 | + S390_FEAT_EEDDSA_SIGN_ED448, \ | |
233 | + S390_FEAT_PCC_SCALAR_MULT_P256, \ | |
234 | + S390_FEAT_PCC_SCALAR_MULT_P384, \ | |
235 | + S390_FEAT_PCC_SCALAR_MULT_P512, \ | |
236 | + S390_FEAT_PCC_SCALAR_MULT_ED25519, \ | |
237 | + S390_FEAT_PCC_SCALAR_MULT_ED448, \ | |
238 | + S390_FEAT_PCC_SCALAR_MULT_X25519, \ | |
239 | + S390_FEAT_PCC_SCALAR_MULT_X448 | |
240 | + | |
241 | +#define S390_FEAT_GROUP_MSA_EXT_9_PCKMO \ | |
242 | + S390_FEAT_PCKMO_ECC_P256, \ | |
243 | + S390_FEAT_PCKMO_ECC_P384, \ | |
244 | + S390_FEAT_PCKMO_ECC_P521, \ | |
245 | + S390_FEAT_PCKMO_ECC_ED25519, \ | |
246 | + S390_FEAT_PCKMO_ECC_ED448 | |
247 | + | |
216 | 248 | /* cpu feature groups */ |
217 | 249 | static uint16_t group_PLO[] = { |
218 | 250 | S390_FEAT_GROUP_PLO, |
@@ -254,6 +286,14 @@ static uint16_t group_MSA_EXT_8[] = { | ||
254 | 286 | S390_FEAT_GROUP_MSA_EXT_8, |
255 | 287 | }; |
256 | 288 | |
289 | +static uint16_t group_MSA_EXT_9[] = { | |
290 | + S390_FEAT_GROUP_MSA_EXT_9, | |
291 | +}; | |
292 | + | |
293 | +static uint16_t group_MSA_EXT_9_PCKMO[] = { | |
294 | + S390_FEAT_GROUP_MSA_EXT_9_PCKMO, | |
295 | +}; | |
296 | + | |
257 | 297 | /* Base features (in order of release) |
258 | 298 | * Only non-hypervisor managed features belong here. |
259 | 299 | * Base feature sets are static meaning they do not change in future QEMU |
@@ -709,6 +749,8 @@ static FeatGroupDefSpec FeatGroupDef[] = { | ||
709 | 749 | FEAT_GROUP_INITIALIZER(MSA_EXT_6), |
710 | 750 | FEAT_GROUP_INITIALIZER(MSA_EXT_7), |
711 | 751 | FEAT_GROUP_INITIALIZER(MSA_EXT_8), |
752 | + FEAT_GROUP_INITIALIZER(MSA_EXT_9), | |
753 | + FEAT_GROUP_INITIALIZER(MSA_EXT_9_PCKMO), | |
712 | 754 | FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF), |
713 | 755 | }; |
714 | 756 |
@@ -2073,6 +2073,9 @@ static int query_cpu_subfunc(S390FeatBitmap features) | ||
2073 | 2073 | if (test_bit(S390_FEAT_MSA_EXT_8, features)) { |
2074 | 2074 | s390_add_from_feat_block(features, S390_FEAT_TYPE_KMA, prop.kma); |
2075 | 2075 | } |
2076 | + if (test_bit(S390_FEAT_MSA_EXT_9, features)) { | |
2077 | + s390_add_from_feat_block(features, S390_FEAT_TYPE_KDSA, prop.kdsa); | |
2078 | + } | |
2076 | 2079 | return 0; |
2077 | 2080 | } |
2078 | 2081 |
@@ -2117,6 +2120,9 @@ static int configure_cpu_subfunc(const S390FeatBitmap features) | ||
2117 | 2120 | if (test_bit(S390_FEAT_MSA_EXT_8, features)) { |
2118 | 2121 | s390_fill_feat_block(features, S390_FEAT_TYPE_KMA, prop.kma); |
2119 | 2122 | } |
2123 | + if (test_bit(S390_FEAT_MSA_EXT_9, features)) { | |
2124 | + s390_fill_feat_block(features, S390_FEAT_TYPE_KDSA, prop.kdsa); | |
2125 | + } | |
2120 | 2126 | return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); |
2121 | 2127 | } |
2122 | 2128 |