All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP
@ 2019-06-12 10:22 David Hildenbrand
  2019-06-12 10:22 ` [PATCH v2 1/4] s390/pkey: " David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: David Hildenbrand @ 2019-06-12 10:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-s390, linux-crypto, David Hildenbrand, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger, Cornelia Huck

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.

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 <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Harald Freudenberger <freude@linux.ibm.com>
Cc: Cornelia Huck <cohuck@redhat.com>

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 | 6 +++---
 6 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 1/4] s390/pkey: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 [PATCH v2 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP David Hildenbrand
@ 2019-06-12 10:22 ` David Hildenbrand
  2019-06-12 10:39   ` Harald Freudenberger
  2019-06-12 10:22 ` [PATCH v2 2/4] s390/crypto: ghash: " David Hildenbrand
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: David Hildenbrand @ 2019-06-12 10:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-s390, linux-crypto, David Hildenbrand, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger, Cornelia Huck

systemd-modules-load.service automatically tries to load the pkey module
on systems that have MSA.

Pkey also requires the MSA3 facility and a bunch of subfunctions.
Failing with -EOPNOTSUPP makes "systemd-modules-load.service" fail on
any system that does not have all needed subfunctions. For example,
when running under QEMU TCG (but also on systems where protected keys
are disabled via the HMC).

Let's use -ENODEV, so systemd-modules-load.service properly ignores
failing to load the pkey module because of missing HW functionality.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 drivers/s390/crypto/pkey_api.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index 45eb0c14b880..ddfcefb47284 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -1695,15 +1695,15 @@ static int __init pkey_init(void)
 	 * are able to work with protected keys.
 	 */
 	if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
-		return -EOPNOTSUPP;
+		return -ENODEV;
 
 	/* check for kmc instructions available */
 	if (!cpacf_query(CPACF_KMC, &kmc_functions))
-		return -EOPNOTSUPP;
+		return -ENODEV;
 	if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
 	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
 	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
