Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675AbcJALqP (ORCPT ); Sat, 1 Oct 2016 07:46:15 -0400 Received: from mga03.intel.com ([134.134.136.65]:36267 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751255AbcJALqD (ORCPT ); Sat, 1 Oct 2016 07:46:03 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208";a="1059147130" From: Srinivas Pandruvada To: rjw@rjwysocki.net, tglx@linutronix.de, mingo@redhat.com, bp@suse.de Cc: x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, peterz@infradead.org, tim.c.chen@linux.intel.com, jolsa@redhat.com, Srinivas Pandruvada Subject: [PATCH v5 2/9] x86/topology: Provide topology_num_packages() Date: Sat, 1 Oct 2016 04:45:19 -0700 Message-Id: <1475322326-160112-3-git-send-email-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475322326-160112-1-git-send-email-srinivas.pandruvada@linux.intel.com> References: <1475322326-160112-1-git-send-email-srinivas.pandruvada@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1783 Lines: 53 From: Tim Chen Returns number of cpu packages discovered. This information is needed to determine the size of the platform and decide if the Intel Turbo Boost Max Technology 3.0 (ITMT) feature should be turned on by default. The ITMT feature is more effective on single socket client like system that uses small number of cores most of the time. Signed-off-by: Tim Chen Signed-off-by: Srinivas Pandruvada --- arch/x86/include/asm/topology.h | 3 +++ arch/x86/kernel/smpboot.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index cf75871..3e95dfc 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -129,10 +129,13 @@ static inline int topology_max_smt_threads(void) } int topology_update_package_map(unsigned int apicid, unsigned int cpu); +extern int topology_num_packages(void); extern int topology_phys_to_logical_pkg(unsigned int pkg); #else #define topology_max_packages() (1) static inline int +topology_num_packages(void) { return 1; } +static inline int topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; } static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; } static inline int topology_max_smt_threads(void) { return 1; } diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 7137ec4..6a763a2 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -295,6 +295,11 @@ found: return 0; } +int topology_num_packages(void) +{ + return logical_packages; +} + /** * topology_phys_to_logical_pkg - Map a physical package id to a logical * -- 2.7.4