Page MenuHomeFreeBSD

D28340.id82873.diff
No OneTemporary

D28340.id82873.diff

diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -41,6 +41,7 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/cpuset.h>
+#include <sys/domainset.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/lock.h>
@@ -245,7 +246,7 @@
struct intr_pic *sc_pic;
struct resource *sc_its_res;
- cpuset_t sc_cpus;
+ struct domainset *ds;
u_int gic_irq_cpu;
struct its_ptable sc_its_ptab[GITS_BASER_NUM];
@@ -385,8 +386,8 @@
uint64_t reg, tmp;
/* Set up the command circular buffer */
- sc->sc_its_cmd_base = contigmalloc(ITS_CMDQ_SIZE, M_GICV3_ITS,
- M_WAITOK | M_ZERO, 0, (1ul << 48) - 1, ITS_CMDQ_ALIGN, 0);
+ sc->sc_its_cmd_base = contigmalloc_domainset(ITS_CMDQ_SIZE, M_GICV3_ITS,
+ sc->ds, M_WAITOK | M_ZERO, 0, (1ul << 48) - 1, ITS_CMDQ_ALIGN, 0);
sc->sc_its_cmd_next_idx = 0;
cmd_paddr = vtophys(sc->sc_its_cmd_base);
@@ -486,8 +487,8 @@
npages = howmany(its_tbl_size, PAGE_SIZE);
/* Allocate the table */
- table = (vm_offset_t)contigmalloc(npages * PAGE_SIZE,
- M_GICV3_ITS, M_WAITOK | M_ZERO, 0, (1ul << 48) - 1,
+ table = (vm_offset_t)contigmalloc_domainset(npages * PAGE_SIZE,
+ M_GICV3_ITS, sc->ds, M_WAITOK | M_ZERO, 0, (1ul << 48) - 1,
PAGE_SIZE_64K, 0);
sc->sc_its_ptab[i].ptab_vaddr = table;
@@ -600,7 +601,7 @@
int i;
for (i = 0; i <= mp_maxid; i++) {
- if (CPU_ISSET(i, &sc->sc_cpus) == 0)
+ if (CPU_ABSENT(i))
continue;
sc->sc_pend_base[i] = (vm_offset_t)contigmalloc(
@@ -704,8 +705,6 @@
gicv3 = device_get_parent(dev);
cpuid = PCPU_GET(cpuid);
- if (!CPU_ISSET(cpuid, &sc->sc_cpus))
- return (0);
/* Check if the ITS is enabled on this CPU */
if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0)
@@ -856,6 +855,12 @@
}
}
+ if (bus_get_domain(dev, &domain) == 0 && domain < MAXMEMDOM) {
+ sc->ds = DOMAINSET_PREF(domain);
+ } else {
+ sc->ds = DOMAINSET_RR();
+ }
+
/* Allocate the private tables */
err = gicv3_its_table_init(dev, sc);
if (err != 0)
@@ -867,22 +872,14 @@
/* Protects access to the ITS command circular buffer. */
mtx_init(&sc->sc_its_cmd_lock, "ITS cmd lock", NULL, MTX_SPIN);
- CPU_ZERO(&sc->sc_cpus);
- if (bus_get_domain(dev, &domain) == 0) {
- if (domain < MAXMEMDOM)
- CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus);
- } else {
- CPU_COPY(&all_cpus, &sc->sc_cpus);
- }
-
/* 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,
+ if (!CPU_ABSENT(cpu))
+ sc->sc_its_cols[cpu] = malloc_domainset(
+ sizeof(*sc->sc_its_cols[0]), M_GICV3_ITS, sc->ds,
M_WAITOK | M_ZERO);
else
sc->sc_its_cols[cpu] = NULL;
@@ -1042,8 +1039,7 @@
sc = device_get_softc(dev);
if (CPU_EMPTY(&isrc->isrc_cpu)) {
- sc->gic_irq_cpu = intr_irq_next_cpu(sc->gic_irq_cpu,
- &sc->sc_cpus);
+ sc->gic_irq_cpu = intr_irq_next_cpu(sc->gic_irq_cpu, &all_cpus);
CPU_SETOF(sc->gic_irq_cpu, &isrc->isrc_cpu);
}
@@ -1173,9 +1169,9 @@
* PA has to be 256 B aligned. At least two entries for device.
*/
its_dev->itt_size = roundup2(MAX(nvecs, 2) * esize, 256);
- its_dev->itt = (vm_offset_t)contigmalloc(its_dev->itt_size,
- M_GICV3_ITS, M_NOWAIT | M_ZERO, 0, LPI_INT_TRANS_TAB_MAX_ADDR,
- LPI_INT_TRANS_TAB_ALIGN, 0);
+ its_dev->itt = (vm_offset_t)contigmalloc_domainset(its_dev->itt_size,
+ M_GICV3_ITS, sc->ds, M_NOWAIT | M_ZERO, 0,
+ LPI_INT_TRANS_TAB_MAX_ADDR, LPI_INT_TRANS_TAB_ALIGN, 0);
if (its_dev->itt == 0) {
vmem_free(sc->sc_irq_alloc, its_dev->lpis.lpi_base, nvecs);
free(its_dev, M_GICV3_ITS);

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 22, 10:30 AM (10 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35361138
Default Alt Text
D28340.id82873.diff (3 KB)

Event Timeline