summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-01-09 23:43:44 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-01-09 23:43:44 +0000
commit610b6c8e42ec9f42a1046112da848a3a1eb7449a (patch)
tree95487fdf0608049dd76757e268453b1348d90bee /sys/arch
parent5887c974279baac9cdd4458da6877455d6cca6fc (diff)
Make interrupt depth counters per-cpu.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mips64/include/cpu.h6
-rw-r--r--sys/arch/mips64/mips64/exception.S43
-rw-r--r--sys/arch/mips64/mips64/genassym.cf16
-rw-r--r--sys/arch/mips64/mips64/interrupt.c6
4 files changed, 32 insertions, 39 deletions
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index e4ed017564f..7d396182748 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.53 2010/01/09 23:34:29 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.54 2010/01/09 23:43:41 miod Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -406,6 +406,7 @@ struct cpu_info {
u_int32_t ci_cpu_counter_interval;
u_int32_t ci_pendingticks;
struct pmap *ci_curpmap;
+ uint ci_intrdepth; /* interrupt depth */
#ifdef MULTIPROCESSOR
u_long ci_flags; /* flags; see below */
struct intrhand ci_ipiih;
@@ -468,12 +469,11 @@ void cpu_startclock(struct cpu_info *);
* Arguments to hardclock encapsulate the previous machine state in
* an opaque clockframe.
*/
-extern int int_nest_cntr;
#define clockframe trap_frame /* Use normal trap frame */
#define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER)
#define CLKF_PC(framep) ((framep)->pc)
-#define CLKF_INTR(framep) (int_nest_cntr > 0)
+#define CLKF_INTR(framep) (curcpu()->ci_intrdepth > 1) /* XXX */
/*
* This is used during profiling to integrate system time.
diff --git a/sys/arch/mips64/mips64/exception.S b/sys/arch/mips64/mips64/exception.S
index 33b9decb75f..243b245d48f 100644
--- a/sys/arch/mips64/mips64/exception.S
+++ b/sys/arch/mips64/mips64/exception.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: exception.S,v 1.27 2009/11/19 20:15:04 miod Exp $ */
+/* $OpenBSD: exception.S,v 1.28 2010/01/09 23:43:43 miod Exp $ */
/*
* Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -49,10 +49,6 @@
.set mips3
- .data
- .globl int_nest_cntr
-int_nest_cntr:
- .word -1
.text
k_exception_table:
@@ -183,20 +179,11 @@ NNON_LEAF(k_intr, FRAMESZ(KERN_EXC_FRAME_SIZE), ra)
and t0, a1, ~(SR_COP_1_BIT | SR_EXL | SR_INT_ENAB | SR_KSU_MASK)
mtc0 t0, COP_0_STATUS_REG
ITLBNOPFIX
- LA t1, int_nest_cntr
- lw t2, (t1)
- addiu t2, 1
- sw t2, (t1)
- ITLBNOPFIX
+ ITLBNOPFIX # XXX necessary?
PTR_S a0, 0(sp)
jal interrupt
PTR_S a3, CF_RA_OFFS + KERN_REG_SIZE(sp)
- LA t1, int_nest_cntr
- lw t2, (t1)
- addiu t2, -1
- sw t2, (t1)
-
PTR_L a0, CF_RA_OFFS + KERN_REG_SIZE(sp)
.set noat
#ifdef RM7000_ICR
@@ -232,22 +219,18 @@ NNON_LEAF(u_intr, FRAMESZ(CF_SZ), ra)
and t0, a1, ~(SR_COP_1_BIT | SR_EXL | SR_INT_ENAB | SR_KSU_MASK)
mtc0 t0, COP_0_STATUS_REG
ITLBNOPFIX
- LA t1, int_nest_cntr
- lw t2, (t1)
- addiu t2, 1
- sw t2, (t1)
- ITLBNOPFIX
+ ITLBNOPFIX # XXX necessary?
PTR_S a0, 0(sp)
jal interrupt
- PTR_S a3, CF_RA_OFFS(sp) # for debugging
+ PTR_S a3, CF_RA_OFFS(sp) # for debugging
mfc0 t0, COP_0_STATUS_REG # enable interrupts before checking
ori t0, SR_INT_ENAB # for ast.
mtc0 t0, COP_0_STATUS_REG
ITLBNOPFIX
-0:
GET_CPU_INFO(t1, t0)
+0:
PTR_L t0, CI_CURPROC(t1)
lw v0, P_ASTPENDING(t0) # any pending AST?
beq v0, zero, 4f
@@ -313,21 +296,17 @@ NNON_LEAF(u_intr, FRAMESZ(CF_SZ), ra)
4:
mfc0 t0, COP_0_STATUS_REG # disable interrupts
- li t1, ~SR_INT_ENAB
- and t0, t0, t1
+ li v0, ~SR_INT_ENAB
+ and t0, t0, v0
mtc0 t0, COP_0_STATUS_REG
ITLBNOPFIX
- LA t1, int_nest_cntr
- lw t2, (t1)
- addiu t2, -1
- sw t2, (t1)
-
ori t0, SR_EXL # restoring to user mode.
mtc0 t0, COP_0_STATUS_REG # must set exception level bit.
ITLBNOPFIX
- GET_CPU_INFO(k1, k0)
+ # t1 is curcpu() from earlier
+ move k1, t1
PTR_L k0, CI_CURPROCPADDR(k1)
RESTORE_REG(a3, CPL, k0, 0)
sw a3, CI_IPL(k1)
@@ -437,14 +416,14 @@ NNON_LEAF(u_general, FRAMESZ(CF_SZ), ra)
jal trap
PTR_S a3, CF_RA_OFFS(sp) # for debugging
-0:
GET_CPU_INFO(t1, t0)
+0:
PTR_L t0, CI_CURPROC(t1)
lw v0, P_ASTPENDING(t0) # any pending AST?
beq v0, zero, 4f
nop
- PTR_L t0, P_ADDR(t0) # curprocpaddr
+ PTR_L t0, CI_CURPROCPADDR(t1) # curprocpaddr
SAVE_CPU_SREG(t0, 0)
jal ast
diff --git a/sys/arch/mips64/mips64/genassym.cf b/sys/arch/mips64/mips64/genassym.cf
index 3b455fdf17b..b04d4682219 100644
--- a/sys/arch/mips64/mips64/genassym.cf
+++ b/sys/arch/mips64/mips64/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.5 2010/01/09 23:34:29 miod Exp $
+# $OpenBSD: genassym.cf,v 1.6 2010/01/09 23:43:43 miod Exp $
#
# Copyright (c) 1997 Per Fogelstrom / Opsycon AB
#
@@ -39,10 +39,10 @@ include <machine/cpu.h>
export SONPROC
struct proc
-member p_stat
member p_addr
-member p_vmspace
member p_cpu
+member p_stat
+member p_vmspace
member P_ASTPENDING p_md.md_astpending
member P_PC_CTRL p_md.md_pc_ctrl
member P_PC_COUNT p_md.md_pc_count
@@ -61,6 +61,16 @@ struct cpu_info
member ci_curproc
member ci_curprocpaddr
member ci_fpuproc
+member ci_cacheconfiguration
+member ci_cacheways
+member ci_l1instcachesize
+member ci_l1instcacheline
+member ci_l1instcacheset
+member ci_l1datacachesize
+member ci_l1datacacheline
+member ci_l1datacacheset
+member ci_l2size
+member ci_l3size
member ci_ipl
member ci_cacheconfiguration
member ci_cacheways
diff --git a/sys/arch/mips64/mips64/interrupt.c b/sys/arch/mips64/mips64/interrupt.c
index 923fc8ff147..89030cf5d60 100644
--- a/sys/arch/mips64/mips64/interrupt.c
+++ b/sys/arch/mips64/mips64/interrupt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interrupt.c,v 1.55 2009/11/27 00:08:27 syuu Exp $ */
+/* $OpenBSD: interrupt.c,v 1.56 2010/01/09 23:43:43 miod Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -111,6 +111,8 @@ interrupt(struct trap_frame *trapframe)
if (!(trapframe->sr & SR_INT_ENAB))
return;
+ ci->ci_intrdepth++;
+
#ifdef DEBUG_INTERRUPT
trapdebug_enter(trapframe, 0);
#endif
@@ -146,6 +148,8 @@ interrupt(struct trap_frame *trapframe)
ci->ci_ipl = s; /* no-overhead splx */
__asm__ ("sync\n\t.set reorder\n");
}
+
+ ci->ci_intrdepth--;
}