Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Change ap_mpstart to return non-zero value if any/a...



details:   https://anonhg.NetBSD.org/src/rev/06377989e735
branches:  trunk
changeset: 838795:06377989e735
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Jan 31 13:06:10 2019 +0000

description:
Change ap_mpstart to return non-zero value if any/all APs don't start.

diffstat:

 sys/arch/arm/altera/cycv_platform.c       |  16 ++++++++++++----
 sys/arch/arm/amlogic/meson_platform.c     |  14 ++++++++------
 sys/arch/arm/fdt/arm_fdtvar.h             |   6 +++---
 sys/arch/arm/fdt/cpu_fdt.c                |  15 ++++++++++-----
 sys/arch/arm/nvidia/soc_tegra124.c        |  16 ++++++++++++----
 sys/arch/arm/nvidia/tegra_var.h           |   7 ++-----
 sys/arch/arm/samsung/exynos_platform.c    |  24 +++++++++++++++---------
 sys/arch/arm/vexpress/vexpress_platform.c |  15 +++++++++++----
 sys/arch/evbarm/zynq/zynq_machdep.c       |   9 ++++++---
 9 files changed, 79 insertions(+), 43 deletions(-)

diffs (truncated from 447 to 300 lines):

diff -r b82c6f432650 -r 06377989e735 sys/arch/arm/altera/cycv_platform.c
--- a/sys/arch/arm/altera/cycv_platform.c       Thu Jan 31 12:31:50 2019 +0000
+++ b/sys/arch/arm/altera/cycv_platform.c       Thu Jan 31 13:06:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_platform.c,v 1.9 2018/11/02 18:13:11 aymeric Exp $ */
+/* $NetBSD: cycv_platform.c,v 1.10 2019/01/31 13:06:10 skrll Exp $ */
 
 /* This file is in the public domain. */
 
@@ -7,7 +7,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.9 2018/11/02 18:13:11 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.10 2019/01/31 13:06:10 skrll Exp $");
 
 #define        _ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -76,12 +76,13 @@
        arm_fdt_cpu_bootstrap();
 }
 
-static void
+static int
 cycv_mpstart(void)
 {
        bus_space_tag_t bst = &armv7_generic_bs_tag;
        bus_space_handle_t bsh_rst;
        bus_space_handle_t bsh_scu;
+       int ret = 0;
 
        bus_space_map(bst, CYCV_RSTMGR_BASE, CYCV_RSTMGR_SIZE, 0, &bsh_rst);
        bus_space_map(bst, CYCV_SCU_BASE, CYCV_SCU_SIZE, 0, &bsh_scu);
@@ -110,11 +111,18 @@
                        ~CYCV_RSTMGR_MPUMODRST_CPU1);
 
        /* Wait for secondary processor to start */
-       for (int i = 0x10000000; i > 0; i--) {
+       int i;
+       for (i = 0x10000000; i > 0; i--) {
                membar_consumer();
                if (arm_cpu_hatched == (1 << 1))
                        break;
        }
+       if (i == 0) {
+               aprint_error("cpu%d: WARNING: AP failed to start\n", 1);
+               ret++;
+       }
+
+       return ret;
 }
 
 static void
