s390/zcrypt: Correct function bits for CEX2x and CEX3x cards.

For the older CEX2x and CEX3x cards the function bits returned
by TAPQ do not reflect the functions of the card. Instead the
functionality is implicit by the type of the card. The reworked
zcrypt requires to have the function bits set correct, so this
patch fixes this. The queue selection is not only based on these
function bits but also on function pointers set by the individual
drivers.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Ingo Tuchscherer <ingo.tuchscherer@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Harald Freudenberger 2016-10-27 08:57:39 +02:00 committed by Martin Schwidefsky
parent e47de21dd3
commit 148784246e
2 changed files with 22 additions and 3 deletions

View File

@ -273,6 +273,23 @@ static int ap_query_queue(ap_qid_t qid, int *queue_depth, int *device_type,
nd = (info >> 16) & 0xff; nd = (info >> 16) & 0xff;
if ((info & (1UL << 57)) && nd > 0) if ((info & (1UL << 57)) && nd > 0)
ap_max_domain_id = nd; ap_max_domain_id = nd;
switch (*device_type) {
/* For CEX2 and CEX3 the available functions
* are not refrected by the facilities bits.
* Instead it is coded into the type. So here
* modify the function bits based on the type.
*/
case AP_DEVICE_TYPE_CEX2A:
case AP_DEVICE_TYPE_CEX3A:
*facilities |= 0x08000000;
break;
case AP_DEVICE_TYPE_CEX2C:
case AP_DEVICE_TYPE_CEX3C:
*facilities |= 0x10000000;
break;
default:
break;
}
return 0; return 0;
case AP_RESPONSE_Q_NOT_AVAIL: case AP_RESPONSE_Q_NOT_AVAIL:
case AP_RESPONSE_DECONFIGURED: case AP_RESPONSE_DECONFIGURED:

View File

@ -257,7 +257,7 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex)
continue; continue;
for_each_zcrypt_queue(zq, zc) { for_each_zcrypt_queue(zq, zc) {
/* check if device is online and eligible */ /* check if device is online and eligible */
if (!zq->online) if (!zq->online || !zq->ops->rsa_modexpo)
continue; continue;
if (zcrypt_queue_compare(zq, pref_zq, if (zcrypt_queue_compare(zq, pref_zq,
weight, pref_weight)) weight, pref_weight))
@ -320,7 +320,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
continue; continue;
for_each_zcrypt_queue(zq, zc) { for_each_zcrypt_queue(zq, zc) {
/* check if device is online and eligible */ /* check if device is online and eligible */
if (!zq->online) if (!zq->online || !zq->ops->rsa_modexpo_crt)
continue; continue;
if (zcrypt_queue_compare(zq, pref_zq, if (zcrypt_queue_compare(zq, pref_zq,
weight, pref_weight)) weight, pref_weight))
@ -377,6 +377,7 @@ static long zcrypt_send_cprb(struct ica_xcRB *xcRB)
for_each_zcrypt_queue(zq, zc) { for_each_zcrypt_queue(zq, zc) {
/* check if device is online and eligible */ /* check if device is online and eligible */
if (!zq->online || if (!zq->online ||
!zq->ops->send_cprb ||
((*domain != (unsigned short) AUTOSELECT) && ((*domain != (unsigned short) AUTOSELECT) &&
(*domain != AP_QID_QUEUE(zq->queue->qid)))) (*domain != AP_QID_QUEUE(zq->queue->qid))))
continue; continue;
@ -480,6 +481,7 @@ static long zcrypt_send_ep11_cprb(struct ep11_urb *xcrb)
for_each_zcrypt_queue(zq, zc) { for_each_zcrypt_queue(zq, zc) {
/* check if device is online and eligible */ /* check if device is online and eligible */
if (!zq->online || if (!zq->online ||
!zq->ops->send_ep11_cprb ||
(targets && (targets &&
!is_desired_ep11_queue(zq->queue->qid, !is_desired_ep11_queue(zq->queue->qid,
target_num, targets))) target_num, targets)))
@ -538,7 +540,7 @@ static long zcrypt_rng(char *buffer)
continue; continue;
for_each_zcrypt_queue(zq, zc) { for_each_zcrypt_queue(zq, zc) {
/* check if device is online and eligible */ /* check if device is online and eligible */
if (!zq->online) if (!zq->online || !zq->ops->rng)
continue; continue;
if (zcrypt_queue_compare(zq, pref_zq, if (zcrypt_queue_compare(zq, pref_zq,
weight, pref_weight)) weight, pref_weight))