Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp47122pxk; Tue, 15 Sep 2020 17:22:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtQWvwzHYdWDiuC8ZeW3dwE7SzGwLvra6XApcYgTswmnhRh0++jedyyenSQIFR1RHGxNZM X-Received: by 2002:a17:906:270f:: with SMTP id z15mr11880659ejc.6.1600215751650; Tue, 15 Sep 2020 17:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600215751; cv=none; d=google.com; s=arc-20160816; b=QVon7cal1OI2XARAhg8Qmhu2CtwupctqjoHCfYmac+m0I5cAwzQrhT1nawYbIQmkoK VZaXTJtOdyDiV8zlX2r7NL6Atu/6H7+13K9GZyBBxCfId4p4cWVnWPBJfQb77OuTunu4 G75qM4LpkM4nDHsZyyaP94SNyiqjK0K1ZFP7Q8GDhxXF6Kt14GDG/nCLsvMbtQzwLcXd n/Ok+RXWFW14ogqW4ryREvnANKswgcy6gIQj0sDDTXNPIaHXtN5AR/Z6OaNjs8KtGl3D rQ0HLv08OzigvBP/AxxLhLCjdHitZ6skU8seUzzDjUvMaUzraWdLL2TssbTeT/uoUjWg xWTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/R0sbSFB8L0Zj/5WvFNro0OjYN93D58h/t38ISKNoV4=; b=xawYOALvv6GIOt7zXrw/oceBU8pRNxtDEVSDdgIxqIbuFFMKg20npxKSi9Q3l2QJk4 s6gAyBarGP9tPgz4ZmQ6FGtUBcbOQ3yaeqZ9pMuB4pWcgK5j1pVkDhnQ6g43R4AQwEie kQVQAGrFtwUlWl1Cc61iRVs4ZDyAb7RrVLWhfgSAurrpIFjlUukNG9fThYBJaYi6Qckx iqdW/uGx8LNb2zPnDBFVGptnhHd1BVM6BK4Uz2WxQppqrd27+IbPyO837XcV3zRNnNN/ SQFXr8X8aWc6u9h6ApHsk/kMESjZFpYIo1U1lGGrSSSiqG+FR7yQvCrXf7IrASFh5g4r 5IOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DwDOzYyN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx6si4607954edb.437.2020.09.15.17.22.09; Tue, 15 Sep 2020 17:22:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DwDOzYyN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727383AbgIPAVc (ORCPT + 99 others); Tue, 15 Sep 2020 20:21:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:34546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbgIOOV6 (ORCPT ); Tue, 15 Sep 2020 10:21:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F0792226A; Tue, 15 Sep 2020 14:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600179451; bh=RCKCSrE4tU5GQj7iM0MpN+Aw8Ju1nJbqwLZpXZDF2Fc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DwDOzYyNM5NZI4I+UA0Xq7+oYtLs21e0KI7OlbMzzUn/gSGwXWmyP71vcPbliAzgB jXU68ZTCQ6yRgPq/tWLUZnFeme3vMWqB7V4bN2cJhqxsojkm08Dt1OzGxYKJtLPsrW QDWZtugbOwbF0MyfiWVaiPvqGEQxQ9eAAVvSTbdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Caleb Callaway , Francisco Jerez , Srinivas Pandruvada , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 35/78] cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled Date: Tue, 15 Sep 2020 16:13:00 +0200 Message-Id: <20200915140635.334160236@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200915140633.552502750@linuxfoundation.org> References: <20200915140633.552502750@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 8fa22aa2ac65b..864a7e8ebdfc3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -712,7 +712,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