diff options
author | Evgeny Voevodin <evgeny.voevodin@intel.com> | 2016-03-23 05:26:52 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2016-04-22 08:42:31 -0400 |
commit | d9676fa152c83b82137af950b1d4f629045d90c9 (patch) | |
tree | 0351ddfe5922e63ca60db11660d878f21f7de7f0 | |
parent | c3b46c73264b03000d1e18b22f5caf63332547c9 (diff) |
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>
-rw-r--r-- | arch/arc/include/asm/irqflags-arcv2.h | 36 | ||||
-rw-r--r-- | arch/arc/kernel/entry-arcv2.S | 10 | ||||
-rw-r--r-- | arch/arc/kernel/entry-compact.S | 3 |
3 files changed, 47 insertions, 2 deletions
diff --git a/arch/arc/include/asm/irqflags-arcv2.h b/arch/arc/include/asm/irqflags-arcv2.h index 37c2f751eebf..d1ec7f6b31e0 100644 --- a/arch/arc/include/asm/irqflags-arcv2.h +++ b/arch/arc/include/asm/irqflags-arcv2.h | |||
@@ -18,6 +18,12 @@ | |||
18 | #define STATUS_AD_MASK (1<<STATUS_AD_BIT) | 18 | #define STATUS_AD_MASK (1<<STATUS_AD_BIT) |
19 | #define STATUS_IE_MASK (1<<STATUS_IE_BIT) | 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 | #define AUX_USER_SP 0x00D | 27 | #define AUX_USER_SP 0x00D |
22 | #define AUX_IRQ_CTRL 0x00E | 28 | #define AUX_IRQ_CTRL 0x00E |
23 | #define AUX_IRQ_ACT 0x043 /* Active Intr across all levels */ | 29 | #define AUX_IRQ_ACT 0x043 /* Active Intr across all levels */ |
@@ -100,6 +106,13 @@ static inline long arch_local_save_flags(void) | |||
100 | : | 106 | : |
101 | : "memory"); | 107 | : "memory"); |
102 | 108 | ||
109 | /* To be compatible with irq_save()/irq_restore() | ||
110 | * encode the irq bits as expected by CLRI/SETI | ||
111 | * (this was needed to make CONFIG_TRACE_IRQFLAGS work) | ||
112 | */ | ||
113 | temp = (1 << 5) | | ||
114 | ((!!(temp & STATUS_IE_MASK)) << CLRI_STATUS_IE_BIT) | | ||
115 | (temp & CLRI_STATUS_E_MASK); | ||
103 | return temp; | 116 | return temp; |
104 | } | 117 | } |
105 | 118 | ||
@@ -108,7 +121,7 @@ static inline long arch_local_save_flags(void) | |||
108 | */ | 121 | */ |
109 | static inline int arch_irqs_disabled_flags(unsigned long flags) | 122 | static inline int arch_irqs_disabled_flags(unsigned long flags) |
110 | { | 123 | { |
111 | return !(flags & (STATUS_IE_MASK)); | 124 | return !(flags & CLRI_STATUS_IE_MASK); |
112 | } | 125 | } |
113 | 126 | ||
114 | static inline int arch_irqs_disabled(void) | 127 | static inline int arch_irqs_disabled(void) |
@@ -128,11 +141,32 @@ static inline void arc_softirq_clear(int irq) | |||
128 | 141 | ||
129 | #else | 142 | #else |
130 | 143 | ||
144 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
145 | |||
146 | .macro TRACE_ASM_IRQ_DISABLE | ||
147 | bl trace_hardirqs_off | ||
148 | .endm | ||
149 | |||
150 | .macro TRACE_ASM_IRQ_ENABLE | ||
151 | bl trace_hardirqs_on | ||
152 | .endm | ||
153 | |||
154 | #else | ||
155 | |||
156 | .macro TRACE_ASM_IRQ_DISABLE | ||
157 | .endm | ||
158 | |||
159 | .macro TRACE_ASM_IRQ_ENABLE | ||
160 | .endm | ||
161 | |||
162 | #endif | ||
131 | .macro IRQ_DISABLE scratch | 163 | .macro IRQ_DISABLE scratch |
132 | clri | 164 | clri |
165 | TRACE_ASM_IRQ_DISABLE | ||
133 | .endm | 166 | .endm |
134 | 167 | ||
135 | .macro IRQ_ENABLE scratch | 168 | .macro IRQ_ENABLE scratch |
169 | TRACE_ASM_IRQ_ENABLE | ||
136 | seti | 170 | seti |
137 | .endm | 171 | .endm |
138 | 172 | ||
diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S index c1264607bbff..7a1c124ff021 100644 --- a/arch/arc/kernel/entry-arcv2.S +++ b/arch/arc/kernel/entry-arcv2.S | |||
@@ -69,8 +69,11 @@ ENTRY(handle_interrupt) | |||
69 | 69 | ||
70 | clri ; To make status32.IE agree with CPU internal state | 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 | mov blink, ret_from_exception | 77 | mov blink, ret_from_exception |
75 | 78 | ||
76 | b.d arch_do_IRQ | 79 | b.d arch_do_IRQ |
@@ -169,6 +172,11 @@ END(EV_TLBProtV) | |||
169 | 172 | ||
170 | .Lrestore_regs: | 173 | .Lrestore_regs: |
171 | 174 | ||
175 | # Interrpts are actually disabled from this point on, but will get | ||
176 | # reenabled after we return from interrupt/exception. | ||
177 | # But irq tracer needs to be told now... | ||
178 | TRACE_ASM_IRQ_ENABLE | ||
179 | |||
172 | ld r0, [sp, PT_status32] ; U/K mode at time of entry | 180 | ld r0, [sp, PT_status32] ; U/K mode at time of entry |
173 | lr r10, [AUX_IRQ_ACT] | 181 | lr r10, [AUX_IRQ_ACT] |
174 | 182 | ||
diff --git a/arch/arc/kernel/entry-compact.S b/arch/arc/kernel/entry-compact.S index 431433929189..0cb0abaa0479 100644 --- a/arch/arc/kernel/entry-compact.S +++ b/arch/arc/kernel/entry-compact.S | |||
@@ -341,6 +341,9 @@ END(call_do_page_fault) | |||
341 | 341 | ||
342 | .Lrestore_regs: | 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 | TRACE_ASM_IRQ_ENABLE | 347 | TRACE_ASM_IRQ_ENABLE |
345 | 348 | ||
346 | lr r10, [status32] | 349 | lr r10, [status32] |