From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC375C433E2 for ; Mon, 7 Sep 2020 17:04:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE611207DE for ; Mon, 7 Sep 2020 17:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599498271; bh=dANP5A8doE17X2f8IBvZQpr4ngAj/Vui516wdzFEfdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tXNPvhwDr1hAHKNmei/XKfgElmR2iOC0+IAjJrIs9x/rQ/0XudP6G4JqBk2HUKrJ/ v66FudRh2oGx3ChuA5ezr5LWHTJuG4pRVGTecDNbVnaHfUS8cU99fbevddPAXJqiv1 yANyywGxJxXOpZiSLbVvu/A0iBrKnsLITeFDp/7M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731005AbgIGREY (ORCPT ); Mon, 7 Sep 2020 13:04:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:47070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729836AbgIGQdP (ORCPT ); Mon, 7 Sep 2020 12:33:15 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2451321D20; Mon, 7 Sep 2020 16:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599496395; bh=dANP5A8doE17X2f8IBvZQpr4ngAj/Vui516wdzFEfdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zoAodhaN5JeP1BLf1MCKmlJPd73tMhCsS8w3mEJmUlDnD7cSE6+Fbp7gxOaQuUBmZ OZCW9GYDIC7Do7EU7T5HUbsFWqeLwUUpGeC9R0e6qWDmGYFwcX2TtFc8eAFpoeK4Fn u36QXPBrYn6xGVtntdXRQU9syoqzU2UO/JjQd7yc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Francisco Jerez , Caleb Callaway , Srinivas Pandruvada , "Rafael J . Wysocki" , Sasha Levin , linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 5.8 43/53] cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled Date: Mon, 7 Sep 2020 12:32:09 -0400 Message-Id: <20200907163220.1280412-43-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907163220.1280412-1-sashal@kernel.org> References: <20200907163220.1280412-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Francisco Jerez [ Upstream commit eacc9c5a927e474c173a5d53dd7fb8e306511768 ] This fixes the behavior of the scaling_max_freq and scaling_min_freq sysfs files in systems which had turbo disabled by the BIOS. Caleb noticed that the HWP is programmed to operate in the wrong P-state range on his system when the CPUFREQ policy min/max frequency is set via sysfs. This seems to be because in his system intel_pstate_get_hwp_max() is returning the maximum turbo P-state even though turbo was disabled by the BIOS, which causes intel_pstate to scale kHz frequencies incorrectly e.g. setting the maximum turbo frequency whenever the maximum guaranteed frequency is requested via sysfs. Tested-by: Caleb Callaway Signed-off-by: Francisco Jerez Acked-by: Srinivas Pandruvada [ rjw: Minor subject edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/intel_pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 97ed4fd0f1342..36a469150ff9c 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -762,7 +762,7 @@ static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max, rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap); - if (global.no_turbo) + if (global.no_turbo || global.turbo_disabled) *current_max = HWP_GUARANTEED_PERF(cap); else *current_max = HWP_HIGHEST_PERF(cap); -- 2.25.1