Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/cortex Remove MAXCPUS dependency.



details:   https://anonhg.NetBSD.org/src/rev/5f954be42e93
branches:  trunk
changeset: 949786:5f954be42e93
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jan 16 21:05:15 2021 +0000

description:
Remove MAXCPUS dependency.

diffstat:

 sys/arch/arm/cortex/gicv3.c     |  11 ++++++++---
 sys/arch/arm/cortex/gicv3.h     |   8 ++++----
 sys/arch/arm/cortex/gicv3_its.c |   8 +++++---
 sys/arch/arm/cortex/gicv3_its.h |   6 +++---
 4 files changed, 20 insertions(+), 13 deletions(-)

diffs (135 lines):

diff -r ca85f245e97a -r 5f954be42e93 sys/arch/arm/cortex/gicv3.c
--- a/sys/arch/arm/cortex/gicv3.c       Sat Jan 16 20:49:31 2021 +0000
+++ b/sys/arch/arm/cortex/gicv3.c       Sat Jan 16 21:05:15 2021 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 #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 @@
 
        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 @@
        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");
diff -r ca85f245e97a -r 5f954be42e93 sys/arch/arm/cortex/gicv3.h
--- a/sys/arch/arm/cortex/gicv3.h       Sat Jan 16 20:49:31 2021 +0000
+++ b/sys/arch/arm/cortex/gicv3.h       Sat Jan 16 21:05:15 2021 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -70,20 +70,20 @@
        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;
diff -r ca85f245e97a -r 5f954be42e93 sys/arch/arm/cortex/gicv3_its.c
--- a/sys/arch/arm/cortex/gicv3_its.c   Sat Jan 16 20:49:31 2021 +0000
+++ b/sys/arch/arm/cortex/gicv3_its.c   Sat Jan 16 21:05:15 2021 +0000
@@ -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 @@
                        /*
                         * 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 @@
        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;
diff -r ca85f245e97a -r 5f954be42e93 sys/arch/arm/cortex/gicv3_its.h
--- a/sys/arch/arm/cortex/gicv3_its.h   Sat Jan 16 20:49:31 2021 +0000
+++ b/sys/arch/arm/cortex/gicv3_its.h   Sat Jan 16 21:05:15 2021 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index