mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Commit7ba8df4781
("asm-generic: Make simd.h more resilient") causes a build error for PREEMPT_RT kernels: CC lib/crypto/sha256.o In file included from ./include/asm-generic/simd.h:6, from ./arch/loongarch/include/generated/asm/simd.h:1, from ./include/crypto/internal/simd.h:9, from ./include/crypto/internal/sha2.h:6, from lib/crypto/sha256.c:15: ./include/asm-generic/simd.h: In function 'may_use_simd': ./include/linux/preempt.h:111:34: error: 'current' undeclared (first use in this function) 111 | # define softirq_count() (current->softirq_disable_cnt & SOFTIRQ_MASK) | ^~~~~~~ ./include/linux/preempt.h:112:82: note: in expansion of macro 'softirq_count' 112 | # define irq_count() ((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) | softirq_count()) | ^~~~~~~~~~~~~ ./include/linux/preempt.h:143:34: note: in expansion of macro 'irq_count' 143 | #define in_interrupt() (irq_count()) | ^~~~~~~~~ ./include/asm-generic/simd.h:18:17: note: in expansion of macro 'in_interrupt' 18 | return !in_interrupt(); | ^~~~~~~~~~~~ So add sched.h inclusion in simd.h to fix it. Fixes:7ba8df4781
("asm-generic: Make simd.h more resilient") Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
22 lines
615 B
C
22 lines
615 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_GENERIC_SIMD_H
|
|
#define _ASM_GENERIC_SIMD_H
|
|
|
|
#include <linux/compiler_attributes.h>
|
|
#include <linux/preempt.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/types.h>
|
|
|
|
/*
|
|
* may_use_simd - whether it is allowable at this time to issue SIMD
|
|
* instructions or access the SIMD register file
|
|
*
|
|
* As architectures typically don't preserve the SIMD register file when
|
|
* taking an interrupt, !in_interrupt() should be a reasonable default.
|
|
*/
|
|
static __must_check inline bool may_use_simd(void)
|
|
{
|
|
return !in_interrupt();
|
|
}
|
|
|
|
#endif /* _ASM_GENERIC_SIMD_H */
|