From nobody Sun Sep 14 18:32:52 2025 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 D6232C00A5A for ; Thu, 19 Jan 2023 11:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230516AbjASLvX (ORCPT ); Thu, 19 Jan 2023 06:51:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbjASLvS (ORCPT ); Thu, 19 Jan 2023 06:51:18 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2061c.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::61c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB5A646086; Thu, 19 Jan 2023 03:51:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Er7t9wN9bYry+DRqpqPOSmRBNHkwUQfQch08BH5L9IB9PaS+JywmuQ3ZNW2gzdSxBQAwegr4NkaCk7ta5Yh2Y9Zmt9EfPfFgdAtKfVVrbvBB3pIi4CdAh3/lUNHbH1i9uaVvzs9q0FCGrjEd1SYyCargg16ONHwOdthK5xmYqegpfTZaB5csTX2W2bcUwWdStGCqTAHLGL6kdwSByNpHX8ThAsljgg1kxKQMeDHrziwMX2i3d1pbQqq7kiAhfu6IXLYYsgP81YoQtyN188hurAgD0s/SCVPQdUAYyGIYLGH1S8EgSe61Gga7XcDr/8qfeL3O+JXXWYduBpbz25pfdw== 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=UAmu7Y2MS+O8fjWpELf1F2AX3fR9gUXskyFwpXcHx9Y=; b=N1/iP3SKi01lVvneAcZalvSEqwhy5vKdq8hGR4njeew+Yxa5BfPA/A3SH6YAeTifmxIdr9LLdosaoCJsOgf9SJqjZ2cZsSHUuMtztJnjd7mVCbk0HGQxYtD8ajLhTyvwqO8G4lIRs/Ru0xQGJN1vtSm2on0SBd7FvggXiw9kdk/vh5X2HFki7mgbFAq8PDI1cnzG0wOOlpdxLIEuVql4k9UDVthLjK32WkQXdIqZjzhiDf6I048bXlqdfiDL2hCEWpD33hoCJOG/esXZRZWMwSTl+ComOuIJRg2y3ZNu59SRjv/QyKwmSR6f5YjsVc+HFaEsHuw0DNr55U23HTLxBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UAmu7Y2MS+O8fjWpELf1F2AX3fR9gUXskyFwpXcHx9Y=; b=CTOAPsnRDDvLeeSGRCKFUa4cUVOGIU4+2TgSPruj5clPW40NHEBJDJe8VAzukAP9gQhVBX1MAocjQ3koyQpW+xA7V6uURLQoUzbF0bQWx765O0fdm+1ci3t8WqIKEKg/BVnd/LWPLTRmGYb6rNE7ni2OdQ0hEtvDjDNgZgfuuMg= Received: from DM5PR08CA0026.namprd08.prod.outlook.com (2603:10b6:4:60::15) by CH2PR12MB4312.namprd12.prod.outlook.com (2603:10b6:610:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 11:51:07 +0000 Received: from DS1PEPF0000B074.namprd05.prod.outlook.com (2603:10b6:4:60:cafe::fc) by DM5PR08CA0026.outlook.office365.com (2603:10b6:4:60::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.25 via Frontend Transport; Thu, 19 Jan 2023 11:51:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000B074.mail.protection.outlook.com (10.167.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.11 via Frontend Transport; Thu, 19 Jan 2023 11:51:07 +0000 Received: from beas.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 19 Jan 2023 05:51:01 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Wyes Karny , Mario Limonciello Subject: [PATCH v3 1/6] acpi: cppc: Add min and max perf reg writing support Date: Thu, 19 Jan 2023 11:50:12 +0000 Message-ID: <20230119115017.10188-2-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119115017.10188-1-wyes.karny@amd.com> References: <20230119115017.10188-1-wyes.karny@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000B074:EE_|CH2PR12MB4312:EE_ X-MS-Office365-Filtering-Correlation-Id: 35d22499-4cbd-41e6-afd8-08dafa137350 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MNyRYn5DH410EwtGE16jrcYqQ7szWWExEenDiTCAi6be9089W46u/9cc6HSAhgnVQUO7Wp7uW3JOOXv898dBg8fThboJuGKWTOcGAn2uluNCLre4p0fBu1aqPufYuPybwBMjg9TMHquVZ2pl1D3HPdbHN3QGqB4Dg59YxnTbfOGbwQH/ppuFa6AwgK9OghsQElXZkUFcGNFIOZitXHhgtNxltQ2czG73mXJ5J2L8MP876MsrauTBkEfKdTnMK+mewToyDXYX6+nV6bE8g3P/bVmHnKuhUQEH/bjWB3MkfjZssAEgAM6zVXBoCAngw7tNmo9RMro9JmS6gcTw/8MNlJMnEVSAHyIK2UStZzfJb7rncQTvYq434SrSa3tKcGpqORagKXyDkHPE3qw/nKZWNMHHp5ueY5JIKDgSWSS4d6HCp0tpAoeTdWqn3Q8W0SjTgDUyjihzkayqxGLpr9R0MFtiy+KgQUPTsZd2JXsTLjQQXXTf1T5Q+kCwkMhMD91n+BuR267eaIxpjSIE4ghWZ426roWdj/RvZUqiJyIWwjkvtUkf9bd5Qw4VLXe7SZouwTus1rKQU+iWE+vpJpP54u270q5mZvw+0aX1wWWulp3n9BA3qDTANF1Y08R01bh5gwS3WWP8a2chO8ki4lrz1Rj/TujSFeyocgVHOM/RFOCSnqBHkXnZdn7vhERh2kVg0EMDX0OsQXppY8bSA464qq6N1Yp4IQwngMq+RCx/i98= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(346002)(136003)(376002)(451199015)(36840700001)(40470700004)(46966006)(44832011)(16526019)(186003)(26005)(2616005)(478600001)(6666004)(1076003)(6636002)(110136005)(7696005)(336012)(54906003)(70206006)(70586007)(8676002)(4326008)(426003)(83380400001)(316002)(41300700001)(47076005)(7416002)(8936002)(5660300002)(2906002)(36860700001)(82310400005)(40460700003)(356005)(40480700001)(86362001)(82740400003)(81166007)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 11:51:07.1555 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35d22499-4cbd-41e6-afd8-08dafa137350 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000B074.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4312 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently writing of min and max perf register is deferred in cppc_set_perf function. In CPPC guided mode, these registers needed to be written to guide the platform about min and max perf levels. Add this su= pport to make guided mode work properly on AMD shared memory systems. Signed-off-by: Wyes Karny Reviewed-by: Mario Limonciello --- drivers/acpi/cppc_acpi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 02d83c807271..c936ff503965 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -1487,7 +1487,7 @@ EXPORT_SYMBOL_GPL(cppc_set_enable); int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) { struct cpc_desc *cpc_desc =3D per_cpu(cpc_desc_ptr, cpu); - struct cpc_register_resource *desired_reg; + struct cpc_register_resource *desired_reg, *min_perf_reg, *max_perf_reg; int pcc_ss_id =3D per_cpu(cpu_pcc_subspace_idx, cpu); struct cppc_pcc_data *pcc_ss_data =3D NULL; int ret =3D 0; @@ -1498,6 +1498,8 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *pe= rf_ctrls) } =20 desired_reg =3D &cpc_desc->cpc_regs[DESIRED_PERF]; + min_perf_reg =3D &cpc_desc->cpc_regs[MIN_PERF]; + max_perf_reg =3D &cpc_desc->cpc_regs[MAX_PERF]; =20 /* * This is Phase-I where we want to write to CPC registers @@ -1506,7 +1508,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *pe= rf_ctrls) * Since read_lock can be acquired by multiple CPUs simultaneously we * achieve that goal here */ - if (CPC_IN_PCC(desired_reg)) { + if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max= _perf_reg)) { if (pcc_ss_id < 0) { pr_debug("Invalid pcc_ss_id\n"); return -ENODEV; @@ -1529,13 +1531,11 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *= perf_ctrls) cpc_desc->write_cmd_status =3D 0; } =20 - /* - * Skip writing MIN/MAX until Linux knows how to come up with - * useful values. - */ cpc_write(cpu, desired_reg, perf_ctrls->desired_perf); + cpc_write(cpu, min_perf_reg, perf_ctrls->min_perf); + cpc_write(cpu, max_perf_reg, perf_ctrls->max_perf); =20 - if (CPC_IN_PCC(desired_reg)) + if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max= _perf_reg)) up_read(&pcc_ss_data->pcc_lock); /* END Phase-I */ /* * This is Phase-II where we transfer the ownership of PCC to Platform @@ -1583,7 +1583,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *pe= rf_ctrls) * case during a CMD_READ and if there are pending writes it delivers * the write command before servicing the read command */ - if (CPC_IN_PCC(desired_reg)) { + if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max= _perf_reg)) { if (down_write_trylock(&pcc_ss_data->pcc_lock)) {/* BEGIN Phase-II */ /* Update only if there are pending write commands */ if (pcc_ss_data->pending_pcc_write_cmd) --=20 2.34.1 From nobody Sun Sep 14 18:32:52 2025 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 16B75C004D4 for ; Thu, 19 Jan 2023 11:52:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbjASLwE (ORCPT ); Thu, 19 Jan 2023 06:52:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230235AbjASLwA (ORCPT ); Thu, 19 Jan 2023 06:52:00 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2043.outbound.protection.outlook.com [40.107.223.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED693302AA; Thu, 19 Jan 2023 03:51:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LD/ib+pei047tkZsycf7B0nSRddMsdTRS4eGYilD70idZDvn5dikiK5nafUGdI3MlemqZAFrJyoL3T4hsvmspFAhobvt+iI0VsfblIqmI3hp93y2zfrDGq83NBgarCGd6c3jeo5r2BQLHtPJlBbF/wqWY0+XjNRQ+n3zu0bzqJFXIXM8/GwtgKUroTrQnC00sONQj2MKPuroedVb1+IJot/1BnbGT3CaXEL9BMLvkWwt9FAS6jd2rCAZ0SF90jvSsIjFNbdp8Z/LMU4dzZkoG6MIrNAgq6w76uR4UKheYipCiFDm6j23cNFr1iJQJY1wbtOUcOQYERaDOaicJ7VZXg== 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=bhVkymXeHoZowm758idB9fs3vqfG/nYfIbxZHkSfneI=; b=Gk89lK4iRvX7cYHSDXJ+tGyEsFKIP/kQKY2jRIZcwRKSNX54D70Pt3Yp25gYOFjHPtWLXi1hXubmTYXFm6aiaMzKr+fHjIRqJQGKTPLSLBFPhsf6vd+VoMMbF2RtqFaiS6KZca0jvFeAXuc32xyg+VSxPoDjMno3LoCpPSEcJe8r9vnaOg2jZaqnXs23EgFBgXgmmPDNVMhVgJmZ0pPHyK28Y96R+TYtdwoIAqplR+nQhR5Ks2i+LLVA2ML1YQmtOxupH+lGt/LahIGBhPe9HgPVB5wiQh7cs2PB965Wqdhsi/Y8u4cdG5r7U7OiHYApOHu4wPnUCnsFWey2Cmhw4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bhVkymXeHoZowm758idB9fs3vqfG/nYfIbxZHkSfneI=; b=4Z2Mp+x7jY2C9rrDk449WSp/ZK+BN9LqnrFATbzJv1soG0qOu6IdunK/4ieABPM24AlWu7BVGeY42jLpKy1ZYpIKyXO3yHRJvf7QVMm+/HhDQFXeguuv/DPSwrxxWukVLEIJmLoLGRBXzIIh9IOlOPRioB5BcLJ1XEJTYjOyb+E= Received: from DM6PR03CA0032.namprd03.prod.outlook.com (2603:10b6:5:40::45) by BL1PR12MB5349.namprd12.prod.outlook.com (2603:10b6:208:31f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Thu, 19 Jan 2023 11:51:57 +0000 Received: from DM6NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:5:40:cafe::f0) by DM6PR03CA0032.outlook.office365.com (2603:10b6:5:40::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.25 via Frontend Transport; Thu, 19 Jan 2023 11:51:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT028.mail.protection.outlook.com (10.13.173.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Thu, 19 Jan 2023 11:51:56 +0000 Received: from beas.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 19 Jan 2023 05:51:51 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Wyes Karny , Mario Limonciello Subject: [PATCH v3 2/6] acpi: cppc: Add auto select register read/write support Date: Thu, 19 Jan 2023 11:50:13 +0000 Message-ID: <20230119115017.10188-3-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119115017.10188-1-wyes.karny@amd.com> References: <20230119115017.10188-1-wyes.karny@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT028:EE_|BL1PR12MB5349:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a63b335-fea0-46d1-1589-08dafa1390f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MRvvuNDNxlMOhSIGXfWvoGdOVnNNButv70DzHhnvbQYmb4yuYa75VoHwQsThck8ufBN+SbNRSXWtEEkilUkusg810zYhEgXR4hhI2XX5x8vCFj1PDfdXoydVdip4Gx1lOX+LQaLfuGs+5xnCt+DhVxN3rMRWNX/p5ZkXXBiDmR0R2odCLIYy8BbQQ4dS7zUHkLjJ3IUImaKFlxfpRsp/AQZt1wThDhgrjmXOLlCrSh5HK/ffF30zybb7yhJ864gEL0uPwgEOARaabInY933m0k0y9t+uV002+DWPADiPUyYN8szj643Nst3B6nUeRKhvsRs8A3FGx51IycT2yH4z/0RLBPVNB44dqU1lmvo6BhBeJ5gLboOOiPnshTEq1FQru0y0fMGAY0ZAFKdikBGcYQ72bN0R4HPxwoY1Jq1WDautNefyS8/0IwotHCyGPD+HpXphIrLhoLtWr6P3eMtHASYpTS78x+lHD7D3xgU5RtXkOX2dqePU7ZH6RjlQJNXVLkxJMKzXlfutfWAjJN84tE8/bB8ghFayUYGESes1YmjJCcFRCPo1i40C4IzP2X0Lw0GrMOq6fCtFiuZZ8dWpncnQd32mFrK5DSkHz7KgMDzeKGXC59AIsa/y8UY17b4l4Zl4gmm99Rs4Sj30rh9/9k9XRyabUUDX4FzCQ8VgcaZwigVeJIdzkkWVynJHW+O6tk2jeYdU9e/Xcibh+6rhbRLtleMxQuHu0d3k65jm5OQ= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199015)(40470700004)(36840700001)(46966006)(8676002)(4326008)(70206006)(41300700001)(8936002)(110136005)(6666004)(44832011)(82740400003)(2616005)(82310400005)(316002)(6636002)(54906003)(2906002)(70586007)(1076003)(16526019)(40460700003)(36756003)(5660300002)(7416002)(86362001)(478600001)(7696005)(40480700001)(186003)(81166007)(36860700001)(26005)(356005)(83380400001)(336012)(426003)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 11:51:56.8606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a63b335-fea0-46d1-1589-08dafa1390f1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5349 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" For some AMD shared memory based systems, the autonomous selection bit needed to be set explicitly. Add autonomous selection register related APIs to acpi driver, which amd_pstate driver uses later. Signed-off-by: Wyes Karny Reviewed-by: Mario Limonciello --- drivers/acpi/cppc_acpi.c | 97 ++++++++++++++++++++++++++++++++++++++++ include/acpi/cppc_acpi.h | 11 +++++ 2 files changed, 108 insertions(+) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index c936ff503965..e47b2cfe022e 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -1432,6 +1432,103 @@ int cppc_set_epp_perf(int cpu, struct cppc_perf_ctr= ls *perf_ctrls, bool enable) } EXPORT_SYMBOL_GPL(cppc_set_epp_perf); =20 +/* + * cppc_get_auto_sel_caps - Read autonomous selection register. + * @cpunum : CPU from which to read register. + * @perf_caps : struct where autonomous selection register value is update= d. + */ +int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps) +{ + struct cpc_desc *cpc_desc =3D per_cpu(cpc_desc_ptr, cpunum); + struct cpc_register_resource *auto_sel_reg; + u64 auto_sel; + + if (!cpc_desc) { + pr_debug("No CPC descriptor for CPU:%d\n", cpunum); + return -ENODEV; + } + + auto_sel_reg =3D &cpc_desc->cpc_regs[AUTO_SEL_ENABLE]; + + if (!CPC_SUPPORTED(auto_sel_reg)) + pr_warn_once("Autonomous mode is not unsupported!\n"); + + if (CPC_IN_PCC(auto_sel_reg)) { + int pcc_ss_id =3D per_cpu(cpu_pcc_subspace_idx, cpunum); + struct cppc_pcc_data *pcc_ss_data =3D NULL; + int ret =3D 0; + + if (pcc_ss_id < 0) + return -ENODEV; + + pcc_ss_data =3D pcc_data[pcc_ss_id]; + + down_write(&pcc_ss_data->pcc_lock); + + if (send_pcc_cmd(pcc_ss_id, CMD_READ) >=3D 0) { + cpc_read(cpunum, auto_sel_reg, &auto_sel); + perf_caps->auto_sel =3D (bool)auto_sel; + } else { + ret =3D -EIO; + } + + up_write(&pcc_ss_data->pcc_lock); + + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(cppc_get_auto_sel_caps); + +/* + * cppc_set_auto_sel - Write autonomous selection register. + * @cpunum : CPU to which to write register. + * @enable : the desired value of autonomous selection resiter to be updat= ed. + */ +int cppc_set_auto_sel(int cpu, bool enable) +{ + int pcc_ss_id =3D per_cpu(cpu_pcc_subspace_idx, cpu); + struct cpc_register_resource *auto_sel_reg; + struct cpc_desc *cpc_desc =3D per_cpu(cpc_desc_ptr, cpu); + struct cppc_pcc_data *pcc_ss_data =3D NULL; + int ret =3D -EINVAL; + + if (!cpc_desc) { + pr_debug("No CPC descriptor for CPU:%d\n", cpu); + return -ENODEV; + } + + auto_sel_reg =3D &cpc_desc->cpc_regs[AUTO_SEL_ENABLE]; + + if (CPC_IN_PCC(auto_sel_reg)) { + if (pcc_ss_id < 0) { + pr_debug("Invalid pcc_ss_id\n"); + return -ENODEV; + } + + if (CPC_SUPPORTED(auto_sel_reg)) { + ret =3D cpc_write(cpu, auto_sel_reg, enable); + if (ret) + return ret; + } + + pcc_ss_data =3D pcc_data[pcc_ss_id]; + + down_write(&pcc_ss_data->pcc_lock); + /* after writing CPC, transfer the ownership of PCC to platform */ + ret =3D send_pcc_cmd(pcc_ss_id, CMD_WRITE); + up_write(&pcc_ss_data->pcc_lock); + } else { + ret =3D -ENOTSUPP; + pr_debug("_CPC in PCC is not supported\n"); + } + + return ret; +} +EXPORT_SYMBOL_GPL(cppc_set_auto_sel); + + /** * cppc_set_enable - Set to enable CPPC on the processor by writing the * Continuous Performance Control package EnableRegister field. diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 6b487a5bd638..6126c977ece0 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -109,6 +109,7 @@ struct cppc_perf_caps { u32 lowest_freq; u32 nominal_freq; u32 energy_perf; + bool auto_sel; }; =20 struct cppc_perf_ctrls { @@ -153,6 +154,8 @@ extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg= , u64 *val); extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); extern int cppc_get_epp_perf(int cpunum, u64 *epp_perf); extern int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, = bool enable); +extern int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_= caps); +extern int cppc_set_auto_sel(int cpu, bool enable); #else /* !CONFIG_ACPI_CPPC_LIB */ static inline int cppc_get_desired_perf(int cpunum, u64 *desired_perf) { @@ -214,6 +217,14 @@ static inline int cppc_get_epp_perf(int cpunum, u64 *e= pp_perf) { return -ENOTSUPP; } +static inline int cppc_set_auto_sel(int cpu, bool enable) +{ + return -ENOTSUPP; +} +static inline int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps= *perf_caps) +{ + return -ENOTSUPP; +} #endif /* !CONFIG_ACPI_CPPC_LIB */ =20 #endif /* _CPPC_ACPI_H*/ --=20 2.34.1 From nobody Sun Sep 14 18:32:52 2025 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 2F1D2C004D4 for ; Thu, 19 Jan 2023 11:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231129AbjASLwo (ORCPT ); Thu, 19 Jan 2023 06:52:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbjASLwi (ORCPT ); Thu, 19 Jan 2023 06:52:38 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2059.outbound.protection.outlook.com [40.107.100.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F6491BF0; Thu, 19 Jan 2023 03:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=keKlL6n5LAP1dnZJajJC4715pKa6sRkouzXSnZnUbnojFSqmmhXdxQpoVHjLQZysA2YWdBVF7hjgnQ222G/nrG6nS64tWDOVnzxfnVcV6l0YitTlm8tFdQVOuwEQtOMom8igNsAqjxomfZuBzeDv2CkKRHLuZnfH63575CCGifkl+bLNE+LWFlpNZ1pcWvyQuIKQL1hMNikIpjSxpsfLrixk6GrMaWwxQ0tg9OivEFWFWSS6UJxCOId/OHwPuh+16/RPc8SiM1zJvzwDkLZHhXYEFXCpal67j9gLXdf/QB5O+CXtyA1i6j9h7o/fLxr6R5m2vgfG/Z3xbyU+2DjkQw== 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=wWsJsm/gG9sQiEORfxagttjLjTIjchwoB3h+8doG7vQ=; b=ixM0K+gkuhF/czVT5192mQOYPNL6fwFN2EEMqp2CHrmed6w2dx2tGTMY15C4sDEyrsJnxy5lNa+Tfa8l23q+fqj5+zhO/PrjhUYogcLQpBWxIRXh166MbTmIe96pC1Ufk11t6Hqj6TIBoOCBHS8e7U3FXyuuiiEzwrsiead8UgIzVurGUI2TbMEKsi4c1I/9eTkw3fbvkWhg/w86RZ6ZZoxEqZnCtg0+CnNOVYNtcxBMbeumxcRoQtVpTifWD4wI1xbUmSULhztDcbeDcUvbGjakKVwt2XOeZQBa87DrcyDo4fJIZitEeIWqe7TCpAN8qAIER1liKpAZfLvO117Fyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wWsJsm/gG9sQiEORfxagttjLjTIjchwoB3h+8doG7vQ=; b=N9KbFpgU+MBhl+2gKbdpnHmCOOH/war98iZ65U3zh0TmbWmpxibgSDCOCaad/xbajmFEnnqAfYcy0YwUsXf8Qx9CSRu0I2qLIlTG32VIVmNFgDqPTCoLumEp5X8z6CPRp0XNDEq48Oc7g2QorGdQrcud+fb7W5JM4PiyVqXdc88= Received: from DM6PR18CA0027.namprd18.prod.outlook.com (2603:10b6:5:15b::40) by SA3PR12MB7997.namprd12.prod.outlook.com (2603:10b6:806:307::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 11:52:33 +0000 Received: from DM6NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:5:15b:cafe::5f) by DM6PR18CA0027.outlook.office365.com (2603:10b6:5:15b::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.19 via Frontend Transport; Thu, 19 Jan 2023 11:52:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT056.mail.protection.outlook.com (10.13.173.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Thu, 19 Jan 2023 11:52:33 +0000 Received: from beas.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 19 Jan 2023 05:52:27 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Wyes Karny Subject: [PATCH v3 3/6] cpufreq: amd_pstate: Add guided autonomous mode Date: Thu, 19 Jan 2023 11:50:14 +0000 Message-ID: <20230119115017.10188-4-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119115017.10188-1-wyes.karny@amd.com> References: <20230119115017.10188-1-wyes.karny@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT056:EE_|SA3PR12MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f707830-6969-4330-9f32-08dafa13a693 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4DxbgCUbw9Aogvk1DMXvgwo80KZJ1c+npZu2DzMXA7+2sDiruMYuxFBVlg0YOqYsgnukavC2NiCtp+k9pKQs79/OarxEpPi7TUYnJJ3+D7lV+lolCjFCuSESJzjjRnJg2+AQZTilViun2YlX/8Lpvwkjn01/zKPDOKuiwrsG6kl8Z4/NiEf8hYuYQDQrWPfaSeE3cwjLoIv81HFAbAJ/vKM69wkjNz9TdWAixFdqWuuRtRbLZqFVrxbYW+hSC428QxWNxWjxoVxSODVHdd0L8bIMZ/TC0OyH03agS8Zswww7eFkpmQ9vjDC8tj56GZ7URgHFWgIFdf9lwGxqTYW0wVqU7NcReqYs1Yq3wzTwnOPk7WcUOI9z48Jd2ycTTS7gtpV5EHh/FTRNZ3lYwm4Hl0MU2kei6WtdEMPD5TVk+7C2GEULS31E2+J5/xTpETt/FWOAPNbQ4d5LocFQ0cTe5pDTWw98+V9ec1CU0yPH6VKrb8RP+oYjPBnDX51r/O+dI5LLNY3KNFxAMSrFLIjyDzS98AH3Quw4DlPC/TTXpTBKSMuXhYjG1wSEJMGqkmMVA4wpmpps1NlQQdFCP0JTPfuNX9UXh3Pj9KtCbsh+PviorazWcRqK5mynGLkDxzXQU3efg4CARvrI9sxfU6TheFjeZKrcXBJTuWRAZbR4ScYLk8r7SoDXFB7sR7jX807nIYBkR/LJaNEftx3aTi/ilOb+NH93PFg4q4marEMJADA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(396003)(346002)(136003)(376002)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(82740400003)(36860700001)(316002)(81166007)(70586007)(86362001)(5660300002)(8936002)(2906002)(44832011)(70206006)(7416002)(40480700001)(26005)(41300700001)(8676002)(82310400005)(40460700003)(2616005)(83380400001)(336012)(16526019)(1076003)(186003)(47076005)(7696005)(426003)(110136005)(54906003)(6666004)(6636002)(356005)(4326008)(36756003)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 11:52:33.1580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f707830-6969-4330-9f32-08dafa13a693 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7997 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From ACPI spec below 3 modes for CPPC can be defined: 1. Non autonomous: OS scaling governor specifies operating frequency/ performance level through `Desired Performance` register and platform follows that. 2. Guided autonomous: OS scaling governor specifies min and max frequencies/ performance levels through `Minimum Performance` and `Maximum Performance` register, and platform can autonomously select an operating frequency in this range. 3. Fully autonomous: OS only hints (via EPP) to platform for the required energy performance preference for the workload and platform autonomously scales the frequency. Currently (1) is supported by amd_pstate as passive mode, and (3) is implemented by EPP support. This change is to support (2). In guided autonomous mode the min_perf is based on the input from the scaling governor. For example, in case of schedutil this value depends on the current utilization. And max_perf is set to max capacity. To activate guided auto mode ``amd_pstate=3Dguided`` command line parameter has to be passed in the kernel. Signed-off-by: Wyes Karny --- .../admin-guide/kernel-parameters.txt | 15 +++++--- drivers/cpufreq/amd-pstate.c | 34 +++++++++++++++---- include/linux/amd-pstate.h | 2 ++ 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index e3618dfdb36a..0d8486325c9a 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -7015,11 +7015,11 @@ Do not enable amd_pstate as the default scaling driver for the supported processors passive - Use amd_pstate as a scaling driver, driver requests a - desired performance on this abstract scale and the power - management firmware translates the requests into actual - hardware states (core frequency, data fabric and memory - clocks etc.) + Use amd_pstate with passive mode as a scaling driver. + In this mode autonomous selection is disabled. + Driver requests a desired performance level and platform + tires to match the same performance level (if it is + satisfied by guaranteed performance level). active Use amd_pstate_epp driver instance as the scaling driver, driver provides a hint to the hardware if software wants @@ -7027,3 +7027,8 @@ to the CPPC firmware. then CPPC power algorithm will calculate the runtime workload and adjust the realtime cores frequency. + guided + Activate guided autonomous mode. Driver requests minimum and + maximum performance level and the platform autonomously + selects a performance level in this range and appropriate + to the current workload. diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index c5731fefcbef..6736ad260485 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -267,7 +267,22 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) cppc_perf.lowest_nonlinear_perf); WRITE_ONCE(cpudata->lowest_perf, cppc_perf.lowest_perf); =20 - return 0; + if (cppc_state =3D=3D AMD_PSTATE_ACTIVE) + return 0; + + ret =3D cppc_get_auto_sel_caps(cpudata->cpu, &cppc_perf); + if (ret) { + pr_warn("failed to get auto_sel, ret: %d\n", ret); + return 0; + } + + ret =3D cppc_set_auto_sel(cpudata->cpu, + (cppc_state =3D=3D AMD_PSTATE_PASSIVE) ? 0 : 1); + + if (ret) + pr_warn("failed to set auto_sel, ret: %d\n", ret); + + return ret; } =20 DEFINE_STATIC_CALL(amd_pstate_init_perf, pstate_init_perf); @@ -344,12 +359,18 @@ static inline bool amd_pstate_sample(struct amd_cpuda= ta *cpudata) } =20 static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, - u32 des_perf, u32 max_perf, bool fast_switch) + u32 des_perf, u32 max_perf, bool fast_switch, int guv_flags) { u64 prev =3D READ_ONCE(cpudata->cppc_req_cached); u64 value =3D prev; =20 des_perf =3D clamp_t(unsigned long, des_perf, min_perf, max_perf); + + if ((cppc_state =3D=3D AMD_PSTATE_GUIDED) && (guv_flags & CPUFREQ_GOV_DYN= AMIC_SWITCHING)) { + min_perf =3D des_perf; + des_perf =3D 0; + } + value &=3D ~AMD_CPPC_MIN_PERF(~0L); value |=3D AMD_CPPC_MIN_PERF(min_perf); =20 @@ -404,7 +425,7 @@ static int amd_pstate_target(struct cpufreq_policy *pol= icy, =20 cpufreq_freq_transition_begin(policy, &freqs); amd_pstate_update(cpudata, min_perf, des_perf, - max_perf, false); + max_perf, false, policy->governor->flags); cpufreq_freq_transition_end(policy, &freqs, false); =20 return 0; @@ -438,7 +459,8 @@ static void amd_pstate_adjust_perf(unsigned int cpu, if (max_perf < min_perf) max_perf =3D min_perf; =20 - amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true); + amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true, + policy->governor->flags); cpufreq_cpu_put(policy); } =20 @@ -1238,7 +1260,7 @@ static int __init amd_pstate_init(void) /* capability check */ if (boot_cpu_has(X86_FEATURE_CPPC)) { pr_debug("AMD CPPC MSR based functionality is supported\n"); - if (cppc_state =3D=3D AMD_PSTATE_PASSIVE) + if (cppc_state !=3D AMD_PSTATE_ACTIVE) current_pstate_driver->adjust_perf =3D amd_pstate_adjust_perf; } else { pr_debug("AMD CPPC shared memory based functionality is supported\n"); @@ -1300,7 +1322,7 @@ static int __init amd_pstate_param(char *str) if (cppc_state =3D=3D AMD_PSTATE_ACTIVE) current_pstate_driver =3D &amd_pstate_epp_driver; =20 - if (cppc_state =3D=3D AMD_PSTATE_PASSIVE) + if (cppc_state =3D=3D AMD_PSTATE_PASSIVE || cppc_state =3D=3D AMD_PSTATE= _GUIDED) current_pstate_driver =3D &amd_pstate_driver; =20 return 0; diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index e9e291b7c2f9..85e980b8e0ac 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -92,6 +92,7 @@ enum amd_pstate_mode { AMD_PSTATE_DISABLE =3D 0, AMD_PSTATE_PASSIVE, AMD_PSTATE_ACTIVE, + AMD_PSTATE_GUIDED, AMD_PSTATE_MAX, }; =20 @@ -99,6 +100,7 @@ static const char * const amd_pstate_mode_string[] =3D { [AMD_PSTATE_DISABLE] =3D "disable", [AMD_PSTATE_PASSIVE] =3D "passive", [AMD_PSTATE_ACTIVE] =3D "active", + [AMD_PSTATE_GUIDED] =3D "guided", NULL, }; =20 --=20 2.34.1 From nobody Sun Sep 14 18:32:52 2025 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 F1BFCC004D4 for ; Thu, 19 Jan 2023 11:53:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231156AbjASLxa (ORCPT ); Thu, 19 Jan 2023 06:53:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231162AbjASLxX (ORCPT ); Thu, 19 Jan 2023 06:53:23 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2054.outbound.protection.outlook.com [40.107.220.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BFC169233; Thu, 19 Jan 2023 03:53:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OLavcqkf4xKVln22w0q5PPx2APTKw0sbuu90XpZdiFJdLzEX/E8nCyLQk4F0Rv+wZrvv5gcd+aFJlSqS31D78Rqw7W2thyRo0Yxp55c0fPAJsnU0k0CjG698ynLKZubSo25JIZTmMOScko8zjeEIb61raOjF9F4wFtkO5dyPmr0xwm5rKa4Y/MjHn7xx6oyc4x5P/V4hJfONR9WzlPRvg0WWdVxX/Ih8Y+NWL+PnTxrrBXKKww/qnhqNpHosUccYHWov/YgCP5yIDPvaDOEFyZfaeE1k27yc9ElGKKutR3r5gdrd9qmNxT38O30u3Iz+tJevE++nXnlI41vhUnzm1A== 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=pSCb9E7hlwVFlUz5E0Q0t2Sq3suv8GG6PLWOYj7pyfw=; b=Ynf8GHvb3MBfFXFDbCMzwvUYHcIZnDusj5cTNMHSZLFUu8OyesjdSllNk2K6KDYZ4Pcgh6TXWNK/y/u+x+lRp5tvhRhE/jFu9mb+kuJSKulzcwxJEjvHv8Rfmh8V82dt801jWBC2uLa1QlkTZvYVVwxCv7l79Re218EWTX3QKwEL2EYGmiFk0WpIeuFp4xMyuX5/ngNmvunFnQ/J00xc2c3E6RRgd685hIe+r2+j30oETqKb2HWxCj5LXqkS2ADuYgkpMguQ9eMT+tyb8pD6YxivjrNXXHhabyo4MD3rkFvSe0awZfSJUoMIv9knxxhTacTcmYMu4E7EDAmFaD5ZlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pSCb9E7hlwVFlUz5E0Q0t2Sq3suv8GG6PLWOYj7pyfw=; b=aDP4KhLQqPl7eIPctZzNg9msYqF7adX/pLBVcXDBenGvSByvIAdqVR9OzYtbb1TX+28zqEQEICtRV6n5A+5f9O3jEB+8Ji8V5+tuQHKWezt4C6hMI3QUoZ/0lcbvgzaXTihrhFmGjgtsMOvIufkyCL+i8N5R22P4xTaz0SBk3Go= Received: from DS7PR06CA0007.namprd06.prod.outlook.com (2603:10b6:8:2a::25) by SA1PR12MB8095.namprd12.prod.outlook.com (2603:10b6:806:33f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 11:53:05 +0000 Received: from DM6NAM11FT072.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2a:cafe::bf) by DS7PR06CA0007.outlook.office365.com (2603:10b6:8:2a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.26 via Frontend Transport; Thu, 19 Jan 2023 11:53:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT072.mail.protection.outlook.com (10.13.173.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Thu, 19 Jan 2023 11:53:05 +0000 Received: from beas.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 19 Jan 2023 05:52:59 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Wyes Karny , Mario Limonciello Subject: [PATCH v3 4/6] Documentation: amd_pstate: Move amd_pstate param to alphabetical order Date: Thu, 19 Jan 2023 11:50:15 +0000 Message-ID: <20230119115017.10188-5-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119115017.10188-1-wyes.karny@amd.com> References: <20230119115017.10188-1-wyes.karny@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT072:EE_|SA1PR12MB8095:EE_ X-MS-Office365-Filtering-Correlation-Id: bdc8ad86-81f1-4fdf-68be-08dafa13b9cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Td4LXZlssfxy76raut38FMI+1GmPObV455NuVPjXhn9AtoZWlM3uXpdkqk3rX8ZaQPp5WvnKpw0vKXsV0lmQv3+WFrX2PBxu5TmNZCskiBllCz9a/aU1mqgjbirK4gfjOM2XiizGNCqmOFdDWTRT+vFixZL5JLtnru/nhrCHKXZNaXf6zn1VqIwdpcILCog7RKW9yTkkML1xiHaN6GI2uCdobXWO8+m8TlWvSkt8ogym9ijqZD4E2HM6Ke9EYkJaaAB+1ffF4ilSUMw1W83nhmIiBsKFLutp4c6oJ7pdC9UWrNa36R/F9F/jEzih6XaZ2HnGK+f4nK4GlPZlRF/m6YRc0cZuDNaF52k3UCqa5wX3ZSNLl4kXNLX4BiTaTb2EBG8UZvYTKLOnU3kWf9lnNqq7TvDTopOKbJcBPjXbGIa1YHjDqXwSJSSX0IJMHCH0rxsnRUG6mpqAriHfOoSRpW2JSFN5JNqRG3Zx9mU0hFiFknRpfizq8pWrSxbW4Qh2WF0rD6HoZqpC8+zLMMlTxg8ZnPXbSqfPuLPvIVcG9nCtlUCkwbvPvwlw7bHUXFdwFKZTdV3Y/2b2pdhq2OzQlEBETIzVQVgatEi3e/3F0cEKXs2XvZ/weF4cW3iAiixHtl5dH9Yr8J+DpsYwTxHsGeREhSKI2K6Zp1tZcWqiQErJePvvgrT4S7G9VKqwLpGriIge0olUW2Hb3j3nbouLHXkDiilnq/GltU4MZxbSNzE= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199015)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(36756003)(426003)(47076005)(8676002)(41300700001)(70586007)(70206006)(7416002)(44832011)(8936002)(26005)(478600001)(16526019)(186003)(4326008)(83380400001)(1076003)(336012)(316002)(110136005)(82310400005)(2616005)(54906003)(7696005)(6636002)(6666004)(5660300002)(356005)(86362001)(36860700001)(2906002)(82740400003)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 11:53:05.4134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdc8ad86-81f1-4fdf-68be-08dafa13b9cd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT072.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8095 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Move amd_pstate command line param description to correct alphabetical order. Signed-off-by: Wyes Karny Reviewed-by: Mario Limonciello --- .../admin-guide/kernel-parameters.txt | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index 0d8486325c9a..5f6a3a34251e 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -339,6 +339,29 @@ This mode requires kvm-amd.avic=3D1. (Default when IOMMU HW support is present.) =20 + amd_pstate=3D [X86] + disable + Do not enable amd_pstate as the default + scaling driver for the supported processors + passive + Use amd_pstate with passive mode as a scaling driver. + In this mode autonomous selection is disabled. + Driver requests a desired performance level and platform + tires to match the same performance level (if it is + satisfied by guaranteed performance level). + active + Use amd_pstate_epp driver instance as the scaling driver, + driver provides a hint to the hardware if software wants + to bias toward performance (0x0) or energy efficiency (0xff) + to the CPPC firmware. then CPPC power algorithm will + calculate the runtime workload and adjust the realtime cores + frequency. + guided + Activate guided autonomous mode. Driver requests minimum and + maximum performance level and the platform autonomously + selects a performance level in this range and appropriate + to the current workload. + amijoy.map=3D [HW,JOY] Amiga joystick support Map of devices attached to JOY0DAT and JOY1DAT Format: , @@ -7009,26 +7032,3 @@ memory, and other data can't be written using xmon commands. off xmon is disabled. - - amd_pstate=3D [X86] - disable - Do not enable amd_pstate as the default - scaling driver for the supported processors - passive - Use amd_pstate with passive mode as a scaling driver. - In this mode autonomous selection is disabled. - Driver requests a desired performance level and platform - tires to match the same performance level (if it is - satisfied by guaranteed performance level). - active - Use amd_pstate_epp driver instance as the scaling driver, - driver provides a hint to the hardware if software wants - to bias toward performance (0x0) or energy efficiency (0xff) - to the CPPC firmware. then CPPC power algorithm will - calculate the runtime workload and adjust the realtime cores - frequency. - guided - Activate guided autonomous mode. Driver requests minimum and - maximum performance level and the platform autonomously - selects a performance level in this range and appropriate - to the current workload. --=20 2.34.1 From nobody Sun Sep 14 18:32:52 2025 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 26051C004D4 for ; Thu, 19 Jan 2023 11:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjASLyS (ORCPT ); Thu, 19 Jan 2023 06:54:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbjASLyA (ORCPT ); Thu, 19 Jan 2023 06:54:00 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2074.outbound.protection.outlook.com [40.107.92.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4244B4B9; Thu, 19 Jan 2023 03:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WkvyqLivzf4BAbp1NC7PvbU8ioqHq7p/X9o0MR16NxqG34HK+QR3HH416kcq6bz/ifKy3iF36UxRlgpsBtp4ty2aYrZNjIQ8pP83oSbYwZ6RtXjuoOu2UeDU38Mr/24IPEBe+jD3jdNPsRMzhw7aka6o5Ak2NhHKAlhaN0pMJNNKthVEUojFrxw67fFC+Kt2ZKb3dNaT/rV7AQQQClcQLabEV1EhmhHBCHosg7df159l6svjFF0qYHYmJPt5XGCFQgs5s6T7l+Lz5JYbpXXeCRMNJ2k7ia6GsTcS5fJsRK3zj4uflbV0Q+gv7C/f2XuwwnXlY/Z+o+NZsf7DhneTmg== 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=ySkUoIANDrWEcEwIJ3J40AhyqLHlwikYn2xI1eJyKNE=; b=lLXN95LWZtFesCr76K8zb1D3Dd5JHFq6KS4QdLZt5OdRQudW4XWq4ae3Nfk/Uc4bPVEo23UcPu7B8KuyKhZk1fvgwI4xyl5pbE+YkSgeLZy5Nu30cqXAxmFbkRy8N54+6yVgtCE7t98eOr9M3GDESAEWzL4L7pR/gHCrcXaVQ5YK7vpHR5RkTsnIvoOhXLed2S22v2XAsZ1qhAWPR4V03DJND85Vzz6CMWmQM81gQm2aRoYF6y+BH4ogCotBPo81DkMH0VPN0+yqd48v6mcTrVM288IFRkvuiJtln0lY76LeSNspRCSNECIEKAMy6BuNI/DISQ2CR8C7QR3dOHRq2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ySkUoIANDrWEcEwIJ3J40AhyqLHlwikYn2xI1eJyKNE=; b=R4sBAR0A/hTOS4VXgaq+7+VDsBAFhq6+AkKeYjHQ4C611sZ4MRtcYuvuf4UpH+3rmXpQJ3WbzFAzrnbzw6mloaSYiwyA+D1wD/th/LCKRx283zsD7SsmOuV40c/8u5ZQyh2gXp53wMmNscf2si1U0Rx4IogOsz72tPwoZGEJUWY= Received: from DM6PR05CA0038.namprd05.prod.outlook.com (2603:10b6:5:335::7) by DS7PR12MB6070.namprd12.prod.outlook.com (2603:10b6:8:9e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Thu, 19 Jan 2023 11:53:50 +0000 Received: from DM6NAM11FT106.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::13) by DM6PR05CA0038.outlook.office365.com (2603:10b6:5:335::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6023.16 via Frontend Transport; Thu, 19 Jan 2023 11:53:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT106.mail.protection.outlook.com (10.13.172.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Thu, 19 Jan 2023 11:53:50 +0000 Received: from beas.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 19 Jan 2023 05:53:45 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Wyes Karny Subject: [PATCH v3 5/6] cpufreq: amd_pstate: Add guided mode control support via sysfs Date: Thu, 19 Jan 2023 11:50:16 +0000 Message-ID: <20230119115017.10188-6-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119115017.10188-1-wyes.karny@amd.com> References: <20230119115017.10188-1-wyes.karny@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT106:EE_|DS7PR12MB6070:EE_ X-MS-Office365-Filtering-Correlation-Id: 235c9367-6684-4717-7135-08dafa13d4d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: heLDthIxPhEZZyZQ8NrZDUEG1YjCYXONbrn36yk/nGwUQA7qO9Eez9i3buoPlQP91njev9r8zgVGNPvP9OXpqnxb+IX6/7fJIx++Wzfg7CUh5vbZ3aHUD157o0V89CSMlExHKF2Vu8MGyiI07Gz4PSlr11YXe5WGEmTwT6Sx1HDUXxJNrgQfbuN5c6Rh83Uy91aGUFlkuDV1YlKc/eLaxaIbnfQwEtk3Ai4l32AxRL6NO+815J7MNpa759hYDnuYY7XFwWUk2Xx3fjgWklcBUMycr7aAxbdxchSjLUB2Yav8SNMxlMAz+hzdSHGWy1J6hTq5WTCp3h+AfdK4ykUItJ60bn8ZBTgYKHI/fi/ynUHO2Sye0NoTQNUFNCJci8fBsvrZhex71SUOlUX68sftapYBAOkYsGyncZIvXi1uaCCvOihxiCHSCXW+2qspXwu8dVfnFF+bPq0PekZBqAWt/pbEBzuSSK6DikJY3v0H0R7H+ZcAFmEzQtmopqUL6ppZsLRD/UmqjBPAISafKQKlj2IlG+ETe1Vv1dYTQAhgtkd8YDLQB/jPZ2LTOdR9Y6NiGCYGhkFyUjvl4J/HRMjpeuDk3NxFAniCThErzdf0GAZvpolDlQ6G8Rt/Vzg7HhFytlQjI9WIYUjC/RRw6n5HF9xu4qdoGVrT0bjS4baC/fcirNWgXYIEsztuhHDSiK4CjY1/Vnkxcfds7Q232dmTAUhv4rMoFq17m+QBZZIgam4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199015)(46966006)(40470700004)(36840700001)(44832011)(478600001)(186003)(16526019)(26005)(2616005)(6666004)(6636002)(1076003)(54906003)(110136005)(7696005)(336012)(8676002)(70586007)(4326008)(70206006)(83380400001)(47076005)(426003)(316002)(5660300002)(8936002)(7416002)(36860700001)(41300700001)(2906002)(81166007)(356005)(40460700003)(40480700001)(86362001)(82740400003)(36756003)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 11:53:50.7318 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 235c9367-6684-4717-7135-08dafa13d4d0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT106.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6070 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" amd_pstate driver's `status` sysfs entry helps to control the driver's mode dynamically by user. After the addition of guided mode the combinations of mode transitions have been increased (16 combinations). Therefore optimise the amd_pstate_update_status function by implementing a state transition table. There are 4 states amd_pstate supports, namely: 'disable', 'passive', 'active', and 'guided'. The transition from any state to any other state is possible after this change. Only if the state requested matches with the current state then -EBUSY value is returned. Sysfs interface: To disable amd_pstate driver: # echo disable > /sys/devices/system/cpu/amd_pstate/status To enable passive mode: # echo passive > /sys/devices/system/cpu/amd_pstate/status To change mode to active: # echo active > /sys/devices/system/cpu/amd_pstate/status To change mode to guided: # echo guided > /sys/devices/system/cpu/amd_pstate/status Signed-off-by: Wyes Karny --- drivers/cpufreq/amd-pstate.c | 150 +++++++++++++++++++++++++---------- 1 file changed, 108 insertions(+), 42 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 6736ad260485..8b234628ec47 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -65,6 +65,8 @@ static struct cpufreq_driver amd_pstate_epp_driver; static int cppc_state =3D AMD_PSTATE_DISABLE; struct kobject *amd_pstate_kobj; =20 +typedef int (*cppc_mode_transition_fn)(int); + static inline int get_mode_idx_from_str(const char *str, size_t size) { int i; @@ -797,6 +799,105 @@ static ssize_t show_energy_performance_preference( return sysfs_emit(buf, "%s\n", energy_perf_strings[preference]); } =20 +static void amd_pstate_driver_cleanup(void) +{ + amd_pstate_enable(false); + cppc_state =3D AMD_PSTATE_DISABLE; + current_pstate_driver =3D NULL; +} + +static int amd_pstate_register_driver(int mode) +{ + int ret; + + if (mode =3D=3D AMD_PSTATE_PASSIVE || mode =3D=3D AMD_PSTATE_GUIDED) + current_pstate_driver =3D &amd_pstate_driver; + else if (mode =3D=3D AMD_PSTATE_ACTIVE) + current_pstate_driver =3D &amd_pstate_epp_driver; + else + return -EINVAL; + + cppc_state =3D mode; + ret =3D cpufreq_register_driver(current_pstate_driver); + if (ret) { + amd_pstate_driver_cleanup(); + return ret; + } + return 0; +} + +static int amd_pstate_unregister_driver(int dummy) +{ + int ret; + + ret =3D cpufreq_unregister_driver(current_pstate_driver); + + if (ret) + return ret; + + amd_pstate_driver_cleanup(); + return 0; +} + +static int amd_pstate_change_mode_without_dvr_change(int mode) +{ + int cpu =3D 0; + + cppc_state =3D mode; + + if (boot_cpu_has(X86_FEATURE_CPPC) || cppc_state =3D=3D AMD_PSTATE_ACTIVE) + return 0; + + for_each_present_cpu(cpu) { + cppc_set_auto_sel(cpu, (cppc_state =3D=3D AMD_PSTATE_PASSIVE) ? 0 : 1); + } + + return 0; +} + +static int amd_pstate_change_driver_mode(int mode) +{ + int ret; + + ret =3D amd_pstate_unregister_driver(0); + if (ret) + return ret; + + ret =3D amd_pstate_register_driver(mode); + if (ret) + return ret; + + return 0; +} + +/* Mode transition table */ +cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX]= =3D { + [AMD_PSTATE_DISABLE] =3D { + [AMD_PSTATE_DISABLE] =3D NULL, + [AMD_PSTATE_PASSIVE] =3D amd_pstate_register_driver, + [AMD_PSTATE_ACTIVE] =3D amd_pstate_register_driver, + [AMD_PSTATE_GUIDED] =3D amd_pstate_register_driver, + }, + [AMD_PSTATE_PASSIVE] =3D { + [AMD_PSTATE_DISABLE] =3D amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] =3D NULL, + [AMD_PSTATE_ACTIVE] =3D amd_pstate_change_driver_mode, + [AMD_PSTATE_GUIDED] =3D amd_pstate_change_mode_without_dvr_change, + }, + [AMD_PSTATE_ACTIVE] =3D { + [AMD_PSTATE_DISABLE] =3D amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] =3D amd_pstate_change_driver_mode, + [AMD_PSTATE_ACTIVE] =3D NULL, + [AMD_PSTATE_GUIDED] =3D amd_pstate_change_driver_mode, + }, + [AMD_PSTATE_GUIDED] =3D { + [AMD_PSTATE_DISABLE] =3D amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] =3D amd_pstate_change_mode_without_dvr_change, + [AMD_PSTATE_ACTIVE] =3D amd_pstate_change_driver_mode, + [AMD_PSTATE_GUIDED] =3D NULL, + }, +}; + static ssize_t amd_pstate_show_status(char *buf) { if (!current_pstate_driver) @@ -805,57 +906,22 @@ static ssize_t amd_pstate_show_status(char *buf) return sysfs_emit(buf, "%s\n", amd_pstate_mode_string[cppc_state]); } =20 -static void amd_pstate_driver_cleanup(void) -{ - current_pstate_driver =3D NULL; -} - static int amd_pstate_update_status(const char *buf, size_t size) { - int ret; int mode_idx; =20 - if (size > 7 || size < 6) + if (size > strlen("passive") || size < strlen("active")) return -EINVAL; - mode_idx =3D get_mode_idx_from_str(buf, size); =20 - switch(mode_idx) { - case AMD_PSTATE_DISABLE: - if (!current_pstate_driver) - return -EINVAL; - if (cppc_state =3D=3D AMD_PSTATE_ACTIVE) - return -EBUSY; - ret =3D cpufreq_unregister_driver(current_pstate_driver); - amd_pstate_driver_cleanup(); - break; - case AMD_PSTATE_PASSIVE: - if (current_pstate_driver) { - if (current_pstate_driver =3D=3D &amd_pstate_driver) - return 0; - cpufreq_unregister_driver(current_pstate_driver); - cppc_state =3D AMD_PSTATE_PASSIVE; - current_pstate_driver =3D &amd_pstate_driver; - } + mode_idx =3D get_mode_idx_from_str(buf, size); =20 - ret =3D cpufreq_register_driver(current_pstate_driver); - break; - case AMD_PSTATE_ACTIVE: - if (current_pstate_driver) { - if (current_pstate_driver =3D=3D &amd_pstate_epp_driver) - return 0; - cpufreq_unregister_driver(current_pstate_driver); - current_pstate_driver =3D &amd_pstate_epp_driver; - cppc_state =3D AMD_PSTATE_ACTIVE; - } + if (mode_idx < 0 || mode_idx >=3D AMD_PSTATE_MAX) + return -EINVAL; =20 - ret =3D cpufreq_register_driver(current_pstate_driver); - break; - default: - ret =3D -EINVAL; - break; - } + if (mode_state_machine[cppc_state][mode_idx]) + return mode_state_machine[cppc_state][mode_idx](mode_idx); =20 - return ret; + return -EBUSY; } =20 static ssize_t show_status(struct kobject *kobj, --=20 2.34.1 From nobody Sun Sep 14 18:32:52 2025 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 20227C00A5A for ; Thu, 19 Jan 2023 11:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230051AbjASLya (ORCPT ); Thu, 19 Jan 2023 06:54:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbjASLyU (ORCPT ); Thu, 19 Jan 2023 06:54:20 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2062.outbound.protection.outlook.com [40.107.101.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBABE4B4B9; Thu, 19 Jan 2023 03:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eG5ikeyxmo3AB+/6/MRoSKy31P4KE6pF2OjxlUCRkmKWxdxc865vUcXbHw7dhI4x+ZrCfMRJcGDGr7fzvwDxOEpg4BjMrBB5wYUzrjJo9ILfZwF5KGh7LTyO6NYhMnxpuYrRxOxAcqebXmblj4UCipYJTvmMSx4xVMzx6SDMp2oNW6yLaSrjoOXXD9W45v1LdkSbbdrt1Nq4M3X1iBTNl99l0QATmLFNZcVUaYuxjSsRt16adyRTH8Z/EfVwUQPELuPOa2gcJgwhAzo6aPYvohGLePY5N46B+c82YM14DYCM7CB5Rs09D6cpbjlIxQOmqcGo1i2CQOLyFfl5qrR3NQ== 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=e2+bi/RLp60NJfFTa706oIDyFewKZo3lNCtGPoDlh+w=; b=eKjKHj5KCt4CuZTB+pqOIWZjeaQQuJxy0gYt3fmvQ7iXDXwRpSEkafZ0Vyu/RjxX/I+Uv2FpPqBY/VHvZk0H8yq4/qx9vwkO34F31XCaX866ljnjQ1MjbprPebC2VAETgu8+XGUTom+hVfqTbnJjdKH3QLQxvEYkXpTNFcsgkAL15XXMv6H5qgbbjtw6XK/FVTZ79AekaaQcgG05tYClWhIzJCkaAUeQRhxzrpSFW0eq5lou/MWVuwH+J01S8+EQNKR7g+ESxHqnfombY1EhW4wwu7vNGQMFonPe/o8fbCBDPugF7gKag2n8N22tyXBUX9hXsrIZS3DDatfNoTGg1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e2+bi/RLp60NJfFTa706oIDyFewKZo3lNCtGPoDlh+w=; b=ARfAczN+1d3iBfOCbV3HguCSKQgSKeyZH1YWZp2G0nVHKJ0qkVMb07438o7GneN+uvgnhLgVlGK6M5NRAoeDp0HvFrEN4yZIPT7lOKYhEPy/Orpvcxo4ic6UVoALe1I2DVjGmpCbrQh+LSIv0677IW+wTefhhbfP4CHRnsASNV0= Received: from DS7PR03CA0260.namprd03.prod.outlook.com (2603:10b6:5:3b3::25) by PH8PR12MB7303.namprd12.prod.outlook.com (2603:10b6:510:220::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.19; Thu, 19 Jan 2023 11:54:15 +0000 Received: from DM6NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b3:cafe::d) by DS7PR03CA0260.outlook.office365.com (2603:10b6:5:3b3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24 via Frontend Transport; Thu, 19 Jan 2023 11:54:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT038.mail.protection.outlook.com (10.13.173.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Thu, 19 Jan 2023 11:54:15 +0000 Received: from beas.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 19 Jan 2023 05:54:10 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Wyes Karny Subject: [PATCH v3 6/6] Documentation: amd_pstate: Update amd_pstate status sysfs for guided Date: Thu, 19 Jan 2023 11:50:17 +0000 Message-ID: <20230119115017.10188-7-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119115017.10188-1-wyes.karny@amd.com> References: <20230119115017.10188-1-wyes.karny@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT038:EE_|PH8PR12MB7303:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f6677d9-5564-4482-3b7d-08dafa13e375 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zM8F1K9DEwFvsWTRevyzEg3azDcSXouNxW3bnjXsBirbOhPXUaqC6N5TvBjjVqUA7Vc9ivOUcrvWAJ2kwRuzDNI9NzLsT5cOGWKmRZbCIdBQEoU2mgAFbbGPDGIhZZa0JKyY8LNX/nc1FlvSfbSy0Y7RVsHUJGTjwbPMgbfhekpUYhwzoEwpRYS3aecULBnOGB7LDncesESSFxOHL75LUksgq6b7eGb6W+qZR0225lBgSNn+f2+cLd9Nvkpxst71uRYyr2yEo+ZcONV99LLpw5PeKdXUy2kYk4j1u+u1ZX127bscuexBn64Gz/h4WcvwBt5rw6d5RZn7t3XU2Um1VjCD41VPcqKs5Nj0xADZ3oA7F8QNaMWj8ZTZZNZdmNT2IcVmx5z4mgeYL1auMgQ6eNGbid1k24MieUG37UvWx/rpf1WRn4ZGS1Emx1vDOvisJYUmoTWBAxR6v0iJ6xzd10x+c+TkBfdJx1icNdzp7NeowybL08GdrippPDwb8MbS9+C0J4dU3iJpPV6HN4jqE0KllCtljd5HkUPqxl08rAVonGzCuYAbsZcwI7YpOBEZG2fjSeF3Fv8L0FMfH5wZ9bXebB0wOnx77R9tqFJYPHU4cRFW+ea1wpV4aEXQGtsUKfM+XBLoQWRsJOeEHLzCQCqZ8+2pFNLYrbE6xoy0827MShpKojn2RvCv2khxJ4ibqMGIFWbfKUpRsOsv07u6Pc+Hh0GETKhtPCEL87MqlqE= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(136003)(346002)(396003)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(7696005)(16526019)(2906002)(110136005)(186003)(1076003)(54906003)(2616005)(26005)(6636002)(316002)(41300700001)(426003)(83380400001)(15650500001)(82740400003)(36860700001)(336012)(8936002)(82310400005)(8676002)(36756003)(4326008)(40480700001)(70206006)(5660300002)(478600001)(86362001)(7416002)(47076005)(81166007)(44832011)(70586007)(40460700003)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 11:54:15.2998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f6677d9-5564-4482-3b7d-08dafa13e375 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7303 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Update amd_pstate status sysfs for guided mode. Signed-off-by: Wyes Karny --- Documentation/admin-guide/pm/amd-pstate.rst | 32 ++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/ad= min-guide/pm/amd-pstate.rst index 5304adf2fc2f..d85a141109e5 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -303,13 +303,19 @@ efficiency frequency management method on AMD process= ors. AMD Pstate Driver Operation Modes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -``amd_pstate`` CPPC has two operation modes: CPPC Autonomous(active) mode = and -CPPC non-autonomous(passive) mode. -active mode and passive mode can be chosen by different kernel parameters. -When in Autonomous mode, CPPC ignores requests done in the Desired Perform= ance -Target register and takes into account only the values set to the Minimum = requested -performance, Maximum requested performance, and Energy Performance Prefere= nce -registers. When Autonomous is disabled, it only considers the Desired Perf= ormance Target. +``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode, +non-autonomous (passive) mode and guided autonomous (guided) mode. +Active/passive/guided mode can be chosen by different kernel parameters. + +- In autonomous mode, platform ignores the desired performance level reque= st + and takes into account only the values set to the Minimum requested + performance, Maximum requested performance and Energy Performance Prefer= ence + registers. +- In non-autonomous mode, platform gets desired performance level + from OS directly through Desired Performance Register. +- In guided-autonomous mode, platform sets operating performance level + autonomously according to the current workload and within the limits set= by + OS through min and max performance registers. =20 Active Mode ------------ @@ -338,6 +344,15 @@ to the Performance Reduction Tolerance register. Above= the nominal performance l processor must provide at least nominal performance requested and go highe= r if current operating conditions allow. =20 +Guided Mode +----------- + +``amd_pstate=3Dguided`` + +If ``amd_pstate=3Dguided`` is passed to kernel command line option then th= is mode +is activated. In this mode, driver requests minimum and maximum performan= ce +level and the platform autonomously selects a performance level in this ra= nge +and appropriate to the current workload. =20 User Space Interface in ``sysfs`` =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -358,6 +373,9 @@ control its functionality at the system level. They ar= e located in the "passive" The driver is functional and in the ``passive mode`` =20 + "guided" + The driver is functional and in the ``guided mode`` + "disable" The driver is unregistered and not functional now. =20 --=20 2.34.1