mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 11:37:47 +07:00
6fb18ac936
Commit cb1293e2f5
("ARM: 8375/1: disable some options on ARMv7-M")
causes the build to on ARMv7-M machines:
CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/sem.h:5:0,
from include/linux/sched.h:35,
from arch/arm/kernel/asm-offsets.c:14:
include/linux/rcupdate.h: In function 'rcu_read_lock_sched_held':
include/linux/rcupdate.h:539:2: error: implicit declaration of function
'arch_irqs_disabled' [-Werror=implicit-function-declaration]
return preempt_count() != 0 || irqs_disabled();
asm-generic/irqflags.h provides an implementation of arch_irqs_disabled().
Lets grab an implementation from there!
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
177 lines
3.5 KiB
C
177 lines
3.5 KiB
C
#ifndef __ASM_ARM_IRQFLAGS_H
|
|
#define __ASM_ARM_IRQFLAGS_H
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
/*
|
|
* CPU interrupt mask handling.
|
|
*/
|
|
#ifdef CONFIG_CPU_V7M
|
|
#define IRQMASK_REG_NAME_R "primask"
|
|
#define IRQMASK_REG_NAME_W "primask"
|
|
#define IRQMASK_I_BIT 1
|
|
#else
|
|
#define IRQMASK_REG_NAME_R "cpsr"
|
|
#define IRQMASK_REG_NAME_W "cpsr_c"
|
|
#define IRQMASK_I_BIT PSR_I_BIT
|
|
#endif
|
|
|
|
#if __LINUX_ARM_ARCH__ >= 6
|
|
|
|
#define arch_local_irq_save arch_local_irq_save
|
|
static inline unsigned long arch_local_irq_save(void)
|
|
{
|
|
unsigned long flags;
|
|
|
|
asm volatile(
|
|
" mrs %0, " IRQMASK_REG_NAME_R " @ arch_local_irq_save\n"
|
|
" cpsid i"
|
|
: "=r" (flags) : : "memory", "cc");
|
|
return flags;
|
|
}
|
|
|
|
#define arch_local_irq_enable arch_local_irq_enable
|
|
static inline void arch_local_irq_enable(void)
|
|
{
|
|
asm volatile(
|
|
" cpsie i @ arch_local_irq_enable"
|
|
:
|
|
:
|
|
: "memory", "cc");
|
|
}
|
|
|
|
#define arch_local_irq_disable arch_local_irq_disable
|
|
static inline void arch_local_irq_disable(void)
|
|
{
|
|
asm volatile(
|
|
" cpsid i @ arch_local_irq_disable"
|
|
:
|
|
:
|
|
: "memory", "cc");
|
|
}
|
|
|
|
#define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
|
|
#define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
|
|
#else
|
|
|
|
/*
|
|
* Save the current interrupt enable state & disable IRQs
|
|
*/
|
|
#define arch_local_irq_save arch_local_irq_save
|
|
static inline unsigned long arch_local_irq_save(void)
|
|
{
|
|
unsigned long flags, temp;
|
|
|
|
asm volatile(
|
|
" mrs %0, cpsr @ arch_local_irq_save\n"
|
|
" orr %1, %0, #128\n"
|
|
" msr cpsr_c, %1"
|
|
: "=r" (flags), "=r" (temp)
|
|
:
|
|
: "memory", "cc");
|
|
return flags;
|
|
}
|
|
|
|
/*
|
|
* Enable IRQs
|
|
*/
|
|
#define arch_local_irq_enable arch_local_irq_enable
|
|
static inline void arch_local_irq_enable(void)
|
|
{
|
|
unsigned long temp;
|
|
asm volatile(
|
|
" mrs %0, cpsr @ arch_local_irq_enable\n"
|
|
" bic %0, %0, #128\n"
|
|
" msr cpsr_c, %0"
|
|
: "=r" (temp)
|
|
:
|
|
: "memory", "cc");
|
|
}
|
|
|
|
/*
|
|
* Disable IRQs
|
|
*/
|
|
#define arch_local_irq_disable arch_local_irq_disable
|
|
static inline void arch_local_irq_disable(void)
|
|
{
|
|
unsigned long temp;
|
|
asm volatile(
|
|
" mrs %0, cpsr @ arch_local_irq_disable\n"
|
|
" orr %0, %0, #128\n"
|
|
" msr cpsr_c, %0"
|
|
: "=r" (temp)
|
|
:
|
|
: "memory", "cc");
|
|
}
|
|
|
|
/*
|
|
* Enable FIQs
|
|
*/
|
|
#define local_fiq_enable() \
|
|
({ \
|
|
unsigned long temp; \
|
|
__asm__ __volatile__( \
|
|
"mrs %0, cpsr @ stf\n" \
|
|
" bic %0, %0, #64\n" \
|
|
" msr cpsr_c, %0" \
|
|
: "=r" (temp) \
|
|
: \
|
|
: "memory", "cc"); \
|
|
})
|
|
|
|
/*
|
|
* Disable FIQs
|
|
*/
|
|
#define local_fiq_disable() \
|
|
({ \
|
|
unsigned long temp; \
|
|
__asm__ __volatile__( \
|
|
"mrs %0, cpsr @ clf\n" \
|
|
" orr %0, %0, #64\n" \
|
|
" msr cpsr_c, %0" \
|
|
: "=r" (temp) \
|
|
: \
|
|
: "memory", "cc"); \
|
|
})
|
|
|
|
#endif
|
|
|
|
/*
|
|
* Save the current interrupt enable state.
|
|
*/
|
|
#define arch_local_save_flags arch_local_save_flags
|
|
static inline unsigned long arch_local_save_flags(void)
|
|
{
|
|
unsigned long flags;
|
|
asm volatile(
|
|
" mrs %0, " IRQMASK_REG_NAME_R " @ local_save_flags"
|
|
: "=r" (flags) : : "memory", "cc");
|
|
return flags;
|
|
}
|
|
|
|
/*
|
|
* restore saved IRQ & FIQ state
|
|
*/
|
|
#define arch_local_irq_restore arch_local_irq_restore
|
|
static inline void arch_local_irq_restore(unsigned long flags)
|
|
{
|
|
asm volatile(
|
|
" msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore"
|
|
:
|
|
: "r" (flags)
|
|
: "memory", "cc");
|
|
}
|
|
|
|
#define arch_irqs_disabled_flags arch_irqs_disabled_flags
|
|
static inline int arch_irqs_disabled_flags(unsigned long flags)
|
|
{
|
|
return flags & IRQMASK_I_BIT;
|
|
}
|
|
|
|
#include <asm-generic/irqflags.h>
|
|
|
|
#endif /* ifdef __KERNEL__ */
|
|
#endif /* ifndef __ASM_ARM_IRQFLAGS_H */
|