From patchwork Wed Jan 28 23:03:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kristen Carlson Accardi X-Patchwork-Id: 5733321 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D526ABF440 for ; Thu, 29 Jan 2015 01:28:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 19E1C2018E for ; Thu, 29 Jan 2015 01:28:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 28F4920218 for ; Thu, 29 Jan 2015 01:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754045AbbA2B2x (ORCPT ); Wed, 28 Jan 2015 20:28:53 -0500 Received: from mga14.intel.com ([192.55.52.115]:34165 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755327AbbA2B2v (ORCPT ); Wed, 28 Jan 2015 20:28:51 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 28 Jan 2015 14:57:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,483,1418112000"; d="scan'208";a="644186393" Received: from kcaccard-desk.jf.intel.com ([10.7.199.81]) by orsmga001.jf.intel.com with ESMTP; 28 Jan 2015 15:03:29 -0800 From: Kristen Carlson Accardi To: rjw@rjwysocki.net Cc: srinivas.pandruvada@linux.intel.com, linux-pm@vger.kernel.org Subject: [PATCH 2/2] intel_pstate: Add num_pstates to sysfs Date: Wed, 28 Jan 2015 15:03:28 -0800 Message-Id: <1422486208-14367-3-git-send-email-kristen@linux.intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1422486208-14367-1-git-send-email-kristen@linux.intel.com> References: <1422486208-14367-1-git-send-email-kristen@linux.intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a sysfs interface to display the total number of supported pstates. This value is independent of whether turbo has been enabled or disabled. Signed-off-by: Kristen Carlson Accardi --- Documentation/cpu-freq/intel-pstate.txt | 4 ++++ drivers/cpufreq/intel_pstate.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt index 7767ce6..6557507 100644 --- a/Documentation/cpu-freq/intel-pstate.txt +++ b/Documentation/cpu-freq/intel-pstate.txt @@ -41,6 +41,10 @@ controlling P state selection. These files have been added to is supported by hardware that is in the turbo range. This number is independent of whether turbo has been disabled or not. + num_pstates: displays the number of pstates that are supported + by hardware. This number is independent of whether turbo has + been disabled or not. + For contemporary Intel processors, the frequency is controlled by the processor itself and the P-states exposed to software are related to performance levels. The idea that frequency can be set to a single diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f558c2e..3ea9aff 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -354,6 +354,17 @@ static ssize_t show_turbo_pct(struct kobject *kobj, return sprintf(buf, "%u\n", turbo_pct); } +static ssize_t show_num_pstates(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + struct cpudata *cpu; + int total; + + cpu = all_cpu_data[0]; + total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; + return sprintf(buf, "%u\n", total); +} + static ssize_t show_no_turbo(struct kobject *kobj, struct attribute *attr, char *buf) { @@ -435,12 +446,14 @@ define_one_global_rw(no_turbo); define_one_global_rw(max_perf_pct); define_one_global_rw(min_perf_pct); define_one_global_ro(turbo_pct); +define_one_global_ro(num_pstates); static struct attribute *intel_pstate_attributes[] = { &no_turbo.attr, &max_perf_pct.attr, &min_perf_pct.attr, &turbo_pct.attr, + &num_pstates.attr, NULL };