2019-06-12 17:58:28

by David Hildenbrand

[permalink] [raw]
Subject: [PATCH v3 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP

s390x crypto is one of the rare modules that returns -EOPNOTSUPP instead of
-ENODEV in case HW support is not available.

Convert to -ENODEV, so e.g., systemd's systemd-modules-load.service
ignores this error properly.

v2 -> v3:
- "s390/pkey: Use -ENODEV instead of -EOPNOTSUPP"
-- Also convert pkey_clr2protkey() as requested by Harald
- Add r-b's (thanks!)

v1 -> v2:
- Include
-- "s390/crypto: ghash: Use -ENODEV instead of -EOPNOTSUPP"
-- "s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP"
-- "s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP"

Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Harald Freudenberger <[email protected]>
Cc: Cornelia Huck <[email protected]>

David Hildenbrand (4):
s390/pkey: Use -ENODEV instead of -EOPNOTSUPP
s390/crypto: ghash: Use -ENODEV instead of -EOPNOTSUPP
s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP
s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP

arch/s390/crypto/ghash_s390.c | 2 +-
arch/s390/crypto/prng.c | 4 ++--
arch/s390/crypto/sha1_s390.c | 2 +-
arch/s390/crypto/sha256_s390.c | 2 +-
arch/s390/crypto/sha512_s390.c | 2 +-
drivers/s390/crypto/pkey_api.c | 8 ++++----
6 files changed, 10 insertions(+), 10 deletions(-)

--
2.21.0


2019-06-12 17:58:28

by David Hildenbrand

[permalink] [raw]
Subject: [PATCH v3 3/4] s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP

Let's use the error value that is typically used if HW support is not
available when trying to load a module - this is also what systemd's
systemd-modules-load.service expects.

Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Harald Freudenberger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
---
arch/s390/crypto/prng.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 12cca467af7d..d977643fa627 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -824,7 +824,7 @@ static int __init prng_init(void)

/* check if the CPU has a PRNG */
if (!cpacf_query_func(CPACF_KMC, CPACF_KMC_PRNG))
- return -EOPNOTSUPP;
+ return -ENODEV;

/* check if TRNG subfunction is available */
if (cpacf_query_func(CPACF_PRNO, CPACF_PRNO_TRNG))
@@ -837,7 +837,7 @@ static int __init prng_init(void)
if (prng_mode == PRNG_MODE_SHA512) {
pr_err("The prng module cannot "
"start in SHA-512 mode\n");
- return -EOPNOTSUPP;
+ return -ENODEV;
}
prng_mode = PRNG_MODE_TDES;
} else
--
2.21.0

2019-06-12 18:03:41

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP

On Wed, Jun 12, 2019 at 03:33:02PM +0200, David Hildenbrand wrote:
> s390x crypto is one of the rare modules that returns -EOPNOTSUPP instead of
> -ENODEV in case HW support is not available.
>
> Convert to -ENODEV, so e.g., systemd's systemd-modules-load.service
> ignores this error properly.
>
> v2 -> v3:
> - "s390/pkey: Use -ENODEV instead of -EOPNOTSUPP"
> -- Also convert pkey_clr2protkey() as requested by Harald
> - Add r-b's (thanks!)
>
> v1 -> v2:
> - Include
> -- "s390/crypto: ghash: Use -ENODEV instead of -EOPNOTSUPP"
> -- "s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP"
> -- "s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP"
>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: Heiko Carstens <[email protected]>
> Cc: Vasily Gorbik <[email protected]>
> Cc: Christian Borntraeger <[email protected]>
> Cc: Harald Freudenberger <[email protected]>
> Cc: Cornelia Huck <[email protected]>
>
> David Hildenbrand (4):
> s390/pkey: Use -ENODEV instead of -EOPNOTSUPP
> s390/crypto: ghash: Use -ENODEV instead of -EOPNOTSUPP
> s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP
> s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP

Should I pick these up so they can go upstream via the s390 tree?