/* First, extract the first interrupt affected by this access */
unsigned int first_irq = reg_index * irqs_per_reg;
- for (irq = first_irq; irq < first_irq + irqs_per_reg; irq++) {
- unsigned int bit_nr = (irq - first_irq) * bits_per_irq;
-
- if ((is_spi(irq) && spi_in_cell(cell, irq - 32)) ||
- irq == SGI_INJECT || irq == SGI_CPU_OFF ||
- irq == MAINTENANCE_IRQ)
- access_mask |= irq_bits << bit_nr;
- }
+ for (irq = 0; irq < irqs_per_reg; irq++)
+ if (irqchip_irq_in_cell(cell, first_irq + irq))
+ access_mask |= irq_bits << (irq * bits_per_irq);
if (!mmio->is_write) {
/* Restrict the read value */
*/
struct cell *cell = this_cell();
unsigned int i, cpu;
- unsigned int spi = irq - 32;
unsigned int offset;
u32 access_mask = 0;
u8 targets;
/*
* The registers are byte-accessible, but we always do word accesses.
*/
- offset = spi % 4;
+ offset = irq % 4;
mmio->address &= ~0x3;
mmio->value <<= 8 * offset;
mmio->size = 4;
- spi -= offset;
+ irq &= ~0x3;
- for (i = 0; i < 4; i++, spi++) {
- if (spi_in_cell(cell, spi))
+ for (i = 0; i < 4; i++, irq++) {
+ if (irqchip_irq_in_cell(cell, irq))
access_mask |= 0xff << (8 * i);
else
continue;
itargetsr += 4 * 8;
for (i = 0; i < 64; i++, shift = (shift + 8) % 32) {
- if (spi_in_cell(config_cell, i)) {
+ if (irqchip_irq_in_cell(config_cell, 32 + i)) {
mask |= (0xff << shift);
bits |= (cpu_itf << shift);
}
for_each_cpu(first_cpu, dest_cell->cpu_set)
break;
- for (i = 0; i < 64; i++, irouter += 8) {
- if (spi_in_cell(config_cell, i))
+ for (i = 0; i < 64; i++, irouter += 8)
+ if (irqchip_irq_in_cell(config_cell, 32 + i))
mmio_write64(irouter, first_cpu);
- }
}
static enum mmio_result gic_handle_redist_access(void *arg,
* forbidden, because the guest driver may simply iterate over all
* registers at initialisation
*/
- if (!spi_in_cell(cell, irq - 32))
+ if (!irqchip_irq_in_cell(cell, irq))
return MMIO_HANDLED;
/* Translate the virtual cpu id into the physical one */
void irqchip_inject_pending(struct per_cpu *cpu_data);
void irqchip_set_pending(struct per_cpu *cpu_data, u16 irq_id);
-bool spi_in_cell(struct cell *cell, unsigned int spi);
+bool irqchip_irq_in_cell(struct cell *cell, unsigned int irq_id);
#endif /* __ASSEMBLY__ */
#endif /* _JAILHOUSE_ASM_IRQCHIP_H */
*/
static bool irqchip_is_init;
-bool spi_in_cell(struct cell *cell, unsigned int spi)
+bool irqchip_irq_in_cell(struct cell *cell, unsigned int irq_id)
{
- if (spi + 32 >= sizeof(cell->arch.irq_bitmap) * 8)
+ if (irq_id >= sizeof(cell->arch.irq_bitmap) * 8)
return false;
- return cell->arch.irq_bitmap[(spi + 32) / 32] & (1 << (spi % 32));
+ return (cell->arch.irq_bitmap[irq_id / 32] & (1 << (irq_id % 32))) != 0;
}
void irqchip_set_pending(struct per_cpu *cpu_data, u16 irq_id)