2022-07-13 13:18:54

by Steffen Eiden

[permalink] [raw]
Subject: [PATCH v2 0/3] s390/cpufeature: rework to allow different types of cpufeatures

Currently the s390 implementaion of cpufeature is limited to elf_hwcap
bits. Using these to automatically load modules also exposes this
cpufeature to userspace which, sometimes is not intended.

Therefore, rework the s390-cpufeature implementation to allow for
various cpu feature indications, which is not only limited to hwcap bits.

Add a new type to allow facilities to be a cpufeature without using
hwcap bits that expose this feature to userspace.

Load uvdevice when facility 158 is present.

since v1:
* add r-bs from Claudio
* worked in comments

Heiko Carstens (2):
s390/cpufeature: rework to allow more than only hwcap bits
s390/cpufeature: allow for facility bits

Steffen Eiden (1):
s390/uvdevice: autoload module based on CPU facility

arch/s390/crypto/aes_s390.c | 2 +-
arch/s390/crypto/chacha-glue.c | 2 +-
arch/s390/crypto/crc32-vx.c | 2 +-
arch/s390/crypto/des_s390.c | 2 +-
arch/s390/crypto/ghash_s390.c | 2 +-
arch/s390/crypto/prng.c | 2 +-
arch/s390/crypto/sha1_s390.c | 2 +-
arch/s390/crypto/sha256_s390.c | 2 +-
arch/s390/crypto/sha3_256_s390.c | 2 +-
arch/s390/crypto/sha3_512_s390.c | 2 +-
arch/s390/crypto/sha512_s390.c | 2 +-
arch/s390/include/asm/cpufeature.h | 23 ++++++---------
arch/s390/kernel/Makefile | 2 +-
arch/s390/kernel/cpufeature.c | 46 ++++++++++++++++++++++++++++++
arch/s390/kernel/processor.c | 10 -------
drivers/char/hw_random/s390-trng.c | 2 +-
drivers/s390/char/uvdevice.c | 5 ++--
drivers/s390/crypto/pkey_api.c | 2 +-
18 files changed, 70 insertions(+), 42 deletions(-)
create mode 100644 arch/s390/kernel/cpufeature.c

--
2.35.3


2022-07-13 13:27:09

by Steffen Eiden

[permalink] [raw]
Subject: [PATCH v2 2/3] s390/cpufeature: allow for facility bits

From: Heiko Carstens <[email protected]>

Allow for facility bits to be used in cpu features.

Signed-off-by: Heiko Carstens <[email protected]>
Reviewed-by: Claudio Imbrenda <[email protected]>
Reviewed-by: Steffen Eiden <[email protected]>
---
arch/s390/kernel/cpufeature.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/s390/kernel/cpufeature.c b/arch/s390/kernel/cpufeature.c
index 9044c75d8b38..170894730fcc 100644
--- a/arch/s390/kernel/cpufeature.c
+++ b/arch/s390/kernel/cpufeature.c
@@ -8,6 +8,7 @@

enum {
TYPE_HWCAP,
+ TYPE_FACILITY,
};

struct s390_cpu_feature {
@@ -34,6 +35,8 @@ int cpu_have_feature(unsigned int num)
switch (feature->type) {
case TYPE_HWCAP:
return !!(elf_hwcap & BIT(feature->num));
+ case TYPE_FACILITY:
+ return test_facility(feature->num);
default:
WARN_ON_ONCE(1);
return 0;
--
2.35.3

2022-07-14 11:42:34

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] s390/cpufeature: rework to allow different types of cpufeatures

On Wed, Jul 13, 2022 at 02:56:41PM +0200, Steffen Eiden wrote:
> Currently the s390 implementaion of cpufeature is limited to elf_hwcap
> bits. Using these to automatically load modules also exposes this
> cpufeature to userspace which, sometimes is not intended.
>
> Therefore, rework the s390-cpufeature implementation to allow for
> various cpu feature indications, which is not only limited to hwcap bits.
>
> Add a new type to allow facilities to be a cpufeature without using
> hwcap bits that expose this feature to userspace.
>
> Load uvdevice when facility 158 is present.
>
> since v1:
> * add r-bs from Claudio
> * worked in comments
>
> Heiko Carstens (2):
> s390/cpufeature: rework to allow more than only hwcap bits
> s390/cpufeature: allow for facility bits
>
> Steffen Eiden (1):
> s390/uvdevice: autoload module based on CPU facility

Series applied, thanks!

2022-07-15 08:09:59

by Hendrik Brueckner

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] s390/cpufeature: rework to allow different types of cpufeatures

Maybe, I am bit late ...

On Wed, Jul 13, 2022 at 02:56:41PM +0200, Steffen Eiden wrote:
> Currently the s390 implementaion of cpufeature is limited to elf_hwcap
> bits. Using these to automatically load modules also exposes this
> cpufeature to userspace which, sometimes is not intended.

Those features are (always) exposed to user space as module loading is
actually done by udev rules. However, we had some pseudo-hwcaps (e.g. sie64a)
in the past.. but I very appreciate this change!

Thanks.