-		return -EOPNOTSUPP;
+		return -ENODEV;
 
 	pkey_debug_init();
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/4] s390/crypto: ghash: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 [PATCH v2 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP David Hildenbrand
  2019-06-12 10:22 ` [PATCH v2 1/4] s390/pkey: " David Hildenbrand
@ 2019-06-12 10:22 ` David Hildenbrand
  2019-06-12 10:31   ` Harald Freudenberger
  2019-06-12 10:32   ` Cornelia Huck
  2019-06-12 10:22 ` [PATCH v2 3/4] s390/crypto: prng: " David Hildenbrand
  2019-06-12 10:22 ` [PATCH v2 4/4] s390/crypto: sha: " David Hildenbrand
  3 siblings, 2 replies; 15+ messages in thread
From: David Hildenbrand @ 2019-06-12 10:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-s390, linux-crypto, David Hildenbrand, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger, Cornelia Huck

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.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/s390/crypto/ghash_s390.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c
index 86aed30fad3a..eeeb6a7737a4 100644
--- a/arch/s390/crypto/ghash_s390.c
+++ b/arch/s390/crypto/ghash_s390.c
@@ -137,7 +137,7 @@ static struct shash_alg ghash_alg = {
 static int __init ghash_mod_init(void)
 {
 	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_GHASH))
-		return -EOPNOTSUPP;
+		return -ENODEV;
 
 	return crypto_register_shash(&ghash_alg);
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 3/4] s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 [PATCH v2 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP David Hildenbrand
  2019-06-12 10:22 ` [PATCH v2 1/4] s390/pkey: " David Hildenbrand
  2019-06-12 10:22 ` [PATCH v2 2/4] s390/crypto: ghash: " David Hildenbrand
@ 2019-06-12 10:22 ` David Hildenbrand
  2019-06-12 10:31   ` Harald Freudenberger
  2019-06-12 10:35   ` Cornelia Huck
  2019-06-12 10:22 ` [PATCH v2 4/4] s390/crypto: sha: " David Hildenbrand
  3 siblings, 2 replies; 15+ messages in thread
From: David Hildenbrand @ 2019-06-12 10:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-s390, linux-crypto, David Hildenbrand, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger, Cornelia Huck

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.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 4/4] s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 [PATCH v2 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP David Hildenbrand
                   ` (2 preceding siblings ...)
  2019-06-12 10:22 ` [PATCH v2 3/4] s390/crypto: prng: " David Hildenbrand
@ 2019-06-12 10:22 ` David Hildenbrand
  2019-06-12 10:30   ` Harald Freudenberger
  2019-06-12 10:37   ` Cornelia Huck
  3 siblings, 2 replies; 15+ messages in thread
From: David Hildenbrand @ 2019-06-12 10:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-s390, linux-crypto, David Hildenbrand, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger, Cornelia Huck

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.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/s390/crypto/sha1_s390.c   | 2 +-
 arch/s390/crypto/sha256_s390.c | 2 +-
 arch/s390/crypto/sha512_s390.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c
index 009572e8276d..7c15542d3685 100644
--- a/arch/s390/crypto/sha1_s390.c
+++ b/arch/s390/crypto/sha1_s390.c
@@ -86,7 +86,7 @@ static struct shash_alg alg = {
 static int __init sha1_s390_init(void)
 {
 	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_1))
-		return -EOPNOTSUPP;
+		return -ENODEV;
 	return crypto_register_shash(&alg);
 }
 
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c
index 62833a1d8724..af7505148f80 100644
--- a/arch/s390/crypto/sha256_s390.c
+++ b/arch/s390/crypto/sha256_s390.c
@@ -117,7 +117,7 @@ static int __init sha256_s390_init(void)
 	int ret;
 
 	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_256))
-		return -EOPNOTSUPP;
+		return -ENODEV;
 	ret = crypto_register_shash(&sha256_alg);
 	if (ret < 0)
 		goto out;
diff --git a/arch/s390/crypto/sha512_s390.c b/arch/s390/crypto/sha512_s390.c
index be589c340d15..ad29db085a18 100644
--- a/arch/s390/crypto/sha512_s390.c
+++ b/arch/s390/crypto/sha512_s390.c
@@ -127,7 +127,7 @@ static int __init init(void)
 	int ret;
 
 	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_512))
-		return -EOPNOTSUPP;
+		return -ENODEV;
 	if ((ret = crypto_register_shash(&sha512_alg)) < 0)
 		goto out;
 	if ((ret = crypto_register_shash(&sha384_alg)) < 0)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/4] s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 ` [PATCH v2 4/4] s390/crypto: sha: " David Hildenbrand
@ 2019-06-12 10:30   ` Harald Freudenberger
  2019-06-12 10:37   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Harald Freudenberger @ 2019-06-12 10:30 UTC (permalink / raw)
  To: David Hildenbrand, linux-kernel
  Cc: linux-s390, linux-crypto, Herbert Xu, David S. Miller,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Cornelia Huck

On 12.06.19 12:22, David Hildenbrand wrote:
> 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.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/crypto/sha1_s390.c   | 2 +-
>  arch/s390/crypto/sha256_s390.c | 2 +-
>  arch/s390/crypto/sha512_s390.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c
> index 009572e8276d..7c15542d3685 100644
> --- a/arch/s390/crypto/sha1_s390.c
> +++ b/arch/s390/crypto/sha1_s390.c
> @@ -86,7 +86,7 @@ static struct shash_alg alg = {
>  static int __init sha1_s390_init(void)
>  {
>  	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_1))
> -		return -EOPNOTSUPP;
> +		return -ENODEV;
>  	return crypto_register_shash(&alg);
>  }
>  
> diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c
> index 62833a1d8724..af7505148f80 100644
> --- a/arch/s390/crypto/sha256_s390.c
> +++ b/arch/s390/crypto/sha256_s390.c
> @@ -117,7 +117,7 @@ static int __init sha256_s390_init(void)
>  	int ret;
>  
>  	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_256))
> -		return -EOPNOTSUPP;
> +		return -ENODEV;
>  	ret = crypto_register_shash(&sha256_alg);
>  	if (ret < 0)
>  		goto out;
> diff --git a/arch/s390/crypto/sha512_s390.c b/arch/s390/crypto/sha512_s390.c
> index be589c340d15..ad29db085a18 100644
> --- a/arch/s390/crypto/sha512_s390.c
> +++ b/arch/s390/crypto/sha512_s390.c
> @@ -127,7 +127,7 @@ static int __init init(void)
>  	int ret;
>  
>  	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_512))
> -		return -EOPNOTSUPP;
> +		return -ENODEV;
>  	if ((ret = crypto_register_shash(&sha512_alg)) < 0)
>  		goto out;
>  	if ((ret = crypto_register_shash(&sha384_alg)) < 0)
fine with me
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 3/4] s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 ` [PATCH v2 3/4] s390/crypto: prng: " David Hildenbrand
@ 2019-06-12 10:31   ` Harald Freudenberger
  2019-06-12 10:35   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Harald Freudenberger @ 2019-06-12 10:31 UTC (permalink / raw)
  To: David Hildenbrand, linux-kernel
  Cc: linux-s390, linux-crypto, Herbert Xu, David S. Miller,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Cornelia Huck

On 12.06.19 12:22, David Hildenbrand wrote:
> 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.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  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
fine with me
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/4] s390/crypto: ghash: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 ` [PATCH v2 2/4] s390/crypto: ghash: " David Hildenbrand
@ 2019-06-12 10:31   ` Harald Freudenberger
  2019-06-12 10:32   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Harald Freudenberger @ 2019-06-12 10:31 UTC (permalink / raw)
  To: David Hildenbrand, linux-kernel
  Cc: linux-s390, linux-crypto, Herbert Xu, David S. Miller,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Cornelia Huck

On 12.06.19 12:22, David Hildenbrand wrote:
> 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.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/crypto/ghash_s390.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c
> index 86aed30fad3a..eeeb6a7737a4 100644
> --- a/arch/s390/crypto/ghash_s390.c
> +++ b/arch/s390/crypto/ghash_s390.c
> @@ -137,7 +137,7 @@ static struct shash_alg ghash_alg = {
>  static int __init ghash_mod_init(void)
>  {
>  	if (!cpacf_query_func(CPACF_KIMD, CPACF_KIMD_GHASH))
> -		return -EOPNOTSUPP;
> +		return -ENODEV;
>  
>  	return crypto_register_shash(&ghash_alg);
>  }
fine with me
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/4] s390/crypto: ghash: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 ` [PATCH v2 2/4] s390/crypto: ghash: " David Hildenbrand
  2019-06-12 10:31   ` Harald Freudenberger
@ 2019-06-12 10:32   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Cornelia Huck @ 2019-06-12 10:32 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-s390, linux-crypto, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger

On Wed, 12 Jun 2019 12:22:46 +0200
David Hildenbrand <david@redhat.com> wrote:

> 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.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/crypto/ghash_s390.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 3/4] s390/crypto: prng: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 ` [PATCH v2 3/4] s390/crypto: prng: " David Hildenbrand
  2019-06-12 10:31   ` Harald Freudenberger
@ 2019-06-12 10:35   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Cornelia Huck @ 2019-06-12 10:35 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-s390, linux-crypto, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger

On Wed, 12 Jun 2019 12:22:47 +0200
David Hildenbrand <david@redhat.com> wrote:

> 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.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/crypto/prng.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/4] s390/crypto: sha: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 ` [PATCH v2 4/4] s390/crypto: sha: " David Hildenbrand
  2019-06-12 10:30   ` Harald Freudenberger
@ 2019-06-12 10:37   ` Cornelia Huck
  1 sibling, 0 replies; 15+ messages in thread
From: Cornelia Huck @ 2019-06-12 10:37 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-s390, linux-crypto, Herbert Xu,
	David S. Miller, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Harald Freudenberger

On Wed, 12 Jun 2019 12:22:48 +0200
David Hildenbrand <david@redhat.com> wrote:

> 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.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/crypto/sha1_s390.c   | 2 +-
>  arch/s390/crypto/sha256_s390.c | 2 +-
>  arch/s390/crypto/sha512_s390.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/4] s390/pkey: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:22 ` [PATCH v2 1/4] s390/pkey: " David Hildenbrand
@ 2019-06-12 10:39   ` Harald Freudenberger
  2019-06-12 10:41     ` David Hildenbrand
  0 siblings, 1 reply; 15+ messages in thread
From: Harald Freudenberger @ 2019-06-12 10:39 UTC (permalink / raw)
  To: David Hildenbrand, linux-kernel
  Cc: linux-s390, linux-crypto, Herbert Xu, David S. Miller,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Cornelia Huck

On 12.06.19 12:22, David Hildenbrand wrote:
> systemd-modules-load.service automatically tries to load the pkey module
> on systems that have MSA.
>
> Pkey also requires the MSA3 facility and a bunch of subfunctions.
> Failing with -EOPNOTSUPP makes "systemd-modules-load.service" fail on
> any system that does not have all needed subfunctions. For example,
> when running under QEMU TCG (but also on systems where protected keys
> are disabled via the HMC).
>
> Let's use -ENODEV, so systemd-modules-load.service properly ignores
> failing to load the pkey module because of missing HW functionality.
>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  drivers/s390/crypto/pkey_api.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
> index 45eb0c14b880..ddfcefb47284 100644
> --- a/drivers/s390/crypto/pkey_api.c
> +++ b/drivers/s390/crypto/pkey_api.c
> @@ -1695,15 +1695,15 @@ static int __init pkey_init(void)
>  	 * are able to work with protected keys.
>  	 */
>  	if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
> -		return -EOPNOTSUPP;
> +		return -ENODEV;
>  
>  	/* check for kmc instructions available */
>  	if (!cpacf_query(CPACF_KMC, &kmc_functions))
> -		return -EOPNOTSUPP;
> +		return -ENODEV;
>  	if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
> -		return -EOPNOTSUPP;
> +		return -ENODEV;
>  
>  	pkey_debug_init();
>  
You missed one match in this file. Function pkey_clr2protkey()
also does a cpacf_test_func() and may return -EOPNOTSUPP.
I checked the call chain, it's save to change the returncode there also.
If done, Thanks and add my
reviewed-by: Harald Freudenberger <freude@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/4] s390/pkey: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:39   ` Harald Freudenberger
@ 2019-06-12 10:41     ` David Hildenbrand
  2019-06-12 11:07       ` Harald Freudenberger
  0 siblings, 1 reply; 15+ messages in thread
