Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp519572ybv; Thu, 13 Feb 2020 04:59:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwRcGO3Z1rRrmiHUMiyEYhinKSMSTeJM+FJsmZfsegCHQsf/iYxUuPecb6x5T3B4gV8n3eh X-Received: by 2002:aca:484a:: with SMTP id v71mr2793354oia.39.1581598783764; Thu, 13 Feb 2020 04:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581598783; cv=none; d=google.com; s=arc-20160816; b=VI7Apr7478HvVMQEvw4hXUCpAN+/M+LNkw7kdTV+jzua9TUC3Aw6fbXpw/UyLvYaVI IpFDyCRxB2KsO/D7tpltN5BNYxYd8msq83GjkkKdTJuW/2dgJsmTkNNrfc6ioUiIhosY 916EVmoVAEDRKY4uBDdY9X8MnkOLGwqk6ungKAfmwOcwTa0ASvdmxJe+ODv2WByFLuSe EMpCQx6JBrT5gYhVYgGjL0hTx3WOgYGpEIuRnAFetiYkTZKv2mYfPaduWj16wVKy4mky qCPEA8npthbEfNHCx7X6Di77kibIijZIrdfqKbDfhQMegWP73kE7/2ZvC2zKJAnlwh5l ioqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=L0iH4pyOhibcBvubOGbaB/fcPP19FlNkO/TFZrmlQPw=; b=H2Fir+KkeftM+fsBuf+CXLD02xe0D0X0ilG6M3zdv6YKa/RZ8Lb9qJ18f0XGdv7DJW pmgNSew37rMKwi+N/y1eR5whnCs5l7l3pXYwU+1g3lI7hTVfx+9yQ5ZnJzoGtNwzEUao tFQ0HjQKaDtUxceW+1yBwnklNBqoB8OjJPA9luLMtxbfoN8NaHSE0g8RwgnVq36fXM+p TmkhWDy+JGQXjM91aBcnwhkHgk7DsxWVNWKAkE1SeZMYnIzQK4/K3l5kQHkQVEmZe/UF wdjMl5ji5CxAOeeZmE3oDgZNqLyCfjnC8TAPTg4Gbsyaem1OCIClr0DzFHqc8xQBz3aF 2qnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si1166067otk.173.2020.02.13.04.59.30; Thu, 13 Feb 2020 04:59:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729772AbgBMM7V (ORCPT + 99 others); Thu, 13 Feb 2020 07:59:21 -0500 Received: from foss.arm.com ([217.140.110.172]:46336 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729428AbgBMM7V (ORCPT ); Thu, 13 Feb 2020 07:59:21 -0500 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 B69091FB; Thu, 13 Feb 2020 04:59:20 -0800 (PST) Received: from localhost (unknown [10.1.198.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 580063F6CF; Thu, 13 Feb 2020 04:59:20 -0800 (PST) Date: Thu, 13 Feb 2020 12:59:18 +0000 From: Ionela Voinescu To: Valentin Schneider Cc: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, maz@kernel.org, suzuki.poulose@arm.com, sudeep.holla@arm.com, lukasz.luba@arm.com, rjw@rjwysocki.net, peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v3 5/7] cpufreq: add function to get the hardware max frequency Message-ID: <20200213125918.GA2397@arm.com> References: <20200211184542.29585-1-ionela.voinescu@arm.com> <20200211184542.29585-6-ionela.voinescu@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 13 Feb 2020 at 11:59:56 (+0000), Valentin Schneider wrote: > On 2/11/20 6:45 PM, Ionela Voinescu wrote: > > +/** > > + * cpufreq_get_hw_max_freq - get the max hardware frequency of the CPU > > + * @cpu: CPU number > > + * > > + * The default return value is the max_freq field of cpuinfo. > > + */ > > +__weak unsigned int cpufreq_get_hw_max_freq(unsigned int cpu) > > +{ > > + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); > > + unsigned int ret_freq = 0; > > + > > + if (policy) { > > + ret_freq = policy->cpuinfo.max_freq; > > + cpufreq_cpu_put(policy); > > What about intel_pstate / turbo stuff? IIRC one of Giovanni's issues was that > turbo freq is not always reported as the max freq. Dunno if we can do > anything about it; at the very least maybe document the caveat? > Okay, I can add details in the description in regards to potential reasons to overwrite this function. But basically this is one of the reasons for making this a weak function. The best information we can generically get for maximum hardware frequency is cpuinfo.max_freq. But if platforms have the possibility to obtain this differently from either hardware or firmware they can overwrite this. Thanks, Ionela. > > + } > > + > > + return ret_freq; > > +} > > +EXPORT_SYMBOL(cpufreq_get_hw_max_freq); > > + > > static unsigned int __cpufreq_get(struct cpufreq_policy *policy) > > { > > if (unlikely(policy_is_inactive(policy))) >