aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-11-24 00:55:29 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-04 12:17:02 -0500
commitb4f4372f96e0573d752d9e45beda02fabf716cc8 (patch)
tree641798dfe78c1407908c68b64427cd55cdc18b34
parentc6afec5e4d323e7b88a7d6e291a5aa021a8fcb7d (diff)
sparc64: Make %pil level 15 a pseudo-NMI.
So that we can profile code even in a local_irq_disable() section, only write 14 (instead of 15) into the %pil register to disable IRQs. This allows PIL level 15 to serve as a pseudo NMI. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/include/asm/irqflags_64.h6
-rw-r--r--arch/sparc/include/asm/pil.h9
-rw-r--r--arch/sparc/include/asm/ttable.h15
-rw-r--r--arch/sparc/mm/ultra.S4
-rw-r--r--arch/sparc64/kernel/cherrs.S10
-rw-r--r--arch/sparc64/kernel/head.S2
-rw-r--r--arch/sparc64/kernel/hvtramp.S5
-rw-r--r--arch/sparc64/kernel/smp.c4
-rw-r--r--arch/sparc64/kernel/spiterrs.S2
-rw-r--r--arch/sparc64/kernel/sun4v_ivec.S8
-rw-r--r--arch/sparc64/kernel/traps.c4
-rw-r--r--arch/sparc64/kernel/ttable.S2
12 files changed, 46 insertions, 25 deletions
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
index bb42e59162aa..8b49bf920df3 100644
--- a/arch/sparc/include/asm/irqflags_64.h
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -10,6 +10,8 @@
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
12 12
13#include <asm/pil.h>
14
13#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
14 16
15static inline unsigned long __raw_local_save_flags(void) 17static inline unsigned long __raw_local_save_flags(void)
@@ -40,9 +42,9 @@ static inline void raw_local_irq_restore(unsigned long flags)
40static inline void raw_local_irq_disable(void) 42static inline void raw_local_irq_disable(void)
41{ 43{
42 __asm__ __volatile__( 44 __asm__ __volatile__(
43 "wrpr 15, %%pil" 45 "wrpr %0, %%pil"
44 : /* no outputs */ 46 : /* no outputs */
45 : /* no inputs */ 47 : "i" (PIL_NORMAL_MAX)
46 : "memory" 48 : "memory"
47 ); 49 );
48} 50}
diff --git a/arch/sparc/include/asm/pil.h b/arch/sparc/include/asm/pil.h
index 71819bb943fc..d573820c0ff4 100644
--- a/arch/sparc/include/asm/pil.h
+++ b/arch/sparc/include/asm/pil.h
@@ -10,7 +10,12 @@
10 * 10 *
11 * In fact any XCALL which has to etrap/rtrap has a problem because 11 * In fact any XCALL which has to etrap/rtrap has a problem because
12 * it is difficult to prevent rtrap from running BH's, and that would 12 * it is difficult to prevent rtrap from running BH's, and that would
13 * need to be done if the XCALL arrived while %pil==15. 13 * need to be done if the XCALL arrived while %pil==PIL_NORMAL_MAX.
14 *
15 * Finally, in order to handle profiling events even when a
16 * local_irq_disable() is in progress, we only disable up to level 14
17 * interrupts. Profile counter overflow interrupts arrive at level
18 * 15.
14 */ 19 */
15#define PIL_SMP_CALL_FUNC 1 20#define PIL_SMP_CALL_FUNC 1
16#define PIL_SMP_RECEIVE_SIGNAL 2 21#define PIL_SMP_RECEIVE_SIGNAL 2
@@ -18,5 +23,7 @@
18#define PIL_SMP_CTX_NEW_VERSION 4 23#define PIL_SMP_CTX_NEW_VERSION 4
19#define PIL_DEVICE_IRQ 5 24#define PIL_DEVICE_IRQ 5
20#define PIL_SMP_CALL_FUNC_SNGL 6 25#define PIL_SMP_CALL_FUNC_SNGL 6
26#define PIL_NORMAL_MAX 14
27#define PIL_NMI 15
21 28
22#endif /* !(_SPARC64_PIL_H) */ 29#endif /* !(_SPARC64_PIL_H) */
diff --git a/arch/sparc/include/asm/ttable.h b/arch/sparc/include/asm/ttable.h
index 5708ba2719fb..bb2c0770a6ac 100644
--- a/arch/sparc/include/asm/ttable.h
+++ b/arch/sparc/include/asm/ttable.h
@@ -2,6 +2,7 @@
2#define _SPARC64_TTABLE_H 2#define _SPARC64_TTABLE_H
3 3
4#include <asm/utrap.h> 4#include <asm/utrap.h>
5#include <asm/pil.h>
5 6
6#ifdef __ASSEMBLY__ 7#ifdef __ASSEMBLY__
7#include <asm/thread_info.h> 8#include <asm/thread_info.h>
@@ -123,7 +124,7 @@
123 124
124#define TRAP_IRQ(routine, level) \ 125#define TRAP_IRQ(routine, level) \
125 rdpr %pil, %g2; \ 126 rdpr %pil, %g2; \
126 wrpr %g0, 15, %pil; \ 127 wrpr %g0, PIL_NORMAL_MAX, %pil; \
127 sethi %hi(1f-4), %g7; \ 128 sethi %hi(1f-4), %g7; \
128 ba,pt %xcc, etrap_irq; \ 129 ba,pt %xcc, etrap_irq; \
129 or %g7, %lo(1f-4), %g7; \ 130 or %g7, %lo(1f-4), %g7; \
@@ -143,7 +144,7 @@
143 144
144#define TRAP_IRQ(routine, level) \ 145#define TRAP_IRQ(routine, level) \
145 rdpr %pil, %g2; \ 146 rdpr %pil, %g2; \
146 wrpr %g0, 15, %pil; \ 147 wrpr %g0, PIL_NORMAL_MAX, %pil; \
147 ba,pt %xcc, etrap_irq; \ 148 ba,pt %xcc, etrap_irq; \
148 rd %pc, %g7; \ 149 rd %pc, %g7; \
149 mov level, %o0; \ 150 mov level, %o0; \
@@ -153,6 +154,16 @@
153 154
154#endif 155#endif
155 156
157#define TRAP_NMI_IRQ(routine, level) \
158 rdpr %pil, %g2; \
159 wrpr %g0, PIL_NMI, %pil; \
160 ba,pt %xcc, etrap_irq; \
161 rd %pc, %g7; \
162 mov level, %o0; \
163 call routine; \
164 add %sp, PTREGS_OFF, %o1; \
165 ba,a,pt %xcc, rtrap_irq;
166
156#define TRAP_IVEC TRAP_NOSAVE(do_ivec) 167#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
157 168
158#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) 169#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S
index e4c146f7c7e9..80c788ec7c32 100644
--- a/arch/sparc/mm/ultra.S
+++ b/arch/sparc/mm/ultra.S
@@ -466,7 +466,7 @@ xcall_sync_tick:
466 .previous 466 .previous
467 467
468 rdpr %pil, %g2 468 rdpr %pil, %g2
469 wrpr %g0, 15, %pil 469 wrpr %g0, PIL_NORMAL_MAX, %pil
470 sethi %hi(109f), %g7 470 sethi %hi(109f), %g7
471 b,pt %xcc, etrap_irq 471 b,pt %xcc, etrap_irq
472109: or %g7, %lo(109b), %g7 472109: or %g7, %lo(109b), %g7
@@ -688,7 +688,7 @@ xcall_kgdb_capture:
688 .previous 688 .previous
689 689
690 rdpr %pil, %g2 690 rdpr %pil, %g2
691 wrpr %g0, 15, %pil 691 wrpr %g0, PIL_NORMAL_MAX, %pil
692 sethi %hi(109f), %g7 692 sethi %hi(109f), %g7
693 ba,pt %xcc, etrap_irq 693 ba,pt %xcc, etrap_irq
694109: or %g7, %lo(109b), %g7 694109: or %g7, %lo(109b), %g7
diff --git a/arch/sparc64/kernel/cherrs.S b/arch/sparc64/kernel/cherrs.S
index 89afebd7eca0..4ee1ad420862 100644
--- a/arch/sparc64/kernel/cherrs.S
+++ b/arch/sparc64/kernel/cherrs.S
@@ -102,7 +102,7 @@ cheetah_plus_dcpe_trap_vector:
102 .type do_cheetah_plus_data_parity,#function 102 .type do_cheetah_plus_data_parity,#function
103do_cheetah_plus_data_parity: 103do_cheetah_plus_data_parity:
104 rdpr %pil, %g2 104 rdpr %pil, %g2
105 wrpr %g0, 15, %pil 105 wrpr %g0, PIL_NORMAL_MAX, %pil
106 ba,pt %xcc, etrap_irq 106 ba,pt %xcc, etrap_irq
107 rd %pc, %g7 107 rd %pc, %g7
108#ifdef CONFIG_TRACE_IRQFLAGS 108#ifdef CONFIG_TRACE_IRQFLAGS
@@ -144,7 +144,7 @@ cheetah_plus_icpe_trap_vector:
144 .type do_cheetah_plus_insn_parity,#function 144 .type do_cheetah_plus_insn_parity,#function
145do_cheetah_plus_insn_parity: 145do_cheetah_plus_insn_parity:
146 rdpr %pil, %g2 146 rdpr %pil, %g2
147 wrpr %g0, 15, %pil 147 wrpr %g0, PIL_NORMAL_MAX, %pil
148 ba,pt %xcc, etrap_irq 148 ba,pt %xcc, etrap_irq
149 rd %pc, %g7 149 rd %pc, %g7
150#ifdef CONFIG_TRACE_IRQFLAGS 150#ifdef CONFIG_TRACE_IRQFLAGS
@@ -492,7 +492,7 @@ cheetah_fast_ecc:
492 .type c_fast_ecc,#function 492 .type c_fast_ecc,#function
493c_fast_ecc: 493c_fast_ecc:
494 rdpr %pil, %g2 494 rdpr %pil, %g2
495 wrpr %g0, 15, %pil 495 wrpr %g0, PIL_NORMAL_MAX, %pil
496 ba,pt %xcc, etrap_irq 496 ba,pt %xcc, etrap_irq
497 rd %pc, %g7 497 rd %pc, %g7
498#ifdef CONFIG_TRACE_IRQFLAGS 498#ifdef CONFIG_TRACE_IRQFLAGS
@@ -528,7 +528,7 @@ cheetah_cee:
528 .type c_cee,#function 528 .type c_cee,#function
529c_cee: 529c_cee:
530 rdpr %pil, %g2 530 rdpr %pil, %g2
531 wrpr %g0, 15, %pil 531 wrpr %g0, PIL_NORMAL_MAX, %pil
532 ba,pt %xcc, etrap_irq 532 ba,pt %xcc, etrap_irq
533 rd %pc, %g7 533 rd %pc, %g7
534#ifdef CONFIG_TRACE_IRQFLAGS 534#ifdef CONFIG_TRACE_IRQFLAGS
@@ -564,7 +564,7 @@ cheetah_deferred_trap:
564 .type c_deferred,#function 564 .type c_deferred,#function
565c_deferred: 565c_deferred:
566 rdpr %pil, %g2 566 rdpr %pil, %g2
567 wrpr %g0, 15, %pil 567 wrpr %g0, PIL_NORMAL_MAX, %pil
568 ba,pt %xcc, etrap_irq 568 ba,pt %xcc, etrap_irq
569 rd %pc, %g7 569 rd %pc, %g7
570#ifdef CONFIG_TRACE_IRQFLAGS 570#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
index 353226fa0239..45830c35fc6d 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc64/kernel/head.S
@@ -706,7 +706,7 @@ setup_trap_table:
706 andn %l0, PSTATE_IE, %o1 706 andn %l0, PSTATE_IE, %o1
707 wrpr %o1, 0x0, %pstate 707 wrpr %o1, 0x0, %pstate
708 rdpr %pil, %l1 708 rdpr %pil, %l1
709 wrpr %g0, 15, %pil 709 wrpr %g0, PIL_NORMAL_MAX, %pil
710 710
711 /* Make the firmware call to jump over to the Linux trap table. */ 711 /* Make the firmware call to jump over to the Linux trap table. */
712 sethi %hi(is_sun4v), %o0 712 sethi %hi(is_sun4v), %o0
diff --git a/arch/sparc64/kernel/hvtramp.S b/arch/sparc64/kernel/hvtramp.S
index 0236c43772fa..9365432904d6 100644
--- a/arch/sparc64/kernel/hvtramp.S
+++ b/arch/sparc64/kernel/hvtramp.S
@@ -1,6 +1,6 @@
1/* hvtramp.S: Hypervisor start-cpu trampoline code. 1/* hvtramp.S: Hypervisor start-cpu trampoline code.
2 * 2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
4 */ 4 */
5 5
6#include <linux/init.h> 6#include <linux/init.h>
@@ -14,6 +14,7 @@
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/head.h> 15#include <asm/head.h>
16#include <asm/asi.h> 16#include <asm/asi.h>
17#include <asm/pil.h>
17 18
18 __CPUINIT 19 __CPUINIT
19 .align 8 20 .align 8
@@ -32,7 +33,7 @@
32 */ 33 */
33hv_cpu_startup: 34hv_cpu_startup:
34 SET_GL(0) 35 SET_GL(0)
35 wrpr %g0, 15, %pil 36 wrpr %g0, PIL_NORMAL_MAX, %pil
36 wrpr %g0, 0, %canrestore 37 wrpr %g0, 0, %canrestore
37 wrpr %g0, 0, %otherwin 38 wrpr %g0, 0, %otherwin
38 wrpr %g0, 6, %cansave 39 wrpr %g0, 6, %cansave
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index c6d06362728c..b5225c81556c 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -1146,8 +1146,8 @@ void smp_release(void)
1146 } 1146 }
1147} 1147}
1148 1148
1149/* Imprisoned penguins run with %pil == 15, but PSTATE_IE set, so they 1149/* Imprisoned penguins run with %pil == PIL_NORMAL_MAX, but PSTATE_IE
1150 * can service tlb flush xcalls... 1150 * set, so they can service tlb flush xcalls...
1151 */ 1151 */
1152extern void prom_world(int); 1152extern void prom_world(int);
1153 1153
diff --git a/arch/sparc64/kernel/spiterrs.S b/arch/sparc64/kernel/spiterrs.S
index ef902c6f8e3c..c357e40ffd01 100644
--- a/arch/sparc64/kernel/spiterrs.S
+++ b/arch/sparc64/kernel/spiterrs.S
@@ -80,7 +80,7 @@ __spitfire_cee_trap_continue:
80 cmp %g2, 1 80 cmp %g2, 1
81 rdpr %pil, %g2 81 rdpr %pil, %g2
82 bleu,pt %xcc, 1f 82 bleu,pt %xcc, 1f
83 wrpr %g0, 15, %pil 83 wrpr %g0, PIL_NORMAL_MAX, %pil
84 84
85 ba,pt %xcc, etraptl1 85 ba,pt %xcc, etraptl1
86 rd %pc, %g7 86 rd %pc, %g7
diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc64/kernel/sun4v_ivec.S
index e2f8e1b4882a..559bc5e9c199 100644
--- a/arch/sparc64/kernel/sun4v_ivec.S
+++ b/arch/sparc64/kernel/sun4v_ivec.S
@@ -186,7 +186,7 @@ sun4v_res_mondo:
186 * when it's done. 186 * when it's done.
187 */ 187 */
188 rdpr %pil, %g2 188 rdpr %pil, %g2
189 wrpr %g0, 15, %pil 189 wrpr %g0, PIL_NORMAL_MAX, %pil
190 mov %g1, %g4 190 mov %g1, %g4
191 ba,pt %xcc, etrap_irq 191 ba,pt %xcc, etrap_irq
192 rd %pc, %g7 192 rd %pc, %g7
@@ -216,7 +216,7 @@ sun4v_res_mondo_queue_full:
216 membar #Sync 216 membar #Sync
217 217
218 rdpr %pil, %g2 218 rdpr %pil, %g2
219 wrpr %g0, 15, %pil 219 wrpr %g0, PIL_NORMAL_MAX, %pil
220 ba,pt %xcc, etrap_irq 220 ba,pt %xcc, etrap_irq
221 rd %pc, %g7 221 rd %pc, %g7
222#ifdef CONFIG_TRACE_IRQFLAGS 222#ifdef CONFIG_TRACE_IRQFLAGS
@@ -297,7 +297,7 @@ sun4v_nonres_mondo:
297 * when it's done. 297 * when it's done.
298 */ 298 */
299 rdpr %pil, %g2 299 rdpr %pil, %g2
300 wrpr %g0, 15, %pil 300 wrpr %g0, PIL_NORMAL_MAX, %pil
301 mov %g1, %g4 301 mov %g1, %g4
302 ba,pt %xcc, etrap_irq 302 ba,pt %xcc, etrap_irq
303 rd %pc, %g7 303 rd %pc, %g7
@@ -327,7 +327,7 @@ sun4v_nonres_mondo_queue_full:
327 membar #Sync 327 membar #Sync
328 328
329 rdpr %pil, %g2 329 rdpr %pil, %g2
330 wrpr %g0, 15, %pil 330 wrpr %g0, PIL_NORMAL_MAX, %pil
331 ba,pt %xcc, etrap_irq 331 ba,pt %xcc, etrap_irq
332 rd %pc, %g7 332 rd %pc, %g7
333#ifdef CONFIG_TRACE_IRQFLAGS 333#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 04994fc8700d..4638af2f55a0 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1832,7 +1832,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
1832 } 1832 }
1833} 1833}
1834 1834
1835/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. 1835/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
1836 * Log the event and clear the first word of the entry. 1836 * Log the event and clear the first word of the entry.
1837 */ 1837 */
1838void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) 1838void sun4v_resum_error(struct pt_regs *regs, unsigned long offset)
@@ -1880,7 +1880,7 @@ void sun4v_resum_overflow(struct pt_regs *regs)
1880 atomic_inc(&sun4v_resum_oflow_cnt); 1880 atomic_inc(&sun4v_resum_oflow_cnt);
1881} 1881}
1882 1882
1883/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. 1883/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
1884 * Log the event, clear the first word of the entry, and die. 1884 * Log the event, clear the first word of the entry, and die.
1885 */ 1885 */
1886void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset) 1886void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset)
diff --git a/arch/sparc64/kernel/ttable.S b/arch/sparc64/kernel/ttable.S
index 2a31ffa4c28d..ea925503b42e 100644
--- a/arch/sparc64/kernel/ttable.S
+++ b/arch/sparc64/kernel/ttable.S
@@ -66,7 +66,7 @@ tl0_irq6: BTRAP(0x46)
66tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49) 66tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49)
67tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) 67tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d)
68tl0_irq14: TRAP_IRQ(timer_interrupt, 14) 68tl0_irq14: TRAP_IRQ(timer_interrupt, 14)
69tl0_irq15: TRAP_IRQ(perfctr_irq, 15) 69tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15)
70tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55) 70tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55)
71tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b) 71tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b)
72tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f) 72tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f)