Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2097267ybb; Sat, 11 Apr 2020 20:34:22 -0700 (PDT) X-Google-Smtp-Source: APiQypJqa2xUfN5OuR7F4V0Poeh0lL0n6jAqQowRmZxiccL4FPFM1T2T6vYN7BxLTZie7f14qW8Z X-Received: by 2002:ae9:dfc5:: with SMTP id t188mr5731qkf.384.1586662462700; Sat, 11 Apr 2020 20:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586662462; cv=none; d=google.com; s=arc-20160816; b=gOwmbHYGWJ/4TWLvXxKjzjyY0avW6iTIw+BZe93Y2Y6qXBab576yVVP9/LhlwVPgEi z012elLUI9MPhzl84KYyK4Gktb0jgMzpKJ8RwV+jOyioG+6ktR5lo89vw8b5BcNcnoQi I/3sICKePt3TVckRujKS9Y/kpWOQEs24lWaPk8fj6ws/vaSzFBgbLy4MSSGqL9UUZZbO INoE4PGMJS5yKNlYaf4tzn5b8Gm4BVFQYuuL1foNmRvtjF8WBoD5Btpb2doCSQLKycke uXFlIMbjZVz8FSXZr6OBuLOuVp++fxDHdrfYMssTKTm5Rq8JGfoHHsq6SU2FeIpMbNJw H/Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4Rffoa1dXYXKyFc6xwkFUct2uOpMNbKHHJfRAT2RHMg=; b=jIwhNWh5pgaul/f2kVKqI2xnkk/JDaNiRd/ilLyG973DC29dpGgzyHRHeLK2c3kjGP jVyWfK2bwr68novRlFnxOd+GAAUJCPNDYVxV43RlISVQAS0cIFlj4jSs6AXQhs2Lk8qL HVTKT/286JfxHF9ufLlltvh4lHm3aYCzp/6jpWjt7g2BZFhzzc0O0XSqQdR980FcYoYJ voEAwDzMT0nxtDZF3lIDjTymPC8X7ulwBCJh0A5sfnJCZ5NcdNllKSEPjXxbO2NNafB4 pQYYy7fUXQ0Zt7JTnafy7qdicjZa8Ey5b6+w4kJpuAeuSQZ6SNJO8TDt1jJS/lWTa780 W9BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b=TR4jBpFW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19si4109075qkf.36.2020.04.11.20.34.07; Sat, 11 Apr 2020 20:34:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b=TR4jBpFW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726890AbgDLDb7 (ORCPT + 99 others); Sat, 11 Apr 2020 23:31:59 -0400 Received: from vultr.net.flygoat.com ([149.28.68.211]:55160 "EHLO vultr.net.flygoat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726565AbgDLDb7 (ORCPT ); Sat, 11 Apr 2020 23:31:59 -0400 Received: from localhost.localdomain (unknown [IPv6:2001:da8:20f:4430:250:56ff:fe9a:7470]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id 620A320D2F; Sun, 12 Apr 2020 03:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1586662319; bh=GNiO8NpbsZIQ1ef9HBb53eMl+oqmvusfYXjRpJzyMrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TR4jBpFW/bSc8nY54KdLEzy08OdLxNizV+H1QqlnjFfDMncihdg5Cdiqgg92EjSNP g8iyKJgIA68vaWhPKljTMUPcgzg6eISoQx5m7sOwARSgCLlu7VqanhbGgXJcpFGrU/ i/LFsYXncft53843fmBwGDl2v+ZcNgc8MN8OwdY3ra2iErr/UrV4kGcbmsYz+zBgvZ QXimsKQqofCNHaOh3cMYxVaxeOIF8yIu7qRPgu/94hWchJHGHaOQsGNYtkS40tv5lc S9Qu+pgnCJoM7opU0XJscSJlnknQeThG66epsaSnbtN4wz5D/Br6fRr03vfc6NNGFt 6+YpLhViVBhBg== 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?q?=E5=91=A8=E7=90=B0=E6=9D=B0=20=28Zhou=20Yanjie=29?= , YunQiang Su , Arnd Bergmann , Serge Semin , Enrico Weigelt , Matt Redfearn , Richard Fontana , Steve Winslow , Peter Xu , afzal mohammed , Oleksij Rempel , Mike Rapoport , 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 11/11] MIPS: Loongson64: Switch to new topology interface Date: Sun, 12 Apr 2020 11:20:41 +0800 Message-Id: <20200412032123.3896114-12-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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new interface to setup topology information. Signed-off-by: Jiaxun Yang --- .../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 + #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