Page MenuHomeFreeBSD

D32504.diff
No OneTemporary

D32504.diff

diff --git a/sys/arm/mv/gpio.c b/sys/arm/mv/gpio.c
--- a/sys/arm/mv/gpio.c
+++ b/sys/arm/mv/gpio.c
@@ -428,7 +428,7 @@
} else if (sc->gpio_setup[pin].gp_flags & MV_GPIO_IN_IRQ_DOUBLE_EDGE)
mv_gpio_double_edge_init(dev, pin);
MV_GPIO_UNLOCK();
- error = intr_event_create(&event, (void *)s, 0, pin,
+ error = intr_event_create(&event, (void *)s, 0,
(void (*)(void *))mv_gpio_intr_mask,
(void (*)(void *))mv_gpio_intr_unmask,
(void (*)(void *))mv_gpio_int_ack,
diff --git a/sys/compat/linuxkpi/common/include/linux/hardirq.h b/sys/compat/linuxkpi/common/include/linux/hardirq.h
--- a/sys/compat/linuxkpi/common/include/linux/hardirq.h
+++ b/sys/compat/linuxkpi/common/include/linux/hardirq.h
@@ -38,7 +38,9 @@
#include <sys/bus.h>
#include <sys/interrupt.h>
-#define synchronize_irq(irq) _intr_drain((irq))
+#include <machine/intr.h>
+
+#define synchronize_irq(irq) _intr_drain(intr2event(intrtab_lookup((irq))))
/*
* FIXME: In the i915 driver's `intel_engine_cs.c` file,
diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h
--- a/sys/compat/linuxkpi/common/include/linux/interrupt.h
+++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h
@@ -40,6 +40,8 @@
#include <sys/param.h>
#include <sys/interrupt.h>
+#include <machine/intr.h>
+
typedef irqreturn_t (*irq_handler_t)(int, void *);
#define IRQF_SHARED RF_SHAREABLE
@@ -133,11 +135,12 @@
irq_set_affinity_hint(int vector, const cpumask_t *mask)
{
int error;
+ struct intr_event *event = intr2event(intrtab_lookup(vector));
if (mask != NULL)
- error = intr_setaffinity(vector, CPU_WHICH_IRQ, __DECONST(cpumask_t *, mask));
+ error = intr_setaffinity(event, CPU_WHICH_IRQ, __DECONST(cpumask_t *, mask));
else
- error = intr_setaffinity(vector, CPU_WHICH_IRQ, cpuset_root);
+ error = intr_setaffinity(event, CPU_WHICH_IRQ, cpuset_root);
return (-error);
}
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -35,6 +35,7 @@
#include <sys/eventhandler.h>
#include <sys/sockio.h>
#include <machine/atomic.h>
+#include <machine/intr.h>
#include <net/debugnet.h>
@@ -2549,7 +2550,8 @@
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
- intr_setaffinity(irq, CPU_WHICH_INTRHANDLER, &cpuset);
+ intr_setaffinity(intr2event(intrtab_lookup(irq)),
+ CPU_WHICH_INTRHANDLER, &cpuset);
}
}
diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c
--- a/sys/kern/kern_cpuset.c
+++ b/sys/kern/kern_cpuset.c
@@ -75,6 +75,8 @@
#include <vm/vm_phys.h>
#include <vm/vm_pagequeue.h>
+#include <machine/intr.h>
+
#ifdef DDB
#include <ddb/ddb.h>
#endif /* DDB */
@@ -2030,7 +2032,8 @@
case CPU_WHICH_IRQ:
case CPU_WHICH_INTRHANDLER:
case CPU_WHICH_ITHREAD:
- error = intr_getaffinity(id, which, mask);
+ error = intr_getaffinity(intr2event(intrtab_lookup(id)),
+ which, mask);
break;
case CPU_WHICH_DOMAIN:
if (id < 0 || id >= MAXMEMDOM)
@@ -2191,7 +2194,8 @@
case CPU_WHICH_IRQ:
case CPU_WHICH_INTRHANDLER:
case CPU_WHICH_ITHREAD:
- error = intr_setaffinity(id, which, mask);
+ error = intr_setaffinity(intr2event(intrtab_lookup(id)),
+ which, mask);
break;
default:
error = EINVAL;
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -283,7 +283,7 @@
}
int
-intr_event_create(struct intr_event **event, void *source, int flags, int irq,
+intr_event_create(struct intr_event **event, void *source, int flags,
void (*pre_ithread)(void *), void (*post_ithread)(void *),
void (*post_filter)(void *), int (*assign_cpu)(void *, int),
const char *fmt, ...)
@@ -302,7 +302,6 @@
ie->ie_post_filter = post_filter;
ie->ie_assign_cpu = assign_cpu;
ie->ie_flags = flags;
- ie->ie_irq = irq;
ie->ie_cpu = NOCPU;
/* ->ie_stray and ->ie_intrcnt[] handled by M_ZERO */
CK_SLIST_INIT(&ie->ie_handlers);
@@ -439,25 +438,9 @@
return (ENODEV);
}
-static struct intr_event *
-intr_lookup(int irq)
-{
- struct intr_event *ie;
-
- sx_slock(&event_lock);
- TAILQ_FOREACH(ie, &event_list, ie_list)
- if (ie->ie_irq == irq &&
- (ie->ie_flags & IE_SOFT) == 0 &&
- CK_SLIST_FIRST(&ie->ie_handlers) != NULL)
- break;
- sx_sunlock(&event_lock);
- return (ie);
-}
-
int
-intr_setaffinity(int irq, int mode, void *m)
+intr_setaffinity(struct intr_event *ie, int mode, void *m)
{
- struct intr_event *ie;
cpuset_t *mask;
int cpu, n;
@@ -476,7 +459,6 @@
cpu = n;
}
}
- ie = intr_lookup(irq);
if (ie == NULL)
return (ESRCH);
switch (mode) {
@@ -492,9 +474,8 @@
}
int
-intr_getaffinity(int irq, int mode, void *m)
+intr_getaffinity(struct intr_event *ie, int mode, void *m)
{
- struct intr_event *ie;
struct thread *td;
struct proc *p;
cpuset_t *mask;
@@ -502,7 +483,6 @@
int error;
mask = m;
- ie = intr_lookup(irq);
if (ie == NULL)
return (ESRCH);
@@ -828,13 +808,11 @@
* Do not use in BSD code.
*/
void
-_intr_drain(int irq)
+_intr_drain(struct intr_event *ie)
{
- struct intr_event *ie;
struct intr_thread *ithd;
struct thread *td;
- ie = intr_lookup(irq);
if (ie == NULL)
return;
if (ie->ie_thread == NULL)
@@ -1083,8 +1061,8 @@
if (!(ie->ie_flags & IE_SOFT))
return (EINVAL);
} else {
- error = intr_event_create(&ie, NULL, IE_SOFT, 0,
- NULL, NULL, NULL, swi_assign_cpu, "swi%d:", pri);
+ error = intr_event_create(&ie, NULL, IE_SOFT, NULL, NULL, NULL,
+ swi_assign_cpu, "swi%d:", pri);
if (error)
return (error);
if (eventp != NULL)
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -562,7 +562,7 @@
if (isrc->isrc_flags & (INTR_ISRCF_IPI|INTR_ISRCF_PPI))
flags |= IE_MULTIPROC;
- error = intr_event_create(&ie, isrc, flags, isrc->isrc_irq,
+ error = intr_event_create(&ie, isrc, flags,
intr_isrc_pre_ithread, intr_isrc_post_ithread, intr_isrc_post_filter,
intr_isrc_assign_cpu, "%s:", isrc->isrc_name);
if (error)
diff --git a/sys/powerpc/powerpc/intr_machdep.c b/sys/powerpc/powerpc/intr_machdep.c
--- a/sys/powerpc/powerpc/intr_machdep.c
+++ b/sys/powerpc/powerpc/intr_machdep.c
@@ -535,7 +535,7 @@
return (ENOMEM);
if (i->event == NULL) {
- error = intr_event_create(&i->event, (void *)i, 0, irq,
+ error = intr_event_create(&i->event, (void *)i, 0,
powerpc_intr_pre_ithread, powerpc_intr_post_ithread,
powerpc_intr_eoi, powerpc_assign_intr_cpu, "irq%u:", irq);
if (error)
diff --git a/sys/riscv/riscv/intr_machdep.c b/sys/riscv/riscv/intr_machdep.c
--- a/sys/riscv/riscv/intr_machdep.c
+++ b/sys/riscv/riscv/intr_machdep.c
@@ -126,7 +126,7 @@
isrc = &isrcs[irq].isrc;
if (isrc->isrc_event == NULL) {
- error = intr_event_create(&isrc->isrc_event, isrc, 0, irq,
+ error = intr_event_create(&isrc->isrc_event, isrc, 0,
riscv_mask_irq, riscv_unmask_irq, NULL, NULL, "int%d", irq);
if (error)
return (error);
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -130,7 +130,6 @@
int ie_count; /* Loop counter. */
int ie_warncnt; /* Rate-check interrupt storm warns. */
struct timeval ie_warntm;
- int ie_irq; /* Physical irq number if !SOFT. */
int ie_cpu; /* CPU this event is bound to. */
volatile int ie_phase; /* Switched to establish a barrier. */
volatile int ie_active[2]; /* Filters in ISR context. */
@@ -181,10 +180,10 @@
int intr_event_bind_ithread_cpuset(struct intr_event *ie,
struct _cpuset *mask);
int intr_event_create(struct intr_event **event, void *source,
- int flags, int irq, void (*pre_ithread)(void *),
+ int flags, void (*pre_ithread)(void *),
void (*post_ithread)(void *), void (*post_filter)(void *),
int (*assign_cpu)(void *, int), const char *fmt, ...)
- __printflike(9, 10);
+ __printflike(8, 9);
int intr_event_describe_handler(struct intr_event *ie, void *cookie,
const char *descr);
int intr_event_destroy(struct intr_event *ie);
@@ -192,10 +191,10 @@
int intr_event_remove_handler(void *cookie);
int intr_event_suspend_handler(void *cookie);
int intr_event_resume_handler(void *cookie);
-int intr_getaffinity(int irq, int mode, void *mask);
+int intr_getaffinity(struct intr_event *ie, int mode, void *mask);
void *intr_handler_source(void *cookie);
-int intr_setaffinity(int irq, int mode, void *mask);
-void _intr_drain(int irq); /* LinuxKPI only. */
+int intr_setaffinity(struct intr_event *ie, int mode, void *mask);
+void _intr_drain(struct intr_event *ie); /* LinuxKPI only. */
int swi_add(struct intr_event **eventp, const char *name,
driver_intr_t handler, void *arg, int pri, enum intr_type flags,
void **cookiep);
diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c
--- a/sys/x86/x86/intr_machdep.c
+++ b/sys/x86/x86/intr_machdep.c
@@ -216,7 +216,7 @@
num_io_irqs));
if (interrupt_sources[vector] != NULL)
return (EEXIST);
- error = intr_event_create(&isrc->is_event, isrc, 0, vector,
+ error = intr_event_create(&isrc->is_event, isrc, 0,
intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source,
(mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:",
vector);

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 7, 3:25 AM (21 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14503890
Default Alt Text
D32504.diff (9 KB)

Event Timeline