This mapping is GICv2-only, and therefore the variable is better renamed. Also make sure that its size can be retrieved externally.
Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/arm-common/gic-common.c | 16 ++++++++-------- hypervisor/arch/arm-common/gic-v2.c | 2 +- hypervisor/arch/arm-common/include/asm/gic.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hypervisor/arch/arm-common/gic-common.c b/hypervisor/arch/arm-common/gic-common.c index e0771d8..67dac8b 100644 --- a/hypervisor/arch/arm-common/gic-common.c +++ b/hypervisor/arch/arm-common/gic-common.c @@ -26,16 +26,16 @@ static DEFINE_SPINLOCK(dist_lock); -/* The GIC interface numbering does not necessarily match the logical map */ -u8 target_cpu_map[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/* The GICv2 interface numbering does not necessarily match the logical map */ +u8 gicv2_target_cpu_map[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; /* Check that the targeted interface belongs to the cell */ bool gic_targets_in_cell(struct cell *cell, u8 targets) { unsigned int cpu; - for (cpu = 0; cpu < ARRAY_SIZE(target_cpu_map); cpu++) - if (targets & target_cpu_map[cpu] && + for (cpu = 0; cpu < ARRAY_SIZE(gicv2_target_cpu_map); cpu++) + if (targets & gicv2_target_cpu_map[cpu] && per_cpu(cpu)->cell != cell) return false; @@ -203,12 +203,12 @@ static enum mmio_result handle_sgir_access(struct mmio_access *mmio) */ int gic_probe_cpu_id(unsigned int cpu) { - if (cpu >= ARRAY_SIZE(target_cpu_map)) + if (cpu >= ARRAY_SIZE(gicv2_target_cpu_map)) return -EINVAL; - target_cpu_map[cpu] = mmio_read32(gicd_base + GICD_ITARGETSR); + gicv2_target_cpu_map[cpu] = mmio_read32(gicd_base + GICD_ITARGETSR); - if (target_cpu_map[cpu] == 0) + if (gicv2_target_cpu_map[cpu] == 0) return -ENODEV; return 0; @@ -244,7 +244,7 @@ void gic_handle_sgir_write(struct sgi *sgi, bool virt_input) * translate them to the hypervisor's virtual * IDs. */ - if (!(targets & target_cpu_map[cpu])) + if (!(targets & gicv2_target_cpu_map[cpu])) continue; } diff --git a/hypervisor/arch/arm-common/gic-v2.c b/hypervisor/arch/arm-common/gic-v2.c index c67b412..c3d8581 100644 --- a/hypervisor/arch/arm-common/gic-v2.c +++ b/hypervisor/arch/arm-common/gic-v2.c @@ -200,7 +200,7 @@ static void gic_adjust_irq_target(struct cell *cell, u16 irq_id) return; targets &= ~(0xff << shift); - targets |= target_cpu_map[first_cpu(cell->cpu_set)] << shift; + targets |= gicv2_target_cpu_map[first_cpu(cell->cpu_set)] << shift; mmio_write32(itargetsr, targets); } diff --git a/hypervisor/arch/arm-common/include/asm/gic.h b/hypervisor/arch/arm-common/include/asm/gic.h index 224a466..44c50f9 100644 --- a/hypervisor/arch/arm-common/include/asm/gic.h +++ b/hypervisor/arch/arm-common/include/asm/gic.h @@ -47,7 +47,7 @@ #define is_spi(irqn) ((irqn) > 31 && (irqn) < 1020) #ifndef __ASSEMBLY__ -extern u8 target_cpu_map[]; +extern u8 gicv2_target_cpu_map[8]; extern void *gicd_base; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
