Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1086418rda; Mon, 23 Oct 2023 01:53:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERPRWXw+ToGoR/pb9QDR5nDYH3oRbrMX9NS5USeb7wRzKvw85HjUMmsmhfRRCmwcRRknyb X-Received: by 2002:a05:6a00:939a:b0:68a:586a:f62 with SMTP id ka26-20020a056a00939a00b0068a586a0f62mr7514539pfb.4.1698051220058; Mon, 23 Oct 2023 01:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698051220; cv=none; d=google.com; s=arc-20160816; b=0hpagFeK3rBfrzZKhRYcHuYyu6Njblul9J9qOXatYJGRYQbE5PmQxWSj42nFafilyE z4x9s3TmNLNA0vhk6H9Q6jCpEJoYy0XbMMZSLPt5CWbjlqGAmD9CF3/QMSg3LHNStQkK fMN0JAOp0FPdk3nVKQwLnF/mxMfxa6s8YBFS/KCj97wRz0dgyNNl5N3sVDLD3hlnf1jR iKsftOekdahdTEfGqVBRSkv4t4jEDvXyUVysX8Agf7pa1b9bykqId97pvHA8H79JumOR MgKDDMxPYimiqJAF/pzfwT6vrHOhQZ9uMlJ/JiXMJXSnqqKb+9Z/9eq5PJpUOYtLO34q D5zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/JESUA6N6Yxoe4GKFN+FsLFUjiW3ob8OSdZSxBN4dvY=; fh=S6ZArTWgdpy9/rBKq3K7/zlp1y3PeJ6/lnEre/xtaCA=; b=EPIAISbvrpXZPfzWCacRjbi9N+xmpMA2eWT4a4YRqGavYB2mrYYiJsrCs4UkN81gJn CNOae7DW0+ZpMdu+l843g+z0OeeJp0nJ3z/qaoFEnWhbSHwSc5f/am1SMFcpmxXtFnDC LHn+1jmblsV+nGQ617us4OgSM65yVovVYS5DjlbDlF+nsaL4CilomGHjGcBzIqdlN4wQ DNOJyRl5YvaLI1RXYVYpQpTMHAvMnHs7ojjs4owQCpT4R/bePnHAoPGniq8hQuPJw+9/ 0jDMcVsmahSJ/aOgpRffHOFyERAq/xEh81/K0g2CZ+U2dgRo8hb3dbNOi85PtZn0EYp3 W4hw== 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 a21-20020a63e855000000b005897bfc2ed1si6172046pgk.215.2023.10.23.01.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 01:53:40 -0700 (PDT) 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 A4B2F8077921; Mon, 23 Oct 2023 01:53:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjJWIx3 (ORCPT + 99 others); Mon, 23 Oct 2023 04:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbjJWIx2 (ORCPT ); Mon, 23 Oct 2023 04:53:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0DFBCA9; Mon, 23 Oct 2023 01:53:24 -0700 (PDT) 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 6349C2F4; Mon, 23 Oct 2023 01:54:05 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AF9893F64C; Mon, 23 Oct 2023 01:53:22 -0700 (PDT) Date: Mon, 23 Oct 2023 09:53:20 +0100 From: Sudeep Holla To: Sumit Gupta Cc: , , , , , , , , , , , , Subject: Re: [Patch v5 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Message-ID: References: <20231014105426.26389-1-sumitg@nvidia.com> <20231014105426.26389-3-sumitg@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231014105426.26389-3-sumitg@nvidia.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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, 23 Oct 2023 01:53:37 -0700 (PDT) On Sat, Oct 14, 2023 at 04:24:26PM +0530, Sumit Gupta wrote: > From: Srikar Srimath Tirumala > > Current implementation of processor_thermal performs software throttling > in fixed steps of "20%" which can be too coarse for some platforms. > We observed some performance gain after reducing the throttle percentage. > Change the CPUFREQ thermal reduction percentage and maximum thermal steps > to be configurable. Also, update the default values of both for Nvidia > Tegra241 (Grace) SoC. The thermal reduction percentage is reduced to "5%" > and accordingly the maximum number of thermal steps are increased as they > are derived from the reduction percentage. > > Signed-off-by: Srikar Srimath Tirumala > Co-developed-by: Sumit Gupta > Signed-off-by: Sumit Gupta > --- > drivers/acpi/arm64/Makefile | 1 + > drivers/acpi/arm64/thermal_cpufreq.c | 20 ++++++++++++++++ > drivers/acpi/processor_thermal.c | 35 +++++++++++++++++++++++++--- > include/linux/acpi.h | 9 +++++++ > 4 files changed, 62 insertions(+), 3 deletions(-) > create mode 100644 drivers/acpi/arm64/thermal_cpufreq.c > > diff --git a/drivers/acpi/arm64/Makefile b/drivers/acpi/arm64/Makefile > index 143debc1ba4a..3f181d8156cc 100644 > --- a/drivers/acpi/arm64/Makefile > +++ b/drivers/acpi/arm64/Makefile > @@ -5,3 +5,4 @@ obj-$(CONFIG_ACPI_GTDT) += gtdt.o > obj-$(CONFIG_ACPI_APMT) += apmt.o > obj-$(CONFIG_ARM_AMBA) += amba.o > obj-y += dma.o init.o > +obj-$(CONFIG_ACPI) += thermal_cpufreq.o Do we really need CONFIG_ACPI here ? We won't be building this if it is not enabled. If this is for some module building, then does it make sense to have more specific config ? May be CONFIG_ACPI_THERMAL ? > diff --git a/drivers/acpi/arm64/thermal_cpufreq.c b/drivers/acpi/arm64/thermal_cpufreq.c > new file mode 100644 > index 000000000000..de834fb013e7 > --- /dev/null > +++ b/drivers/acpi/arm64/thermal_cpufreq.c > @@ -0,0 +1,20 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +#include > + > +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY > +#define SMCCC_SOC_ID_T241 0x036b0241 > + > +int acpi_thermal_cpufreq_pctg(void) > +{ > + s32 soc_id = arm_smccc_get_soc_id_version(); > + > + /* > + * Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) and > + * reduce the CPUFREQ Thermal reduction percentage to 5%. > + */ > + if (soc_id == SMCCC_SOC_ID_T241) > + return 5; > + > + return 0; > +} > +#endif Since this looks like arch specific hook/callback, not sure if it is good idea to have "arch_" in the function name. But if Rafael is OK with the name I am fine with this as well. -- Regards, Sudeep