Skip to content
/ linux Public

Commit 8e77151

Browse files
hfreudegregkh
authored andcommitted
s390/zcrypt: Enable AUTOSEL_DOM for CCA serialnr sysfs attribute
commit 598bbef upstream. 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: 8f291eb ("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> [ preserved zc->online as the fourth argument to cca_get_info() ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2c5c0f4 commit 8e77151

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

drivers/s390/crypto/zcrypt_ccamisc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,11 +1687,13 @@ static int fetch_cca_info(u16 cardnr, u16 domain, struct cca_info *ci)
16871687

16881688
memset(ci, 0, sizeof(*ci));
16891689

1690-
/* get first info from zcrypt device driver about this apqn */
1691-
rc = zcrypt_device_status_ext(cardnr, domain, &devstat);
1692-
if (rc)
1693-
return rc;
1694-
ci->hwtype = devstat.hwtype;
1690+
/* if specific domain given, fetch status and hw info for this apqn */
1691+
if (domain != AUTOSEL_DOM) {
1692+
rc = zcrypt_device_status_ext(cardnr, domain, &devstat);
1693+
if (rc)
1694+
return rc;
1695+
ci->hwtype = devstat.hwtype;
1696+
}
16951697

16961698
/* prep page for rule array and var array use */
16971699
pg = (u8 *)__get_free_page(GFP_KERNEL);

drivers/s390/crypto/zcrypt_cex4.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ static ssize_t cca_serialnr_show(struct device *dev,
8585

8686
memset(&ci, 0, sizeof(ci));
8787

88-
if (ap_domain_index >= 0)
89-
cca_get_info(ac->id, ap_domain_index, &ci, zc->online);
88+
cca_get_info(ac->id, AUTOSEL_DOM, &ci, zc->online);
9089

9190
return sysfs_emit(buf, "%s\n", ci.serial);
9291
}

0 commit comments

Comments
 (0)