From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423337AbcBQNv7 (ORCPT ); Wed, 17 Feb 2016 08:51:59 -0500 Received: from www.linutronix.de ([62.245.132.108]:43916 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423171AbcBQNst (ORCPT ); Wed, 17 Feb 2016 08:48:49 -0500 Message-Id: <20160217133932.203135603@linutronix.de> User-Agent: quilt/0.63-1 Date: Wed, 17 Feb 2016 13:47:35 -0000 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Ingo Molnar , Borislav Petkov , Stephane Eranian , Harish Chegondi , Kan Liang , Andi Kleen Subject: [patch 06/11] x86/topology: Provide helper to retrieve number of cpu packages References: <20160217132903.767990400@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=x86-topology--Provide-helper-to-get-number-of-cpu-packages.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For services which are per package, e.g. intel_uncore, we need to know the number of possible packages in the system. Provide a helper. Unfortunately a macro to avoid inclue hell. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/topology.h | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -127,6 +127,9 @@ extern const struct cpumask *cpu_coregro #define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) #endif +#define topology_max_packages() \ + DIV_ROUND_UP(num_possible_cpus(), boot_cpu_data.x86_max_cores * smp_num_siblings) + static inline void arch_fix_phys_package_id(int num, u32 slot) { }