From patchwork Fri Jan 13 05:21:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 42943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp94034wrt; Thu, 12 Jan 2023 21:24:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXuU7pvnSwfQ8H/eVaNRErWjDaP1eqjSGHelN8XBOg7NQQabH909HwcP1gIGG6UMOGxWSt51 X-Received: by 2002:a17:906:2a05:b0:7c1:e7a:62e6 with SMTP id j5-20020a1709062a0500b007c10e7a62e6mr38268412eje.71.1673587495335; Thu, 12 Jan 2023 21:24:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673587495; cv=pass; d=google.com; s=arc-20160816; b=iUIjnI6Q7A1dg6CKQq6/hIpkNDE9iV91+0Ux0NLg9pc+UQHHgKwm/KoDrgeWQ1qt2g tfgbVSSgk4nOp9acjrnsibQIvz3M61PyytYB7lRpIEOh088QoNUPTTeF36NhP7KVZvbt 3lZOUGQ2tc9nCPQYNCqS5SQRtW/g3FjuqVkmMBE1pqWXgnHiIViWP5DRUYFUedb8xqAo urWcgbJIhmCa7Qcm18s+vcb4gvkIUk3kbPAIS8hQ10owtssC+DU2+uWICqVZZsLbpIBU /NSgVjOZFnuatVSzOvHSQZlwMWoKwBkl9ZovWU5UtDaDgGLjIWjX2DfqHdiFKGUBJTpC +nSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Wm7ZDxu1XcY+5FrrYTlJeRqScBH0gJ8tZ0zxYBMBFUI=; b=xg9Xhaq/YzclHFqHQx/h8fcaZEO7Jbibhm9VGdkXtP//Gujou+8ircbIFA81XJr9Co vgKlSFeKb19vRqacDLlK/xnZh5acIZlv8DlHAQKUuD0kz0EpHGCYCJcgcYkpdQTe6RhO ICcCgKgE30Hq8hS0NFmMilW9TvF8WyAe6nzUGFJxrZYrI1WGFrbnm0jtaIdB1LE0J07L Zjicwwol9eigqBrHpdnNbRVNIYJCTWTWfbE9NE4ksG2/rau0aOz9eVE/P3/++n2Lr4/c YiP2m80AEpwsuchgRWg7rybU1IoW4FD74mYutK9m5WkAQ69iFjVAooKkW5O8DUFje6kf lcuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HAj207yz; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w12-20020a056402268c00b0048dbfba188csi24011245edd.493.2023.01.12.21.24.31; Thu, 12 Jan 2023 21:24:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HAj207yz; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232088AbjAMFXP (ORCPT + 99 others); Fri, 13 Jan 2023 00:23:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbjAMFXF (ORCPT ); Fri, 13 Jan 2023 00:23:05 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FE7062192; Thu, 12 Jan 2023 21:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VGJFltBmgtttup+kK9BGXYUKFWOxMUnuB2+Er+yK5xIJxVSyDtdT7bFvDSYyL6POf+8wpFn3k7Lpmw14+5D6bZgQ50gGlAIOQyMgg5RJ7YHVRCoofJKuh6gD8vYq3/QghuMGqq8hzyuiTu+cyHBevByxnytO5ckccRcrrxyD4EuGP0PBriDh+w6bRKx1QEt9dVKQl0RdGqg/s9koS9PEP1TqCvDg3Kp5GXyzRmUffAmCR72OjDRK/JtJCrTDeodfReBd9JolC8VrImNfIk3911XcSlxd6bPZz+f6sW/tJzNDwoZwszm/MMHl6wMve++Pm6s1o4nh6x6gn87dMLuqNA== 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=Wm7ZDxu1XcY+5FrrYTlJeRqScBH0gJ8tZ0zxYBMBFUI=; b=DOD/rf/K5Mnx32mAOXPO5P1zSUsVlG6Li0E8jS+mjTdNzKZl/qgXo3vD7QRAWsOB6GmEClzUNucuY5fbXoBvCmrv1V+0NFmppcme4amkT+1DddaayFowHn47+c299Mah7SuXf/CCIf12FudGVYqP+rRSH1/v2fL6xYYrx72LOPtzQ2MtXm/bEj9qWA7jAimm5VBJixKIpVfg4a6PH3/MInTCvAYE1qj96w9FubpXcFDSoiT9Y2mibDGz/9JJy7/AE1NEKnOwDny+D38mjqiL8mHL/542l9fMeMlSzfsXD1gegTVtqYrJalBQmM2yZgd1Vp4axd4BJazV9lSVYMDYGg== 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=Wm7ZDxu1XcY+5FrrYTlJeRqScBH0gJ8tZ0zxYBMBFUI=; b=HAj207yz+WNOc3LAFvTTn7XXcAmRgKo3QfUGEVafM7W/ZQ3ENBf8Zix1KyVYlh1BfLm2XwSpGjuiL3qnukq2BdWSS9Y5PGPAbV/hSf3yfNM/LanHgqdhosdXemrXL/auA4gukqEgxdpGWxx+oo9oKpBdNHAu3eYqSjQhqWSXKO0= Received: from DS7PR03CA0181.namprd03.prod.outlook.com (2603:10b6:5:3b6::6) by CH0PR12MB5108.namprd12.prod.outlook.com (2603:10b6:610:bf::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Fri, 13 Jan 2023 05:22:55 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::bf) by DS7PR03CA0181.outlook.office365.com (2603:10b6:5:3b6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:22:55 +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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:22:54 +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, 12 Jan 2023 23:22:49 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Wyes Karny Subject: [PATCH v2 1/6] acpi: cppc: Add min and max perf reg writing support Date: Fri, 13 Jan 2023 05:21:36 +0000 Message-ID: <20230113052141.2874296-2-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113052141.2874296-1-wyes.karny@amd.com> References: <20230113052141.2874296-1-wyes.karny@amd.com> MIME-Version: 1.0 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: DM6NAM11FT064:EE_|CH0PR12MB5108:EE_ X-MS-Office365-Filtering-Correlation-Id: ec807ae7-6ba5-4ee3-bcd3-08daf5263976 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IPqXb4dLILolb3FNRUtYCrSoZc9jnXHBvjBdh9NbTy2LspmLXN6D8AHEwvHAaPB1l1bd2zPcdlGkWFQLVeTza+RAe3sAiaS7V1UpCT2xHP+3XhGiJ4SqirJGIlAKY18BGC9ah9uTpya5cj2YeK/d7f7mzRPndIfc80S3dh/1A47Y2/YvoEXf9sygEow9eypCoo0R5G9PfE49q/aeEMlEtuRnz0QJMVU0zemDVOiBeNrwOyjsuB1KqG40/Tt9HtBSvzJLYMl0TPbmlzjzz79jp3ddlIUsgbI1zYT3J45bnQB36C87f46cEeilT4cY4EmGwfCuugEr0M4bxajwuXRopPtqdyq99ZD2yJPUJ7twHTOy/n274lnCowq8hgr1/B1IQEFKrgivqg+HziCS3geJkSlDbwXTFLZkHvwjPAI7rJ90nah77h9+aEiH1SM9k4iH4yg4tKuUrOdRf8d02J95fr37kdFVa9ZqF4Hvx9S5VhCVKW34SMs6WYxesGzIwGFam4BTDD0Kkdp/4N1nzprfP8Pm8977wK0dXWJ1yXcCNmue17dHTulU01YcwyvsORzHdwwTcSM4hfVOl4mEoXlWq5KpcTvCJjhUvo9hcZ19EZJ4VimoHaFB6aahOfREAcCzsxHV6wnbjFdTllCRsL2ZRydA8I6E2TN6Z3jWsV0GVebhclKqNX99OPv3iVNJS9RKRVsWqrBmUVXlr8l+xAOttVHNUplq9JInjxJaUoZsTmE= 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)(39860400002)(376002)(451199015)(36840700001)(46966006)(40470700004)(82310400005)(47076005)(8936002)(26005)(81166007)(2906002)(5660300002)(41300700001)(426003)(7696005)(4326008)(8676002)(316002)(70586007)(110136005)(356005)(54906003)(6636002)(70206006)(82740400003)(16526019)(40480700001)(2616005)(336012)(86362001)(44832011)(40460700003)(186003)(1076003)(36860700001)(83380400001)(36756003)(478600001)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 05:22:54.7210 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec807ae7-6ba5-4ee3-bcd3-08daf5263976 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5108 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754883681440141364?= X-GMAIL-MSGID: =?utf-8?q?1754883681440141364?= 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 PMFW about min and max perf levels. Add this support to make guided mode work properly on 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 = 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 = per_cpu(cpu_pcc_subspace_idx, cpu); struct cppc_pcc_data *pcc_ss_data = NULL; int ret = 0; @@ -1498,6 +1498,8 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) } desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF]; + min_perf_reg = &cpc_desc->cpc_regs[MIN_PERF]; + max_perf_reg = &cpc_desc->cpc_regs[MAX_PERF]; /* * 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 *perf_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 = 0; } - /* - * 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); - 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 *perf_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) From patchwork Fri Jan 13 05:21:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 42944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp94153wrt; Thu, 12 Jan 2023 21:25:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXuRh4PWArWZ3ae6sCgQd9srrooxbHUUT/MqNwNkyC2IRSJPj8p983u9UQN8XHVU3x5QeEdz X-Received: by 2002:a17:907:a788:b0:7fd:ec83:b8b8 with SMTP id vx8-20020a170907a78800b007fdec83b8b8mr69399880ejc.19.1673587520068; Thu, 12 Jan 2023 21:25:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673587520; cv=pass; d=google.com; s=arc-20160816; b=aNmP507mG1WNhnzmJ4GVxoIwSFJPQxCYRZlvVDTYyPzMZwrGbr+ABLRzaAbIATvWQN 5K8A1+t6EjhJIXuVgh3EFbQcrmdw6hdaZhqlxuZaYcp1YOA0pys/rcHK8ChegMNDlmGU 4PNAaDj7WVBsQE6NeVnBrrc+v8CQpq0bqtX4C78A3/wMtIlD+IQkTPZFwaI5w1+8Ie0L IQHXtlhV9oOaWQ6sM5gYvEibWvwh3B4THkv8G82TiHXq3qOSj1Mgy19BJzRVBT+Qqrj5 607xYfiCoHeL1ahRdbk2XeP5uHE3MbDshsccvlRCrA/6P3QMim0MaFP6zOPmL29xp9uM el1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xHzrhqw0mZ+P9ayAqWvmbIHNuheEyALcVjg21ZwF1is=; b=BSb/ZjUx/FiB5y0e72yap+3uxckqtwfhWP68Chy1URLp4by38gI9cXcp01mHEfy6Nb xyPZ3CCzGAYg9Z76BonT8MoLVGseVaPM778IFgP0tPEP1+D///lJDyt1nzHS1sjIXgwk pNj03VUXeg8QXdMztiWplDxe6sEAmmyiQ7TVX8akccWm6ozK5vWusVsgwYy6nmJ0AAo2 HOw2o5kN6A/rBrMv3k1YokXPj93MqeM6x2FC+TFyi9Z9NsVZq4dE5r7mY2wLkiGQrwAK nl0CxIHB6r/FOS+Vb3dHRlIiFEOk1FhB63zdgQc7KjHhi6MHKUcsarLNOizMGLGjxdgx xFgg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SFrcmtOH; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a508d88000000b00489d3d09accsi19421490edh.247.2023.01.12.21.24.56; Thu, 12 Jan 2023 21:25:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SFrcmtOH; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjAMFYW (ORCPT + 99 others); Fri, 13 Jan 2023 00:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235210AbjAMFXs (ORCPT ); Fri, 13 Jan 2023 00:23:48 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94F8A6144B; Thu, 12 Jan 2023 21:23:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IypwchJig65LvplN6TD6peODRJvR2uLJY1lgoh3qrXkNPLYGMSDnVfr6ryqHxrGdDaTHItJNtLeoUYsafCoRXf3+oZLDImhGCq9OsownDXkFfxlNORg+jrxwU33AWe5nVSDDo70X32vdHpfSia0u7rwGSWDxEi3dPtP7eH2Rg4YDkyJCqgMzB8cWk4QR56uubA5vyMuESWIklBJXlgPmZrLk/oDBVMu5sOrpQClV7pkev92520wzmKRn+eA2T2HJoODMZEyVKaFjPwKGypZbkIx9pWhf7bwVI8738kWI2zUZFtFtrVKpyJgKYzDUjwLPyeUYZVrNwkG7hUe2rocwXA== 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=xHzrhqw0mZ+P9ayAqWvmbIHNuheEyALcVjg21ZwF1is=; b=WGPPV0B5nD5f8Yp59jpox5pz+l/VuITwELs4sECwAOZ1fGXzDBxeGqM0NuhI9IhuzOeRpDS8lF7xoHgpdJnlK41/U41tleiZFUjerW+FIBiQLBqAO01Az4pVFTco6sf4fY2z7pVhPbw3g2NzFhmbIkwQXftN6rP92CpoJW7y+QndrMbXS/fCXmmaCxQNYRUoUqswrhocAgv44XFMQXUK80oWOdrbBjLF4SJeNGYr8HPP1XJIT7JgwmspsaF3WMOpvfVHgZBqOMHGtbpiYEUArktk+7dLTK5kceje+3Q8/n5Zco77jnycJoK0Xpit3b/XSmoxYO9C8lswWJTHJiDwUA== 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=xHzrhqw0mZ+P9ayAqWvmbIHNuheEyALcVjg21ZwF1is=; b=SFrcmtOH4irnoaHNhSGMzTnjE3/iofyYj+lAlFouO9vjrqZrWECil1qSsggGl6gKCcMhIX6+uBJTTqgxLfP4uoXMt6aztLx7q+8sWwBlljJDasxc+rQKS7EunjuSf8C/kPoxDgZaauyp8toGGW+eyTcyzms5qmlg234Dib2a+Qc= Received: from DS7PR03CA0332.namprd03.prod.outlook.com (2603:10b6:8:55::19) by DS0PR12MB7605.namprd12.prod.outlook.com (2603:10b6:8:13d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Fri, 13 Jan 2023 05:23:33 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::48) by DS7PR03CA0332.outlook.office365.com (2603:10b6:8:55::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.14 via Frontend Transport; Fri, 13 Jan 2023 05:23: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 DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:23:32 +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, 12 Jan 2023 23:23:27 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Wyes Karny Subject: [PATCH v2 2/6] acpi: cppc: Add auto select register read/write support Date: Fri, 13 Jan 2023 05:21:37 +0000 Message-ID: <20230113052141.2874296-3-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113052141.2874296-1-wyes.karny@amd.com> References: <20230113052141.2874296-1-wyes.karny@amd.com> MIME-Version: 1.0 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: DM6NAM11FT052:EE_|DS0PR12MB7605:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a4c24d5-c9e0-4f74-c9f5-08daf526502f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iXMKHIXbKzY+aaxqg7w6be7qaaH3/asQeCc8lSSKxOi/eX0atapumxtAAyH3d7uO7YU/SRbl0iDmnA3iqXmIqGFyhYLz0OYkhAvvkmrIaJxAhkW++mrDGC9zmHZlSS5Vo0u0UueCTvGrc49cL6K68Hc3eFLwGddA60uxuV/+oTEwBFqkh2HKKGAj95wBbWwwJ3N7UdNujHYLvKqVVfNd7kvesWPq2FCnJp9EmhMtALhTgQqk68Wjj+lLsUWzc5Y+dWUAC/R9k91kh0hcjilMUoufqYw8DvPF7LVMjLr1n6F2DbgIC21bYsLIpKHRTqcYwv2Qt5c/GvSxGWSk3vQQRKLUcdqVzXloIW1JwLhIV4/H8inr5hT7HwB0UIzp82SnsfSGCOhC6X1BE4+nSwaasOK3giXl7oGet7ydBKkvs7EjmUaAGdK1OhHATNQznYMlv3UXVX1zOirzFJUy0oaob30wepDVPlrfCez4IGRYCR7ZpfB7a/clerQ3NWS0jw3i4d7ltWcqiNDFwrfrIZcqwEF5oFwbgJyOeQ+fPn1VnmhtBizWi3pK//iUrEbsFQdeUZwse3qW/5OsCECY3ESFbbMd2HN2geWp8infmWMTy/wseUzvCHpYh2PjWK9F2CJwd1vIs6bJgdIRV0xntcFwoLAVG/HLP+2SS4aDaRaTDxk0aGElrGpOmtjoxV0Iu1lG4vYajYAmHWTyzKyAqb77AiDYXrejWESPnvsd90kmv5c= 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)(136003)(376002)(346002)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(81166007)(36860700001)(356005)(82740400003)(70206006)(86362001)(40460700003)(6636002)(4326008)(70586007)(110136005)(54906003)(8676002)(41300700001)(47076005)(8936002)(40480700001)(83380400001)(5660300002)(16526019)(336012)(2616005)(44832011)(2906002)(426003)(1076003)(82310400005)(316002)(186003)(6666004)(26005)(478600001)(7696005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 05:23:32.8436 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a4c24d5-c9e0-4f74-c9f5-08daf526502f 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: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7605 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754883707901153835?= X-GMAIL-MSGID: =?utf-8?q?1754883707901153835?= For some 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_ctrls *perf_ctrls, bool enable) } EXPORT_SYMBOL_GPL(cppc_set_epp_perf); +/* + * 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 updated. + */ +int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps) +{ + struct cpc_desc *cpc_desc = 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 = &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 = per_cpu(cpu_pcc_subspace_idx, cpunum); + struct cppc_pcc_data *pcc_ss_data = NULL; + int ret = 0; + + if (pcc_ss_id < 0) + return -ENODEV; + + pcc_ss_data = pcc_data[pcc_ss_id]; + + down_write(&pcc_ss_data->pcc_lock); + + if (send_pcc_cmd(pcc_ss_id, CMD_READ) >= 0) { + cpc_read(cpunum, auto_sel_reg, &auto_sel); + perf_caps->auto_sel = (bool)auto_sel; + } else { + ret = -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 updated. + */ +int cppc_set_auto_sel(int cpu, bool enable) +{ + int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu); + struct cpc_register_resource *auto_sel_reg; + struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu); + struct cppc_pcc_data *pcc_ss_data = NULL; + int ret = -EINVAL; + + if (!cpc_desc) { + pr_debug("No CPC descriptor for CPU:%d\n", cpu); + return -ENODEV; + } + + auto_sel_reg = &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 = cpc_write(cpu, auto_sel_reg, enable); + if (ret) + return ret; + } + + pcc_ss_data = pcc_data[pcc_ss_id]; + + down_write(&pcc_ss_data->pcc_lock); + /* after writing CPC, transfer the ownership of PCC to platform */ + ret = send_pcc_cmd(pcc_ss_id, CMD_WRITE); + up_write(&pcc_ss_data->pcc_lock); + } else { + ret = -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; }; 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 *epp_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 */ #endif /* _CPPC_ACPI_H*/ From patchwork Fri Jan 13 05:21:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 42945 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp94275wrt; Thu, 12 Jan 2023 21:25:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXtiZ8abEcBKpR53GBwYtoMU02pAdfGHTetiiqiHT/DtG+djubIwaRoq6HTmcoxN/BcZQfr9 X-Received: by 2002:a17:906:4e90:b0:7c0:e4b7:517e with SMTP id v16-20020a1709064e9000b007c0e4b7517emr1972095eju.16.1673587542490; Thu, 12 Jan 2023 21:25:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673587542; cv=pass; d=google.com; s=arc-20160816; b=aGrjctG6TkHcYFe2nvi4m09fIofogzFp8lGzXbM5Ja7eQf9x3q/x0F+Emyaq+WU4OT Y0d6637NhznCZ+UXlw4JDqtw/vTwjflfajgkn0aMNz/2m7JGXgIZsrhHqx5SbBy83t4q bpK0ACEOyYTbE5ImqJ3gmBePBbnYDXz9ENeIyB3qiaxC2xppEAeEkgT+Ph8XqZw2DAk1 5X3mGi/yf6zqksWxxnhPsrLhtEe49OC2U7T8dXeSG1Xol/nSYcWup+8mTqvStjOJ9+wx aabg4ufz1WQ+YxBILTSdEOV4qnXWobWPmWHesx8A8JHK+P22KXTN9Vy35a8EvBkBFl4w RfPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ax0+dEekv6wiRqcp+uoIWJhYZhQNxZdvgaxfNEDVoBE=; b=lM8Y87DnTa2fU6118qGVZTY5MfXhJUcm9X8VKMKlpxK8oHU/9IRH8UecdysL52plXd MSHgREnTNJirQlL2udux9aLhD7Ue89tLfuR3xbF3pJyOtbYFSdeUsNARSt0iJg8bxg1Z AElEKX0oM2VP3gXV9dtdb1K6kG1ih4hlWipQt/IP4dkiWQBJTEP5Sl4C6JqwfWkOprzl vuM+0SM1mNFqmsfROHzote65+QWuvfQe7r/FBtqdX3zwx8U25AK0geY9+/ZKqDyk18xh o2F5A+F7zfiFeHsxWggTHMtpxFlk4j2xSaubFy2k48M2cR6KKoXdGqvrviF4QTr84x/O kD9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pfd1tJiY; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a056402349600b0045cecdc1fbcsi26479914edc.9.2023.01.12.21.25.19; Thu, 12 Jan 2023 21:25:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pfd1tJiY; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232500AbjAMFYa (ORCPT + 99 others); Fri, 13 Jan 2023 00:24:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232362AbjAMFYE (ORCPT ); Fri, 13 Jan 2023 00:24:04 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2058.outbound.protection.outlook.com [40.107.94.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 111A961319; Thu, 12 Jan 2023 21:24:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iR++8NWQ0+KQr7vri0DeUPJU1ouFQ92vCVGb+mzn9zWWDvoiXK7kXOZ5yZgzAW1anDWUJ6/16j3+gSDYe4NZoBmcmZ0Uxts9eQnfsR3ZOqbvG9U08Br/m184Rs1PHmeqTlcbW47dlNbNtpPNgI6HIAylmd3RnyqTEz1IEyhnsQRG5K8dudb8c9MawALPjOVaGcl9Ano8DS8FY3U1gTaCguplSfCrYxmQbRZDroVf4pww8F63/bhOUMKTX1tOwMqgwmxu1mU3VvVdrW9bbFY13CcDUDoGrFGarNcHmxKrg6Rr/yralisD2C4ylUUO8FOq23dPvQRCQvd7wpiMb959nw== 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=Ax0+dEekv6wiRqcp+uoIWJhYZhQNxZdvgaxfNEDVoBE=; b=kX0UyR4lZKKeWea4TXMU3/z8Cui57OeMgMflrI0kDRSXkiIOhFUmH7RzGP3nAW+aw1qUOFf7tELRghU7TwO72AlLNG54shr1A124V5cGYQ3CESXi/08q2f+VlS8DJ4Hn3QeuL/LoQDxwX1cKEJqOQMQmAd2Eb8b64zv+G+MiefvS4coQcczciOlN4ERosM6fGKLPpbhlLNESA6Ls/9ghIZV4ptVUqfMlehN+bi1ErLkp5bCunYF5RTHamVDP7IbfqB50RIvUDWc20CFwdtQpH4/7WLIa4MZL+DfE4pjPrQ+c+aTBqSY/0wV8IqX/aKs7UW2tC07yMoSpwoeceyj0/w== 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=Ax0+dEekv6wiRqcp+uoIWJhYZhQNxZdvgaxfNEDVoBE=; b=pfd1tJiY8IeUmhgOdlPuEJdR29D0JUfGyceeZ/wB9eUhsod/K+GrVJXBGYqnmlI3f9FEYsYzpP7EeU5kKTVpmRzPRMFxZvlWhXeWMogk1j18oHakZkXMd+8FsGVYS4TejmaN8fy9QuCyZ3Kl47XD3jDQKSzzTQofjwgmysOHB9Q= Received: from DM6PR21CA0004.namprd21.prod.outlook.com (2603:10b6:5:174::14) by SJ1PR12MB6315.namprd12.prod.outlook.com (2603:10b6:a03:456::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Fri, 13 Jan 2023 05:24:00 +0000 Received: from DM6NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:5:174:cafe::cd) by DM6PR21CA0004.outlook.office365.com (2603:10b6:5:174::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6023.3 via Frontend Transport; Fri, 13 Jan 2023 05:23:59 +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 DM6NAM11FT094.mail.protection.outlook.com (10.13.172.195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:23:59 +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, 12 Jan 2023 23:23:54 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Wyes Karny Subject: [PATCH v2 3/6] cpufreq: amd_pstate: Add guided autonomous mode Date: Fri, 13 Jan 2023 05:21:38 +0000 Message-ID: <20230113052141.2874296-4-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113052141.2874296-1-wyes.karny@amd.com> References: <20230113052141.2874296-1-wyes.karny@amd.com> MIME-Version: 1.0 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: DM6NAM11FT094:EE_|SJ1PR12MB6315:EE_ X-MS-Office365-Filtering-Correlation-Id: e54fbf9d-1b39-4961-ed81-08daf526600c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tpBBio/hT7lfNK8i6LUQwgZgZIFV7tcxjCDq8wiAdyDBV0qyJLyoHntHN7Ss6fE1ke4P0zsgYZ7DYY6BjlhFlenVxBw9IO3zNMoDreieZlIOdXgqRGgtZNHXNI46nsqUV+Lxj21ES7gCwSkGHtsV/cpBirk2SFxSJu3MhZcXFV/q98e9JrLRPMJ+oi3v2fQhOVc9OWAKpfRBbzwJAT2aHrESTHaM+OmDG3CZwZuP0f26c+U2tEVnIkKhx46wHIC0Ba1IQggcXhWYeTihfjuyITdav5XKGlCQQQ4ssTD8Q2deANgjOEuOpQ4XJXEhXJf0hut1BSTh/oxjVqB6jJD4d1XCZVImYTBBh2PeLyo75CgZcVoLKLh+lfDGev0uIg/E+++txHiSL1e0mXHHn/9qgjaGzMH5+ls45EjIknnkQEFooWNMOC+myBZI55wrleNHBwKI3lkvJCADHF3rYg9ZRv628uLgfH+7YQEas9JBEpl4nx+w93vJ6fE7XFtVznvFCvaGpeocm0NDbKylgZ0mxmBH73++EJcQ7N78RZVgxv5W29UeQKdvE7kIZLqIdlHEF9vmUdQ9oa/OtNM026kxgJa2tREh6TBLg+VDtW/RxYy1UjUomQGbEkiez3817tRj0BmOFj2RErWv87G3vqIyEXD2PemJEP1+1enP91dxWz5re5LxmFH6XdLKT22hg47EOzdIiYKLdMHxNqaYE0gUKoc5cmVvbiZ7tBZjJCNkrl8= 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)(376002)(396003)(39860400002)(346002)(451199015)(40470700004)(46966006)(36840700001)(83380400001)(41300700001)(70586007)(4326008)(8676002)(70206006)(47076005)(8936002)(426003)(36860700001)(82310400005)(5660300002)(336012)(1076003)(82740400003)(16526019)(44832011)(36756003)(2906002)(81166007)(186003)(26005)(110136005)(2616005)(6636002)(6666004)(54906003)(316002)(478600001)(40480700001)(86362001)(40460700003)(356005)(7696005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 05:23:59.4587 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e54fbf9d-1b39-4961-ed81-08daf526600c 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: DM6NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6315 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754883730637505691?= X-GMAIL-MSGID: =?utf-8?q?1754883730637505691?= 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=guided`` 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 | 29 ++++++++++++++++--- include/linux/amd-pstate.h | 2 ++ 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/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 87450413cf45..20d78dad712d 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -267,6 +267,20 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) cppc_perf.lowest_nonlinear_perf); WRITE_ONCE(cpudata->lowest_perf, cppc_perf.lowest_perf); + ret = cppc_get_auto_sel_caps(cpudata->cpu, &cppc_perf); + if (ret) { + pr_warn("failed to get auto_sel\n"); + return 0; + } + + if (cppc_state == AMD_PSTATE_PASSIVE) + ret = cppc_set_auto_sel(cpudata->cpu, 0); + else if (cppc_state == AMD_PSTATE_GUIDED) + ret = cppc_set_auto_sel(cpudata->cpu, 1); + + if (ret) + pr_warn("failed to set auto_sel\n"); + return 0; } @@ -344,12 +358,18 @@ static inline bool amd_pstate_sample(struct amd_cpudata *cpudata) } 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 = READ_ONCE(cpudata->cppc_req_cached); u64 value = prev; des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf); + + if ((cppc_state == AMD_PSTATE_GUIDED) && (guv_flags & CPUFREQ_GOV_DYNAMIC_SWITCHING)) { + min_perf = des_perf; + des_perf = 0; + } + value &= ~AMD_CPPC_MIN_PERF(~0L); value |= AMD_CPPC_MIN_PERF(min_perf); @@ -404,7 +424,7 @@ static int amd_pstate_target(struct cpufreq_policy *policy, 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); return 0; @@ -438,7 +458,8 @@ static void amd_pstate_adjust_perf(unsigned int cpu, if (max_perf < min_perf) max_perf = min_perf; - 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); } @@ -1233,7 +1254,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 == AMD_PSTATE_PASSIVE) + if (cppc_state != AMD_PSTATE_ACTIVE) default_pstate_driver->adjust_perf = amd_pstate_adjust_perf; } else { pr_debug("AMD CPPC shared memory based functionality is supported\n"); diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index 15761a581e82..e07cfbd63560 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -92,6 +92,7 @@ enum amd_pstate_mode { AMD_PSTATE_DISABLE = 0, AMD_PSTATE_PASSIVE, AMD_PSTATE_ACTIVE, + AMD_PSTATE_GUIDED, AMD_PSTATE_MAX, }; @@ -99,6 +100,7 @@ static const char * const amd_pstate_mode_string[] = { [AMD_PSTATE_DISABLE] = "disable", [AMD_PSTATE_PASSIVE] = "passive", [AMD_PSTATE_ACTIVE] = "active", + [AMD_PSTATE_GUIDED] = "guided", NULL, }; From patchwork Fri Jan 13 05:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 42946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp94548wrt; Thu, 12 Jan 2023 21:26:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXttFRL5AuTmd03ShkjgpJihrMRnt6NcCD2Z5zbHU0HSsjoV/2dwg81+6yovoze1Wv3eUjSj X-Received: by 2002:a17:906:b00a:b0:7c1:458b:a946 with SMTP id v10-20020a170906b00a00b007c1458ba946mr69721543ejy.0.1673587599693; Thu, 12 Jan 2023 21:26:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673587599; cv=pass; d=google.com; s=arc-20160816; b=y9yoDK+U1dd3njJkJGJcRIFitlph67hSUfDGvMIwBstMwBTmrlQtjUhbwmI0cZsyzr 9z+N6cRNoA0Y9Rbth97fLd2LjSs8uJpePai7bBtbwwkYMyMxvjDPVM60x9DHrY6G70R/ TtsilinhspGdcptPEWJE0KwmoATEomI7XEnGBwNT1K0np0Y6ZsVk9vKy9aEK0KKtg1/9 5gpwyCBGlAcDHfW8sxb89UZ8EvwweMbOso/x2EsftuAkUJUNDisNUVAvdtyoBHSXAa/O qec6QU6XJr7Ev5XP19MbR93j8mn1nLOLsItI9A7GlMhEs58b1gZqAcC5ByGwB1lnTtq3 SdvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8o7pOTB7rr581e9f3WW+ovZQfdcnvY07pEUymHiYvPI=; b=ypvk+nMshKBgM6YPRPEVUXjp81NzZ/tC4HmQ4orH4hrAGkCJxfnNYj61xeWQ8e/G7o QVZuA1uzVCDPZn4xkH0/Z5ftRskRlqxa21pfvGQTO7LQm/Ochi99oW5oMimrfZFT2Luj Ee2N1eIdsg5HqJf2FiCACDPY2wfJ1tE6WdaMF8o1toIjJCUAaC/fcqdD0roBeXJq5AII tu5oRKzvtHzepm7Gi24u4HNS3/tTxKSM0eUAQ1isQOQL8xpgb1d+hCmLy9axzUq5Qxw+ w67T3C1YKCS3HTTRKMfPVaZq79lplzqxXbp7VevVUica3nR9ggjuieBLBoofrd4+lVBN CB+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=uLqgVCNf; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he41-20020a1709073da900b008695abff71dsi2657704ejc.710.2023.01.12.21.26.16; Thu, 12 Jan 2023 21:26:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=uLqgVCNf; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235593AbjAMFY7 (ORCPT + 99 others); Fri, 13 Jan 2023 00:24:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233025AbjAMFY2 (ORCPT ); Fri, 13 Jan 2023 00:24:28 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2077.outbound.protection.outlook.com [40.107.223.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1852B6218A; Thu, 12 Jan 2023 21:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F0vcQrBXB8/uUDxD2wmhIGHozAY+ljTiKvMFQ6Smkrrgw+IfHmLXUIqREIOH+n/aj9xT1lNOxEo9VuxpkdoM49imRL8IZuB0p9+xfOT9Vzw2C2DcgtfLC3cMt8jn9vlBbZptiq2jmy8J67CGFMMnGYVNQZFAt5NUFjV+ZcvkFVoBYRb8pknldrM5uw/ouI6HVieo/1wMfCLNZguULXWLarLkut5ap4ssSUhv12PotNawNKC2yA2o9zmHvuYxlOb2vz1Y3U1/AWqIEDSAlkydHojxpV+Ng777sd2LtjCKkYupy4ReoBAYGJ/uW1shJFgpiEiIwfmHaewPH3H2+L5Frg== 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=8o7pOTB7rr581e9f3WW+ovZQfdcnvY07pEUymHiYvPI=; b=jXW91T9Qh56jbYd/Rd1L1p5Ftxc9237ttizPf8zMUBAfzkEePqEuf6oZYJGcc+j0eGAtiD5823xeNKqK3GNO2SoGFefyUMEVHZE7zEtdwY6kuxlETnSHUNPRJAUz6u1TZ9DRc/1LQ9sa/jo0YEZ8G69NtwyLKAadjppQtyZLVoEm/vLG7qajLd4cnveE+1JZx49pRnTtp53m+gEbILcbBod5BO8hRN9Owu1/C+WLqqDt+cYNow9rVObw4q5CCnHxC6Z6AOlBBAb2LnlN/l+KNDYkB7crM7ixqsZ+Oat38R3lAqbXa2zEsHHlDzFAxmErruJ8uF1BTtHEed9hAEitPA== 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=8o7pOTB7rr581e9f3WW+ovZQfdcnvY07pEUymHiYvPI=; b=uLqgVCNftlK5RDH9rSBuNjj0e7nCobrjtBi/dzkbXDyRpsydTXGSQ7Z8Qw5U3Nfw/YUB2d6z/dQdUENIutZ6Mt9py1FYAwpkqN6SATsj9si2eKVsF6nir5974jiceyGoptsWEppIaaxdEID1XtIKGbehse3sBLgzMZd2POqxRao= Received: from DS7PR03CA0143.namprd03.prod.outlook.com (2603:10b6:5:3b4::28) by IA1PR12MB7637.namprd12.prod.outlook.com (2603:10b6:208:427::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Fri, 13 Jan 2023 05:24:23 +0000 Received: from DM6NAM11FT042.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::66) by DS7PR03CA0143.outlook.office365.com (2603:10b6:5:3b4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:24:23 +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 DM6NAM11FT042.mail.protection.outlook.com (10.13.173.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:24:23 +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, 12 Jan 2023 23:24:18 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Wyes Karny Subject: [PATCH v2 4/6] Documentation: amd_pstate: Move amd_pstate param to alphabetical order Date: Fri, 13 Jan 2023 05:21:39 +0000 Message-ID: <20230113052141.2874296-5-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113052141.2874296-1-wyes.karny@amd.com> References: <20230113052141.2874296-1-wyes.karny@amd.com> MIME-Version: 1.0 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: DM6NAM11FT042:EE_|IA1PR12MB7637:EE_ X-MS-Office365-Filtering-Correlation-Id: de3870ec-6d9f-4924-7453-08daf5266e2b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LuSgGLbT7FB0NfKZ6IfQjEIBuzR6ffk3jibqhR/qPjKfHMZgT8k9K19YJsXvzSj56wOysvyULGoy72xeU6pfQjSkGNmzzQ0k8nO0Op+TMQuNHiUuTSG2svLppFqRWMtGPpk5UfbMb/i6Dg1v+Q2ZYedMqzPq1iq5Skb7AcYZDP0C+u7HNt8I0CVfdmtPliyr8lXDofpkPPxqXA7Qb/Bpo4ulsze3un/rtRNYnJ3d9KSH2+7IUv3R8P4Gli9rVbgUW1mLLHeRwFoQQU6DCfooIYFLMYBcXHojqkIgzCXYdx0ih6IUtBkj+AElTi6la19a3szay9HDtEeIyw/e3hzRqmMqZIfXbLYwJGNk0FTS7qYRhVbc2T/bvA2Gf9zd5PyAiMWZpee14ahULsiun/3bCOfRifIb+TIRyBZXx/eqCC0y9ikGh/6XSdmPqnisPxpTpOpsSZrb768xm7PT/F4X3qTjVCgL7/h9R1zaHupq36ZvJUKJXaOP4rVg7lzpxoptUEInB+bWofrKFd9UA++gXcwVOcQtb3ojoqXXfbAHkdhkVobUd7pFLEtTyooRbzACeRxjALHsJygXnUpYbmvi8aak8jtyEmBdk3Eqf7WdMRkNTO+u6ewN5MewvzC6XHL2WYW1WxEy1SmP4e6WJIqtQxVzsyCI8dEr5NByinK3zZedFR6KBSrlZzTrmC3pXxgqKgQN9DfgsYN/cVBQDbLtjYdL8CLfAzpa+FbpUkvhG88= 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)(136003)(346002)(39860400002)(376002)(451199015)(36840700001)(46966006)(40470700004)(36860700001)(6666004)(2906002)(70206006)(16526019)(36756003)(5660300002)(83380400001)(8936002)(44832011)(4326008)(8676002)(47076005)(478600001)(82740400003)(81166007)(356005)(41300700001)(426003)(26005)(336012)(70586007)(40480700001)(7696005)(82310400005)(186003)(1076003)(86362001)(40460700003)(2616005)(316002)(110136005)(54906003)(6636002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 05:24:23.1469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de3870ec-6d9f-4924-7453-08daf5266e2b 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: DM6NAM11FT042.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7637 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754883790871005789?= X-GMAIL-MSGID: =?utf-8?q?1754883790871005789?= 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/Documentation/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=1. (Default when IOMMU HW support is present.) + amd_pstate= [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= [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= [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. From patchwork Fri Jan 13 05:21:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 42947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp94723wrt; Thu, 12 Jan 2023 21:27:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXv2MdikIk/UPzDCmChGBSiioMIb1ec4yXsYzP1CzajgLWmXYx10uMIBkjWm4VL/+/+LrPWC X-Received: by 2002:a05:6a00:1d8e:b0:575:6a68:65f8 with SMTP id z14-20020a056a001d8e00b005756a6865f8mr79107486pfw.18.1673587637158; Thu, 12 Jan 2023 21:27:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673587637; cv=pass; d=google.com; s=arc-20160816; b=DTKPaq3YwijLfZLt+M09doZBh3W/xc0+aA1EYTffEVpiZSI8ldCw3gC1UeM1cvVemk DzX2PSWhpRodtTMmCpKCQWGhr8kVNIcEGka95cbyh+MFshfi0oGz+X0hnakSaeYP3gPr NZUsodteQ4w2x9liHk+oNbKW2/UU0oiEhKEJJhMggjs3vw72PUYB42mDIcvJ37Z3hGNG K3RHrSAJc7DhmirZLHI5kBS7x2EN7ntoLzK67UfLBoM5LgnEQotil/MeLgGFdxD9MbGH bjTuz04NE7jYH+r+MmsKstR3WUG1bK7+XQHOOPu+OKJOxvFP+WLIlsqlUg2vr/ibSSJR 6rTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q6NdZDDlwli7C8W873FcbXa5fNvq5NIShjUGvulXh9s=; b=hR4j+ZAQtp0PkX4+bD9GI+If0zqDE6QE+tCwbwyZPeUeYkWLy4XuJwxDNnifgV/SdG l2B9lO8cIUnpFJzTBI4fYzqBf3eZNjb8bV0kH1+zTiogAp4ZLiO3DzrM+ch39e/8KbNC qNKtRFWtHsSow1xLJT7UljUsY9zxWUhwxN2lUq6wcQErAMiarPf8KxIKSZbpXf6Xf/6Q hmH7n2TOIY+Rjz2Kw+lPNeD4Vso2KmGAt7wwromgck7PPA7iCdTJxiXmDnO02KoleJma 9PeLE/RPZG+zJ9Dj26afBygVVkIzQpP8gAT49b/HjjnzIJa9FkheKVpcaYy37prYUzwL oSTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RPzk+7Qr; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020aa788c9000000b0057d5f9a24d1si21241015pff.94.2023.01.12.21.27.04; Thu, 12 Jan 2023 21:27:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RPzk+7Qr; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233650AbjAMF0O (ORCPT + 99 others); Fri, 13 Jan 2023 00:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236478AbjAMFZQ (ORCPT ); Fri, 13 Jan 2023 00:25:16 -0500 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2057.outbound.protection.outlook.com [40.107.102.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39FB7621B5; Thu, 12 Jan 2023 21:24:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X3Gu8D7vU5yLSPrU4gWyAFmnTPhl/NYbfNczvhvdwHglEPtDby2opJdMKMdE1yFvhp4tG2KUG0ksEdrllipE6+oEi55PNJYCleHRKZ/GDQAUAmLrkHZL3ZSK0WkMY+nhwmkbq525ot5Y+5Y6P+zIvqBa1RUikylsVt5Pq/R75qTUrPx8hCOimXEQbcgGSNCsWNhy2+83fnyrQIb6bG0qu0q8183BnkjfmPlIkw+h8F218nJsdzgyBByD77NkTbhhzVn3Nef8Ue6K0iGEUCfkXlaAwJuCpTlEwVdJguVv3vS09kxCc8eQApgTRzPMxvDOUoujjTIuvnDMRPQOsp8u9w== 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=q6NdZDDlwli7C8W873FcbXa5fNvq5NIShjUGvulXh9s=; b=VwByethADYAlhka5axHBmHpm/dqjRioYaDNcD4apUXU4eJi9XNvI4fWT0LnNxfs3JHEEaGbsqLexbjCXwd+v9O2sxbBF8RSK2rSw18SbkyNl7B48I/goh/GJ1wyYbsQBpv8Ab3wD3VijKq4KuuZPzbINLNnl9PGIsfNgxavROgSaT0lG8uufvzWS7TycFh34LevG3HLDHEuWOut7xHaJ+jERKUw4uotpsrOY+DNI4CySgLB5DDAGI6y1eRgIsongy38aAWvZb5iAFFc07SIgyi8tTSSCCieAvleBa0at8hwa5KpRR/sXKsPP7FB/7fbwgwvxzx2hQzVbZcTaylljZg== 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=q6NdZDDlwli7C8W873FcbXa5fNvq5NIShjUGvulXh9s=; b=RPzk+7QrpfBeUFGgEKvAVD1kCXB/zEknS3ig3cdpgsmIsjgonmQ6xwjBEoofDB1rkSC8x5QyTjN+TxhePbOunt8ucPNys+VgP/grPWmZ/G/TGXUdWHY27xQEoGQBq6AtBdI9O57tkQAXNdQ0E6ANE8t5NKt9nUqNsNpDyFvl8lw= Received: from DS7PR06CA0014.namprd06.prod.outlook.com (2603:10b6:8:2a::11) by SJ0PR12MB7083.namprd12.prod.outlook.com (2603:10b6:a03:4ae::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Fri, 13 Jan 2023 05:24:54 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2a:cafe::81) by DS7PR06CA0014.outlook.office365.com (2603:10b6:8:2a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:24:54 +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 DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:24:53 +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, 12 Jan 2023 23:24:48 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Wyes Karny Subject: [PATCH v2 5/6] cpufreq: amd_pstate: Add guided mode control support via sysfs Date: Fri, 13 Jan 2023 05:21:40 +0000 Message-ID: <20230113052141.2874296-6-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113052141.2874296-1-wyes.karny@amd.com> References: <20230113052141.2874296-1-wyes.karny@amd.com> MIME-Version: 1.0 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: DM6NAM11FT004:EE_|SJ0PR12MB7083:EE_ X-MS-Office365-Filtering-Correlation-Id: f21002f1-6227-4610-03ac-08daf5268084 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YUXiHYyyvaM3ukiEXjlMVl7ynSZDTNA0vH6ibumTKvhUk1wxJsI9ZXkn0vdSemxseAH97I70ZeM2VPzc146VnAK+ZVeS4wQHl31kio+KoAkk0H1ZkJR5yVcqL5fwhD8fep+fbJyH05Uk1v83I2YmYCWnNF8kot3uGYoSzDxhIiIeosvmGXr1pbxYCP4MN7i0DobdDu/ZtjSTw9cLTEaWjDPgtKkMEPHf359KNRdNqO8+uA76vK/SiRWSYU2eJPhwvMeSnsN3z2gJptlZPEiZA1k9V99uP8OvZkDxLi5gYITjXKFSXkVDcO2vxq8az6ugy40VLf0t0aeg9thL3QeIokiqToRNdUbbJAbOUd4Glr/wYLhmsm6tmZcoy5h1H9I04np/NqA7PM3l84HKqjB5W6nJ6Wsd7dKNpe5omf0WA9XvFy9eTGjrpm0aakvGzpDNwi9uBJL0VozFeIn70Ekbc5m5yUaf+s9E4hKxRqohEuRi89fU5qp5lYLlGkZ8iky6eJ0tSvZd9fYBnw02FcMh7PGzw0HCSydpK+B9TXR0R3ks987hSQ/IesKCFHjpTvil5InnyB58vj0GDgKTtmISNNTKV9tolL8k+ddgQQUGEpmDTFd/AFaZ1DlpNz6/3ZbM3RHmP845JNruWZIQODr/OT+FB88XiCGhE7QsrU/tF0Dzyk/dqkolJSVFGQaIrcYWgD0vuiVw95GhhgY735j9HU4Rm2pfNV+FBdKbxbwW3Os= 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)(136003)(346002)(39860400002)(376002)(451199015)(40470700004)(46966006)(36840700001)(36860700001)(6666004)(2906002)(70206006)(16526019)(36756003)(5660300002)(83380400001)(8936002)(44832011)(4326008)(8676002)(82740400003)(81166007)(41300700001)(356005)(47076005)(478600001)(426003)(26005)(336012)(70586007)(40480700001)(7696005)(82310400005)(186003)(1076003)(86362001)(40460700003)(2616005)(316002)(110136005)(54906003)(6636002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 05:24:53.9263 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f21002f1-6227-4610-03ac-08daf5268084 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: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7083 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754883830155483951?= X-GMAIL-MSGID: =?utf-8?q?1754883830155483951?= 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 | 144 ++++++++++++++++++++++++++--------- 1 file changed, 109 insertions(+), 35 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 20d78dad712d..4a2b559fd712 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 = AMD_PSTATE_DISABLE; struct kobject *amd_pstate_kobj; +typedef int (*cppc_mode_transition_fn)(int); + static inline int get_mode_idx_from_str(const char *str, size_t size) { int i; @@ -806,55 +808,127 @@ static ssize_t amd_pstate_show_status(char *buf) static void amd_pstate_driver_cleanup(void) { + amd_pstate_enable(false); + cppc_state = AMD_PSTATE_DISABLE; default_pstate_driver = NULL; } -static int amd_pstate_update_status(const char *buf, size_t size) +static int amd_pstate_register_driver(int mode) { int ret; - int mode_idx; - if (size > 7 || size < 3) + if (mode == AMD_PSTATE_PASSIVE || mode == AMD_PSTATE_GUIDED) + default_pstate_driver = &amd_pstate_driver; + else if (mode == AMD_PSTATE_ACTIVE) + default_pstate_driver = &amd_pstate_epp_driver; + else return -EINVAL; - mode_idx = get_mode_idx_from_str(buf, size); - switch(mode_idx) { - case AMD_PSTATE_DISABLE: - if (!default_pstate_driver) - return -EINVAL; - if (cppc_state == AMD_PSTATE_ACTIVE) - return -EBUSY; - ret = cpufreq_unregister_driver(default_pstate_driver); + ret = cpufreq_register_driver(default_pstate_driver); + if (ret) { amd_pstate_driver_cleanup(); - break; - case AMD_PSTATE_PASSIVE: - if (default_pstate_driver) { - if (default_pstate_driver == &amd_pstate_driver) - return 0; - cpufreq_unregister_driver(default_pstate_driver); - cppc_state = AMD_PSTATE_PASSIVE; - default_pstate_driver = &amd_pstate_driver; - } + return ret; + } - ret = cpufreq_register_driver(default_pstate_driver); - break; - case AMD_PSTATE_ACTIVE: - if (default_pstate_driver) { - if (default_pstate_driver == &amd_pstate_epp_driver) - return 0; - cpufreq_unregister_driver(default_pstate_driver); - default_pstate_driver = &amd_pstate_epp_driver; - cppc_state = AMD_PSTATE_ACTIVE; + cppc_state = mode; + return 0; +} + +static int amd_pstate_unregister_driver(int dummy) +{ + int ret; + + ret = cpufreq_unregister_driver(default_pstate_driver); + + if (ret) + return ret; + + amd_pstate_driver_cleanup(); + return 0; +} + +static void amd_pstate_change_mode_without_dvr_change(int mode) +{ + int cpu = 0; + + cppc_state = mode; + if (!boot_cpu_has(X86_FEATURE_CPPC)) { + if (cppc_state == AMD_PSTATE_PASSIVE) { + for_each_present_cpu(cpu) { + cppc_set_auto_sel(cpu, 0); + } + } else if (cppc_state == AMD_PSTATE_GUIDED) { + for_each_present_cpu(cpu) { + cppc_set_auto_sel(cpu, 1); + } } + } +} - ret = cpufreq_register_driver(default_pstate_driver); - break; - default: - break; - ret = -EINVAL; +static int amd_pstate_change_driver_mode(int mode) +{ + int ret; + + if ((mode == AMD_PSTATE_GUIDED && cppc_state == AMD_PSTATE_PASSIVE) || + (mode == AMD_PSTATE_PASSIVE && cppc_state == AMD_PSTATE_GUIDED)) { + amd_pstate_change_mode_without_dvr_change(mode); + return 0; } - return ret; + ret = amd_pstate_unregister_driver(0); + if (ret) + return ret; + + ret = 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] = { + [AMD_PSTATE_DISABLE] = { + [AMD_PSTATE_DISABLE] = NULL, + [AMD_PSTATE_PASSIVE] = amd_pstate_register_driver, + [AMD_PSTATE_ACTIVE] = amd_pstate_register_driver, + [AMD_PSTATE_GUIDED] = amd_pstate_register_driver, + }, + [AMD_PSTATE_PASSIVE] = { + [AMD_PSTATE_DISABLE] = amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] = NULL, + [AMD_PSTATE_ACTIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_GUIDED] = amd_pstate_change_driver_mode, + }, + [AMD_PSTATE_ACTIVE] = { + [AMD_PSTATE_DISABLE] = amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_ACTIVE] = NULL, + [AMD_PSTATE_GUIDED] = amd_pstate_change_driver_mode, + }, + [AMD_PSTATE_GUIDED] = { + [AMD_PSTATE_DISABLE] = amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_ACTIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_GUIDED] = NULL, + }, +}; + +static int amd_pstate_update_status(const char *buf, size_t size) +{ + int mode_idx; + + if (size > 7 || size < 3) + return -EINVAL; + mode_idx = get_mode_idx_from_str(buf, size); + + if (mode_idx < 0 || mode_idx >= AMD_PSTATE_MAX) + return -EINVAL; + + if (mode_state_machine[cppc_state][mode_idx]) + return mode_state_machine[cppc_state][mode_idx](mode_idx); + + return -EBUSY; } static ssize_t show_status(struct kobject *kobj, From patchwork Fri Jan 13 05:21:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 42948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp94802wrt; Thu, 12 Jan 2023 21:27:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvapNUgDp6FtmsxFUe5D4JiOw8EL9DYXQaeX8OMtM739GPlkc3I4eByEppDjXgsm6AkIQao X-Received: by 2002:a05:6a20:ba9d:b0:b6:1413:fff0 with SMTP id fb29-20020a056a20ba9d00b000b61413fff0mr14674316pzb.50.1673587656843; Thu, 12 Jan 2023 21:27:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673587656; cv=pass; d=google.com; s=arc-20160816; b=InZU5Qzh5BVBehH38Ub3bZIXYFCKxCE9tRHFjBVn+TtPksw3BPJzWWgl9qKlObtNn5 eLf1hKW7aVrmIi2j4blqzJixg+0qN0uk09SriAGETiOPdS22dNz7NfXhfufmqamCQgv3 CgvQ/RKsU8jPyM0fY22+Ola3PKZSH4e5XI+Jlbr224ZDIZvrG801bblOjuk+FRNJURDo Skbd78BS+itLpeOQUd4b2CcaXuyKHjqRCubYHiPcfrEocuMey9+SvDop4lYEdE63VKC4 BE7eI+AgjoeKRmCbzkakrAdXoM4KBXlc0EeupsMFxZjqE8putQz+uAtA1tQxxLcy+YIq BWvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9erekdQ/mftikoOpNdo+ex6T2H+4bLNpiJgAumRNs2s=; b=dsMNi/45ZpwkKTw4/RtL+MWR8ilPlOgFOpLLBhAFcel7wE72xq1zpJh+l5iynCZngf YjR9HPYWD63g9LfEztid3sXEJ53qOsj04THyNZzB9SdieLgz3p5ISwn+KbJFZAetgw1x r1n87G+oBvJgZCF6+Tp8mYSuvOYnsEVSs2bPOYJ0oxClKyufzU7GOAdH2sI3vqzxPUdO q4qhJMTKSsmK0WTUGWF2zLYPOydxB1vTN0OcJCJIR8Ke3kXxYkE7At4zdIIB7M62Tv42 fUOkqMZB6f97g97twzRJgs4S1uRXDhjf3yl2ECOEq3znrtuc3ZFyGlx17YE0/wdkmvzp pYJA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=QgmBo4p+; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020a63fc01000000b00463dbc5cebfsi19735766pgi.67.2023.01.12.21.27.24; Thu, 12 Jan 2023 21:27:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=QgmBo4p+; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236698AbjAMF1E (ORCPT + 99 others); Fri, 13 Jan 2023 00:27:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233587AbjAMF0H (ORCPT ); Fri, 13 Jan 2023 00:26:07 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD474631BE; Thu, 12 Jan 2023 21:25:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7LrVNrdoyUSVWSM2U0GKevEJjW4N1OLImbJ0b1nxIQmb8npVUjNi3Mb7vaBWhyNF732MuQHeLmz5cEOAokJcz5YigTPX31sTvbFl9THxuqrrAGkIVdWcDPVMfrmpxHNRwnlsJrYForOXd1lDG7e+iV6WeOQjstcPQ23xbaT3DAvT+YM0gWx7k/dMqRMMY+O+YfkvO/OFWsCZJFlKnnzxUL5B0ZLX6E5X3vfkyaofu5tvkr+uTO3Z4u7zQQm3JkYkL9bIgZ7kZW/6Wyey2Xm7yjY7vPwk8Iu6yHasclXzhtrUb/usQLW1hZuX2WqVupEp5yTWgiN7B+demTX5WnlWA== 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=9erekdQ/mftikoOpNdo+ex6T2H+4bLNpiJgAumRNs2s=; b=X4O21ij7mcCGSWeyLclj6wNqjct+2OSh2lm8KRlk+J2TDy0LA2ZdLuToEtkRqq2w45LJ2aHUg4W7gHxGNdWk9GkEC76rTzEAqsbERoXdXNif6EPwWkZXKgGJoQ0pv1nLWDL2GhL8caoQ/0hFCz7gyTFIHS74eEqJLHzXIO5R+K6WGtf85A03iM2vL2v3JP3n4kj55Bf6GrMyUHM5Q3EGvWZM/34Qp2JecH97Zpsn2i1QfjyIlrDb5OVmmpPiZEC5C0w1SMElGMbbG5vR8W9BupxUZlY2uhbx/FukCfmuinw9T1WMaoWvyZzUcQP7ITly6NKHPpvGwk9fgsBCin4UXA== 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=9erekdQ/mftikoOpNdo+ex6T2H+4bLNpiJgAumRNs2s=; b=QgmBo4p+0EC4gD9DJX/9FNjCfs/8+iHWMGtwnQBdc/tmDxSie0ZEcVaROAldg+GPdoq1TpIxVmJDpXPKb2sOJ5oai1E56IMl9Rn96pOT+8SCtzOPw11Kef7gzF2LqsSkaO+pWJ43FmE107k+lMxjYuzul8xdahcZphA4y6r59ns= Received: from DM6PR02CA0161.namprd02.prod.outlook.com (2603:10b6:5:332::28) by SN7PR12MB7201.namprd12.prod.outlook.com (2603:10b6:806:2a8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Fri, 13 Jan 2023 05:25:19 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::3a) by DM6PR02CA0161.outlook.office365.com (2603:10b6:5:332::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:25:18 +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 DM6NAM11FT033.mail.protection.outlook.com (10.13.172.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Fri, 13 Jan 2023 05:25:18 +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, 12 Jan 2023 23:25:13 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , , Ananth Narayan , CC: , , , Bagas Sanjaya , , Wyes Karny Subject: [PATCH v2 6/6] Documentation: amd_pstate: Update amd_pstate status sysfs for guided Date: Fri, 13 Jan 2023 05:21:41 +0000 Message-ID: <20230113052141.2874296-7-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113052141.2874296-1-wyes.karny@amd.com> References: <20230113052141.2874296-1-wyes.karny@amd.com> MIME-Version: 1.0 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: DM6NAM11FT033:EE_|SN7PR12MB7201:EE_ X-MS-Office365-Filtering-Correlation-Id: 49e31e33-4492-4387-7543-08daf5268f23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z0zipcBx9K2nb0ivuhMEhYlXRalMLTraQ3DmJEk0JbOMcZYP63gCF9PymManqpk1htxzM4blj0ftX4v2UNGxn3+nDEYm4g6mRl8yIOgIliqQh2mUlvrtUo03KWaTH2hn1gLwi63oWzQ+bbu30cP0eVkJCMi2ebbpjXhNpWiJ5DT0m7xH+wqjh2CB6iHy2N7ZPqlAfbG9QKztjs0g5LfwV3n0jggkfAai4NkJxJvH1pf4MgaMG/d7/Gd5Y2RH/pwZ1xcGvlBCQCuF9tmzfwlMfYzEifZVfbhyzJb9ECSJAdAtGRuFwZX4idGOmrd9uhk4v48s/isV+kJ6dXUQ3fCiyvR26yftwcr9S3gYfOdQYAjyvPKJs1vtMGee1NoSOJTx3QklyICKA6rEnVD9fqCGw468XDeXvxt5qj0r7O4QSkf/+p5spdXQOJ3x0FbPDP9WK/JWhCBsxcHZc5DsAaAooubHM6q9dMEX3Z6AA2UL7mPqP9CiJqDOdqTRBHulZXfaroKyjztwrSL+zsRlYVDTsEY/CIN9o/suvhjJLKFUOkvVtvB04Ecd+9uHkVPutrdLBNIZpE2BUUxwTv0Dpbalpp8etqJxlCVbcNM2hNo6EhmCqP39fvAnpoqpOLnppIquz7VDzjvjd+uKrcKAPrJbTONB4jYV3f//DixQyXJxQmODaa/9zjGOWDd7VBbklPV1+CXam+C3jjHVxC0dJT6nG8KUzboegY97TLNYIjrS9wo= 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)(39860400002)(376002)(346002)(136003)(396003)(451199015)(46966006)(36840700001)(40470700004)(8676002)(70586007)(70206006)(4326008)(316002)(7696005)(356005)(81166007)(110136005)(54906003)(36860700001)(44832011)(15650500001)(426003)(47076005)(186003)(2906002)(5660300002)(6636002)(8936002)(41300700001)(40460700003)(478600001)(40480700001)(83380400001)(86362001)(6666004)(336012)(26005)(82740400003)(16526019)(1076003)(2616005)(82310400005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 05:25:18.4593 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49e31e33-4492-4387-7543-08daf5268f23 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: DM6NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7201 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754883850936360162?= X-GMAIL-MSGID: =?utf-8?q?1754883850936360162?= Update amd_pstate status sysfs for guided mode. Signed-off-by: Wyes Karny --- Documentation/admin-guide/pm/amd-pstate.rst | 29 ++++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 55396981266a..92fa22e45a2b 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -303,13 +303,16 @@ efficiency frequency management method on AMD processors. AMD Pstate Driver Operation Modes ================================= -``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 Performance -Target register and takes into account only the values set to the Minimum requested -performance, Maximum requested performance, and Energy Performance Preference -registers. When Autonomous is disabled, it only considers the Desired Performance Target. +``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode, guided +autonomous (guided) mode and non-autonomous (passive) mode. +Active/passive/guided mode can be chosen by different kernel parameters. In +autonomous mode, platform ignores the desired performance level request and +takes into account only the values set to the Minimum requested performance, +Maximum requested performance and Energy Performance Preference 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. Active Mode ------------ @@ -338,6 +341,15 @@ to the Performance Reduction Tolerance register. Above the nominal performance l processor must provide at least nominal performance requested and go higher if current operating conditions allow. +Guided Mode +----------- + +``amd_pstate=guided`` + +If ``amd_pstate=guided`` is passed to kernel command line option then this mode +is activated. In this 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. User Space Interface in ``sysfs`` ================================= @@ -358,6 +370,9 @@ control its functionality at the system level. They are located in the "passive" The driver is functional and in the ``passive mode`` + "guided" + The driver is functional and in the ``guided mode`` + "disable" The driver is unregistered and not functional now.