From patchwork Tue Jan 31 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: 649125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 638D5C636CD for ; Tue, 31 Jan 2023 05:23:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjAaFXY (ORCPT ); Tue, 31 Jan 2023 00:23:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbjAaFXW (ORCPT ); Tue, 31 Jan 2023 00:23:22 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2064.outbound.protection.outlook.com [40.107.92.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2529AEC6E; Mon, 30 Jan 2023 21:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jv8W53d3hDq22aWcmQgYafAYpD5c7YkOLuYNZLCmZOWYxXDHGQ+YTywAwVqYei5o8H4Vq54SyI8cq+Ljoea4CHQwyeqAQRu3/7O/AlgTLb0Lpst6cKHWkk7iVLnC7pxj1AGkJL41qsDw4eGDOPbX7TFnci0BOG4I7WO7S5l1Rx1oJ3XAc2r3GxE7Vq1nRiljEJm27YnUWYzO8nDHFtm6+ek8MFywymXm6F83nSVQeVP9G/yPy3z66R2+18XKQubgsYm1Bm18GdDSxDahmG0EHHxzK7rd4PL6utrF3LNvsRgrXArM0FSzkRW7o/4ABlw06ImSLylD4VUR3t6V89XDeg== 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=82aGwNYippQcfrJSwAkDqSbcGKrbCFCBCOh5PrQN9Dg=; b=DkyDCtCRkFG9CI6EqeSkCJ1OttNQjVZTEBZLLJZOQR+t4nz9OkNgUyDd2Y2vUKpbxEgNksfYvCSR3kx8JSEWFOXpmG47Xpk4syUl6fBknhbI3KFRvscX4MOyUUzgSQTq7hzMZbddq4g6gtRpFDj9IvpstBAABvYLcpDY22v09OeVKCuc/R3Oo5TYL1PmF+Jb6tSfR183BZUDQPV/2MTOkFYtOQv8pdzB/7NevV2WlhH/AF60KrEL/7ItRRacIM30wIc6LlxFEtrYhnHX+qpS8F7AxgzpD8Tl87RKb+ATxW0fSWM6DKqYefPN8Qi3eUl+lzm4YBTu29c0O1E5AxQc9Q== 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=82aGwNYippQcfrJSwAkDqSbcGKrbCFCBCOh5PrQN9Dg=; b=MGcxQO2vQKF0n+zd5yF/ivFGTana88NqdwnMLvMgAk9283rWakuTHA3+VOoUqfHHYAsISF5nzO7aDKcvu2hwJBSWmp/+1/O12PM0wytHKjvxTORrwTFU2J1iNw2oNMs0m4XtcWzhHdE8fJlmAuPg0jWnZkZbLybYk5YRgphLhho= Received: from DS7PR07CA0001.namprd07.prod.outlook.com (2603:10b6:5:3af::10) by SN7PR12MB7936.namprd12.prod.outlook.com (2603:10b6:806:347::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Tue, 31 Jan 2023 05:23:09 +0000 Received: from DM6NAM11FT111.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::10) by DS7PR07CA0001.outlook.office365.com (2603:10b6:5:3af::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38 via Frontend Transport; Tue, 31 Jan 2023 05:23:08 +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 DM6NAM11FT111.mail.protection.outlook.com (10.13.173.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.38 via Frontend Transport; Tue, 31 Jan 2023 05:23:08 +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; Mon, 30 Jan 2023 23:23:03 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Wyes Karny , Mario Limonciello Subject: [PATCH v4 2/6] acpi: cppc: Add auto select register read/write support Date: Tue, 31 Jan 2023 05:21:37 +0000 Message-ID: <20230131052141.96475-3-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230131052141.96475-1-wyes.karny@amd.com> References: <20230131052141.96475-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: DM6NAM11FT111:EE_|SN7PR12MB7936:EE_ X-MS-Office365-Filtering-Correlation-Id: aa2921ee-1476-439f-9592-08db034b3d4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B5LDsw2hqUJnx2LnVLHRT0MayVbY5ObtcQ+TtPY0XHYdvbAD3hrcerogvta1ucyos+Qhops+0xhSEvXk8ieBfKAaVVOiVjDtDI1sBr/XkkNCwQNHYwdX/HADwxVLNk4REZsTEr7/tD6+4/SvT8SZlrHQsfvfQWdNeYuyH4M34XcCeOGq5Uw0hCw8/gpusgG7PbujUH4p52Z8chkqH5HVDfWnvY1eyFiBZNY6RkBhgaH9FXr36UvNyUbqZScWVejR2z9rqbWHVpMgMP/nfHBjHdCqRXd9lIXaPlnQGbWbp685fB9Nvn9U10t590fxuegZUvZS2g9EYvX7pel/NqO00JQlhIYPxNxP9rfKwfElUcmBWwfZc1zohNRDEs11l/qXOG/dMiwkKyIuGFM6pLS2RslTNfv/YpEpixww+I0gscCVptF0rk/86lgw2079GUw8VyIS85JNQhoCgPFS9K42NFlYaQYrruaUvJhed+grVxjStxsHDmUltAnjWKn32Yxg0BFrET8n6OjfJVUpmgk0fvI8Xhz81eMDRDX+s9+lIwX6035k2XUYXsg+aqAVymPST94CDdIhorwdE/c8EqQ9/iR/Mh8h87l1pLrsFi9TZhw4zgau5clZJR+E+aZFqus3Hrry2qs5a4GusiOGZdGHqmuXkL00GmSlQo0DyQhNPBNgRAgjnKnqd2IYjFCc4s+xQf8TTKpXiCcNwd6TF9Yugg9k6TmRd6yV6XPUZ6GBW5Y= 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:(13230025)(4636009)(376002)(136003)(396003)(346002)(39860400002)(451199018)(40470700004)(46966006)(36840700001)(86362001)(356005)(82310400005)(2906002)(36756003)(110136005)(7696005)(41300700001)(7416002)(6666004)(54906003)(478600001)(44832011)(40480700001)(8936002)(5660300002)(186003)(2616005)(70206006)(70586007)(316002)(40460700003)(81166007)(26005)(83380400001)(36860700001)(82740400003)(16526019)(1076003)(426003)(336012)(47076005)(8676002)(4326008)(6636002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2023 05:23:08.8133 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa2921ee-1476-439f-9592-08db034b3d4c 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: DM6NAM11FT111.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7936 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 91f9ef75f7de..1806006a51af 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 Tue Jan 31 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: 649124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97F41C636CD for ; Tue, 31 Jan 2023 05:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbjAaFY4 (ORCPT ); Tue, 31 Jan 2023 00:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjAaFYs (ORCPT ); Tue, 31 Jan 2023 00:24:48 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2072.outbound.protection.outlook.com [40.107.243.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4D1F3B3F9; Mon, 30 Jan 2023 21:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CF1itaDT1tWJpMXtSngtoiHu0GkXjg/OmeglBQbd7uJzuLewaxCOzyfDNNEGlfdtnTA1NNadvR47Vk168QmpC804Cv5a+bTVG0k7e9wX8Uu9E+Sw2TQZ7jITSTmmkzBCW+MwwcK2+a/puuPMqLua83vMNltVCKHx6r3ydai3AUrVjBkg0PAvLX+uugxZ8+rzwYtyboCZkrMqFVbZIRxZABzCmaw+SAoqejYu4X74iiR8Voh6d9fHzzHZeSTPSPWd+SImsipXY+dsodzbWJqK2gbPaLItwN6kfqhrWLYYWqaCJ0/CBrFdfNDRODXnT2OtT3r5tXgBYuBZDTrB6W5wVA== 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=lunItLAoj6khvCHnECJe6+1pgpEO10VtlhO4FJeQMcfLVJq368EU95r7HAlOSU9WLOx1YW7j2AYIKdJPO4ipUXBIh3ZF1r9TcAJWGZQIkIlO0lG2kCGeqGueEpIge0TRopm/C1HVjhs7NM1X0WmOT2mB8TP8eAqj1vj7bkdgIhlvrNsu5+vUgBs3D7cyMX0tSOVTLlmUGWQW0YgrGusH/Zd6yo66KF2WlVIw9005uX+XODfa4Yb5yf8iJptJMQde1ocIRGUyro+QBlR7DjZpUIW67ZFIBU8b6oT6cun/8iHX5yt+8YBec/yQK3qLjTedroJ2pEi1CvzVXMKtyyNHIQ== 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=t2JSJhZh+hWKyxGalZFCc06LjpdQj66hSzp3Jg+MaDlf15YK5v5ISe98UzUi7sSOpz2gcj+D/0kUghCzdhSItgOJloA9cv9Q7zpvNWRbL1LzmPgx6YIyVDk82aPkRmNXwV2JJhfunw2/504IW/XNPqFDoJbbXJDRTF6fWifkpB4= Received: from DM6PR21CA0018.namprd21.prod.outlook.com (2603:10b6:5:174::28) by MN0PR12MB6176.namprd12.prod.outlook.com (2603:10b6:208:3c3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Tue, 31 Jan 2023 05:24:24 +0000 Received: from DM6NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:5:174:cafe::66) by DM6PR21CA0018.outlook.office365.com (2603:10b6:5:174::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.4 via Frontend Transport; Tue, 31 Jan 2023 05:24:24 +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 DM6NAM11FT021.mail.protection.outlook.com (10.13.173.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.22 via Frontend Transport; Tue, 31 Jan 2023 05:24:24 +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; Mon, 30 Jan 2023 23:24:18 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Wyes Karny , Mario Limonciello Subject: [PATCH v4 4/6] Documentation: amd_pstate: Move amd_pstate param to alphabetical order Date: Tue, 31 Jan 2023 05:21:39 +0000 Message-ID: <20230131052141.96475-5-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230131052141.96475-1-wyes.karny@amd.com> References: <20230131052141.96475-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: DM6NAM11FT021:EE_|MN0PR12MB6176:EE_ X-MS-Office365-Filtering-Correlation-Id: 71010477-6942-45e4-3c7e-08db034b6a43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o4Eq8Fay4llq20Wtvq5XhJgAvasmjuaRU+smYZWJxwa4MJEW3hvstoGcmfKLxe6UY1J5taINs7GB6W3FhnGm1bx2HLMQRY11qg+A73qnsUvFucdrqnar1AngX3y5Hd0/3e8IRtIZWSpBaeBFbELYOUuCYHtwIf1CbMH4KohNH76W7eDyAB7w6CF/zLJvVdQbP0jY14K+lLt+9H4wFbBLPO8h+pvzWjW8AzuazRI+/7aZes3PynU3ov1PkPENZTCeOzDbriusnzQgEOdHkiqBkoHLPJblUH1OzOq+3nJhiXFZEFLRFlnMsyiLJnRmbn8H0EI37lEuJfLc3HcPWdVcqxKaYUM/5xYnp7goZBP6pIojA6/ZcRowHBCWsgceeFt6hNJMAkzfcEPEWLwwWdfUDV7Y8BYgp9ErdP2J+5MaD1uR+EszRaZeFMEGvBQ5egRRuCweKdQI9BVETWOsLyUkUPUgq7+0OeEemYh5YGiaBdmTOJZA3uVlRBakFbzhYBsUAKFSJxoYo+1g30i94BXJi7VEWbp/Q/eVoxDZPmeS1meDk0uG0Cr2Gx6tw1uqAAOVzkEN5wOcare52eDn5wBsd266O0CDYSK9xSB2kdxv3JlsH4iwW6OO9Cd3LrednAAQydALReMHp3RTQGvyuyJjdwWN3arJWgRkri/V2vYEcabh91PSlT/qqENW3JtJ06i9XMAV6wLGtQ+9EFNE9H+lcM88y48uTUMtZ1/yFe2GCy0= 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:(13230025)(4636009)(346002)(376002)(39860400002)(396003)(136003)(451199018)(40470700004)(46966006)(36840700001)(47076005)(7696005)(8676002)(70206006)(4326008)(36860700001)(41300700001)(70586007)(8936002)(336012)(83380400001)(426003)(478600001)(86362001)(2906002)(316002)(6666004)(40480700001)(82740400003)(82310400005)(1076003)(81166007)(6636002)(5660300002)(16526019)(186003)(44832011)(356005)(26005)(7416002)(36756003)(110136005)(40460700003)(54906003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2023 05:24:24.2497 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71010477-6942-45e4-3c7e-08db034b6a43 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: DM6NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6176 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 Tue Jan 31 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: 649123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2321C38142 for ; Tue, 31 Jan 2023 05:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230295AbjAaF0O (ORCPT ); Tue, 31 Jan 2023 00:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbjAaF0J (ORCPT ); Tue, 31 Jan 2023 00:26:09 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2060.outbound.protection.outlook.com [40.107.223.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 563EB3646B; Mon, 30 Jan 2023 21:26:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nK5EIGsfdsh2E/L4qPIqK0FwP+AKFjSE6a5N0bSFoNMTomtvWfI+d0mAGmhIZcId9Zp4LMu+UG20TzqoRtF0lNvs69SWyKhpYpAeag9kvsf+duRM1q9Jw63xTe/dOz4PerJ6L5ZwE1lDvSe2DAEX6cTnLQ1QPbGlzFz28BXtNgTsm+XtVLSA6SRTI87ekPdS6gEt7eZbHuB8qAcWJso7M8VlE2bjcsQAKujmmyfTuRbTHpCVwRKbeWwZ8XVSGZX1zXMW8eVX7mN7/WWzKsAfBC8+dz3jjVsQZSLmpSC+zaJt259OQEurX3LWU7YabGBlz5n3EjUTiw6u3Uw5AzeloA== 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=soJKWscNntUtGILPE7LnMJipVFI6FVSiNDMc4q/beTk=; b=Nr+dM1J2sGaP+soFWNtzp+/yo9wEZxTWDj/IfT03wExXOMM88aOLTpc0dxPiZk6nAiuRbZuWFBf6HeERxfEajjJcJI9GK8tUR3WIxejL1NBPD9t5HMQ/ke+QrvzKasArNMPpgZxdSH6ipoTNTHT6rScDFKeVE0p4Lr8ByisCK5C+oXOanKyPkfVJJZ6B+LT3aBPnVT3pwMXyI2dEt+MBtr8OIOwnybXcCzvnWrsLkXeX8e7sZ1ndQ4io1s2U/STyDhMcS4ebzhvvqBREzoqesSWPNDRF3G3s2SMs7z8fR/qzQhpQbCMYoPM64r2w3IWzIENG2I2m6QuyApg/NCTHNA== 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=soJKWscNntUtGILPE7LnMJipVFI6FVSiNDMc4q/beTk=; b=j53OdXrPQgldr6GIr+AzYAUtm+j6frDuC/at9+LIKKeHRJ2cyWm9i9m4v9gsk4H8WKSFaAOYG9123pGpDJhr1c3vCq6DFHD9PGJmyvFpLq8azgrZi9d/SWLGMJhBsy3OlcYx2NsiZ0zQy+0ql6Rtu1cLPc9ZMa6BVmDBJ3uLI1I= Received: from DM6PR02CA0123.namprd02.prod.outlook.com (2603:10b6:5:1b4::25) by IA1PR12MB6308.namprd12.prod.outlook.com (2603:10b6:208:3e4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Tue, 31 Jan 2023 05:26:06 +0000 Received: from DM6NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::2d) by DM6PR02CA0123.outlook.office365.com (2603:10b6:5:1b4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38 via Frontend Transport; Tue, 31 Jan 2023 05:26:06 +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 DM6NAM11FT003.mail.protection.outlook.com (10.13.173.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.30 via Frontend Transport; Tue, 31 Jan 2023 05:26: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; Mon, 30 Jan 2023 23:25:09 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Wyes Karny Subject: [PATCH v4 6/6] Documentation: amd_pstate: Update amd_pstate status sysfs for guided Date: Tue, 31 Jan 2023 05:21:41 +0000 Message-ID: <20230131052141.96475-7-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230131052141.96475-1-wyes.karny@amd.com> References: <20230131052141.96475-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: DM6NAM11FT003:EE_|IA1PR12MB6308:EE_ X-MS-Office365-Filtering-Correlation-Id: 42be5acc-4bb2-4d0e-890a-08db034ba6b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q4tIpauU7JZZJbRukX/39viEJ7tFsP+7ss7cL37FJKVV19EDIw5nt2vz/knoY+kuln3EhI6891W9JVt8NWIcsev4Bz8SF3VsiFs7bIKxmf5aFZ6FZR66Ggct1HKGScsvuceBqQaNGVQ8zWVo+xy2YSWQxyS+a/RLBUNXScuyYxUQ/FwUxmKUGEnQcIQnyZVz6mhH+FFl9mzBJsqcTgk4TFBJ/EEQtaNIaBE1osQY5mxAEbqbaenJWLhhIqfPzDZveGPafbU1kp4X9LCZ6QEIaxyApO8Fk98nMk9Km74cxxQopDf450py9+ObMNGGKyGBs/O52iKxxPMMuQrKfRgc2j/4cAR9m0KOxHy+BdE4U+xBKdoszpgwAFtFGOt84xqL6GetQv0w1YxnuMWhLwTCPT9i+H9xLIgCq0X7b6CTqIT45Ob2jfRBREtiElf8uH8wKvgmgDlLyJdADBlNxaygWVkDP3ikNuTHgZd7jtR+HZcBSzn8yJEqyAUM8ctmdbg9eqyM5epPYg/GQCvfT5dF+QbfRCn5spxcl9m7l0U2WpgzIshMD9Dfp2A8QNgmWLFp/msxL0jxhXLUVGVyTHXT4YBPKEOOgYXWG5cigJibDOUTzwps/EkoaFc/pzr9+/bqxlS3VZ+hcCjvsyFWTUpIjNY2Cp8RN9pZnZJYEkgf6Sk8hfjXLHkIXljfjO1ogw/qLzpzCpjyFtPB0syzuLJxtZgh9SFtcU5XYJ2M41m7SpI= 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:(13230025)(4636009)(396003)(376002)(136003)(346002)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(40460700003)(316002)(110136005)(54906003)(83380400001)(70586007)(8936002)(41300700001)(70206006)(4326008)(47076005)(1076003)(6666004)(8676002)(478600001)(186003)(336012)(26005)(16526019)(2616005)(7696005)(356005)(6636002)(426003)(82310400005)(81166007)(40480700001)(36860700001)(5660300002)(7416002)(36756003)(15650500001)(44832011)(2906002)(86362001)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2023 05:26:05.6490 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42be5acc-4bb2-4d0e-890a-08db034ba6b3 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: DM6NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6308 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Update amd_pstate status sysfs for guided mode. Signed-off-by: Wyes Karny --- Documentation/admin-guide/pm/amd-pstate.rst | 31 ++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 5304adf2fc2f..56a3d11f51a5 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -303,13 +303,18 @@ 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, maximum 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 +343,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 +372,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.