Skip to content

Commit

Permalink
irqchip/gic: Use IRQD_FORWARDED_TO_VCPU flag
Browse files Browse the repository at this point in the history
Get rid of the handler_data abuse.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
  • Loading branch information
Thomas Gleixner committed Sep 16, 2015
1 parent fc56971 commit 7146653
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions drivers/irqchip/irq-gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,29 +145,10 @@ static inline bool cascading_gic_irq(struct irq_data *d)
void *data = irq_data_get_irq_handler_data(d);

/*
* If handler_data pointing to one of the secondary GICs, then
* this is a cascading interrupt, and it cannot possibly be
* forwarded.
* If handler_data is set, this is a cascading interrupt, and
* it cannot possibly be forwarded.
*/
if (data >= (void *)(gic_data + 1) &&
data < (void *)(gic_data + MAX_GIC_NR))
return true;

return false;
}

static inline bool forwarded_irq(struct irq_data *d)
{
/*
* A forwarded interrupt:
* - is on the primary GIC
* - has its handler_data set to a value
* - that isn't a secondary GIC
*/
if (d->handler_data && !cascading_gic_irq(d))
return true;

return false;
return data != NULL;
}

/*
Expand Down Expand Up @@ -201,7 +182,7 @@ static void gic_eoimode1_mask_irq(struct irq_data *d)
* disabled/masked will not get "stuck", because there is
* noone to deactivate it (guest is being terminated).
*/
if (forwarded_irq(d))
if (irqd_is_forwarded_to_vcpu(d))
gic_poke_irq(d, GIC_DIST_ACTIVE_CLEAR);
}

Expand All @@ -218,7 +199,7 @@ static void gic_eoi_irq(struct irq_data *d)
static void gic_eoimode1_eoi_irq(struct irq_data *d)
{
/* Do not deactivate an IRQ forwarded to a vcpu. */
if (forwarded_irq(d))
if (irqd_is_forwarded_to_vcpu(d))
return;

writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_DEACTIVATE);
Expand Down Expand Up @@ -296,7 +277,10 @@ static int gic_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu)
if (cascading_gic_irq(d))
return -EINVAL;

d->handler_data = vcpu;
if (vcpu)
irqd_set_forwarded_to_vcpu(d);
else
irqd_clr_forwarded_to_vcpu(d);
return 0;
}

Expand Down

0 comments on commit 7146653

Please sign in to comment.