-/* $OpenBSD: xen.c,v 1.56 2016/04/28 16:40:10 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.57 2016/07/29 21:27:43 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
continue;
}
xi->xi_evcnt.ec_count++;
- if (xi->xi_handler)
- xi->xi_handler(xi->xi_arg);
+ task_add(xi->xi_taskq, &xi->xi_task);
}
}
}
+void
+xen_intr_schedule(xen_intr_handle_t xih)
+{
+ struct xen_softc *sc = xen_sc;
+ struct xen_intsrc *xi;
+
+ if ((xi = xen_lookup_intsrc(sc, (evtchn_port_t)xih)) != NULL)
+ task_add(xi->xi_taskq, &xi->xi_task);
+}
+
void
xen_intr_signal(xen_intr_handle_t xih)
{
if (xi == NULL)
return (-1);
- xi->xi_handler = handler;
- xi->xi_arg = arg;
xi->xi_port = (evtchn_port_t)*xih;
+ xi->xi_taskq = taskq_create(name, 1, IPL_NET, TASKQ_MPSAFE);
+ if (!xi->xi_taskq) {
+ printf("%s: failed to create interrupt task for %s\n",
+ sc->sc_dev.dv_xname, name);
+ free(xi, M_DEVBUF, sizeof(*xi));
+ return (-1);
+ }
+ task_set(&xi->xi_task, handler, arg);
+
if (port == 0) {
/* We're being asked to allocate a new event port */
memset(&eau, 0, sizeof(eau));
-/* $OpenBSD: xenvar.h,v 1.32 2016/04/19 18:15:41 mikeb Exp $ */
+/* $OpenBSD: xenvar.h,v 1.33 2016/07/29 21:27:43 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
#endif
struct xen_intsrc {
- SLIST_ENTRY(xen_intsrc) xi_entry;
- void (*xi_handler)(void *);
- void *xi_arg;
- struct evcount xi_evcnt;
- evtchn_port_t xi_port;
- short xi_noclose;
- short xi_masked;
+ SLIST_ENTRY(xen_intsrc) xi_entry;
+ struct evcount xi_evcnt;
+ evtchn_port_t xi_port;
+ short xi_noclose;
+ short xi_masked;
+ struct task xi_task;
+ struct taskq *xi_taskq;
};
struct xen_gntent {
void xen_intr(void);
void xen_intr_ack(void);
void xen_intr_signal(xen_intr_handle_t);
+void xen_intr_schedule(xen_intr_handle_t);
int xen_intr_establish(evtchn_port_t, xen_intr_handle_t *, int,
void (*)(void *), void *, char *);
int xen_intr_disestablish(xen_intr_handle_t);