Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp625939ybb; Wed, 8 Apr 2020 06:49:40 -0700 (PDT) X-Google-Smtp-Source: APiQypI2h8qFQIpUsPVZn9+cFKIiZNTQbOI3FSPBAgUQVFgVbtPGQ7OnAbw/FgcycIoZ2xjyjDF6 X-Received: by 2002:aca:c78d:: with SMTP id x135mr2427802oif.51.1586353780197; Wed, 08 Apr 2020 06:49:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1586353780; cv=pass; d=google.com; s=arc-20160816; b=rffUhGuRdOIMCh4bRh/7mytcGFSw24h3MOBZlCWbiJv6Qa4RIBbDi8XQ7dwJSzxFAn N2jPw+5/lxZW6jqSKEhYXFyASHNotn0IcpH0J5CyGtB8Vx0Tmmfu41oot2ZXIyxiXSiL EXDIY933rF/YXXm5WiJPZpxo/AFNg+rNnFWfvVbtI3qyk61oW5lniWfgO6nGZwJL4gjF eqso9VbS/4Yps5+Rp9X7rvcXjYzism9SAgzSLi8NDA+eInk7T9MRvwu5SAwmThwmHBXA emT4qeON9fU7KchFr46wldqSgqq5Qbf5+vZ9BIWjwI8FN6cwcXC8kThdHvCI6/CUIkIi j3wA== ARC-Message-Signature: i=2; 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:date:subject:message-id:cc:to:from :dkim-signature; bh=Wb2cFU7L7AcultSr3wuDD9OjkWyYp8SDKu7wk5DT1vQ=; b=Qt2qnZEmFkbIDQo2scPPO2wiQFwfD+SCiuGgiTUZHtWx/Ycq7PcSPFf3Lsf0Uom5Zw HCPYGFwPNT04+LQI3U9QszM9BckcbuxEQ7CRSKsabeO3Z4/M2io8hK/4JskK/sj6njKI +gATq+4B8O88GvaQ6TwKuCR7Vv9KDf1jJdqmsQQPUewQMOxWMadpVm3hyk+n7i19KbA4 t9npTpBh9oUC3oYKiUZ2Ltrz1Ur7iiBw4kxxOcC2OjfJnyDLkBFy1Ol6ZhrljtbwE60a ANVG78U8nDHwaz/+3/sIKryqyCtCjlc5wtYW+MX5MH4gcBeDq/21dGJeigsK1ikV/6kn v/aw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=SIssDSqG; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dmarc=pass fromdomain=flygoat.com>); 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=pass (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 145si2180113oie.185.2020.04.08.06.49.26; Wed, 08 Apr 2020 06:49:40 -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=pass header.i=@flygoat.com header.s=mail header.b=SIssDSqG; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dmarc=pass fromdomain=flygoat.com>); 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=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728966AbgDHNFf (ORCPT + 99 others); Wed, 8 Apr 2020 09:05:35 -0400 Received: from sender3-op-o12.zoho.com.cn ([124.251.121.243]:17822 "EHLO sender3-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbgDHNFe (ORCPT ); Wed, 8 Apr 2020 09:05:34 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1586350997; cv=none; d=zoho.com.cn; s=zohoarc; b=qWDkOcrbjIfbp9iMEf0mjnuO7Pp9Uz2yiZqyIJuqirdubVysweKWVs3PqXtYhW9xxVZ99kgAjI2dxK63Ip8KAfGijVb7vasLyn5O/1kDd8o5yS6xycCNiR0ThfbRNt9Zrzjw4bla2vAzAnHlwPKTnfRKuViQGId3YkSbqFyIuvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1586350997; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Wb2cFU7L7AcultSr3wuDD9OjkWyYp8SDKu7wk5DT1vQ=; b=ltNgh+4ffb344wTWgr50j38RmgDo8CWkup9QoRv+Oymr/HLWGKF/F9MzpWHPz9+15RuTZ+PqrnuwBbgskKp/+uRN162H/Y6+5bJGuwb4SCMDjfXPPtZyVQh1wKYhyOXC7KiHHYDOX37r5sDwHG3BfgY8nEq/buQFyjBJ7HsjLJE= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=flygoat.com; spf=pass smtp.mailfrom=jiaxun.yang@flygoat.com; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1586350997; s=mail; d=flygoat.com; i=jiaxun.yang@flygoat.com; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=Wb2cFU7L7AcultSr3wuDD9OjkWyYp8SDKu7wk5DT1vQ=; b=SIssDSqGVxKUsmp2F5IwyFWJLHPm/2/JPZl89281ynWkamtxtqAcbAT7L1bT3SGn WSCq5pu0UCqwmXvvGD2QRBjmREi3vdCmDSf6JUmuKyCpmDwm6Jr1rGp0nKl3hqxrN97 K88LOsN9djlSMzi0u+TLE/rajbM0iy/FK9ixB0gw= Received: from localhost.localdomain (39.155.141.144 [39.155.141.144]) by mx.zoho.com.cn with SMTPS id 1586350994404844.9671026645353; Wed, 8 Apr 2020 21:03:14 +0800 (CST) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: 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 , Thomas Gleixner , Jason Cooper , Marc Zyngier , Paul Burton , Greg Kroah-Hartman , Allison Randal , Vladimir Kondratiev , Alexios Zavras , Arnd Bergmann , Serge Semin , Matt Redfearn , Steve Winslow , Richard Fontana , Mike Rapoport , Oleksij Rempel , Kamal Dasu , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, oprofile-list@lists.sf.net Message-ID: <20200408130024.2529220-6-jiaxun.yang@flygoat.com> Subject: [PATCH 11/12] MIPS: Loongson64: Switch to new topology interface Date: Wed, 8 Apr 2020 20:59:53 +0800 X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200408113505.2528103-1-jiaxun.yang@flygoat.com> References: <20200408113505.2528103-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 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/i= nclude/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 =20 +#include + #ifdef CONFIG_NUMA =20 #define cpu_to_node(cpu)=09(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) =09=09loongson3_ipi_write32(0xffffffff, ipi_en0_regs[cpu_logical_map(i)]); =20 =09per_cpu(cpu_state, cpu) =3D CPU_ONLINE; -=09cpu_set_core(&cpu_data[cpu], +=09cpu_set_core(cpu, =09=09 cpu_logical_map(cpu) % loongson_sysconf.cores_per_package); -=09cpu_data[cpu].package =3D -=09=09cpu_logical_map(cpu) / loongson_sysconf.cores_per_package; +=09cpu_set_cluster(cpu, +=09=09=09cpu_logical_map(cpu) / loongson_sysconf.cores_per_package); =20 =09i =3D 0; =09core0_c0count[cpu] =3D 0; @@ -368,7 +368,7 @@ static void loongson3_init_secondary(void) =20 =09if (i > MAX_LOOPS) =09=09i =3D MAX_LOOPS; -=09if (cpu_data[cpu].package) +=09if (cpu_cluster(cpu)) =09=09initcount =3D core0_c0count[cpu] + i; =09else /* Local access is faster for loops */ =09=09initcount =3D core0_c0count[cpu] + i/2; @@ -421,9 +421,9 @@ static void __init loongson3_smp_setup(void) =09ipi_status0_regs_init(); =09ipi_en0_regs_init(); =09ipi_mailbox_buf_init(); -=09cpu_set_core(&cpu_data[0], +=09cpu_set_core(0, =09=09 cpu_logical_map(0) % loongson_sysconf.cores_per_package); -=09cpu_data[0].package =3D cpu_logical_map(0) / loongson_sysconf.cores_per= _package; +=09cpu_set_cluster(0, cpu_logical_map(0) / loongson_sysconf.cores_per_pack= age); } =20 static void __init loongson3_prepare_cpus(unsigned int max_cpus) @@ -752,8 +752,8 @@ void play_dead(void) =20 static int loongson3_disable_clock(unsigned int cpu) { -=09uint64_t core_id =3D cpu_core(&cpu_data[cpu]); -=09uint64_t package_id =3D cpu_data[cpu].package; +=09uint64_t core_id =3D cpu_core(cpu); +=09uint64_t package_id =3D cpu_cluster(cpu); =20 =09if ((read_c0_prid() & PRID_REV_MASK) =3D=3D PRID_REV_LOONGSON3A_R1) { =09=09LOONGSON_CHIPCFG(package_id) &=3D ~(1 << (12 + core_id)); @@ -766,8 +766,8 @@ static int loongson3_disable_clock(unsigned int cpu) =20 static int loongson3_enable_clock(unsigned int cpu) { -=09uint64_t core_id =3D cpu_core(&cpu_data[cpu]); -=09uint64_t package_id =3D cpu_data[cpu].package; +=09uint64_t core_id =3D cpu_core(cpu); +=09uint64_t package_id =3D cpu_cluster(cpu); =20 =09if ((read_c0_prid() & PRID_REV_MASK) =3D=3D PRID_REV_LOONGSON3A_R1) { =09=09LOONGSON_CHIPCFG(package_id) |=3D 1 << (12 + core_id); --=20 2.26.0.rc2