Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3184917rdh; Mon, 27 Nov 2023 08:09:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIg+ZUyo8JBdKJrKJSMIUXG8Su1WeYkl3d/ZqpNEB40lpT28lvbEB+AZ0N1iK053KotHdN X-Received: by 2002:a17:902:e551:b0:1cf:ee3a:3aa with SMTP id n17-20020a170902e55100b001cfee3a03aamr148936plf.4.1701101363417; Mon, 27 Nov 2023 08:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701101363; cv=none; d=google.com; s=arc-20160816; b=GZ/4h1sKlAZram+bw66jaE/vD4ho7gj0UoKz/v9gNqTS05LLFfJKLc2a/2+PAp64j8 C6d1Gsv4LOb6h4fckz11aW8udNfNqwuukB/VEzmgESmChMO0XOr3FGtc8HIgbALwBC4J 5t7iKBtUalFfHPpu0dfs1l0rhEnp2O15a6FoWqRLnHQt5Xk67TybopNbITrtXVMVuJLG P12O1SrmhW6JuTLPwH7K1ApM5cqhUpLv1MsBq+2cKiccY1do6poE/1/V/btZmt2DSdCu V0CB7uWTXx2PdJ5Rw2GDc3FbNfy/RZeGBBJfrx5v5SHdjTKEc+k+pzhl9yDOxPboC2Z/ FQaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UfciFF9NBWUPTdcHWUfnhF14YzHT5beVO5m7YyBdxNA=; fh=T+aqzx8zkLYh8rg4LWp1gr91VntGMmWMOs1LhCvdFA4=; b=rKy/8UFTE/19FaZsparsAUGAr340xdjnGE11bxk9+w/Has6qkZqoOipPhmuaxjWN2c QEKanpt11Xpr1ATEW/wE1Clpxj+A7qD7oxQeFF+LxdyYfYLk84+UHxlTDSD+bTzu7iFx omYu3AT3bqpm+QRJfOUey4x3XdTsDACBIbdNkbtql9WSWHJc/8KIOO+lXMeDqjvRu62U BiHy9cMjIiRifBC4zL9M7O9hVnf9RTzL1Xl8S1O1gqJzA0RNjH1zLPgldfjd/GPJKTZp 0GUC6LNZrt6RJVmPYrQeLrzyK+A6BMHI5lzXA4NOFeIPZYblQA+MBieaPNMjU0WecWcX bJuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id n15-20020a170902d2cf00b001cfe100a99fsi582722plc.487.2023.11.27.08.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 08:09:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4B9A480203EA; Mon, 27 Nov 2023 08:09:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234335AbjK0QJH (ORCPT + 99 others); Mon, 27 Nov 2023 11:09:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234336AbjK0QJF (ORCPT ); Mon, 27 Nov 2023 11:09:05 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 630F0EA; Mon, 27 Nov 2023 08:09:11 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 27 Nov 2023 08:09:20 -0800 (PST) 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; -- 2.25.1