From: David Hildenbrand @ 2019-06-12 10:41 UTC (permalink / raw)
  To: Harald Freudenberger, linux-kernel
  Cc: linux-s390, linux-crypto, Herbert Xu, David S. Miller,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Cornelia Huck

On 12.06.19 12:39, Harald Freudenberger wrote:
> On 12.06.19 12:22, David Hildenbrand wrote:
>> systemd-modules-load.service automatically tries to load the pkey module
>> on systems that have MSA.
>>
>> Pkey also requires the MSA3 facility and a bunch of subfunctions.
>> Failing with -EOPNOTSUPP makes "systemd-modules-load.service" fail on
>> any system that does not have all needed subfunctions. For example,
>> when running under QEMU TCG (but also on systems where protected keys
>> are disabled via the HMC).
>>
>> Let's use -ENODEV, so systemd-modules-load.service properly ignores
>> failing to load the pkey module because of missing HW functionality.
>>
>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>  drivers/s390/crypto/pkey_api.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
>> index 45eb0c14b880..ddfcefb47284 100644
>> --- a/drivers/s390/crypto/pkey_api.c
>> +++ b/drivers/s390/crypto/pkey_api.c
>> @@ -1695,15 +1695,15 @@ static int __init pkey_init(void)
>>  	 * are able to work with protected keys.
>>  	 */
>>  	if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
>> -		return -EOPNOTSUPP;
>> +		return -ENODEV;
>>  
>>  	/* check for kmc instructions available */
>>  	if (!cpacf_query(CPACF_KMC, &kmc_functions))
>> -		return -EOPNOTSUPP;
>> +		return -ENODEV;
>>  	if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
>>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
>>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
>> -		return -EOPNOTSUPP;
>> +		return -ENODEV;
>>  
>>  	pkey_debug_init();
>>  
> You missed one match in this file. Function pkey_clr2protkey()
> also does a cpacf_test_func() and may return -EOPNOTSUPP.
> I checked the call chain, it's save to change the returncode there also.

