From owner-svn-src-head@freebsd.org Fri Mar 17 12:45:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8180AD105AB; Fri, 17 Mar 2017 12:45:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 599FB1690; Fri, 17 Mar 2017 12:45:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2HCjsIN030345; Fri, 17 Mar 2017 12:45:54 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2HCjsJL030342; Fri, 17 Mar 2017 12:45:54 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201703171245.v2HCjsJL030342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 17 Mar 2017 12:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315450 - in head/sys: arm/qemu dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Mar 2017 12:45:55 -0000 Author: andrew Date: Fri Mar 17 12:45:53 2017 New Revision: 315450 URL: https://svnweb.freebsd.org/changeset/base/315450 Log: Make the default FDT implementation of platform_mp_setmaxid use the cpu nodes from the DTB by default. This will allow us to enumerate the CPUs without hard coding the CPU count into code. Reviewed by: br Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D9827 Modified: head/sys/arm/qemu/virt_machdep.c head/sys/arm/qemu/virt_mp.c head/sys/dev/fdt/fdt_arm_platform.c Modified: head/sys/arm/qemu/virt_machdep.c ============================================================================== --- head/sys/arm/qemu/virt_machdep.c Fri Mar 17 12:34:57 2017 (r315449) +++ head/sys/arm/qemu/virt_machdep.c Fri Mar 17 12:45:53 2017 (r315450) @@ -60,7 +60,6 @@ static platform_method_t virt_methods[] #ifdef SMP PLATFORMMETHOD(platform_mp_start_ap, virt_mp_start_ap), - PLATFORMMETHOD(platform_mp_setmaxid, virt_mp_setmaxid), #endif PLATFORMMETHOD_END, Modified: head/sys/arm/qemu/virt_mp.c ============================================================================== --- head/sys/arm/qemu/virt_mp.c Fri Mar 17 12:34:57 2017 (r315449) +++ head/sys/arm/qemu/virt_mp.c Fri Mar 17 12:45:53 2017 (r315450) @@ -50,27 +50,6 @@ __FBSDID("$FreeBSD$"); static int running_cpus; static boolean_t -virt_maxid(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg) -{ - - if (mp_maxid < id) - mp_maxid = id; - - return (true); -} - -void -virt_mp_setmaxid(platform_t plat) -{ - - mp_maxid = PCPU_GET(cpuid); - mp_ncpus = ofw_cpu_early_foreach(virt_maxid, true); - if (mp_ncpus < 1) - mp_ncpus = 1; - mp_ncpus = MIN(mp_ncpus, MAXCPU); -} - -static boolean_t virt_start_ap(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg) { int err; Modified: head/sys/dev/fdt/fdt_arm_platform.c ============================================================================== --- head/sys/dev/fdt/fdt_arm_platform.c Fri Mar 17 12:34:57 2017 (r315449) +++ head/sys/dev/fdt/fdt_arm_platform.c Fri Mar 17 12:45:53 2017 (r315450) @@ -30,12 +30,14 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include +#include #include #include "platform_if.h" @@ -43,6 +45,10 @@ __FBSDID("$FreeBSD$"); #define FDT_PLATFORM(plat) \ ((fdt_platform_def_t *)(plat)->cls->baseclasses[0]) +#if defined(SMP) +static platform_mp_setmaxid_t fdt_platform_mp_setmaxid; +#endif + static int fdt_platform_probe(platform_t plat) { @@ -66,8 +72,36 @@ fdt_platform_probe(platform_t plat) return 1; } +#if defined(SMP) +static boolean_t +fdt_platform_maxid(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg) +{ + + if (mp_maxid < id) + mp_maxid = id; + + return (true); +} + +static void +fdt_platform_mp_setmaxid(platform_t plat) +{ + + mp_maxid = PCPU_GET(cpuid); + mp_ncpus = ofw_cpu_early_foreach(fdt_platform_maxid, true); + if (mp_ncpus < 1) + mp_ncpus = 1; + mp_ncpus = MIN(mp_ncpus, MAXCPU); +} +#endif + platform_method_t fdt_platform_methods[] = { PLATFORMMETHOD(platform_probe, fdt_platform_probe), + +#if defined(SMP) + PLATFORMMETHOD(platform_mp_setmaxid, fdt_platform_mp_setmaxid), +#endif + PLATFORMMETHOD_END };