Merge branches 'irq-cleanup-for-linus' and 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: vlynq: Convert irq functions * 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: genirq; Fix cleanup fallout genirq: Fix typo and remove unused variable genirq: Fix new kernel-doc warnings genirq: Add setter for AFFINITY_SET in irq_data state genirq: Provide setter inline for IRQD_IRQ_INPROGRESS genirq: Remove handle_IRQ_event arm: Ns9xxx: Remove private irq flow handler powerpc: cell: Use the core flow handler genirq: Provide edge_eoi flow handler genirq: Move INPROGRESS, MASKED and DISABLED state flags to irq_data genirq: Split irq_set_affinity() so it can be called with lock held. genirq: Add chip flag for restricting cpu_on/offline calls genirq: Add chip hooks for taking CPUs on/off line. genirq: Add irq disabled flag to irq_data state genirq: Reserve the irq when calling irq_set_chip()
This commit is contained in:
@@ -51,6 +51,10 @@ config HARDIRQS_SW_RESEND
|
||||
config IRQ_PREFLOW_FASTEOI
|
||||
bool
|
||||
|
||||
# Edge style eoi based handler (cell)
|
||||
config IRQ_EDGE_EOI_HANDLER
|
||||
bool
|
||||
|
||||
# Support forced irq threading
|
||||
config IRQ_FORCED_THREADING
|
||||
bool
|
||||
|
@@ -37,6 +37,12 @@ int irq_set_chip(unsigned int irq, struct irq_chip *chip)
|
||||
irq_chip_set_defaults(chip);
|
||||
desc->irq_data.chip = chip;
|
||||
irq_put_desc_unlock(desc, flags);
|
||||
/*
|
||||
* For !CONFIG_SPARSE_IRQ make the irq show up in
|
||||
* allocated_irqs. For the CONFIG_SPARSE_IRQ case, it is
|
||||
* already marked, and this call is harmless.
|
||||
*/
|
||||
irq_reserve_irq(irq);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(irq_set_chip);
|
||||
@@ -134,25 +140,25 @@ EXPORT_SYMBOL_GPL(irq_get_irq_data);
|
||||
|
||||
static void irq_state_clr_disabled(struct irq_desc *desc)
|
||||
{
|
||||
desc->istate &= ~IRQS_DISABLED;
|
||||
irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED);
|
||||
irq_compat_clr_disabled(desc);
|
||||
}
|
||||
|
||||
static void irq_state_set_disabled(struct irq_desc *desc)
|
||||
{
|
||||
desc->istate |= IRQS_DISABLED;
|
||||
irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
|
||||
irq_compat_set_disabled(desc);
|
||||
}
|
||||
|
||||
static void irq_state_clr_masked(struct irq_desc *desc)
|
||||
{
|
||||
desc->istate &= ~IRQS_MASKED;
|
||||
irqd_clear(&desc->irq_data, IRQD_IRQ_MASKED);
|
||||
irq_compat_clr_masked(desc);
|
||||
}
|
||||
|
||||
static void irq_state_set_masked(struct irq_desc *desc)
|
||||
{
|
||||
desc->istate |= IRQS_MASKED;
|
||||
irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
|
||||
irq_compat_set_masked(desc);
|
||||
}
|
||||
|
||||
@@ -372,11 +378,11 @@ void handle_nested_irq(unsigned int irq)
|
||||
kstat_incr_irqs_this_cpu(irq, desc);
|
||||
|
||||
action = desc->action;
|
||||
if (unlikely(!action || (desc->istate & IRQS_DISABLED)))
|
||||
if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))
|
||||
goto out_unlock;
|
||||
|
||||
irq_compat_set_progress(desc);
|
||||
desc->istate |= IRQS_INPROGRESS;
|
||||
irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
|
||||
raw_spin_unlock_irq(&desc->lock);
|
||||
|
||||
action_ret = action->thread_fn(action->irq, action->dev_id);
|
||||
@@ -384,7 +390,7 @@ void handle_nested_irq(unsigned int irq)
|
||||
note_interrupt(irq, desc, action_ret);
|
||||
|
||||
raw_spin_lock_irq(&desc->lock);
|
||||
desc->istate &= ~IRQS_INPROGRESS;
|
||||
irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
|
||||
irq_compat_clr_progress(desc);
|
||||
|
||||
out_unlock:
|
||||
@@ -416,14 +422,14 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
raw_spin_lock(&desc->lock);
|
||||
|
||||
if (unlikely(desc->istate & IRQS_INPROGRESS))
|
||||
if (unlikely(irqd_irq_inprogress(&desc->irq_data)))
|
||||
if (!irq_check_poll(desc))
|
||||
goto out_unlock;
|
||||
|
||||
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
|
||||
kstat_incr_irqs_this_cpu(irq, desc);
|
||||
|
||||
if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
|
||||
if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
|
||||
goto out_unlock;
|
||||
|
||||
handle_irq_event(desc);
|
||||
@@ -448,7 +454,7 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
|
||||
raw_spin_lock(&desc->lock);
|
||||
mask_ack_irq(desc);
|
||||
|
||||
if (unlikely(desc->istate & IRQS_INPROGRESS))
|
||||
if (unlikely(irqd_irq_inprogress(&desc->irq_data)))
|
||||
if (!irq_check_poll(desc))
|
||||
goto out_unlock;
|
||||
|
||||
@@ -459,12 +465,12 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
|
||||
* If its disabled or no action available
|
||||
* keep it masked and get out of here
|
||||
*/
|
||||
if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
|
||||
if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
|
||||
goto out_unlock;
|
||||
|
||||
handle_irq_event(desc);
|
||||
|
||||
if (!(desc->istate & (IRQS_DISABLED | IRQS_ONESHOT)))
|
||||
if (!irqd_irq_disabled(&desc->irq_data) && !(desc->istate & IRQS_ONESHOT))
|
||||
unmask_irq(desc);
|
||||
out_unlock:
|
||||
raw_spin_unlock(&desc->lock);
|
||||
@@ -496,7 +502,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
raw_spin_lock(&desc->lock);
|
||||
|
||||
if (unlikely(desc->istate & IRQS_INPROGRESS))
|
||||
if (unlikely(irqd_irq_inprogress(&desc->irq_data)))
|
||||
if (!irq_check_poll(desc))
|
||||
goto out;
|
||||
|
||||
@@ -507,7 +513,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
|
||||
* If its disabled or no action available
|
||||
* then mask it and get out of here:
|
||||
*/
|
||||
if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) {
|
||||
if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
|
||||
irq_compat_set_pending(desc);
|
||||
desc->istate |= IRQS_PENDING;
|
||||
mask_irq(desc);
|
||||
@@ -558,8 +564,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
|
||||
* we shouldn't process the IRQ. Mark it pending, handle
|
||||
* the necessary masking and go out
|
||||
*/
|
||||
if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) ||
|
||||
!desc->action))) {
|
||||
if (unlikely(irqd_irq_disabled(&desc->irq_data) ||
|
||||
irqd_irq_inprogress(&desc->irq_data) || !desc->action)) {
|
||||
if (!irq_check_poll(desc)) {
|
||||
irq_compat_set_pending(desc);
|
||||
desc->istate |= IRQS_PENDING;
|
||||
@@ -584,20 +590,65 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
|
||||
* Renable it, if it was not disabled in meantime.
|
||||
*/
|
||||
if (unlikely(desc->istate & IRQS_PENDING)) {
|
||||
if (!(desc->istate & IRQS_DISABLED) &&
|
||||
(desc->istate & IRQS_MASKED))
|
||||
if (!irqd_irq_disabled(&desc->irq_data) &&
|
||||
irqd_irq_masked(&desc->irq_data))
|
||||
unmask_irq(desc);
|
||||
}
|
||||
|
||||
handle_irq_event(desc);
|
||||
|
||||
} while ((desc->istate & IRQS_PENDING) &&
|
||||
!(desc->istate & IRQS_DISABLED));
|
||||
!irqd_irq_disabled(&desc->irq_data));
|
||||
|
||||
out_unlock:
|
||||
raw_spin_unlock(&desc->lock);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IRQ_EDGE_EOI_HANDLER
|
||||
/**
|
||||
* handle_edge_eoi_irq - edge eoi type IRQ handler
|
||||
* @irq: the interrupt number
|
||||
* @desc: the interrupt description structure for this irq
|
||||
*
|
||||
* Similar as the above handle_edge_irq, but using eoi and w/o the
|
||||
* mask/unmask logic.
|
||||
*/
|
||||
void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
struct irq_chip *chip = irq_desc_get_chip(desc);
|
||||
|
||||
raw_spin_lock(&desc->lock);
|
||||
|
||||
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
|
||||
/*
|
||||
* If we're currently running this IRQ, or its disabled,
|
||||
* we shouldn't process the IRQ. Mark it pending, handle
|
||||
* the necessary masking and go out
|
||||
*/
|
||||
if (unlikely(irqd_irq_disabled(&desc->irq_data) ||
|
||||
irqd_irq_inprogress(&desc->irq_data) || !desc->action)) {
|
||||
if (!irq_check_poll(desc)) {
|
||||
desc->istate |= IRQS_PENDING;
|
||||
goto out_eoi;
|
||||
}
|
||||
}
|
||||
kstat_incr_irqs_this_cpu(irq, desc);
|
||||
|
||||
do {
|
||||
if (unlikely(!desc->action))
|
||||
goto out_eoi;
|
||||
|
||||
handle_irq_event(desc);
|
||||
|
||||
} while ((desc->istate & IRQS_PENDING) &&
|
||||
!irqd_irq_disabled(&desc->irq_data));
|
||||
|
||||
out_unlock:
|
||||
chip->irq_eoi(&desc->irq_data);
|
||||
raw_spin_unlock(&desc->lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* handle_percpu_irq - Per CPU local irq handler
|
||||
* @irq: the interrupt number
|
||||
@@ -642,8 +693,7 @@ __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
|
||||
if (handle == handle_bad_irq) {
|
||||
if (desc->irq_data.chip != &no_irq_chip)
|
||||
mask_ack_irq(desc);
|
||||
irq_compat_set_disabled(desc);
|
||||
desc->istate |= IRQS_DISABLED;
|
||||
irq_state_set_disabled(desc);
|
||||
desc->depth = 1;
|
||||
}
|
||||
desc->handle_irq = handle;
|
||||
@@ -684,8 +734,70 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
|
||||
irqd_set(&desc->irq_data, IRQD_PER_CPU);
|
||||
if (irq_settings_can_move_pcntxt(desc))
|
||||
irqd_set(&desc->irq_data, IRQD_MOVE_PCNTXT);
|
||||
if (irq_settings_is_level(desc))
|
||||
irqd_set(&desc->irq_data, IRQD_LEVEL);
|
||||
|
||||
irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
|
||||
|
||||
irq_put_desc_unlock(desc, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* irq_cpu_online - Invoke all irq_cpu_online functions.
|
||||
*
|
||||
* Iterate through all irqs and invoke the chip.irq_cpu_online()
|
||||
* for each.
|
||||
*/
|
||||
void irq_cpu_online(void)
|
||||
{
|
||||
struct irq_desc *desc;
|
||||
struct irq_chip *chip;
|
||||
unsigned long flags;
|
||||
unsigned int irq;
|
||||
|
||||
for_each_active_irq(irq) {
|
||||
desc = irq_to_desc(irq);
|
||||
if (!desc)
|
||||
continue;
|
||||
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
|
||||
chip = irq_data_get_irq_chip(&desc->irq_data);
|
||||
if (chip && chip->irq_cpu_online &&
|
||||
(!(chip->flags & IRQCHIP_ONOFFLINE_ENABLED) ||
|
||||
!irqd_irq_disabled(&desc->irq_data)))
|
||||
chip->irq_cpu_online(&desc->irq_data);
|
||||
|
||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* irq_cpu_offline - Invoke all irq_cpu_offline functions.
|
||||
*
|
||||
* Iterate through all irqs and invoke the chip.irq_cpu_offline()
|
||||
* for each.
|
||||
*/
|
||||
void irq_cpu_offline(void)
|
||||
{
|
||||
struct irq_desc *desc;
|
||||
struct irq_chip *chip;
|
||||
unsigned long flags;
|
||||
unsigned int irq;
|
||||
|
||||
for_each_active_irq(irq) {
|
||||
desc = irq_to_desc(irq);
|
||||
if (!desc)
|
||||
continue;
|
||||
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
|
||||
chip = irq_data_get_irq_chip(&desc->irq_data);
|
||||
if (chip && chip->irq_cpu_offline &&
|
||||
(!(chip->flags & IRQCHIP_ONOFFLINE_ENABLED) ||
|
||||
!irqd_irq_disabled(&desc->irq_data)))
|
||||
chip->irq_cpu_offline(&desc->irq_data);
|
||||
|
||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,8 @@
|
||||
|
||||
#define P(f) if (desc->status & f) printk("%14s set\n", #f)
|
||||
#define PS(f) if (desc->istate & f) printk("%14s set\n", #f)
|
||||
/* FIXME */
|
||||
#define PD(f) do { } while (0)
|
||||
|
||||
static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
@@ -28,13 +30,15 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
|
||||
P(IRQ_NOAUTOEN);
|
||||
|
||||
PS(IRQS_AUTODETECT);
|
||||
PS(IRQS_INPROGRESS);
|
||||
PS(IRQS_REPLAY);
|
||||
PS(IRQS_WAITING);
|
||||
PS(IRQS_DISABLED);
|
||||
PS(IRQS_PENDING);
|
||||
PS(IRQS_MASKED);
|
||||
|
||||
PD(IRQS_INPROGRESS);
|
||||
PD(IRQS_DISABLED);
|
||||
PD(IRQS_MASKED);
|
||||
}
|
||||
|
||||
#undef P
|
||||
#undef PS
|
||||
#undef PD
|
||||
|
@@ -178,25 +178,13 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
|
||||
irq_compat_clr_pending(desc);
|
||||
desc->istate &= ~IRQS_PENDING;
|
||||
irq_compat_set_progress(desc);
|
||||
desc->istate |= IRQS_INPROGRESS;
|
||||
irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
|
||||
raw_spin_unlock(&desc->lock);
|
||||
|
||||
ret = handle_irq_event_percpu(desc, action);
|
||||
|
||||
raw_spin_lock(&desc->lock);
|
||||
desc->istate &= ~IRQS_INPROGRESS;
|
||||
irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
|
||||
irq_compat_clr_progress(desc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* handle_IRQ_event - irq action chain handler
|
||||
* @irq: the interrupt number
|
||||
* @action: the interrupt action chain for this irq
|
||||
*
|
||||
* Handles the action chain of an irq event
|
||||
*/
|
||||
irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
|
||||
{
|
||||
return handle_irq_event_percpu(irq_to_desc(irq), action);
|
||||
}
|
||||
|
@@ -44,26 +44,20 @@ enum {
|
||||
* IRQS_SPURIOUS_DISABLED - was disabled due to spurious interrupt
|
||||
* detection
|
||||
* IRQS_POLL_INPROGRESS - polling in progress
|
||||
* IRQS_INPROGRESS - Interrupt in progress
|
||||
* IRQS_ONESHOT - irq is not unmasked in primary handler
|
||||
* IRQS_REPLAY - irq is replayed
|
||||
* IRQS_WAITING - irq is waiting
|
||||
* IRQS_DISABLED - irq is disabled
|
||||
* IRQS_PENDING - irq is pending and replayed later
|
||||
* IRQS_MASKED - irq is masked
|
||||
* IRQS_SUSPENDED - irq is suspended
|
||||
*/
|
||||
enum {
|
||||
IRQS_AUTODETECT = 0x00000001,
|
||||
IRQS_SPURIOUS_DISABLED = 0x00000002,
|
||||
IRQS_POLL_INPROGRESS = 0x00000008,
|
||||
IRQS_INPROGRESS = 0x00000010,
|
||||
IRQS_ONESHOT = 0x00000020,
|
||||
IRQS_REPLAY = 0x00000040,
|
||||
IRQS_WAITING = 0x00000080,
|
||||
IRQS_DISABLED = 0x00000100,
|
||||
IRQS_PENDING = 0x00000200,
|
||||
IRQS_MASKED = 0x00000400,
|
||||
IRQS_SUSPENDED = 0x00000800,
|
||||
};
|
||||
|
||||
|
@@ -80,7 +80,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node)
|
||||
desc->irq_data.handler_data = NULL;
|
||||
desc->irq_data.msi_desc = NULL;
|
||||
irq_settings_clr_and_set(desc, ~0, _IRQ_DEFAULT_INIT_FLAGS);
|
||||
desc->istate = IRQS_DISABLED;
|
||||
irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
|
||||
desc->handle_irq = handle_bad_irq;
|
||||
desc->depth = 1;
|
||||
desc->irq_count = 0;
|
||||
@@ -238,7 +238,6 @@ int __init early_irq_init(void)
|
||||
|
||||
struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
|
||||
[0 ... NR_IRQS-1] = {
|
||||
.istate = IRQS_DISABLED,
|
||||
.handle_irq = handle_bad_irq,
|
||||
.depth = 1,
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(irq_desc->lock),
|
||||
|
@@ -41,7 +41,7 @@ early_param("threadirqs", setup_forced_irqthreads);
|
||||
void synchronize_irq(unsigned int irq)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
unsigned int state;
|
||||
bool inprogress;
|
||||
|
||||
if (!desc)
|
||||
return;
|
||||
@@ -53,16 +53,16 @@ void synchronize_irq(unsigned int irq)
|
||||
* Wait until we're out of the critical section. This might
|
||||
* give the wrong answer due to the lack of memory barriers.
|
||||
*/
|
||||
while (desc->istate & IRQS_INPROGRESS)
|
||||
while (irqd_irq_inprogress(&desc->irq_data))
|
||||
cpu_relax();
|
||||
|
||||
/* Ok, that indicated we're done: double-check carefully. */
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
state = desc->istate;
|
||||
inprogress = irqd_irq_inprogress(&desc->irq_data);
|
||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||
|
||||
/* Oops, that failed? */
|
||||
} while (state & IRQS_INPROGRESS);
|
||||
} while (inprogress);
|
||||
|
||||
/*
|
||||
* We made sure that no hardirq handler is running. Now verify
|
||||
@@ -112,13 +112,13 @@ void irq_set_thread_affinity(struct irq_desc *desc)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
static inline bool irq_can_move_pcntxt(struct irq_desc *desc)
|
||||
static inline bool irq_can_move_pcntxt(struct irq_data *data)
|
||||
{
|
||||
return irq_settings_can_move_pcntxt(desc);
|
||||
return irqd_can_move_in_process_context(data);
|
||||
}
|
||||
static inline bool irq_move_pending(struct irq_desc *desc)
|
||||
static inline bool irq_move_pending(struct irq_data *data)
|
||||
{
|
||||
return irqd_is_setaffinity_pending(&desc->irq_data);
|
||||
return irqd_is_setaffinity_pending(data);
|
||||
}
|
||||
static inline void
|
||||
irq_copy_pending(struct irq_desc *desc, const struct cpumask *mask)
|
||||
@@ -131,43 +131,34 @@ irq_get_pending(struct cpumask *mask, struct irq_desc *desc)
|
||||
cpumask_copy(mask, desc->pending_mask);
|
||||
}
|
||||
#else
|
||||
static inline bool irq_can_move_pcntxt(struct irq_desc *desc) { return true; }
|
||||
static inline bool irq_move_pending(struct irq_desc *desc) { return false; }
|
||||
static inline bool irq_can_move_pcntxt(struct irq_data *data) { return true; }
|
||||
static inline bool irq_move_pending(struct irq_desc *data) { return false; }
|
||||
static inline void
|
||||
irq_copy_pending(struct irq_desc *desc, const struct cpumask *mask) { }
|
||||
static inline void
|
||||
irq_get_pending(struct cpumask *mask, struct irq_desc *desc) { }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* irq_set_affinity - Set the irq affinity of a given irq
|
||||
* @irq: Interrupt to set affinity
|
||||
* @cpumask: cpumask
|
||||
*
|
||||
*/
|
||||
int irq_set_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
struct irq_chip *chip = desc->irq_data.chip;
|
||||
unsigned long flags;
|
||||
struct irq_chip *chip = irq_data_get_irq_chip(data);
|
||||
struct irq_desc *desc = irq_data_to_desc(data);
|
||||
int ret = 0;
|
||||
|
||||
if (!chip->irq_set_affinity)
|
||||
if (!chip || !chip->irq_set_affinity)
|
||||
return -EINVAL;
|
||||
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
|
||||
if (irq_can_move_pcntxt(desc)) {
|
||||
ret = chip->irq_set_affinity(&desc->irq_data, mask, false);
|
||||
if (irq_can_move_pcntxt(data)) {
|
||||
ret = chip->irq_set_affinity(data, mask, false);
|
||||
switch (ret) {
|
||||
case IRQ_SET_MASK_OK:
|
||||
cpumask_copy(desc->irq_data.affinity, mask);
|
||||
cpumask_copy(data->affinity, mask);
|
||||
case IRQ_SET_MASK_OK_NOCOPY:
|
||||
irq_set_thread_affinity(desc);
|
||||
ret = 0;
|
||||
}
|
||||
} else {
|
||||
irqd_set_move_pending(&desc->irq_data);
|
||||
irqd_set_move_pending(data);
|
||||
irq_copy_pending(desc, mask);
|
||||
}
|
||||
|
||||
@@ -176,7 +167,28 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
schedule_work(&desc->affinity_notify->work);
|
||||
}
|
||||
irq_compat_set_affinity(desc);
|
||||
irqd_set(&desc->irq_data, IRQD_AFFINITY_SET);
|
||||
irqd_set(data, IRQD_AFFINITY_SET);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* irq_set_affinity - Set the irq affinity of a given irq
|
||||
* @irq: Interrupt to set affinity
|
||||
* @mask: cpumask
|
||||
*
|
||||
*/
|
||||
int irq_set_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
if (!desc)
|
||||
return -EINVAL;
|
||||
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
ret = __irq_set_affinity_locked(irq_desc_get_irq_data(desc), mask);
|
||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||
return ret;
|
||||
}
|
||||
@@ -206,7 +218,7 @@ static void irq_affinity_notify(struct work_struct *work)
|
||||
goto out;
|
||||
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
if (irq_move_pending(desc))
|
||||
if (irq_move_pending(&desc->irq_data))
|
||||
irq_get_pending(cpumask, desc);
|
||||
else
|
||||
cpumask_copy(cpumask, desc->irq_data.affinity);
|
||||
@@ -551,9 +563,9 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
|
||||
flags &= IRQ_TYPE_SENSE_MASK;
|
||||
|
||||
if (chip->flags & IRQCHIP_SET_TYPE_MASKED) {
|
||||
if (!(desc->istate & IRQS_MASKED))
|
||||
if (!irqd_irq_masked(&desc->irq_data))
|
||||
mask_irq(desc);
|
||||
if (!(desc->istate & IRQS_DISABLED))
|
||||
if (!irqd_irq_disabled(&desc->irq_data))
|
||||
unmask = 1;
|
||||
}
|
||||
|
||||
@@ -651,7 +663,7 @@ again:
|
||||
* irq_wake_thread(). See the comment there which explains the
|
||||
* serialization.
|
||||
*/
|
||||
if (unlikely(desc->istate & IRQS_INPROGRESS)) {
|
||||
if (unlikely(irqd_irq_inprogress(&desc->irq_data))) {
|
||||
raw_spin_unlock_irq(&desc->lock);
|
||||
chip_bus_sync_unlock(desc);
|
||||
cpu_relax();
|
||||
@@ -668,12 +680,10 @@ again:
|
||||
|
||||
desc->threads_oneshot &= ~action->thread_mask;
|
||||
|
||||
if (!desc->threads_oneshot && !(desc->istate & IRQS_DISABLED) &&
|
||||
(desc->istate & IRQS_MASKED)) {
|
||||
irq_compat_clr_masked(desc);
|
||||
desc->istate &= ~IRQS_MASKED;
|
||||
desc->irq_data.chip->irq_unmask(&desc->irq_data);
|
||||
}
|
||||
if (!desc->threads_oneshot && !irqd_irq_disabled(&desc->irq_data) &&
|
||||
irqd_irq_masked(&desc->irq_data))
|
||||
unmask_irq(desc);
|
||||
|
||||
out_unlock:
|
||||
raw_spin_unlock_irq(&desc->lock);
|
||||
chip_bus_sync_unlock(desc);
|
||||
@@ -767,7 +777,7 @@ static int irq_thread(void *data)
|
||||
atomic_inc(&desc->threads_active);
|
||||
|
||||
raw_spin_lock_irq(&desc->lock);
|
||||
if (unlikely(desc->istate & IRQS_DISABLED)) {
|
||||
if (unlikely(irqd_irq_disabled(&desc->irq_data))) {
|
||||
/*
|
||||
* CHECKME: We might need a dedicated
|
||||
* IRQ_THREAD_PENDING flag here, which
|
||||
@@ -985,8 +995,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
|
||||
}
|
||||
|
||||
desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \
|
||||
IRQS_INPROGRESS | IRQS_ONESHOT | \
|
||||
IRQS_WAITING);
|
||||
IRQS_ONESHOT | IRQS_WAITING);
|
||||
irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
|
||||
|
||||
if (new->flags & IRQF_PERCPU) {
|
||||
irqd_set(&desc->irq_data, IRQD_PER_CPU);
|
||||
|
@@ -60,13 +60,12 @@ void move_masked_irq(int irq)
|
||||
|
||||
void irq_move_irq(struct irq_data *idata)
|
||||
{
|
||||
struct irq_desc *desc = irq_data_to_desc(idata);
|
||||
bool masked;
|
||||
|
||||
if (likely(!irqd_is_setaffinity_pending(idata)))
|
||||
return;
|
||||
|
||||
if (unlikely(desc->istate & IRQS_DISABLED))
|
||||
if (unlikely(irqd_irq_disabled(idata)))
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -74,7 +73,7 @@ void irq_move_irq(struct irq_data *idata)
|
||||
* threaded interrupt with ONESHOT set, we can end up with an
|
||||
* interrupt storm.
|
||||
*/
|
||||
masked = desc->istate & IRQS_MASKED;
|
||||
masked = irqd_irq_masked(idata);
|
||||
if (!masked)
|
||||
idata->chip->irq_mask(idata);
|
||||
irq_move_masked_irq(idata);
|
||||
|
@@ -45,12 +45,12 @@ bool irq_wait_for_poll(struct irq_desc *desc)
|
||||
#ifdef CONFIG_SMP
|
||||
do {
|
||||
raw_spin_unlock(&desc->lock);
|
||||
while (desc->istate & IRQS_INPROGRESS)
|
||||
while (irqd_irq_inprogress(&desc->irq_data))
|
||||
cpu_relax();
|
||||
raw_spin_lock(&desc->lock);
|
||||
} while (desc->istate & IRQS_INPROGRESS);
|
||||
} while (irqd_irq_inprogress(&desc->irq_data));
|
||||
/* Might have been disabled in meantime */
|
||||
return !(desc->istate & IRQS_DISABLED) && desc->action;
|
||||
return !irqd_irq_disabled(&desc->irq_data) && desc->action;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@@ -75,7 +75,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
|
||||
* Do not poll disabled interrupts unless the spurious
|
||||
* disabled poller asks explicitely.
|
||||
*/
|
||||
if ((desc->istate & IRQS_DISABLED) && !force)
|
||||
if (irqd_irq_disabled(&desc->irq_data) && !force)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
@@ -88,7 +88,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
|
||||
goto out;
|
||||
|
||||
/* Already running on another processor */
|
||||
if (desc->istate & IRQS_INPROGRESS) {
|
||||
if (irqd_irq_inprogress(&desc->irq_data)) {
|
||||
/*
|
||||
* Already running: If it is shared get the other
|
||||
* CPU to go looking for our mystery interrupt too
|
||||
|
Reference in New Issue
Block a user