diff options
Diffstat (limited to 'big-little/common/vgiclib.c')
-rw-r--r-- | big-little/common/vgiclib.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/big-little/common/vgiclib.c b/big-little/common/vgiclib.c index d048e91..9acee57 100644 --- a/big-little/common/vgiclib.c +++ b/big-little/common/vgiclib.c @@ -39,7 +39,7 @@ static struct overflowint theoverflowints[NUM_CPUS][MAXOVERFLOWINTS]; static struct gic_cpuif cpuifs[NUM_CPUS]; static unsigned hv_lr_count[NUM_CPUS] = { 0 }; -static mig_irq_info migrated_irqs[NUM_CPUS][MAX_MIG_IRQS] = {0}; +static mig_irq_info migrated_irqs[NUM_CPUS][MAX_MIG_IRQS] = { 0 }; static void free_overflowint(struct overflowint *p, unsigned cpuid) { @@ -87,7 +87,6 @@ static unsigned get_elrsr_active_bits(unsigned index, unsigned cpuid, return elrsr; } - /* * For a given interrupt and cpu id, this function will * check whether its virq is not inactive and return the @@ -98,16 +97,20 @@ static unsigned dequeue_virq(unsigned irq, unsigned cpu_id) unsigned list_reg = 0, max_index = elrsr_max_index(cpu_id), ctr = 0; unsigned cur_elrsr = 0, i = 0; struct gic_cpuif *cpuif = &cpuifs[cpu_id]; - struct overflowint *ovflow = cpuif->overflow, *ovflowp = cpuif->overflow; + struct overflowint *ovflow = cpuif->overflow, *ovflowp = + cpuif->overflow; /* First check the hw list registers */ for (ctr = 0; ctr <= max_index; ctr++) { cur_elrsr = get_elrsr_active_bits(ctr, cpu_id, max_index); - for (i = bitindex(cur_elrsr); ((int)i) >= 0; i = bitindex(cur_elrsr)) { + for (i = bitindex(cur_elrsr); ((int)i) >= 0; + i = bitindex(cur_elrsr)) { unsigned int_id = 0; - list_reg = read32(VGIC_HV_PHY_BASE + GICH_LR_BASE + ((1 << 7) * ctr) + (i << 2)); + list_reg = + read32(VGIC_HV_PHY_BASE + GICH_LR_BASE + + ((1 << 7) * ctr) + (i << 2)); int_id = (list_reg >> 10) & 0x3ff; /* Clear the current bit */ @@ -120,7 +123,9 @@ static unsigned dequeue_virq(unsigned irq, unsigned cpu_id) /* * Invalidate the list register entry if the ids match and return */ - write32(VGIC_HV_PHY_BASE + GICH_LR_BASE + ((1 << 7) * ctr) + (i << 2), list_reg & ~(0x3 << 28)); + write32(VGIC_HV_PHY_BASE + GICH_LR_BASE + + ((1 << 7) * ctr) + (i << 2), + list_reg & ~(0x3 << 28)); return list_reg; } @@ -129,7 +134,7 @@ static unsigned dequeue_virq(unsigned irq, unsigned cpu_id) /* Check the sw linked list for the presence of this interrupt */ while (ovflow) { - unsigned int_id = (ovflow->value >> 10 )& 0x3ff; + unsigned int_id = (ovflow->value >> 10) & 0x3ff; unsigned type = ovflow->value & HW_IRQ; if ((type == HW_IRQ) && (int_id == irq)) { @@ -161,7 +166,8 @@ static unsigned dequeue_virq(unsigned irq, unsigned cpu_id) * interrupt and return a cpu mask for asking other cpus to * complete the migration. */ -static unsigned set_mig_irq_info(unsigned orig, unsigned curr, unsigned icdiptr_offset) +static unsigned set_mig_irq_info(unsigned orig, unsigned curr, + unsigned icdiptr_offset) { unsigned ctr, diff = orig ^ curr, cpu_mask = 0; unsigned desc = 0, cpu_id = read_cpuid(); @@ -169,12 +175,16 @@ static unsigned set_mig_irq_info(unsigned orig, unsigned curr, unsigned icdiptr_ for (ctr = 0; ctr < MAX_MIG_IRQS; ctr++) { if ((diff >> (ctr << 3)) & 0xff) { migrated_irqs[cpu_id][ctr].id = icdiptr_offset + ctr; - migrated_irqs[cpu_id][ctr].src_cpuif = bitindex((orig >> (ctr << 3)) & 0xff); - migrated_irqs[cpu_id][ctr].dest_cpuif = bitindex((curr >> (ctr << 3)) & 0xff); - desc = dequeue_virq(migrated_irqs[cpu_id][ctr].id, cpu_id); + migrated_irqs[cpu_id][ctr].src_cpuif = + bitindex((orig >> (ctr << 3)) & 0xff); + migrated_irqs[cpu_id][ctr].dest_cpuif = + bitindex((curr >> (ctr << 3)) & 0xff); + desc = + dequeue_virq(migrated_irqs[cpu_id][ctr].id, cpu_id); if (desc) { migrated_irqs[cpu_id][ctr].desc = desc; - cpu_mask |= 1 << migrated_irqs[cpu_id][ctr].dest_cpuif; + cpu_mask |= + 1 << migrated_irqs[cpu_id][ctr].dest_cpuif; } } } @@ -187,7 +197,8 @@ static unsigned set_mig_irq_info(unsigned orig, unsigned curr, unsigned icdiptr_ * that have just been migrated. Save this information and ask the target cpu to * enqueue them. */ -unsigned start_virq_migration(unsigned orig, unsigned curr, unsigned icdiptr_offset) +unsigned start_virq_migration(unsigned orig, unsigned curr, + unsigned icdiptr_offset) { unsigned virq_mig_mask = 0; @@ -221,9 +232,11 @@ void complete_virq_migration(unsigned src_cpuid) * Compare the cpu id instead of the cpu interface id in case * a switch took place before the virq migration ipi was recieved. */ - dest_cpuid = get_cpuinfo(migrated_irqs[src_cpuid][ctr].dest_cpuif) & 0xf; + dest_cpuid = + get_cpuinfo(migrated_irqs[src_cpuid][ctr].dest_cpuif) & 0xf; if (migrated_irqs[src_cpuid][ctr].desc && dest_cpuid == cpu_id) { - enqueue_interrupt(migrated_irqs[src_cpuid][ctr].desc, cpu_id); + enqueue_interrupt(migrated_irqs[src_cpuid][ctr].desc, + cpu_id); migrated_irqs[src_cpuid][ctr].desc = 0; } } @@ -232,7 +245,6 @@ void complete_virq_migration(unsigned src_cpuid) return; } - void dump_vgic_state() { unsigned int i; |