mbox series

[0/4] Make crypto/internal/simd.h resilient

Message ID cover.1744356724.git.herbert@gondor.apana.org.au
Headers show
Series Make crypto/internal/simd.h resilient | expand

Message

Herbert Xu April 11, 2025, 7:38 a.m. UTC
If you include crypto/internal/simd.h without asm/simd.h the build
may fail because may_use_simd isn't defined.  Fix this by including
asm/simd.h in crypto/internal/simd.h.

It turns out that there is a generic simd.h, it just couldn't be
included twice.  Thiat patch series fixes this problem.

Herbert Xu (4):
  asm-generic: Make simd.h more resilient
  arm: Make simd.h more resilient
  x86: Make simd.h more resilient
  crypto: simd - Include asm/simd.h in internal/simd.h

 arch/arm/include/asm/simd.h    | 8 +++++++-
 arch/x86/include/asm/simd.h    | 6 ++++++
 include/asm-generic/simd.h     | 8 +++++++-
 include/crypto/internal/simd.h | 4 +---
 4 files changed, 21 insertions(+), 5 deletions(-)

Comments

Eric Biggers April 16, 2025, 5:09 p.m. UTC | #1
On Fri, Apr 11, 2025 at 03:38:43PM +0800, Herbert Xu wrote:
> Add missing header inclusions and protect against double inclusion.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> ---
>  include/asm-generic/simd.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/include/asm-generic/simd.h b/include/asm-generic/simd.h
> index d0343d58a74a..ac29a22eb7cf 100644
> --- a/include/asm-generic/simd.h
> +++ b/include/asm-generic/simd.h
> @@ -1,6 +1,10 @@
>  /* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _ASM_GENERIC_SIMD_H
> +#define _ASM_GENERIC_SIMD_H
>  
> -#include <linux/hardirq.h>
> +#include <linux/compiler_attributes.h>
> +#include <linux/preempt.h>
> +#include <linux/types.h>
>  
>  /*
>   * may_use_simd - whether it is allowable at this time to issue SIMD
> @@ -13,3 +17,5 @@ static __must_check inline bool may_use_simd(void)
>  {
>  	return !in_interrupt();
>  }
> +
> +#endif	/* _ASM_GENERIC_SIMD_H */

This patch broke the powerpc build:

../arch/powerpc/lib/crc32-glue.c: In function 'crc32c_arch':
../arch/powerpc/lib/crc32-glue.c:44:17: error: implicit declaration of function 'pagefault_disable'; did you mean 'preempt_disable'? [-Wimplicit-function-declaration]
   44 |                 pagefault_disable();
      |                 ^~~~~~~~~~~~~~~~~
      |                 preempt_disable
../arch/powerpc/lib/crc-t10dif-glue.c: In function 'crc_t10dif_arch':
../arch/powerpc/lib/crc-t10dif-glue.c:48:17: error: implicit declaration of function 'pagefault_disable'; did you mean 'preempt_disable'? [-Wimplicit-function-declaration]
   48 |                 pagefault_disable();
      |                 ^~~~~~~~~~~~~~~~~
      |                 preempt_disable
../arch/powerpc/lib/crc32-glue.c:48:17: error: implicit declaration of function 'pagefault_enable'; did you mean 'preempt_enable'? [-Wimplicit-function-declaration]
   48 |                 pagefault_enable();
      |                 ^~~~~~~~~~~~~~~~
      |                 preempt_enable
../arch/powerpc/lib/crc-t10dif-glue.c:52:17: error: implicit declaration of function 'pagefault_enable'; did you mean 'preempt_enable'? [-Wimplicit-function-declaration]
   52 |                 pagefault_enable();
      |                 ^~~~~~~~~~~~~~~~
      |                 preempt_enable