2005-04-17 06:20:36 +08:00
|
|
|
/* interrupt.h */
|
|
|
|
#ifndef _LINUX_INTERRUPT_H
|
|
|
|
#define _LINUX_INTERRUPT_H
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/preempt.h>
|
|
|
|
#include <linux/cpumask.h>
|
2006-06-23 17:06:00 +08:00
|
|
|
#include <linux/irqreturn.h>
|
2008-10-17 00:20:58 +08:00
|
|
|
#include <linux/irqnr.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/hardirq.h>
|
2005-11-14 08:06:57 +08:00
|
|
|
#include <linux/sched.h>
|
2006-07-03 15:24:42 +08:00
|
|
|
#include <linux/irqflags.h>
|
2008-09-24 13:15:57 +08:00
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/percpu.h>
|
2009-07-22 20:18:35 +08:00
|
|
|
#include <linux/hrtimer.h>
|
2008-12-12 18:26:39 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/atomic.h>
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
|
2006-07-02 10:29:03 +08:00
|
|
|
/*
|
|
|
|
* These correspond to the IORESOURCE_IRQ_* defines in
|
|
|
|
* linux/ioport.h to select the interrupt line behaviour. When
|
|
|
|
* requesting an interrupt without specifying a IRQF_TRIGGER, the
|
|
|
|
* setting should be assumed to be "as already configured", which
|
|
|
|
* may be as per machine or firmware initialisation.
|
|
|
|
*/
|
|
|
|
#define IRQF_TRIGGER_NONE 0x00000000
|
|
|
|
#define IRQF_TRIGGER_RISING 0x00000001
|
|
|
|
#define IRQF_TRIGGER_FALLING 0x00000002
|
|
|
|
#define IRQF_TRIGGER_HIGH 0x00000004
|
|
|
|
#define IRQF_TRIGGER_LOW 0x00000008
|
|
|
|
#define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \
|
|
|
|
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
|
|
|
|
#define IRQF_TRIGGER_PROBE 0x00000010
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These flags used only by the kernel as part of the
|
|
|
|
* irq handling routines.
|
|
|
|
*
|
|
|
|
* IRQF_DISABLED - keep irqs disabled when calling the action handler
|
|
|
|
* IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
|
|
|
|
* IRQF_SHARED - allow sharing the irq among several devices
|
|
|
|
* IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
|
|
|
|
* IRQF_TIMER - Flag to mark this interrupt as timer interrupt
|
2007-02-16 17:27:24 +08:00
|
|
|
* IRQF_PERCPU - Interrupt is per cpu
|
|
|
|
* IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
|
2007-05-08 15:35:24 +08:00
|
|
|
* IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
|
|
|
|
* registered first in an shared interrupt is considered for
|
|
|
|
* performance reasons)
|
2006-07-02 10:29:03 +08:00
|
|
|
*/
|
|
|
|
#define IRQF_DISABLED 0x00000020
|
|
|
|
#define IRQF_SAMPLE_RANDOM 0x00000040
|
|
|
|
#define IRQF_SHARED 0x00000080
|
|
|
|
#define IRQF_PROBE_SHARED 0x00000100
|
|
|
|
#define IRQF_TIMER 0x00000200
|
2006-07-03 08:20:32 +08:00
|
|
|
#define IRQF_PERCPU 0x00000400
|
2007-02-16 17:27:24 +08:00
|
|
|
#define IRQF_NOBALANCING 0x00000800
|
2007-05-08 15:35:24 +08:00
|
|
|
#define IRQF_IRQPOLL 0x00001000
|
2006-07-02 10:29:03 +08:00
|
|
|
|
2009-03-24 01:28:15 +08:00
|
|
|
/*
|
|
|
|
* Bits used by threaded handlers:
|
|
|
|
* IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
|
|
|
|
* IRQTF_DIED - handler thread died
|
2009-03-24 18:46:22 +08:00
|
|
|
* IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
|
2009-07-21 17:09:39 +08:00
|
|
|
* IRQTF_AFFINITY - irq thread is requested to adjust affinity
|
2009-03-24 01:28:15 +08:00
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
IRQTF_RUNTHREAD,
|
|
|
|
IRQTF_DIED,
|
2009-03-24 18:46:22 +08:00
|
|
|
IRQTF_WARNED,
|
2009-07-21 17:09:39 +08:00
|
|
|
IRQTF_AFFINITY,
|
2009-03-24 01:28:15 +08:00
|
|
|
};
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 21:55:46 +08:00
|
|
|
typedef irqreturn_t (*irq_handler_t)(int, void *);
|
2006-10-05 20:06:34 +08:00
|
|
|
|
2009-03-03 23:58:16 +08:00
|
|
|
/**
|
|
|
|
* struct irqaction - per interrupt action descriptor
|
|
|
|
* @handler: interrupt handler function
|
|
|
|
* @flags: flags (see IRQF_* above)
|
|
|
|
* @mask: no comment as it is useless and about to be removed
|
|
|
|
* @name: name of the device
|
|
|
|
* @dev_id: cookie to identify the device
|
|
|
|
* @next: pointer to the next irqaction for shared interrupts
|
|
|
|
* @irq: interrupt number
|
|
|
|
* @dir: pointer to the proc/irq/NN/name entry
|
2009-03-24 01:28:15 +08:00
|
|
|
* @thread_fn: interupt handler function for threaded interrupts
|
|
|
|
* @thread: thread pointer for threaded interrupts
|
|
|
|
* @thread_flags: flags related to @thread
|
2009-03-03 23:58:16 +08:00
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
struct irqaction {
|
2006-10-05 20:06:34 +08:00
|
|
|
irq_handler_t handler;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long flags;
|
|
|
|
cpumask_t mask;
|
|
|
|
const char *name;
|
|
|
|
void *dev_id;
|
|
|
|
struct irqaction *next;
|
|
|
|
int irq;
|
|
|
|
struct proc_dir_entry *dir;
|
2009-03-24 01:28:15 +08:00
|
|
|
irq_handler_t thread_fn;
|
|
|
|
struct task_struct *thread;
|
|
|
|
unsigned long thread_flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 21:55:46 +08:00
|
|
|
extern irqreturn_t no_action(int cpl, void *dev_id);
|
2009-03-24 01:28:15 +08:00
|
|
|
|
2009-03-25 03:27:39 +08:00
|
|
|
#ifdef CONFIG_GENERIC_HARDIRQS
|
2009-03-24 01:28:15 +08:00
|
|
|
extern int __must_check
|
|
|
|
request_threaded_irq(unsigned int irq, irq_handler_t handler,
|
|
|
|
irq_handler_t thread_fn,
|
|
|
|
unsigned long flags, const char *name, void *dev);
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
|
|
|
|
const char *name, void *dev)
|
|
|
|
{
|
|
|
|
return request_threaded_irq(irq, handler, NULL, flags, name, dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void exit_irq_thread(void);
|
|
|
|
#else
|
2009-03-25 03:27:39 +08:00
|
|
|
|
|
|
|
extern int __must_check
|
|
|
|
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
|
|
|
|
const char *name, void *dev);
|
|
|
|
|
2009-03-26 00:33:38 +08:00
|
|
|
/*
|
|
|
|
* Special function to avoid ifdeffery in kernel/irq/devres.c which
|
|
|
|
* gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
|
|
|
|
* m68k). I really love these $@%#!* obvious Makefile references:
|
|
|
|
* ../../../kernel/irq/devres.o
|
|
|
|
*/
|
|
|
|
static inline int __must_check
|
|
|
|
request_threaded_irq(unsigned int irq, irq_handler_t handler,
|
|
|
|
irq_handler_t thread_fn,
|
|
|
|
unsigned long flags, const char *name, void *dev)
|
|
|
|
{
|
|
|
|
return request_irq(irq, handler, flags, name, dev);
|
|
|
|
}
|
|
|
|
|
2009-03-24 01:28:15 +08:00
|
|
|
static inline void exit_irq_thread(void) { }
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void free_irq(unsigned int, void *);
|
|
|
|
|
2007-07-27 21:24:33 +08:00
|
|
|
struct device;
|
|
|
|
|
2009-03-24 01:28:16 +08:00
|
|
|
extern int __must_check
|
|
|
|
devm_request_threaded_irq(struct device *dev, unsigned int irq,
|
|
|
|
irq_handler_t handler, irq_handler_t thread_fn,
|
|
|
|
unsigned long irqflags, const char *devname,
|
|
|
|
void *dev_id);
|
|
|
|
|
|
|
|
static inline int __must_check
|
|
|
|
devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
|
|
|
|
unsigned long irqflags, const char *devname, void *dev_id)
|
|
|
|
{
|
|
|
|
return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
|
|
|
|
devname, dev_id);
|
|
|
|
}
|
|
|
|
|
devres: device resource management
Implement device resource management, in short, devres. A device
driver can allocate arbirary size of devres data which is associated
with a release function. On driver detach, release function is
invoked on the devres data, then, devres data is freed.
devreses are typed by associated release functions. Some devreses are
better represented by single instance of the type while others need
multiple instances sharing the same release function. Both usages are
supported.
devreses can be grouped using devres group such that a device driver
can easily release acquired resources halfway through initialization
or selectively release resources (e.g. resources for port 1 out of 4
ports).
This patch adds devres core including documentation and the following
managed interfaces.
* alloc/free : devm_kzalloc(), devm_kzfree()
* IO region : devm_request_region(), devm_release_region()
* IRQ : devm_request_irq(), devm_free_irq()
* DMA : dmam_alloc_coherent(), dmam_free_coherent(),
dmam_declare_coherent_memory(), dmam_pool_create(),
dmam_pool_destroy()
* PCI : pcim_enable_device(), pcim_pin_device(), pci_is_managed()
* iomap : devm_ioport_map(), devm_ioport_unmap(), devm_ioremap(),
devm_ioremap_nocache(), devm_iounmap(), pcim_iomap_table(),
pcim_iomap(), pcim_iounmap()
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-01-20 15:00:26 +08:00
|
|
|
extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
|
|
|
|
|
2006-07-03 15:24:27 +08:00
|
|
|
/*
|
|
|
|
* On lockdep we dont want to enable hardirqs in hardirq
|
|
|
|
* context. Use local_irq_enable_in_hardirq() to annotate
|
|
|
|
* kernel code that has to do this nevertheless (pretty much
|
|
|
|
* the only valid case is for old/broken hardware that is
|
|
|
|
* insanely slow).
|
|
|
|
*
|
|
|
|
* NOTE: in theory this might break fragile code that relies
|
|
|
|
* on hardirq delivery - in practice we dont seem to have such
|
|
|
|
* places left. So the only effect should be slightly increased
|
|
|
|
* irqs-off latencies.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
# define local_irq_enable_in_hardirq() do { } while (0)
|
|
|
|
#else
|
|
|
|
# define local_irq_enable_in_hardirq() local_irq_enable()
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern void disable_irq_nosync(unsigned int irq);
|
|
|
|
extern void disable_irq(unsigned int irq);
|
|
|
|
extern void enable_irq(unsigned int irq);
|
2006-06-29 17:24:55 +08:00
|
|
|
|
2009-03-17 05:33:49 +08:00
|
|
|
/* The following three functions are for the core kernel use only. */
|
2009-06-12 03:59:21 +08:00
|
|
|
#ifdef CONFIG_GENERIC_HARDIRQS
|
2009-03-17 05:33:49 +08:00
|
|
|
extern void suspend_device_irqs(void);
|
|
|
|
extern void resume_device_irqs(void);
|
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
extern int check_wakeup_irqs(void);
|
|
|
|
#else
|
|
|
|
static inline int check_wakeup_irqs(void) { return 0; }
|
|
|
|
#endif
|
2009-06-12 03:59:21 +08:00
|
|
|
#else
|
|
|
|
static inline void suspend_device_irqs(void) { };
|
|
|
|
static inline void resume_device_irqs(void) { };
|
|
|
|
static inline int check_wakeup_irqs(void) { return 0; }
|
2009-03-17 05:33:49 +08:00
|
|
|
#endif
|
|
|
|
|
[S390] genirq/clockevents: move irq affinity prototypes/inlines to interrupt.h
> Generic code is not supposed to include irq.h. Replace this include
> by linux/hardirq.h instead and add/replace an include of linux/irq.h
> in asm header files where necessary.
> This change should only matter for architectures that make use of
> GENERIC_CLOCKEVENTS.
> Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.
>
> I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64.
> This patch fixes also build breakages caused by the include replacement in
> tick-common.h.
I generally dislike adding optional linux/* includes in asm/* includes -
I'm nervous about this causing include loops.
However, there's a separate point to be discussed here.
That is, what interfaces are expected of every architecture in the kernel.
If generic code wants to be able to set the affinity of interrupts, then
that needs to become part of the interfaces listed in linux/interrupt.h
rather than linux/irq.h.
So what I suggest is this approach instead (against Linus' tree of a
couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity()
to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h
and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be
rarely used include since not much touches the stacked parent context
registers.)
Build tested on ARM PXA family kernels and ARM's Realview platform
kernels which both use genirq.
[ tglx@linutronix.de: add GENERIC_HARDIRQ dependencies ]
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-04-17 13:46:24 +08:00
|
|
|
#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
|
|
|
|
|
2009-01-01 07:42:26 +08:00
|
|
|
extern cpumask_var_t irq_default_affinity;
|
2008-05-30 02:02:52 +08:00
|
|
|
|
2008-12-13 18:50:26 +08:00
|
|
|
extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
|
[S390] genirq/clockevents: move irq affinity prototypes/inlines to interrupt.h
> Generic code is not supposed to include irq.h. Replace this include
> by linux/hardirq.h instead and add/replace an include of linux/irq.h
> in asm header files where necessary.
> This change should only matter for architectures that make use of
> GENERIC_CLOCKEVENTS.
> Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.
>
> I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64.
> This patch fixes also build breakages caused by the include replacement in
> tick-common.h.
I generally dislike adding optional linux/* includes in asm/* includes -
I'm nervous about this causing include loops.
However, there's a separate point to be discussed here.
That is, what interfaces are expected of every architecture in the kernel.
If generic code wants to be able to set the affinity of interrupts, then
that needs to become part of the interfaces listed in linux/interrupt.h
rather than linux/irq.h.
So what I suggest is this approach instead (against Linus' tree of a
couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity()
to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h
and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be
rarely used include since not much touches the stacked parent context
registers.)
Build tested on ARM PXA family kernels and ARM's Realview platform
kernels which both use genirq.
[ tglx@linutronix.de: add GENERIC_HARDIRQ dependencies ]
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-04-17 13:46:24 +08:00
|
|
|
extern int irq_can_set_affinity(unsigned int irq);
|
2008-05-30 02:02:52 +08:00
|
|
|
extern int irq_select_affinity(unsigned int irq);
|
[S390] genirq/clockevents: move irq affinity prototypes/inlines to interrupt.h
> Generic code is not supposed to include irq.h. Replace this include
> by linux/hardirq.h instead and add/replace an include of linux/irq.h
> in asm header files where necessary.
> This change should only matter for architectures that make use of
> GENERIC_CLOCKEVENTS.
> Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.
>
> I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64.
> This patch fixes also build breakages caused by the include replacement in
> tick-common.h.
I generally dislike adding optional linux/* includes in asm/* includes -
I'm nervous about this causing include loops.
However, there's a separate point to be discussed here.
That is, what interfaces are expected of every architecture in the kernel.
If generic code wants to be able to set the affinity of interrupts, then
that needs to become part of the interfaces listed in linux/interrupt.h
rather than linux/irq.h.
So what I suggest is this approach instead (against Linus' tree of a
couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity()
to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h
and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be
rarely used include since not much touches the stacked parent context
registers.)
Build tested on ARM PXA family kernels and ARM's Realview platform
kernels which both use genirq.
[ tglx@linutronix.de: add GENERIC_HARDIRQ dependencies ]
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-04-17 13:46:24 +08:00
|
|
|
|
|
|
|
#else /* CONFIG_SMP */
|
|
|
|
|
2008-12-13 18:50:26 +08:00
|
|
|
static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
|
[S390] genirq/clockevents: move irq affinity prototypes/inlines to interrupt.h
> Generic code is not supposed to include irq.h. Replace this include
> by linux/hardirq.h instead and add/replace an include of linux/irq.h
> in asm header files where necessary.
> This change should only matter for architectures that make use of
> GENERIC_CLOCKEVENTS.
> Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.
>
> I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64.
> This patch fixes also build breakages caused by the include replacement in
> tick-common.h.
I generally dislike adding optional linux/* includes in asm/* includes -
I'm nervous about this causing include loops.
However, there's a separate point to be discussed here.
That is, what interfaces are expected of every architecture in the kernel.
If generic code wants to be able to set the affinity of interrupts, then
that needs to become part of the interfaces listed in linux/interrupt.h
rather than linux/irq.h.
So what I suggest is this approach instead (against Linus' tree of a
couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity()
to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h
and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be
rarely used include since not much touches the stacked parent context
registers.)
Build tested on ARM PXA family kernels and ARM's Realview platform
kernels which both use genirq.
[ tglx@linutronix.de: add GENERIC_HARDIRQ dependencies ]
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-04-17 13:46:24 +08:00
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int irq_can_set_affinity(unsigned int irq)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-05-30 02:02:52 +08:00
|
|
|
static inline int irq_select_affinity(unsigned int irq) { return 0; }
|
|
|
|
|
[S390] genirq/clockevents: move irq affinity prototypes/inlines to interrupt.h
> Generic code is not supposed to include irq.h. Replace this include
> by linux/hardirq.h instead and add/replace an include of linux/irq.h
> in asm header files where necessary.
> This change should only matter for architectures that make use of
> GENERIC_CLOCKEVENTS.
> Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.
>
> I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64.
> This patch fixes also build breakages caused by the include replacement in
> tick-common.h.
I generally dislike adding optional linux/* includes in asm/* includes -
I'm nervous about this causing include loops.
However, there's a separate point to be discussed here.
That is, what interfaces are expected of every architecture in the kernel.
If generic code wants to be able to set the affinity of interrupts, then
that needs to become part of the interfaces listed in linux/interrupt.h
rather than linux/irq.h.
So what I suggest is this approach instead (against Linus' tree of a
couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity()
to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h
and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be
rarely used include since not much touches the stacked parent context
registers.)
Build tested on ARM PXA family kernels and ARM's Realview platform
kernels which both use genirq.
[ tglx@linutronix.de: add GENERIC_HARDIRQ dependencies ]
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2008-04-17 13:46:24 +08:00
|
|
|
#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
|
|
|
|
|
2007-07-22 06:29:12 +08:00
|
|
|
#ifdef CONFIG_GENERIC_HARDIRQS
|
2006-07-03 15:24:27 +08:00
|
|
|
/*
|
|
|
|
* Special lockdep variants of irq disabling/enabling.
|
|
|
|
* These should be used for locking constructs that
|
|
|
|
* know that a particular irq context which is disabled,
|
|
|
|
* and which is the only irq-context user of a lock,
|
|
|
|
* that it's safe to take the lock in the irq-disabled
|
|
|
|
* section without disabling hardirqs.
|
|
|
|
*
|
|
|
|
* On !CONFIG_LOCKDEP they are equivalent to the normal
|
|
|
|
* irq disable/enable methods.
|
|
|
|
*/
|
|
|
|
static inline void disable_irq_nosync_lockdep(unsigned int irq)
|
|
|
|
{
|
|
|
|
disable_irq_nosync(irq);
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
local_irq_disable();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-09-29 17:01:08 +08:00
|
|
|
static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
|
|
|
|
{
|
|
|
|
disable_irq_nosync(irq);
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
local_irq_save(*flags);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-07-03 15:24:27 +08:00
|
|
|
static inline void disable_irq_lockdep(unsigned int irq)
|
|
|
|
{
|
|
|
|
disable_irq(irq);
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
local_irq_disable();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void enable_irq_lockdep(unsigned int irq)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
local_irq_enable();
|
|
|
|
#endif
|
|
|
|
enable_irq(irq);
|
|
|
|
}
|
|
|
|
|
2006-09-29 17:01:08 +08:00
|
|
|
static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
local_irq_restore(*flags);
|
|
|
|
#endif
|
|
|
|
enable_irq(irq);
|
|
|
|
}
|
|
|
|
|
2006-06-29 17:24:55 +08:00
|
|
|
/* IRQ wakeup (PM) control: */
|
|
|
|
extern int set_irq_wake(unsigned int irq, unsigned int on);
|
|
|
|
|
|
|
|
static inline int enable_irq_wake(unsigned int irq)
|
|
|
|
{
|
|
|
|
return set_irq_wake(irq, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int disable_irq_wake(unsigned int irq)
|
|
|
|
{
|
|
|
|
return set_irq_wake(irq, 0);
|
|
|
|
}
|
|
|
|
|
2006-07-03 15:24:27 +08:00
|
|
|
#else /* !CONFIG_GENERIC_HARDIRQS */
|
|
|
|
/*
|
|
|
|
* NOTE: non-genirq architectures, if they want to support the lock
|
|
|
|
* validator need to define the methods below in their asm/irq.h
|
|
|
|
* files, under an #ifdef CONFIG_LOCKDEP section.
|
|
|
|
*/
|
2007-05-02 04:32:42 +08:00
|
|
|
#ifndef CONFIG_LOCKDEP
|
2006-07-03 15:24:27 +08:00
|
|
|
# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
|
2007-05-02 04:32:42 +08:00
|
|
|
# define disable_irq_nosync_lockdep_irqsave(irq, flags) \
|
|
|
|
disable_irq_nosync(irq)
|
2006-07-03 15:24:27 +08:00
|
|
|
# define disable_irq_lockdep(irq) disable_irq(irq)
|
|
|
|
# define enable_irq_lockdep(irq) enable_irq(irq)
|
2007-05-02 04:32:42 +08:00
|
|
|
# define enable_irq_lockdep_irqrestore(irq, flags) \
|
|
|
|
enable_irq(irq)
|
2006-07-03 15:24:27 +08:00
|
|
|
# endif
|
|
|
|
|
2007-10-16 16:24:01 +08:00
|
|
|
static inline int enable_irq_wake(unsigned int irq)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int disable_irq_wake(unsigned int irq)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2006-07-03 15:24:27 +08:00
|
|
|
#endif /* CONFIG_GENERIC_HARDIRQS */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-09-13 00:49:24 +08:00
|
|
|
#ifndef __ARCH_SET_SOFTIRQ_PENDING
|
|
|
|
#define set_softirq_pending(x) (local_softirq_pending() = (x))
|
|
|
|
#define or_softirq_pending(x) (local_softirq_pending() |= (x))
|
|
|
|
#endif
|
|
|
|
|
Add hard_irq_disable()
Some architectures, like powerpc, implement lazy disabling of interrupts.
That means that on those, local_irq_disable() doesn't actually disable
interrupts on the CPU, but only sets some per CPU flag which cause them to be
disabled only if an interrupt actually occurs.
However, in some cases, such as stop_machine, we really want interrupts to be
fully disabled. For example, I have code using stop machine to do ECC error
injection, used to verify operations of the ECC hardware, that sort of thing.
It really needs to make sure that nothing is actually writing to memory while
the injection happens. Similar examples can be found in other low level bits
and pieces.
This patch implements a generic hard_irq_disable() function which is meant to
be called -after- local_irq_disable() and ensures that interrupts are fully
disabled on that CPU. The default implementation is a nop, though powerpc
does already provide an appropriate one.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-11 13:22:46 +08:00
|
|
|
/* Some architectures might implement lazy enabling/disabling of
|
|
|
|
* interrupts. In some cases, such as stop_machine, we might want
|
|
|
|
* to ensure that after a local_irq_disable(), interrupts have
|
|
|
|
* really been disabled in hardware. Such architectures need to
|
|
|
|
* implement the following hook.
|
|
|
|
*/
|
|
|
|
#ifndef hard_irq_disable
|
|
|
|
#define hard_irq_disable() do { } while(0)
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
|
|
|
|
frequency threaded job scheduling. For almost all the purposes
|
|
|
|
tasklets are more than enough. F.e. all serial device BHs et
|
|
|
|
al. should be converted to tasklets, not to softirqs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
HI_SOFTIRQ=0,
|
|
|
|
TIMER_SOFTIRQ,
|
|
|
|
NET_TX_SOFTIRQ,
|
|
|
|
NET_RX_SOFTIRQ,
|
2006-01-09 23:02:34 +08:00
|
|
|
BLOCK_SOFTIRQ,
|
2006-12-10 18:20:25 +08:00
|
|
|
TASKLET_SOFTIRQ,
|
|
|
|
SCHED_SOFTIRQ,
|
2009-01-05 18:28:22 +08:00
|
|
|
HRTIMER_SOFTIRQ,
|
|
|
|
RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
|
2008-09-07 02:04:36 +08:00
|
|
|
|
|
|
|
NR_SOFTIRQS
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2009-03-13 02:33:36 +08:00
|
|
|
/* map softirq index to softirq name. update 'softirq_to_name' in
|
|
|
|
* kernel/softirq.c when adding a new softirq.
|
|
|
|
*/
|
|
|
|
extern char *softirq_to_name[NR_SOFTIRQS];
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* softirq mask and active fields moved to irq_cpustat_t in
|
|
|
|
* asm/hardirq.h to get better cache usage. KAO
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct softirq_action
|
|
|
|
{
|
|
|
|
void (*action)(struct softirq_action *);
|
|
|
|
};
|
|
|
|
|
|
|
|
asmlinkage void do_softirq(void);
|
2008-04-29 15:59:12 +08:00
|
|
|
asmlinkage void __do_softirq(void);
|
Remove argument from open_softirq which is always NULL
As git-grep shows, open_softirq() is always called with the last argument
being NULL
block/blk-core.c: open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL);
kernel/hrtimer.c: open_softirq(HRTIMER_SOFTIRQ, run_hrtimer_softirq, NULL);
kernel/rcuclassic.c: open_softirq(RCU_SOFTIRQ, rcu_process_callbacks, NULL);
kernel/rcupreempt.c: open_softirq(RCU_SOFTIRQ, rcu_process_callbacks, NULL);
kernel/sched.c: open_softirq(SCHED_SOFTIRQ, run_rebalance_domains, NULL);
kernel/softirq.c: open_softirq(TASKLET_SOFTIRQ, tasklet_action, NULL);
kernel/softirq.c: open_softirq(HI_SOFTIRQ, tasklet_hi_action, NULL);
kernel/timer.c: open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);
net/core/dev.c: open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
net/core/dev.c: open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);
This observation has already been made by Matthew Wilcox in June 2002
(http://www.cs.helsinki.fi/linux/linux-kernel/2002-25/0687.html)
"I notice that none of the current softirq routines use the data element
passed to them."
and the situation hasn't changed since them. So it appears we can safely
remove that extra argument to save 128 (54) bytes of kernel data (text).
Signed-off-by: Carlos R. Mafra <crmafra@ift.unesp.br>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-15 22:15:37 +08:00
|
|
|
extern void open_softirq(int nr, void (*action)(struct softirq_action *));
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void softirq_init(void);
|
2005-09-13 00:49:24 +08:00
|
|
|
#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
|
2008-02-14 07:03:15 +08:00
|
|
|
extern void raise_softirq_irqoff(unsigned int nr);
|
|
|
|
extern void raise_softirq(unsigned int nr);
|
2009-03-13 19:21:27 +08:00
|
|
|
extern void wakeup_softirqd(void);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-09-24 13:15:57 +08:00
|
|
|
/* This is the worklist that queues up per-cpu softirq work.
|
|
|
|
*
|
|
|
|
* send_remote_sendirq() adds work to these lists, and
|
|
|
|
* the softirq handler itself dequeues from them. The queues
|
|
|
|
* are protected by disabling local cpu interrupts and they must
|
|
|
|
* only be accessed by the local cpu that they are for.
|
|
|
|
*/
|
|
|
|
DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
|
|
|
|
|
|
|
|
/* Try to send a softirq to a remote cpu. If this cannot be done, the
|
|
|
|
* work will be queued to the local cpu.
|
|
|
|
*/
|
|
|
|
extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq);
|
|
|
|
|
|
|
|
/* Like send_remote_softirq(), but the caller must disable local cpu interrupts
|
|
|
|
* and compute the current cpu, passed in as 'this_cpu'.
|
|
|
|
*/
|
|
|
|
extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
|
|
|
|
int this_cpu, int softirq);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Tasklets --- multithreaded analogue of BHs.
|
|
|
|
|
|
|
|
Main feature differing them of generic softirqs: tasklet
|
|
|
|
is running only on one CPU simultaneously.
|
|
|
|
|
|
|
|
Main feature differing them of BHs: different tasklets
|
|
|
|
may be run simultaneously on different CPUs.
|
|
|
|
|
|
|
|
Properties:
|
|
|
|
* If tasklet_schedule() is called, then tasklet is guaranteed
|
|
|
|
to be executed on some cpu at least once after this.
|
|
|
|
* If the tasklet is already scheduled, but its excecution is still not
|
|
|
|
started, it will be executed only once.
|
|
|
|
* If this tasklet is already running on another CPU (or schedule is called
|
|
|
|
from tasklet itself), it is rescheduled for later.
|
|
|
|
* Tasklet is strictly serialized wrt itself, but not
|
|
|
|
wrt another tasklets. If client needs some intertask synchronization,
|
|
|
|
he makes it with spinlocks.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct tasklet_struct
|
|
|
|
{
|
|
|
|
struct tasklet_struct *next;
|
|
|
|
unsigned long state;
|
|
|
|
atomic_t count;
|
|
|
|
void (*func)(unsigned long);
|
|
|
|
unsigned long data;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DECLARE_TASKLET(name, func, data) \
|
|
|
|
struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
|
|
|
|
|
|
|
|
#define DECLARE_TASKLET_DISABLED(name, func, data) \
|
|
|
|
struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
|
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TASKLET_STATE_SCHED, /* Tasklet is scheduled for execution */
|
|
|
|
TASKLET_STATE_RUN /* Tasklet is running (SMP only) */
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
static inline int tasklet_trylock(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
return !test_and_set_bit(TASKLET_STATE_RUN, &(t)->state);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void tasklet_unlock(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
smp_mb__before_clear_bit();
|
|
|
|
clear_bit(TASKLET_STATE_RUN, &(t)->state);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void tasklet_unlock_wait(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
while (test_bit(TASKLET_STATE_RUN, &(t)->state)) { barrier(); }
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define tasklet_trylock(t) 1
|
|
|
|
#define tasklet_unlock_wait(t) do { } while (0)
|
|
|
|
#define tasklet_unlock(t) do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2008-02-14 07:03:15 +08:00
|
|
|
extern void __tasklet_schedule(struct tasklet_struct *t);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static inline void tasklet_schedule(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
|
|
|
|
__tasklet_schedule(t);
|
|
|
|
}
|
|
|
|
|
2008-02-14 07:03:15 +08:00
|
|
|
extern void __tasklet_hi_schedule(struct tasklet_struct *t);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static inline void tasklet_hi_schedule(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
|
|
|
|
__tasklet_hi_schedule(t);
|
|
|
|
}
|
|
|
|
|
2008-05-22 04:53:13 +08:00
|
|
|
extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This version avoids touching any other tasklets. Needed for kmemcheck
|
|
|
|
* in order not to take any page faults while enqueueing this tasklet;
|
|
|
|
* consider VERY carefully whether you really need this or
|
|
|
|
* tasklet_hi_schedule()...
|
|
|
|
*/
|
|
|
|
static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
|
|
|
|
__tasklet_hi_schedule_first(t);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static inline void tasklet_disable_nosync(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
atomic_inc(&t->count);
|
|
|
|
smp_mb__after_atomic_inc();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void tasklet_disable(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
tasklet_disable_nosync(t);
|
|
|
|
tasklet_unlock_wait(t);
|
|
|
|
smp_mb();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void tasklet_enable(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
smp_mb__before_atomic_dec();
|
|
|
|
atomic_dec(&t->count);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void tasklet_hi_enable(struct tasklet_struct *t)
|
|
|
|
{
|
|
|
|
smp_mb__before_atomic_dec();
|
|
|
|
atomic_dec(&t->count);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void tasklet_kill(struct tasklet_struct *t);
|
|
|
|
extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
|
|
|
|
extern void tasklet_init(struct tasklet_struct *t,
|
|
|
|
void (*func)(unsigned long), unsigned long data);
|
|
|
|
|
2009-07-22 20:18:35 +08:00
|
|
|
struct tasklet_hrtimer {
|
|
|
|
struct hrtimer timer;
|
|
|
|
struct tasklet_struct tasklet;
|
|
|
|
enum hrtimer_restart (*function)(struct hrtimer *);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern void
|
|
|
|
tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer,
|
|
|
|
enum hrtimer_restart (*function)(struct hrtimer *),
|
|
|
|
clockid_t which_clock, enum hrtimer_mode mode);
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int tasklet_hrtimer_start(struct tasklet_hrtimer *ttimer, ktime_t time,
|
|
|
|
const enum hrtimer_mode mode)
|
|
|
|
{
|
|
|
|
return hrtimer_start(&ttimer->timer, time, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer)
|
|
|
|
{
|
|
|
|
hrtimer_cancel(&ttimer->timer);
|
|
|
|
tasklet_kill(&ttimer->tasklet);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Autoprobing for irqs:
|
|
|
|
*
|
|
|
|
* probe_irq_on() and probe_irq_off() provide robust primitives
|
|
|
|
* for accurate IRQ probing during kernel initialization. They are
|
|
|
|
* reasonably simple to use, are not "fooled" by spurious interrupts,
|
|
|
|
* and, unlike other attempts at IRQ probing, they do not get hung on
|
|
|
|
* stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards).
|
|
|
|
*
|
|
|
|
* For reasonably foolproof probing, use them as follows:
|
|
|
|
*
|
|
|
|
* 1. clear and/or mask the device's internal interrupt.
|
|
|
|
* 2. sti();
|
|
|
|
* 3. irqs = probe_irq_on(); // "take over" all unassigned idle IRQs
|
|
|
|
* 4. enable the device and cause it to trigger an interrupt.
|
|
|
|
* 5. wait for the device to interrupt, using non-intrusive polling or a delay.
|
|
|
|
* 6. irq = probe_irq_off(irqs); // get IRQ number, 0=none, negative=multiple
|
|
|
|
* 7. service the device to clear its pending interrupt.
|
|
|
|
* 8. loop again if paranoia is required.
|
|
|
|
*
|
|
|
|
* probe_irq_on() returns a mask of allocated irq's.
|
|
|
|
*
|
|
|
|
* probe_irq_off() takes the mask as a parameter,
|
|
|
|
* and returns the irq number which occurred,
|
|
|
|
* or zero if none occurred, or a negative irq number
|
|
|
|
* if more than one irq occurred.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(CONFIG_GENERIC_HARDIRQS) && !defined(CONFIG_GENERIC_IRQ_PROBE)
|
|
|
|
static inline unsigned long probe_irq_on(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline int probe_irq_off(unsigned long val)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline unsigned int probe_irq_mask(unsigned long val)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
extern unsigned long probe_irq_on(void); /* returns 0 on failure */
|
|
|
|
extern int probe_irq_off(unsigned long); /* returns 0 or negative on failure */
|
|
|
|
extern unsigned int probe_irq_mask(unsigned long); /* returns mask of ISA interrupts */
|
|
|
|
#endif
|
|
|
|
|
2007-02-18 13:22:39 +08:00
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
|
/* Initialize /proc/irq/ */
|
|
|
|
extern void init_irq_proc(void);
|
|
|
|
#else
|
|
|
|
static inline void init_irq_proc(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-01-17 00:43:50 +08:00
|
|
|
#if defined(CONFIG_GENERIC_HARDIRQS) && defined(CONFIG_DEBUG_SHIRQ)
|
|
|
|
extern void debug_poll_all_shared_irqs(void);
|
|
|
|
#else
|
|
|
|
static inline void debug_poll_all_shared_irqs(void) { }
|
|
|
|
#endif
|
|
|
|
|
2008-02-06 17:36:35 +08:00
|
|
|
int show_interrupts(struct seq_file *p, void *v);
|
|
|
|
|
2008-12-29 08:01:13 +08:00
|
|
|
struct irq_desc;
|
|
|
|
|
|
|
|
extern int early_irq_init(void);
|
2009-01-13 09:39:24 +08:00
|
|
|
extern int arch_probe_nr_irqs(void);
|
2008-12-29 08:01:13 +08:00
|
|
|
extern int arch_early_irq_init(void);
|
2009-04-28 09:00:38 +08:00
|
|
|
extern int arch_init_chip_data(struct irq_desc *desc, int node);
|
2008-12-29 08:01:13 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|