From patchwork Wed Dec 7 15:46:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 632828 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 DEF95C4708E for ; Wed, 7 Dec 2022 15:48:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229576AbiLGPsv (ORCPT ); Wed, 7 Dec 2022 10:48:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbiLGPsu (ORCPT ); Wed, 7 Dec 2022 10:48:50 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2084.outbound.protection.outlook.com [40.107.237.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 116C924951; Wed, 7 Dec 2022 07:48:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cJQ58hUq/+1/pxI7ErCcqkE927hd5FX0Ml33ngNiN87UDTeiFjbdWhQJ2uYZ8NGP7Fed471036pWonAjPXqomk5h/MK1Kwdm20NqMBJvTTa54rGyXcvoGTyqjGZGzmoK4JvlJ6bl/HQF23U+vhe13OU66GKZYV1H8bc05XF5JatKeWiRtfZFR6NAAxLTLfvmy8pjxwcEwNxqdBdlNcOwo8GNKGMr9Q5U8KjgeFj1rVVZQjvrPH9OYihUO0TDocX9uPtSeD6f12cLuU+weMmkDPJjJebPNzWy302vbs5c2JPxnZTIA1lpcVXkuot2Q84bqvjYu3cFsQ4HfvDZc4NrAQ== 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=eLcjDIeSEGypdO8KnNGuif8V4VRy6SJ9CgWUnp/jg/4=; b=n6H+JmS8mRObsBj57t40exPEeTA4pIVx3MQg3r5jcqhshwwhx52bQEGwaKg16zVo48gY9TYEpSDZSDwDJ2Bj5Gwgx0kRqEQXH6QRsoUZOV/gS+ajePBocfWkXDWuF72UAcry+8YWxnd14BltIQ9f/ZvMwRq0wtRQ5u9kEwOAmecniuSiSQES5J+kMngtsbsefATZx5c+MHTLQ++UGTrfgqnxjyBkgwAMdbdDktdTmT0OM4l9SuHASNO0Ql/1cqwU28vt/QgDczsZXMyDbl/oxmH6Yor7rBsXU9eSXqUm37lHMY6QT3zG4BG9UEYtXMNdkYSGuERkor6vVONFmamPug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.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=eLcjDIeSEGypdO8KnNGuif8V4VRy6SJ9CgWUnp/jg/4=; b=f+ih5tvv3eUK6HCr4a7EcF36N5vP5Uec2fwNtFKtOh5oxA/M1NO02XmkPX9B5Yii4mf/oZiTPKkJXvhNNTe6Rvv7zM7GGk69BR6USUIGFjj6HTpZcUJn9NdkFh/1Is45RFflQ+SXLiFb3OZaD9CKNzVB4zDHFwEcgYXxrM1hg8E= Received: from BN9PR03CA0630.namprd03.prod.outlook.com (2603:10b6:408:106::35) by CY8PR12MB7195.namprd12.prod.outlook.com (2603:10b6:930:59::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Wed, 7 Dec 2022 15:48:44 +0000 Received: from BN8NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::f8) by BN9PR03CA0630.outlook.office365.com (2603:10b6:408:106::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14 via Frontend Transport; Wed, 7 Dec 2022 15:48:44 +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 BN8NAM11FT059.mail.protection.outlook.com (10.13.177.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5901.16 via Frontend Transport; Wed, 7 Dec 2022 15:48:44 +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; Wed, 7 Dec 2022 09:48:40 -0600 From: Wyes Karny To: , , CC: Jonathan Corbet , Huang Rui , "Rafael J . Wysocki" , Viresh Kumar , , , Ananth Narayan , , Wyes Karny Subject: [PATCH 2/4] Documentation: amd_pstate: Move amd_pstate param to alphabetical order Date: Wed, 7 Dec 2022 15:46:46 +0000 Message-ID: <20221207154648.233759-3-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207154648.233759-1-wyes.karny@amd.com> References: <20221207154648.233759-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: BN8NAM11FT059:EE_|CY8PR12MB7195:EE_ X-MS-Office365-Filtering-Correlation-Id: d8984a30-00ce-46c4-1fba-08dad86a8578 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mDQqxwG6zV78pDDR6l9li95NUW38E7v9Nhvh20ntmCvYP2fcZwJu33RsJ6bMMdDO0QtLQVeJBoiLi2cVP3rRS/hlXo7aH9xe2AT03WXsBa004akPGClZZMasayQPQogna2PzgYAieBZefjJGI3idN4N2+JaiSgED6tgknOiDfGuV4NpKcvflADKG9/MYTdUDWKZPimazSfaArU7my+LwNQrEUv3ckAcbsHjeyBzqdQsAeJ5jDSsuaqgvtLwt9GgCWAybG/fIVBbxn/CUY5PPflYK+EwSKB2MRFOxoNf/lEOsXYeqzcKfkKf1cn2j4niKGX2W4A7eS0qz/grjdnfZuVBnpAn5RQ2ExPUrI+6ylK8ZvddWniRQA5u3pnGaGOedH9GazS+97iiw7mZJWIgNPjkRBIGpSlGXNZT6Duai9teduJjI38k6Xx3VVG5LJdjQZJYSCdxZsVK7XBezK1diXrLDdrzAJygJAVD8yUA2ESZpoEZdNQLSlK/KrAj296k14CIRZEUdZWQZRmbmwgc+EoGIlZQpG5+Iv0BMHQfdtSaeTiEJncqTPdYySO+OZfJSStfJSoQnLzHN2lstx935Dy/k2ncnenER6ZBLrKabJmC2ei/O4O1gtEC2kBcipx38jr/XEWicA12PjwyqSI6AO9YGsVsgIhW97d96ZO5GCOetGuWEc2IUZMxvonnVOSSO7coBtGYhGXNtdXxW8utNqS0WPTth0FQ/aPSKmp6j0+s= 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)(376002)(136003)(396003)(451199015)(46966006)(40470700004)(36840700001)(316002)(44832011)(110136005)(82740400003)(86362001)(41300700001)(356005)(54906003)(70586007)(70206006)(82310400005)(47076005)(5660300002)(4326008)(36756003)(8676002)(8936002)(426003)(83380400001)(186003)(1076003)(81166007)(2616005)(336012)(16526019)(40460700003)(36860700001)(26005)(7696005)(40480700001)(478600001)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2022 15:48:44.3409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8984a30-00ce-46c4-1fba-08dad86a8578 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: BN8NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7195 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 --- .../admin-guide/kernel-parameters.txt | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 75e57afba77e..143a38ce27e5 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -339,6 +339,21 @@ 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 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.) + guided + Activate guided autonomous mode. Driver requests minimum + performance and maximum performance and the PMFW autonomously + selects frequencies in this range. + amijoy.map= [HW,JOY] Amiga joystick support Map of devices attached to JOY0DAT and JOY1DAT Format: , @@ -6959,18 +6974,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 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.) - guided - Activate guided autonomous mode. Driver requests minimum - performance and maximum performance and the PMFW autonomously - selects frequencies in this range. From patchwork Wed Dec 7 15:46:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 631809 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 1A39BC63703 for ; Wed, 7 Dec 2022 15:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbiLGPtS (ORCPT ); Wed, 7 Dec 2022 10:49:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiLGPtK (ORCPT ); Wed, 7 Dec 2022 10:49:10 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2089.outbound.protection.outlook.com [40.107.95.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A804263BAE; Wed, 7 Dec 2022 07:49:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fhiD8iP+PAcw7pAAcj0JsrAL2vx1Y04kQl0bYkMJJsvSN+p9BJEyc510Sr6AqLR8R4rBkl/osAQKt4wPKWzG1pz9tpIXEgXOjAwU6yuF/xUV/z2uVE4uhu1pREX3d2ASDaKzbR9UquV790p0yifd2HdazO4H6PGlnwQkaUxkWdtnekbh+rZiXRE55jta7K2YaCtlA7gjaKLCRrFDM4OdESvZmhDBJxaihuXE+a8HG2RaPg5HYuPHOwXfST4gKfWvenomFcCPSq1tsDZNXi7mPE2EemRFJvPno+uQ/UrxHAfO/FosW3buqNaPnhlMcXsoXOL/ZX3OSvYi7W9FgFsZzg== 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=MbU1xFoTsR7cw1bOECIU0HE1PRvSMpX49ZRk/kvkMZM=; b=hmUxvFCHeeJtdhz0RICFR6vuwPHeGzJVUrYHyhBcKEJ39ZJBXkDsV/qBOoEldHRf+Vgd6KHDGe/Ydhqv7uNXsgtACEiXV/bJaKCR+NBBPbRpqqhbnmlFaUGINBfo0TefQU+cb5h15FGW+DPciasWuDthKLHLvkgfFIgXTJoARqPuMZOp8V4XsXTwtBWGGGMxD9q6LAHPNYUtHz3cxxlli4Xf3Z02WuoWwxZrngO+3QZLwxkda8lbUYhpPwOZ6J2Izv134dE2reTvlQh9pvWgrvcpGuKOKSMKWUB1o2UNeRPowSTQJhz0USi9eQAxu00q3hjl5aVBnq0h9T6COLffnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.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=MbU1xFoTsR7cw1bOECIU0HE1PRvSMpX49ZRk/kvkMZM=; b=jvc/4wULUUJhExjrFelUU567Ams6cWI4qQN17GcG0ce8RyKBMH5eZUaogLZy2iPdcd46Grq/9RtCX/KRFXAoJG1geB4hDDe5aWuat0j/rhRnzPvcVfnrmFkcMLTaPpm50YSW1IcZcQ7glGec6PrOKFHMAF4JpJS25F2aq2S4CTY= Received: from BN9PR03CA0251.namprd03.prod.outlook.com (2603:10b6:408:ff::16) by DS7PR12MB8345.namprd12.prod.outlook.com (2603:10b6:8:e5::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Wed, 7 Dec 2022 15:49:08 +0000 Received: from BN8NAM11FT088.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ff:cafe::dd) by BN9PR03CA0251.outlook.office365.com (2603:10b6:408:ff::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14 via Frontend Transport; Wed, 7 Dec 2022 15:49: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 BN8NAM11FT088.mail.protection.outlook.com (10.13.177.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5901.16 via Frontend Transport; Wed, 7 Dec 2022 15:49: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; Wed, 7 Dec 2022 09:49:03 -0600 From: Wyes Karny To: , , CC: Jonathan Corbet , Huang Rui , "Rafael J . Wysocki" , Viresh Kumar , , , Ananth Narayan , , Wyes Karny Subject: [PATCH 3/4] cpufreq: amd_pstate: Expose sysfs interface to control state Date: Wed, 7 Dec 2022 15:46:47 +0000 Message-ID: <20221207154648.233759-4-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207154648.233759-1-wyes.karny@amd.com> References: <20221207154648.233759-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: BN8NAM11FT088:EE_|DS7PR12MB8345:EE_ X-MS-Office365-Filtering-Correlation-Id: f64d1e1a-2106-484d-bf9c-08dad86a937b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: axjqTzW7WbGdtk+d+Q1FUOPqS3ZlRn4AfvRejHuzbmsnYyj73LWvdrSzYOInyQpIB7s6FQYzc1OICOtqcmuPvDAQBJ5/edSTkClCTztvkvn2BrjiyG8ZqiUMAYXqskm6zWZbaqYv0wfpn8dGfLMT7We941aqN3EByDUey29Iti3N8Xnyb+hzdmLCmBntcMCrx1MmU1kl8mWv7pAFlIGbhjtJjLjdT2cCDnFFKSq7pWMJIbG806ZxD1FlByIuSwzSVR3+daM1DDjfGoHqffFa+4z2KD7FKvrOzXYOuHL8ht4XrY1suwnTZ/hFQhBMkCUrBrGRAddNA5NlKbVG8kWe5QpE3kdqQ84DqhY4PLrjZyhuIpQkVTQq8ajunZ5zakJ+yYX9EGS/QZ0G2ar3weVJCgju5YKIS7HgcYrf5HGMEAOLM2nf4WsxRawCSCMJb26fJWJ3CHixSOUfF8/mWb22BPEVZ9gW2WO6gtnvemfFt1svFuM8au/Ln1z7G5JzCvL+1F+FaESmk5iF/nUFm/PT5xKLmoaIJXD2m4heh9Flg3SQOj/zfCUPBWN3tDg15/+QCf0xsa6WVL2GvGEZ2uZaLoS8QDp6is0G9G4j/5w28lc2AZyp/2aDILxj3tyxrG/t5QSoecBJlGuT3kTVTjp5IcpUvWQgKVR7DzFDeZIhtHKMs+Ij8U8F0Q/oBDobHDK9E9Aa7imJbUKjF4znCQYC+m3oLq00zpRxWmurN6ZMN9w= 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)(346002)(376002)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(82740400003)(54906003)(82310400005)(2906002)(83380400001)(6666004)(16526019)(40480700001)(2616005)(40460700003)(44832011)(316002)(8936002)(1076003)(186003)(41300700001)(478600001)(36756003)(336012)(5660300002)(81166007)(356005)(110136005)(47076005)(7696005)(426003)(70586007)(70206006)(86362001)(4326008)(8676002)(36860700001)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2022 15:49:07.8371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f64d1e1a-2106-484d-bf9c-08dad86a937b 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: BN8NAM11FT088.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8345 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org As amd_pstate is a built-in driver (commit 456ca88d8a52 ("cpufreq: amd-pstate: change amd-pstate driver to be built-in type")), it can't be unloaded. However, it can be registered/unregistered from the cpufreq-core at runtime. Add a sysfs file to show the current amd_pstate status as well as add register/un-register capability to amd_pstate through this file. This sysfs interface can be used to change the driver mode dynamically. To show current state: #cat /sys/devices/system/cpu/amd_pstate/state # disable [passive] guided "[]" indicates current mode. To disable amd_pstate driver: #echo disable > /sys/devices/system/cpu/amd_pstate/state To enable passive mode: #echo passive > /sys/devices/system/cpu/amd_pstate/state To change mode from passive to guided: #echo guided > /sys/devices/system/cpu/amd_pstate/state Signed-off-by: Wyes Karny --- drivers/cpufreq/amd-pstate.c | 142 +++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 8bffcb9f80cf..023c4384a46a 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -50,6 +50,8 @@ #define AMD_PSTATE_TRANSITION_LATENCY 20000 #define AMD_PSTATE_TRANSITION_DELAY 1000 +typedef int (*cppc_mode_transition_fn)(int); + enum amd_pstate_mode { CPPC_DISABLE = 0, CPPC_PASSIVE, @@ -87,6 +89,8 @@ static inline int get_mode_idx_from_str(const char *str, size_t size) return -EINVAL; } +static DEFINE_MUTEX(amd_pstate_driver_lock); + static inline int pstate_enable(bool enable) { return wrmsrl_safe(MSR_AMD_CPPC_ENABLE, enable); @@ -623,6 +627,124 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, return sprintf(&buf[0], "%u\n", perf); } +static int amd_pstate_driver_cleanup(void) +{ + amd_pstate_enable(false); + cppc_state = CPPC_DISABLE; + return 0; +} + +static int amd_pstate_register_driver(int mode) +{ + int ret; + + ret = cpufreq_register_driver(&amd_pstate_driver); + if (ret) { + amd_pstate_driver_cleanup(); + return ret; + } + + cppc_state = mode; + return 0; +} + +static int amd_pstate_unregister_driver(int dummy) +{ + int ret; + + ret = cpufreq_unregister_driver(&amd_pstate_driver); + + if (ret) + return ret; + + amd_pstate_driver_cleanup(); + return 0; +} + +static int amd_pstate_change_driver_mode(int mode) +{ + cppc_state = mode; + return 0; +} + +/* Mode transition table */ +cppc_mode_transition_fn mode_state_machine[CPPC_MODE_MAX][CPPC_MODE_MAX] = { + [CPPC_DISABLE] = { + [CPPC_DISABLE] = NULL, + [CPPC_PASSIVE] = amd_pstate_register_driver, + [CPPC_GUIDED] = amd_pstate_register_driver, + }, + [CPPC_PASSIVE] = { + [CPPC_DISABLE] = amd_pstate_unregister_driver, + [CPPC_PASSIVE] = NULL, + [CPPC_GUIDED] = amd_pstate_change_driver_mode, + }, + [CPPC_GUIDED] = { + [CPPC_DISABLE] = amd_pstate_unregister_driver, + [CPPC_PASSIVE] = amd_pstate_change_driver_mode, + [CPPC_GUIDED] = NULL, + }, +}; + +static int amd_pstate_update_status(const char *buf, size_t size) +{ + int mode_req = 0; + + mode_req = get_mode_idx_from_str(buf, size); + + if (mode_req < 0 || mode_req >= CPPC_MODE_MAX) + return -EINVAL; + + if (mode_state_machine[cppc_state][mode_req]) + return mode_state_machine[cppc_state][mode_req](mode_req); + return -EBUSY; +} + +static ssize_t amd_pstate_show_status(char *buf) +{ + int i, j = 0; + + for (i = 0; i < CPPC_MODE_MAX; ++i) { + if (i == cppc_state) + j += sprintf(buf + j, "[%s] ", amd_pstate_mode_string[i]); + else + j += sprintf(buf + j, "%s ", amd_pstate_mode_string[i]); + } + j += sprintf(buf + j, "\n"); + return j; +} + +static ssize_t state_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + ssize_t ret = 0; + char *p = memchr(buf, '\n', count); + + mutex_lock(&amd_pstate_driver_lock); + ret = amd_pstate_update_status(buf, p ? p - buf : count); + mutex_unlock(&amd_pstate_driver_lock); + + return ret < 0 ? ret : count; +} +static ssize_t state_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + int ret; + + mutex_lock(&amd_pstate_driver_lock); + ret = amd_pstate_show_status(buf); + mutex_unlock(&amd_pstate_driver_lock); + return ret; +} + +static struct kobj_attribute state_attr = __ATTR_RW(state); +static struct attribute *amd_pstate_attrs[] = { + &state_attr.attr, + NULL, +}; + +ATTRIBUTE_GROUPS(amd_pstate); + cpufreq_freq_attr_ro(amd_pstate_max_freq); cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); @@ -648,6 +770,25 @@ static struct cpufreq_driver amd_pstate_driver = { .attr = amd_pstate_attr, }; +static struct kobject *amd_pstate_kobject; + +static void __init amd_pstate_sysfs_expose_param(void) +{ + int ret = 0; + + amd_pstate_kobject = kobject_create_and_add("amd_pstate", + &cpu_subsys.dev_root->kobj); + + if (WARN_ON(!amd_pstate_kobject)) + return; + + ret = sysfs_create_groups(amd_pstate_kobject, amd_pstate_groups); + if (ret) { + pr_err("sysfs group creation failed (%d)", ret); + return; + } +} + static int __init amd_pstate_init(void) { int ret; @@ -695,6 +836,7 @@ static int __init amd_pstate_init(void) if (ret) pr_err("failed to register amd_pstate_driver with return %d\n", ret); + amd_pstate_sysfs_expose_param(); return ret; } From patchwork Wed Dec 7 15:46:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 632827 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 4A06FC63703 for ; Wed, 7 Dec 2022 15:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229951AbiLGPuj (ORCPT ); Wed, 7 Dec 2022 10:50:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbiLGPt6 (ORCPT ); Wed, 7 Dec 2022 10:49:58 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F9E5D690; Wed, 7 Dec 2022 07:49:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpIAnjDJ3WjWy3BSS3GMVXOAccUUMZ/6OswVjHcW5rjWqJE43+xjIOOXku2Lw/aPlIpMQs8WhQCu/EYgiJOoSt0OIR4R7Et292ume416kZ9f0rg+cJOxfl+NPjRSUj/X6zyXBKZTsLMxcIUrZwmGeCO5GMh0CyzNmWa7Bk6SkRS37fr55SrCVj7Jv0KvupYKJn4S1i2hwBCjcVSDN7+/Znht9jCKx2Avnk+7nsGcW4OJX1ydOM5zaEP3a7OXnRQj0JkKD37ZR/3XVCFJB99yoQDvP8xCdtMEDJCHrSq5hBmPSbYmipqM42XAM1jghPKN6AOvFkBoBXFXvtaHf7mI+w== 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=tdTCKrYg4Vocmoj1X2D2pS5MTAwtyjEWaMTIrs2/9Fs=; b=mdZk+yT3heE2Ux+tT4WakgZjb2ATb5yszd1IDCB28y1bKlwKid8UAS4UrJpzbz9K3NdpV5vdMy73Q2EVlNlfNhhFAIhRrwL9z9+eO0rTy75kRqDSq6o8HID7QJiBuNrASEVSc9EWIsOqn/uyEyVV3IprWKrETtQMs8mPh2V5Hebek0DHUBEmZrZO2vbK7hC/6yp3fg9ApoTn0XP+44fPRUMOt/qmwdEBvkaz5f//dU4Pz/zbcWrgVwVm1pB+fnBcdgOg7mkb7rawJ4uXqr5pPjX3/biG2Cp2orNYF81i9oluXz1MvI3dyN69ChksPamNZNMX9VgLEYb4Pe+8ierIGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.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=tdTCKrYg4Vocmoj1X2D2pS5MTAwtyjEWaMTIrs2/9Fs=; b=P9KQHibSNLgJYOpp0vP13j3fi6ba5PhuZuk1o9iGYsBEXhxqiU4MFnJqI3jeJZOF+okwgvFXTZDPGVGzgmPh/pejDPRHJhH9GjjZWGMlZ5GNV6noJFA5pWi2AQQ/cCJ8omvF2G2n9kb+cmpdFkOOAlxPW3TRIAYE4n4lXDrnfVo= Received: from BN8PR04CA0049.namprd04.prod.outlook.com (2603:10b6:408:d4::23) by MW5PR12MB5649.namprd12.prod.outlook.com (2603:10b6:303:19d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Wed, 7 Dec 2022 15:49:56 +0000 Received: from BN8NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::b3) by BN8PR04CA0049.outlook.office365.com (2603:10b6:408:d4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14 via Frontend Transport; Wed, 7 Dec 2022 15:49:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT073.mail.protection.outlook.com (10.13.177.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5901.16 via Frontend Transport; Wed, 7 Dec 2022 15:49:55 +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; Wed, 7 Dec 2022 09:49:50 -0600 From: Wyes Karny To: , , CC: Jonathan Corbet , Huang Rui , "Rafael J . Wysocki" , Viresh Kumar , , , Ananth Narayan , , Wyes Karny Subject: [PATCH 4/4] Documentation: amd_pstate: Add amd_pstate state sysfs file Date: Wed, 7 Dec 2022 15:46:48 +0000 Message-ID: <20221207154648.233759-5-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207154648.233759-1-wyes.karny@amd.com> References: <20221207154648.233759-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: BN8NAM11FT073:EE_|MW5PR12MB5649:EE_ X-MS-Office365-Filtering-Correlation-Id: 10d2e681-5b36-4222-592b-08dad86ab00b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VhR5+KGNOJ7yhq4E1zsbMURCoDRnhD4Bdzjrhoq0Ztj7hO/R88xYSu92oNhtQ/iZOPVhqcdb3rE/y1BPHAaCiMAehid60iF9ZoTAhbgHmMeF0obn2zCZD+i98paIjpj2yEEcRCchLxNPhWfQvihbpdTlofHtfhVE+Hj9s/j43pKqldtllUaE9/B+RZ5r3MzzcOOCQGekbKrbW0r4E7PG+x2L5yLSiC/cOduRymY5gCkdyOlAVF2jml7DNeLQkCOBvu2AYsBmiMSFCqjQT83v7uFhCDuwyFmj7Vp/o3zekD5uPghxaV/1G2PZo5ZBxhTAlt12GMTSHA+ZBsbMZipSJPqiyRuppwEPZH+ej4y8wydk+OkWmRt/KBfZkvO8QhfsCitSKvnnx+2Og3diS2smU5PtgnMn0qC3wnUHJUsv3m0HVQ0IDDUE12ys5iN59GTc1SO9+ARRLboNs+A7BXiqo/HUJt4xdPBkbj08nirLocGWkCFj4OquCLPs1K4sTGtkZTcDjKVUnQyhRTWIXJpXCbeYYWJRYD38ijvgLJAOtSKasJnYa8wUN1u6R/XQwdqxFtZrsaa7jR2KwFKk0HSD1wYlBOK1SCZ/90bR1HmyyRPb8xI1giBwUByuv91KiG57Dvl0iEVDj+KX5XHgYRShhPTTvGdI8wnOPyHtMKYCVyHdM4g/FU/P/hud0ojVukWnbxc6oc1RmAR4x+5AhklmwY4Q7NDwurVTx05jrCVdW1s= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199015)(40470700004)(46966006)(36840700001)(478600001)(82740400003)(36860700001)(356005)(2616005)(2906002)(81166007)(7696005)(26005)(44832011)(5660300002)(83380400001)(82310400005)(47076005)(36756003)(16526019)(336012)(186003)(86362001)(41300700001)(40460700003)(426003)(54906003)(110136005)(316002)(1076003)(8936002)(4326008)(8676002)(40480700001)(70586007)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2022 15:49:55.7544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10d2e681-5b36-4222-592b-08dad86ab00b 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: BN8NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5649 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add documentation for amd_pstate `state` interface. User can see the current state of the driver with the help of this sysfs interface: # cat /sys/devices/system/cpu/amd_pstate/state # disable [passive] guided User can load/unload driver with the help of `state` sysfs interface. - Load driver with passive mode: # echo passive > /sys/devices/system/cpu/amd_pstate/state - Unload the driver: # echo disable > /sys/devices/system/cpu/amd_pstate/state - To switch to guided mode: # echo guided > /sys/devices/system/cpu/amd_pstate/state Signed-off-by: Wyes Karny --- Documentation/admin-guide/pm/amd-pstate.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 06e23538f79c..4d3783516ddc 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -265,6 +265,17 @@ This attribute is read-only. Other performance and frequency values can be read back from ``/sys/devices/system/cpu/cpuX/acpi_cppc/``, see :ref:`cppc_sysfs`. +``state`` + +``amd_pstate`` also exposes a sysfs interface to view and control the driver state. +The driver state can be one of the following: +``disable`` : indicates driver is in unloaded state. +``passive`` : indicates driver is loaded and currently in passive mode. +``guided`` : indicates driver is loaded and currenlty in guided autonomous mode. +This file can be found here: ``/sys/devices/system/cpu/amd_pstate/state``. + +To switch to passive mode: ``echo passive > /sys/devices/system/cpu/amd_pstate/state`` +To switch to guided mode: ``echo guided > /sys/devices/system/cpu/amd_pstate/state`` ``amd-pstate`` vs ``acpi-cpufreq`` ======================================