That's unrelated to module loading (if I am not wrong), shall we still
include this change here?

Thanks!

> If done, Thanks and add my
> reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
> 


-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/4] s390/pkey: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 10:41     ` David Hildenbrand
@ 2019-06-12 11:07       ` Harald Freudenberger
  2019-06-12 11:08         ` David Hildenbrand
  0 siblings, 1 reply; 15+ messages in thread
From: Harald Freudenberger @ 2019-06-12 11:07 UTC (permalink / raw)
  To: David Hildenbrand, linux-kernel
  Cc: linux-s390, linux-crypto, Herbert Xu, David S. Miller,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Cornelia Huck

On 12.06.19 12:41, David Hildenbrand wrote:
> On 12.06.19 12:39, Harald Freudenberger wrote:
>> On 12.06.19 12:22, David Hildenbrand wrote:
>>> systemd-modules-load.service automatically tries to load the pkey module
>>> on systems that have MSA.
>>>
>>> Pkey also requires the MSA3 facility and a bunch of subfunctions.
>>> Failing with -EOPNOTSUPP makes "systemd-modules-load.service" fail on
>>> any system that does not have all needed subfunctions. For example,
>>> when running under QEMU TCG (but also on systems where protected keys
>>> are disabled via the HMC).
>>>
>>> Let's use -ENODEV, so systemd-modules-load.service properly ignores
>>> failing to load the pkey module because of missing HW functionality.
>>>
>>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>> ---
>>>  drivers/s390/crypto/pkey_api.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
>>> index 45eb0c14b880..ddfcefb47284 100644
>>> --- a/drivers/s390/crypto/pkey_api.c
>>> +++ b/drivers/s390/crypto/pkey_api.c
>>> @@ -1695,15 +1695,15 @@ static int __init pkey_init(void)
>>>  	 * are able to work with protected keys.
>>>  	 */
>>>  	if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
>>> -		return -EOPNOTSUPP;
>>> +		return -ENODEV;
>>>  
>>>  	/* check for kmc instructions available */
>>>  	if (!cpacf_query(CPACF_KMC, &kmc_functions))
>>> -		return -EOPNOTSUPP;
>>> +		return -ENODEV;
>>>  	if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
>>>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
>>>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
>>> -		return -EOPNOTSUPP;
>>> +		return -ENODEV;
>>>  
>>>  	pkey_debug_init();
>>>  
>> You missed one match in this file. Function pkey_clr2protkey()
>> also does a cpacf_test_func() and may return -EOPNOTSUPP.
>> I checked the call chain, it's save to change the returncode there also.
> That's unrelated to module loading (if I am not wrong), shall we still
> include this change here?
>
> Thanks!
That would be nice.
However, I agree it is not related to module loading.
>
>> If done, Thanks and add my
>> reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
>>
>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/4] s390/pkey: Use -ENODEV instead of -EOPNOTSUPP
  2019-06-12 11:07       ` Harald Freudenberger
