summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2008-12-06 19:59:39 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2008-12-06 19:59:39 +0000
commit44ef19d8849007ab9caf37726901a117b212856c (patch)
treeb0e1b1bc4abd101a4cfead906f1ad9db76d4e354 /sys/arch/amd64
parentff900f7e9685bb482c1571f12d03b53e5961fc10 (diff)
revert all changes related to the mpsafe intr handler. i screwed up the commit
and even then it didn't work. we have higher standards than this.
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/intr.c47
-rw-r--r--sys/arch/amd64/amd64/vector.S13
-rw-r--r--sys/arch/amd64/include/intr.h10
-rw-r--r--sys/arch/amd64/include/pci_machdep.h11
-rw-r--r--sys/arch/amd64/isa/isa_machdep.c4
-rw-r--r--sys/arch/amd64/pci/pci_machdep.c9
6 files changed, 41 insertions, 53 deletions
diff --git a/sys/arch/amd64/amd64/intr.c b/sys/arch/amd64/amd64/intr.c
index eb9ff1ee477..b03a0232407 100644
--- a/sys/arch/amd64/amd64/intr.c
+++ b/sys/arch/amd64/amd64/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.21 2008/12/06 14:36:49 tedu Exp $ */
+/* $OpenBSD: intr.c,v 1.22 2008/12/06 19:59:38 tedu Exp $ */
/* $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $ */
/*
@@ -79,8 +79,6 @@ struct pic softintr_pic = {
NULL,
};
-int intr_biglock_wrap(void *);
-
/*
* Fill in default interrupt table (in case of spurious interrupt
* during configuration of kernel), setup interrupt control unit
@@ -355,17 +353,13 @@ found:
void *
intr_establish(int legacy_irq, struct pic *pic, int pin, int type, int level,
- int (*handler)(void *), void *arg, char *what, int flags)
+ int (*handler)(void *), void *arg, char *what)
{
struct intrhand **p, *q, *ih;
struct cpu_info *ci;
int slot, error, idt_vec;
struct intrsource *source;
struct intrstub *stubp;
- int mpsafe = 0;
-
- if (level >= IPL_SCHED || (flags & INTR_ESTABLISH_MPSAFE))
- mpsafe = 1;
#ifdef DIAGNOSTIC
if (legacy_irq != -1 && (legacy_irq < 0 || legacy_irq > 15))
@@ -450,14 +444,6 @@ intr_establish(int legacy_irq, struct pic *pic, int pin, int type, int level,
ih->ih_pin = pin;
ih->ih_cpu = ci;
ih->ih_slot = slot;
-#ifdef MULTIPROCESSOR
- if (!mpsafe) {
- ih->ih_wrapped_fun = handler;
- ih->ih_wrapped_arg = arg;
- ih->ih_fun = intr_biglock_wrap;
- ih->ih_arg = ih;
- }
-#endif
evcount_attach(&ih->ih_count, what, (void *)&ih->ih_pin,
&evcount_intr);
@@ -553,21 +539,6 @@ intr_disestablish(struct intrhand *ih)
simple_unlock(&ci->ci_slock);
}
-#ifdef MULTIPROCESSOR
-int
-intr_biglock_wrap(void *v)
-{
- struct intrhand *ih = v;
- int ret;
-
- __mp_lock(&kernel_lock);
- ret = (*ih->ih_wrapped_fun)(ih->ih_wrapped_arg);
- __mp_unlock(&kernel_lock);
-
- return (ret);
-}
-#endif
-
#define CONCAT(x,y) __CONCAT(x,y)
/*
@@ -653,6 +624,20 @@ cpu_intr_init(struct cpu_info *ci)
#ifdef MULTIPROCESSOR
void
+x86_intlock(struct intrframe iframe)
+{
+ if (iframe.if_ppl < IPL_SCHED)
+ __mp_lock(&kernel_lock);
+}
+
+void
+x86_intunlock(struct intrframe iframe)
+{
+ if (iframe.if_ppl < IPL_SCHED)
+ __mp_unlock(&kernel_lock);
+}
+
+void
x86_softintlock(void)
{
__mp_lock(&kernel_lock);
diff --git a/sys/arch/amd64/amd64/vector.S b/sys/arch/amd64/amd64/vector.S
index 511af4d5ac4..cf34dd0d87a 100644
--- a/sys/arch/amd64/amd64/vector.S
+++ b/sys/arch/amd64/amd64/vector.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: vector.S,v 1.15 2008/12/06 04:31:24 tedu Exp $ */
+/* $OpenBSD: vector.S,v 1.16 2008/12/06 19:59:38 tedu Exp $ */
/* $NetBSD: vector.S,v 1.5 2004/06/28 09:13:11 fvdl Exp $ */
/*
@@ -381,6 +381,14 @@ IDTVEC(resume_lapic_ltimer)
INTRFASTEXIT
#endif /* NLAPIC > 0 */
+#ifdef MULTIPROCESSOR
+#define LOCK_KERNEL movq %rsp, %rdi; call _C_LABEL(x86_intlock)
+#define UNLOCK_KERNEL movq %rsp, %rdi; call _C_LABEL(x86_intunlock)
+#else
+#define LOCK_KERNEL
+#define UNLOCK_KERNEL
+#endif
+
#define voidop(num)
@@ -421,6 +429,7 @@ IDTVEC(intr_/**/name/**/num) ;\
sti ;\
incl CPUVAR(IDEPTH) ;\
movq IS_HANDLERS(%r14),%rbx ;\
+ LOCK_KERNEL ;\
6: \
movl IH_LEVEL(%rbx),%r12d ;\
cmpl %r13d,%r12d ;\
@@ -438,12 +447,14 @@ IDTVEC(intr_/**/name/**/num) ;\
testq %rbx,%rbx ;\
jnz 6b ;\
5: \
+ UNLOCK_KERNEL ;\
cli ;\
unmask(num) /* unmask it in hardware */ ;\
late_ack(num) ;\
sti ;\
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
7: \
+ UNLOCK_KERNEL ;\
cli ;\
orl $(1 << num),CPUVAR(IPENDING) ;\
level_mask(num) ;\
diff --git a/sys/arch/amd64/include/intr.h b/sys/arch/amd64/include/intr.h
index 740ffb0ec5d..86c63ceb283 100644
--- a/sys/arch/amd64/include/intr.h
+++ b/sys/arch/amd64/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.14 2008/12/06 04:31:24 tedu Exp $ */
+/* $OpenBSD: intr.h,v 1.15 2008/12/06 19:59:38 tedu Exp $ */
/* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
/*-
@@ -91,8 +91,6 @@ struct intrsource {
struct intrhand {
int (*ih_fun)(void *);
void *ih_arg;
- int (*ih_wrapped_fun)(void *);
- void *ih_wrapped_arg;
int ih_level;
struct intrhand *ih_next;
int ih_pin;
@@ -208,10 +206,8 @@ void intr_calculatemasks(struct cpu_info *);
int intr_allocate_slot_cpu(struct cpu_info *, struct pic *, int, int *);
int intr_allocate_slot(struct pic *, int, int, int, struct cpu_info **, int *,
int *);
-
-#define INTR_ESTABLISH_MPSAFE 0x01
void *intr_establish(int, struct pic *, int, int, int, int (*)(void *),
- void *, char *, int);
+ void *, char *);
void intr_disestablish(struct intrhand *);
void cpu_intr_init(struct cpu_info *);
int intr_find_mpmapping(int bus, int pin, int *handle);
@@ -223,6 +219,8 @@ int x86_fast_ipi(struct cpu_info *, int);
void x86_broadcast_ipi(int);
void x86_multicast_ipi(int, int);
void x86_ipi_handler(void);
+void x86_intlock(struct intrframe);
+void x86_intunlock(struct intrframe);
void x86_softintlock(void);
void x86_softintunlock(void);
void x86_setperf_ipi(struct cpu_info *);
diff --git a/sys/arch/amd64/include/pci_machdep.h b/sys/arch/amd64/include/pci_machdep.h
index cfd04020f47..0218c28f898 100644
--- a/sys/arch/amd64/include/pci_machdep.h
+++ b/sys/arch/amd64/include/pci_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.h,v 1.7 2008/12/06 04:31:24 tedu Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.8 2008/12/06 19:59:38 tedu Exp $ */
/* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */
/*
@@ -93,13 +93,8 @@ void pci_conf_write(pci_chipset_tag_t, pcitag_t, int,
pcireg_t);
int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
-
-void *pci_intr_establish_flags(pci_chipset_tag_t, pci_intr_handle_t,
- int, int (*)(void *), void *, char *, int);
-#define pci_intr_establish(t,h,l,f,a,w) \
- pci_intr_establish_flags(t,h,l,f,a,w,0)
-#define pci_intr_establish_mpsafe(t,h,l,f,a,w) \
- pci_intr_establish_flags(t,h,l,f,a,w,INTR_ESTABLISH_MPSAFE)
+void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
+ int, int (*)(void *), void *, char *);
void pci_intr_disestablish(pci_chipset_tag_t, void *);
void pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
int *, int *, int *);
diff --git a/sys/arch/amd64/isa/isa_machdep.c b/sys/arch/amd64/isa/isa_machdep.c
index 552e540057b..bd41ffc5bae 100644
--- a/sys/arch/amd64/isa/isa_machdep.c
+++ b/sys/arch/amd64/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.16 2008/12/06 17:46:52 tedu Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.17 2008/12/06 19:59:38 tedu Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
#define ISA_DMA_STATS
@@ -330,7 +330,7 @@ isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level,
KASSERT(pic);
return intr_establish(irq, pic, pin, type, level, ih_fun,
- ih_arg, ih_what, 0);
+ ih_arg, ih_what);
}
/*
diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c
index b1580779134..722b6e3591d 100644
--- a/sys/arch/amd64/pci/pci_machdep.c
+++ b/sys/arch/amd64/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.17 2008/12/06 05:08:02 tedu Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.18 2008/12/06 19:59:38 tedu Exp $ */
/* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -518,8 +518,8 @@ pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
}
void *
-pci_intr_establish_flags(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
- int (*func)(void *), void *arg, char *what, int flags)
+pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
+ int (*func)(void *), void *arg, char *what)
{
int pin, irq;
struct pic *pic;
@@ -542,8 +542,7 @@ pci_intr_establish_flags(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
}
#endif
- return intr_establish(irq, pic, pin, IST_LEVEL, level, func, arg, what,
- flags);
+ return intr_establish(irq, pic, pin, IST_LEVEL, level, func, arg, what);
}
void