Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4f4372f authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parent c6afec5e
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -10,6 +10,8 @@
#ifndef _ASM_IRQFLAGS_H
#ifndef _ASM_IRQFLAGS_H
#define _ASM_IRQFLAGS_H
#define _ASM_IRQFLAGS_H


#include <asm/pil.h>

#ifndef __ASSEMBLY__
#ifndef __ASSEMBLY__


static inline unsigned long __raw_local_save_flags(void)
static inline unsigned long __raw_local_save_flags(void)
@@ -40,9 +42,9 @@ static inline void raw_local_irq_restore(unsigned long flags)
static inline void raw_local_irq_disable(void)
static inline void raw_local_irq_disable(void)
{
{
	__asm__ __volatile__(
	__asm__ __volatile__(
		"wrpr	15, %%pil"
		"wrpr	%0, %%pil"
		: /* no outputs */
		: /* no outputs */
		: /* no inputs */
		: "i" (PIL_NORMAL_MAX)
		: "memory"
		: "memory"
	);
	);
}
}
+8 −1
Original line number Original line Diff line number Diff line
@@ -10,7 +10,12 @@
 *
 *
 * In fact any XCALL which has to etrap/rtrap has a problem because
 * In fact any XCALL which has to etrap/rtrap has a problem because
 * it is difficult to prevent rtrap from running BH's, and that would
 * it is difficult to prevent rtrap from running BH's, and that would
 * need to be done if the XCALL arrived while %pil==15.
 * need to be done if the XCALL arrived while %pil==PIL_NORMAL_MAX.
 *
 * Finally, in order to handle profiling events even when a
 * local_irq_disable() is in progress, we only disable up to level 14
 * interrupts.  Profile counter overflow interrupts arrive at level
 * 15.
 */
 */
#define PIL_SMP_CALL_FUNC	1
#define PIL_SMP_CALL_FUNC	1
#define PIL_SMP_RECEIVE_SIGNAL	2
#define PIL_SMP_RECEIVE_SIGNAL	2
@@ -18,5 +23,7 @@
#define PIL_SMP_CTX_NEW_VERSION	4
#define PIL_SMP_CTX_NEW_VERSION	4
#define PIL_DEVICE_IRQ		5
#define PIL_DEVICE_IRQ		5
#define PIL_SMP_CALL_FUNC_SNGL	6
#define PIL_SMP_CALL_FUNC_SNGL	6
#define PIL_NORMAL_MAX		14
#define PIL_NMI			15


#endif /* !(_SPARC64_PIL_H) */
#endif /* !(_SPARC64_PIL_H) */
+13 −2
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@
#define _SPARC64_TTABLE_H
#define _SPARC64_TTABLE_H


#include <asm/utrap.h>
#include <asm/utrap.h>
#include <asm/pil.h>


#ifdef __ASSEMBLY__
#ifdef __ASSEMBLY__
#include <asm/thread_info.h>
#include <asm/thread_info.h>
@@ -123,7 +124,7 @@


#define TRAP_IRQ(routine, level)			\
#define TRAP_IRQ(routine, level)			\
	rdpr	%pil, %g2;				\
	rdpr	%pil, %g2;				\
	wrpr	%g0, 15, %pil;				\
	wrpr	%g0, PIL_NORMAL_MAX, %pil;		\
	sethi	%hi(1f-4), %g7;				\
	sethi	%hi(1f-4), %g7;				\
	ba,pt	%xcc, etrap_irq;			\
	ba,pt	%xcc, etrap_irq;			\
	 or	%g7, %lo(1f-4), %g7;			\
	 or	%g7, %lo(1f-4), %g7;			\
@@ -143,7 +144,7 @@


#define TRAP_IRQ(routine, level)			\
#define TRAP_IRQ(routine, level)			\
	rdpr	%pil, %g2;				\
	rdpr	%pil, %g2;				\
	wrpr	%g0, 15, %pil;				\
	wrpr	%g0, PIL_NORMAL_MAX, %pil;		\
	ba,pt	%xcc, etrap_irq;			\
	ba,pt	%xcc, etrap_irq;			\
	 rd	%pc, %g7;				\
	 rd	%pc, %g7;				\
	mov	level, %o0;				\
	mov	level, %o0;				\
@@ -153,6 +154,16 @@


#endif
#endif


#define TRAP_NMI_IRQ(routine, level)			\
	rdpr	%pil, %g2;				\
	wrpr	%g0, PIL_NMI, %pil;			\
	ba,pt	%xcc, etrap_irq;			\
	 rd	%pc, %g7;				\
	mov	level, %o0;				\
	call	routine;				\
	 add	%sp, PTREGS_OFF, %o1;			\
	ba,a,pt	%xcc, rtrap_irq;

