From patchwork Mon Oct 9 02:49:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Meng, Li \(Jassmine\)" X-Patchwork-Id: 731780 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 D880DE95A8E for ; Mon, 9 Oct 2023 02:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345038AbjJICuE (ORCPT ); Sun, 8 Oct 2023 22:50:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbjJICuD (ORCPT ); Sun, 8 Oct 2023 22:50:03 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1207BAC; Sun, 8 Oct 2023 19:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Et0oDnMQy7rmgaLvZgrSHTXGUNwJlV8fb1ZfYO6FnHN5Fp/t8Zk9bYCUDVt3vY4qZQkTvco6oBJixq+iDygggAnCS9QFvTu0qPGTapsIMZePQ2DNXaoOxls98EzfQ78K1GDbTjZlDw8sjWXZRTJNBygoIEGDI3AijJJBZx8QEYp6R/LVGxYzs2TgfJ4OO3sPWxMQ9c8i8zUmrACSlFwAMOn/8f3DyITF55PFhE/rbH/ZVnQSHAmi5RuzsIAirS7x7KMQ/lPWXik5IMZ9I12tP1KUQ2IkYP0ArLQpu+P2QcU4Kj+es2LRgvagArwD6m51k06Y9Brz1mLiQh95EKywiw== 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=hjcQ49bg8CAFre4NUkzFDvQ8GWwZ8FmEd7dO3NaTlE8=; b=PeW98c//99W7Zx6ZaFzBFKRKSUWxfQSQiIMY4abmK/+ZaRcAIQLz7ec26BUgt/lbTrG6oXTuxTTSqY7tv/weEZqpuzKeO1r/mpbaLHcrLvzktaV+hfuDZ+6WKIleeLhzdm2Vq+9VUI5lG+fMqBpos+dd5ocK2fL8cWHtBRGi5pwdgrTyJ/NenQDQ2VHj/vqJTBseyUe+Vh51nTfOTQKInR6lKrxjrlLDSdpeqlP6Pvxagvpo5eJYWMYKKXES7v39okeFpqNNNzgCnKSLBxw7UesfquocrKBkv39caVlLW8vfsWLB55dG5Hh5IVfjuBHz9dlu3wCW2ENGekkdLXKMpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=hjcQ49bg8CAFre4NUkzFDvQ8GWwZ8FmEd7dO3NaTlE8=; b=ld29TM/q6oLxheWCOj2X4t87Zwv1dmwlK+2++j0TvQDAOWhisxPIG994s+sNo85OkWkAEhivAqvF2c1KmPUIsGyhWtFEMHXn7toyD+eEH6+k+8G3A9mTg2yqYfCzFwXaleBjph8NKT1ucexh94VB5yTj39qH0aS0DlaLaXeJAT4= Received: from PH0PR07CA0099.namprd07.prod.outlook.com (2603:10b6:510:4::14) by SN7PR12MB8003.namprd12.prod.outlook.com (2603:10b6:806:32a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Mon, 9 Oct 2023 02:49:58 +0000 Received: from SN1PEPF0002529D.namprd05.prod.outlook.com (2603:10b6:510:4:cafe::aa) by PH0PR07CA0099.outlook.office365.com (2603:10b6:510:4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Mon, 9 Oct 2023 02:49:58 +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 SN1PEPF0002529D.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.21 via Frontend Transport; Mon, 9 Oct 2023 02:49:57 +0000 Received: from jasmine-meng.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.2507.27; Sun, 8 Oct 2023 21:49:53 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li Subject: [PATCH V8 1/7] x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. Date: Mon, 9 Oct 2023 10:49:26 +0800 Message-ID: <20231009024932.2563622-2-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009024932.2563622-1-li.meng@amd.com> References: <20231009024932.2563622-1-li.meng@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: SN1PEPF0002529D:EE_|SN7PR12MB8003:EE_ X-MS-Office365-Filtering-Correlation-Id: b02c98c0-9344-4a96-6961-08dbc8726ccc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kchJsCtkhH8gnux0MqD+aofDU57h+pJq94qpca4IKHGu1D3bbw3c9LQdRH660AyVpe9sfWZcyiNo7/Xs+MuLHuHTY476LMiVENSpYEpxNXmgu5VEvOGYHiKGJ6velPPY3Ba1cQS8Qm1Sj0N17iF5rsbQYA1vp28hWKze8nh3TRgEdufLlE28klVQR5Eupc9qgrGmN4Sczf/k7lQLHrSJk4j6kymeas7+/dfAvxB8ZJ9z0hgVgAHbju3C5seinZXxsl78dcWo3FN6Qk1oLNHV2/lxJ2KUfRXaChTY9BViqjKSxF01tolzwsFZcW/Ns6latOm9wp0/OcNdRR2Cs4EZayNVbGPLpt9N0d5/3wK6a7e30aPpBv9SHz7gLbRPvlCx7kOnsj5HWWAblvPnslui997rV1OCRAJ/k1ADerBRfIhIjgU7vJ4jnbcWZbUHY9LH5DSsA34jp7cwo2ewddvFmfkROU+AhbK+pIbvbd/BZxsTvMwE5hrTOMUtg16ghCSVdNRCoenC2Hd0o7EeQ6vbJ+aRUCzyrFqGdLHSgTwtiy5cHD1VVaIhiax4XZX5EzUxRvvVITq2Ce5wA7Gbwm45OPorhw61mMZjB1e9VTFT1YNj3nYoesxpFelY94XxNENCe3UrN/Hsip9zHUsHMlX8UxuQ+Lxva3dv0hG7d7DNizMNFjye35pXgvZiDbqUalPsT5OItiLOF0CUCQd3JIDo1KugVBsLmOhAf6qK0ZpICCZOcfGRGOGzqE8TsvCyNSDJePbRCesFK55PGdN6KiJp8g== 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:(13230031)(4636009)(376002)(396003)(346002)(136003)(39860400002)(230922051799003)(186009)(82310400011)(451199024)(1800799009)(64100799003)(40470700004)(36840700001)(46966006)(7696005)(40460700003)(70206006)(54906003)(6636002)(478600001)(426003)(36860700001)(356005)(82740400003)(47076005)(70586007)(83380400001)(36756003)(8676002)(40480700001)(16526019)(110136005)(6666004)(2616005)(1076003)(81166007)(336012)(86362001)(4744005)(8936002)(4326008)(2906002)(316002)(5660300002)(26005)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:49:57.9594 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b02c98c0-9344-4a96-6961-08dbc8726ccc 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: SN1PEPF0002529D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8003 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org amd-pstate driver also uses SCHED_MC_PRIO, so decouple the requirement of CPU_SUP_INTEL from the dependencies to allow compilation in kernels without Intel CPU support. Reviewed-by: Mario Limonciello Reviewed-by: Huang Rui Signed-off-by: Meng Li --- arch/x86/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 66bfabae8814..a2e163acf623 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1054,8 +1054,9 @@ config SCHED_MC config SCHED_MC_PRIO bool "CPU core priorities scheduler support" - depends on SCHED_MC && CPU_SUP_INTEL - select X86_INTEL_PSTATE + depends on SCHED_MC + select X86_INTEL_PSTATE if CPU_SUP_INTEL + select X86_AMD_PSTATE if CPU_SUP_AMD && ACPI select CPU_FREQ default y help From patchwork Mon Oct 9 02:49:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Meng, Li \(Jassmine\)" X-Patchwork-Id: 731335 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 A9A37E95A91 for ; Mon, 9 Oct 2023 02:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233658AbjJICuL (ORCPT ); Sun, 8 Oct 2023 22:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233914AbjJICuK (ORCPT ); Sun, 8 Oct 2023 22:50:10 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2040.outbound.protection.outlook.com [40.107.100.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1761D6; Sun, 8 Oct 2023 19:50:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f9QGp9pexlXmeJDYvPah8VHiEU2iOuTvLmQ54PxMxtJfjRYyFP5KeWSlqHgGMwlPx8k5GELbIDE1gG3DeI2oZxwrlBEGxBL+OKlgvRymxrdq28Q7HjycTk6YAiLR2KRj3XxRqpQJB+YRnR5qj+k39Akebj/bOIH14QTP+71xW7zemkKMUxam4EByDd0itM/j02MQJ8QWAaV9hfxa51aXDy6ZQtaCsfutiHnPtmEGK/tBP2fp4AUIbbMmVr/lR8NyiBKKgxq84N87Nqm5s89i6hCyBEKnPXpZFHrJpm+OC7qKVTvakrj5ZTrfqresxP3lv0UtvYJBN07Tx6QLevqTnQ== 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=68m3Wjq9q0JUFz/4fisPuF3cAg7UniP1UxVS6p0LUCI=; b=KuAQQC1uAySNnB+rOCqWToFdmNBN2a6eo53VuEJdoKKXdOLM8VpZ3KEdajbv6xGXG6KFKJenhRGpe1iwZdMty+3E3c6TT36/yBnISP3hm/w/KyZRRjKRyZbN7qYIdllyjA1n8T+MGJSU+AcLDht+ie/q8oB0dziLbgv3CKIOePc0hf4Ksmkl5/gxgUUKteBScUKl29SWjpYYqZc3Z+O5cMUNFXI9pZkXyJ0/7LHwkKaZzSirBnkeme08CoJ6kVfkqBY9WWlx71Wia6TYt58fPzPH65P7pjO4tegwPYngihnOo/XVatdl28yB0WeKrXwlnuB3Hyvna2aeHz12uXqRgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=68m3Wjq9q0JUFz/4fisPuF3cAg7UniP1UxVS6p0LUCI=; b=UvT3e8zt2MhKHVYV1GFPiLRYgHhqHYSowPbACb/K1+KHnzvIPxC43y7JT25IfdyUsXEoQIM3fOrhEBybZbY8vasS48USh6bR48n2BmJbQ7l4usDPVkDz+fZYPvoPtglA49yHQDxdBPQSRD+gzUj6ljgdBsyoJ3puTBNZFaRG9Bg= Received: from SA9PR10CA0004.namprd10.prod.outlook.com (2603:10b6:806:a7::9) by LV8PR12MB9084.namprd12.prod.outlook.com (2603:10b6:408:18e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.39; Mon, 9 Oct 2023 02:50:03 +0000 Received: from SN1PEPF0002529F.namprd05.prod.outlook.com (2603:10b6:806:a7:cafe::6b) by SA9PR10CA0004.outlook.office365.com (2603:10b6:806:a7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37 via Frontend Transport; Mon, 9 Oct 2023 02:50:03 +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 SN1PEPF0002529F.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Mon, 9 Oct 2023 02:50:03 +0000 Received: from jasmine-meng.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.2507.27; Sun, 8 Oct 2023 21:49:57 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li , Wyes Karny Subject: [PATCH V8 2/7] acpi: cppc: Add get the highest performance cppc control Date: Mon, 9 Oct 2023 10:49:27 +0800 Message-ID: <20231009024932.2563622-3-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009024932.2563622-1-li.meng@amd.com> References: <20231009024932.2563622-1-li.meng@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: SN1PEPF0002529F:EE_|LV8PR12MB9084:EE_ X-MS-Office365-Filtering-Correlation-Id: 62d60eb0-7ccd-4593-3298-08dbc8726fd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lXpjIDmrL1sVeFsQW2CVz6skDR+/YKipZf7sA2GmNcau5QCQYDirf6NP8BvDl1kwTDFvhxOX/VuweMjNXe+WmyMAuu4K77joInvapOz2UQCl+5ij/wHlG4rxqqmWdvB7fSNctZXmHmq5DicbD/k0QpV7367Wudl6zd0CKxb17Cwu3Tcy+V9Yhp7pJKw+G4cbkMIa5cHVhLZHxZ6ODs06IqehoqRUz+YbwV6ZUKFyT7k+uMkRsLDnHw8lp4p8e3pv8qTFtpMM8PXh8nBmaswqwsxtCneg2sPbRW4SjTZzahZBTcEETZmh2Zaqc0WruOUZConSDGXGBgf9QP2KV3xODtiPYwKZ0juqTvmRHOa+bqZMREOLN3ut1lfX9DzgKbqJfD8L2Ff2lLen3Kjb/hxnnvI9f8ZUay2TN8cl7D0hGzxpAbBANUWTh97KUVg8aThZAxes0jOHplJfjXMbRhdhNzFeRorh0AbBVBpQPPPyI74vRUli6EM2pg4F2E7pqs/S8iYUAXICnn42J8Hn0/YjlNECOhtXOF+2i4bFqDdm/n1rVx1Ygb1Svj3Zs24jsUfEHy5LZOeaJwG1UWAJMBYVpJwQX5jY59CZ/COxq1+UbUUVgihctB2XIRlGqRkRBJkLSY9YtHiqZnIlIfB/yiKUtYvHNhaBUmOF60aEHJTiyEzbxUeRgnM96DrR1afqIa22FVn7iEm+kNj/eojlDWQoAZqcALhWWrI8SF8bHQvj4QQGzTK5AAK4LQlF9k14oQX1d/9dxTh/xZGbRAbYKYlBi/l/SE1jSiytSUyBiZ7Wqz8= 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:(13230031)(4636009)(136003)(346002)(376002)(396003)(39860400002)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(82310400011)(36840700001)(40470700004)(46966006)(40460700003)(1076003)(2616005)(478600001)(7696005)(966005)(6666004)(336012)(426003)(26005)(16526019)(47076005)(2906002)(5660300002)(110136005)(54906003)(70586007)(4326008)(8676002)(8936002)(70206006)(316002)(6636002)(41300700001)(82740400003)(356005)(81166007)(36860700001)(36756003)(86362001)(40480700001)(15583001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:50:03.0502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62d60eb0-7ccd-4593-3298-08dbc8726fd5 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: SN1PEPF0002529F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9084 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add support for getting the highest performance to the generic CPPC driver. This enables downstream drivers such as amd-pstate to discover and use these values. Please refer to the ACPI_Spec for details on continuous performance control of CPPC. Reviewed-by: Mario Limonciello Reviewed-by: Wyes Karny Acked-by: Huang Rui Signed-off-by: Meng Li Link: https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html?highlight=cppc#highest-performance --- drivers/acpi/cppc_acpi.c | 13 +++++++++++++ include/acpi/cppc_acpi.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 7ff269a78c20..ad388a0e8484 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -1154,6 +1154,19 @@ int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf) return cppc_get_perf(cpunum, NOMINAL_PERF, nominal_perf); } +/** + * cppc_get_highest_perf - Get the highest performance register value. + * @cpunum: CPU from which to get highest performance. + * @highest_perf: Return address. + * + * Return: 0 for success, -EIO otherwise. + */ +int cppc_get_highest_perf(int cpunum, u64 *highest_perf) +{ + return cppc_get_perf(cpunum, HIGHEST_PERF, highest_perf); +} +EXPORT_SYMBOL_GPL(cppc_get_highest_perf); + /** * cppc_get_epp_perf - Get the epp register value. * @cpunum: CPU from which to get epp preference value. diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 6126c977ece0..c0b69ffe7bdb 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -139,6 +139,7 @@ struct cppc_cpudata { #ifdef CONFIG_ACPI_CPPC_LIB extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf); extern int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf); +extern int cppc_get_highest_perf(int cpunum, u64 *highest_perf); extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs); extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); extern int cppc_set_enable(int cpu, bool enable); @@ -165,6 +166,10 @@ static inline int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf) { return -ENOTSUPP; } +static inline int cppc_get_highest_perf(int cpunum, u64 *highest_perf) +{ + return -ENOTSUPP; +} static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs) { return -ENOTSUPP; From patchwork Mon Oct 9 02:49:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Meng, Li \(Jassmine\)" X-Patchwork-Id: 731779 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 C322AE95A8F for ; Mon, 9 Oct 2023 02:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233613AbjJICus (ORCPT ); Sun, 8 Oct 2023 22:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbjJICur (ORCPT ); Sun, 8 Oct 2023 22:50:47 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2046.outbound.protection.outlook.com [40.107.96.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 877D0A6; Sun, 8 Oct 2023 19:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f1YpHNBvFHmm/t/eZgXUNG6JvtVYJKKhf2yX9sco6xvMSjFnedBjAwOvEJxSoqsSloNH61vnyXlt/XQ7H7tcmZvweZhILTwdFwLqsEheugf1lNqEkw1r7vdjlCtkkba5JwFpMKHjOVZnSG34pwJUTkxFVoYgeb9lTj0kB7XmhzVl1cZ7ZWAR1PAIrre1Gp79wxNAuW3IIZELdJYrj0IJROP9+qM9BqXQrGuyVJ6FNjAn3joC8/rzpkcTSFfr6ilQtxUk0jjemofUQD8P2RZVwQ9yeXgA0j5W+NIJUoQtpFeDS/6CqcggrR/6As2NOjnvILq70488kX8W27yOrqP8Eg== 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=RJYvjMJKHJ8ceESTBOKOhrQihm4T6VwTm0HICO7uIBk=; b=BG57K2ABVsHWj4nTnBVcRQk+KsiziC7c06B3xW9ksJS6ddJSZQfcAnHhjStzzF9j5B1CWTKimEff6k0aLTFiS/O9tJgaxKzjpNwsVsvZdN2H7beNQZmTCplQ+sWh4fink5gTdeSFE9ndD6nbMl+n8CWc7fLEFcVea/oyIUS2sSabiGMUn1rpTDGZ7lTTYk62lSwalpGyUuVLhkaSOktK0HUYyP+UEsvRqWsxgwX1taOid489UkO9ucWxEgT1Wk3P4fB7HGtkKmirCReSiSnkH+NW9lGSAH+61AmvZCXEvr5gsgJYmSbU5/xNWZdgQIFm6j5sCTt5WNNj0+Lr42i8Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=RJYvjMJKHJ8ceESTBOKOhrQihm4T6VwTm0HICO7uIBk=; b=KexvDRW0qtII5RSsTL34r2feoYAEoh1oPb0fwVXPKmBUwu6AZVRr1OudCE3XniP2XGCG/tRIfltj8J977n/IMQ9BxD79u2ehOmfK1Vbr1IlpiOaDlha6gNYd38Shdqn3oQrpZ2IJ87oLDNmhPuPXs1CrelKzOLgwzzH0koTzE5I= Received: from SA9PR11CA0018.namprd11.prod.outlook.com (2603:10b6:806:6e::23) by SA1PR12MB6774.namprd12.prod.outlook.com (2603:10b6:806:259::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.41; Mon, 9 Oct 2023 02:50:42 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:806:6e:cafe::1b) by SA9PR11CA0018.outlook.office365.com (2603:10b6:806:6e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Mon, 9 Oct 2023 02:50:42 +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 SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Mon, 9 Oct 2023 02:50:42 +0000 Received: from jasmine-meng.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.2507.27; Sun, 8 Oct 2023 21:50:02 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li Subject: [PATCH V8 3/7] cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. Date: Mon, 9 Oct 2023 10:49:28 +0800 Message-ID: <20231009024932.2563622-4-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009024932.2563622-1-li.meng@amd.com> References: <20231009024932.2563622-1-li.meng@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: SA2PEPF00001509:EE_|SA1PR12MB6774:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bcd9b09-bb8a-4a7e-d833-08dbc8728739 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VUI4rnqkE+7iwRr2Vm1txAoesp5+OcuYs9twpLUUjpVJHW4pnRl/XaAS18GEY05wBl55okzRR2s9WV0eD0wRtzwKjX2TtQ5P1Z0ba0u+O0UtVurhnlU9T2e+ti0m5oO64LnYuw5ykwumy+tGr6HSVa8RSmLfBLTrp7EBBvaXYzzHrqnn7EYodCbDkIFt852suJ/bxqSo3GpqkV/bYrzAUl3qhcdqMqjiU2uARYBUgtTx02Q6iJEqB0WIXmFwTMv04xA18ibYTVgGtYq17n1qlE9cFJqyHgLaAzStSHwVjTC9FnzIKw6ILkTyBfs1crtbvVA4J1BeDtXriN+IBILgs/R1YAMTmHHVrpbvhBASFRUsU2TdfLV9R+KvzVa3jIXuB6AowlvJfLISDuWlU987EqroiVuCpfDG4EsP+rRs2/2YBjMSlBLsq1H34oVLCtvcKRG0PNr25AfYk57i04rNJBKef8ZYN0ucZvbwwuQEz1bSt93OZFbuVhAki24NgLTQ8am+Mp4gQKEKbWxrR9f+KQdJc43qnPJKrmjphev6IQEAaj5nt+MAhV3cAVlu4QMa3dOavv/mpJT23q2/zuL/oLsNtsmceNHAx4OWsz/Zyrot5lx8NyhehAHCeN4xofdkQr/BT0vQtLEpFVuTpqpZaDfS6LTnzG1gTVVSAenT+updss9N1VjoscUIzwvvkSe7bfwY4rS0nfLfibdsWt+dZxH4pp5G/AtFpuf681rGkF7SysYMdmnd4Oz8coTGE1F1yBHyLm9rQ6qqAZqovwmOgw== 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:(13230031)(4636009)(376002)(136003)(346002)(39860400002)(396003)(230922051799003)(1800799009)(451199024)(186009)(64100799003)(82310400011)(36840700001)(40470700004)(46966006)(70586007)(54906003)(6636002)(70206006)(316002)(30864003)(41300700001)(110136005)(336012)(426003)(16526019)(1076003)(2616005)(26005)(47076005)(2906002)(8936002)(8676002)(6666004)(7696005)(4326008)(5660300002)(83380400001)(356005)(478600001)(36860700001)(81166007)(36756003)(86362001)(82740400003)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:50:42.3130 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bcd9b09-bb8a-4a7e-d833-08dbc8728739 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: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6774 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org amd-pstate driver utilizes the functions and data structures provided by the ITMT architecture to enable the scheduler to favor scheduling on cores which can be get a higher frequency with lower voltage. We call it amd-pstate preferrred core. Here sched_set_itmt_core_prio() is called to set priorities and sched_set_itmt_support() is called to enable ITMT feature. amd-pstate driver uses the highest performance value to indicate the priority of CPU. The higher value has a higher priority. The initial core rankings are set up by amd-pstate when the system boots. Add a variable hw_prefcore in cpudata structure. It will check if the processor and power firmware support preferred core feature. Add one new early parameter `disable` to allow user to disable the preferred core. Only when hardware supports preferred core and user set `enabled` in early parameter, amd pstate driver supports preferred core featue. Reviewed-by: Mario Limonciello Co-developed-by: Perry Yuan Signed-off-by: Perry Yuan Signed-off-by: Meng Li --- drivers/cpufreq/amd-pstate.c | 152 +++++++++++++++++++++++++++++++---- include/linux/amd-pstate.h | 4 + 2 files changed, 140 insertions(+), 16 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9a1e194d5cf8..6ac8939fce5a 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,8 @@ #define AMD_PSTATE_TRANSITION_LATENCY 20000 #define AMD_PSTATE_TRANSITION_DELAY 1000 +#define AMD_PSTATE_PREFCORE_THRESHOLD 166 +#define AMD_PSTATE_MAX_CPPC_PERF 255 /* * TODO: We need more time to fine tune processors with shared memory solution @@ -64,6 +67,7 @@ static struct cpufreq_driver amd_pstate_driver; static struct cpufreq_driver amd_pstate_epp_driver; static int cppc_state = AMD_PSTATE_UNDEFINED; static bool cppc_enabled; +static bool amd_pstate_prefcore = true; /* * AMD Energy Preference Performance (EPP) @@ -290,23 +294,21 @@ static inline int amd_pstate_enable(bool enable) static int pstate_init_perf(struct amd_cpudata *cpudata) { u64 cap1; - u32 highest_perf; int ret = rdmsrl_safe_on_cpu(cpudata->cpu, MSR_AMD_CPPC_CAP1, &cap1); if (ret) return ret; - /* - * TODO: Introduce AMD specific power feature. - * - * CPPC entry doesn't indicate the highest performance in some ASICs. + /* For platforms that do not support the preferred core feature, the + * highest_pef may be configured with 166 or 255, to avoid max frequency + * calculated wrongly. we take the AMD_CPPC_HIGHEST_PERF(cap1) value as + * the default max perf. */ - highest_perf = amd_get_highest_perf(); - if (highest_perf > AMD_CPPC_HIGHEST_PERF(cap1)) - highest_perf = AMD_CPPC_HIGHEST_PERF(cap1); - - WRITE_ONCE(cpudata->highest_perf, highest_perf); + if (cpudata->hw_prefcore) + WRITE_ONCE(cpudata->highest_perf, AMD_PSTATE_PREFCORE_THRESHOLD); + else + WRITE_ONCE(cpudata->highest_perf, AMD_CPPC_HIGHEST_PERF(cap1)); WRITE_ONCE(cpudata->nominal_perf, AMD_CPPC_NOMINAL_PERF(cap1)); WRITE_ONCE(cpudata->lowest_nonlinear_perf, AMD_CPPC_LOWNONLIN_PERF(cap1)); @@ -318,17 +320,15 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) static int cppc_init_perf(struct amd_cpudata *cpudata) { struct cppc_perf_caps cppc_perf; - u32 highest_perf; int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); if (ret) return ret; - highest_perf = amd_get_highest_perf(); - if (highest_perf > cppc_perf.highest_perf) - highest_perf = cppc_perf.highest_perf; - - WRITE_ONCE(cpudata->highest_perf, highest_perf); + if (cpudata->hw_prefcore) + WRITE_ONCE(cpudata->highest_perf, AMD_PSTATE_PREFCORE_THRESHOLD); + else + WRITE_ONCE(cpudata->highest_perf, cppc_perf.highest_perf); WRITE_ONCE(cpudata->nominal_perf, cppc_perf.nominal_perf); WRITE_ONCE(cpudata->lowest_nonlinear_perf, @@ -676,6 +676,90 @@ static void amd_perf_ctl_reset(unsigned int cpu) wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0); } +/* + * Set amd-pstate preferred core enable can't be done directly from cpufreq callbacks + * due to locking, so queue the work for later. + */ +static void amd_pstste_sched_prefcore_workfn(struct work_struct *work) +{ + sched_set_itmt_support(); +} +static DECLARE_WORK(sched_prefcore_work, amd_pstste_sched_prefcore_workfn); + +/* + * Get the highest performance register value. + * @cpu: CPU from which to get highest performance. + * @highest_perf: Return address. + * + * Return: 0 for success, -EIO otherwise. + */ +static int amd_pstate_get_highest_perf(int cpu, u32 *highest_perf) +{ + int ret; + u64 cppc_highest_perf; + + if (boot_cpu_has(X86_FEATURE_CPPC)) { + u64 cap1; + + ret = rdmsrl_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1); + if (ret) + return ret; + WRITE_ONCE(*highest_perf, AMD_CPPC_HIGHEST_PERF(cap1)); + } else { + ret = cppc_get_highest_perf(cpu, &cppc_highest_perf); + *highest_perf = (u32)(cppc_highest_perf & 0xFFFF); + } + + return (ret); +} + +static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) +{ + int ret; + u32 highest_perf; + static u32 max_highest_perf = 0, min_highest_perf = U32_MAX; + + ret = amd_pstate_get_highest_perf(cpudata->cpu, &highest_perf); + if (ret) + return; + + cpudata->hw_prefcore = true; + /* check if CPPC preferred core feature is enabled*/ + if (highest_perf == AMD_PSTATE_MAX_CPPC_PERF) { + pr_debug("AMD CPPC preferred core is unsupported!\n"); + cpudata->hw_prefcore = false; + return; + } + + if (!amd_pstate_prefcore) + return; + + /* + * The priorities can be set regardless of whether or not + * sched_set_itmt_support(true) has been called and it is valid to + * update them at any time after it has been called. + */ + sched_set_itmt_core_prio(highest_perf, cpudata->cpu); + + if (max_highest_perf <= min_highest_perf) { + if (highest_perf > max_highest_perf) + max_highest_perf = highest_perf; + + if (highest_perf < min_highest_perf) + min_highest_perf = highest_perf; + + if (max_highest_perf > min_highest_perf) { + /* + * This code can be run during CPU online under the + * CPU hotplug locks, so sched_set_itmt_support() + * cannot be called from here. Queue up a work item + * to invoke it. + */ + schedule_work(&sched_prefcore_work); + } + } +} + static int amd_pstate_cpu_init(struct cpufreq_policy *policy) { int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; @@ -697,6 +781,8 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) cpudata->cpu = policy->cpu; + amd_pstate_init_prefcore(cpudata); + ret = amd_pstate_init_perf(cpudata); if (ret) goto free_cpudata1; @@ -845,6 +931,17 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, return sysfs_emit(buf, "%u\n", perf); } +static ssize_t show_amd_pstate_hw_prefcore(struct cpufreq_policy *policy, + char *buf) +{ + bool hw_prefcore; + struct amd_cpudata *cpudata = policy->driver_data; + + hw_prefcore = READ_ONCE(cpudata->hw_prefcore); + + return sysfs_emit(buf, "%s\n", hw_prefcore ? "supported" : "unsupported"); +} + static ssize_t show_energy_performance_available_preferences( struct cpufreq_policy *policy, char *buf) { @@ -1037,18 +1134,27 @@ static ssize_t status_store(struct device *a, struct device_attribute *b, return ret < 0 ? ret : count; } +static ssize_t prefcore_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%s\n", amd_pstate_prefcore ? "enabled" : "disabled"); +} + cpufreq_freq_attr_ro(amd_pstate_max_freq); cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); cpufreq_freq_attr_ro(amd_pstate_highest_perf); +cpufreq_freq_attr_ro(amd_pstate_hw_prefcore); cpufreq_freq_attr_rw(energy_performance_preference); cpufreq_freq_attr_ro(energy_performance_available_preferences); static DEVICE_ATTR_RW(status); +static DEVICE_ATTR_RO(prefcore); static struct freq_attr *amd_pstate_attr[] = { &amd_pstate_max_freq, &amd_pstate_lowest_nonlinear_freq, &amd_pstate_highest_perf, + &amd_pstate_hw_prefcore, NULL, }; @@ -1056,6 +1162,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { &amd_pstate_max_freq, &amd_pstate_lowest_nonlinear_freq, &amd_pstate_highest_perf, + &amd_pstate_hw_prefcore, &energy_performance_preference, &energy_performance_available_preferences, NULL, @@ -1063,6 +1170,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { static struct attribute *pstate_global_attributes[] = { &dev_attr_status.attr, + &dev_attr_prefcore.attr, NULL }; @@ -1114,6 +1222,8 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) cpudata->cpu = policy->cpu; cpudata->epp_policy = 0; + amd_pstate_init_prefcore(cpudata); + ret = amd_pstate_init_perf(cpudata); if (ret) goto free_cpudata1; @@ -1527,7 +1637,17 @@ static int __init amd_pstate_param(char *str) return amd_pstate_set_driver(mode_idx); } + +static int __init amd_prefcore_param(char *str) +{ + if (!strcmp(str, "disable")) + amd_pstate_prefcore = false; + + return 0; +} + early_param("amd_pstate", amd_pstate_param); +early_param("amd_prefcore", amd_prefcore_param); MODULE_AUTHOR("Huang Rui "); MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver"); diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index 446394f84606..87e140e9e6db 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -52,6 +52,9 @@ struct amd_aperf_mperf { * @prev: Last Aperf/Mperf/tsc count value read from register * @freq: current cpu frequency value * @boost_supported: check whether the Processor or SBIOS supports boost mode + * @hw_prefcore: check whether HW supports preferred core featue. + * Only when hw_prefcore and early prefcore param are true, + * AMD P-State driver supports preferred core featue. * @epp_policy: Last saved policy used to set energy-performance preference * @epp_cached: Cached CPPC energy-performance preference value * @policy: Cpufreq policy value @@ -81,6 +84,7 @@ struct amd_cpudata { u64 freq; bool boost_supported; + bool hw_prefcore; /* EPP feature related attributes*/ s16 epp_policy; From patchwork Mon Oct 9 02:49:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Meng, Li \(Jassmine\)" X-Patchwork-Id: 731334 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 62ECEE95A91 for ; Mon, 9 Oct 2023 02:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345049AbjJICuz (ORCPT ); Sun, 8 Oct 2023 22:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233653AbjJICuw (ORCPT ); Sun, 8 Oct 2023 22:50:52 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B00DA4; Sun, 8 Oct 2023 19:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PangInJExWdxPNq5SvFS2wYeIStjGpDdmPeSmuL3ia3jyOxKnuLlLYrQR7ndetihjcAj3fwrtb5VFNLjM5kZx0K44LXaOhqURRcqhcVndBOaxNoyZBMwcGV9GhotsRlaEA8u6Qa/wUnohpY3Es0BLE9iHovUjlcyRNVikskv5LEKIhZvw5ZSk01ip/5BbzhJe+KXdKzD8HLmBAec5Nx/3x5NVFREEZnwmtcw/rI1iTRxiWMPU6PgklCjmuV3DmD/dMdz1q4aqbXK8CV76Ll2ivLb/K1Qs2NkgteVpbFmj7ZYF4pzBSrH1pEMAJ4qVEJ3CTnuxIo4x2HtMMMGq/8PLA== 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=AVQLDHlBFGN8eLlpQahZ7b53ooTJ5WGoPWkmAc1H+PA=; b=FUPcWW8oLSC2gGuP0UbHsK5hGEShGAvU5z6qOS/KqGzbyq5FJQLD4CiCK9py6KTeCCIv6DKmmlcaEUE6Lb+ZGVvMTpP+OBimkMnMfYNXJosMGzHXBw7sr77f7/ncUvnuEzpKat746dLWReLW8ogZxQSqFSiw4KUEskxH81vVzHp62g3XQ5hsmhHGhbaeLnm69/BwIb6ahyi6Cfa+FrydXqnwCJ2ZT561TIoJGiYJFEBpHQ3m1ukYDZlznJ1NoPIEwl8MFe8yGkzdn16fregydyuQYiFSzIFXWYW0FtIEiiDjCZOHoxDa0dr+582Bl33HduQUgxZm693SSLR5GGYCTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=AVQLDHlBFGN8eLlpQahZ7b53ooTJ5WGoPWkmAc1H+PA=; b=A4bq+PDUKBwpGcurO8a9hvyh5NZBVG6TH5BPBWKrfl+BO6fGfNQ8EymP7WyZUqA4hAZKQToSX53V4d9MG3dlAMuD1pqQlBQKF8i0nLBpwS+liLk21PrU9cJXiFcdjwmXE3vWbtbak2m7XIwvzQM6q71G/HxUfgE+RtVcDZUWrOw= Received: from MN2PR22CA0004.namprd22.prod.outlook.com (2603:10b6:208:238::9) by SA0PR12MB4352.namprd12.prod.outlook.com (2603:10b6:806:9c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.43; Mon, 9 Oct 2023 02:50:48 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:238:cafe::bb) by MN2PR22CA0004.outlook.office365.com (2603:10b6:208:238::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Mon, 9 Oct 2023 02:50:48 +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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Mon, 9 Oct 2023 02:50:48 +0000 Received: from jasmine-meng.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.2507.27; Sun, 8 Oct 2023 21:50:40 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li Subject: [PATCH V8 4/7] cpufreq: Add a notification message that the highest perf has changed Date: Mon, 9 Oct 2023 10:49:29 +0800 Message-ID: <20231009024932.2563622-5-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009024932.2563622-1-li.meng@amd.com> References: <20231009024932.2563622-1-li.meng@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: BL6PEPF0001AB4D:EE_|SA0PR12MB4352:EE_ X-MS-Office365-Filtering-Correlation-Id: 15a8c133-8bd9-4828-dddd-08dbc8728ac2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UdQSNtUIqBL0+ONVH4HihnOBiXdlOG3joIMjJglQ6idBVDpI2XHeqJc5PctPBESdi6tWLaj2hIMyBLTP+EsNWkGTqFkabrOEN48v1gFmQh94E9rjMeksujo54hX9I37XvTA3cYqQehFlUe3zTJo4GeuFrqIUOcuxKM2U2lr761eVmb6NnjGQqCJkHFv6+bluDUrju6Zx4UBaMXOVLsFg9BQpgiBkIAr4TmpOJ2B1TJetszoR6g3jmoeeJiJtS0MjtP5jH1C4uJ2irppPlSY2o7CA6xfKOjY88gdc18QtfRSUdy2Vcc/OpaNm9NqoFT8JHuCyBJ/eaagn7UguDsJFaTPfl7Zs/7+4zMweZ6B9OlhCSNfrcfQaFVMqp9WfRd8Y16NMCj+04QsF5bKBt6CGPFc+TJI6g5/efgxzc9RtXMpZlko0fsPDOTozg9CdMIfuwYKTgt9Xn8A4rHpxie0oFW5aj7el1f/b4HfyY5AeTRu7SxfBHCkjHawi4/q3Rb8/S2LNKbjqrg1cSDfrEvKm7ddNWEtb9gCusP1B3vZt4DIU4KzoEmZLttyunrOk6tOV8NIyYVpBX0J5H5Pq7nVfClgRBZ3AvZnQN2v1XIrdR1P2q5FgdD12VpDC7gzv6hu14EuqxUrQieFQC9O+95/3kgB6d2x6qYy1UT3pBFQZyzDZc+n8J3ZMq1yTTFMEXBFqvjTvG5jScd9ZtYj3w6PtWkTLasgwF6pzb+CaKfbXLdr7A8T4F+5T+4HHx3bEFJnh9/9/2uYQMsV6dbzQOFAnAqDKgPxKccGs1yRRV0Jrosk= 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:(13230031)(4636009)(39860400002)(136003)(376002)(346002)(396003)(230922051799003)(82310400011)(1800799009)(186009)(451199024)(64100799003)(40470700004)(46966006)(36840700001)(40460700003)(1076003)(478600001)(7696005)(26005)(2616005)(966005)(47076005)(336012)(16526019)(83380400001)(426003)(15650500001)(2906002)(5660300002)(110136005)(54906003)(70206006)(70586007)(6636002)(4326008)(8936002)(8676002)(316002)(41300700001)(40480700001)(356005)(81166007)(36860700001)(82740400003)(36756003)(86362001)(6666004)(226483002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:50:48.2442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15a8c133-8bd9-4828-dddd-08dbc8728ac2 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4352 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org ACPI 6.5 section 8.4.6.1.1.1 specifies that Notify event 0x85 can be emmitted to cause the the OSPM to re-evaluate the highest performance register. Add support for this event. Reviewed-by: Mario Limonciello Reviewed-by: Huang Rui Signed-off-by: Meng Li Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#processor-device-notification-values --- drivers/acpi/processor_driver.c | 6 ++++++ drivers/cpufreq/cpufreq.c | 13 +++++++++++++ include/linux/cpufreq.h | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 4bd16b3f0781..29b2fb68a35d 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -27,6 +27,7 @@ #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 +#define ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED 0x85 MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION("ACPI Processor Driver"); @@ -83,6 +84,11 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) acpi_bus_generate_netlink_event(device->pnp.device_class, dev_name(&device->dev), event, 0); break; + case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED: + cpufreq_update_highest_perf(pr->id); + acpi_bus_generate_netlink_event(device->pnp.device_class, + dev_name(&device->dev), event, 0); + break; default: acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event); break; diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 60ed89000e82..4ada787ff105 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2718,6 +2718,19 @@ void cpufreq_update_limits(unsigned int cpu) } EXPORT_SYMBOL_GPL(cpufreq_update_limits); +/** + * cpufreq_update_highest_perf - Update highest performance for a given CPU. + * @cpu: CPU to update the highest performance for. + * + * Invoke the driver's ->update_highest_perf callback if present + */ +void cpufreq_update_highest_perf(unsigned int cpu) +{ + if (cpufreq_driver->update_highest_perf) + cpufreq_driver->update_highest_perf(cpu); +} +EXPORT_SYMBOL_GPL(cpufreq_update_highest_perf); + /********************************************************************* * BOOST * *********************************************************************/ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 71d186d6933a..1cc1241fb698 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -235,6 +235,7 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); void refresh_frequency_limits(struct cpufreq_policy *policy); void cpufreq_update_policy(unsigned int cpu); void cpufreq_update_limits(unsigned int cpu); +void cpufreq_update_highest_perf(unsigned int cpu); bool have_governor_per_policy(void); bool cpufreq_supports_freq_invariance(void); struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); @@ -263,6 +264,7 @@ static inline bool cpufreq_supports_freq_invariance(void) return false; } static inline void disable_cpufreq(void) { } +static inline void cpufreq_update_highest_perf(unsigned int cpu) { } #endif #ifdef CONFIG_CPU_FREQ_STAT @@ -380,6 +382,9 @@ struct cpufreq_driver { /* Called to update policy limits on firmware notifications. */ void (*update_limits)(unsigned int cpu); + /* Called to update highest performance on firmware notifications. */ + void (*update_highest_perf)(unsigned int cpu); + /* optional */ int (*bios_limit)(int cpu, unsigned int *limit); From patchwork Mon Oct 9 02:49:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Meng, Li \(Jassmine\)" X-Patchwork-Id: 731778 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 D43EAE95A99 for ; Mon, 9 Oct 2023 02:50:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345058AbjJICu5 (ORCPT ); Sun, 8 Oct 2023 22:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345052AbjJICuz (ORCPT ); Sun, 8 Oct 2023 22:50:55 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2080.outbound.protection.outlook.com [40.107.220.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 345E1C5; Sun, 8 Oct 2023 19:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iZZoQ8ovO6XNnTvPSCImnd7vIUbPQx8TV79HjD27EqjeEvsOC+cj6lBfU+LVm3XWOcua3myAivqPysTJbkJnfKdusaVzAr2hCdDDSWPyhuDUnT5JaJyGzZAu0g4WdLkzjx88cNkaimR7UhaW82eAD68HvfmkBWpkYnJzyJDRBm4Lme2+zpTwwidL4GcNY+gBtdOt0GwwRRQ58KTFd11Dj8kKHJ8yOUqkgal2B0z+ZDdRofYvxnlp/ag4PMkL0ZRVeiWCQuVDPPqB38qKGVQftrNobDyRIeffiiV/qyXh4ZQIZdpMvL2SGi6cFn6dbRq61MDPY+iSvPCK8wbttW5lRA== 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=suDPF+jeyHyeW96r+6eTe34BdnM0xUMLOfDEhPfEl3U=; b=e1/othshb3eCysD6tu5Azp5586IT1UfdClErVNSakJIseq7Exu0pRz6UKLDPxN40IVB8xzRpldkCII0YNO/I0eBNxs3Ctqi9TFPx3zXvgCAsesBcSiHqjARtDRJcOpbsWltnSml+Jr4P26BpcuI+BGDvSWeYQFBmD2QQsX9J8mVMJwo/VnkpX3SCGMmQNjqqLo8I4K6THqj9HfzsyL59kaXXNqa12lWsSP7YV21GP/sxV42t3EM2sgu7v/3Bk67Cpam4imfw+FBnRD2zOTp4yZwPCtKpPVIxLub1qE8ni92gjEQKr0a3IgUeC6g66RHbGuobVm3tPUHOJwoYO6s/4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=suDPF+jeyHyeW96r+6eTe34BdnM0xUMLOfDEhPfEl3U=; b=kwcGlRW/d1WO6yb61gJ+s7VLP+sPZxj4UpAvTq0qVNXUPbSRlR4HMXOIe8D/FoUk64ydjRS1JRegb989DoQjuZI+d78aRJYVHjHEYBCZOECyiQEWs1W5RWoerQBkl6UI9IxnVS/njS47JooBj4jA35wyKwJOgo2X/zUXQHOHDl8= Received: from MN2PR22CA0020.namprd22.prod.outlook.com (2603:10b6:208:238::25) by MW4PR12MB5666.namprd12.prod.outlook.com (2603:10b6:303:188::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Mon, 9 Oct 2023 02:50:50 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:238:cafe::23) by MN2PR22CA0020.outlook.office365.com (2603:10b6:208:238::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Mon, 9 Oct 2023 02:50: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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Mon, 9 Oct 2023 02:50:50 +0000 Received: from jasmine-meng.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.2507.27; Sun, 8 Oct 2023 21:50:44 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li , Wyes Karny Subject: [PATCH V8 5/7] cpufreq: amd-pstate: Update amd-pstate preferred core ranking dynamically Date: Mon, 9 Oct 2023 10:49:30 +0800 Message-ID: <20231009024932.2563622-6-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009024932.2563622-1-li.meng@amd.com> References: <20231009024932.2563622-1-li.meng@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: BL6PEPF0001AB4D:EE_|MW4PR12MB5666:EE_ X-MS-Office365-Filtering-Correlation-Id: 8aabc7bd-f99d-4aef-96a6-08dbc8728bde X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A52HU1fduQjBgxTPKCVRceY9qMxYINvoe6OAlYcieKo9GGFm/jUPez16mrA2kXO/2c+UbRzgeWURVCQsHXsprGdjHm1CzVdrz9eBCYctKs1K0WNELMKO08a09KWQLj6QviDrG9GEqhU1jPbNd5MVP1II/kBXeS6aCL7UPRhRnxajvp4aB3zmiBRPhmgUF9odmBrz3qp3tO3/fjg6S9zwMV68MfFlKUwH4RnGkKdOu4zCgXpV3CplUtFXS+v2rhTMdT0uNKKtVt14AI/ZmvtdclG3SV6VE8V2bWAwQYrWKAiztPrb6mF8weCi1Ab7Aw40JAUa2ghCieOsr48QiaH0g5Ig5vF5rAONQhljDXP7MkA83jeGbVlzswTeEeKrMcpmVib4IkqZr1JhIW2njr3KPdHoxQpC8RL4rB0V1ID8FYh2TQ/lOkuVrD9CkAxBtVn9CtLhKVIVco7cSBQ9HWGNHyqZOo1qVHCPaBwyEiz61AE+d16ZzfEw+rvoNqI37kLjvksSxYC/MKk2u6dbbqdnKrFYm14+7Z9/hJnatsRyYhrOvrYwZZwpL2L5dj4H3iW2sEcOuSLhNIIG3i699Cne+SjCLvo41A8dBAtw3IqOMBmzMioseG+bYY04kCuQmrY3wVqEGUcvYv94DQGXnw7FCM6GkeaDHrbnB0AIjSjzBdLh7GsY2US9cmylY7hMide+WScPeBxsJhBI31Z2pMM/VcY21qRiwjV0I/GgejOoZYl2MhtpDdcPuM7+tXR0wwxDHtMDelfeJROjn8nJ2pxzvQ== 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:(13230031)(4636009)(39860400002)(136003)(396003)(346002)(376002)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799009)(46966006)(40470700004)(36840700001)(40480700001)(66899024)(40460700003)(83380400001)(1076003)(2616005)(336012)(426003)(26005)(16526019)(47076005)(36860700001)(54906003)(70206006)(70586007)(110136005)(316002)(6636002)(8936002)(8676002)(4326008)(5660300002)(41300700001)(7696005)(6666004)(2906002)(15650500001)(82740400003)(478600001)(36756003)(356005)(81166007)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:50:50.1035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8aabc7bd-f99d-4aef-96a6-08dbc8728bde 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5666 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Preferred core rankings can be changed dynamically by the platform based on the workload and platform conditions and accounting for thermals and aging. When this occurs, cpu priority need to be set. Reviewed-by: Mario Limonciello Reviewed-by: Wyes Karny Reviewed-by: Huang Rui Signed-off-by: Meng Li --- drivers/cpufreq/amd-pstate.c | 34 ++++++++++++++++++++++++++++++++-- include/linux/amd-pstate.h | 6 ++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 6ac8939fce5a..d3369247c6c9 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -313,6 +313,7 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) WRITE_ONCE(cpudata->nominal_perf, AMD_CPPC_NOMINAL_PERF(cap1)); WRITE_ONCE(cpudata->lowest_nonlinear_perf, AMD_CPPC_LOWNONLIN_PERF(cap1)); WRITE_ONCE(cpudata->lowest_perf, AMD_CPPC_LOWEST_PERF(cap1)); + WRITE_ONCE(cpudata->prefcore_ranking, AMD_CPPC_HIGHEST_PERF(cap1)); return 0; } @@ -334,6 +335,7 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) WRITE_ONCE(cpudata->lowest_nonlinear_perf, cppc_perf.lowest_nonlinear_perf); WRITE_ONCE(cpudata->lowest_perf, cppc_perf.lowest_perf); + WRITE_ONCE(cpudata->prefcore_ranking, cppc_perf.highest_perf); if (cppc_state == AMD_PSTATE_ACTIVE) return 0; @@ -540,7 +542,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu, if (target_perf < capacity) des_perf = DIV_ROUND_UP(cap_perf * target_perf, capacity); - min_perf = READ_ONCE(cpudata->highest_perf); + min_perf = READ_ONCE(cpudata->lowest_perf); if (_min_perf < capacity) min_perf = DIV_ROUND_UP(cap_perf * _min_perf, capacity); @@ -760,6 +762,32 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) } } +static void amd_pstate_update_highest_perf(unsigned int cpu) +{ + struct cpufreq_policy *policy; + struct amd_cpudata *cpudata; + u32 prev_high = 0, cur_high = 0; + int ret; + + if ((!amd_pstate_prefcore) || (!cpudata->hw_prefcore)) + return; + + ret = amd_pstate_get_highest_perf(cpu, &cur_high); + if (ret) + return; + + policy = cpufreq_cpu_get(cpu); + cpudata = policy->driver_data; + prev_high = READ_ONCE(cpudata->prefcore_ranking); + + if (prev_high != cur_high) { + WRITE_ONCE(cpudata->prefcore_ranking, cur_high); + sched_set_itmt_core_prio(cur_high, cpu); + } + + cpufreq_cpu_put(policy); +} + static int amd_pstate_cpu_init(struct cpufreq_policy *policy) { int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; @@ -926,7 +954,7 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, u32 perf; struct amd_cpudata *cpudata = policy->driver_data; - perf = READ_ONCE(cpudata->highest_perf); + perf = READ_ONCE(cpudata->prefcore_ranking); return sysfs_emit(buf, "%u\n", perf); } @@ -1502,6 +1530,7 @@ static struct cpufreq_driver amd_pstate_driver = { .suspend = amd_pstate_cpu_suspend, .resume = amd_pstate_cpu_resume, .set_boost = amd_pstate_set_boost, + .update_highest_perf = amd_pstate_update_highest_perf, .name = "amd-pstate", .attr = amd_pstate_attr, }; @@ -1516,6 +1545,7 @@ static struct cpufreq_driver amd_pstate_epp_driver = { .online = amd_pstate_epp_cpu_online, .suspend = amd_pstate_epp_suspend, .resume = amd_pstate_epp_resume, + .update_highest_perf = amd_pstate_update_highest_perf, .name = "amd-pstate-epp", .attr = amd_pstate_epp_attr, }; diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index 87e140e9e6db..426822612373 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -39,11 +39,16 @@ struct amd_aperf_mperf { * @cppc_req_cached: cached performance request hints * @highest_perf: the maximum performance an individual processor may reach, * assuming ideal conditions + * For platforms that do not support the preferred core feature, the + * highest_pef may be configured with 166 or 255, to avoid max frequency + * calculated wrongly. we take the fixed value as the highest_perf. * @nominal_perf: the maximum sustained performance level of the processor, * assuming ideal operating conditions * @lowest_nonlinear_perf: the lowest performance level at which nonlinear power * savings are achieved * @lowest_perf: the absolute lowest performance level of the processor + * @prefcore_ranking: the preferred core ranking, the higher value indicates a higher + * priority. * @max_freq: the frequency that mapped to highest_perf * @min_freq: the frequency that mapped to lowest_perf * @nominal_freq: the frequency that mapped to nominal_perf @@ -73,6 +78,7 @@ struct amd_cpudata { u32 nominal_perf; u32 lowest_nonlinear_perf; u32 lowest_perf; + u32 prefcore_ranking; u32 max_freq; u32 min_freq; From patchwork Mon Oct 9 02:49:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Meng, Li \(Jassmine\)" X-Patchwork-Id: 731333 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 68658E95A8F for ; Mon, 9 Oct 2023 02:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345083AbjJICvH (ORCPT ); Sun, 8 Oct 2023 22:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345066AbjJICvB (ORCPT ); Sun, 8 Oct 2023 22:51:01 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2044.outbound.protection.outlook.com [40.107.100.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC3F1F1; Sun, 8 Oct 2023 19:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P5mjqGb1RzA34vc/x6B2DPqMnn2PKmOFHqlmQVRQj2Sl9YrHzXi3iBei0Xf3d9HqLQ0MIqQJDUZ0lxVf1cxf/+IwHxwtDn6XYOM6aN4qtedMQPw8Au6keDGKgfkbcZuCPXd1rjUzfXu7/iTZcrsPpcLaah9ug+qYSJXmX1cOgamWW85llRPlXGy5uVz/33doIzEqBozTI+6+F8RBv5z/dDmgiwp+Ey83nOyqR79ayaAWveK7O67lKmp3zjGeNfLNiXTnk14KCju85U6tutgPrf/o0mdQz3Kgh29uCMjWuZJ4hxCnXk6uLbF2FvF4qKgWKorBr6abLlwYG6yqQM+sxQ== 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=9OK1yS43YQ3sOBQqS3fVNjmQ7kYIlNFL+i2jNaV7o10=; b=NIXqDndpDYCzS2j72swvaNf2ikWHea685cdKkz0GH/zfJ3N0vsflLUh13yM9LolCu0e2Sa2iZBRpBq9662kiVUhMyH3792drkEcytt4rjC42i72tfjr36vbXS6A22QyaY6nNh68UEbMWSZH4C/BVmO7ww6EbpgWZumdd4pyJV6Tq6tw3FAsw9ryVQ9BLrjHvrGl8uxCQHjdm9pPJ/jQsiJa4neHSxqPfQq7GvicuK/2dcgG1E/+9qWPFJGva9ErhZenOKDGFFffS5nZF9W8D/tBQx0S/1y/weWdK7fzik8fVs74m+8nQuYgu0KIAQU5Ez7hLxQ3RAdbfM3NwDUuxxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=9OK1yS43YQ3sOBQqS3fVNjmQ7kYIlNFL+i2jNaV7o10=; b=EPw2AIfzUqUkCMl1TYra8mmwxWgfujDzUNdXjyQLO/CVMmICMaCrAzUcW6c6p6eN3aMal5kO9HhIh7mH7EPiflqk/gvmDylIFcAzJevf82h0JqJQgmt+tSef4nwdLzre2+7lY9r98J1iHm7uM/cdA3f4ZDAwaRinOLzjLTQgqqM= Received: from MN2PR05CA0006.namprd05.prod.outlook.com (2603:10b6:208:c0::19) by PH7PR12MB8828.namprd12.prod.outlook.com (2603:10b6:510:26b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.43; Mon, 9 Oct 2023 02:50:55 +0000 Received: from BL6PEPF0001AB51.namprd04.prod.outlook.com (2603:10b6:208:c0:cafe::86) by MN2PR05CA0006.outlook.office365.com (2603:10b6:208:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.20 via Frontend Transport; Mon, 9 Oct 2023 02:50: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 BL6PEPF0001AB51.mail.protection.outlook.com (10.167.242.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Mon, 9 Oct 2023 02:50:54 +0000 Received: from jasmine-meng.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.2507.27; Sun, 8 Oct 2023 21:50:49 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li Subject: [PATCH V8 6/7] Documentation: amd-pstate: introduce amd-pstate preferred core Date: Mon, 9 Oct 2023 10:49:31 +0800 Message-ID: <20231009024932.2563622-7-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009024932.2563622-1-li.meng@amd.com> References: <20231009024932.2563622-1-li.meng@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: BL6PEPF0001AB51:EE_|PH7PR12MB8828:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c90555f-8308-4450-d7b9-08dbc8728e76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kQLNwCeq8shFiIlObe6d/oc/ujfldpCD2gXhD7NB4+7/0nEJJ3HCiTTRTl7WGzVOKQdTXNS6xbuUYmoXSv0mY+zAq1/u337ftbIWekPCI9FuTA4mS3PRIgGSK+yIo6o1bnveEfaKdnfS4XxqzQ0QS8mqMzsQhfaFdaDYQ2Q/3TQ8Tep6zWWU+qFwu3ZuR3uIYhWw91+gGwfKmSkLc8kRFzqE57bnOxympBmZMP5sBM8CNl1HuPJLmlsusa5iqCKtPGrvq0x+3pihcBlIxE9RTl4AWHoe+o3MZ/BwHJTZHQkuNuksICsxpuPmJsPrkksD5BCkcmedTybYRTVsz/p2p025d97RRbaJaQFLEcJwkTlp0pbBDBE1qHY3SnVGK7+GKbrKk7eqGtnYrmX5216Y/5Z5ORCknf3HJWGTtO5Kl1KoklBGHK822uJ9ZzvogNKioWNQb5GQQj9Cef8nuFpzlh+Ngx+Eju4ydtXPlO+aww2+lHhjvIPpGWYF0fczKVzuG3menj+il7HY61MslJR4db8CNcyojtL4sQlN2iiYhB9xPQM8HPp5wy8LXWR5RtbkpIHS/Sc5EA7Nzkxq05GCYu1+N9IVxtSY8cB4GeVSAt3OZyRyVmDHtILE2IfA++SCcbxJD5PxyssGQOkrpvaD/4+qjd0Oto7bJs8dIx7bupByTsMMF4nhpp3MLUrEkLHvvGzrE13I/mpkymgqIFgWgKDIuxtuwrfU8ZDFNK4OiH0k29zNLNc1gqwxd7po64Kn519INIAS4zy+1soXjeMUqw== 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:(13230031)(4636009)(136003)(39860400002)(376002)(396003)(346002)(230922051799003)(64100799003)(1800799009)(82310400011)(451199024)(186009)(46966006)(40470700004)(36840700001)(2616005)(1076003)(16526019)(426003)(336012)(26005)(54906003)(70586007)(70206006)(110136005)(6636002)(2906002)(83380400001)(40460700003)(86362001)(36756003)(47076005)(36860700001)(7696005)(6666004)(478600001)(5660300002)(8676002)(8936002)(4326008)(316002)(41300700001)(81166007)(40480700001)(356005)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:50:54.4724 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c90555f-8308-4450-d7b9-08dbc8728e76 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: BL6PEPF0001AB51.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8828 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Introduce amd-pstate preferred core. check preferred core state set by the kernel parameter: $ cat /sys/devices/system/cpu/amd-pstate/prefcore Reviewed-by: Mario Limonciello Reviewed-by: Huang Rui Signed-off-by: Meng Li --- Documentation/admin-guide/pm/amd-pstate.rst | 59 ++++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 1cf40f69278c..0b832ff529db 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -300,8 +300,8 @@ platforms. The AMD P-States mechanism is the more performance and energy efficiency frequency management method on AMD processors. -AMD Pstate Driver Operation Modes -================================= +``amd-pstate`` Driver Operation Modes +====================================== ``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode, non-autonomous (passive) mode and guided autonomous (guided) mode. @@ -353,6 +353,48 @@ 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. +``amd-pstate`` Preferred Core +================================= + +The core frequency is subjected to the process variation in semiconductors. +Not all cores are able to reach the maximum frequency respecting the +infrastructure limits. Consequently, AMD has redefined the concept of +maximum frequency of a part. This means that a fraction of cores can reach +maximum frequency. To find the best process scheduling policy for a given +scenario, OS needs to know the core ordering informed by the platform through +highest performance capability register of the CPPC interface. + +``amd-pstate`` preferred core enables the scheduler to prefer scheduling on +cores that can achieve a higher frequency with lower voltage. The preferred +core rankings can dynamically change based on the workload, platform conditions, +thermals and ageing. + +The priority metric will be initialized by the ``amd-pstate`` driver. The ``amd-pstate`` +driver will also determine whether or not ``amd-pstate`` preferred core is +supported by the platform. + +``amd-pstate`` driver will provide an initial core ordering when the system boots. +The platform uses the CPPC interfaces to communicate the core ranking to the +operating system and scheduler to make sure that OS is choosing the cores +with highest performance firstly for scheduling the process. When ``amd-pstate`` +driver receives a message with the highest performance change, it will +update the core ranking and set the cpu's priority. + +``amd-pstate`` Preferred Core Switch +================================= +Kernel Parameters +----------------- + +``amd-pstate`` peferred core`` has two states: enable and disable. +Enable/disable states can be chosen by different kernel parameters. +Default enable ``amd-pstate`` preferred core. + +``amd_prefcore=disable`` + +For systems that support ``amd-pstate`` preferred core, the core rankings will +always be advertised by the platform. But OS can choose to ignore that via the +kernel parameter ``amd_prefcore=disable``. + User Space Interface in ``sysfs`` - General =========================================== @@ -385,6 +427,19 @@ control its functionality at the system level. They are located in the to the operation mode represented by that string - or to be unregistered in the "disable" case. +``prefcore`` + Preferred core state of the driver: "enabled" or "disabled". + + "enabled" + Enable the ``amd-pstate`` preferred core. + + "disabled" + Disable the ``amd-pstate`` preferred core + + + This attribute is read-only to check the state of preferred core set + by the kernel parameter. + ``cpupower`` tool support for ``amd-pstate`` =============================================== From patchwork Mon Oct 9 02:49:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Meng, Li \(Jassmine\)" X-Patchwork-Id: 731777 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 262D9E95A98 for ; Mon, 9 Oct 2023 02:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345078AbjJICvK (ORCPT ); Sun, 8 Oct 2023 22:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345081AbjJICvG (ORCPT ); Sun, 8 Oct 2023 22:51:06 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DE8EDB; Sun, 8 Oct 2023 19:51:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcO88dDW9r5MdvwdyHWHoyK0MaDM/3qMjsWBqOmVOVocqanFi+aNFFjthqWGmXIKLWFN8Oa/YjqAFoACkJuBCH0drN93mt347js2EXCKDn7Q0BbSOcgaFaMf5BxFnmzppA7aM7G0E6hUVeCfZjz8Xkyng6VDasKWsewhe4Dyzc7YV3AElI6U1vv30OiLRJoSLjmVmup2COfiKTQva3hGROkEKjxLhrs/SPcQSRHjCRNQyDoO1ULLKmnLGrsjA/NUrphGqAULEPpzRH3jlyiuOTUBIw1KbljSLl5LSjk7wASyUa4+WivAqMEf/7buQ3pVCH1APqZOLNtXg3y7lMF5ug== 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=hneoerr6yrWBbKcNzxSGDk6ANxsTr+qLx51Zn6rqXUA=; b=my+ubAc0TU2ZdDfSJu4irmAI+Sot4f2LCyGyXdGy9tbgsMNMtiywBryNBtScRNm/0he11/3uI/XeAc8HQQzyXuWcGuxjBce8u7C6hBQoOMuh2HpZ9ujkupC1ykg74QJcaNaHZ05iCmgaXqenGjDAbBbs5e3Xs5V4/+WiAD8g6DFv/IEeDRNxYAu/NTweO/jA+H04XI+nbxLHtwgdWGE1BtH9extyDnAPfQpE4thmsP3sK6agPbwO+VhTlE8ZF55ahu0bEyHR1gF2FTrvG6kP9JtheF/KJGMtvRsTDsu66+W8ldQdJZ6SFFUNvwYxfMQtONy+LGfjmT/7JmMajTQQ4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=hneoerr6yrWBbKcNzxSGDk6ANxsTr+qLx51Zn6rqXUA=; b=kwyuyb65zt32N5f2FeNSLr6hVmqYwQeqV1SuD97TStcGaMW9pOqpAidspU3RAu5tuG3hMl8BT3/cBeGtfDp6F5fm0vwJiHtTQlGe48PffqW+iDbIhLraxzdWJe/slhf8WoeZlkdY2wN1FHkkk5pM4LTe45glpQNt+fcar3214fc= Received: from MN2PR20CA0019.namprd20.prod.outlook.com (2603:10b6:208:e8::32) by CH3PR12MB8483.namprd12.prod.outlook.com (2603:10b6:610:15c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.35; Mon, 9 Oct 2023 02:50:59 +0000 Received: from BL6PEPF0001AB4E.namprd04.prod.outlook.com (2603:10b6:208:e8:cafe::fb) by MN2PR20CA0019.outlook.office365.com (2603:10b6:208:e8::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36 via Frontend Transport; Mon, 9 Oct 2023 02:50:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB4E.mail.protection.outlook.com (10.167.242.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Mon, 9 Oct 2023 02:50:59 +0000 Received: from jasmine-meng.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.2507.27; Sun, 8 Oct 2023 21:50:54 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , Meng Li , Wyes Karny Subject: [PATCH V8 7/7] Documentation: introduce amd-pstate preferrd core mode kernel command line options Date: Mon, 9 Oct 2023 10:49:32 +0800 Message-ID: <20231009024932.2563622-8-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009024932.2563622-1-li.meng@amd.com> References: <20231009024932.2563622-1-li.meng@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: BL6PEPF0001AB4E:EE_|CH3PR12MB8483:EE_ X-MS-Office365-Filtering-Correlation-Id: fb4bae77-f719-4c60-2102-08dbc8729148 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dPs+KhFcmpizslPneYl4k62+j3RQm0cPBB9/t5cTRrWHRlTpwbOnq6aY91cXXsYAcKT0sHpF++zrrDuhs2FZnB2Ct6QG33SIIX2sWY7IQV3+XVVSXqHK015/O+2pmu77s+rqtcMIkVFHj3vSyrUN6gt8rJSOLky7242Xhcc7tUvbexI+jRxwFwDE7H86Y/6sQX2HxYZ4iJ7/GIBjU4QYA4W4ujIFdgvR4r27HPbxmDoHCEgvPGRdfQgkdSmPL0LMp+4k9ml8sUQ1G+PrKYn1beANMIh5yvK5hqeNYcSnaZcDQc2+SbSt1pIShmK+VBkDTf5/Q04I6/xufCYjSAWBBdda8djtibIWqHA+WfGs7g0sQ0UuS6IU/9nwFfDg5SdSlAcKbpQZZsPInT0+y1pcOgw4YSzUIHigR3bdF3IP2OGSdm0rorPY2eeL4+DPiSybVvcL7rSK3D0newKXe46cSTAjBmY81ZnS7v35rrxjsYtGlra+bTMRYhvIolhkLYUR+PnLn4LayCgtHKD4QIOydFckWwyjJJyJ/79ytCcnspnUAyqPCvw3Qt+ZrVOp+xFIN+GnLYwvHO5Rd/GfP2ZldW4XqyDvoKbWGEoa2mxQfJDdBtapTOGgFUaVMEt4GEr1OfbkIBXe6OmH37WnA6j0+orR76Uxq6Y6EoFLnusAA9hto3ofwHZq2c2V0QLiMGZuRYRS4vYU7qSpkt4YsG7/L4YlEU5RmLFgo7ThE4e8/TbFnZnRf+//YQrr+wUx4Slh23EhCn7yPHofBQTaRjhDFX0sTRBu+KZXYSJQABDk+cYepjrsz0z4oj0e6Kx9B9LJ 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:(13230031)(4636009)(396003)(376002)(136003)(346002)(39860400002)(230922051799003)(82310400011)(451199024)(186009)(1800799009)(64100799003)(40470700004)(36840700001)(46966006)(336012)(1076003)(40460700003)(7696005)(478600001)(6666004)(26005)(86362001)(82740400003)(2906002)(356005)(16526019)(81166007)(36860700001)(316002)(110136005)(6636002)(83380400001)(2616005)(426003)(41300700001)(36756003)(8676002)(40480700001)(70586007)(70206006)(8936002)(47076005)(4326008)(5660300002)(54906003)(36900700001)(14943795004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 02:50:59.1838 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb4bae77-f719-4c60-2102-08dbc8729148 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: BL6PEPF0001AB4E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8483 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org amd-pstate driver support enable/disable preferred core. Default enabled on platforms supporting amd-pstate preferred core. Disable amd-pstate preferred core with "amd_prefcore=disable" added to the kernel command line. Signed-off-by: Meng Li Reviewed-by: Mario Limonciello Reviewed-by: Wyes Karny Reviewed-by: Huang Rui --- Documentation/admin-guide/kernel-parameters.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 0a1731a0f0ef..e35b795aa8aa 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -363,6 +363,11 @@ selects a performance level in this range and appropriate to the current workload. + amd_prefcore= + [X86] + disable + Disable amd-pstate preferred core. + amijoy.map= [HW,JOY] Amiga joystick support Map of devices attached to JOY0DAT and JOY1DAT Format: ,