@@ -616,7 +616,8 @@ static void its_unmask_irq(struct irq_data *d)
static void its_eoi_irq(struct irq_data *d)
{
gic_write_eoir(d->hwirq);
- gic_write_dir(d->hwirq);
+ if (!irqd_irq_forwarded(d))
+ gic_write_dir(d->hwirq);
}
static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
@@ -235,10 +235,35 @@ static void gic_unmask_irq(struct irq_data *d)
gic_poke_irq(d, GICD_ISENABLER);
}
+static void gic_irq_set_fwd_state(struct irq_data *d, u32 val, u32 mask)
+{
+ if (mask & IRQ_FWD_STATE_PENDING)
+ gic_poke_irq(d, (val & IRQ_FWD_STATE_PENDING) ? GICD_ISPENDR : GICD_ICPENDR);
+ if (mask & IRQ_FWD_STATE_ACTIVE)
+ gic_poke_irq(d, (val & IRQ_FWD_STATE_ACTIVE) ? GICD_ISACTIVER : GICD_ICACTIVER);
+ if (mask & IRQ_FWD_STATE_MASKED)
+ gic_poke_irq(d, (val & IRQ_FWD_STATE_MASKED) ? GICD_ICENABLER : GICD_ISENABLER);
+}
+
+static u32 gic_irq_get_fwd_state(struct irq_data *d, u32 mask)
+{
+ u32 val = 0;
+
+ if ((mask & IRQ_FWD_STATE_PENDING) && gic_peek_irq(d, GICD_ISPENDR))
+ val |= IRQ_FWD_STATE_PENDING;
+ if ((mask & IRQ_FWD_STATE_ACTIVE) && gic_peek_irq(d, GICD_ISACTIVER))
+ val |= IRQ_FWD_STATE_ACTIVE;
+ if ((mask & IRQ_FWD_STATE_MASKED) && !gic_peek_irq(d, GICD_ISENABLER))
+ val |= IRQ_FWD_STATE_MASKED;
+
+ return val;
+}
+
static void gic_eoi_irq(struct irq_data *d)
{
gic_write_eoir(gic_irq(d));
- gic_write_dir(gic_irq(d));
+ if (!irqd_irq_forwarded(d))
+ gic_write_dir(gic_irq(d));
}
static int gic_set_type(struct irq_data *d, unsigned int type)
@@ -598,6 +623,8 @@ static struct irq_chip gic_chip = {
.irq_eoi = gic_eoi_irq,
.irq_set_type = gic_set_type,
.irq_set_affinity = gic_set_affinity,
+ .irq_get_fwd_state = gic_irq_get_fwd_state,
+ .irq_set_fwd_state = gic_irq_set_fwd_state,
};
static struct irq_chip *its_chip;
@@ -90,6 +90,8 @@
#define GICR_SYNCR 0x00C0
#define GICR_MOVLPIR 0x0100
#define GICR_MOVALLR 0x0110
+#define GICR_ISACTIVER GICD_ISACTIVER
+#define GICR_ICACTIVER GICD_ICACTIVER
#define GICR_IDREGS GICD_IDREGS
#define GICR_PIDR2 GICD_PIDR2
Now that we've switched to EOImode == 1, prevent a forwarded interrupt from being deactivated after its priority has been dropped. Also add support for the interrupt state to be saved/restored. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> --- drivers/irqchip/irq-gic-v3-its.c | 3 ++- drivers/irqchip/irq-gic-v3.c | 29 ++++++++++++++++++++++++++++- include/linux/irqchip/arm-gic-v3.h | 2 ++ 3 files changed, 32 insertions(+), 2 deletions(-)