Module Name: src
Committed By: jmcneill
Date: Sat Jan 16 21:05:15 UTC 2021
Modified Files:
src/sys/arch/arm/cortex: gicv3.c gicv3.h gicv3_its.c gicv3_its.h
Log Message:
Remove MAXCPUS dependency.
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/cortex/gicv3.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/cortex/gicv3.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/cortex/gicv3_its.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/cortex/gicv3_its.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.38 src/sys/arch/arm/cortex/gicv3.c:1.39
--- src/sys/arch/arm/cortex/gicv3.c:1.38 Tue Dec 22 10:46:51 2020
+++ src/sys/arch/arm/cortex/gicv3.c Sat Jan 16 21:05:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.38 2020/12/22 10:46:51 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.39 2021/01/16 21:05:15 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <[email protected]>
@@ -31,7 +31,7 @@
#define _INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.38 2020/12/22 10:46:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.39 2021/01/16 21:05:15 jmcneill Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.
#include <sys/systm.h>
#include <sys/cpu.h>
#include <sys/vmem.h>
+#include <sys/kmem.h>
#include <sys/atomic.h>
#include <machine/cpufunc.h>
@@ -838,7 +839,8 @@ gicv3_init(struct gicv3_softc *sc)
LIST_INIT(&sc->sc_lpi_callbacks);
- for (n = 0; n < MAXCPUS; n++)
+ sc->sc_irouter = kmem_zalloc(sizeof(*sc->sc_irouter) * ncpu, KM_SLEEP);
+ for (n = 0; n < ncpu; n++)
sc->sc_irouter[n] = UINT64_MAX;
sc->sc_gicd_typer = gicd_read_4(sc, GICD_TYPER);
@@ -876,6 +878,9 @@ gicv3_init(struct gicv3_softc *sc)
pic_add(&sc->sc_pic, 0);
if ((sc->sc_gicd_typer & GICD_TYPER_LPIS) != 0) {
+ sc->sc_lpipend = kmem_zalloc(sizeof(*sc->sc_lpipend) * ncpu, KM_SLEEP);
+ sc->sc_processor_id = kmem_zalloc(sizeof(*sc->sc_processor_id) * ncpu, KM_SLEEP);
+
sc->sc_lpi.pic_ops = &gicv3_lpiops;
sc->sc_lpi.pic_maxsources = 8192; /* Min. required by GICv3 spec */
snprintf(sc->sc_lpi.pic_name, sizeof(sc->sc_lpi.pic_name), "gicv3-lpi");
Index: src/sys/arch/arm/cortex/gicv3.h
diff -u src/sys/arch/arm/cortex/gicv3.h:1.10 src/sys/arch/arm/cortex/gicv3.h:1.11
--- src/sys/arch/arm/cortex/gicv3.h:1.10 Fri Dec 4 21:39:26 2020
+++ src/sys/arch/arm/cortex/gicv3.h Sat Jan 16 21:05:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.h,v 1.10 2020/12/04 21:39:26 jmcneill Exp $ */
+/* $NetBSD: gicv3.h,v 1.11 2021/01/16 21:05:15 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <[email protected]>
@@ -70,20 +70,20 @@ struct gicv3_softc {
u_int sc_pmr_shift;
uint32_t sc_enabled_sgippi;
- uint64_t sc_irouter[MAXCPUS];
+ uint64_t *sc_irouter;
/* LPI configuration table */
struct gicv3_dma sc_lpiconf;
bool sc_lpiconf_flush;
/* LPI pending tables */
- struct gicv3_dma sc_lpipend[MAXCPUS];
+ struct gicv3_dma *sc_lpipend;
/* LPI IDs */
vmem_t *sc_lpi_pool;
/* Unique identifier for PEs */
- u_int sc_processor_id[MAXCPUS];
+ u_int *sc_processor_id;
/* Callbacks */
LIST_HEAD(, gicv3_lpi_callback) sc_lpi_callbacks;
Index: src/sys/arch/arm/cortex/gicv3_its.c
diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.31 src/sys/arch/arm/cortex/gicv3_its.c:1.32
--- src/sys/arch/arm/cortex/gicv3_its.c:1.31 Thu Dec 24 14:44:49 2020
+++ src/sys/arch/arm/cortex/gicv3_its.c Sat Jan 16 21:05:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.31 2020/12/24 14:44:49 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.32 2021/01/16 21:05:15 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#define _INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.31 2020/12/24 14:44:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.32 2021/01/16 21:05:15 jmcneill Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -712,7 +712,7 @@ gicv3_its_table_init(struct gicv3_softc
/*
* Allocate space for one interrupt collection per CPU.
*/
- table_size = roundup(entry_size * MAXCPUS, page_size);
+ table_size = roundup(entry_size * ncpu, page_size);
table_type = "Collections";
break;
default:
@@ -866,6 +866,8 @@ gicv3_its_init(struct gicv3_softc *sc, b
its->its_pa = kmem_zalloc(sizeof(struct pci_attach_args *) * its->its_pic->pic_maxsources, KM_SLEEP);
its->its_targets = kmem_zalloc(sizeof(struct cpu_info *) * its->its_pic->pic_maxsources, KM_SLEEP);
its->its_gic = sc;
+ its->its_rdbase = kmem_zalloc(sizeof(*its->its_rdbase) * ncpu, KM_SLEEP);
+ its->its_cpuonline = kmem_zalloc(sizeof(*its->its_cpuonline) * ncpu, KM_SLEEP);
its->its_cb.cpu_init = gicv3_its_cpu_init;
its->its_cb.get_affinity = gicv3_its_get_affinity;
its->its_cb.set_affinity = gicv3_its_set_affinity;
Index: src/sys/arch/arm/cortex/gicv3_its.h
diff -u src/sys/arch/arm/cortex/gicv3_its.h:1.6 src/sys/arch/arm/cortex/gicv3_its.h:1.7
--- src/sys/arch/arm/cortex/gicv3_its.h:1.6 Wed Jun 12 21:02:07 2019
+++ src/sys/arch/arm/cortex/gicv3_its.h Sat Jan 16 21:05:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.h,v 1.6 2019/06/12 21:02:07 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.h,v 1.7 2021/01/16 21:05:15 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -52,8 +52,8 @@ struct gicv3_its {
bus_dma_tag_t its_dmat;
uint32_t its_id;
uint64_t its_base;
- uint64_t its_rdbase[MAXCPUS];
- bool its_cpuonline[MAXCPUS];
+ uint64_t *its_rdbase;
+ bool *its_cpuonline;
struct gicv3_softc *its_gic;
struct gicv3_lpi_callback its_cb;