gicv3_its: do LPI init only once per CPU

The initialization required for LPIs (setting up pending tables etc.)
has to be done just once per CPU, even in the case where there are
multiple ITS blocks associated with the CPU.

Add a flag lpi_enabled in the per-cpu distributor info for this and
use it to ensure that we call its_init_cpu_lpi() just once.

This enables us to support platforms where multiple GIC ITS blocks
can generate LPIs to a CPU.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D19844
This commit is contained in:
jchandra 2019-05-30 01:32:00 +00:00
parent 21280ab5e7
commit 03c5d90f7c
3 changed files with 10 additions and 3 deletions

View File

@ -1185,6 +1185,7 @@ gic_v3_redist_find(struct gic_v3_softc *sc)
("Invalid pointer to per-CPU redistributor"));
/* Copy res contents to its final destination */
sc->gic_redists.pcpu[cpuid]->res = r_res;
sc->gic_redists.pcpu[cpuid]->lpi_enabled = false;
if (bootverbose) {
device_printf(sc->dev,
"CPU%u Re-Distributor has been found\n",

View File

@ -41,8 +41,9 @@ DECLARE_CLASS(gic_v3_driver);
struct gic_v3_irqsrc;
struct redist_pcpu {
struct resource res;
struct resource res; /* mem resource for redist */
vm_offset_t pend_base;
bool lpi_enabled; /* redist LPI configured? */
};
struct gic_redists {

View File

@ -672,11 +672,16 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc)
if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0)
return (ENXIO);
its_init_cpu_lpi(dev, sc);
rpcpu = gicv3_get_redist(dev);
/* Do per-cpu LPI init once */
if (!rpcpu->lpi_enabled) {
its_init_cpu_lpi(dev, sc);
rpcpu->lpi_enabled = true;
}
if ((gic_its_read_8(sc, GITS_TYPER) & GITS_TYPER_PTA) != 0) {
/* This ITS wants the redistributor physical address */
rpcpu = gicv3_get_redist(dev);
target = vtophys(rman_get_virtual(&rpcpu->res));
} else {
/* This ITS wants the unique processor number */