From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 D7BAFC43381 for ; Wed, 20 Mar 2019 23:48:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9554B218CD for ; Wed, 20 Mar 2019 23:48:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Jk8iZ9bB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727786AbfCTXsl (ORCPT ); Wed, 20 Mar 2019 19:48:41 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:11929 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727646AbfCTXsR (ORCPT ); Wed, 20 Mar 2019 19:48:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1553125697; x=1584661697; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=clP6NMFQMwOD3n54p6gFwQhrqNU04Jf2cfalAdxHECo=; b=Jk8iZ9bBH7wXomRKRJmMa6Z5fbb3gFIglQhnJJjAnc1ObXhVVGYoGr3J EaSVNuFjjsr17XMuLiLLyEcmIt8piSpspp4/7lSr76eVICVbkJJhL3xnP U0UiSVXPMW0jb/cKoOey8knV2aZB4oJEJSke0mOOvbO+E7afUXI2PTe+9 uZnm7YtwyWc8CEm+TM2WnKDm5NJt42RIEMK+HGxzOc3QK0Lh0OyMk8oNX hsAjpgz0fnvx8YL3dPfW9+LBmfVpOvuh+Qellcbniukls+Op3kVbrs+FM uBWGAi2ewM5Nzv9KoiI/UPd+Rt2GJwG98iMqGqWr9nesH9iUTjGaYZinY g==; X-IronPort-AV: E=Sophos;i="5.60,250,1549900800"; d="scan'208";a="103874326" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 21 Mar 2019 07:48:16 +0800 IronPort-SDR: Y0fZER6cj2QfsBrnHwvP02sHOWv1tkoKGnMU9PXZU5zHNxGter0f4mS0Nsz4QzpnfA/ec/Wuad 3B/URG/DNaK09VqVZB0NilASkr3XhBl134Cc+OeS32Q3Yji/LuaIOsmIx3sx0o6SNW53VNnjaE zhj4Tq9TXqgS9Yitq3l+Y0K0NGKpnAghMCOqVqcCRn4qLq+Bp45H58Pd+IFSJFOjYX/Ay6GIjX Rn6ALLoOY2I40Y4nBs86np4ewArbrWLXpAm3nVI/+VDq4NiFGP1ejTzdm43ZjBmrU774W3cvfj WPT1sAcG8Bk44Buws0BZX6Zd Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 20 Mar 2019 16:27:53 -0700 IronPort-SDR: /1pYslUX5TWJJ4C/tLDjSgJrKkGzmhVYGb+STzhMnVSd782VWNJaIqLSzzK3O2t1mZ9460YR5O Tk70+87aq32vJCBZ+uyObTfeaJwfG5RPWcf5Sit8WkHkNjUqegyMsgDioCyApcrCMMkJSKAx3A +fjtrzVFHjMsFeUJvY2PdBkkHua84WmCaofCHM+pFnIxOHEfUvtc1q9F/zcTHVLlK9pIQF0Hoi m8ulEDu8m85a930yWJy+sh5f3yLp8XkudMe8TIDJcP/xBknERMQ1ccK7IzM5cQbZpRmqlRbO1i O2E= Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Mar 2019 16:48:16 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Albert Ou , Anup Patel , Ard Biesheuvel , Catalin Marinas , devicetree@vger.kernel.org, Dmitriy Cherkasov , Greg Kroah-Hartman , Ingo Molnar , Jeremy Linton , Johan Hovold , linux-riscv@lists.infradead.org, Mark Rutland , Morten Rasmussen , Otto Sabart , Palmer Dabbelt , Paul Walmsley , "Peter Zijlstra (Intel)" , "Rafael J. Wysocki" , Rob Herring , Sudeep Holla , Will Deacon Subject: [RFT/RFC PATCH v3 4/5] arm: Use common cpu_topology Date: Wed, 20 Mar 2019 16:48:05 -0700 Message-Id: <20190320234806.19748-5-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320234806.19748-1-atish.patra@wdc.com> References: <20190320234806.19748-1-atish.patra@wdc.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 Currently, ARM32 and ARM64 uses different data structures to represent their cpu toplogies. Since, we are moving the ARM64 topology to common code to be used by other architectures, we can reuse that for ARM32 as well. Signed-off-by: Atish Patra --- arch/arm/include/asm/topology.h | 22 +--------------------- arch/arm/kernel/topology.c | 10 +++++----- include/linux/arch_topology.h | 10 +++++++++- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h index 2a786f54..52f99ec8 100644 --- a/arch/arm/include/asm/topology.h +++ b/arch/arm/include/asm/topology.h @@ -5,26 +5,6 @@ #ifdef CONFIG_ARM_CPU_TOPOLOGY #include - -struct cputopo_arm { - int thread_id; - int core_id; - int socket_id; - cpumask_t thread_sibling; - cpumask_t core_sibling; -}; - -extern struct cputopo_arm cpu_topology[NR_CPUS]; - -#define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id) -#define topology_core_id(cpu) (cpu_topology[cpu].core_id) -#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling) -#define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling) - -void init_cpu_topology(void); -void store_cpu_topology(unsigned int cpuid); -const struct cpumask *cpu_coregroup_mask(int cpu); - #include /* Replace task scheduler's default frequency-invariant accounting */ @@ -38,7 +18,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu); #else -static inline void init_cpu_topology(void) { } +static inline void init_cpu_topology(void) {} static inline void store_cpu_topology(unsigned int cpuid) { } #endif diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 60e375ce..0ddb24c7 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -180,7 +180,7 @@ static inline void update_cpu_capacity(unsigned int cpuid) {} /* * cpu topology table */ -struct cputopo_arm cpu_topology[NR_CPUS]; +struct cpu_topology cpu_topology[NR_CPUS]; EXPORT_SYMBOL_GPL(cpu_topology); const struct cpumask *cpu_coregroup_mask(int cpu) @@ -197,9 +197,9 @@ const struct cpumask *cpu_corepower_mask(int cpu) return &cpu_topology[cpu].thread_sibling; } -static void update_siblings_masks(unsigned int cpuid) +void update_siblings_masks(unsigned int cpuid) { - struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; + struct cpu_topology *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; int cpu; /* update core and thread sibling masks */ @@ -230,7 +230,7 @@ static void update_siblings_masks(unsigned int cpuid) */ void store_cpu_topology(unsigned int cpuid) { - struct cputopo_arm *cpuid_topo = &cpu_topology[cpuid]; + struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; unsigned int mpidr; /* If the cpu topology has been already set, just return */ @@ -302,7 +302,7 @@ void __init init_cpu_topology(void) /* init core mask and capacity */ for_each_possible_cpu(cpu) { - struct cputopo_arm *cpu_topo = &(cpu_topology[cpu]); + struct cpu_topology *cpu_topo = &(cpu_topology[cpu]); cpu_topo->thread_id = -1; cpu_topo->core_id = -1; diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h index d4e76e0a..7c850611 100644 --- a/include/linux/arch_topology.h +++ b/include/linux/arch_topology.h @@ -36,17 +36,25 @@ unsigned long topology_get_freq_scale(int cpu) struct cpu_topology { int thread_id; int core_id; +#ifdef CONFIG_ARM_CPU_TOPOLOGY + int socket_id; +#else int package_id; int llc_id; + cpumask_t llc_sibling; +#endif cpumask_t thread_sibling; cpumask_t core_sibling; - cpumask_t llc_sibling; }; #ifdef CONFIG_GENERIC_ARCH_TOPOLOGY extern struct cpu_topology cpu_topology[NR_CPUS]; +#ifdef CONFIG_ARM_CPU_TOPOLOGY +#define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id) +#else #define topology_physical_package_id(cpu) (cpu_topology[cpu].package_id) +#endif #define topology_core_id(cpu) (cpu_topology[cpu].core_id) #define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling) #define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling) -- 2.21.0