Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 009b4c3b authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

genirq: Add IRQ_INPROGRESS to core



We need to maintain the flag for now in both fields status and istate.
Add a CONFIG_GENERIC_HARDIRQS_NO_COMPAT switch to allow testing w/o
the status one. Wrap the access to status IRQ_INPROGRESS in a inline
which can be turned of with CONFIG_GENERIC_HARDIRQS_NO_COMPAT along
with the define.

There is no reason that anything outside of core looks at this. That
needs some modifications, but we'll get there.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 6954b75b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -50,7 +50,11 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
#define IRQ_TYPE_PROBE		0x00000010	/* Probing in progress */

/* Internal flags */
#define IRQ_INPROGRESS		0x00000100	/* IRQ handler active - do not enter! */

#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
#define IRQ_INPROGRESS		0x00000100	/* DEPRECATED */
#endif

#define IRQ_DISABLED		0x00000200	/* IRQ disabled - do not enter! */
#define IRQ_PENDING		0x00000400	/* IRQ pending - replay on enable */
#define IRQ_REPLAY		0x00000800	/* IRQ has been replayed but not acked yet */
+3 −0
Original line number Diff line number Diff line
@@ -13,6 +13,9 @@ config GENERIC_HARDIRQS
config GENERIC_HARDIRQS_NO_DEPRECATED
       def_bool n

config GENERIC_HARDIRQS_NO_COMPAT
       def_bool n

# Options selectable by the architecture code
config HAVE_SPARSE_IRQ
       def_bool n
+9 −7
Original line number Diff line number Diff line
@@ -383,7 +383,8 @@ void handle_nested_irq(unsigned int irq)
	if (unlikely(!action || (desc->status & IRQ_DISABLED)))
		goto out_unlock;

	desc->status |= IRQ_INPROGRESS;
	irq_compat_set_progress(desc);
	desc->istate |= IRQS_INPROGRESS;
	raw_spin_unlock_irq(&desc->lock);

	action_ret = action->thread_fn(action->irq, action->dev_id);
@@ -391,7 +392,8 @@ void handle_nested_irq(unsigned int irq)
		note_interrupt(irq, desc, action_ret);

	raw_spin_lock_irq(&desc->lock);
	desc->status &= ~IRQ_INPROGRESS;
	desc->istate &= ~IRQS_INPROGRESS;
	irq_compat_clr_progress(desc);

out_unlock:
	raw_spin_unlock_irq(&desc->lock);
@@ -422,7 +424,7 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
{
	raw_spin_lock(&desc->lock);

	if (unlikely(desc->status & IRQ_INPROGRESS))
	if (unlikely(desc->istate & IRQS_INPROGRESS))
		if (!irq_check_poll(desc))
			goto out_unlock;

@@ -454,7 +456,7 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
	raw_spin_lock(&desc->lock);
	mask_ack_irq(desc);

	if (unlikely(desc->status & IRQ_INPROGRESS))
	if (unlikely(desc->istate & IRQS_INPROGRESS))
		if (!irq_check_poll(desc))
			goto out_unlock;

@@ -492,7 +494,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
{
	raw_spin_lock(&desc->lock);

	if (unlikely(desc->status & IRQ_INPROGRESS))
	if (unlikely(desc->istate & IRQS_INPROGRESS))
		if (!irq_check_poll(desc))
			goto out;

@@ -542,8 +544,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->status & (IRQ_INPROGRESS | IRQ_DISABLED)) ||
		    !desc->action)) {
	if (unlikely((desc->istate & (IRQS_INPROGRESS) ||
		      (desc->status & IRQ_DISABLED) || !desc->action))) {
		if (!irq_check_poll(desc)) {
			desc->status |= IRQ_PENDING;
			mask_ack_irq(desc);

kernel/irq/compat.h

0 → 100644
+17 −0
Original line number Diff line number Diff line
/*
 * Compat layer for transition period
 */
#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
static inline void irq_compat_set_progress(struct irq_desc *desc)
{
	desc->status |= IRQ_INPROGRESS;
}

static inline void irq_compat_clr_progress(struct irq_desc *desc)
{
	desc->status &= ~IRQ_INPROGRESS;
}
#else
static inline void irq_compat_set_progress(struct irq_desc *desc) { }
static inline void irq_compat_clr_progress(struct irq_desc *desc) { }
#endif
+4 −2
Original line number Diff line number Diff line
@@ -123,13 +123,15 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
	irqreturn_t ret;

	desc->status &= ~IRQ_PENDING;
	desc->status |= IRQ_INPROGRESS;
	irq_compat_set_progress(desc);
	desc->istate |= IRQS_INPROGRESS;
	raw_spin_unlock(&desc->lock);

	ret = handle_irq_event_percpu(desc, action);

	raw_spin_lock(&desc->lock);
	desc->status &= ~IRQ_INPROGRESS;
	desc->istate &= ~IRQS_INPROGRESS;
	irq_compat_clr_progress(desc);
	return ret;
}

Loading