From patchwork Thu Jan 19 11:50:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 45709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp286611wrn; Thu, 19 Jan 2023 04:03:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXuf8IQCP8zEwcXEekjxMgdqfELxc5q39iNbVaGZJFr7W9aHWeKykef8zV0rffP4YT5RkXXQ X-Received: by 2002:a17:906:af13:b0:86d:f370:19ab with SMTP id lx19-20020a170906af1300b0086df37019abmr10650655ejb.5.1674129806247; Thu, 19 Jan 2023 04:03:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674129806; cv=pass; d=google.com; s=arc-20160816; b=iCeiOCjKaFTUNSnAqEeqMFSVESgIwSSYS3zg5u7DhgLrOBhsR2O6knlIb07fuf8/k+ YdZg5rNpRZJNe60oyWS9u8o0fVnJgImvPxyDUNHWcXVvmm9pWjQdd0EROFF9JZgDwF5S sRA+kyU3x9kAJYAZ/WlnEKS9Xkq5LuXJSM87aNcuyfGKT2NTSlb+1mwMfqp+dCKbIETc 1n7aq4x/OlVcyp19GR/dvtUIXKsY2SQSXnib0mdK2cY2Nqlq0AKM0JGxHTHL+3dgX3RY Gh6z1FHYYdd3Xke2ZfGMjP0gB5UekiuhBOfdUcnw81b6hBzOMzkvMuIQFhB3gRn8dLdW 7HmQ== 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=UAmu7Y2MS+O8fjWpELf1F2AX3fR9gUXskyFwpXcHx9Y=; b=kNJVOQozbFJsyU5ertX9fZ+60glpwJt6Zrhx2wE9zOWM5+C2bi2B6dWJuikrU5/wAF vwJAJAgo7WhpuVFC4G/c6g0pQKG21YHUTyb1Oat4QUFoo4/TxtG+oH0wth/0rKub1qcn q88enkwbfa6w14BBFq2scjW5APgOLW76AWVXymYruT8Cm78SCxy+Gx0cLW+ArHINHG6M AsIiQ3UySNFX9G+QyUnoKmY/ZltRx3quivifwbW9ER8xaMbvovE/ZmoaBLgKklDSDSYn 6n3wsnfq3Sm2Lg8E6YuAm5OlHyp/n/dhZwbtV/mtT0yFFJvt+ORsF/V5k7xNOKztyyac Vjkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CTOAPsnR; 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 xd9-20020a170907078900b0084cdfa26c19si37988715ejb.841.2023.01.19.04.03.01; Thu, 19 Jan 2023 04:03:26 -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=CTOAPsnR; 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 S229515AbjASLvW (ORCPT + 99 others); Thu, 19 Jan 2023 06:51:22 -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 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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?1755452335623920889?= X-GMAIL-MSGID: =?utf-8?q?1755452335623920889?= 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 support 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 = 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 Thu Jan 19 11:50:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 45705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp286244wrn; Thu, 19 Jan 2023 04:02:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXsIYY/1ks9gnRJm2KhAAgKI+gmBinJNC+NAjHxGZiYHWyNprHP2/OHYan8q29vx1RYV+oK0 X-Received: by 2002:a17:906:ce23:b0:85a:4230:6743 with SMTP id sd3-20020a170906ce2300b0085a42306743mr10383004ejb.23.1674129770924; Thu, 19 Jan 2023 04:02:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674129770; cv=pass; d=google.com; s=arc-20160816; b=YdPEjFNpZy66EJV+0RreJHdeOoLgxbOsL0jhpwdHEpoaC7Gz8mEJ7RdsaXu53Qi0PB sdwu/CsrcZ8FeqDy7+zitiReEQ6NH3AWXdK9FurZddJHqGK1NuQH2UNX6qIt7ZRqxmVE poTrxROmSKsBzNtuEGi5FcULkcUwXCszvBYwjdWxgZA3s8BDxnfBgiaXG+JzcgU/pbUQ +60UL+tglIJLWb+EGqZ0HmPwCr3r8oqXaoIykuyMS/ypnXU+JQ38FyZ8KN6ekfphmhzI 9ep2fcpAlK545NHirOxW4h+KaSPNquBFtyI7MNbwGQb4vkHx3NdOc+I8HRBwjGErR7mt 1GTA== 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=bhVkymXeHoZowm758idB9fs3vqfG/nYfIbxZHkSfneI=; b=bHrowz9EaXo+sQOdH15nogdT9YT/f4DSkkpbbe92zJBcL2C4Rl2yP1UzcqBMeyXbQR e7Dcn32ravv13i4dUhEcpMdoyD1YnNmWQBoGmjbzIu1j/YsDEC2rsq/HgLrF5Voiifnl slfBPYSCcOvuWQr3pDjG9HbtE2WFXYwMfPrNdGpMx235SWB8Ecqck8BgIrM3A7A8Wo++ fg7ov0U3pHwdSiY1zcvJ4sVHGrRLKZOpMAkJkxapzDug/Zsk+WjE89JKvg7odVrEkoH/ ryCQTEg1OMsrwFijRfAjd/v0Rn2nNuRMxrf4mm3ydzyUA/r9ryqVk0T8+eAhgvmvQo7i dtHA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4Z2Mp+x7; 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 ga35-20020a1709070c2300b00871773ad4a3si12801950ejc.817.2023.01.19.04.02.27; Thu, 19 Jan 2023 04:02:50 -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=4Z2Mp+x7; 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 S231127AbjASLwD (ORCPT + 99 others); Thu, 19 Jan 2023 06:52:03 -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 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 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?1755452298353450610?= X-GMAIL-MSGID: =?utf-8?q?1755452298353450610?= 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_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 Thu Jan 19 11:50:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 45707 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp286367wrn; Thu, 19 Jan 2023 04:03:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXuCRzcuYzcDDyn4LY5+fKQR+izNAnl/asBTMhQqs+T+zyBzX1WMWmG4zBfR94Ff9zMw5oHr X-Received: by 2002:a17:906:1e42:b0:7c1:458b:a946 with SMTP id i2-20020a1709061e4200b007c1458ba946mr10388260ejj.0.1674129782494; Thu, 19 Jan 2023 04:03:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674129782; cv=pass; d=google.com; s=arc-20160816; b=R5/eYmmdldbmN6sjJ/2ccFrZtJRfVTi8C4LAoKZNSE/rPn6QkisClyyBCqQfX6/QJI srIXCQYRDunMjB0ZsDl0h6JJaf9Tq0QGJBDScy0FK+8E9Wxfn5QB18hJRw42ouMGQVNZ sPn7VzHmF9d4M0WId3ASkEdbtMspm49TbhUVtre60bKFX1cntkpscqz0DAGnaIxFXqQd GPTIv+1ZzXNXoqxPK3tfY+rLwekoWFJoxgl8GOa/I60WZr8p8UZ+NBpXfrzSSJ5Dw4MZ 9ugLHuQEjwjrtdMmWFkHjzhQaUzJwxJxPt5oL9ihhVbAC6vbUnzQPCBHFPDF3v96mxWY U+qw== 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=wWsJsm/gG9sQiEORfxagttjLjTIjchwoB3h+8doG7vQ=; b=vecyiOPE0uDHbJMCy60lLU8bXyi8YSmnek+oErt8WzXfc3uLW8qIYxhCE3gUXilvUI cAzfyAXtpjWaCpyB9Ez0rAl6yTH2KyNZKheZzqtS8sD6QYanY0Tum9xY7U09gvcnLekl pQZh3q60uxhF0Pr2ZCFnnmCvePqCfnrjD2jovwNCOaulXGBluuYMG+Bw1yaba9wrJ5Jk SEPf1VuMGezGG7Za2MqPrZ0PoqiafrbIIJx/Obzzuc4vXyMdYApU08rlsXo5UzSvXdf1 UiksCT7D8Wy3RG0ST9GFFXUhPWBc9jGTS5wNouswGx9JcgVfL6kwTQ2yUOwUSoAkGHVX XUug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=N9KbFpgU; 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 l16-20020a056402255000b0046197a8b7a1si34566506edb.485.2023.01.19.04.02.37; Thu, 19 Jan 2023 04:03:02 -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=N9KbFpgU; 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 S231143AbjASLwn (ORCPT + 99 others); Thu, 19 Jan 2023 06:52:43 -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 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 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?1755452310766223737?= X-GMAIL-MSGID: =?utf-8?q?1755452310766223737?= 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 | 34 +++++++++++++++---- include/linux/amd-pstate.h | 2 ++ 3 files changed, 40 insertions(+), 11 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 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); - return 0; + if (cppc_state == AMD_PSTATE_ACTIVE) + return 0; + + ret = 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 = cppc_set_auto_sel(cpudata->cpu, + (cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1); + + if (ret) + pr_warn("failed to set auto_sel, ret: %d\n", ret); + + return ret; } DEFINE_STATIC_CALL(amd_pstate_init_perf, pstate_init_perf); @@ -344,12 +359,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 +425,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 +459,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); } @@ -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 == AMD_PSTATE_PASSIVE) + if (cppc_state != AMD_PSTATE_ACTIVE) current_pstate_driver->adjust_perf = 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 == AMD_PSTATE_ACTIVE) current_pstate_driver = &amd_pstate_epp_driver; - if (cppc_state == AMD_PSTATE_PASSIVE) + if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED) current_pstate_driver = &amd_pstate_driver; 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 = 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 Thu Jan 19 11:50:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 45706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp286320wrn; Thu, 19 Jan 2023 04:02:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXtkNnvFk9HLjxsUVcjui8l3NtGcm2+iCSr6Ataf9igHw7kRjcdSuanEjC4SMuH/CLzpAt7x X-Received: by 2002:a17:90b:4a91:b0:229:2a8e:90cf with SMTP id lp17-20020a17090b4a9100b002292a8e90cfmr10773249pjb.26.1674129777584; Thu, 19 Jan 2023 04:02:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674129777; cv=pass; d=google.com; s=arc-20160816; b=bT0NtzvL2tNEMPBSmWvuLAa50OlypmaaKHEPIibU31pHLfC2F6rRyQjylhdKUZ0jIJ m5qR9YRY4EGNVCRZKAxb0/nqtGpuZIvwKSI0MAgweMv+DuUwWRDFrmTdROX+9+khx28i kgzp8jP1Qq6ThHDUoV/R/rKKVWcvVCxS3t3mm0d21UmWwbqF1ZD/xm9cBNLKrHe96wIW VASoQ4m/wdUFl8h/VtRGZEzrOgbH4Z6sdbQvwGuzAXU485qHZyrdgHaQk3gWpu0Y4/VD NcvKqyAd/xkH+fcSOUvBCDCQ3pcpUpq1Z2t0CDHCLWBHDdilnzBlyIXZjSzN2O8pjqde F9KQ== 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=pSCb9E7hlwVFlUz5E0Q0t2Sq3suv8GG6PLWOYj7pyfw=; b=v/nYBjfEQ3czL1WkSwl3S40AbP8MBBIfoOMq3KbQGKPGSCWIXMKSobatQHyTgGzc9M hymfxeZ0Sko7pWcxh95wrx/DWsX/JYBY6ev42lUteVCGlahQWVoSMvoNAWgzg9lyoB3Y T3G7r1eMDIYAYDGVYYWn3XGIdQPfYVhJ4uzJ0PxBc3qQlS3oMRgISDkiMNZMNYxy/aBj OWxtZoyyGESfEZZXgqkQzo/0OG7notg5IUj2FeyXoLbu6qqmV/yPyRfBOoeLtQEYlT3b fQhnZb3mKmrAd8sjoy7wQaYVA525U4xrAd8YEaDvO+lHivojV5e/ORubDCFjFJ45WyoL uFYQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=aDP4KhLQ; 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 y12-20020a17090a86cc00b00229f907b760si15771pjv.102.2023.01.19.04.02.45; Thu, 19 Jan 2023 04:02:57 -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=aDP4KhLQ; 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 S231153AbjASLx3 (ORCPT + 99 others); Thu, 19 Jan 2023 06:53:29 -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 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 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?1755452305706959351?= X-GMAIL-MSGID: =?utf-8?q?1755452305706959351?= 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 Thu Jan 19 11:50:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 45710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp286695wrn; Thu, 19 Jan 2023 04:03:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXs2DQLkzrMpJSSaRFEyWp0vdMLqf+DYNsFs1dZ3+ouDD6eL16wkXGyarzpeguXA9+QXk5ff X-Received: by 2002:a17:906:edc9:b0:870:2f70:c63e with SMTP id sb9-20020a170906edc900b008702f70c63emr11052248ejb.18.1674129814370; Thu, 19 Jan 2023 04:03:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674129814; cv=pass; d=google.com; s=arc-20160816; b=mcgNoPdFBgFkJH47IPvpFecrkYDdqBTyrnuJg9mtTWaxUJ0FKVrQ8zlV0KoyDurZbp nqCnXAN5TN0kFEPjh8Vu6KaYQW5p8uiHPMoor/Y4UGhQAlioE/5qVVQMXZy7yqbTwOde gKyfl3YjwBoBzZKdpGgn5K0COqGq+yIw6CKT1/Eb1eyIBYebuetw9ao2m8TyE5k4Ms1C aCzqMupYthDBbKWe52ItUU6+k0gmD8hGXtMgj+Sy8XsOmU1moJRub7OS8nS4P3K9RNXJ gYjGXs6QxUXVPglsuKx44pwVpmoCD92AUqf5gB/jcRXZWywgJ4AFdaPGWJaa3/fHYYV2 EhKQ== 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=ySkUoIANDrWEcEwIJ3J40AhyqLHlwikYn2xI1eJyKNE=; b=R1skySSMdwwwXkCeSJVTnPz0YaYgQIOjC78Ex4m5PXKv6tS4qMqXXIWFrKAhXZaAHp PMvBYrAWtTXZ97+G0g/9I/3FqIQl3G2TFU79oI18UUn7N63Tuzi5ThoDFqt0AWxUgsRo dusWXHFhXOuec8pHUPjXWT3s1vQyVVK4ZWcTebj26vVkbJa28tJGdjNKq/xzIpjcvNzu FjLqtW31in4rAF/0dl+FOp3hZ6ps99+Q/F/o1wJbuCX0L3j8yfR723icJOFff/aQJjLI Og05IsV13HxvxzvJw4E7BwWegIW/LED1Spdb35SplgCB8y9qpJiz97KlnkO5d0x1NrBo +F2Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=R4sBAR0A; 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 sb18-20020a1709076d9200b0087118b6b618si13527882ejc.338.2023.01.19.04.03.07; Thu, 19 Jan 2023 04:03:34 -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=R4sBAR0A; 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 S230516AbjASLyR (ORCPT + 99 others); Thu, 19 Jan 2023 06:54:17 -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 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 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?1755452344371423087?= X-GMAIL-MSGID: =?utf-8?q?1755452344371423087?= 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 = 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; @@ -797,6 +799,105 @@ static ssize_t show_energy_performance_preference( return sysfs_emit(buf, "%s\n", energy_perf_strings[preference]); } +static void amd_pstate_driver_cleanup(void) +{ + amd_pstate_enable(false); + cppc_state = AMD_PSTATE_DISABLE; + current_pstate_driver = NULL; +} + +static int amd_pstate_register_driver(int mode) +{ + int ret; + + if (mode == AMD_PSTATE_PASSIVE || mode == AMD_PSTATE_GUIDED) + current_pstate_driver = &amd_pstate_driver; + else if (mode == AMD_PSTATE_ACTIVE) + current_pstate_driver = &amd_pstate_epp_driver; + else + return -EINVAL; + + cppc_state = mode; + ret = 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 = 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 = 0; + + cppc_state = mode; + + if (boot_cpu_has(X86_FEATURE_CPPC) || cppc_state == AMD_PSTATE_ACTIVE) + return 0; + + for_each_present_cpu(cpu) { + cppc_set_auto_sel(cpu, (cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1); + } + + return 0; +} + +static int amd_pstate_change_driver_mode(int mode) +{ + int 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_mode_without_dvr_change, + }, + [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_mode_without_dvr_change, + [AMD_PSTATE_ACTIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_GUIDED] = 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]); } -static void amd_pstate_driver_cleanup(void) -{ - current_pstate_driver = NULL; -} - static int amd_pstate_update_status(const char *buf, size_t size) { - int ret; int mode_idx; - if (size > 7 || size < 6) + if (size > strlen("passive") || size < strlen("active")) return -EINVAL; - mode_idx = get_mode_idx_from_str(buf, size); - switch(mode_idx) { - case AMD_PSTATE_DISABLE: - if (!current_pstate_driver) - return -EINVAL; - if (cppc_state == AMD_PSTATE_ACTIVE) - return -EBUSY; - ret = cpufreq_unregister_driver(current_pstate_driver); - amd_pstate_driver_cleanup(); - break; - case AMD_PSTATE_PASSIVE: - if (current_pstate_driver) { - if (current_pstate_driver == &amd_pstate_driver) - return 0; - cpufreq_unregister_driver(current_pstate_driver); - cppc_state = AMD_PSTATE_PASSIVE; - current_pstate_driver = &amd_pstate_driver; - } + mode_idx = get_mode_idx_from_str(buf, size); - ret = cpufreq_register_driver(current_pstate_driver); - break; - case AMD_PSTATE_ACTIVE: - if (current_pstate_driver) { - if (current_pstate_driver == &amd_pstate_epp_driver) - return 0; - cpufreq_unregister_driver(current_pstate_driver); - current_pstate_driver = &amd_pstate_epp_driver; - cppc_state = AMD_PSTATE_ACTIVE; - } + if (mode_idx < 0 || mode_idx >= AMD_PSTATE_MAX) + return -EINVAL; - ret = cpufreq_register_driver(current_pstate_driver); - break; - default: - ret = -EINVAL; - break; - } + if (mode_state_machine[cppc_state][mode_idx]) + return mode_state_machine[cppc_state][mode_idx](mode_idx); - return ret; + return -EBUSY; } static ssize_t show_status(struct kobject *kobj, From patchwork Thu Jan 19 11:50:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 45708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp286573wrn; Thu, 19 Jan 2023 04:03:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXsV/6KjGFlpOb0opb19MxyjjGHXmnB/5NCXbkNhlfoNQoETU5K2DR8Smf7ckBD5ME3SKsOT X-Received: by 2002:a05:6a20:8c04:b0:b8:42b0:1214 with SMTP id j4-20020a056a208c0400b000b842b01214mr10180166pzh.32.1674129801928; Thu, 19 Jan 2023 04:03:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674129801; cv=pass; d=google.com; s=arc-20160816; b=WVw/2KUUw79x0MLi2yvjNEn98vexwjLZLRuCXZxBnuS230C80VC0Fe+kWEx8ee8aqs ZAjp93+Es7xQWNzt2ccv/qXleFMI5QPClplVnOtRuSn29RuihWCFt+ymEeUEW9tvgM7r NvRuVocOQZFbwcsGKwfpoOGXzby2KaeakGAiy3tqhRqE+HtXnBs8ESQX2C1lByCDXt8B BGAMPNhLmbUTIhDYW0yOaf0cIQK4k4GAWrojL5wgkmpN34AlnkYXzB+Ha0R8T4Ip8OPI mca4WwoJXvbEfhxQ5xaYVnvX1PMzOmhjrJenlvUBX1VEtqOJ6ixQgava8R2MGKT7DsMD FoZA== 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=e2+bi/RLp60NJfFTa706oIDyFewKZo3lNCtGPoDlh+w=; b=CIRKr3wXfKWbhgZJCS1B+tHSD6xO2gFLUrZUaZ53i0sUcv5YN3KWj332Fm68WIYvTZ MIcbLb5+B+1TQAm0YkKomFY8OYXTI9Tc0uh6BBwLjsSSLbe3P9voOxnGDtl2FenZdify A14MSfOFbsAoNhQ9kBSr3d4rSllQBq2lY0v1Pq468ul1WaHC2GpC090JXVGQ8sxAeHUu LDvKplVm35dj5oGjoSjyNBjtu0UXyHMeXmzvdAkLyumR1ddC+DYogSwMAcSa5mul/DAz o2CY0pwRdu1Z6dmbq+nBMR0QX4HwfXEz5hQNtiuaNLlB/yIYSQEtRu0q0+KSY1HLElFO Xdyw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ARfAczN+; 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 k190-20020a6324c7000000b004d2621d6a70si721042pgk.163.2023.01.19.04.03.09; Thu, 19 Jan 2023 04:03:21 -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=ARfAczN+; 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 S231200AbjASLy3 (ORCPT + 99 others); Thu, 19 Jan 2023 06:54:29 -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 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 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?1755452331348629851?= X-GMAIL-MSGID: =?utf-8?q?1755452331348629851?= 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/admin-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 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, +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 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 +344,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 +373,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.