From patchwork Mon Nov 27 16:08:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beata Michalska X-Patchwork-Id: 13469896 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E01B6C4167B for ; Mon, 27 Nov 2023 16:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YXYIRWKXNyTwEujUzbjR02HIpBeg11d3NdYmAJxBNiQ=; b=Q6uYYJT25Fy9QE jDq0dOHxw9HbCHX+hOJcA18Z1X+YHIU1Jk3Z+ztC6KsjjPjuyTG47yQXUCtemkAAmXb6IwiPeWNhk Wl80I3AeXbscz6M9wEfXoUiOUabpNwGKVaOVQxgmBA594W2o7DE4o11xQYForSNn9U/bRJa/4vW81 UVvdoUCms16VuTSZ2a1sOlKI9qrKZluIPbU68UrB4xCENWDMWGGu03TYmizxBZbqvsLA1SpAjCP55 NNSDADboIdSFEhzlRjfKQZyLcH1o1R/0mfWQPsYU4Wgkv3Qf/G2wvAPJYJismANKQCeMdGATrWpcv 79Shhz5x7Zc0ScnyRUyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7eAp-002usv-09; Mon, 27 Nov 2023 16:09:27 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7eAc-002uqA-1h for linux-arm-kernel@lists.infradead.org; Mon, 27 Nov 2023 16:09:15 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D36971688; Mon, 27 Nov 2023 08:09:58 -0800 (PST) Received: from e125905.cambridge.arm.com (e125905.cambridge.arm.com [10.1.194.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 947263F6C4; Mon, 27 Nov 2023 08:09:09 -0800 (PST) From: Beata Michalska To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, sumitg@nvidia.com Cc: sudeep.holla@arm.covm, will@kernel.org, catalin.marinas@arm.com, viresh.kumar@linaro.org, rafael@kernel.org, ionela.voinescu@arm.com, yang@os.amperecomputing.com, linux-tegra@vger.kernel.org Subject: [PATCH v2 2/2] cpufreq: Wire-up arch-flavored freq info into cpufreq_verify_current_freq Date: Mon, 27 Nov 2023 16:08:38 +0000 Message-Id: <20231127160838.1403404-3-beata.michalska@arm.com> In-Reply-To: <20231127160838.1403404-1-beata.michalska@arm.com> References: <20231127160838.1403404-1-beata.michalska@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231127_080914_616450_7571365C X-CRM114-Status: UNSURE ( 8.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Sumit Gupta When available, use arch_freq_get_on_cpu to obtain current frequency (usually an average reported over given period of time) to better align the cpufreq's view on the current state of affairs. This also automatically pulls in the update for cpuinfo_cur_freq sysfs attribute, aligning it with the scaling_cur_freq one, and thus providing consistent view on relevant platforms. Signed-off-by: Sumit Gupta [BM: Subject & commit msg] Signed-off-by: Beata Michalska --- drivers/cpufreq/cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 8c4f9c2f9c44..109559438f45 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1756,7 +1756,8 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b { unsigned int new_freq; - new_freq = cpufreq_driver->get(policy->cpu); + new_freq = arch_freq_get_on_cpu(policy->cpu); + new_freq = new_freq ?: cpufreq_driver->get(policy->cpu); if (!new_freq) return 0;