--- zzzz-none-000/linux-4.4.271/arch/mips/include/asm/irqflags.h 2021-06-03 06:22:09.000000000 +0000 +++ dakota-7530ac-750/linux-4.4.271/arch/mips/include/asm/irqflags.h 2023-01-11 09:25:41.000000000 +0000 @@ -18,25 +18,38 @@ #include #include +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) +#include + +#define _local_RET_IP_ ((unsigned long)__builtin_return_address(0)) +#endif/*--- #if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) ---*/ + + #if defined(CONFIG_CPU_MIPSR2) || defined (CONFIG_CPU_MIPSR6) -static inline void arch_local_irq_disable(void) +static inline unsigned long arch_local_irq_save(void) { - __asm__ __volatile__( + unsigned long flags; +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + unsigned long pc_addr; + + asm __volatile__( " .set push \n" + " .set reorder \n" " .set noat \n" - " di \n" + " la %[pc_addr], 1f \n" + "1: di %[flags] \n" + " andi %[flags], 1 \n" " " __stringify(__irq_disable_hazard) " \n" " .set pop \n" - : /* no outputs */ + : [flags] "=r" (flags), [pc_addr] "=r" (pc_addr) : /* no inputs */ : "memory"); -} - -static inline unsigned long arch_local_irq_save(void) -{ - unsigned long flags; + avm_simple_profiling_irq_disabled(pc_addr, _local_RET_IP_, + !flags, /* old-disable-status */ + 0x1 /* new-disable-status */); +#else asm __volatile__( " .set push \n" " .set reorder \n" @@ -48,13 +61,35 @@ : [flags] "=r" (flags) : /* no inputs */ : "memory"); - +#endif return flags; } +static inline void arch_local_irq_disable(void) +{ +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + arch_local_irq_save(); + return; +#endif/*--- #if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) ---*/ + __asm__ __volatile__( + " .set push \n" + " .set noat \n" + " di \n" + " " __stringify(__irq_disable_hazard) " \n" + " .set pop \n" + : /* no outputs */ + : /* no inputs */ + : "memory"); +} static inline void arch_local_irq_restore(unsigned long flags) { unsigned long __tmp1; +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled((unsigned long)&&here, _local_RET_IP_, + 0x1, /* old-disable-status */ + !(flags & 0x1) /* new-disable-status */); +here: +#endif __asm__ __volatile__( " .set push \n" @@ -86,6 +121,12 @@ static inline void __arch_local_irq_restore(unsigned long flags) { +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled((unsigned long)&&here, _local_RET_IP_, + 0x1, /* old-disable-status */ + !(flags & 0x1) /* new-disable-status */); +here: +#endif __asm__ __volatile__( " .set push \n" " .set noreorder \n" @@ -121,8 +162,30 @@ void __arch_local_irq_restore(unsigned long flags); #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ +static inline unsigned long arch_local_save_flags(void) +{ + unsigned long flags; + + asm __volatile__( + " .set push \n" + " .set reorder \n" + " mfc0 %[flags], $12 \n" + " .set pop \n" + : [flags] "=r" (flags)); + + return flags; +} + static inline void arch_local_irq_enable(void) { +#if IS_ENABLED(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + unsigned long flags = arch_local_save_flags(); + + avm_simple_profiling_irq_disabled((unsigned long)&&here, _local_RET_IP_, + !(flags & 1), /* old-disable-status */ + 0x0 /* new-disable-status */); +here: +#endif __asm__ __volatile__( " .set push \n" " .set reorder \n" @@ -142,20 +205,6 @@ : "memory"); } -static inline unsigned long arch_local_save_flags(void) -{ - unsigned long flags; - - asm __volatile__( - " .set push \n" - " .set reorder \n" - " mfc0 %[flags], $12 \n" - " .set pop \n" - : [flags] "=r" (flags)); - - return flags; -} - static inline int arch_irqs_disabled_flags(unsigned long flags) {