lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200412032123.3896114-12-jiaxun.yang@flygoat.com>
Date:   Sun, 12 Apr 2020 11:20:41 +0800
From:   Jiaxun Yang <jiaxun.yang@...goat.com>
To:     linux-mips@...r.kernel.org
Cc:     dietmar.eggemann@....com, Jiaxun Yang <jiaxun.yang@...goat.com>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Huacai Chen <chenhc@...ote.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Robert Richter <rric@...nel.org>,
        Sudeep Holla <sudeep.holla@....com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jason Cooper <jason@...edaemon.net>,
        Marc Zyngier <maz@...nel.org>,
        Paul Burton <paulburton@...nel.org>,
        Allison Randal <allison@...utok.net>,
        Kate Stewart <kstewart@...uxfoundation.org>,
        Vladimir Kondratiev <vladimir.kondratiev@...el.com>,
        Alexios Zavras <alexios.zavras@...el.com>,
        Paul Cercueil <paul@...pouillou.net>,
        Zhou Yanjie <zhouyanjie@...o.com>,
        周琰杰 (Zhou Yanjie) 
        <zhouyanjie@...yeetech.com>, YunQiang Su <syq@...ian.org>,
        Arnd Bergmann <arnd@...db.de>,
        Serge Semin <fancer.lancer@...il.com>,
        Enrico Weigelt <info@...ux.net>,
        Matt Redfearn <matt.redfearn@...s.com>,
        Richard Fontana <rfontana@...hat.com>,
        Steve Winslow <swinslow@...il.com>,
        Peter Xu <peterx@...hat.com>,
        afzal mohammed <afzal.mohd.ma@...il.com>,
        Oleksij Rempel <linux@...pel-privat.de>,
        Mike Rapoport <rppt@...ux.ibm.com>,
        Kamal Dasu <kdasu.kdev@...il.com>,
        linux-kernel@...r.kernel.org,
        bcm-kernel-feedback-list@...adcom.com, oprofile-list@...ts.sf.net,
        linux-pm@...r.kernel.org
Subject: [PATCH v2 11/11] MIPS: Loongson64: Switch to new topology interface

Use the new interface to setup topology information.

Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
---
 .../include/asm/mach-loongson64/topology.h    |  2 ++
 arch/mips/loongson64/smp.c                    | 20 +++++++++----------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h
index 3414a1fd1783..999464ed0c20 100644
--- a/arch/mips/include/asm/mach-loongson64/topology.h
+++ b/arch/mips/include/asm/mach-loongson64/topology.h
@@ -2,6 +2,8 @@
 #ifndef _ASM_MACH_TOPOLOGY_H
 #define _ASM_MACH_TOPOLOGY_H
 
+#include <linux/numa.h>
+
 #ifdef CONFIG_NUMA
 
 #define cpu_to_node(cpu)	(cpu_logical_map(cpu) >> 2)
diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c
index e1fe8bbb377d..bb37d0a7e79c 100644
--- a/arch/mips/loongson64/smp.c
+++ b/arch/mips/loongson64/smp.c
@@ -353,10 +353,10 @@ static void loongson3_init_secondary(void)
 		loongson3_ipi_write32(0xffffffff, ipi_en0_regs[cpu_logical_map(i)]);
 
 	per_cpu(cpu_state, cpu) = CPU_ONLINE;
-	cpu_set_core(&cpu_data[cpu],
+	cpu_set_core(cpu,
 		     cpu_logical_map(cpu) % loongson_sysconf.cores_per_package);
-	cpu_data[cpu].package =
-		cpu_logical_map(cpu) / loongson_sysconf.cores_per_package;
+	cpu_set_cluster(cpu,
+			cpu_logical_map(cpu) / loongson_sysconf.cores_per_package);
 
 	i = 0;
 	core0_c0count[cpu] = 0;
@@ -368,7 +368,7 @@ static void loongson3_init_secondary(void)
 
 	if (i > MAX_LOOPS)
 		i = MAX_LOOPS;
-	if (cpu_data[cpu].package)
+	if (cpu_cluster(cpu))
 		initcount = core0_c0count[cpu] + i;
 	else /* Local access is faster for loops */
 		initcount = core0_c0count[cpu] + i/2;
@@ -421,9 +421,9 @@ static void __init loongson3_smp_setup(void)
 	ipi_status0_regs_init();
 	ipi_en0_regs_init();
 	ipi_mailbox_buf_init();
-	cpu_set_core(&cpu_data[0],
+	cpu_set_core(0,
 		     cpu_logical_map(0) % loongson_sysconf.cores_per_package);
-	cpu_data[0].package = cpu_logical_map(0) / loongson_sysconf.cores_per_package;
+	cpu_set_cluster(0, cpu_logical_map(0) / loongson_sysconf.cores_per_package);
 }
 
 static void __init loongson3_prepare_cpus(unsigned int max_cpus)
@@ -752,8 +752,8 @@ void play_dead(void)
 
 static int loongson3_disable_clock(unsigned int cpu)
 {
-	uint64_t core_id = cpu_core(&cpu_data[cpu]);
-	uint64_t package_id = cpu_data[cpu].package;
+	uint64_t core_id = cpu_core(cpu);
+	uint64_t package_id = cpu_cluster(cpu);
 
 	if ((read_c0_prid() & PRID_REV_MASK) == PRID_REV_LOONGSON3A_R1) {
 		LOONGSON_CHIPCFG(package_id) &= ~(1 << (12 + core_id));
@@ -766,8 +766,8 @@ static int loongson3_disable_clock(unsigned int cpu)
 
 static int loongson3_enable_clock(unsigned int cpu)
 {
-	uint64_t core_id = cpu_core(&cpu_data[cpu]);
-	uint64_t package_id = cpu_data[cpu].package;
+	uint64_t core_id = cpu_core(cpu);
+	uint64_t package_id = cpu_cluster(cpu);
 
 	if ((read_c0_prid() & PRID_REV_MASK) == PRID_REV_LOONGSON3A_R1) {
 		LOONGSON_CHIPCFG(package_id) |= 1 << (12 + core_id);
-- 
2.26.0.rc2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