aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/interrupt.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-01-19 16:01:44 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-01-22 11:34:25 -0500
commitcd7eab44e9946c28d595abe3e9a43e945bc49141 (patch)
treeb8b0c1beebbcad7785422a463504a374bb43cdea /include/linux/interrupt.h
parent1bae4ce27c9c90344f23c65ea6966c50ffeae2f5 (diff)
genirq: Add IRQ affinity notifiers
When initiating I/O on a multiqueue and multi-IRQ device, we may want to select a queue for which the response will be handled on the same or a nearby CPU. This requires a reverse-map of IRQ affinity. Add a notification mechanism to support this. This is based closely on work by Thomas Gleixner <tglx@linutronix.de>. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Cc: linux-net-drivers@solarflare.com Cc: Tom Herbert <therbert@google.com> Cc: David Miller <davem@davemloft.net> LKML-Reference: <1295470904.11126.84.camel@bwh-desktop> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/interrupt.h')
-rw-r--r--include/linux/interrupt.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 55e0d4253e49..63c5ad78e37c 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -14,6 +14,8 @@
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/percpu.h> 15#include <linux/percpu.h>
16#include <linux/hrtimer.h> 16#include <linux/hrtimer.h>
17#include <linux/kref.h>
18#include <linux/workqueue.h>
17 19
18#include <asm/atomic.h> 20#include <asm/atomic.h>
19#include <asm/ptrace.h> 21#include <asm/ptrace.h>
@@ -240,6 +242,35 @@ extern int irq_can_set_affinity(unsigned int irq);
240extern int irq_select_affinity(unsigned int irq); 242extern int irq_select_affinity(unsigned int irq);
241 243
242extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); 244extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
245
246/**
247 * struct irq_affinity_notify - context for notification of IRQ affinity changes
248 * @irq: Interrupt to which notification applies
249 * @kref: Reference count, for internal use
250 * @work: Work item, for internal use
251 * @notify: Function to be called on change. This will be
252 * called in process context.
253 * @release: Function to be called on release. This will be
254 * called in process context. Once registered, the
255 * structure must only be freed when this function is
256 * called or later.
257 */
258struct irq_affinity_notify {
259 unsigned int irq;
260 struct kref kref;
261 struct work_struct work;
262 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
263 void (*release)(struct kref *ref);
264};
265
266extern int
267irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
268
269static inline void irq_run_affinity_notifiers(void)
270{
271 flush_scheduled_work();
272}
273
243#else /* CONFIG_SMP */ 274#else /* CONFIG_SMP */
244 275
245static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 276static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -255,7 +286,7 @@ static inline int irq_can_set_affinity(unsigned int irq)
255static inline int irq_select_affinity(unsigned int irq) { return 0; } 286static inline int irq_select_affinity(unsigned int irq) { return 0; }
256 287
257static inline int irq_set_affinity_hint(unsigned int irq, 288static inline int irq_set_affinity_hint(unsigned int irq,
258 const struct cpumask *m) 289 const struct cpumask *m)
259{ 290{
260 return -EINVAL; 291 return -EINVAL;
261} 292}