From patchwork Sun Apr 12 03:20:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 212334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D076C2D0EC for ; Sun, 12 Apr 2020 03:32:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 129D7206C0 for ; Sun, 12 Apr 2020 03:32:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="IgPb1a7t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbgDLDcW (ORCPT ); Sat, 11 Apr 2020 23:32:22 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:55180 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726565AbgDLDcW (ORCPT ); Sat, 11 Apr 2020 23:32:22 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id D063420D06; Sun, 12 Apr 2020 03:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1586661825; bh=+ULjUjhxhZgjrZLr4QNtGZOFHPRv0/ugDHj7sJtG6ok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IgPb1a7tm6ww/8vati/ROFgNz7SQz3VN6PgwecuxJkT6vs0HDCMJdlkT0RBLeVokx 2joNcS8j+QpHiUorg8HWbEdKelKzPEzZczVh+zBGFzFfnTOHwHYkcqYjAfENNu0qq7 Ijn+vaXYAYXdmK5JLyMocByYVGcrnBn1AYAt9EEGlr3eeLpytJBkE9yEB6ATWWNMDy Uf7KUCgW1VWGjFOhoK53PEhOKmfZF24c1JChQaXxkHzsglT0lOkqPe83gSUSzkQ/xC mshHe+5FCm9uiYgFx6/BKC6VfVyB3k22rXDxHyClrl+DDusDRoHYGc/5SZziceNLCI g9Sd7Hi1PFu0w== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: dietmar.eggemann@arm.com, Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Florian Fainelli , Robert Richter , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Paul Burton , Allison Randal , Enrico Weigelt , Kate Stewart , Vladimir Kondratiev , Alexios Zavras , Paul Cercueil , Zhou Yanjie , =?utf-8?b?5ZGo55Cw5p2wIChaaG91IFlh?= =?utf-8?q?njie=29?= , YunQiang Su , Arnd Bergmann , Serge Semin , Matt Redfearn , Richard Fontana , Steve Winslow , afzal mohammed , Peter Xu , Mike Rapoport , Kamal Dasu , Oleksij Rempel , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, oprofile-list@lists.sf.net, linux-pm@vger.kernel.org Subject: [PATCH v2 01/11] MIPS: setup: Drop prefill_possible_map Date: Sun, 12 Apr 2020 11:20:31 +0800 Message-Id: <20200412032123.3896114-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> References: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org All the plat_smp_setup are setting up possible cpus in their platform code. So prefill_possible_map is actually overwriting platform's setup, which seems unreasonable. Signed-off-by: Jiaxun Yang --- arch/mips/kernel/setup.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 10bef8f78e7c..8a418783a6bb 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -761,25 +761,6 @@ static void __init resource_init(void) } } -#ifdef CONFIG_SMP -static void __init prefill_possible_map(void) -{ - int i, possible = num_possible_cpus(); - - if (possible > nr_cpu_ids) - possible = nr_cpu_ids; - - for (i = 0; i < possible; i++) - set_cpu_possible(i, true); - for (; i < NR_CPUS; i++) - set_cpu_possible(i, false); - - nr_cpu_ids = possible; -} -#else -static inline void prefill_possible_map(void) {} -#endif - void __init setup_arch(char **cmdline_p) { cpu_probe(); @@ -804,7 +785,6 @@ void __init setup_arch(char **cmdline_p) resource_init(); plat_smp_setup(); - prefill_possible_map(); cpu_cache_init(); paging_init(); From patchwork Sun Apr 12 03:20:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 212332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2C8CC2BB55 for ; Sun, 12 Apr 2020 03:32:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D761206C0 for ; Sun, 12 Apr 2020 03:32:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="xdkAAkVh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbgDLDcX (ORCPT ); Sat, 11 Apr 2020 23:32:23 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:55206 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726706AbgDLDcW (ORCPT ); Sat, 11 Apr 2020 23:32:22 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id 0DA9720D0B; Sun, 12 Apr 2020 03:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1586661874; bh=oPTnJfivkM+8UlbJ6/9gGwXtkpRxLwi4xWE4eb0+CaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdkAAkVhE9cLmt4b8+PYZ1ceY8j4cfNtQsYRsYkA3LvMmiJ3R6r25w7aD/QGgISKZ I359nv7efhU2PI4KSVasEJ3dlYoYnMIipUwgLqmtXSooV2Gx/2n6J8zZbdhUh2E9eR M7Yad4QLQbyjs2ZVh3QUJs6tatPMqCzxN1QRWDpTKj63tM5EkheRe4Xen1pIT/Gt+I eKKZ/8eAAfqKopirzq3cc3dzFL3uwX+0IlxNtyAta/z9Y+Y3RvcUaIHQXX+cili6fg PCXwe49oAs+nYA+EukxPtqkc1hdEv5BoIhFmRTU3C0mDE9eTKLvx3Q6VyAHr6PVR7o ZNXGTUaVyXG2Q== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: dietmar.eggemann@arm.com, Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Florian Fainelli , Robert Richter , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Paul Burton , Allison Randal , Kate Stewart , Enrico Weigelt , Vladimir Kondratiev , Richard Fontana , Alexios Zavras , Paul Cercueil , Zhou Yanjie , =?utf-8?b?5ZGo55Cw5p2wICha?= =?utf-8?q?hou_Yanjie=29?= , YunQiang Su , Arnd Bergmann , Serge Semin , Matt Redfearn , Steve Winslow , afzal mohammed , Peter Xu , Mike Rapoport , Oleksij Rempel , Kamal Dasu , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, oprofile-list@lists.sf.net, linux-pm@vger.kernel.org Subject: [PATCH v2 02/11] MIPS: prom: Add helper to parse CPU node in dt Date: Sun, 12 Apr 2020 11:20:32 +0800 Message-Id: <20200412032123.3896114-3-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> References: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Mostly identical with arm one. The only difference is that we allow to mark a CPU Node as status = "disabled" in dt, which means the core is physicaly present, but not possible for the kernel. It will occupy a bit in cpumask as well. Signed-off-by: Jiaxun Yang --- v2: Exclude non-SMP config. --- arch/mips/include/asm/prom.h | 6 +++ arch/mips/kernel/prom.c | 97 ++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h index c42e07671934..84802c70e426 100644 --- a/arch/mips/include/asm/prom.h +++ b/arch/mips/include/asm/prom.h @@ -24,6 +24,12 @@ extern int __dt_register_buses(const char *bus0, const char *bus1); static inline void device_tree_init(void) { } #endif /* CONFIG_OF */ +#if defined(CONFIG_OF) && defined(CONFIG_SMP) +extern void mips_dt_init_cpu_maps(void); +#else +static inline void mips_dt_init_cpu_maps(void) { } +#endif + extern char *mips_get_machine_name(void); extern void mips_set_machine_name(const char *name); diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index 9e50dc8df2f6..deb5cc0a0eb5 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c @@ -89,4 +89,101 @@ int __init __dt_register_buses(const char *bus0, const char *bus1) return 0; } +#ifdef CONFIG_SMP +void __init mips_dt_init_cpu_maps(void) +{ + struct device_node *cpu, *cpus; + u32 i, j, cpuidx = 1; + u32 cpunum; + u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = U32_MAX }; + bool cpu_possible[NR_CPUS] = { [0 ... NR_CPUS-1] = false }; + bool bootcpu_valid = false; + + cpus = of_find_node_by_path("/cpus"); + if (!cpus) + return; + + if (cpu_has_mips_r2_r6) + cpunum = get_ebase_cpunum(); + else + cpunum = 0; /* For legacy system we assume boot from CPU 0 */ + + for_each_of_cpu_node(cpu) { + u32 hwid; + + pr_debug(" * %pOF...\n", cpu); + /* + * A device tree containing CPU nodes with missing "reg" + * properties is considered invalid to build the + * cpu_logical_map. + */ + + if (of_property_read_u32(cpu, "reg", &hwid)) { + pr_debug(" * %pOF missing reg property\n", cpu); + of_node_put(cpu); + return; + } + + /* + * Duplicate hwid are a recipe for disaster. + * Scan all initialized entries and check for + * duplicates. If any is found just bail out. + */ + for (j = 0; j < cpuidx; j++) + if (WARN(tmp_map[j] == hwid, + "Duplicate /cpu reg properties in the DT\n")) { + of_node_put(cpu); + return; + } + + /* + * Build a stashed array of hwid values. Numbering scheme + * requires that if detected the boot CPU must be assigned + * logical id 0. Other CPUs get sequential indexes starting + * from 1. If a CPU node with a reg property matching the + * boot CPU hwid is detected, this is recorded so that the + * logical map built from DT is validated. + */ + if (hwid == cpunum) { + i = 0; + if (of_device_is_available(cpu)) + bootcpu_valid = true; + } else { + i = cpuidx++; + } + + if (WARN(cpuidx > nr_cpu_ids, "DT /cpu %u nodes greater than " + "max cores %u, capping them\n", + cpuidx, nr_cpu_ids)) { + cpuidx = nr_cpu_ids; + of_node_put(cpu); + break; + } + + tmp_map[i] = hwid; + + if (of_device_is_available(cpu)) + cpu_possible[i] = true; + } + + if (!bootcpu_valid) { + pr_warn("DT missing boot CPU, fall back to default cpu_logical_map\n"); + return; + } + + init_cpu_possible(cpu_none_mask); + init_cpu_present(cpu_none_mask); + + for (i = 0; i < cpuidx; i++) { + set_cpu_possible(i, cpu_possible[i]); + cpu_logical_map(i) = tmp_map[i]; + pr_debug("cpu logical map 0x%x\n", cpu_logical_map(i)); + } +} + +bool arch_match_cpu_phys_id(int cpu, u64 phys_id) +{ + return phys_id == cpu_logical_map(cpu); +} +#endif /* CONFIG_SMP */ #endif From patchwork Sun Apr 12 03:20:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 212333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F5EAC2BBC7 for ; Sun, 12 Apr 2020 03:32:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67FB021835 for ; Sun, 12 Apr 2020 03:32:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="xGx/6YE0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726689AbgDLDcX (ORCPT ); Sat, 11 Apr 2020 23:32:23 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:55216 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726759AbgDLDcW (ORCPT ); Sat, 11 Apr 2020 23:32:22 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id 67F8320D16; Sun, 12 Apr 2020 03:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1586661973; bh=tGxZsojCaXRQzUdr7zPR3NOXIGurTKod1uy8NjI5p4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGx/6YE0io5bsdUPMhxoxEtHAD2PhTqgr8oGauD28ht0om5LPEo9Gg+mYvohWevhA DDt7PXbYLaEmUppcrL7V3FD5fsup9agG6l9dlf3MM/mfoiQ/qm7RY+JV/YiKSVbTX7 t5dyba1nNAHbzbaddtE0RtBYGhPPEVgAu64dbSmm7RNhD5GvXAsUjkZS2P3k+NFHgN OXiiUhR58SGALxKtK3jd+Tn4s0v3SdRdz6uPrMisS7WmGYiFYnuWVS8wpT5xo5jUVa lPrY8npH96DYo0qUsW0z9OI4ly38crST4a56ezVKQ73/EKeXcGDHFj7RR0F5YCksH+ t7Zh+NbVX1AWw== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: dietmar.eggemann@arm.com, Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Florian Fainelli , Robert Richter , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Paul Burton , Allison Randal , Enrico Weigelt , Kate Stewart , Vladimir Kondratiev , Alexios Zavras , Paul Cercueil , Zhou Yanjie , =?utf-8?b?5ZGo55Cw5p2wIChaaG91IFlh?= =?utf-8?q?njie=29?= , YunQiang Su , Arnd Bergmann , Serge Semin , Matt Redfearn , Richard Fontana , Steve Winslow , afzal mohammed , Peter Xu , Kamal Dasu , Oleksij Rempel , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, oprofile-list@lists.sf.net, linux-pm@vger.kernel.org Subject: [PATCH v2 04/11] arch_topology: Reset all cpus in reset_cpu_topology Date: Sun, 12 Apr 2020 11:20:34 +0800 Message-Id: <20200412032123.3896114-5-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> References: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org For MIPS platform, when topology isn't probed by DeviceTree, possible_cpu might be empty when calling init_cpu_topology, that may result cpu_topology not fully reseted for all CPUs. So here we can reset all cpus instead of possible cpus. Signed-off-by: Jiaxun Yang --- v2: Use ARRAY_SIZE instead of NR_CPUS. --- drivers/base/arch_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 13dc4fbf043f..e7912d0a875e 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -536,7 +536,7 @@ void __init reset_cpu_topology(void) { unsigned int cpu; - for_each_possible_cpu(cpu) { + for (cpu = 0; cpu < ARRAY_SIZE(cpu_topology); cpu++) { struct cpu_topology *cpu_topo = &cpu_topology[cpu]; cpu_topo->thread_id = -1; From patchwork Sun Apr 12 03:20:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 212331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2889C2D0EC for ; Sun, 12 Apr 2020 03:37:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40D9720739 for ; Sun, 12 Apr 2020 03:37:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="GKhi1J6x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726689AbgDLDhX (ORCPT ); Sat, 11 Apr 2020 23:37:23 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:55244 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbgDLDhW (ORCPT ); Sat, 11 Apr 2020 23:37:22 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id 8A55220D18; Sun, 12 Apr 2020 03:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1586662022; bh=CwxSJACN9kfWOFrwE500WiFJJVxkNDeXPqXpee2bVhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKhi1J6xCqXtUnSfbyh3dYyalSndsb49LrD4EakclPIBDqIcBMl+470NUJakB1z84 o9KVhJ4vvLiHhPuQpXtt3MX3mRBo62KA1tLbKt55kJ4C6JveY0+8XjM7gglXAez+6c vzuo4rbXuFg8WWWJcM4AwAayP2wu81WWVPcyjkgv/cnCEZUdgDGNlDVM1M8bdnLnnP BU/aorVLYwQvFoKR4yWB1msfyNAfCsV4ga0mUICzV1hhx9YmjRUZGhguZULecXp1xe PqCEnV8U+iDoxPgCjLF2riICs4zsC29ADSXDbBmBFvP1g2PohEt5pQbAOxHAciVDYD 5rWu+wAwfMG8g== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: dietmar.eggemann@arm.com, Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Florian Fainelli , Robert Richter , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Paul Burton , Allison Randal , Enrico Weigelt , Kate Stewart , Vladimir Kondratiev , Paul Cercueil , Zhou Yanjie , =?utf-8?b?5ZGo55Cw5p2wIChaaG91IFlh?= =?utf-8?q?njie=29?= , YunQiang Su , Arnd Bergmann , Serge Semin , Matt Redfearn , Steve Winslow , Alexios Zavras , Richard Fontana , Peter Xu , afzal mohammed , Kamal Dasu , Oleksij Rempel , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, oprofile-list@lists.sf.net, linux-pm@vger.kernel.org Subject: [PATCH v2 05/11] MIPS: Switch to arch_topology Date: Sun, 12 Apr 2020 11:20:35 +0800 Message-Id: <20200412032123.3896114-6-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> References: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Previously, MIPS is using self-defined "globalnumber" in struct mips_cpuinfo to store topology information. However, it's not friendly to DeviceTree based systems and lack of cpu_capacity related feature which can take advantage of multi-cluster system. Here, we enabled arch_topology for MIPS and adapted some functions to fit arch_topology structure. Also, we implmented smp_store_cpu_info to probe CPU's topology information by "globalnumber" registers in VP ASE or Ebase.CPUNum for legacy systems. Signed-off-by: Jiaxun Yang --- v2: - Squash header fix into this commit. - Provide dummy functions for no-SMP config, CM code requires them. (Thanks to 0-day CI for discover this) --- arch/mips/Kconfig | 1 + arch/mips/include/asm/cpu-info.h | 49 ---------------- arch/mips/include/asm/mach-ip27/mmzone.h | 2 + arch/mips/include/asm/mach-ip27/topology.h | 2 + arch/mips/include/asm/smp.h | 2 - arch/mips/include/asm/sn/addrs.h | 1 + arch/mips/include/asm/topology.h | 68 ++++++++++++++++++++-- arch/mips/kernel/cpu-probe.c | 43 -------------- arch/mips/kernel/setup.c | 1 + arch/mips/kernel/smp.c | 55 ++--------------- arch/mips/kernel/topology.c | 42 +++++++++++++ 11 files changed, 118 insertions(+), 148 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 690718b3701a..66b57e9f2b4d 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -20,6 +20,7 @@ config MIPS select CLONE_BACKWARDS select CPU_NO_EFFICIENT_FFS if (TARGET_ISA_REV < 1) select CPU_PM if CPU_IDLE + select GENERIC_ARCH_TOPOLOGY if SMP select GENERIC_ATOMIC64 if !64BIT select GENERIC_CLOCKEVENTS select GENERIC_CMOS_UPDATE diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h index ed7ffe4e63a3..7140a3e61ce3 100644 --- a/arch/mips/include/asm/cpu-info.h +++ b/arch/mips/include/asm/cpu-info.h @@ -78,8 +78,6 @@ struct cpuinfo_mips { struct cache_desc scache; /* Secondary cache */ struct cache_desc tcache; /* Tertiary/split secondary cache */ int srsets; /* Shadow register sets */ - int package;/* physical package number */ - unsigned int globalnumber; #ifdef CONFIG_64BIT int vmbits; /* Virtual memory size in bits */ #endif @@ -139,53 +137,6 @@ struct proc_cpuinfo_notifier_args { unsigned long n; }; -static inline unsigned int cpu_cluster(struct cpuinfo_mips *cpuinfo) -{ - /* Optimisation for systems where multiple clusters aren't used */ - if (!IS_ENABLED(CONFIG_CPU_MIPSR6)) - return 0; - - return (cpuinfo->globalnumber & MIPS_GLOBALNUMBER_CLUSTER) >> - MIPS_GLOBALNUMBER_CLUSTER_SHF; -} - -static inline unsigned int cpu_core(struct cpuinfo_mips *cpuinfo) -{ - return (cpuinfo->globalnumber & MIPS_GLOBALNUMBER_CORE) >> - MIPS_GLOBALNUMBER_CORE_SHF; -} - -static inline unsigned int cpu_vpe_id(struct cpuinfo_mips *cpuinfo) -{ - /* Optimisation for systems where VP(E)s aren't used */ - if (!IS_ENABLED(CONFIG_MIPS_MT_SMP) && !IS_ENABLED(CONFIG_CPU_MIPSR6)) - return 0; - - return (cpuinfo->globalnumber & MIPS_GLOBALNUMBER_VP) >> - MIPS_GLOBALNUMBER_VP_SHF; -} - -extern void cpu_set_cluster(struct cpuinfo_mips *cpuinfo, unsigned int cluster); -extern void cpu_set_core(struct cpuinfo_mips *cpuinfo, unsigned int core); -extern void cpu_set_vpe_id(struct cpuinfo_mips *cpuinfo, unsigned int vpe); - -static inline bool cpus_are_siblings(int cpua, int cpub) -{ - struct cpuinfo_mips *infoa = &cpu_data[cpua]; - struct cpuinfo_mips *infob = &cpu_data[cpub]; - unsigned int gnuma, gnumb; - - if (infoa->package != infob->package) - return false; - - gnuma = infoa->globalnumber & ~MIPS_GLOBALNUMBER_VP; - gnumb = infob->globalnumber & ~MIPS_GLOBALNUMBER_VP; - if (gnuma != gnumb) - return false; - - return true; -} - static inline unsigned long cpu_asid_inc(void) { return 1 << CONFIG_MIPS_ASID_SHIFT; diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h index 08c36e50a860..e0a53b97b4a8 100644 --- a/arch/mips/include/asm/mach-ip27/mmzone.h +++ b/arch/mips/include/asm/mach-ip27/mmzone.h @@ -2,6 +2,8 @@ #ifndef _ASM_MACH_MMZONE_H #define _ASM_MACH_MMZONE_H +#include + #include #include #include diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h index d66cc53feab8..601e350908f7 100644 --- a/arch/mips/include/asm/mach-ip27/topology.h +++ b/arch/mips/include/asm/mach-ip27/topology.h @@ -2,6 +2,8 @@ #ifndef _ASM_MACH_TOPOLOGY_H #define _ASM_MACH_TOPOLOGY_H 1 +#include + #include #include diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 7990c1c70471..538e73f6bab0 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h @@ -21,8 +21,6 @@ #include extern int smp_num_siblings; -extern cpumask_t cpu_sibling_map[]; -extern cpumask_t cpu_core_map[]; extern cpumask_t cpu_foreign_map[]; static inline int raw_smp_processor_id(void) diff --git a/arch/mips/include/asm/sn/addrs.h b/arch/mips/include/asm/sn/addrs.h index 837d23e24976..1d3945ef2ca4 100644 --- a/arch/mips/include/asm/sn/addrs.h +++ b/arch/mips/include/asm/sn/addrs.h @@ -13,6 +13,7 @@ #ifndef __ASSEMBLY__ #include #include +#include #endif /* !__ASSEMBLY__ */ #include diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h index 0673d2d0f2e6..0f27a00df56d 100644 --- a/arch/mips/include/asm/topology.h +++ b/arch/mips/include/asm/topology.h @@ -9,13 +9,71 @@ #define __ASM_TOPOLOGY_H #include +#include #include -#ifdef CONFIG_SMP -#define topology_physical_package_id(cpu) (cpu_data[cpu].package) -#define topology_core_id(cpu) (cpu_core(&cpu_data[cpu])) -#define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) -#define topology_sibling_cpumask(cpu) (&cpu_sibling_map[cpu]) +#if defined(CONFIG_SMP) +static inline bool cpus_are_siblings(int cpua, int cpub) +{ + return cpumask_test_cpu(cpua, topology_sibling_cpumask(cpub)); +} + +static inline unsigned int cpu_cluster(int cpu) +{ + return cpu_topology[cpu].package_id; +} + +static inline unsigned int cpu_core(int cpu) +{ + return cpu_topology[cpu].core_id; +} + +static inline unsigned int cpu_vpe_id(int cpu) +{ + int id = cpu_topology[cpu].thread_id; + + /* Uniprocessor system may get -1, but for hardware it's 0 */ + if (id == -1) + return 0; + + return id; +} + +static inline void cpu_set_cluster(int cpu, unsigned int cluster) +{ + cpu_topology[cpu].package_id = cluster; +} + +static inline void cpu_set_core(int cpu, unsigned int core) +{ + cpu_topology[cpu].core_id = core; +} + +static inline void cpu_set_vpe_id(int cpu, unsigned int vpe) +{ + cpu_topology[cpu].thread_id = vpe; +} +#else +static inline void init_cpu_topology(void) { } +static inline bool cpus_are_siblings(int cpua, int cpub) +{ + return false; +} + +static inline unsigned int cpu_cluster(int cpu) +{ + return 0; +} + +static inline unsigned int cpu_core(int cpu) +{ + return 0; +} + +static inline unsigned int cpu_vpe_id(int cpu) +{ + return 0; +} #endif #endif /* __ASM_TOPOLOGY_H */ diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index f21a2304401f..eead35e5dbfd 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1042,17 +1042,6 @@ static void decode_configs(struct cpuinfo_mips *c) set_ftlb_enable(c, (mips_ftlb_disabled ? 0 : FTLB_EN) | FTLB_SET_PROB); mips_probe_watch_registers(c); - -#ifndef CONFIG_MIPS_CPS - if (cpu_has_mips_r2_r6) { - unsigned int core; - - core = get_ebase_cpunum(); - if (cpu_has_mipsmt) - core >>= fls(core_nvpes()) - 1; - cpu_set_core(c, core); - } -#endif } /* @@ -2303,35 +2292,3 @@ void cpu_report(void) if (cpu_has_msa) pr_info("MSA revision is: %08x\n", c->msa_id); } - -void cpu_set_cluster(struct cpuinfo_mips *cpuinfo, unsigned int cluster) -{ - /* Ensure the core number fits in the field */ - WARN_ON(cluster > (MIPS_GLOBALNUMBER_CLUSTER >> - MIPS_GLOBALNUMBER_CLUSTER_SHF)); - - cpuinfo->globalnumber &= ~MIPS_GLOBALNUMBER_CLUSTER; - cpuinfo->globalnumber |= cluster << MIPS_GLOBALNUMBER_CLUSTER_SHF; -} - -void cpu_set_core(struct cpuinfo_mips *cpuinfo, unsigned int core) -{ - /* Ensure the core number fits in the field */ - WARN_ON(core > (MIPS_GLOBALNUMBER_CORE >> MIPS_GLOBALNUMBER_CORE_SHF)); - - cpuinfo->globalnumber &= ~MIPS_GLOBALNUMBER_CORE; - cpuinfo->globalnumber |= core << MIPS_GLOBALNUMBER_CORE_SHF; -} - -void cpu_set_vpe_id(struct cpuinfo_mips *cpuinfo, unsigned int vpe) -{ - /* Ensure the VP(E) ID fits in the field */ - WARN_ON(vpe > (MIPS_GLOBALNUMBER_VP >> MIPS_GLOBALNUMBER_VP_SHF)); - - /* Ensure we're not using VP(E)s without support */ - WARN_ON(vpe && !IS_ENABLED(CONFIG_MIPS_MT_SMP) && - !IS_ENABLED(CONFIG_CPU_MIPSR6)); - - cpuinfo->globalnumber &= ~MIPS_GLOBALNUMBER_VP; - cpuinfo->globalnumber |= vpe << MIPS_GLOBALNUMBER_VP_SHF; -} diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 8a418783a6bb..b9fefc5dc702 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -784,6 +784,7 @@ void __init setup_arch(char **cmdline_p) dmi_setup(); resource_init(); + init_cpu_topology(); plat_smp_setup(); cpu_cache_init(); diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 48d84d5fcc36..4896d6ecc719 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -47,10 +48,6 @@ EXPORT_SYMBOL(__cpu_logical_map); int smp_num_siblings = 1; EXPORT_SYMBOL(smp_num_siblings); -/* representing the TCs (or siblings in Intel speak) of each logical CPU */ -cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; -EXPORT_SYMBOL(cpu_sibling_map); - /* representing the core map of multi-core chips of each logical CPU */ cpumask_t cpu_core_map[NR_CPUS] __read_mostly; EXPORT_SYMBOL(cpu_core_map); @@ -65,12 +62,6 @@ static DECLARE_COMPLETION(cpu_running); cpumask_t cpu_foreign_map[NR_CPUS] __read_mostly; EXPORT_SYMBOL(cpu_foreign_map); -/* representing cpus for which sibling maps can be computed */ -static cpumask_t cpu_sibling_setup_map; - -/* representing cpus for which core maps can be computed */ -static cpumask_t cpu_core_setup_map; - cpumask_t cpu_coherent_mask; #ifdef CONFIG_GENERIC_IRQ_IPI @@ -78,37 +69,6 @@ static struct irq_desc *call_desc; static struct irq_desc *sched_desc; #endif -static inline void set_cpu_sibling_map(int cpu) -{ - int i; - - cpumask_set_cpu(cpu, &cpu_sibling_setup_map); - - if (smp_num_siblings > 1) { - for_each_cpu(i, &cpu_sibling_setup_map) { - if (cpus_are_siblings(cpu, i)) { - cpumask_set_cpu(i, &cpu_sibling_map[cpu]); - cpumask_set_cpu(cpu, &cpu_sibling_map[i]); - } - } - } else - cpumask_set_cpu(cpu, &cpu_sibling_map[cpu]); -} - -static inline void set_cpu_core_map(int cpu) -{ - int i; - - cpumask_set_cpu(cpu, &cpu_core_setup_map); - - for_each_cpu(i, &cpu_core_setup_map) { - if (cpu_data[cpu].package == cpu_data[i].package) { - cpumask_set_cpu(i, &cpu_core_map[cpu]); - cpumask_set_cpu(cpu, &cpu_core_map[i]); - } - } -} - /* * Calculate a new cpu_foreign_map mask whenever a * new cpu appears or disappears. @@ -131,7 +91,7 @@ void calculate_cpu_foreign_map(void) for_each_online_cpu(i) cpumask_andnot(&cpu_foreign_map[i], - &temp_foreign_map, &cpu_sibling_map[i]); + &temp_foreign_map, topology_sibling_cpumask(i)); } const struct plat_smp_ops *mp_ops; @@ -177,7 +137,7 @@ void mips_smp_send_ipi_mask(const struct cpumask *mask, unsigned int action) if (cpus_are_siblings(cpu, smp_processor_id())) continue; - core = cpu_core(&cpu_data[cpu]); + core = cpu_core(cpu); while (!cpumask_test_cpu(cpu, &cpu_coherent_mask)) { mips_cm_lock_other_cpu(cpu, CM_GCR_Cx_OTHER_BLOCK_LOCAL); @@ -340,6 +300,8 @@ asmlinkage void start_secondary(void) mips_clockevent_init(); mp_ops->init_secondary(); cpu_report(); + cpu = smp_processor_id(); + store_cpu_topology(cpu); maar_init(); /* @@ -349,7 +311,6 @@ asmlinkage void start_secondary(void) calibrate_delay(); preempt_disable(); - cpu = smp_processor_id(); cpu_data[cpu].udelay_val = loops_per_jiffy; cpumask_set_cpu(cpu, &cpu_coherent_mask); @@ -363,9 +324,6 @@ asmlinkage void start_secondary(void) /* The CPU is running and counters synchronised, now mark it online */ set_cpu_online(cpu, true); - set_cpu_sibling_map(cpu); - set_cpu_core_map(cpu); - calculate_cpu_foreign_map(); /* @@ -411,8 +369,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) init_new_context(current, &init_mm); current_thread_info()->cpu = 0; mp_ops->prepare_cpus(max_cpus); - set_cpu_sibling_map(0); - set_cpu_core_map(0); + store_cpu_topology(0); calculate_cpu_foreign_map(); #ifndef CONFIG_HOTPLUG_CPU init_cpu_present(cpu_possible_mask); diff --git a/arch/mips/kernel/topology.c b/arch/mips/kernel/topology.c index cd3e1f82e1a5..112482de8187 100644 --- a/arch/mips/kernel/topology.c +++ b/arch/mips/kernel/topology.c @@ -31,3 +31,45 @@ static int __init topology_init(void) } subsys_initcall(topology_init); + +#if defined(CONFIG_SMP) +void store_cpu_topology(unsigned int cpuid) +{ + struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; + + if (cpuid_topo->package_id != -1) + goto topology_populated; + + if (cpu_has_vp) { + u32 gn = read_c0_globalnumber(); + + cpuid_topo->thread_id = (gn & MIPS_GLOBALNUMBER_VP) >> + MIPS_GLOBALNUMBER_VP_SHF; + cpuid_topo->core_id = (gn & MIPS_GLOBALNUMBER_CORE) >> + MIPS_GLOBALNUMBER_CORE_SHF; + cpuid_topo->package_id = (gn & MIPS_GLOBALNUMBER_CLUSTER) >> + MIPS_GLOBALNUMBER_CLUSTER_SHF; + } else { + int hwid; + + if (cpu_has_mips_r2_r6) + hwid = get_ebase_cpunum(); + else + hwid = cpuid; /* Assume hwid = cpuid */ + + if (smp_num_siblings == 1) + cpuid_topo->thread_id = -1; + else + cpuid_topo->thread_id = hwid % smp_num_siblings; + + cpuid_topo->core_id = hwid / smp_num_siblings; + /* Platform code will handle multi-cluster case */ + cpuid_topo->package_id = 0; + } + +topology_populated: + update_siblings_masks(cpuid); + pr_info("Topology: CPU %d: cluster: %d, core: %d, vpe: %d\n", cpuid, + cpu_cluster(cpuid), cpu_core(cpuid), cpu_vpe_id(cpuid)); +} +#endif From patchwork Sun Apr 12 03:20:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 212336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D640C2D0EC for ; Sun, 12 Apr 2020 03:29:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0343620739 for ; Sun, 12 Apr 2020 03:29:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="X2NSAqDv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726708AbgDLD3a (ORCPT ); Sat, 11 Apr 2020 23:29:30 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:54974 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbgDLD3a (ORCPT ); Sat, 11 Apr 2020 23:29:30 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id B747520D23; Sun, 12 Apr 2020 03:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1586662170; bh=BOc6QgkrNBLeLZl+hvilMEjIegxaLYZEaLH0YSkmRQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X2NSAqDvYKwfd8rwogqVTj+Je0hAWBgYxpakWNlLoUsDtToRGFZKv/msuqGBGnlLX H1g+Rcbs4Hmlh5Y1nBkP003a7tSdCOYMLbqGZVSAABE5mP91z/GaV+9/mwlMMG6Gri 9yIn4aWtn1bo8riNUEDyA3aZxBchuHVGa1vpjX0ztIOBv/Jrfxd/T0fMv3NKM9qpcZ GklkisndpvtsI8aZCgOukbG6762Tv/9axoZHdGZPcrcLfrjUqGJj54pUlllBky/2h/ FhSrMUGY4/poOr8QkJYpk/TR9tzM/Lrdc4vSPIa2yqVR/HT0QMdf/9Cd/B+UdHDMAQ GhAHxQ4HFzD6w== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: dietmar.eggemann@arm.com, Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Florian Fainelli , Robert Richter , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Paul Burton , Allison Randal , Kate Stewart , Vladimir Kondratiev , Alexios Zavras , Paul Cercueil , Zhou Yanjie , =?utf-8?b?5ZGo55Cw5p2wIChaaG91IFlh?= =?utf-8?q?njie=29?= , YunQiang Su , Arnd Bergmann , Serge Semin , Enrico Weigelt , Matt Redfearn , Richard Fontana , Steve Winslow , Peter Xu , afzal mohammed , Oleksij Rempel , Kamal Dasu , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, oprofile-list@lists.sf.net, linux-pm@vger.kernel.org Subject: [PATCH v2 08/11] irqchip: mips-cpu: Switch to new topology interface Date: Sun, 12 Apr 2020 11:20:38 +0800 Message-Id: <20200412032123.3896114-9-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> References: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Change the parameter of cpu_vpe_id from cpu_data to cpuid. Signed-off-by: Jiaxun Yang --- drivers/irqchip/irq-mips-cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-mips-cpu.c b/drivers/irqchip/irq-mips-cpu.c index 95d4fd8f7a96..eed3edf8480b 100644 --- a/drivers/irqchip/irq-mips-cpu.c +++ b/drivers/irqchip/irq-mips-cpu.c @@ -100,7 +100,7 @@ static void mips_mt_send_ipi(struct irq_data *d, unsigned int cpu) WARN_ON(!cpus_are_siblings(smp_processor_id(), cpu)); vpflags = dvpe(); - settc(cpu_vpe_id(&cpu_data[cpu])); + settc(cpu_vpe_id(cpu)); write_vpe_c0_cause(read_vpe_c0_cause() | (C_SW0 << hwirq)); evpe(vpflags); From patchwork Sun Apr 12 03:20:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 212335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AB27C2BB85 for ; Sun, 12 Apr 2020 03:31:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35B2A20739 for ; Sun, 12 Apr 2020 03:31:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="AguW/aEn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbgDLDbK (ORCPT ); Sat, 11 Apr 2020 23:31:10 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:55098 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726565AbgDLDbJ (ORCPT ); Sat, 11 Apr 2020 23:31:09 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id C95F420D2B; Sun, 12 Apr 2020 03:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1586662270; bh=ZVoEHgyxwKRnpz9YM+7JK0CgnU+b6VSlDxJRGNc9WhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AguW/aEn9egIUVf9Xs/nZ5oJzpXDA+gH+31H66p/dgAjejW5GZBsekpFsfshFyn1/ Q/7+38hfghIhqY7aWWUphwB01sJsYYQSoQ4zoftpqR8/T17hwt7yebt5/4yKQCDAaE 3J/V1guU57bOZGpQvEEfacr3dbG6+iRtebHsV9hHfMBBbJbS3OzqoV+mRjYSUPU67m Z4XrMASt7salrpbY8/x9z8SNk0LHVLdeHRT21uD8UBOzR7H1imATE05DT3jPzLzVp6 D0+pr6x8u70Q7CayGX2NbOd7e2fJAcjXcO+fGJxu/6ljl74DBo9cH/UMcUV5RaWJeK LQhxAdnggTMYw== From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: dietmar.eggemann@arm.com, Jiaxun Yang , Thomas Bogendoerfer , Huacai Chen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Florian Fainelli , Robert Richter , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Paul Burton , Allison Randal , Kate Stewart , Enrico Weigelt , Vladimir Kondratiev , Richard Fontana , Paul Cercueil , Zhou Yanjie , =?utf-8?b?5ZGo55Cw5p2wIChaaG91IFlhbmppZSk=?= , YunQiang Su , Arnd Bergmann , Serge Semin , Matt Redfearn , Alexios Zavras , Steve Winslow , afzal mohammed , Peter Xu , Mike Rapoport , Kamal Dasu , Oleksij Rempel , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, oprofile-list@lists.sf.net, linux-pm@vger.kernel.org Subject: [PATCH v2 10/11] MIPS: nlm: Switch to new topology interface Date: Sun, 12 Apr 2020 11:20:40 +0800 Message-Id: <20200412032123.3896114-11-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> References: <20200412032123.3896114-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use new functions to set core_id & cluster_id. Signed-off-by: Jiaxun Yang --- arch/mips/netlogic/common/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c index 39a300bd6cc2..14bfa8a099cc 100644 --- a/arch/mips/netlogic/common/smp.c +++ b/arch/mips/netlogic/common/smp.c @@ -122,8 +122,8 @@ static void nlm_init_secondary(void) int hwtid; hwtid = hard_smp_processor_id(); - cpu_set_core(¤t_cpu_data, hwtid / NLM_THREADS_PER_CORE); - current_cpu_data.package = nlm_nodeid(); + cpu_set_core(smp_processor_id(), hwtid / NLM_THREADS_PER_CORE); + cpu_set_cluster(smp_processor_id(), nlm_nodeid()); nlm_percpu_init(hwtid); nlm_smp_irq_init(hwtid); }