]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/zcrypt: Enable AUTOSEL_DOM for CCA serialnr sysfs attribute
authorHarald Freudenberger <freude@linux.ibm.com>
Thu, 19 Mar 2026 10:50:31 +0000 (06:50 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:48 +0000 (11:08 +0100)
[ Upstream commit 598bbefa8032cc58b564a81d1ad68bd815c8dc0f ]

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>
[ 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>
drivers/s390/crypto/zcrypt_ccamisc.c
drivers/s390/crypto/zcrypt_cex4.c

index 43a27cb3db847e17e048a0d19fc58d536a59f570..9dd4d01e1203fc1b116595fd967e12aec0be84b6 100644 (file)
@@ -1665,11 +1665,13 @@ static int fetch_cca_info(u16 cardnr, u16 domain, struct cca_info *ci)
 
        memset(ci, 0, sizeof(*ci));
 
-       /* get first info from zcrypt device driver about this apqn */
-       rc = zcrypt_device_status_ext(cardnr, domain, &devstat);
-       if (rc)
-               return rc;
-       ci->hwtype = devstat.hwtype;
+       /* if specific domain given, fetch status and hw info for this apqn */
+       if (domain != AUTOSEL_DOM) {
+               rc = zcrypt_device_status_ext(cardnr, domain, &devstat);
+               if (rc)
+                       return rc;
+               ci->hwtype = devstat.hwtype;
+       }
 
        /* prep page for rule array and var array use */
        pg = (u8 *)__get_free_page(GFP_KERNEL);
index 64df7d2f6266c46785279eb50ff1121692755d1c..63b793fc97d852b76c002d8d17bcce544be1bf09 100644 (file)
@@ -85,8 +85,7 @@ static ssize_t cca_serialnr_show(struct device *dev,
 
        memset(&ci, 0, sizeof(ci));
 
-       if (ap_domain_index >= 0)
-               cca_get_info(ac->id, ap_domain_index, &ci, zc->online);
+       cca_get_info(ac->id, AUTOSEL_DOM, &ci, zc->online);
 
        return sysfs_emit(buf, "%s\n", ci.serial);
 }