Skip to content

Commit

Permalink
GICv3 debug1
Browse files Browse the repository at this point in the history
  • Loading branch information
strejda committed Dec 6, 2020
1 parent cd5c51d commit a25ed73
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions sys/arm64/arm64/gicv3_its.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc)

gicv3 = device_get_parent(dev);
cpuid = PCPU_GET(cpuid);
printf("%s: cpuid: %u \n", __func__, PCPU_GET(cpuid));
if (!CPU_ISSET(cpuid, &sc->sc_cpus))
return (0);

Expand All @@ -727,7 +728,7 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc)
target = GICR_TYPER_CPUNUM(gic_r_read_8(gicv3, GICR_TYPER)) <<
CMD_TARGET_SHIFT;
}

printf("%s: cpuid: %d, target: 0x%lX\n", __func__, cpuid, target);
sc->sc_its_cols[cpuid]->col_target = target;
sc->sc_its_cols[cpuid]->col_id = cpuid;

Expand Down Expand Up @@ -869,24 +870,34 @@ gicv3_its_attach(device_t dev)

CPU_ZERO(&sc->sc_cpus);
if (bus_get_domain(dev, &domain) == 0) {
printf("%s: per domain cpus\n", __func__);
if (domain < MAXMEMDOM)
CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus);
} else {
CPU_COPY(&all_cpus, &sc->sc_cpus);
printf("%s: all cpus\n", __func__);
}

/* Allocate the command circular buffer */
gicv3_its_cmdq_init(sc);

/* Allocate the per-CPU collections */
for (int cpu = 0; cpu <= mp_maxid; cpu++)
{

if (CPU_ISSET(cpu, &sc->sc_cpus) != 0)
{
sc->sc_its_cols[cpu] = malloc(
sizeof(*sc->sc_its_cols[0]), M_GICV3_ITS,
M_WAITOK | M_ZERO);
printf("%s: new its col[%d]\n", __func__, cpu);
}
else
{
sc->sc_its_cols[cpu] = NULL;

printf("%s: NULL its col[%d]\n", __func__, cpu);
}
}
/* Enable the ITS */
gic_its_write_4(sc, GITS_CTLR,
gic_its_read_4(sc, GITS_CTLR) | GITS_CTLR_EN);
Expand Down Expand Up @@ -1045,8 +1056,10 @@ gicv3_its_select_cpu(device_t dev, struct intr_irqsrc *isrc)
sc->gic_irq_cpu = intr_irq_next_cpu(sc->gic_irq_cpu,
&sc->sc_cpus);
CPU_SETOF(sc->gic_irq_cpu, &isrc->isrc_cpu);
printf("%s: gic_irq_cpu: %d\n", __func__, sc->gic_irq_cpu);
}

else
printf("%s: cpuset not empty\n", __func__);
return (0);
}

Expand All @@ -1055,10 +1068,12 @@ gicv3_its_bind_intr(device_t dev, struct intr_irqsrc *isrc)
{
struct gicv3_its_irqsrc *girq;

printf("%s: Enter\n", __func__);
gicv3_its_select_cpu(dev, isrc);

girq = (struct gicv3_its_irqsrc *)isrc;
its_cmd_movi(dev, girq);
printf("%s: Leave\n", __func__);
return (0);
}

Expand Down Expand Up @@ -1101,6 +1116,7 @@ gicv3_its_init_secondary(device_t dev)
if (its_init_cpu(dev, sc) != 0)
panic("gicv3_its_init_secondary: No usable ITS on CPU%d",
PCPU_GET(cpuid));
printf("%s: cpuid: %u \n", __func__, PCPU_GET(cpuid));
}
#endif

Expand Down Expand Up @@ -1797,7 +1813,7 @@ its_cmd_movi(device_t dev, struct gicv3_its_irqsrc *girq)

sc = device_get_softc(dev);
col = sc->sc_its_cols[CPU_FFS(&girq->gi_isrc.isrc_cpu) - 1];

printf("%s: isrc_cpu %ld, col; %p\n", __func__, CPU_FFS(&girq->gi_isrc.isrc_cpu) - 1, col);
desc.cmd_type = ITS_CMD_MOVI;
desc.cmd_desc_movi.its_dev = girq->gi_its_dev;
desc.cmd_desc_movi.col = col;
Expand Down

0 comments on commit a25ed73

Please sign in to comment.