From: Jan Kiszka <[email protected]> We will need this once we start to identity-map the redistributors. And while we could currently still calculate the addresses, better prepare for multiple redist regions and store the address along the mapping.
Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/arm/gic-v3.c | 10 ++++++++-- hypervisor/arch/arm/include/asm/percpu.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/arm/gic-v3.c b/hypervisor/arch/arm/gic-v3.c index 15701db0..d529128c 100644 --- a/hypervisor/arch/arm/gic-v3.c +++ b/hypervisor/arch/arm/gic-v3.c @@ -90,12 +90,14 @@ static void gic_cpu_reset(struct per_cpu *cpu_data) static int gic_cpu_init(struct per_cpu *cpu_data) { unsigned int mnt_irq = system_config->platform_info.arm.maintenance_irq; + unsigned long redist_addr = system_config->platform_info.arm.gicr_base; + void *redist_base = gicr_base; + unsigned long redist_size; u64 typer; u32 pidr; u32 cell_icc_ctlr, cell_icc_pmr, cell_icc_igrpen1; u32 ich_vtr; u32 ich_vmcr; - void *redist_base = gicr_base; /* Find redistributor */ do { @@ -104,13 +106,17 @@ static int gic_cpu_init(struct per_cpu *cpu_data) if (gic_version != 3 && gic_version != 4) break; + redist_size = gic_version == 4 ? 0x40000 : 0x20000; + typer = mmio_read64(redist_base + GICR_TYPER); if ((typer >> 32) == cpu_data->cpu_id) { cpu_data->gicr.base = redist_base; + cpu_data->gicr.phys_addr = redist_addr; break; } - redist_base += gic_version == 4 ? 0x40000 : 0x20000; + redist_base += redist_size; + redist_addr += redist_size; } while (!(typer & GICR_TYPER_Last)); if (!cpu_data->gicr.base) { diff --git a/hypervisor/arch/arm/include/asm/percpu.h b/hypervisor/arch/arm/include/asm/percpu.h index 68f8ea18..d8b10fce 100644 --- a/hypervisor/arch/arm/include/asm/percpu.h +++ b/hypervisor/arch/arm/include/asm/percpu.h @@ -57,6 +57,8 @@ struct per_cpu { /** mapped redistributor base. When non-NULL, per-cpu * cpu initialization completed.*/ void *base; + /** physical redistributor address */ + unsigned long phys_addr; } gicr; }; -- 2.12.3 -- 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.