@ 2019-06-12 11:08         ` David Hildenbrand
  0 siblings, 0 replies; 15+ messages in thread
From: David Hildenbrand @ 2019-06-12 11:08 UTC (permalink / raw)
  To: Harald Freudenberger, linux-kernel
  Cc: linux-s390, linux-crypto, Herbert Xu, David S. Miller,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Cornelia Huck

On 12.06.19 13:07, Harald Freudenberger wrote:
> On 12.06.19 12:41, David Hildenbrand wrote:
>> On 12.06.19 12:39, Harald Freudenberger wrote:
>>> On 12.06.19 12:22, David Hildenbrand wrote:
>>>> systemd-modules-load.service automatically tries to load the pkey module
>>>> on systems that have MSA.
>>>>
>>>> Pkey also requires the MSA3 facility and a bunch of subfunctions.
>>>> Failing with -EOPNOTSUPP makes "systemd-modules-load.service" fail on
>>>> any system that does not have all needed subfunctions. For example,
>>>> when running under QEMU TCG (but also on systems where protected keys
>>>> are disabled via the HMC).
>>>>
>>>> Let's use -ENODEV, so systemd-modules-load.service properly ignores
>>>> failing to load the pkey module because of missing HW functionality.
>>>>
>>>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>>> ---
>>>>  drivers/s390/crypto/pkey_api.c | 6 +++---
>>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
>>>> index 45eb0c14b880..ddfcefb47284 100644
>>>> --- a/drivers/s390/crypto/pkey_api.c
>>>> +++ b/drivers/s390/crypto/pkey_api.c
>>>> @@ -1695,15 +1695,15 @@ static int __init pkey_init(void)
>>>>  	 * are able to work with protected keys.
>>>>  	 */
>>>>  	if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
>>>> -		return -EOPNOTSUPP;
>>>> +		return -ENODEV;
>>>>  
>>>>  	/* check for kmc instructions available */
>>>>  	if (!cpacf_query(CPACF_KMC, &kmc_functions))
>>>> -		return -EOPNOTSUPP;
>>>> +		return -ENODEV;
>>>>  	if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
>>>>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
>>>>  	    !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
>>>> -		return -EOPNOTSUPP;
>>>> +		return -ENODEV;
>>>>  
>>>>  	pkey_debug_init();
>>>>  
>>> You missed one match in this file. Function pkey_clr2protkey()
>>> also does a cpacf_test_func() and may return -EOPNOTSUPP.
>>> I checked the call chain, it's save to change the returncode there also.
>> That's unrelated to module loading (if I am not wrong), shall we still
>> include this change here?
>>
>> Thanks!
> That would be nice.
> However, I agree it is not related to module loading.

I can include that, thanks!


-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-06-12 11:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 10:22 [PATCH v2 0/4] s390/crypto: Use -ENODEV instead of -EOPNOTSUPP David Hildenbrand
2019-06-12 10:22 ` [PATCH v2 1/4] s390/pkey: " David Hildenbrand
2019-06-12 10:39   ` Harald Freudenberger
2019-06-12 10:41     ` David Hildenbrand
2019-06-12 11:07       ` Harald Freudenberger
2019-06-12 11:08         ` David Hildenbrand
2019-06-12 10:22 ` [PATCH v2 2/4] s390/crypto: ghash: " David Hildenbrand
2019-06-12 10:31   ` Harald Freudenberger
2019-06-12 10:32   ` Cornelia Huck
2019-06-12 10:22 ` [PATCH v2 3/4] s390/crypto: prng: " David Hildenbrand
2019-06-12 10:31   ` Harald Freudenberger
2019-06-12 10:35   ` Cornelia Huck
2019-06-12 10:22 ` [PATCH v2 4/4] s390/crypto: sha: " David Hildenbrand
2019-06-12 10:30   ` Harald Freudenberger
2019-06-12 10:37   ` Cornelia Huck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.