From patchwork Wed Sep 13 16:46:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 13383547 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52820EE01EB for ; Wed, 13 Sep 2023 16:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231233AbjIMQs2 (ORCPT ); Wed, 13 Sep 2023 12:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbjIMQsP (ORCPT ); Wed, 13 Sep 2023 12:48:15 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2044.outbound.protection.outlook.com [40.107.93.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7D426A2; Wed, 13 Sep 2023 09:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QvP3jMOKuZkle46fkqCRasM4DFQNSqfn8tylSfOyhdt8YCjb0qAc1bvM+AkNskAbBcNUJ7RHI+JTh37N1rVzL0M2AsKqhT1RkkiMin9sMuB3lCr1Nm723mEwGFfAnFZSjaDl7AuThNbt9lVc9Oxbt2wYOybF+JAZrdu1uUhvFUvWvmtkr+PrxEhtkpkRJ/BXB18DRCqGFmN771Qs+9ZdCJjDGd9KhRmKGRQnsIQ5rUe4Wdl8FF9k7anefVmnLgbwrzc6D3C2xcDR7T8asnlrIl00Xj1dFYRr5WN3JgF7VBg19quv3QpYdfsGHsIYJefKV+0ls+7zumymup+GehwbCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QxC+smxm1V5z5UrVmC55WExCHcCYQjpoqGTLn5tGql0=; b=WLYJW3/0+ZdqO6yVnd29W+gNHVjNeOfkZMd311WCPqj6Zg5gTl4c2xZ3+/qzeF0lijaLcK/6bYXG2ld1q6wGd4NTDf3SRINApmVO8Ui6mhflIwy+LOu+FGLTGMq9YIBTF8oSW2/9Cr+axMP+X42KccG4yV1JyYGkaLPsuXHYtKlwL7/UBQhZ25JkZAciPMVVSSE1eo78KZGtQ/L19r4XiedvR3HSSIlOQXyV0Um4oukd7DKJoe3G0JupdyMR9e95Ev6iE6T/CM3ARXxjSyOFRbG3McmjUR7/S3OsJyWk8c9359nRYFuqZdnTH3hRLGgfHrG9GVXxAn8uU+KRqQWjHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QxC+smxm1V5z5UrVmC55WExCHcCYQjpoqGTLn5tGql0=; b=SpZIrqtLsdnyMx9nJSjr6Zd7WuUmrMifb3ohQJ9teplFqRm1XZ59PgN1XEP6k310evSO1FgCi3dZRNU8qMgKzGuFpTf2hAebvKCJe78lh2OvhHa3s8cqI0TsoXvFGCOP140LaggXY2LvWpxehMedgJEiccSjKzJrGEh4fDU6sdCy6ZquIE4/kU4Tc4099I3Zp73vq6kJpYjhb/HlzJeLFSaxwOONV8/LGtTonfI9Hkl5S0QcSxhMpWqwLVwJ+kuu6CD6ir3mC9nCwt2fhQZH3Qm+nxim6gKyLYKZGN6yjRO1HJzbZg7iVIzPcED7l4t6p6MuIm+Kxkrsva84G1Sxxg== Received: from BLAPR03CA0023.namprd03.prod.outlook.com (2603:10b6:208:32b::28) by PH7PR12MB7793.namprd12.prod.outlook.com (2603:10b6:510:270::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.36; Wed, 13 Sep 2023 16:47:27 +0000 Received: from BL6PEPF0001AB76.namprd02.prod.outlook.com (2603:10b6:208:32b:cafe::5) by BLAPR03CA0023.outlook.office365.com (2603:10b6:208:32b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19 via Frontend Transport; Wed, 13 Sep 2023 16:47:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by BL6PEPF0001AB76.mail.protection.outlook.com (10.167.242.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Wed, 13 Sep 2023 16:47:27 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 13 Sep 2023 09:47:18 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 13 Sep 2023 09:47:18 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 13 Sep 2023 09:47:15 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , Subject: [Patch v2 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support Date: Wed, 13 Sep 2023 22:16:58 +0530 Message-ID: <20230913164659.9345-2-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230913164659.9345-1-sumitg@nvidia.com> References: <20230913164659.9345-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB76:EE_|PH7PR12MB7793:EE_ X-MS-Office365-Filtering-Correlation-Id: a3398da1-ee4f-45be-a3b0-08dbb4791ce5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JgMl9KCvvsym52RU66n30tVCBVAlmH8rIIh66maPvz5FS1PpagVA/uAQ5f7FPtg7cJfsZdxjc1U+Sk/wCHRz9kHnl+k6xUggKgfC/SNa64iAXCoI7wHjkS/Qz40iZVTcejuiTQyEGv4HEo10SGFrpiNZRGxHz8KqUWNhDZp/9knyLiqBhYmN9DTujCE5f29bfgMnhn6PfeiSc5d2MninkK5JSpRRUSPlYvJNiWXQyX1WKrAEWPmWZOHypIZuLMT8zH1Rm6OfbKIBP+NBOMu46cQOSG4FPERKSxrXSA2IWOzKnZ1E1shrekjTEjg7rn4hXp5QVUr5psRhsmSzvVncDYx3rzVfrj0HEME55zZO9dEwYBkMuTT9YxroLNEGczOFZg/ssnXtvlD7XjUJQf4erDjM94/juq6r1X+KDkESo0lqhaGdspj+DEevjkSyBWbATM43ew9qtW4suKtY5nfjX3rHwMDOTSqo3XeKkGtBlsL/6RJqwhCEYEKJ/CwD1HM4vZ+jZ7boNpKdczzhGyUq+qJdSX7YJoscv9mF27oA122HEnWnT+KiW4l7iB+MHSQ2eBPvSHXZxgHEf6LSNx7RDjJPX70s3qt1P1+uPWvJvqP4PGW+xSSIbsL4fyPuY8cxYlUB9SngmNGlOL4PPlsTLif0fe42bV9XrEAUTr3vGa8du5BbSYFleGJdQmeD5pGKOMVXqaCQIMoMbIJdg6bKystGca7STuA6BIWI7DT3MOlg8EaAMYhRT/fpwMTPD2ssNRwggRRaW4J13TVS6OtUtQ== X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(346002)(396003)(39860400002)(186009)(1800799009)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(40460700003)(36860700001)(2906002)(47076005)(36756003)(86362001)(356005)(7636003)(82740400003)(40480700001)(8936002)(8676002)(4326008)(1076003)(2616005)(5660300002)(26005)(70206006)(7696005)(70586007)(107886003)(54906003)(110136005)(316002)(41300700001)(6666004)(336012)(426003)(478600001)(83380400001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2023 16:47:27.0036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3398da1-ee4f-45be-a3b0-08dbb4791ce5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB76.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7793 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Jeff Brasen Add support of "Thermal fast Sampling Period (_TFP)" for Passive cooling. As per [1], _TFP overrides the "Thermal Sampling Period (_TSP)" if both are present in a Thermal zone. [1] ACPI Specification 6.4 - section 11.4.17. _TFP (Thermal fast Sampling Period)" Signed-off-by: Jeff Brasen Signed-off-by: Sumit Gupta --- drivers/acpi/thermal.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index f14e68266ccd..d0bbf42cae9c 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -102,7 +102,7 @@ struct acpi_thermal_passive { struct acpi_handle_list devices; unsigned long tc1; unsigned long tc2; - unsigned long tsp; + unsigned long passive_delay; }; struct acpi_thermal_active { @@ -287,11 +287,17 @@ static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) tz->trips.passive.tc2 = tmp; status = acpi_evaluate_integer(tz->device->handle, - "_TSP", NULL, &tmp); - if (ACPI_FAILURE(status)) - tz->trips.passive.trip.valid = false; - else - tz->trips.passive.tsp = tmp; + "_TFP", NULL, &tmp); + if (ACPI_FAILURE(status)) { + status = acpi_evaluate_integer(tz->device->handle, + "_TSP", NULL, &tmp); + if (ACPI_FAILURE(status)) + tz->trips.passive.trip.valid = false; + else + tz->trips.passive.passive_delay = tmp * 100; + } else { + tz->trips.passive.passive_delay = tmp; + } } } } @@ -683,7 +689,6 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) { struct acpi_thermal_trip *acpi_trip; struct thermal_trip *trip; - int passive_delay = 0; int trip_count = 0; int result; int i; @@ -694,10 +699,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) if (tz->trips.hot.valid) trip_count++; - if (tz->trips.passive.trip.valid) { + if (tz->trips.passive.trip.valid) trip_count++; - passive_delay = tz->trips.passive.tsp * 100; - } for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].trip.valid; i++) trip_count++; @@ -746,7 +749,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) 0, tz, &acpi_thermal_zone_ops, NULL, - passive_delay, + tz->trips.passive.passive_delay, tz->polling_frequency * 100); if (IS_ERR(tz->thermal_zone)) { result = PTR_ERR(tz->thermal_zone); From patchwork Wed Sep 13 16:46:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 13383548 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C272EE01E8 for ; Wed, 13 Sep 2023 16:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbjIMQsp (ORCPT ); Wed, 13 Sep 2023 12:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbjIMQsU (ORCPT ); Wed, 13 Sep 2023 12:48:20 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2046.outbound.protection.outlook.com [40.107.102.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D7AF359D; Wed, 13 Sep 2023 09:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cqw5Ue7C7uSeYW0xJYq/rqwUXY8PYnVTjqVlx7RfFzi4RxvQYclP1k1SAgfgVMgg8jgkdjhCDb5uZCCRW/GGHrXvFuNVockoJbOUyxf4jusbOOSgwuoeiV4k1jSo8xYMpxBIxx+RqZFUXHH3pXN7BG1nACDHJFwXYLFI/JaBynStccykX12qROSjwIy1zkbEMK++XF1DmmmOCDsrwYxzP5/NXzWROEd2iqZDWUDOPABJ/2KBX3clSn+//vrB4qZsdUP+0TT2V3u+Hv7Pf+RYjAo28oE7PkAS0NjrlId9h9yH3hVzZBPckXpmNpIohZ0cYx7N3+8wER/KNYPejOhcZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kwzzw8138+YZ3/lmiNY9SOdnltHoR4qUADwwJh2D/Qg=; b=SDF78mzj+zBVoN8WWIlpCM25g9kO/O9K43y4APD4gXx6ZRfGaL/2gYwNt4kLl7P/udXvu61fHIvwyoYtNrCdxU7FD1h+KUXgiB1FK1ubhOcgECp+7sIxIYmDtHJrNu37+KzTEbzTpDjdAlCtVUEOwr2B5jTLZoxzlRvRTOpnZsSMOz4gXEKmt4+KYZrKhovDztU4t87/7lRr2fNdtxMhkC5WLp8IJsb65FH/hTvNa2o8EequCBfUA8od1hbG9grHbhkjn2EfTxgjSb9lYsbIiItJh/xE45NFuGkykT0tcDFTfVzQnki4/b5pnNoJFOSSHdotZabd4R8/iHvbjtvjZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kwzzw8138+YZ3/lmiNY9SOdnltHoR4qUADwwJh2D/Qg=; b=M9opHYfTO7FGalLZFSiN2Po/h0LBqnBuYysO5vLRmfYNidxG7jWzr/NcxYSjRr/7Rquiu+sb6kbFTpEybJZLDIkYW2yc/aybd5zvPhkHNpwChdAHquuxHPbrC9utkTnWYYfGVSSxKccez+Il0oFAhic+ccAB1y/8mjZMf6PJZSt2bls45DoiH6dX+wMKGgARvh6JRr59rUK1PUhoZykYSPeGmDGq3LnQWiXiYPvwDBw91iAt9KLF5y8tp15yb52IdPVGgRgb9E2u/A2Cj531BxMJQi5ukSTdS6aoXJY+rmvgG6eNhfREEnL8OGT5G7ISMUH4Uno0WcvF2cLh0ZzInQ== Received: from BL1PR13CA0169.namprd13.prod.outlook.com (2603:10b6:208:2bd::24) by DS7PR12MB6119.namprd12.prod.outlook.com (2603:10b6:8:99::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Wed, 13 Sep 2023 16:47:36 +0000 Received: from BL02EPF0001A0FC.namprd03.prod.outlook.com (2603:10b6:208:2bd:cafe::5) by BL1PR13CA0169.outlook.office365.com (2603:10b6:208:2bd::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19 via Frontend Transport; Wed, 13 Sep 2023 16:47:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BL02EPF0001A0FC.mail.protection.outlook.com (10.167.242.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Wed, 13 Sep 2023 16:47:35 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 13 Sep 2023 09:47:24 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 13 Sep 2023 09:47:24 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 13 Sep 2023 09:47:20 -0700 From: Sumit Gupta To: , , , , , , , CC: , , , , , Subject: [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Date: Wed, 13 Sep 2023 22:16:59 +0530 Message-ID: <20230913164659.9345-3-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230913164659.9345-1-sumitg@nvidia.com> References: <20230913164659.9345-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A0FC:EE_|DS7PR12MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: 3af7ba26-6a74-4522-d959-08dbb4792230 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vVjwhxMc48mYqxMqUlmxx49NW/ivPnab5yh9M4ZZbtCjLg48FjY0t9Aey00MgJFGnS7FWbxukhrUbSvSgb/tPE5Hq2z0HqdP0MSYKxdnaJUtQKkmBjT7dBaSwnFU9dH2zRNNFosaEY/SxFV+24NxjcY/hGWuFgGu4lgDbuDpoRBUQIbecSTy3cpHBB512tf2JWkxpVZoJiu/bqe6OrvwWZsLkJEgisXcT7l9BvOgwJOL2pd4ZT2TpzrTZdOGMzeAxMYC/3xmmd3q1XJwapW1N/PGOiV12BMuuLoNS8s7wq9OvuSN03XsE6VNin3gx36A56pB6d/MZB0JIRyD6aCUH7SYmw2uFwhDMiTzaSSHEipuDzn5LBmfO8AaZlFhvhItLInIGWF+jK7H3/5gVrUSznfiZTvEnxukWd1JBtPThmNMwQyQTa43EJpOqavNZBW3a8lws/L2aPEpllo+XUM2gvZm2V/XriiNL5XQupb1S5QqsB5xCWcMHTyndI4gtUjeOdYyy5HEgWw9asVstS2QLqs/XdB/T3JTpnZrxvPpuah9Rn3AAygnRAOCGmk94hfoXfpIel/o2YBUaYQFTBBShpGoa4Qgiq/yP7jmh7Qy4dLP4ZSRuIxyLZCE3XBVa1rnOgRjRvNlzGDYX95d0bYwBH/ZrTnEugvPGl3L6arVrbxHC+RO2/86nXUpC3tY3U0tnXKHyi8/TVvETAlS8Cd/p9FMhsbiI/BBHGSRDSL/iAl7+F8h5KrlYapf8paxpQzx/ajb+smdflHUUrtU6Vq72w== X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(136003)(376002)(346002)(186009)(1800799009)(451199024)(82310400011)(40470700004)(46966006)(36840700001)(316002)(41300700001)(26005)(1076003)(426003)(40480700001)(107886003)(336012)(4326008)(2906002)(70586007)(8676002)(54906003)(70206006)(8936002)(478600001)(5660300002)(110136005)(6666004)(40460700003)(7696005)(36756003)(36860700001)(2616005)(83380400001)(47076005)(86362001)(7636003)(82740400003)(356005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2023 16:47:35.8851 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3af7ba26-6a74-4522-d959-08dbb4792230 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A0FC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6119 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 Signed-off-by: Sumit Gupta --- drivers/acpi/processor_thermal.c | 41 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index b7c6287eccca..30f2801abce6 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -26,7 +26,16 @@ */ #define CPUFREQ_THERMAL_MIN_STEP 0 -#define CPUFREQ_THERMAL_MAX_STEP 3 + +static int cpufreq_thermal_max_step = 3; + +/* + * Minimum throttle percentage for processor_thermal cooling device. + * The processor_thermal driver uses it to calculate the percentage amount by + * which cpu frequency must be reduced for each cooling state. This is also used + * to calculate the maximum number of throttling steps or cooling states. + */ +static int cpufreq_thermal_pctg = 20; static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg); @@ -71,7 +80,7 @@ static int cpufreq_get_max_state(unsigned int cpu) if (!cpu_has_cpufreq(cpu)) return 0; - return CPUFREQ_THERMAL_MAX_STEP; + return cpufreq_thermal_max_step; } static int cpufreq_get_cur_state(unsigned int cpu) @@ -113,7 +122,8 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) if (!policy) return -EINVAL; - max_freq = (policy->cpuinfo.max_freq * (100 - reduction_pctg(i) * 20)) / 100; + max_freq = (policy->cpuinfo.max_freq * + (100 - reduction_pctg(i) * cpufreq_thermal_pctg)) / 100; cpufreq_cpu_put(policy); @@ -126,10 +136,35 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) return 0; } +#define SMCCC_SOC_ID_T241 0x036b0241 + +void acpi_thermal_cpufreq_config_nvidia(void) +{ +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY + s32 soc_id = arm_smccc_get_soc_id_version(); + + /* Check JEP106 code for NVIDIA Tegra241 chip (036b:0241) */ + if ((soc_id < 0) || (soc_id != SMCCC_SOC_ID_T241)) + return; + + /* Reduce the CPUFREQ Thermal reduction percentage to 5% */ + cpufreq_thermal_pctg = 5; + + /* + * Derive the MAX_STEP from minimum throttle percentage so that the reduction + * percentage doesn't end up becoming negative. Also, cap the MAX_STEP so that + * the CPU performance doesn't become 0. + */ + cpufreq_thermal_max_step = ((100 / cpufreq_thermal_pctg) - 1); +#endif +} + void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) { unsigned int cpu; + acpi_thermal_cpufreq_config_nvidia(); + for_each_cpu(cpu, policy->related_cpus) { struct acpi_processor *pr = per_cpu(processors, cpu); int ret;