From patchwork Thu Oct 20 21:59:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Chen X-Patchwork-Id: 9387679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BF57A607D0 for ; Thu, 20 Oct 2016 22:02:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E95329CAF for ; Thu, 20 Oct 2016 22:02:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9369729CBA; Thu, 20 Oct 2016 22:02:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 698A929CAF for ; Thu, 20 Oct 2016 22:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757196AbcJTWAx (ORCPT ); Thu, 20 Oct 2016 18:00:53 -0400 Received: from mga03.intel.com ([134.134.136.65]:58643 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757188AbcJTWAu (ORCPT ); Thu, 20 Oct 2016 18:00:50 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP; 20 Oct 2016 15:00:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,521,1473145200"; d="scan'208";a="21915247" Received: from skl-02.jf.intel.com ([10.23.236.208]) by fmsmga005.fm.intel.com with ESMTP; 20 Oct 2016 15:00:48 -0700 From: Tim Chen To: rjw@rjwysocki.net, tglx@linutronix.de, mingo@redhat.com, bp@suse.de Cc: Tim Chen , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, peterz@infradead.org, jolsa@redhat.com, Srinivas Pandruvada Subject: [PATCH v6 2/9] x86/topology: Provide topology_num_packages() Date: Thu, 20 Oct 2016 14:59:56 -0700 Message-Id: <94727cbcda5e768227ecad61f584045c6d4b13c3.1477000078.git.tim.c.chen@linux.intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 951f093..4234e52 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -295,6 +295,11 @@ int topology_update_package_map(unsigned int apicid, unsigned int cpu) return 0; } +int topology_num_packages(void) +{ + return logical_packages; +} + /** * topology_phys_to_logical_pkg - Map a physical package id to a logical *