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

Configure Feed

Select the types of activity you want to include in your feed.

s390/zcrypt: Enable AUTOSEL_DOM for CCA serialnr sysfs attribute

The serialnr sysfs attribute for CCA cards when queried always
used the default domain for sending the request down to the card.
If for any reason exactly this default domain is disabled then
the attribute code fails to retrieve the CCA info and the sysfs
entry shows an empty string. Works as designed but the serial
number is a card attribute and thus it does not matter which
domain is used for the query. So if there are other domains on
this card available, these could be used.

So extend the code to use AUTOSEL_DOM for the domain value to
address any online domain within the card for querying the cca
info and thus show the serialnr as long as there is one domain
usable regardless of the default domain setting.

Fixes: 8f291ebf3270 ("s390/zcrypt: enable card/domain autoselect on ep11 cprbs")
Suggested-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Harald Freudenberger and committed by
Vasily Gorbik
598bbefa 75aa996e

+8 -7
+7 -5
drivers/s390/crypto/zcrypt_ccamisc.c
··· 1639 1639 1640 1640 memset(ci, 0, sizeof(*ci)); 1641 1641 1642 - /* get first info from zcrypt device driver about this apqn */ 1643 - rc = zcrypt_device_status_ext(cardnr, domain, &devstat); 1644 - if (rc) 1645 - return rc; 1646 - ci->hwtype = devstat.hwtype; 1642 + /* if specific domain given, fetch status and hw info for this apqn */ 1643 + if (domain != AUTOSEL_DOM) { 1644 + rc = zcrypt_device_status_ext(cardnr, domain, &devstat); 1645 + if (rc) 1646 + return rc; 1647 + ci->hwtype = devstat.hwtype; 1648 + } 1647 1649 1648 1650 /* 1649 1651 * Prep memory for rule array and var array use.
+1 -2
drivers/s390/crypto/zcrypt_cex4.c
··· 85 85 86 86 memset(&ci, 0, sizeof(ci)); 87 87 88 - if (ap_domain_index >= 0) 89 - cca_get_info(ac->id, ap_domain_index, &ci, 0); 88 + cca_get_info(ac->id, AUTOSEL_DOM, &ci, 0); 90 89 91 90 return sysfs_emit(buf, "%s\n", ci.serial); 92 91 }