aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip/irq-gic.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-09-15 06:37:36 -0400
committerThomas Gleixner <tglx@linutronix.de>2015-09-16 09:46:49 -0400
commit714665351cc718e01f0ce34ef5325932d56d8b4e (patch)
treef8acdd2463f9ede1b62a0006139e2f48d14d900c /drivers/irqchip/irq-gic.c
parentfc5697126aa074c289df5e8baae28e115963023f (diff)
irqchip/gic: Use IRQD_FORWARDED_TO_VCPU flag
Get rid of the handler_data abuse. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'drivers/irqchip/irq-gic.c')
-rw-r--r--drivers/irqchip/irq-gic.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index a9470574c031..9bccdd295769 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -145,29 +145,10 @@ static inline bool cascading_gic_irq(struct irq_data *d)
145 void *data = irq_data_get_irq_handler_data(d); 145 void *data = irq_data_get_irq_handler_data(d);
146 146
147 /* 147 /*
148 * If handler_data pointing to one of the secondary GICs, then 148 * If handler_data is set, this is a cascading interrupt, and
149 * this is a cascading interrupt, and it cannot possibly be 149 * it cannot possibly be forwarded.
150 * forwarded.
151 */ 150 */
152 if (data >= (void *)(gic_data + 1) && 151 return data != NULL;
153 data < (void *)(gic_data + MAX_GIC_NR))
154 return true;
155
156 return false;
157}
158
159static inline bool forwarded_irq(struct irq_data *d)
160{
161 /*
162 * A forwarded interrupt:
163 * - is on the primary GIC
164 * - has its handler_data set to a value
165 * - that isn't a secondary GIC
166 */
167 if (d->handler_data && !cascading_gic_irq(d))
168 return true;
169
170 return false;
171} 152}
172 153
173/* 154/*
@@ -201,7 +182,7 @@ static void gic_eoimode1_mask_irq(struct irq_data *d)
201 * disabled/masked will not get "stuck", because there is 182 * disabled/masked will not get "stuck", because there is
202 * noone to deactivate it (guest is being terminated). 183 * noone to deactivate it (guest is being terminated).
203 */ 184 */
204 if (forwarded_irq(d)) 185 if (irqd_is_forwarded_to_vcpu(d))
205 gic_poke_irq(d, GIC_DIST_ACTIVE_CLEAR); 186 gic_poke_irq(d, GIC_DIST_ACTIVE_CLEAR);
206} 187}
207 188
@@ -218,7 +199,7 @@ static void gic_eoi_irq(struct irq_data *d)
218static void gic_eoimode1_eoi_irq(struct irq_data *d) 199static void gic_eoimode1_eoi_irq(struct irq_data *d)
219{ 200{
220 /* Do not deactivate an IRQ forwarded to a vcpu. */ 201 /* Do not deactivate an IRQ forwarded to a vcpu. */
221 if (forwarded_irq(d)) 202 if (irqd_is_forwarded_to_vcpu(d))
222 return; 203 return;
223 204
224 writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_DEACTIVATE); 205 writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_DEACTIVATE);
@@ -296,7 +277,10 @@ static int gic_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu)
296 if (cascading_gic_irq(d)) 277 if (cascading_gic_irq(d))
297 return -EINVAL; 278 return -EINVAL;
298 279
299 d->handler_data = vcpu; 280 if (vcpu)
281 irqd_set_forwarded_to_vcpu(d);
282 else
283 irqd_clr_forwarded_to_vcpu(d);
300 return 0; 284 return 0;
301} 285}
302 286