--- zzzz-none-000/linux-4.19.183/arch/arm/include/asm/irqflags.h 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/arch/arm/include/asm/irqflags.h 2023-06-28 08:54:18.000000000 +0000 @@ -21,21 +21,43 @@ #if __LINUX_ARM_ARCH__ >= 6 +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) +#include +#define _local_RET_IP_ (unsigned long)__builtin_return_address(0) +static inline unsigned long arch_local_save_flags(void); +#endif + #define arch_local_irq_save arch_local_irq_save static inline unsigned long arch_local_irq_save(void) { - unsigned long flags; + unsigned long flags, pc_addr __maybe_unused; asm volatile( + " mov %1, pc\n" " mrs %0, " IRQMASK_REG_NAME_R " @ arch_local_irq_save\n" " cpsid i" - : "=r" (flags) : : "memory", "cc"); + : "=r" (flags), "=r" (pc_addr) + : + : "memory", "cc"); +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled(pc_addr, _local_RET_IP_, + flags & PSR_I_BIT, /* old-status */ + PSR_I_BIT /* new-status */); +#endif/*--- #if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) ---*/ return flags; } #define arch_local_irq_enable arch_local_irq_enable static inline void arch_local_irq_enable(void) { +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + unsigned long flags = arch_local_save_flags(); + + avm_simple_profiling_irq_disabled((unsigned long)&&here, _local_RET_IP_, + flags & PSR_I_BIT, /* old-status */ + 0 /* new-status */); +here: +#endif/*--- #if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) ---*/ asm volatile( " cpsie i @ arch_local_irq_enable" : @@ -46,6 +68,10 @@ #define arch_local_irq_disable arch_local_irq_disable static inline void arch_local_irq_disable(void) { +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + arch_local_irq_save(); + return; +#endif/*--- #if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) ---*/ asm volatile( " cpsid i @ arch_local_irq_disable" : @@ -163,11 +189,17 @@ } /* - * restore saved IRQ & FIQ state + * restore saved IRQ state */ #define arch_local_irq_restore arch_local_irq_restore static inline void arch_local_irq_restore(unsigned long flags) { +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled((unsigned long)&&here, _local_RET_IP_, + PSR_I_BIT, /* old-status */ + (flags & PSR_I_BIT) /* new-status */); +here: +#endif/*--- #if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) ---*/ asm volatile( " msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore" :