From patchwork Mon Mar 18 10:11:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13595190 Received: from outbound.mail.protection.outlook.com (mail-bn8nam12on2052.outbound.protection.outlook.com [40.107.237.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A8D1381BE; Mon, 18 Mar 2024 10:11:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756700; cv=fail; b=FgEU5VYrvfe6klOJdRc7C1tZYzH7NAl2S9fUepZcPPcEJZ7+QmgAQSV7a9GLqjq6cVvNAP5SHJOeL37LFrGuWuJEb8vwyyWlHVndbcvlUrrGtFEEgwYJlN6GfmICCpPCqCLzZREbuqlh8hQd3AY4V3lXC3M6aYkiqMVKRr9lE74= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756700; c=relaxed/simple; bh=/Ws93YPfQEKtzmeaXIjFwmKBI9PXsY3tbO6nBDCtKg8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=haV7GER32m8JrpJ3B5qUgrEwxhRmWF+KiMkBA6iqCyE8yO2H4dIpdB9KqrGAfFb6uv8mQoIBhmQyzPIXEnQZTsqaL4L2f1GCshTr30iYN/8nQulTVpEoUOu8jjNCl1A2MzVJz6/21TXZFvzE8CerJCT0Q/ua4I1BEXv6GMu1wEA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=llbUZNTd; arc=fail smtp.client-ip=40.107.237.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="llbUZNTd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NS5HqI+DzxVeZWgTV3ZyPzipjQzrd0dbtFZHFIXMLHb2B/G+MZj7aMCkbWMH3k4pSFgG464vrmfUwibE09WOAEBl+fkZCuLxvaoWZD5D4Oq6UYvLAhWWdexZOFsGT0JthXj1gjhzAWAtS/2sB5TzZJVRXoAvlORFyZ30mSkjjScuiqVYWLFYBrauobm4rxEstz914nTmcpmSHPXutsW/RhzTrr9wTapuPUPn2atTc91e6dc/AlRc6SrKHWBNaKbBWfZIYaOPCTeXwZ8RAYq+WlSG4Pzh+OrfHeaqN7lfuBxPtO6EIROTn37SR7ouqBMeX9xYK+I/Jk8jkA6TkjukqA== 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=CBbk054G3uTAd40lzenfkFawnSHZZ9Uc9Lt8FKpIt+8=; b=QLeNgAVa+65tL1JWH7EtCL8WaKMwlBfCVtXw3namaldZ35Vt45bMlx6nmT35aJdJ1v02Jy9twaSB24TtR1HTSEu3joM16u8N72MKT3hjR30V0pGgh5O88+GtYUpLZ9hSeAukCZRb3NBIYiSuqr6xKA8iSzWtAGMKrKTI30rYKBNIlmjUwBdFgdjImKE7ezZ/DKYOdPsYxfR3mWi1pP3DLbd66G18kj/rstbMQKn2L8kR9AsQLVEI8DrsqGQTnxlR++2EYqlMEYQEangcpJAqXCZuJ2AYecXG1FZEX+ScT2kVJFuZ+4KqU2dxUvI8A+SguqNSoMGYtVOLhfnrKsq2Yw== 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 (0) 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=CBbk054G3uTAd40lzenfkFawnSHZZ9Uc9Lt8FKpIt+8=; b=llbUZNTd161K0bL2TrdLwALzn/6tmrSt6hUf2ztBmANGlECzYtVt836IH6PJU5g2Kh7WIrTlkpESAJGTkIs5shHpAIIltTiM8G7/IS1QIYEVN74e1Hg0Fq5Z5J1297txwtHmg7CxG5gv8rxMyoN3JpIAYg1m00jvaANl+NenfTQ= Received: from CY5PR15CA0171.namprd15.prod.outlook.com (2603:10b6:930:81::17) by IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27; Mon, 18 Mar 2024 10:11:34 +0000 Received: from CY4PEPF0000E9D4.namprd03.prod.outlook.com (2603:10b6:930:81:cafe::b8) by CY5PR15CA0171.outlook.office365.com (2603:10b6:930:81::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Mon, 18 Mar 2024 10:11:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D4.mail.protection.outlook.com (10.167.241.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Mon, 18 Mar 2024 10:11:33 +0000 Received: from pyuan-Chachani-VN.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.35; Mon, 18 Mar 2024 05:11:30 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v6 1/6] cpufreq: acpi: move MSR_K7_HWCR_CPB_DIS_BIT into msr-index.h Date: Mon, 18 Mar 2024 18:11:08 +0800 Message-ID: <8e617be2b0eef88781973e16a98aac6a4a08d664.1710754236.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D4:EE_|IA1PR12MB6163:EE_ X-MS-Office365-Filtering-Correlation-Id: 812d02d9-4d94-4256-d0ba-08dc4733c9f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s3KMPpKITetCKNEmAlQSlTAvHLj52R1pd2k96ZtKS5PiKQ6WP6h0NRQao+TaNcNj6n04Oc8joiZiWUdDWSzyNwAiOTIyncXLT675Mm2GrhJsx6M4AEJBDtOjaHaRcA9d/U6NGPop4mJiJqPgjgvB03lYxPJBCDHSPVanPULaQ1wVpEonTa6AlNnX6ST59v1n/2S2bI9JRnKDMheYH1XaLaYLD7FSZcVOFN9BwQZ6Sw5164gFI9uXNmPk6+aTN7LWNGvgzva08r+EjPqCC/lpvcRPkPhn1LRoEryoNocmEAaJB4Ry0NG1OaU8nOMMY+jyLTK4wqNHRk+9Ufbp+Yobyon60QcwFr9hQbYFjbPago0SSZUXPWh2ENPMU8xas2H+EiVx1wRWZzQi+gBliLInyFgHmTBNQmMMDkW6JZiVOGm0cQeW3Pi6mFzRcG/jNuc9J8LnyfNBoFKr6SLXh7DPJ5t1b9dA7BQ5XhIJBrjGes+sCFqiLl1YfwHzSPuZjvib1C9tJh61fEEyEjaxrByVO3y/3SG7QrvK3wWawY2bOfmJlY/XaJQU4NECNI/BLMJSAHWduusYAamd1KlaO//YEFD5SYj+iY1LHvgOO23P8b2+1Os/CBJOeEYd7WT6JX/Yr5eCNQazxMA2TSNqpJigg9FGUe4TP0YD+/YNw6aPWVWhSpKPawGr0arUw8ayI3kj3FCAWBoIF/eyT6TdE52kZLX2dhE9fUJEjmy+BvncZGYFj3O8MFoMQSHJMr01JDV7 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)(376005)(36860700004)(82310400014)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 10:11:33.6105 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 812d02d9-4d94-4256-d0ba-08dc4733c9f8 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: CY4PEPF0000E9D4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6163 There are some other drivers also need to use the MSR_K7_HWCR_CPB_DIS_BIT for CPB control bit, so it makes sense to move the definition to a common header file to allow other driver to use it. No intentional functional impact. Suggested-by: Gautham Ranjal Shenoy Signed-off-by: Perry Yuan Acked-by: Rafael J. Wysocki --- arch/x86/include/asm/msr-index.h | 2 ++ drivers/cpufreq/acpi-cpufreq.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 05956bd8bacf..41503647192e 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -775,6 +775,8 @@ #define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT) #define MSR_K7_FID_VID_CTL 0xc0010041 #define MSR_K7_FID_VID_STATUS 0xc0010042 +#define MSR_K7_HWCR_CPB_DIS_BIT 25 +#define MSR_K7_HWCR_CPB_DIS BIT_ULL(MSR_K7_HWCR_CPB_DIS_BIT) /* K6 MSRs */ #define MSR_K6_WHCR 0xc0000082 diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 37f1cdf46d29..2fc82831bddd 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -50,8 +50,6 @@ enum { #define AMD_MSR_RANGE (0x7) #define HYGON_MSR_RANGE (0x7) -#define MSR_K7_HWCR_CPB_DIS (1ULL << 25) - struct acpi_cpufreq_data { unsigned int resume; unsigned int cpu_feature; From patchwork Mon Mar 18 10:11:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13595191 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2089.outbound.protection.outlook.com [40.107.93.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB8E2381D2; Mon, 18 Mar 2024 10:11:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756701; cv=fail; b=WZeM7QXNOSZM0tMRHYVSRjgscqF6I4G5zoWsQqpLRnr5d5RpumZh8Vh70wkGqZNZSObvV5xY115GNsr66byHIj3X8GIFP8/iIe9HBO2DlKLc45s8ms8EJ1KRz40hbb3QheWel3YZxCXeihA+nCOYK4lgGq0ARvhRVe4OUsC5HGw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756701; c=relaxed/simple; bh=hIgkKPGWKmHXc+BKPCad2ibEcDx3MTToS1XTi/GgqfU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T7f60wXxK++gjKt6hGflPZdtchdMER1LIfa2OIv5/OZPtV932x6BR8orLnYmUeUpJTKt/wotJ7FJYGgWlqrBmTjQ2TpLwZdbB6xlZMD1FkKkQTAoXUs2edHp8nN/EcIpzVdGaZ7jpZ0u0nnGEBYRPC8RR1GUohMd0X2/lL4EvYY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=oSQNbFGn; arc=fail smtp.client-ip=40.107.93.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="oSQNbFGn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZkQ7PMeAny9sxmrvK0E6Xa3Pg/tGMinpU1/OOFFw8p17OpGuBL6iK4FPvyh2U4OKfCIo8D+2G+fnCR5DAMGnUQfDWcHk2hGXVjIL5Xq8N51Hv8OQu2Itb293urUDIPa+6F6zvXi3laxW07yC1ZBHe++G6mU8I4jESV3kxD0YL2daqVt/0ha38mTCb+dBaABfjp06qV2oqXyeTm0+w/bn2Lu0gsfzfhv4xhRo/JoJ9v5BxkjsTsCce4vMGySFMDlx8M1U4hY27PIcFX22HxXyXpvzosBu6W0Wcv6XiNcEiKy4ZmSfx/hDyDwVpxtIMxIAWLWfncrFazH2hYHab52Mlg== 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=EMs0KvCpm4U0E+rO8pCfFaT8EYmEqu7q3795v0kApnQ=; b=jEb/CjI20N2i0K6bZeT1+fpjWowML9h+rBE50+Dx0oI7K9vCRjV0EDk7XJL6etY7lhMzVB5eQdaRLyD6qxylpdNYmdqTaFZTmSCSBNmWlZrdW4Ql9UbwpTTSkdiKdIHu/BjmzXKPZuse9IGsWmuZzDnO+nR1hYgsIfYE1p/lNqoTsRQGjtKl3hg7DNvSeCTJ7bAit8p62ik3grv6vWNrB8A3EbIrW6Yn1Hofli5W2ii7WZsICNk3ubQY6p2NgveFvzphG86ObTQI04Ehip5TKdMJQqmC4HX7FIW2E2jt/F8mjoTo5nRNZnU4sOH+M16pJfv/OWp698zR+ewSFKhjuw== 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 (0) 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=EMs0KvCpm4U0E+rO8pCfFaT8EYmEqu7q3795v0kApnQ=; b=oSQNbFGnPKSNaJ6+NYDJmYM+1wURCvKu+wF45eYqqGo07xV3MEtfBFFqYZGbrX+UcXZGjcdm6LGZFQPpiGRovRn7rA5OHyFOS+N0oaf1bKLPRGTTnxHjM9hN0Wa7gQfNBBRYgV1uQUxi6f+ItddLZbNG0hSDDdM2lO2BVD8SZ8g= Received: from CY5PR15CA0185.namprd15.prod.outlook.com (2603:10b6:930:81::24) by DM4PR12MB6424.namprd12.prod.outlook.com (2603:10b6:8:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 10:11:37 +0000 Received: from CY4PEPF0000E9D4.namprd03.prod.outlook.com (2603:10b6:930:81:cafe::99) by CY5PR15CA0185.outlook.office365.com (2603:10b6:930:81::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Mon, 18 Mar 2024 10:11:37 +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 CY4PEPF0000E9D4.mail.protection.outlook.com (10.167.241.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Mon, 18 Mar 2024 10:11:37 +0000 Received: from pyuan-Chachani-VN.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.35; Mon, 18 Mar 2024 05:11:33 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v6 2/6] cpufreq: amd-pstate: initialize new core precision boost state Date: Mon, 18 Mar 2024 18:11:09 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D4:EE_|DM4PR12MB6424:EE_ X-MS-Office365-Filtering-Correlation-Id: c76b125a-38da-4c3e-4125-08dc4733cc11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HRgioViBYGVnmG0VhC8K28h0JYfkCFabTc0iAy9jiDe4e8Onnw4QoO4pRylFSpwS3nfUjVLS2bYRceHZLE5COTg8qkhOyObYoPpijkkIkToAzno6hViwpS1thxSN17pNRdb0/DQO6B7H6+GwnrdawJtneIP1b8ivpQ1D5A5uJ47DSu9EcoFDL0Bgu6s2C6Wxz+Ohij6iJtTS+CfSjee/Z8WqajsUnbjRcnHSeMjZ8VUb0EW3zw9UfnPuZ076qgdtIXqwzA61mhNIiLRzInEUJWNnpG7zCDyJX2pXgK5g0Mb6HC/AGy1PjWSydvmNRSqP48KxIvOEnUvpvksgcGbBpGd+EIhsDndzRS9iq/3+HNAAaqNcbblmD4LznNmZHvJFQSTTYO+FG/Xbc3wVMdiDZiF/FGoHaOV+QhU2+Y0Mcng619msbBZKxKvUQiplYX3tOSOyOqUXPDVrx6+8VbCIQcVlrFNjz+Xkj7ab3g81H4No4ehqHnnvhkK85pYGxc0bnOK52isBpgxwjfToUW+G60orT3SXZQWs4DjKDk5kkTGoBE0Oyrl5iIg1Y85aktla/Szqe34PCK+yLje8Or8DLMVm87mXUgmoB8PUV0+h9TSqdxWB8KgWwLLt2AmIc6oh1OOwuq2rnoQUL809G7KLVGGipQmE8aR8VaHMawKCU9sAeKsCQdB94OE5bdrLA4zQ6G1lr4/fUedcRC/dIUv1JA== 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)(36860700004)(82310400014)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 10:11:37.1261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c76b125a-38da-4c3e-4125-08dc4733cc11 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: CY4PEPF0000E9D4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6424 From: Perry Yuan Add gloal global_params to represent current CPU Performance Boost(cpb) state for cpu frequency scaling, both active and passive modes all can support CPU cores frequency boosting control which is based on the BIOS setting, while BIOS turn on the "Core Performance Boost", it will allow OS control each core highest perf limitation from OS side. If core performance boost is disabled while a core is in a boosted P-state, the core transitions to the highest performance non-boosted P-state, that is the same as the nominal frequency limit. Reported-by: Artem S. Tashkinov" Cc: Oleksandr Natalenko Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217931 Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 39 +++++++++++++++++++++++++++--------- include/linux/amd-pstate.h | 13 ++++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 59a2db225d98..81787f83c906 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -68,6 +68,8 @@ static int cppc_state = AMD_PSTATE_UNDEFINED; static bool cppc_enabled; static bool amd_pstate_prefcore = true; static struct quirk_entry *quirks; +struct amd_pstate_global_params amd_pstate_global_params; +EXPORT_SYMBOL_GPL(amd_pstate_global_params); /* * AMD Energy Preference Performance (EPP) @@ -665,18 +667,27 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) return 0; } -static void amd_pstate_boost_init(struct amd_cpudata *cpudata) +static int amd_pstate_boost_init(struct amd_cpudata *cpudata) { - u32 highest_perf, nominal_perf; + u64 boost_val; + int ret; - highest_perf = READ_ONCE(cpudata->highest_perf); - nominal_perf = READ_ONCE(cpudata->nominal_perf); + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_K7_HWCR, &boost_val); + if (ret) { + pr_err_once("failed to read initial CPU boost state!\n"); + return ret; + } - if (highest_perf <= nominal_perf) - return; + amd_pstate_global_params.cpb_supported = !(boost_val & MSR_K7_HWCR_CPB_DIS); + + if (amd_pstate_global_params.cpb_supported) { + cpudata->boost_supported = true; + current_pstate_driver->boost_enabled = true; + } - cpudata->boost_supported = true; - current_pstate_driver->boost_enabled = true; + amd_pstate_global_params.cpb_boost = amd_pstate_global_params.cpb_supported; + + return ret; } static void amd_perf_ctl_reset(unsigned int cpu) @@ -900,6 +911,11 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) amd_pstate_init_prefcore(cpudata); + /* initialize cpu cores boot state */ + ret = amd_pstate_boost_init(cpudata); + if (ret) + goto free_cpudata1; + ret = amd_pstate_init_perf(cpudata); if (ret) goto free_cpudata1; @@ -956,7 +972,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) policy->driver_data = cpudata; - amd_pstate_boost_init(cpudata); if (!current_pstate_driver->adjust_perf) current_pstate_driver->adjust_perf = amd_pstate_adjust_perf; @@ -1363,6 +1378,11 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) amd_pstate_init_prefcore(cpudata); + /* initialize cpu cores boot state */ + ret = amd_pstate_boost_init(cpudata); + if (ret) + goto free_cpudata1; + ret = amd_pstate_init_perf(cpudata); if (ret) goto free_cpudata1; @@ -1417,7 +1437,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) return ret; WRITE_ONCE(cpudata->cppc_cap1_cached, value); } - amd_pstate_boost_init(cpudata); return 0; diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index 6b832153a126..c5e41de65f70 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -134,4 +134,17 @@ struct quirk_entry { u32 lowest_freq; }; +/** + * struct amd_pstate_global_params - Global parameters, mostly tunable via sysfs. + * @cpb_boost: Whether or not to use boost CPU P-states. + * @cpb_supported: Whether or not CPU boost P-states are available + * based on the MSR_K7_HWCR bit[25] state + */ +struct amd_pstate_global_params { + bool cpb_boost; + bool cpb_supported; +}; + +extern struct amd_pstate_global_params amd_pstate_global_params; + #endif /* _LINUX_AMD_PSTATE_H */ From patchwork Mon Mar 18 10:11:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13595192 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2066.outbound.protection.outlook.com [40.107.96.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D84963A1B5; Mon, 18 Mar 2024 10:11:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756706; cv=fail; b=V7IZGJM7kak47fNXF3yRUNPXOQz+YGMHyKjF32yPQ7nrEcrJxBP+J6TGsCmLfs3+40nTMZh7qBETr4b4WnCpVyjvmPgpi43YlED9pIJA7muM0wVet0vlRKVayuBEvPegLahbMEO3fkaweA67/MWsFF+7Z6nsWFNAYGMP+GMxfz8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756706; c=relaxed/simple; bh=DNBmTXM5l/5DrfG/4k01NNwh6z/6IKTONCTB19/z2oo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eftJAZyHQ19G9n1ULaB+2Td1shxWBPUARomf4ZfQV07Szl+LUcaUh3Cl5zw/xbAvF7xHgfHC8jIHiw3q5Z2Gu/RpbvfoDWYN9BfbJ/+47928o09Mlw6RmUE7Sl4MUCIwJhaZVxxDmrQfdm+7bfGenIJjIi43cA0eJQhdFdnGPn4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=O1oxg2tu; arc=fail smtp.client-ip=40.107.96.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="O1oxg2tu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TzGb0eILxki4HPVIAYNTtRNr3a+o+NPr9DK4Z+YVX9EakLIVlXrBUzxiWNkRufhTTGLXB4vNpwoa6USLk8Gocxcz9KCCRic08hLHbjiMO0XX/2JzBFKVRrZYxpoy7+3ulbzwkZzHE/Q0dcbkGpDxZ1RVzMltz6t4AB64MGHlIYlm2HNAok2A9W7fuZb3gH+er17urRO59IAB7/VlVlhl6Udsk9VGyvo6OlR777I7rjHiDkGMRI6GP5Coo5RQ73WmqZCYiUV22uiBxSI64g/4Z4V9zddsC736plYr/BehNb+0YUSWYrvxZ/k/ZBjpkFpp4SynvSsS4JAPKOJBksfEpw== 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=bxFRIZkJ1BMDUMNPRaq3S7BZgbAhzFjrrGPocjGB1n8=; b=EzBfHfuuUQF3yCEecdQkw7XFE9nQLPKYvyECJYZNfAOaotpnLH1qzSeQF+fFuBAst26UhhocF4l463hZNt8d1/kpJeILt5FBAFRulp1yIkXOZczVhBz+M/wDddayTHcHuXSXVceDmu5/gwu/fLAHvZHYO9ocGEw5i5LJ5ALMRnvXKrBxZZpzLNK6DQgIbOW4D0hCG+MZ2Vf5tNUS0YzSHYgtw/Up0q+6+cjMLq5992wm74uD6WvPgmg9ubgOHuS41B9l3TNkw2dj5i9KzK1EzzyI2TkfCjjT36uXfnuaMUrdnaKODVB7dpB+VsOUp9F3BRWy+F0CxEf+zrkgE5jBGg== 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 (0) 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=bxFRIZkJ1BMDUMNPRaq3S7BZgbAhzFjrrGPocjGB1n8=; b=O1oxg2tu7R2xkmlMahkKtn9mIf0UNeCacjUYwH02rPdTveZ++onX4oA5VO5Q06TjFwl+7WkPRSqG/WBaUQEcKMWmsn/SSqjkNPUIkT1/NZfgmq1LIGIXe3FAkHPq/m6k3zQbGewfXF3ZyHD99EXrkwu42sPfiwQ0N+v2Tt0P+Co= Received: from CY5PR04CA0015.namprd04.prod.outlook.com (2603:10b6:930:1e::9) by SA1PR12MB8743.namprd12.prod.outlook.com (2603:10b6:806:37c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 10:11:41 +0000 Received: from CY4PEPF0000E9D3.namprd03.prod.outlook.com (2603:10b6:930:1e:cafe::78) by CY5PR04CA0015.outlook.office365.com (2603:10b6:930:1e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Mon, 18 Mar 2024 10:11:40 +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 CY4PEPF0000E9D3.mail.protection.outlook.com (10.167.241.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Mon, 18 Mar 2024 10:11:40 +0000 Received: from pyuan-Chachani-VN.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.35; Mon, 18 Mar 2024 05:11:37 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v6 3/6] cpufreq: amd-pstate: implement cpb_boost sysfs entry for boost control Date: Mon, 18 Mar 2024 18:11:10 +0800 Message-ID: <2668b90cb68315c0dea4a098100fd084b013e277.1710754236.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D3:EE_|SA1PR12MB8743:EE_ X-MS-Office365-Filtering-Correlation-Id: 16ff3076-57a2-48d4-4238-08dc4733cde2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S83rk8ahMXqzzbVRTN8zFErp04u6JtJ1XKo2PPKz3hnlBcUM8Z7Bd6O826MWYuhFE2lFwoeOvuqH7Wuo8iXXu00KnnHgVDDUH2qDnam3hdX66hnIKrHJ4ECTrWrCkzomZgSGoSu9wayzXVs46x/CXpI21e3fsw9K46tyVGvCtozM+rbRKyoLY2zxA4xda7VjvgJvLrzfkb4eCxRB6enGfouSZPd4sQFl52H1PgpDqtMK+CTSCeqBAZ4WoyRVOGwvq557bP707jBx5FCyGHrD51HPk9M/35Cd9uyQjD6wH/TuyYdzzDumZpvlFV++hgw1Fu9Ed0vYR15m2Krsv1mQsouxGL0tlHVXeUrrEhnQUqjkzQrW/spkTUtCw3mJIWIbV6V77XH2w/BsILra1BAMtwyZy9zniaiZs3+xVC198yZ/ltNAlIErvstT7zwvuLqZreiUs5t1sfVKAsVnDFzvZxnQl4TB1BliVMqTR405Cjqezf1oFumkhanx68KE+NLnHVuhOHoG3NS3Mss9L2Na0qGTpEXHDNDb7/7TLwYotBaDfsiAsVDcrOJDth5DJSt5uPBBiOfCrnlPiLewvRBo4VTgHdIgs28gm5D63hjNtM2vuo1GCkfwdBAyQCv1w1IsiNQe41JHYtaz97mco4PvcVNfA0cThHIuiOZkJP9hCqh6A16heG7cuhu9f0vsFT9+s/Z8/jDxeyb6ARwFRm7CAw== 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)(376005)(36860700004)(82310400014)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 10:11:40.1735 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16ff3076-57a2-48d4-4238-08dc4733cde2 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: CY4PEPF0000E9D3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8743 From: Perry Yuan With this new sysfs entry `cpb_boost`created, user can change CPU boost state dynamically under `active`, `guided` and `passive` modes. And the highest perf and frequency will also be updated as the boost state changing. 0): check current boost state cat /sys/devices/system/cpu/amd_pstate/cpb_boost 1): disable CPU boost sudo bash -c "echo 0 > /sys/devices/system/cpu/amd_pstate/cpb_boost" 2): enable CPU boost sudo bash -c "echo 1 > /sys/devices/system/cpu/amd_pstate/cpb_boost" Link: https://bugzilla.kernel.org/show_bug.cgi?id=217931 Link: https://bugzilla.kernel.org/show_bug.cgi?id=217618 Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 99 ++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 81787f83c906..4cd2818045c7 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1291,6 +1291,103 @@ static ssize_t prefcore_show(struct device *dev, return sysfs_emit(buf, "%s\n", str_enabled_disabled(amd_pstate_prefcore)); } +static int amd_cpu_boost_update(struct amd_cpudata *cpudata, u32 on) +{ + struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpudata->cpu); + struct cppc_perf_ctrls perf_ctrls; + u32 highest_perf, nominal_perf, nominal_freq, max_freq; + int ret; + + if (!policy) + return -ENODATA; + + highest_perf = READ_ONCE(cpudata->highest_perf); + nominal_perf = READ_ONCE(cpudata->nominal_perf); + nominal_freq = READ_ONCE(cpudata->nominal_freq); + max_freq = READ_ONCE(cpudata->max_freq); + + if (boot_cpu_has(X86_FEATURE_CPPC)) { + u64 value = READ_ONCE(cpudata->cppc_req_cached); + + value &= ~GENMASK_ULL(7, 0); + value |= on ? highest_perf : nominal_perf; + WRITE_ONCE(cpudata->cppc_req_cached, value); + + wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); + + } else { + perf_ctrls.max_perf = on ? highest_perf : nominal_perf; + ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1); + if (ret) { + pr_debug("failed to set energy perf value (%d)\n", ret); + return ret; + } + } + + if (on) + policy->cpuinfo.max_freq = max_freq; + else + policy->cpuinfo.max_freq = nominal_freq; + + policy->max = policy->cpuinfo.max_freq; + + if (cppc_state == AMD_PSTATE_PASSIVE) { + ret = freq_qos_update_request(&cpudata->req[1], + policy->cpuinfo.max_freq); + } + + cpufreq_cpu_release(policy); + + return ret; +} + +static ssize_t cpb_boost_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%u\n", amd_pstate_global_params.cpb_boost); +} + +static ssize_t cpb_boost_store(struct device *dev, struct device_attribute *b, + const char *buf, size_t count) +{ + bool new_state; + ssize_t ret; + int cpu; + + mutex_lock(&amd_pstate_driver_lock); + if (!amd_pstate_global_params.cpb_supported) { + pr_err("Boost mode is not supported by this processor or SBIOS\n"); + return -EINVAL; + } + + ret = kstrtobool(buf, &new_state); + if (ret) + return -EINVAL; + + amd_pstate_global_params.cpb_boost = !!new_state; + + for_each_present_cpu(cpu) { + + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); + struct amd_cpudata *cpudata = policy->driver_data; + + if (!cpudata) { + pr_err("cpudata is NULL\n"); + ret = -ENODATA; + cpufreq_cpu_put(policy); + goto err_exit; + } + + amd_cpu_boost_update(cpudata, amd_pstate_global_params.cpb_boost); + refresh_frequency_limits(policy); + cpufreq_cpu_put(policy); + } + +err_exit: + mutex_unlock(&amd_pstate_driver_lock); + return ret < 0 ? ret : count; +} + cpufreq_freq_attr_ro(amd_pstate_max_freq); cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); @@ -1301,6 +1398,7 @@ 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 DEVICE_ATTR_RW(cpb_boost); static struct freq_attr *amd_pstate_attr[] = { &amd_pstate_max_freq, @@ -1325,6 +1423,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { static struct attribute *pstate_global_attributes[] = { &dev_attr_status.attr, &dev_attr_prefcore.attr, + &dev_attr_cpb_boost.attr, NULL }; From patchwork Mon Mar 18 10:11:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13595193 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2083.outbound.protection.outlook.com [40.107.96.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BA5F3A29A; Mon, 18 Mar 2024 10:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756710; cv=fail; b=O620yhF61uaeOcIhN//9y8wO+o16xmEigu8KdD7B9uutwEk/avv/gn0N4ohuP5P0uzDs+ECUweEDkDy0DXNI/mKmTeoS/uxaRPi5GbPsEYC8L8ETCjJLB+VWyAEB57TE608q0Vx20Zmv4QanntBOxXWK/4JU7HGyPqiSMT1Cv/I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756710; c=relaxed/simple; bh=m1QQ+FWWV3RUDF1uvHRUYpoh0aRKA7LM8m6KCGCSsdc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IPaBmOwWEiZukwq/9d4Ijx1nPXRh0jXHNgeAQMT8H/99OofTSJWqyp+W8cUZ/Om9KRbnkPmEXdLJw1C1c1FgddjjEqZU6EbQh+dj7kSyars24dBTiA5h/I7D1wB39FtwM2pbWsKFOqWNd7lsBcEDG9j1JCzzDGuQY9VqQ2lxe1A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=bhZikUVz; arc=fail smtp.client-ip=40.107.96.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="bhZikUVz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PG3t3fZ8yBAqkkHI4zNlmO0siAbr120bm5f9XN6Xuge4VrU2gafrD0Ie1kMIjKI5Mr+gESTKhtb19/LZ5nf7pzAfw+qdgfgVh3Zf82k6QpBdIsjI1NyTgrxq2Pn0vqZuYmSZCUe0rFwnYyFvo8a4B1fENIyK6lznpoySh0GOUxN+Feko2JQTecxuyX7/UnlKeybVA08ZBPbyFYr8qTiS8nPK4KXM71WfthMd1gPmawcjfRDl9c9vARVuZVL1CB6D9VMO/+ycfuEXO5pWyGpoK5ZmNKYH1L6R6jD50B7BSR6tU8BjlEB7hn2qKyYsTHoB7Scmb01kQc4cdyOqr2kMxw== 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=Dg669zp2or/DzO43fJYX3Hpy+TmMmMMi+43WGH0vfC0=; b=ZKrBIwhHgtdvMGGq6iiNySSpYJ70BCyVp0Pwk85fXfSApEgyA1p/4drI02myUqXn0qXhhIonmAzvfYM1rE9xHU0omLVfauPe2LuyLXgrqv/OZkF3pmiWgZ73h0AC55YocGoDHwXXQ0+LlD8KNcsh8f7INywYx3o4sPeu7AM7x7S7CxZOVJZkA6VSibs5KtKGpIAQCX/OlCYFERnsNiwrx2EEALH3sCRRS5njvzAqi0kXKQkFMGwpV5oLJUVpZAchopjNorcW5eTTQ+5QHwDSeCkmtTpfQI3/voHFHUFlC9FHoGIiHgtY+kg2EckyV6A5VdrKZxkbgLjU5JaDrClNGg== 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 (0) 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=Dg669zp2or/DzO43fJYX3Hpy+TmMmMMi+43WGH0vfC0=; b=bhZikUVz30h7PY6fyw3+X3mSc530jmNl4lBPeVRKqRaXF+y61d27XzdFjzfuqiaSx5N6hRN88SJ7AAI4y5HWnA6UqfS86EOD5E4N5SSErIFcRAASgM0gj0vXBXpdrvIjd9kvWkUQlXAAtNJX8x/xARX4rR612G4mSgHF+t+6Mx4= Received: from CY5PR04CA0025.namprd04.prod.outlook.com (2603:10b6:930:1e::28) by SJ2PR12MB8135.namprd12.prod.outlook.com (2603:10b6:a03:4f3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 10:11:44 +0000 Received: from CY4PEPF0000E9D3.namprd03.prod.outlook.com (2603:10b6:930:1e:cafe::d7) by CY5PR04CA0025.outlook.office365.com (2603:10b6:930:1e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26 via Frontend Transport; Mon, 18 Mar 2024 10:11:43 +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 CY4PEPF0000E9D3.mail.protection.outlook.com (10.167.241.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Mon, 18 Mar 2024 10:11:43 +0000 Received: from pyuan-Chachani-VN.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.35; Mon, 18 Mar 2024 05:11:40 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v6 4/6] cpufreq: amd-pstate: fix the MSR highest perf will be reset issue while cpb boost off Date: Mon, 18 Mar 2024 18:11:11 +0800 Message-ID: <8e04afd3f5f8f9f9aa1a4b7954ad4b8946d11d31.1710754236.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D3:EE_|SJ2PR12MB8135:EE_ X-MS-Office365-Filtering-Correlation-Id: e79d78d6-d818-4d1c-008b-08dc4733d009 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mWZKWT1Ekzh5O508Jma8MRPno2l79nNZ0mqy9AGskdRRIG+q9JaYeYgNsmc/iY8DpAAa42smCm9fQyInKdOj0K/AFC6ykZL09fGnBKsB49Rm7atx74DOuW8M+Oh9wJBLzQjh9CCsgWbCXtencUFJcFI562vBz8Ahl6Ims3bVddlqgsinvZ+Dba8I4wHRiQJKsM1vYk+BahB4FlZLPcPXY7Z8iflfilGmDPhITcBkbCUkrqtSXLgpMN6EB1XwPi2Q0om2huIoRS9iA1GrFnc8B77Lmo3KlvQ9UAS8ro33GY+BYU/On+5FEFjl6NGj3U5c9iocMypMC3TM7Ms5L7yPo4mEZXHSPP+a+H+saVt+WhVc7WLCdKDs7lOUIrzhzlbpP1c+ndMrnbZeqKGUtXBEUdelxC4subWrX7DFuslyEvhU6r1zrcuzrfS8TdtZ7tTIhKhTAfdAVWDdTH+UNIuiEaBwgqiW2sU7JGZr+DRJ9wxlp1Bk4CI6Fn0qPQKhvKg0/A+5ZnGEh7YyrZWoo3IgP98JbXp3zxK7qxACwZMps9gVlvabqRGPLVswMn/Sk87HNjP4E00djRdgpJsuV76C4SPb7VTqxIw/RWy+9JKnTxpqOj0mj0iu4XlqekTyDgQ+TGZmu46o1Yt7W32/vH8FC8yCDfnl4y6HPeuTdulf4SJxueunNwx8WNppUPk7X3baDRLhavTNu8gFCxr2qY7PrJvqLccKFOUiFnaQRM/fQPHUCoNRKlWZedDTc2Vjsoag 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)(82310400014)(36860700004)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 10:11:43.7829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e79d78d6-d818-4d1c-008b-08dc4733d009 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: CY4PEPF0000E9D3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8135 From: Perry Yuan Select the min perf to fix the highest perf value while update pstate CPPC request MSR register, here we need to limit the max perf value when CPU boost is disabled in case of that highest perf value in the MSR will be reset to original highest perf value which cause the BOOST control failed. Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 4cd2818045c7..513f91611cd5 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -476,6 +476,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, u32 des_perf, u32 max_perf, bool fast_switch, int gov_flags) { u64 prev = READ_ONCE(cpudata->cppc_req_cached); + u32 nominal_perf = READ_ONCE(cpudata->nominal_perf); u64 value = prev; min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf, @@ -495,6 +496,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, value &= ~AMD_CPPC_DES_PERF(~0L); value |= AMD_CPPC_DES_PERF(des_perf); + /* limit the max perf when core performance boost feature is disabled */ + if (!amd_pstate_global_params.cpb_boost) + max_perf = min_t(unsigned long, nominal_perf, max_perf); + value &= ~AMD_CPPC_MAX_PERF(~0L); value |= AMD_CPPC_MAX_PERF(max_perf); From patchwork Mon Mar 18 10:11:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13595194 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D7F33BBC5; Mon, 18 Mar 2024 10:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756711; cv=fail; b=P/A62MsMeYKW6Aq9X8fxl5roPyoicfPZDBx8bQ8WnFe5GThhL8GYKep1ZrOBZzLzFP/MoGWQZHALFAz3pjbX/v0rCvcqilfNMSKl3d+zu3Kt9lJ34ebjZ0AaMQ6PGw4oTt1BB3G3Y+831v9c0ZzFWuo4D0kikcLwGkL9PL0YrQI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756711; c=relaxed/simple; bh=xEj6liAj6IMhbWAhkHuDsMO4hCwxjqNXMN9NlrsX8rk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B6RIahDDBvfrdJ5S+uK8zf1LTL5xFXQU86mueGyzYEFDPZPQ1bDwLIbh544k1L3x/qsvM+Z4QAE4rG2xOz4wBqGM+G93XPOVJxFm2zZstF5taIF8ojlxyHV4HBv4szpPblld3pXWCfXOuFTIS13Q+FLrhlemFU0bDgiF7iGgTBo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=ckMufI6/; arc=fail smtp.client-ip=40.107.220.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ckMufI6/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EJL8C4PCwzmDPZTKnvtPqe1W1ZoPvpCX0Q6VD2ynarPWv9BWlf0hLyTTWI1JVcQzRN6NwYPB0QDdzocdoP79l7ijX8kL8kQfBYKV4wnsENoCYmEJNkmbW7AfhhK6y+vrEUXUUD9X4wSv5DgsRqE0G+fnpXR9U9SwM2dMarfZ4HTBbuEEikP++nzzaxMBO/lwa59O4Pew4/qF06bPeJxcN3iATjPV1BN1tywfbv9576nYXtm4Wd+W8UpJjadkEYJiHUsaX1om2LYkqJJLLIchHNwUTBkyATBkGLge106k9QbnMXpFoyq6jdQuphBatK0qNBGSxi8Wq6iSyVhdJOjdeA== 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=27ao4J8fzUAMRbFzpm1S5an7Hi17ByoMGWcavVPwhww=; b=Nxp1pL7Zv6HSOBTnknrAmoRSoPaQs1fuFBsHv50a5tF+raC/DVr3dC3Tu1LcWAdUFEjtXYODRl/SVKGOFitkJuFfivg0zCgpepTbdtE4EXD9TXI5j/bIdTFYoYHtGSCxHMXas3EneWPJEHmo7MwF9IjbobhcAnxUbU0CdiAn0mZNIPe6DCjbo64faYGBfgHqYArlitf8GMNZJDgz7EGJCMJUIsuMbOAx9fJ2mBZnU1mIoIuYICl7W1I0U5kliuh4IFy+gOMwQIJtFLxzrd1Jqo0gkOIEpm3DkfZwOuBlL7MgBuVvueMGsDTczUiSP/bm7OaezAqixJFq8fW67/+6UA== 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 (0) 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=27ao4J8fzUAMRbFzpm1S5an7Hi17ByoMGWcavVPwhww=; b=ckMufI6/7N94onKhtVna8JfteUYiVu4SHV/P4mTRvDbIBz6ATZ/viOHO2sF99cuhBmnRG8jyApY8U1C09CHBHlQ68OYcmvU6pXFGWRVUV0Vsm+Irt0R23Pm0FIo+2hSPjUOkHImy8Hb86wVf1JelH06LmBMV8Q0ZM86tVmEK18I= Received: from CY5PR19CA0076.namprd19.prod.outlook.com (2603:10b6:930:69::22) by CY8PR12MB8194.namprd12.prod.outlook.com (2603:10b6:930:76::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 10:11:47 +0000 Received: from CY4PEPF0000E9D0.namprd03.prod.outlook.com (2603:10b6:930:69:cafe::57) by CY5PR19CA0076.outlook.office365.com (2603:10b6:930:69::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Mon, 18 Mar 2024 10:11:47 +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 CY4PEPF0000E9D0.mail.protection.outlook.com (10.167.241.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Mon, 18 Mar 2024 10:11:46 +0000 Received: from pyuan-Chachani-VN.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.35; Mon, 18 Mar 2024 05:11:43 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v6 5/6] Documentation: cpufreq: amd-pstate: introduce the new cpu boost control method Date: Mon, 18 Mar 2024 18:11:12 +0800 Message-ID: <7058c6a5001d021d00c0a27f05e598d32ff1dfe8.1710754236.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D0:EE_|CY8PR12MB8194:EE_ X-MS-Office365-Filtering-Correlation-Id: 04c5c90b-de58-4ad2-dacb-08dc4733d1ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DaDb82jAJXWWUnQvkrNlJRuqfS1y3q6LrHFxD3lS9yn2L1qqPMMtieRAxcg/GcEZ7qwq5NPlsR9HciPTlfJLOCEbGH+KkVgnAjgs2sWLmW0kl8+cCOoct1KC77fcSptypFMVpqyk0Pe67ShpB7YydQiZ2S7V352AW9z/oosKwCurtH046E/4S+g6m3Dvk/sJ50zJXP/MR279cnzkWksvegAe6imrBO7Qp6Si/pAcsD7b3w4x429HNAFxK2zuTzoMwD2uHc7GXldx7oln34tc9t/tLWAlQqqFJ9sWCmLtZVPCGGwo9o1ikw+uOfl14cQxFnaghC6g5XoDFD4/+jm51qpfwduEYyECchjuq3/FEVjM41/VGySz8hFUcbJ0qhzAZJXAHbUO6N/x03ipzqg6xdZ+NPfW7FrfRRoT2fGbdsbTul6lrmxsu5j+rQas8qxEvBVAL8ULNBGMA/09y0VJ9gdkWCIP67BCOe4yDKfXiCYqj23d1Wg8pfYuEqCHU1UnVARNgjglih2XKPeilI+dBj/AD4AOEzfNFTC4T/ApEei/0M2mKYOuLlekxChEHbd1/FxuxRrogS7QltABzmJnOKSg+ojtSvCr5gQa7LatV6vPLSduanI8yOvj8pXJmeV46nMZs0at9CVK9yxu9MPBAIXfZBvVl+ElBw08EBA5xRGNAhAFNztH2u63Jkq8sAOua0THorR0yTqg6sDs+OI60gbn8E+XlPd3LiuLLcLALi2Xtkd4pvUVosIakX1/h/yk 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)(36860700004)(376005)(82310400014)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 10:11:46.9669 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 04c5c90b-de58-4ad2-dacb-08dc4733d1ee 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: CY4PEPF0000E9D0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8194 From: Perry Yuan Introduce AMD CPU frequency boosting control sysfs entry which used for switching boost on and boost off. If core performance boost is disabled while a core is in a boosted P-state, the core automatically transitions to the highest performance non-boosted P-state The highest perf and frequency will be limited by the setting value. Signed-off-by: Perry Yuan --- 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 1e0d101b020a..82fbd01da658 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -440,6 +440,17 @@ control its functionality at the system level. They are located in the This attribute is read-only to check the state of preferred core set by the kernel parameter. +``cpb_boost`` + Specifies whether core performance boost is requested to be enabled or disabled + If core performance boost is disabled while a core is in a boosted P-state, the + core automatically transitions to the highest performance non-boosted P-state. + AMD Core Performance Boost(CPB) is controlled by this new attribute file which + allow user to change all cores frequency boosting state. It supports both + ``active``, ``passive`` and ``guided`` mode control with below value write to it. + + "0" Disable Core Performance Boosting + "1" Enable Core Performance Boosting + ``cpupower`` tool support for ``amd-pstate`` =============================================== From patchwork Mon Mar 18 10:11:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13595195 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2062.outbound.protection.outlook.com [40.107.96.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EE4D3CF4F; Mon, 18 Mar 2024 10:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756714; cv=fail; b=gq0nXnxfK8+RJIJfWb5XcJHutLwlp3dxi66mnvu+8Z9YPyhBv/Bz4dviZCGEiKm6p9QuJjIBP+2jLSjJYN0zzcdVJNQTzvxQiTyeHLL7sAA1UtjrFw1S/Sc+bXXnlieN/hwIa98GnItOMFIAZZ5p1MJXxfJg8SooJGefgdLvjaQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756714; c=relaxed/simple; bh=W+dCh9C8EntywcvXhSubkaBnZJJuzKjsF7idcfLgto4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IDbuPK7c0SA7NTcgq+JJUprTvq1PCd9r62ev+9f68sFC01ew10dXEscvrkMRFlJVFGDWYBCIz38afDZXqaQp6EI6pPdOMkd6KY/IOuuVMmmfpv/tF+E1YX9ao79Dirr0GZHXWVfCkYb+9gDGMZPx9OKCPHtgBhGn9TQj+H78Maw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=OFMf/xoJ; arc=fail smtp.client-ip=40.107.96.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="OFMf/xoJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UoMaU+oD6EqVX3wLO0MeAKadS9i0GRNpNe21Ob9NmTbGzguIuIXV9mlc/+Qbk9ikSiB+2r2Kf+0PDo+llE2KCtRyTXt2GpvNvVO26yF81FpBD34NJ5c9f2nBP6+PAJYVTEcrYR0DrU36CBDrEI0uUYqvU/ceTaiwBdmgv0Xh9ymeKA76tc2HagyycEDlYnXcAHUN5B8EufhgRr0+Lyfsil3ALZqYzuzkruaXTnxPM2Z7P0yIeA9A3KrYODAkht3O48jL2zQPz1sCpSAyjPSe1ws3DUYX63eyefEuJ1n82+wfU5pgYyPZBPhIXSnv89pUK/NIg3T9W47wcPxUpT2mNg== 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=o8EDLYk3NSyioGPjxU+pIEAuL4I7f4cRvkuByN872I4=; b=jXsF9maqbZlFcik6+dZK4PCT7S67SPp4WAOcQ1JsgRC89gNbeta1Lw4oGr7t1pitIGrZUKvMP3P1gxSGkEpapUPJvnhbnUPPF0pMXNa9DpSb3ZHaas8GS1mvSbqPad7NKFcrVqT4qtb7cS8fU4oCytIbXv3wUrzXvsD1s85M3U3ChD8ls9bPpE/oEDErdmp+43oqlHJckvYPX6JSrcyMaU5cdZFLcNTA75qcFbEkT8KVOORoYTcWFPHcd4Qo8P58GZx02YpVSZ/rWFXaeEZ6xdtK0SAQRVcH2vqzN/oX4PBjBcZy9DZKot5ReH2YsgqClkL2cGBmV+2Hxxa6fM/wiw== 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 (0) 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=o8EDLYk3NSyioGPjxU+pIEAuL4I7f4cRvkuByN872I4=; b=OFMf/xoJ+zE3a0QeUiiamITwLJwwHLF2RYPj6GEGSiS1kv0LhEhkdJRxrjCQ1H3obPTqAWEfPE+1XOqsZaR9pecdjdaZcUMZ3M7X5A6oM9UE/ATgvX70eomfuI9rjX5TT6AGTYHAQB6gSnZlZSRVYQD1H+7/dVsccQmYEJft2OI= Received: from DM6PR18CA0024.namprd18.prod.outlook.com (2603:10b6:5:15b::37) by SN7PR12MB8819.namprd12.prod.outlook.com (2603:10b6:806:32a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 10:11:50 +0000 Received: from CY4PEPF0000E9D3.namprd03.prod.outlook.com (2603:10b6:5:15b:cafe::cf) by DM6PR18CA0024.outlook.office365.com (2603:10b6:5:15b::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Mon, 18 Mar 2024 10:11: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 CY4PEPF0000E9D3.mail.protection.outlook.com (10.167.241.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Mon, 18 Mar 2024 10:11:50 +0000 Received: from pyuan-Chachani-VN.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.35; Mon, 18 Mar 2024 05:11:47 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v6 6/6] cpufreq: amd-pstate-ut: support new cpb boost control interface Date: Mon, 18 Mar 2024 18:11:13 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D3:EE_|SN7PR12MB8819:EE_ X-MS-Office365-Filtering-Correlation-Id: e0991a4a-d80e-48fd-e593-08dc4733d3dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RI2ZaYE9JFPH1Y6Fq8Y0pXUXz9SGVBQfRl5VXMgCtdzIRScqFHbvNwf7rdKeKAwyudslHz8GJQtv1BjvAhjhG3SBvg8VjpX4KdP/0JKuI52cVyEsFxgnErbchXVt9yaJvW/tPMhWKU5yc2kmvB2MP/apliKP5vgtgJExWmcKuhRL/qeKBtJbV4txdBoWiHOBLLVYx39nK367Bdpx/bdDD3bT3DtEoj3MDzWox7NxQ8Snn/r55GWFk33/+o6orl82akct3VUN1xwBAzXcA9o+Xb8miWeO4Whc55g+Qdtl7ofmCCEPs0HAt6coJObswjQAisU5rQylNsXetM/5FXfvY3ooXpF8i8OdikOe7EU1mqqrekBJsSAC0Io6lMkFKv5mbdIAAIJk6EnhU898a21YgaO8XN7C8yVTKj8gfQuS/zBrx8eo3K4FtcXsbDH3+Azue9q6+HaIzTvZ1OZXESoZLvoV9INJ80h1YD2jWTMDzqYZYzhsgrdHVyU7ZzZ0D/56qntqVuYxps7m8dGm3T7NnTbVL4jY6JVauLJFrsnBZc38mqKtRdvvSkAsUNhCwEjao4DgWLenTsYxOB9bV/QJR5wa0w3isLnxWbmASltwVR5y31h6ORbO11XATzAuQqoDm3+GFmC+krm1UzmW2svPUdb/KavvFdchaSGzhE0t5BkoixD4fGfwOCgFI5ZYOB9AvPZzSksPDnSZN13bmN2tjLxZqQL1wXw2KC5Swg5QHUOdmWs1gKVmEM+eV2G4uv40 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)(82310400014)(36860700004)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 10:11:50.2047 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0991a4a-d80e-48fd-e593-08dc4733d3dc 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: CY4PEPF0000E9D3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8819 As the new CPB boost control is enabled, pstate unit test needs to remove legacy `boost_supported` check and start to use new CPB boost control interface `amd_pstate_global_params.cpb_boost`. Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate-ut.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c index f04ae67dda37..b3601b0e6dd3 100644 --- a/drivers/cpufreq/amd-pstate-ut.c +++ b/drivers/cpufreq/amd-pstate-ut.c @@ -226,7 +226,7 @@ static void amd_pstate_ut_check_freq(u32 index) goto skip_test; } - if (cpudata->boost_supported) { + if (amd_pstate_global_params.cpb_boost) { if ((policy->max == cpudata->max_freq) || (policy->max == cpudata->nominal_freq)) amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;