summaryrefslogtreecommitdiffstats
path: root/sys/sun4v/sun4v
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2007-05-22 06:17:55 +0000
committerkmacy <kmacy@FreeBSD.org>2007-05-22 06:17:55 +0000
commitd0b2a29b691dfd610de48843cf74eed0338f3bdf (patch)
treec0291e11c2a20963097208b33cca741cd9264205 /sys/sun4v/sun4v
parent45f681d588bdaa6f5e767cbe6519c229b30275c7 (diff)
downloadFreeBSD-src-d0b2a29b691dfd610de48843cf74eed0338f3bdf.zip
FreeBSD-src-d0b2a29b691dfd610de48843cf74eed0338f3bdf.tar.gz
restore interrupts to working order after INTR_THREAD changes
- ithread_wrapper was being treated as a wrapper for fast interrupts when in fact it was intended for ithread interrupts
Diffstat (limited to 'sys/sun4v/sun4v')
-rw-r--r--sys/sun4v/sun4v/intr_machdep.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/sys/sun4v/sun4v/intr_machdep.c b/sys/sun4v/sun4v/intr_machdep.c
index 0596b5a..559bf8f 100644
--- a/sys/sun4v/sun4v/intr_machdep.c
+++ b/sys/sun4v/sun4v/intr_machdep.c
@@ -283,7 +283,7 @@ intr_execute_handlers(void *cookie)
struct intr_vector *iv;
struct intr_event *ie;
struct intr_handler *ih;
- int error, thread;
+ int fast, thread;
iv = cookie;
ie = iv->iv_event;
@@ -291,31 +291,32 @@ intr_execute_handlers(void *cookie)
intr_stray_vector(iv);
return;
}
-
- thread = 0;
+
+ fast = thread = 0;
TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
if (ih->ih_filter == NULL) {
thread = 1;
continue;
}
- MPASS(ih->ih_filter == NULL && ih->ih_argument != NULL);
+ MPASS(ih->ih_filter != NULL && ih->ih_argument != NULL);
CTR3(KTR_INTR, "%s: executing handler %p(%p)", __func__,
ih->ih_filter, ih->ih_argument);
ih->ih_filter(ih->ih_argument);
+ fast = 1;
}
/* Schedule a heavyweight interrupt process. */
- if (thread) {
- error = intr_event_schedule_thread(ie);
- } else {
- if (TAILQ_EMPTY(&ie->ie_handlers))
- intr_stray_vector(iv);
- else
- hv_intr_setstate(iv->iv_vec, HV_INTR_IDLE_STATE);
- }
+ if (thread)
+ intr_event_schedule_thread(ie);
+ else if (TAILQ_EMPTY(&ie->ie_handlers))
+ intr_stray_vector(iv);
+
+ if (fast)
+ hv_intr_setstate(iv->iv_vec, HV_INTR_IDLE_STATE);
+
}
-static int
+static void
ithread_wrapper(void *arg)
{
struct ithread_vector_handler *ivh = (struct ithread_vector_handler *)arg;
@@ -323,7 +324,6 @@ ithread_wrapper(void *arg)
ivh->ivh_handler(ivh->ivh_arg);
/* re-enable interrupt */
hv_intr_setstate(ivh->ivh_vec, HV_INTR_IDLE_STATE);
- return (FILTER_HANDLED);
}
int
@@ -336,8 +336,10 @@ inthand_add(const char *name, int vec, driver_filter_t *filt,
struct ithread_vector_handler *ivh;
int errcode, pil;
- if (filt != NULL && handler != NULL)
+ if (filt != NULL && handler != NULL) {
+ printf("both filt and handler set is not valid\n");
return (EINVAL);
+ }
/*
* Work around a race where more than one CPU may be registering
* handlers on the same IRQ at the same time.
@@ -363,17 +365,17 @@ inthand_add(const char *name, int vec, driver_filter_t *filt,
}
}
- if (filt != NULL) {
+ if (filt == NULL) {
ivh = (struct ithread_vector_handler *)
malloc(sizeof(struct ithread_vector_handler), M_DEVBUF, M_WAITOK);
- ivh->ivh_handler = (driver_intr_t *)filt;
+ ivh->ivh_handler = (driver_intr_t *)handler;
ivh->ivh_arg = arg;
ivh->ivh_vec = vec;
- errcode = intr_event_add_handler(ie, name, ithread_wrapper, NULL, ivh,
+ errcode = intr_event_add_handler(ie, name, NULL, ithread_wrapper, ivh,
intr_priority(flags), flags, cookiep);
} else {
ivh = NULL;
- errcode = intr_event_add_handler(ie, name, NULL, handler, arg,
+ errcode = intr_event_add_handler(ie, name, filt, NULL, arg,
intr_priority(flags), flags,
cookiep);
}
OpenPOWER on IntegriCloud