From patchwork Mon Oct 9 17:18:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 150219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2015314vqo; Mon, 9 Oct 2023 10:19:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEaKx3QZBFq8XTHDV5MsU2ubzfOfPC5YHuXjmtbzlP6iDnV+cppkeOZtsUlLGqkhHZHk8U3 X-Received: by 2002:a17:90a:6908:b0:270:1614:11c7 with SMTP id r8-20020a17090a690800b00270161411c7mr17336985pjj.2.1696871986415; Mon, 09 Oct 2023 10:19:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696871986; cv=pass; d=google.com; s=arc-20160816; b=c+HsyRQyKED8Nmc2NfGrxt94UpfFgHfoqnadOfN5lDxh1f+/qi1LwmutPV+mK0HV80 Gv50I8GR+ir+TX0dYVHEHg7s6ocmVdMKxe2V2DK9rlbhCCPztI61FO50M1HAGGO2XG1I fJ8VgXKLT26lG0y9vRNRHip6A/mqVPPApp7ejULqb3e9yS/9R157yX4cPIwht7GUoljC fUTTimsQUWJSmtgHEZH3YZ/NVjYtXe9heg2pMDQaDXEIWt50skkBjYeCR/JItcx6kK87 f7T5XRKqdWvL9DELxUDeDP9Nc6l8uQoNi+6dVjG1wj2lO8tNnn48eBzJd/1hEzERyyL7 uouA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qDeXdDo90VaiTGL6pyucbmL+eGTtCKZ4n5Z33toR1U4=; fh=unGb0PxJ5fVahQU1umCcRoLhLnQ+wIQ4RXeupiqakAo=; b=vwnCffepBuJOVKuozpm+NWgTUibEGvfrtG0zJGCsZgjhXhbnU/lQglHFeyIUMDvjO6 mGvxcp32vqPU17/qcf3ajioWdXVci0iYeQnTFjWW9J+AT+biKCgT7d860qpMxHgZzLZG r6HNAmXtf+JcgvIKeXXCVf1KKrBciVhoNaP1Xqha5Y7To4F173YbNT9Jzkh6aOoczGky /O0FQ4Q8VATqBwRC6gZvlJL3+0x7TIYLxyGzDUS7p7wPx/K94bEzz09ftlLsRCLTeU5w Am2m74bIKEs6mO8RZd3ZNByyhvmEabQ0vgK135ZpTZiEIp9YfcCv0pUrAlMx4NePAyn6 D08Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=cOLes37G; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id n3-20020a170902d2c300b001bf741231f7si10961084plc.570.2023.10.09.10.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:19:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=cOLes37G; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2691180C922B; Mon, 9 Oct 2023 10:19:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377861AbjJIRTQ (ORCPT + 18 others); Mon, 9 Oct 2023 13:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377634AbjJIRTP (ORCPT ); Mon, 9 Oct 2023 13:19:15 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE65CB9; Mon, 9 Oct 2023 10:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IUGIhZSgQhb3ro38uvWzPSut+GmGWKwonUl5sGaI3jDG66A4+u3IA/bScnJQ0pN1wjXNiQdph2qk3hdDp8PBKk8WV1ozdq8ox2FAXYLcsGUhR93GXsXw27UZosZAjY7GzZK80bqB8xgrfFlv+L1FRVuZd/UUClLBbuDM90ykyKEaBjwHl1LsQUu6A18+64I2lgyOxp6obl0iphhRkI+HkxjEJMemC5lARGeecp7fXgqUxokhPjLQUJLYRdjgUbScpH2VaccLxJIqMMgRtr9WGW0broMrX/6sR574qJ8F5zS2ejwDPgZjhNUpeDpFZUHlX4KNTcpVUZ619pAbP00GoQ== 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=qDeXdDo90VaiTGL6pyucbmL+eGTtCKZ4n5Z33toR1U4=; b=L23XRMfWl2JCYzhJ9umS9gx3SBcs4n9Dtdtd1exwwVApAE4qoDnQYj6zlDsr5p18bTPG4Rp1D3qrqzLfoodpiuOl7/eaJ2DrTA/j6cNL/rJB4ASxi9Ap1YKrawahiaYDK8Cwx6+DT/A7kd379Wo3HWStWixAXJV1af54KD6/eouE3tIGFVgCX0/c+9fk7wfmLdXSLFDSuM+/8N9ih0TKE2LqWP3z5NKkhHsAIzx6RUfcEIEu1IpqwktC9e2rUXahaATLmTBZL25Zz53+AaSrO6N5xMgZUwVHP/H8C4j+t1fBnPnObzY+DhzNw/Unp9B4NiLqyFEbrbfoCbhzwlIsww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=qDeXdDo90VaiTGL6pyucbmL+eGTtCKZ4n5Z33toR1U4=; b=cOLes37GOBeVoowwRSqM1IZ7r7z5gVyjSsUi3ATIqf69b8r3Uj+E22qYZrY61GVxbMzUusPAF27RRruDtMrOuzIXjX9QQLd3nQXWXqjVVTU0NMDONIzT+KkhDIiHgFf4WCMXiH4Udexiv0Oa53YL7FKKWlfW5T1SUnKXTyI14+OGLn3v+b8pCPXiAeZGMhdNeDm8oCP1uw89cVxyhPDscUlFXYomezZl31NsVdYwHi+tBLXNPOyyYPvC+Atuiv6CnBzuYpKe8jUnIX4jSoCW1gk9q7UPvqlaYbme+KIpIc1wTvdxIBH9EsydZo6MYMcMdErnCFQbNNF/ktYhV2ohPQ== Received: from CY5PR22CA0101.namprd22.prod.outlook.com (2603:10b6:930:65::15) by CY8PR12MB8412.namprd12.prod.outlook.com (2603:10b6:930:6f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Mon, 9 Oct 2023 17:19:11 +0000 Received: from CY4PEPF0000E9D0.namprd03.prod.outlook.com (2603:10b6:930:65:cafe::2f) by CY5PR22CA0101.outlook.office365.com (2603:10b6:930:65::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Mon, 9 Oct 2023 17:19:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000E9D0.mail.protection.outlook.com (10.167.241.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 9 Oct 2023 17:19:10 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 9 Oct 2023 10:18:54 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 9 Oct 2023 10:18:54 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 9 Oct 2023 10:18:50 -0700 From: Sumit Gupta To: , , , , , CC: , , , , , , , Subject: [Patch v4 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support Date: Mon, 9 Oct 2023 22:48:38 +0530 Message-ID: <20231009171839.12267-2-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231009171839.12267-1-sumitg@nvidia.com> References: <20231009171839.12267-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: CY4PEPF0000E9D0:EE_|CY8PR12MB8412:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ba80d6e-682e-4145-9f28-08dbc8ebda73 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ST1xfje7w+S/tettbRS19238mBFAAQz2ALjRfxU6YGWjHiYJpgbOjoIhRuSFD/rPlAXKQnnCLhzW5atR3DAUgOCo32l/ku0dkoPmzNAC5ONJ4tLDyurZhxHMFFrP5akdub6kg6x0DgHXvWGmROJCigtq8tE0wgjEb6a5naaMQp5fFEtC6CcaHHl4EvA3l6DJrB8EbhsmqftmC6TplkC0iqiPQe6vt/LPjwOjxNcNH96u6TmUoqeEpeEfPcvl1uGcEEOG6IPBBHcgU3C4yzHI+ZtCI3wrxnv68GxpQjokQ/GOmEKbidNTHa3fqz5Mkirb0iw5KbIuht/nb1YXuUtz5vgrVlKm3wLYP7OgB8TybabCq+0arxSXmuRxj/4qyCYbdR5UDCHr5wydecUyKd6bMVL9KmtI4KAEOuYbUtK1f5DpVBQ5uMxb8jIt1tl0LE3TYqndzVqVpwXlPgLSXJ9RVdA05I/qlp3fIWsM0R0c/URe/r17qonOrbZ6T6l/TJdJdaLfiAAgJxh5rgDJ7bfmvIW9GXG/TgoIFuXyNqpGddDbk+0xmJv/w0OBbS3+nfmzRD+SGLj4DTRMDQkDm+0KJdQqcTcWKhEn4U5I8f9xJrzZauwT3iAN4KoX0O77LmG0eFHZEmW0XGnX4Gt6p+1N45n+5fZtP8ZCHf0bwHvfUiXVoK2ywidfooAPU9/JT1B+SI3dHxH5aVr2NzaBLM9exw2UpmUG3RoAFTWRH99+8u1+J8rwmxQFlRlDl0ukLi+lSFa6wSwh75dXR3jivoAccQ== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(396003)(136003)(376002)(230922051799003)(82310400011)(64100799003)(1800799009)(186009)(451199024)(46966006)(40470700004)(36840700001)(40480700001)(316002)(26005)(47076005)(336012)(426003)(83380400001)(8936002)(7636003)(82740400003)(36860700001)(356005)(8676002)(40460700003)(4326008)(70206006)(478600001)(70586007)(41300700001)(54906003)(110136005)(2616005)(5660300002)(107886003)(2906002)(6666004)(7696005)(1076003)(36756003)(86362001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 17:19:10.9531 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ba80d6e-682e-4145-9f28-08dbc8ebda73 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8412 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 10:19:44 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779299239818511486 X-GMAIL-MSGID: 1779299239818511486 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 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 356d577689ff..e360aeebd249 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -90,7 +90,7 @@ struct acpi_thermal_passive { struct acpi_thermal_trip trip; unsigned long tc1; unsigned long tc2; - unsigned long tsp; + unsigned long passive_delay; }; struct acpi_thermal_active { @@ -404,11 +404,16 @@ static bool passive_trip_params_init(struct acpi_thermal *tz) tz->trips.passive.tc2 = tmp; - status = acpi_evaluate_integer(tz->device->handle, "_TSP", NULL, &tmp); - if (ACPI_FAILURE(status)) - return false; + status = acpi_evaluate_integer(tz->device->handle, "_TFP", NULL, &tmp); + if (ACPI_FAILURE(status)) { + status = acpi_evaluate_integer(tz->device->handle, "_TSP", NULL, &tmp); + if (ACPI_FAILURE(status)) + return false; - tz->trips.passive.tsp = tmp; + tz->trips.passive.passive_delay = tmp * 100; + } else { + tz->trips.passive.passive_delay = tmp; + } return true; } @@ -904,7 +909,7 @@ static int acpi_thermal_add(struct acpi_device *device) acpi_trip = &tz->trips.passive.trip; if (acpi_thermal_trip_valid(acpi_trip)) { - passive_delay = tz->trips.passive.tsp * 100; + passive_delay = tz->trips.passive.passive_delay; trip->type = THERMAL_TRIP_PASSIVE; trip->temperature = acpi_thermal_temp(tz, acpi_trip->temp_dk); From patchwork Mon Oct 9 17:18:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 150220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2015398vqo; Mon, 9 Oct 2023 10:19:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERWiKlXTeJK6TWT1OO4+yhEXiGI2DPDWA9XeQQRKQ0ZDmWSr5Ukh2w6k7mmJtlV2PuUCA2 X-Received: by 2002:a05:6a00:2e90:b0:690:3b59:cc7a with SMTP id fd16-20020a056a002e9000b006903b59cc7amr21049808pfb.23.1696871997626; Mon, 09 Oct 2023 10:19:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696871997; cv=pass; d=google.com; s=arc-20160816; b=a5a6V2UDbY98VXEOeZd4ZNqQPGUwub0kRcKGqrspsSqhAZnNTx9e7yZeoJ8UflGwWq OaU/CS1UM979+D34HyswRWbghs3myIRHQBIKDi2T0bRvnR/Icvh81OEEIriIMWsM8UPB DA4J+L1RKqVPgBkIsYac2SMnyO6QnhioaiSyWZxoGUn7qp+O9qBYnvMpyf0rKXiWxt4L Nlm5FclzJI2hA+MwwodxdX9Ktw1DAU6YqiADae5XmM60CxE1jSWz8B+fMg63gY1mqsHw 4dw9PqzBhtI9QkkvjSqyweXijZsFoA4eS+iSmfeqOBlfeq3i3zXzLUwN119FMc9zCm30 gdBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=x+IxZ3/+FdjyFPqEqyBy04dvpDEj10CZthXgLZspFDE=; fh=unGb0PxJ5fVahQU1umCcRoLhLnQ+wIQ4RXeupiqakAo=; b=0A/BFdb5E3uY48jwKU41ouEnp0MdikA7y4IF1IAF5Gecw+mUom78kjwiqCITCeoSjh q69MLOaBgZbyX1loHapGxajcAahzzo4Y7nLiNXX9po54fKoFAfNJ33ZDk3Ym105ZMVev IunFyAFRkUKP5s12CrsuNr3g/SVY206I6IW+2w2214SZ+FsYcLqhDAI1AOHlSHIomrjz JITUmgdHOFG0CfgI8mpcyacnGUa0QsNxn4gbN2ryPpHnyqgktAbWMTBB39X2Vmhge3Kc gr926fm/xJOpWy7HI6dXYuplZ9I95SK2uWlhPQw0578LfyY0Pws6JLKQsrJ4gBY+VhU+ uuVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=sb3yes+V; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id q3-20020a056a00150300b00690f8edee16si7894050pfu.275.2023.10.09.10.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:19:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=sb3yes+V; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 26A7981C0C86; Mon, 9 Oct 2023 10:19:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377818AbjJIRTa (ORCPT + 18 others); Mon, 9 Oct 2023 13:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377880AbjJIRTX (ORCPT ); Mon, 9 Oct 2023 13:19:23 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2055.outbound.protection.outlook.com [40.107.96.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21D23E9; Mon, 9 Oct 2023 10:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ieZkMki8SS5AJZcLrTGZWJ8176efaL84WeYxSVl9tWtxdlsJybzeKrbU+4QaLyy+3DYzLrmjP4M2TsirKjlsqG34ZIRm0zDNXIFF+tG26MMsxbXVN8YhTb6QG+3V+evMDnVa2F1gtNk9ckSL2LCz988EOniJqjDVEB8/HABJfht8UTTFwXeqoz0jYC48pL2zXWEqBRBjIe21Cfo6xliYaWA/fyULrs0tgunIX0vpT6rtOUUReRn4FiCOGM+P6JtKisupir4H+oOikQkmwfLb9+HJZiMohsm61c5kDAfCpC/Co+Ni3ptJMxmW+12Q8052i7eYTefo3FrHSGTkMiu0Fg== 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=x+IxZ3/+FdjyFPqEqyBy04dvpDEj10CZthXgLZspFDE=; b=cr8vjRQBUXuq7i6ZVNXJhF9JLKrSEYJ0WVqyuyNBOz0Wvux8hcVu/7xB+QbYvNykzZNi67ypiPNeqZ9kpVK2OjU1EpMnnQrL8UGVka5zit5iJiBU4M7Bai19ZwDxYbBi1XkhWpRlp9dPeVR8hx6cC9diKwew5AwnL6HQUUF4k4a2GIsrFndaAA02kVD8s0H2CEsBoHj1T7KPczn9NijJDlDgd/+jTzAZzV8wF8ZURMaFVLwF7FLTFb2hit/HYBkhhtcAUjvgtk+rVIrko+yenznN/Gi5mIqNPkH3AOmYX9yZ+bQkEYPkKqkJgVSupAb+4z+l2gCvOEqGMIG5xO+5Ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=x+IxZ3/+FdjyFPqEqyBy04dvpDEj10CZthXgLZspFDE=; b=sb3yes+VqvzCNFaz27fj+OHNDmQx5dKz/en6MK0ymmvodNyKpOYSidgmTPSIB5WK67vjfCvSiSvWinvmEnM9BJFJKHPp1FHWTk5IcIoDEy5DGaB8yElC7qDRpdpi6uS7OVoY3Lrv+7NaZSTDe30mWgPU9kmWVcTH0qF01onYBx9VwZ1HWc3rcKUNO0hpJNDxbC8XzH61CGSr/IIEK+w8b4LGi/YKBXwwUkLiIoJ5IXYbbGHUyLcPXqz/UMaiaITffprsgrEmZwhhkLaRSBlAUqJAfpy+BdFUyXcPvn0CImbutqbISbbV4YTOM65nHzq1yRrnRGTYj8r0QXovq2INcw== Received: from CY5PR15CA0234.namprd15.prod.outlook.com (2603:10b6:930:88::24) by CH2PR12MB4246.namprd12.prod.outlook.com (2603:10b6:610:a9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Mon, 9 Oct 2023 17:19:15 +0000 Received: from CY4PEPF0000E9D2.namprd03.prod.outlook.com (2603:10b6:930:88:cafe::e0) by CY5PR15CA0234.outlook.office365.com (2603:10b6:930:88::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Mon, 9 Oct 2023 17:19:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000E9D2.mail.protection.outlook.com (10.167.241.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 9 Oct 2023 17:19:15 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 9 Oct 2023 10:19:04 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 9 Oct 2023 10:19:03 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 9 Oct 2023 10:18:59 -0700 From: Sumit Gupta To: , , , , , CC: , , , , , , , Subject: [Patch v4 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Date: Mon, 9 Oct 2023 22:48:39 +0530 Message-ID: <20231009171839.12267-3-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231009171839.12267-1-sumitg@nvidia.com> References: <20231009171839.12267-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: CY4PEPF0000E9D2:EE_|CH2PR12MB4246:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cd70e1a-133d-4b1d-974f-08dbc8ebdd21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1J+rwqavycv4SV8YzzfNIhbMcsjA+b42QvsQmtu2PpPJgUDNTTUJBjYd4JyN01exZJnI2oyZTi/QDAZdcmd3pcy5BTZH5kSeevbBxMDZ2pYeL4c/PYFRVJc/wOepYfOrDJlUACNwcYYSIDJYKWCem2ziY2/R1jhesMepofF/997KCJmdNMrjFxMLXoBxtsW1YVa4OKFRHOxBq+7HD/HXfivkL6oQx1j2k/bbIXMTnB7OL5sgbszTB+Wqj2d8AeHtHmdtYL9o7xZ3VAqX2gELrbA+YqQly5gBEHH0OGTY9TS+CqjQd41c693CcfKy3Q7NH4zIBn35RzQCn9czWPWYTKAQsJ7usMAelx0YmMAn9rjGzkw3nehkV9bHT7DXNVJt27tZtN+Y85SvYi8tCMjutItRFydKDcPjHt40svz8SOSGbJEfUFmIFp3u6TKUzxy3sTBRz8AEBUf0/fPC70L0pvbotRmXHDtdkUVFwgvZDRhov04CvQy4K/k4m0oyepdovv0zrkbT11iGRsXEDSK+51JIJG65y0BTO9sajcGBMw9D5y20M/nTEKl+LGkIGhYoa+MoTFIyrc/DP5gv6edIc4N/2W7FlU7SEOgOIEjlabWJeA7b5X6+3Yjie9QqKHWcLhVsiHYUVXyt1iWfGhO67rCH2NyFUkEhGYCx1MQ6qtwL9mJFE9SGp8MpbX2yswz+IKW77olGRPx5CzmiuIs402gZYbcLsgD4q6jjxKoyBcMIw4OqCKJm5C1mUjpva7DN34PJsesMqKLtCus8oCnUdg== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(346002)(39860400002)(396003)(230922051799003)(82310400011)(451199024)(186009)(1800799009)(64100799003)(36840700001)(46966006)(40470700004)(26005)(426003)(1076003)(336012)(2616005)(36860700001)(478600001)(7696005)(6666004)(47076005)(8676002)(107886003)(83380400001)(4326008)(2906002)(8936002)(5660300002)(54906003)(110136005)(70206006)(70586007)(41300700001)(316002)(40460700003)(7636003)(356005)(40480700001)(82740400003)(36756003)(86362001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 17:19:15.4486 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2cd70e1a-133d-4b1d-974f-08dbc8ebdd21 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4246 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Mon, 09 Oct 2023 10:19:55 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779299252026585343 X-GMAIL-MSGID: 1779299252026585343 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 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 diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index b7c6287eccca..52f316e4e260 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 __read_mostly = 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 __read_mostly = 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,29 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) return 0; } +static void acpi_thermal_cpufreq_config(void) +{ + int cpufreq_pctg = acpi_thermal_cpufreq_pctg(); + + if (!cpufreq_pctg) + return; + + cpufreq_thermal_pctg = cpufreq_pctg; + + /* + * 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; +} + void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) { unsigned int cpu; + acpi_thermal_cpufreq_config(); + for_each_cpu(cpu, policy->related_cpus) { struct acpi_processor *pr = per_cpu(processors, cpu); int ret; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ba3f601b6e3d..052c90d7479a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1541,4 +1541,13 @@ static inline void acpi_device_notify(struct device *dev) { } static inline void acpi_device_notify_remove(struct device *dev) { } #endif +#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY +int acpi_thermal_cpufreq_pctg(void); +#else +inline int acpi_thermal_cpufreq_pctg(void) +{ + return 0; +} +#endif + #endif /*_LINUX_ACPI_H*/