Re: [PATCH v2 1/3] s390/cpufeature: rework to allow more than only hwcap bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 13, 2022 at 02:56:42PM +0200, Steffen Eiden wrote:
> From: Heiko Carstens <hca@xxxxxxxxxxxxx>
> 
> Rework cpufeature implementation to allow for various cpu feature
> indications, which is not only limited to hwcap bits. This is achieved
> by adding a sequential list of cpu feature numbers, where each of them
> is mapped to an entry which indicates what this number is about.
> 
> Each entry contains a type member, which indicates what feature
> name space to look into (e.g. hwcap, or cpu facility). If wanted this
> allows also to automatically load modules only in e.g. z/VM
> configurations.
> 
> Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
> Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>
> ---
>  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 +-

Regarding facility bits for cpu features:  Initially, I used
MSA hwcap to cover all ciphers among all hw generations. With facility bit
checks, it makes more sense to fine-tune and load based on respective
MSA level or CPACF functions that is required for ciphers/hashes.


E.g. like

> diff --git a/arch/s390/crypto/sha512_s390.c b/arch/s390/crypto/sha512_s390.c
> index 43ce4956df73..04f11c407763 100644
> --- a/arch/s390/crypto/sha512_s390.c
> +++ b/arch/s390/crypto/sha512_s390.c
> @@ -142,7 +142,7 @@ static void __exit fini(void)
>  	crypto_unregister_shash(&sha384_alg);
>  }
> 
> -module_cpu_feature_match(MSA, init);
> +module_cpu_feature_match(S390_CPU_FEATURE_MSA, init);
>  module_exit(fini);

which becomes automatically loaded if (any) MSA is available and then
performs this check:

	cpacf_query_func(CPACF_KIMD, CPACF_KIMD_SHA_512

which in the worst case would fail.

This might be a very useful follow-up patch to remove those mod init checks
into the cpu feature.

Other than that,

Reviewed-by: Hendrik Brueckner <brueckner@xxxxxxxxxxxxx>



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux