From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E54363815C8 for ; Thu, 19 Mar 2026 11:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773918461; cv=none; b=E8elbwKeiin4jvvjbymm9JkECZdkIdAiVjfD9qA2/OBRk4EojyyWglNfW7cpYX51D90RrVqnFj/Zx0rOSu6iVJ9RH8pMFj7G0izvQ4wdY2kIe1f0p9bTMG7ZeRr1ov6emCsynXZWsMShEpw/YFXC5iDb/rBqFZyze19eLaDAUj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773918461; c=relaxed/simple; bh=OtrVk5R1l5cPmaZRC1GcwLReZ1VopWEpCKCTD5C8Zn0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RDm8GAPIjBr0Dq60O0t2D/MlIb8Y0Jdr4SfYYNkrdcSLwMhToG2kOAliG6F629mIvBTZK4dMiJQgBMo7o++nJ556fieI3C0HaM+yMYJOoLsTdyB4Sz5W6Ywn+bgbOspuBwWQgOiuMamherjYDlQwx5v6oMiJK3fWDz8D9LUiW2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C+ljmIIQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C+ljmIIQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C412C19424; Thu, 19 Mar 2026 11:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773918460; bh=OtrVk5R1l5cPmaZRC1GcwLReZ1VopWEpCKCTD5C8Zn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C+ljmIIQgBYKsQZnQGUtpbS8P//ezlE7dcOIM1Yy+DMzLmUz4QyUZG+PqkGNdrp5a lr5xnWyCJPb0dKmJBylm4Kd6dkheXOn9dDo3tEsjXjbLz0pEfD9yhYhuRRdN7noCKy JlR/RprGXRh6Y7qD5LQy9ZjLB70qM8PqV16Pks9t/H+0s2cpNl02bDg8yy8TPRzE47 c1HVV6wxo99nomhv3Rdzy5//wKJYWn0zNi5WujUcMKqiaoA+V6+UoOFk+LFNxtZKVW tp+rqzJBOEOZ6s7DBLpGBhOyPlXPsiZkNv7i3zXO7NZEXXiscb8rlKYe945loq4uQi o3UuRcOwIOLqg== From: Sasha Levin To: stable@vger.kernel.org Cc: Harald Freudenberger , Ingo Franzki , Vasily Gorbik , Sasha Levin Subject: [PATCH 6.6.y] s390/zcrypt: Enable AUTOSEL_DOM for CCA serialnr sysfs attribute Date: Thu, 19 Mar 2026 07:07:38 -0400 Message-ID: <20260319110738.2315416-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026031712-finale-defog-f8d6@gregkh> References: <2026031712-finale-defog-f8d6@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Harald Freudenberger [ 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 Signed-off-by: Harald Freudenberger Reviewed-by: Ingo Franzki Cc: stable@vger.kernel.org Signed-off-by: Vasily Gorbik [ preserved zc->online as the fourth argument to cca_get_info() ] Signed-off-by: Sasha Levin --- drivers/s390/crypto/zcrypt_ccamisc.c | 12 +++++++----- drivers/s390/crypto/zcrypt_cex4.c | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c index 263fe182648b8..0c7172880dffe 100644 --- a/drivers/s390/crypto/zcrypt_ccamisc.c +++ b/drivers/s390/crypto/zcrypt_ccamisc.c @@ -1687,11 +1687,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); diff --git a/drivers/s390/crypto/zcrypt_cex4.c b/drivers/s390/crypto/zcrypt_cex4.c index 9cfce9ff2e654..2bb3fc8f3d2f9 100644 --- a/drivers/s390/crypto/zcrypt_cex4.c +++ b/drivers/s390/crypto/zcrypt_cex4.c @@ -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); } -- 2.51.0