Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARCv2: Enable LOCKDEP

- The asm helpers for calling into irq tracer were missing

- Add calls to above helpers in low level assembly entry code for ARCv2

- irq_save() uses CLRI to disable interrupts and returns the prev interrupt
state (in STATUS32) in a specific encoding (and not the raw value of
STATUS32). This is usable with SETI in irq_restore(). However
save_flags() reads the raw value of STATUS32 which doesn't pair with
irq_save/restore() and thus needs fixing.

Signed-off-by: Evgeny Voevodin <evgeny.voevodin@intel.com>
[vgupta: updated changelog and also added some comments]
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

authored by

Evgeny Voevodin and committed by
Vineet Gupta
d9676fa1 c3b46c73

+47 -2
+35 -1
arch/arc/include/asm/irqflags-arcv2.h
··· 18 18 #define STATUS_AD_MASK (1<<STATUS_AD_BIT) 19 19 #define STATUS_IE_MASK (1<<STATUS_IE_BIT) 20 20 21 + /* status32 Bits as encoded/expected by CLRI/SETI */ 22 + #define CLRI_STATUS_IE_BIT 4 23 + 24 + #define CLRI_STATUS_E_MASK 0xF 25 + #define CLRI_STATUS_IE_MASK (1 << CLRI_STATUS_IE_BIT) 26 + 21 27 #define AUX_USER_SP 0x00D 22 28 #define AUX_IRQ_CTRL 0x00E 23 29 #define AUX_IRQ_ACT 0x043 /* Active Intr across all levels */ ··· 106 100 : 107 101 : "memory"); 108 102 103 + /* To be compatible with irq_save()/irq_restore() 104 + * encode the irq bits as expected by CLRI/SETI 105 + * (this was needed to make CONFIG_TRACE_IRQFLAGS work) 106 + */ 107 + temp = (1 << 5) | 108 + ((!!(temp & STATUS_IE_MASK)) << CLRI_STATUS_IE_BIT) | 109 + (temp & CLRI_STATUS_E_MASK); 109 110 return temp; 110 111 } 111 112 ··· 121 108 */ 122 109 static inline int arch_irqs_disabled_flags(unsigned long flags) 123 110 { 124 - return !(flags & (STATUS_IE_MASK)); 111 + return !(flags & CLRI_STATUS_IE_MASK); 125 112 } 126 113 127 114 static inline int arch_irqs_disabled(void) ··· 141 128 142 129 #else 143 130 131 + #ifdef CONFIG_TRACE_IRQFLAGS 132 + 133 + .macro TRACE_ASM_IRQ_DISABLE 134 + bl trace_hardirqs_off 135 + .endm 136 + 137 + .macro TRACE_ASM_IRQ_ENABLE 138 + bl trace_hardirqs_on 139 + .endm 140 + 141 + #else 142 + 143 + .macro TRACE_ASM_IRQ_DISABLE 144 + .endm 145 + 146 + .macro TRACE_ASM_IRQ_ENABLE 147 + .endm 148 + 149 + #endif 144 150 .macro IRQ_DISABLE scratch 145 151 clri 152 + TRACE_ASM_IRQ_DISABLE 146 153 .endm 147 154 148 155 .macro IRQ_ENABLE scratch 156 + TRACE_ASM_IRQ_ENABLE 149 157 seti 150 158 .endm 151 159
+9 -1
arch/arc/kernel/entry-arcv2.S
··· 69 69 70 70 clri ; To make status32.IE agree with CPU internal state 71 71 72 - lr r0, [ICAUSE] 72 + #ifdef CONFIG_TRACE_IRQFLAGS 73 + TRACE_ASM_IRQ_DISABLE 74 + #endif 73 75 76 + lr r0, [ICAUSE] 74 77 mov blink, ret_from_exception 75 78 76 79 b.d arch_do_IRQ ··· 171 168 ; All 2 entry points to here already disable interrupts 172 169 173 170 .Lrestore_regs: 171 + 172 + # Interrpts are actually disabled from this point on, but will get 173 + # reenabled after we return from interrupt/exception. 174 + # But irq tracer needs to be told now... 175 + TRACE_ASM_IRQ_ENABLE 174 176 175 177 ld r0, [sp, PT_status32] ; U/K mode at time of entry 176 178 lr r10, [AUX_IRQ_ACT]
+3
arch/arc/kernel/entry-compact.S
··· 341 341 342 342 .Lrestore_regs: 343 343 344 + # Interrpts are actually disabled from this point on, but will get 345 + # reenabled after we return from interrupt/exception. 346 + # But irq tracer needs to be told now... 344 347 TRACE_ASM_IRQ_ENABLE 345 348 346 349 lr r10, [status32]