diff -r b82c6f432650 -r 06377989e735 sys/arch/arm/amlogic/meson_platform.c
--- a/sys/arch/arm/amlogic/meson_platform.c     Thu Jan 31 12:31:50 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_platform.c     Thu Jan 31 13:06:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.3 2019/01/21 16:27:48 jmcneill Exp $ */
+/* $NetBSD: meson_platform.c,v 1.4 2019/01/31 13:06:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.3 2019/01/21 16:27:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.4 2019/01/31 13:06:10 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -397,15 +397,16 @@
 ARM_CPU_METHOD(meson8b, "amlogic,meson8b-smp", cpu_enable_meson8b);
 #endif
 
-static void
+static int
 meson_mpstart(void)
 {
+       int ret = 0;
 #ifdef MULTIPROCESSOR
        const bus_addr_t cbar = armreg_cbar_read();
        bus_space_tag_t bst = &arm_generic_bs_tag;
 
        if (cbar == 0)
-               return;
+               return ret;
 
        const bus_space_handle_t scu_bsh =
            cbar - MESON8B_ARM_PBASE + MESON8B_ARM_VBASE;
@@ -414,7 +415,7 @@
        const u_int ncpus = (scu_cfg & SCU_CFG_CPUMAX) + 1;
 
        if (ncpus < 2)
-               return;
+               return ret;
 
        /*
         * Invalidate all SCU cache tags. That is, for all cores (0-3)
@@ -427,8 +428,9 @@
 
        armv7_dcache_wbinv_all();
 
-       arm_fdt_cpu_mpstart();
+       ret = arm_fdt_cpu_mpstart();
 #endif
+       return ret;
 }
 
 
diff -r b82c6f432650 -r 06377989e735 sys/arch/arm/fdt/arm_fdtvar.h
--- a/sys/arch/arm/fdt/arm_fdtvar.h     Thu Jan 31 12:31:50 2019 +0000
+++ b/sys/arch/arm/fdt/arm_fdtvar.h     Thu Jan 31 13:06:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdtvar.h,v 1.14 2019/01/03 12:54:25 jmcneill Exp $ */
+/* $NetBSD: arm_fdtvar.h,v 1.15 2019/01/31 13:06:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -38,7 +38,7 @@
 struct arm_platform {
        const struct pmap_devmap * (*ap_devmap)(void);
        void                    (*ap_bootstrap)(void);
-       void                    (*ap_mpstart)(void);
+       int                     (*ap_mpstart)(void);
        void                    (*ap_startup)(void);
        void                    (*ap_init_attach_args)(struct fdt_attach_args *);
        void                    (*ap_device_register)(device_t, void *);
@@ -84,7 +84,7 @@
 _ARM_CPU_METHOD_REGISTER(_name)
 
 void   arm_fdt_cpu_bootstrap(void);
-void   arm_fdt_cpu_mpstart(void);
+int    arm_fdt_cpu_mpstart(void);
 void    arm_fdt_cpu_hatch_register(void *, void (*)(void *, struct cpu_info *));
 void    arm_fdt_cpu_hatch(struct cpu_info *);
 
diff -r b82c6f432650 -r 06377989e735 sys/arch/arm/fdt/cpu_fdt.c
--- a/sys/arch/arm/fdt/cpu_fdt.c        Thu Jan 31 12:31:50 2019 +0000
+++ b/sys/arch/arm/fdt/cpu_fdt.c        Thu Jan 31 13:06:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.21 2019/01/19 20:56:03 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.22 2019/01/31 13:06:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.21 2019/01/19 20:56:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.22 2019/01/31 13:06:10 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -272,9 +272,10 @@
 }
 #endif
 
-void
+int
 arm_fdt_cpu_mpstart(void)
 {
+       int ret = 0;
 #ifdef MULTIPROCESSOR
        uint64_t mpidr, bp_mpidr;
        u_int cpuindex, i;
@@ -284,7 +285,7 @@
        const int cpus = OF_finddevice("/cpus");
        if (cpus == -1) {
                aprint_error("%s: no /cpus node found\n", __func__);
-               return;
+               return 0;
        }
 
        /* MPIDR affinity levels of boot processor. */
@@ -323,12 +324,16 @@
                        if (arm_cpu_hatched & __BIT(cpuindex))
                                break;
                }
-               if (i == 0)
+
+               if (i == 0) {
+                       ret++;
                        aprint_error("cpu%d: WARNING: AP failed to start\n", cpuindex);
+               }
 
                cpuindex++;
        }
 #endif /* MULTIPROCESSOR */
+       return ret;
 }
 
 static int
