diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-04-15 20:40:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-04-15 20:40:08 +0000 |
commit | 6c79978cbce731e6dd4f90352a13cdd25a500eeb (patch) | |
tree | aff1016153e9c8e9c986a3263124aaef9a489b73 /sys/arch/alpha | |
parent | 54d01755e0c490f3abfc0ae79a651eac257ad0cf (diff) |
More than a decade ago, interrupt handlers on sparc started returning 0
(interrupt was not for me), 1 (positive interrupt was for me), or -1
(i am not sure...). We have continued with this practice in as many
drivers as possible, throughout the tree.
This makes some of the architectures use that information in their
interrupt handler calling code -- if 1 is returned (and we know
this specific machine does not have edge-shared interrupts), we
finish servicing other possible handlers on the same pin. If the
interrupt pin remains asserted (from a different device), we will
end up back in the interrupt servicing code of course... but this is
cheaper than calling all the chained interrupts on a pin.
This does of course count on shared level interrupts being properly
sorted by IPL.
There have been some concerns about starvation of drivers which
incorrectly return 1. Those drivers should be hunted down so that
they return -1.
(other architectures will follow)
ok kettenis drahn dlg miod
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r-- | sys/arch/alpha/alpha/interrupt.c | 8 | ||||
-rw-r--r-- | sys/arch/alpha/dev/shared_intr.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/include/intr.h | 4 | ||||
-rw-r--r-- | sys/arch/alpha/pci/sio_pic.c | 4 |
4 files changed, 20 insertions, 6 deletions
diff --git a/sys/arch/alpha/alpha/interrupt.c b/sys/arch/alpha/alpha/interrupt.c index 3390277aba1..4fff2042e1e 100644 --- a/sys/arch/alpha/alpha/interrupt.c +++ b/sys/arch/alpha/alpha/interrupt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interrupt.c,v 1.30 2010/12/21 14:56:23 claudio Exp $ */ +/* $OpenBSD: interrupt.c,v 1.31 2011/04/15 20:40:03 deraadt Exp $ */ /* $NetBSD: interrupt.c,v 1.46 2000/06/03 20:47:36 thorpej Exp $ */ /*- @@ -101,6 +101,12 @@ struct scbvec scb_iovectab[SCB_VECTOIDX(SCB_SIZE - SCB_IOVECBASE)]; void scb_stray(void *, u_long); +/* + * True if the system has any non-level interrupts which are shared + * on the same pin. + */ +int intr_shared_edge; + void scb_init(void) { diff --git a/sys/arch/alpha/dev/shared_intr.c b/sys/arch/alpha/dev/shared_intr.c index a0fdb4ca9b6..847541c8a9a 100644 --- a/sys/arch/alpha/dev/shared_intr.c +++ b/sys/arch/alpha/dev/shared_intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shared_intr.c,v 1.17 2010/09/20 06:33:46 matthew Exp $ */ +/* $OpenBSD: shared_intr.c,v 1.18 2011/04/15 20:40:05 deraadt Exp $ */ /* $NetBSD: shared_intr.c,v 1.13 2000/03/19 01:46:18 thorpej Exp $ */ /* @@ -104,10 +104,12 @@ alpha_shared_intr_dispatch(intr, num) * -1: This interrupt might have been for me, but I can't say * for sure. */ - if ((rv = (*ih->ih_fn)(ih->ih_arg))) + rv = (*ih->ih_fn)(ih->ih_arg); + if (rv) ih->ih_count.ec_count++; - handled = handled || (rv != 0); + if (intr_shared_edge == 0 && rv == 1) + break; } return (handled); @@ -142,6 +144,8 @@ alpha_shared_intr_establish(intr, num, type, level, fn, arg, basename) switch (intr[num].intr_sharetype) { case IST_EDGE: + intr_shared_edge = 1; + /* FALLTHROUGH */ case IST_LEVEL: if (type == intr[num].intr_sharetype) break; diff --git a/sys/arch/alpha/include/intr.h b/sys/arch/alpha/include/intr.h index 29eae0d7006..03af2a9e156 100644 --- a/sys/arch/alpha/include/intr.h +++ b/sys/arch/alpha/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.38 2011/03/23 16:54:34 pirofti Exp $ */ +/* $OpenBSD: intr.h,v 1.39 2011/04/15 20:40:05 deraadt Exp $ */ /* $NetBSD: intr.h,v 1.26 2000/06/03 20:47:41 thorpej Exp $ */ /*- @@ -235,6 +235,8 @@ struct alpha_shared_intr { ((asi)[num].intr_maxstrays != 0 && \ (asi)[num].intr_nstrays == (asi)[num].intr_maxstrays) +extern int intr_shared_edge; + /* * simulated software interrupt register */ diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c index 8b65a4638b3..9ae639cf39d 100644 --- a/sys/arch/alpha/pci/sio_pic.c +++ b/sys/arch/alpha/pci/sio_pic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio_pic.c,v 1.31 2009/09/30 20:16:31 miod Exp $ */ +/* $OpenBSD: sio_pic.c,v 1.32 2011/04/15 20:40:05 deraadt Exp $ */ /* $NetBSD: sio_pic.c,v 1.28 2000/06/06 03:10:13 thorpej Exp $ */ /*- @@ -586,6 +586,8 @@ sio_intr_alloc(v, mask, type, irq) return (0); case IST_EDGE: + intr_shared_edge = 1; + /* FALLTHROUGH */ case IST_LEVEL: if (type != sio_intr[i].intr_sharetype) continue; |