summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2015-12-19 09:11:15 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2015-12-19 09:11:15 +0000
commite39a063aa46c3f0760b04c6a37313b140a0fb7a3 (patch)
tree42fd21782e03f41b59d8e71df2e4090acfce8a85 /sys/dev
parent1fb1af852db1da7714d5b7c581aed86d0e1fff77 (diff)
Fixup a few bugs in xen_intr_{establish,disestablish}
xen_intr_establish was using a variable that hasn't got its value updated in the supplementary check for event channel port unmasking. xen_intr_disestablish didn't save and correctly check the return value of xen_lookup_intsrc call and was incorrectly indexing into the pending event channel port bitmap.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pv/xen.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index 712a2671aac..bb31010ccec 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.14 2015/12/12 21:07:45 reyk Exp $ */
+/* $OpenBSD: xen.c,v 1.15 2015/12/19 09:11:14 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -537,7 +537,6 @@ xen_intr(void)
if ((xi = xen_lookup_intsrc(sc, port)) == NULL)
continue;
xi->xi_evcnt.ec_count++;
-
if (xi->xi_handler)
xi->xi_handler(xi->xi_arg);
}
@@ -625,9 +624,9 @@ xen_intr_establish(evtchn_port_t port, xen_intr_handle_t *xih,
if (!cold) {
eu.port = xi->xi_port;
if (xen_hypercall(sc, event_channel_op, 2, EVTCHNOP_unmask,
- &eu) || isset(sc->sc_ipg->evtchn_mask, port))
+ &eu) || isset(sc->sc_ipg->evtchn_mask, xi->xi_port))
printf("%s: unmasking port %u failed\n",
- sc->sc_dev.dv_xname, port);
+ sc->sc_dev.dv_xname, xi->xi_port);
}
#ifdef XEN_DEBUG
@@ -664,18 +663,15 @@ xen_intr_disestablish(xen_intr_handle_t xih)
struct evtchn_close ec;
struct xen_intsrc *xi;
- if (xen_lookup_intsrc(sc, port) != NULL) {
- DPRINTF("%s: failed to lookup an established interrupt handler "
- "for port %u\n", sc->sc_dev.dv_xname, port);
+ if ((xi = xen_lookup_intsrc(sc, port)) == NULL)
return (-1);
- }
evcount_detach(&xi->xi_evcnt);
SLIST_REMOVE(&sc->sc_intrs, xi, xen_intsrc, xi_entry);
- setbit((char *)sc->sc_ipg->evtchn_mask, xi->xi_port);
- clrbit((char *)sc->sc_ipg->evtchn_pending[0], xi->xi_port);
+ setbit((char *)&sc->sc_ipg->evtchn_mask[0], xi->xi_port);
+ clrbit((char *)&sc->sc_ipg->evtchn_pending[0], xi->xi_port);
membar_producer();
if (!xi->xi_noclose) {