diff -r b82c6f432650 -r 06377989e735 sys/arch/arm/nvidia/soc_tegra124.c
--- a/sys/arch/arm/nvidia/soc_tegra124.c        Thu Jan 31 12:31:50 2019 +0000
+++ b/sys/arch/arm/nvidia/soc_tegra124.c        Thu Jan 31 13:06:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: soc_tegra124.c,v 1.19 2018/10/18 09:01:53 skrll Exp $ */
+/* $NetBSD: soc_tegra124.c,v 1.20 2019/01/31 13:06:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: soc_tegra124.c,v 1.19 2018/10/18 09:01:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: soc_tegra124.c,v 1.20 2019/01/31 13:06:10 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -51,9 +51,11 @@
 
 #define EVP_RESET_VECTOR_0_REG 0x100
 
-void
+int
 tegra124_mpstart(void)
 {
+       int ret = 0;
+
 #if defined(MULTIPROCESSOR)
        bus_space_tag_t bst = &arm_generic_bs_tag;
        bus_space_handle_t bsh;
@@ -74,10 +76,16 @@
        tegra_pmc_power(PMC_PARTID_CPU2, true); started |= __BIT(2);
        tegra_pmc_power(PMC_PARTID_CPU3, true); started |= __BIT(3);
 
-       for (u_int i = 0x10000000; i > 0; i--) {
+       u_int i;
+       for (i = 0x10000000; i > 0; i--) {
                arm_dmb();
                if (arm_cpu_hatched == started)
                        break;
        }
+       if (i == 0) {
+               ret++;
+               aprint_error("cpu%d: WARNING: AP failed to start\n", i;
+       }
 #endif
+       return ret;
 }
diff -r b82c6f432650 -r 06377989e735 sys/arch/arm/nvidia/tegra_var.h
--- a/sys/arch/arm/nvidia/tegra_var.h   Thu Jan 31 12:31:50 2019 +0000
+++ b/sys/arch/arm/nvidia/tegra_var.h   Thu Jan 31 13:06:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_var.h,v 1.45 2018/12/14 12:29:22 skrll Exp $ */
+/* $NetBSD: tegra_var.h,v 1.46 2019/01/31 13:06:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -77,10 +77,7 @@
 void   tegra_cpufreq_register(const struct tegra_cpufreq_func *);
 
 #if defined(SOC_TEGRA124)
-void   tegra124_mpstart(void);
-#endif
-#if defined(SOC_TEGRA210)
-void   tegra210_mpstart(void);
+int    tegra124_mpstart(void);
 #endif
 
 static void inline
diff -r b82c6f432650 -r 06377989e735 sys/arch/arm/samsung/exynos_platform.c
--- a/sys/arch/arm/samsung/exynos_platform.c    Thu Jan 31 12:31:50 2019 +0000
+++ b/sys/arch/arm/samsung/exynos_platform.c    Thu Jan 31 13:06:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.24 2019/01/27 04:53:59 dholland Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.25 2019/01/31 13:06:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -35,7 +35,7 @@
 #include "ukbd.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.24 2019/01/27 04:53:59 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.25 2019/01/31 13:06:10 skrll Exp $");
 
 /* XXXJDM
  * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
@@ -91,9 +91,10 @@
 #define        EXYNOS5800_SYSRAM_SIZE          0x1000
 #define         EXYNOS5800_SYSRAM_HOTPLUG              0x001c
 
-static void
+static int
 exynos5800_mpstart(void)
 {
+       int ret = 0;
 #if defined(MULTIPROCESSOR)
        bus_space_tag_t bst = &armv7_generic_bs_tag;
        bus_space_handle_t pmu_bsh, sysram_bsh;
@@ -108,7 +109,7 @@
        const int cpus = OF_finddevice("/cpus");
        if (cpus == -1) {
                aprint_error("%s: no /cpus node found\n", __func__);
-               return;
+               return ret;



Home | Main Index | Thread Index | Old Index