From patchwork Thu May 11 22:39:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Prakash, Prashanth" X-Patchwork-Id: 9723215 X-Patchwork-Delegate: rjw@sisk.pl 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 308676031B for ; Thu, 11 May 2017 22:40:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BE0A2874A for ; Thu, 11 May 2017 22:40:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1090528751; Thu, 11 May 2017 22:40:13 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 87B3628749 for ; Thu, 11 May 2017 22:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753916AbdEKWkL (ORCPT ); Thu, 11 May 2017 18:40:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48050 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752049AbdEKWkL (ORCPT ); Thu, 11 May 2017 18:40:11 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7BE06607B4; Thu, 11 May 2017 22:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1494542410; bh=Bx8eYmKQvSXAnqDvyijJ2f/zjHYG89VB+ErOH2y2SNg=; h=From:To:Cc:Subject:Date:From; b=XEblgNxiHJsM9m0V/CB5yNMKDzVc2OQ6bzN6cvC4UDkmTkef9r3VMaDJBY47sGRuP x8ozZ9gKLQrXpMLhEQ1AY3nf+V0iFeSatmoLPZrhzGeRsSUvzoSPFgENt5HYeew8U3 VaAJKZQmZKEj95CKntYvgJGu4VmkXM3vDGBt0X4A= Received: from pprakash-lnx.qualcomm.com (unknown [129.46.15.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: pprakash@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A5BDE607B4; Thu, 11 May 2017 22:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1494542409; bh=Bx8eYmKQvSXAnqDvyijJ2f/zjHYG89VB+ErOH2y2SNg=; h=From:To:Cc:Subject:Date:From; b=D97GvgKezmbpsKYchLE3yk/A0d/7jqNIFQHU9p3tZ44O+JujL7gMBkPhIvg8J/6qk l8w0iDFodb3Achr5QdopL2IkTFgA3xj3UMNozqSwFV0hEqg2pce5ZXr1ZqLMRRzFE/ oko7vPKdWsNVEz73bfonG19DSEn7Wp66OEWRXSxQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A5BDE607B4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pprakash@codeaurora.org From: Prashanth Prakash To: linux-pm@vger.kernel.org Cc: rjw@rjwysocki.net, viresh.kumar@linaro.org, ahs3@redhat.com, hotran@apm.com, alexey.klimov@arm.com, Prashanth Prakash Subject: [PATCH] cpufreq / CPPC: Initialize policy->min to lowest nonlinear performance Date: Thu, 11 May 2017 16:39:44 -0600 Message-Id: <1494542384-7502-1-git-send-email-pprakash@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Description of Lowest Perfomance in ACPI 6.1 specification states: "Lowest Performance is the absolute lowest performance level of the platform. Selecting a performance level lower than the lowest nonlinear performance level may actually cause an efficiency penalty, but should reduce the instantaneous power consumption of the processor. In traditional terms, this represents the T-state range of performance levels." Set the default value of policy->min to Lowest Nonlinear Performance to avoid any potential efficiency penalty. Signed-off-by: Prashanth Prakash Acked-by: Viresh Kumar Acked-by: Alexey Klimov --- drivers/cpufreq/cppc_cpufreq.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index e82bb3c..10be285 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -144,10 +144,23 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) cppc_dmi_max_khz = cppc_get_dmi_max_khz(); - policy->min = cpu->perf_caps.lowest_perf * cppc_dmi_max_khz / cpu->perf_caps.highest_perf; + /* + * Set min to lowest nonlinear perf to avoid any efficiency penalty (see + * Section 8.4.7.1.1.5 of ACPI 6.1 spec) + */ + policy->min = cpu->perf_caps.lowest_nonlinear_perf * cppc_dmi_max_khz / + cpu->perf_caps.highest_perf; policy->max = cppc_dmi_max_khz; - policy->cpuinfo.min_freq = policy->min; - policy->cpuinfo.max_freq = policy->max; + + /* + * Set cpuinfo.min_freq to Lowest to make the full range of performance + * available if userspace wants to use any perf between lowest & lowest + * nonlinear perf + */ + policy->cpuinfo.min_freq = cpu->perf_caps.lowest_perf * cppc_dmi_max_khz / + cpu->perf_caps.highest_perf; + policy->cpuinfo.max_freq = cppc_dmi_max_khz; + policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num); policy->shared_type = cpu->shared_type;