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

While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with UAPI headers that rather should use __ASSEMBLER__ instead. So let's standardize on the __ASSEMBLER__ macro that is provided by the compilers now. This is mostly a mechanical patch (done with a simple "sed -i" statement), with some manual tweaks in <asm/frame.h>, <asm/hw_irq.h> and <asm/setup.h> that mentioned this macro in comments with some missing underscores. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Juergen Gross <jgross@suse.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20250314071013.1575167-38-thuth@redhat.com
38 lines
905 B
C
38 lines
905 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_CPUMASK_H
|
|
#define _ASM_X86_CPUMASK_H
|
|
#ifndef __ASSEMBLER__
|
|
#include <linux/cpumask.h>
|
|
|
|
extern void setup_cpu_local_masks(void);
|
|
|
|
/*
|
|
* NMI and MCE exceptions need cpu_is_offline() _really_ early,
|
|
* provide an arch_ special for them to avoid instrumentation.
|
|
*/
|
|
#if NR_CPUS > 1
|
|
static __always_inline bool arch_cpu_online(int cpu)
|
|
{
|
|
return arch_test_bit(cpu, cpumask_bits(cpu_online_mask));
|
|
}
|
|
|
|
static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
|
|
{
|
|
arch_clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
|
|
}
|
|
#else
|
|
static __always_inline bool arch_cpu_online(int cpu)
|
|
{
|
|
return cpu == 0;
|
|
}
|
|
|
|
static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
|
|
{
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
#define arch_cpu_is_offline(cpu) unlikely(!arch_cpu_online(cpu))
|
|
|
|
#endif /* __ASSEMBLER__ */
|
|
#endif /* _ASM_X86_CPUMASK_H */
|