#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
#define TRAP_IVEC TRAP_NOSAVE(do_ivec)


#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
+2 −2
Original line number Original line Diff line number Diff line
@@ -466,7 +466,7 @@ xcall_sync_tick:
	.previous
	.previous


	rdpr		%pil, %g2
	rdpr		%pil, %g2
	wrpr		%g0, 15, %pil
	wrpr		%g0, PIL_NORMAL_MAX, %pil
	sethi		%hi(109f), %g7
	sethi		%hi(109f), %g7
	b,pt		%xcc, etrap_irq
	b,pt		%xcc, etrap_irq
109:	 or		%g7, %lo(109b), %g7
109:	 or		%g7, %lo(109b), %g7
@@ -688,7 +688,7 @@ xcall_kgdb_capture:
	.previous
	.previous


	rdpr		%pil, %g2
	rdpr		%pil, %g2
	wrpr		%g0, 15, %pil
	wrpr		%g0, PIL_NORMAL_MAX, %pil
	sethi		%hi(109f), %g7
	sethi		%hi(109f), %g7
	ba,pt		%xcc, etrap_irq
	ba,pt		%xcc, etrap_irq
109:	 or		%g7, %lo(109b), %g7
109:	 or		%g7, %lo(109b), %g7
+5 −5
Original line number Original line Diff line number Diff line
@@ -102,7 +102,7 @@ cheetah_plus_dcpe_trap_vector:
	.type		do_cheetah_plus_data_parity,#function
	.type		do_cheetah_plus_data_parity,#function
do_cheetah_plus_data_parity:
do_cheetah_plus_data_parity:
	rdpr		%pil, %g2
	rdpr		%pil, %g2
	wrpr		%g0, 15, %pil
	wrpr		%g0, PIL_NORMAL_MAX, %pil
	ba,pt		%xcc, etrap_irq
	ba,pt		%xcc, etrap_irq
	 rd		%pc, %g7
	 rd		%pc, %g7
#ifdef CONFIG_TRACE_IRQFLAGS
#ifdef CONFIG_TRACE_IRQFLAGS
@@ -144,7 +144,7 @@ cheetah_plus_icpe_trap_vector:
	.type		do_cheetah_plus_insn_parity,#function
	.type		do_cheetah_plus_insn_parity,#function
do_cheetah_plus_insn_parity:
do_cheetah_plus_insn_parity:
	rdpr		%pil, %g2
	rdpr		%pil, %g2
	wrpr		%g0, 15, %pil
	wrpr		%g0, PIL_NORMAL_MAX, %pil
	ba,pt		%xcc, etrap_irq
	ba,pt		%xcc, etrap_irq
	 rd		%pc, %g7
	 rd		%pc, %g7
#ifdef CONFIG_TRACE_IRQFLAGS
#ifdef CONFIG_TRACE_IRQFLAGS
@@ -492,7 +492,7 @@ cheetah_fast_ecc:
	.type		c_fast_ecc,#function
	.type		c_fast_ecc,#function
c_fast_ecc:
c_fast_ecc:
	rdpr		%pil, %g2
	rdpr		%pil, %g2
	wrpr		%g0, 15, %pil
	wrpr		%g0, PIL_NORMAL_MAX, %pil
	ba,pt		%xcc, etrap_irq
	ba,pt		%xcc, etrap_irq
	 rd		%pc, %g7
	 rd		%pc, %g7
#ifdef CONFIG_TRACE_IRQFLAGS
#ifdef CONFIG_TRACE_IRQFLAGS
@@ -528,7 +528,7 @@ cheetah_cee:
	.type		c_cee,#function
	.type		c_cee,#function
c_cee:
c_cee:
	rdpr		%pil, %g2
	rdpr		%pil, %g2
	wrpr		%g0, 15, %pil
	wrpr		%g0, PIL_NORMAL_MAX, %pil
	ba,pt		%xcc, etrap_irq
	ba,pt		%xcc, etrap_irq
	 rd		%pc, %g7
	 rd		%pc, %g7
#ifdef CONFIG_TRACE_IRQFLAGS
#ifdef CONFIG_TRACE_IRQFLAGS
@@ -564,7 +564,7 @@ cheetah_deferred_trap:
	.type		c_deferred,#function
	.type		c_deferred,#function
c_deferred:
c_deferred:
	rdpr		%pil, %g2
	rdpr		%pil, %g2
	wrpr		%g0, 15, %pil
	wrpr		%g0, PIL_NORMAL_MAX, %pil
	ba,pt		%xcc, etrap_irq
	ba,pt		%xcc, etrap_irq
	 rd		%pc, %g7
	 rd		%pc, %g7
#ifdef CONFIG_TRACE_IRQFLAGS
#ifdef CONFIG_TRACE_IRQFLAGS
Loading