writel_gicd(1U << (irqd->irq % 32), offset + (irqd->irq / 32) * 4);
}
+static bool gicv2_peek_irq(struct irq_desc *irqd, uint32_t offset)
+{
+ uint32_t reg;
+
+ reg = readl_gicd(offset + (irqd->irq / 32) * 4) & (1U << (irqd->irq % 32));
+
+ return reg;
+}
+
/*
* This is forcing the active state of an interrupt, somewhat circumventing
* the normal interrupt flow and the GIC state machine. So use with care
return readl_gich(GICH_APR);
}
+static bool gicv2_read_pending_state(struct irq_desc *irqd)
+{
+ return gicv2_peek_irq(irqd, GICD_ISPENDR);
+}
+
static void gicv2_irq_enable(struct irq_desc *desc)
{
unsigned long flags;
.write_lr = gicv2_write_lr,
.read_vmcr_priority = gicv2_read_vmcr_priority,
.read_apr = gicv2_read_apr,
+ .read_pending_state = gicv2_read_pending_state,
.make_hwdom_dt_node = gicv2_make_hwdom_dt_node,
.make_hwdom_madt = gicv2_make_hwdom_madt,
.get_hwdom_extra_madt_size = gicv2_get_hwdom_extra_madt_size,
gicv3_wait_for_rwp(irqd->irq);
}
+static bool gicv3_peek_irq(struct irq_desc *irqd, u32 offset)
+{
+ void __iomem *base;
+ unsigned int irq = irqd->irq;
+
+ if ( irq >= NR_GIC_LOCAL_IRQS)
+ base = GICD + (irq / 32) * 4;
+ else
+ base = GICD_RDIST_SGI_BASE;
+
+ return !!(readl(base + offset) & (1U << (irq % 32)));
+}
+
static void gicv3_unmask_irq(struct irq_desc *irqd)
{
gicv3_poke_irq(irqd, GICD_ISENABLER, false);
}
}
+static bool gicv3_read_pending_state(struct irq_desc *irqd)
+{
+ return gicv3_peek_irq(irqd, GICD_ISPENDR);
+}
+
static void gicv3_irq_enable(struct irq_desc *desc)
{
unsigned long flags;
.write_lr = gicv3_write_lr,
.read_vmcr_priority = gicv3_read_vmcr_priority,
.read_apr = gicv3_read_apr,
+ .read_pending_state = gicv3_read_pending_state,
.secondary_init = gicv3_secondary_cpu_init,
.make_hwdom_dt_node = gicv3_make_hwdom_dt_node,
.make_hwdom_madt = gicv3_make_hwdom_madt,
unsigned int (*read_vmcr_priority)(void);
/* Read APRn register */
unsigned int (*read_apr)(int apr_reg);
+ /* Query the pending state of an interrupt at the distributor level. */
+ bool (*read_pending_state)(struct irq_desc *irqd);
/* Secondary CPU init */
int (*secondary_init)(void);
/* Create GIC node for the hardware domain */
gic_hw_ops->set_pending_state(irqd, state);
}
+/*
+ * Read the pending state of an interrupt from the distributor.
+ * For private IRQs this only works for those of the current CPU.
+ */
+static inline bool gic_read_pending_state(struct irq_desc *irqd)
+{
+ return gic_hw_ops->read_pending_state(irqd);
+}
+
void register_gic_ops(const struct gic_hw_operations *ops);
int gic_make_hwdom_dt_node(const struct domain *d,
const struct dt_device_node *gic,