Commit a696712c authored by Juergen Gross's avatar Juergen Gross Committed by Thomas Gleixner

genirq/PM: Properly pretend disabled state when force resuming interrupts

Interrupts with the IRQF_FORCE_RESUME flag set have also the
IRQF_NO_SUSPEND flag set. They are not disabled in the suspend path, but
must be forcefully resumed. That's used by XEN to keep IPIs enabled beyond
the suspension of device irqs. Force resume works by pretending that the
interrupt was disabled and then calling __irq_enable().

Incrementing the disabled depth counter was enough to do that, but with the
recent changes which use state flags to avoid unnecessary hardware access,
this is not longer sufficient. If the state flags are not set, then the
hardware callbacks are not invoked and the interrupt line stays disabled in
"hardware".

Set the disabled and masked state when pretending that an interrupt got
disabled by suspend.

Fixes: bf22ff45 ("genirq: Avoid unnecessary low level irq function calls")
Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: xen-devel@lists.xenproject.org
Cc: boris.ostrovsky@oracle.com
Link: http://lkml.kernel.org/r/20170717174703.4603-2-jgross@suse.com
parent 935acd3f
...@@ -170,21 +170,11 @@ static void irq_state_clr_disabled(struct irq_desc *desc) ...@@ -170,21 +170,11 @@ static void irq_state_clr_disabled(struct irq_desc *desc)
irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED); irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED);
} }
static void irq_state_set_disabled(struct irq_desc *desc)
{
irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
}
static void irq_state_clr_masked(struct irq_desc *desc) static void irq_state_clr_masked(struct irq_desc *desc)
{ {
irqd_clear(&desc->irq_data, IRQD_IRQ_MASKED); irqd_clear(&desc->irq_data, IRQD_IRQ_MASKED);
} }
static void irq_state_set_masked(struct irq_desc *desc)
{
irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
}
static void irq_state_clr_started(struct irq_desc *desc) static void irq_state_clr_started(struct irq_desc *desc)
{ {
irqd_clear(&desc->irq_data, IRQD_IRQ_STARTED); irqd_clear(&desc->irq_data, IRQD_IRQ_STARTED);
......
...@@ -227,6 +227,16 @@ static inline bool irqd_has_set(struct irq_data *d, unsigned int mask) ...@@ -227,6 +227,16 @@ static inline bool irqd_has_set(struct irq_data *d, unsigned int mask)
return __irqd_to_state(d) & mask; return __irqd_to_state(d) & mask;
} }
static inline void irq_state_set_disabled(struct irq_desc *desc)
{
irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
}
static inline void irq_state_set_masked(struct irq_desc *desc)
{
irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
}
#undef __irqd_to_state #undef __irqd_to_state
static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc) static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc)
......
...@@ -149,6 +149,8 @@ static void resume_irq(struct irq_desc *desc) ...@@ -149,6 +149,8 @@ static void resume_irq(struct irq_desc *desc)
/* Pretend that it got disabled ! */ /* Pretend that it got disabled ! */
desc->depth++; desc->depth++;
irq_state_set_disabled(desc);
irq_state_set_masked(desc);
resume: resume:
desc->istate &= ~IRQS_SUSPENDED; desc->istate &= ~IRQS_SUSPENDED;
__enable_irq(desc); __enable_irq(desc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment