From patchwork Mon May 6 10:19:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13655265 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) (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 9363113FD93; Mon, 6 May 2024 10:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990831; cv=fail; b=rejzIp/PbD1CYAkX8zLo/ui5IB8nmBeYC7Y9xf3e4VAcgbeWgsrx1WRcwEpcuMNfZAmArzrUOvcypOqvl5Rp63z0X1cyzrbf1asmCw+/yIyJQvSetVmjp66Vkk64+/5OTKDMmlgxYUV2cg1R6P/8D0Yerq7za0z9ss5eSEVkCgA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990831; c=relaxed/simple; bh=oEJ1aIAtGosrFyk4IqINDU+8CxFIH3iJUhgfurIlJY0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j3BVrQ2oKN8c2T6D0ukg+zlKazH7GkemRQHUvMQL2NdXTkqL0p4SsBZG7hef/mCp9Zb0J7InAekBLegrp2KnNT9sZ3UeG8gU1vA1kanlLzW/OI2QruJxkkqfP/GV9KJVIth6tGKD0SJyMw9ZoZDsMNIdTKMj2OzJrJUc+gIRGFA= 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=CfSbu6NM; arc=fail smtp.client-ip=40.107.244.84 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="CfSbu6NM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHl8wZnvoYTk0ChVxwIFTsO3mfncKEwh3GfSW66LBgRjYxxpiKYiMZhN2soHD1VTNmUVVaBw4CbjBBp5uW7yoqfDal2ZDocLTydlptzKLpZyGH9z5Hh5OEAb9Qw1n50H75Lz/P2EyKv/fYh0awQmBTOUVf6tfcaUDl9B6s/xGKimiNPTbQmppG5FviR+r2WG2fx+xziyySp5mHWYf1sSOVLNjMkIVd2MaYpkcu+xUOEf9Z+LYSBqtdjTTLOhgnIGyqwNaGcEyr41ivZPLewXDcnsJaG/4Z9Ej6tAtxtBCVD6fr+gPBW718e8Blv58uXPEAe5apKqciPnYr3OD0pFtA== 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=kq+BXGQldt6vAGnrN13zwfmUSkeLFSTbaIEjid2Iko8=; b=RJ9O27XqzIGzs4UDd/EQV+Slee+8tyPXmu2DDJnsML0O29rQqRi+Wl/shhU0yZ9VEwvOH12Rf8gcVEUQv8VD95zQQ4MaPppHNZMKztjIGfAQeaoX8TpC81MlulJY/Bu3r4ar9w1E3c7BT0NnPgR6k6zoOII/hylCa5p45uipTf/XoRCSdcoGKFJ3O4Vjvo5HqYd7KPvUhgjCUoV8koABI1SzW9Jyrj5CahfdyTaCjf9OoK7grp7gFmOlmBTWvYQgg7/0xy3KsZlqfkiGpbsxLf3fsPjx8SHeQ90CKMIMCVQvbBOauJxfgtOb1Z9ADg4/5Un3YuCw9779hpwxoa3scA== 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=kq+BXGQldt6vAGnrN13zwfmUSkeLFSTbaIEjid2Iko8=; b=CfSbu6NMK+3dYE3e2XkA+4NzyG3E4cdsc9pwzx1yJgmt7ihGka5PNJMyrpQOitcXioiIbOJfsvRIzePh6wqWixMmI2si538f0wpVPTvFl7TqCHm9agiMw8ORIMO4bsz8KQxI1w0pdYkPryXWwS8yxRAMaQtDslIUM18prGaQqRU= Received: from BN8PR12CA0034.namprd12.prod.outlook.com (2603:10b6:408:60::47) by SJ1PR12MB6123.namprd12.prod.outlook.com (2603:10b6:a03:45a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 10:20:26 +0000 Received: from BN3PEPF0000B073.namprd04.prod.outlook.com (2603:10b6:408:60:cafe::be) by BN8PR12CA0034.outlook.office365.com (2603:10b6:408:60::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 10:20:26 +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 BN3PEPF0000B073.mail.protection.outlook.com (10.167.243.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 10:20:26 +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, 6 May 2024 05:20:15 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v9 1/7] cpufreq: acpi: move MSR_K7_HWCR_CPB_DIS_BIT into msr-index.h Date: Mon, 6 May 2024 18:19:53 +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: 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: BN3PEPF0000B073:EE_|SJ1PR12MB6123:EE_ X-MS-Office365-Filtering-Correlation-Id: 759c7dea-fca3-4c1e-a004-08dc6db625ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: 6oWCFD1oGPEIMk/b7ABqvCX6WOH9jsQl8pHaSm49NnldZN77Plivpdw9lwRzsO0b8/hxgO30LsM14FQm2B54uxdoE5N4kr3EkPBMfTEr8p9DgWxey8v1wD+eAg0h9e9hujvGMm+BM+cAKGPWiqOj4vyzbh3eluylBhhx8DrItLolcRTMxItvO3qNZlhuZaesHJLc6DhE37bdZ6sCLM+iLc+a5iHmvM2v28XZgTzVwgIaRllRdmABCVYVPcjzx5CgukaF6+fSK9RkoFUMQ+1AGyu0T84znUPDSIaYt+IM63CTx6aFEOUIqY+mSIjJr6Sj4Dlb7w2jiyRANcdcrrCmsaupvai1LIj0qy1HbRHXGPFwTzs2lPvq9lHr4cUcmD6lIK9t30W1XeqGI2AoMvkCizqbqiSqhkbn+eUmTqIU7ieRDuKlG+0mf5RCivB4T5zEf9vTKni4vODYB6PKsnKmweHn9VgEEZoWzJjUPb/snWyKTFdHYlhffE0EDUK61UcD9loLs52YxAMzmCaSGzDNvzOtIC/rrlYnItdGiI4pXSdZDAVgw/SHak7kXwgHKdI6BvLD9vrB5GkJbnEptR1k1/B5mEGufKcfnxgDxBYCz5FtU0pHXsHLjTs40YbOA32Q1UEbdL9Z0z+EcM84LAO1AdcfZn6jFxukUDk9QQtnsSx0t58Nmu9xJbiBbtXLlcOOuUAbH+eYF4z244ln9vsXvfAZw7pN5JN0ZBD+7zHOVEPHfVZbM91CQl7gbAzbzBbTwkANyELlo0PMIh30k9PRUAQEXkAVnPOQ6s8LJKk1xmhFQFNq+9PTtZkEiegOdFYQx6NPHpzLr1ctRuSH180emh8hykkNyw4ATQdEFL+CNkWs4lZecoPiIeA5dgGXSwSk/Q1JIfGbHYbWyoMWEx6LRAV12QKWkGrOSRA9pi1Jg+xFKPTEhqVl/txOfeiZob5IU3RBQmiq7cxTlL/18Tf3NF2pdkxrD+G9nc7J1umAZ4Sj3FWN/OP3g0zI3oGYzrtiprfWch4h6KSxRmGHJIlA1IpIFUCXh2eHs96HvOBxyjzIMIup58oG+l2ZalbUBPuhPxNcKFQ3fOwoDbX/RXcUOhc+i4Y6MxYWme5KkU5ac3yAONhVRjTU0OICz1GmSga5cIGJsu2+fo+WB0sq0HfGk7jb1LroE5cZojOmrAl/UePiJBPkGv4EV4xaVr2eOWhdX/jljKHtmBkgSv1Jnw9W52d/4RlZ1UNoDA+TnwJ0gskWJm6cTZPUNB4pvjxIgdaTmIpIbXXZsSn9LH4+8U3POUVu/KeasU1ob5qjOr4BFqgbvRrJoXsuZBe5WBKnHRaDeDu4BuEYFPXfbiW9aG1oyM92OQGvGmRbjFIL7SJ8rLw= 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)(1800799015)(376005)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 10:20:26.3762 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 759c7dea-fca3-4c1e-a004-08dc6db625ba 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: BN3PEPF0000B073.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6123 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 Acked-by: Huang Rui --- 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 e72c2b872957..8738a7b3917d 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -782,6 +782,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 May 6 10:19:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13655266 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) (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 A85B01422C5; Mon, 6 May 2024 10:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990832; cv=fail; b=BJCskxU0cC8+ftohRSKRVHJn28Tms2IbIikxu0YO5jHwGtjNldIy8GQvPiVB6nKRGRBbvJB/o3KdSY+1vbyWQIjRAPAxqX0/isu0vyFz/9/q7MW6q5tEXe9W8Tji/6mrVQrNkOAg8mpad2mi4SDqbKmzPtrVkyl8+Iha6VPcRWA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990832; c=relaxed/simple; bh=0dghC9Gb1tCE887cWqM58tpg82BP2Al8QCSx8BHQYTI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ud5Ys3mBdl9mNjSiF/8cKCkGezwrUIXdm6yBCwR92DaNxzCUKBzNjeLIwnoQygPTBCaS3s0q5ZmoBJ5e9ggoE3ecNGvaz4fOb8eC0BNiNYPg7SP1AWwu10I95GptzJMByKMDC8DOG0UUvmjcub5fXTtdDAGqb+vwfU+kNg3371c= 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=d7k52rfA; arc=fail smtp.client-ip=40.107.94.60 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="d7k52rfA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ph52NehHZTz9GJdXwMgF3ajVS4hhFCcj3pzZHvwHNmjI4K3n4avRB+NgsCBN5FDZwbzBaRNiu3OdkDwSeaPwpWLWl5xmxx1oKJUjCBDbi4IdRl2Jz59npxEYOO/8WwF1Tdrm2OkhAFabc2qDQh0jYsitlTgET1fS0Ywl4Sizmb3lXmxkCNOWPbxP3AvLsCO4Eofqs6ZqOeXVKXXYQ3rs9QGEGVWZVH4I6IqxWjPqxJ7r3g+q3qLg+J7YrLlCxSMhnIqqDp4rOokv57HE/yBi14EZYYxWl5SG2d5xvscopCJCWKh9GH1q3Q323hkAYVtv5FVxVmBCw7TNX8y7sXWJsA== 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=RDFlRLzJYPYSSOp5lp8EMyLfuSjXwx6x1lCUhGk8YMk=; b=CRW3yA/4gwQXza/qQyFuOEgak7qOPjFX5mE3zevq9goeEY3cdwjC65KICUz1kt0pgZrTKqrrKljGZaEnEKLeREwMcKXVuPJTXhtWuMcga3LoBmy0XNmI4+VELHLAV/l1jqd2RPB7D5XeODTWRHHfghIvy18fXk1hyWHTLRB1c5pG01KS1REFi+hOhTjPNKe0sDLxbFVJ7vghpSXuKrySCxsH6uJvWwqDpw1qE/Y7izKYlIy8VNhEmA80j7aCADPg7cRZk7gsoWgDt1NM+/r2JsKxys6ry86u9hohCSa1khk2Mnjvpn5cN8HQx7Cw9y3GptVB3CzAwy8M7u+2cgq9aw== 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=RDFlRLzJYPYSSOp5lp8EMyLfuSjXwx6x1lCUhGk8YMk=; b=d7k52rfA6GyGCGg09pe9vh1nowWqkJxb/1OFC/MvpQQgT6+trCil/8L/KOkIBF5UL1BDUU5K20NnsN5obyZqOwVjm9VFFEC7DGWuTP0ICbdyrgAkvGvTDOPpTg5eBW4hyvn7qFRkVF7h11MGJqLVBbW3mr2udOz8WzATxUNNkck= Received: from BN8PR12CA0010.namprd12.prod.outlook.com (2603:10b6:408:60::23) by DM4PR12MB8473.namprd12.prod.outlook.com (2603:10b6:8:183::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 10:20:27 +0000 Received: from BN3PEPF0000B073.namprd04.prod.outlook.com (2603:10b6:408:60:cafe::ad) by BN8PR12CA0010.outlook.office365.com (2603:10b6:408:60::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 10:20:27 +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 BN3PEPF0000B073.mail.protection.outlook.com (10.167.243.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 10:20:27 +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, 6 May 2024 05:20:18 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v9 2/7] cpufreq: amd-pstate: initialize new core precision boost state Date: Mon, 6 May 2024 18:19:54 +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: 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: BN3PEPF0000B073:EE_|DM4PR12MB8473:EE_ X-MS-Office365-Filtering-Correlation-Id: ba7d4ae1-a152-4737-d2a5-08dc6db6266f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|36860700004|1800799015|376005; X-Microsoft-Antispam-Message-Info: sq20MlJVpCWjIP+MaRciceRc+TYkcUV4PjAgQ+AmmuW0OEiMNPQVHSnTnDI3v8nO432K1uYbMLAe5k/s9+QxcnNEUsZIL6Gq09PbyzdgF1ISY4Q3ZP7liFDb5R4cWIzYikDYHf/4sSNLDlFb/Skw43kZ0q/9w0kVxZgmTn6sUv3oIdIrXD9zYJhJUwlOZMOMw85WapUBm/lzZYP+RkEelUQQcFpYupgn23261U5+ST8YoQE4/1PWNKi2To51PBNuqeIYjlWKajy57XiQ+BVoCJeHVW8HXKQiuYnIDpQIZKRux8D+0p/aPB/JkuBp+IbUDLdK2Wyq7HisHb+/qiSgjcgbNgscyp2Gfi2vnsneL8QXloMliCAFnlaRuljE8zisnIsDNKBkj2tt54QsHB4aOn69XrKp1gXkxwouGwrj1aahFbGVBJkd5d78L51k4ID/m4cHCmKSBWhc/zYdCCPEfVrInr8FK+WimXQglc4TVhSbOjbrw5Anuz1b3A7uhYNxHtW6ka6tPs+olcfIp+zbeNhRH5HTFSverQ6iBTOLrdK5Hz39e7WwEupTr87EpSCgibG0PdVzMqG0SNYSZhs8ooAApSZjn+ten3DcLpBjkn3UqVlXZYvKPYvI/49ABV5IbYGlkLzVqTkAZ2QmpJkLBpnOSLHmvggkmXs0cBFNxGrKmc0J0US7SuVwy36ZpUI7YzFbtwmDkOKvWOT4o8L93qepzw8VhFOO6ikoiCIRZAWtM/drgWf2uO+X/4V4XoeHlxuyXoWmDTOUW3HC7Me+F7JyVtjZ6JcyRaoZ7cANNCEqKuLbYbnVa9ds6gCoy9CfQQmfBrUC5FMYrYgDKu81yQh7H9maFdxgtC+4k6Y8MgosBkszQidxtlBy1r2g0Jg0S2CvEWC/Y0NSVMlk0BJR0n6v+X41u8pKNsVqbyC0c+Y1oVaTs9qhZySTuHqvMPM9cHdc3eCvpcOQrG4ZQLCLxdjrbyyg0JaBPkZUMuCIlmRtxamCNuMxq+vyCvqX16otbMDYDkRDF4AlfmIo5M/lp0FKhliL0+cbwEb4R/U5lnnfWGOJB/boLT2tGgv8tuVOo7qZgRcecd5VwzuRc0i7BSETRwswz5zvodULfzZXIW4jNiYruyaTWYKsHBQz+5q5D7w2tm5C4oRxl19geGta/ce0Cm+ko23xhJnZCAPsYYS8x7F/10T0VR2nfjJK/t+TdO38tE9cRsb9IPz8/n+AHTXtvkYgcm0dPfW/XZqS3ovKZw7djGDHq2Zto8vegcdoauUoDWw9PuqihcANwRA15SAcd1l8mdc0uKUYf3N3i8Fm0qWjG2sHWb+DBf8QGMUw 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)(82310400017)(36860700004)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 10:20:27.5637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba7d4ae1-a152-4737-d2a5-08dc6db6266f 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: BN3PEPF0000B073.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8473 From: Perry Yuan Add one global `global_params` to represent 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. The active, guided and passive modes of the amd-pstate driver can support frequency boost control when the "Core Performance Boost" (CPB) feature is enabled in the BIOS. When enabled in BIOS, the user has an option at runtime to allow/disallow the cores from operating in the boost frequency range. Add an amd_pstate_global_params object to record whether CPB is enabled in BIOS, and if it has been activated by the user 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 | 45 +++++++++++++++++++++++++++--------- include/linux/amd-pstate.h | 13 +++++++++++ 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 2db095867d03..f7dab0f7b452 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) @@ -647,7 +649,7 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) if (!cpudata->boost_supported) { pr_err("Boost mode is not supported by this processor or SBIOS\n"); - return -EINVAL; + return -ENOTSUPP; } if (state) @@ -665,18 +667,31 @@ 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); + if (!cpu_feature_enabled(X86_FEATURE_CPB)) { + cpudata->boost_supported = false; + current_pstate_driver->boost_enabled = false; + pr_debug_once("Boost CPB capabilities not present in the processor\n"); + return -ENOTSUPP; + } - if (highest_perf <= nominal_perf) - return; + 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; + } - cpudata->boost_supported = true; - current_pstate_driver->boost_enabled = true; + amd_pstate_global_params.cpb_supported = !(boost_val & MSR_K7_HWCR_CPB_DIS); + if (amd_pstate_global_params.cpb_supported) + 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) @@ -899,6 +914,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; @@ -954,7 +974,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; @@ -1361,6 +1380,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; @@ -1414,7 +1438,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 d58fc022ec46..8ba5dd4d3405 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 May 6 10:19:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13655267 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) (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 E5C70142629; Mon, 6 May 2024 10:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990834; cv=fail; b=rNOK4MVJWUnx1afm+7HV/sH1yklyYShI08xWktv3XBAE2CUUUmLIRIfAu8cscAFGs+ybE8eVDwSj7TZ4SprcoB1Wmv+d3Z/AxSUTNpoxeKsDJvQmeMZhO6vTGNZppYkI4Fhpcn+Bs4PzdHlEqJdssBK9RUruke5Y5okYpcahZnU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990834; c=relaxed/simple; bh=SPtaTKhKS4kBximrAAIVyLl++Y6fmD1XuYHuKP4/3TM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GbT8vTYG4peDVosAyERAS2QG6W32TcdTFsCfb2TKEqHfMPhVvzUmGXheaAKVDCSL52okLozPjkl5kRxcZzbGUmq79nyt/O1fEW4BAB8F1RJ4WUbWl8E75cLRzFNmtxNs9aI+4SZxgCv8aYsUh9fATdMhNu4pMGYE3L6K5fP1cPw= 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=y2nLoeQt; arc=fail smtp.client-ip=40.107.244.45 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="y2nLoeQt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZKI1wZMBltJJoRm3Yxbe7TP83LmwuwYGeS3yr3xfm0DbGYC2+G/Nj7WEauBy0bAF2tO7OTr/pPWIqKOwal059KQGcf8npjfVISlrZNtXRrV+IdxCsiHV+/QUJDlPyhJqdPBNt1ZX/wEPJDH8DiDtmodv7f8n+9bcvkXmk/nUITYl7JSonhceWxk4fI3DmcBlroE3sltz7rMLTl9xChgct8aPmn7klY84EbKWgE9NoesTJA4fObTd7ucT0Qtial+Wx2ssVsFUjOKmylmzwj2xW9fDudA3ycgZlc31w6srLrnmHupYlYSI6DkkjB06OF2xYVB3RXpdOx3fL3vVodN8mg== 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=fwGsNws72j0bUsX8RT3yzn8iKBZDTYed2C6LZvdY94k=; b=dJs7PdmFUdyb1UYjsI7WHackDP/Hlc1nkZ5ZJ6uNKpwztTDZJseE6blpvUK8DwEj4PhLVjcLqvJkfuEb3KhBY/Zha8a41z21MDw6QKq2vaeZff7Bl+nLEYXK+Zhw54kzHr0yoXxnCWi2g/oLD/ai+68kY+okL0ZYa07l69zA+CT2CDo2Jf3fcj12qLcX1u0QrTPhoyZzh1AdhU9is9AejUd/gL5eD712Rai0E0gKX91OTWk7IIP2WEgmGCprZzBGAQiJ/CUDGbivj1OabeUAm4Upp1Kx0v2QpgSZecIL4htxrlk+v9elW7Xiioa7sDcolO7izyEFAaeCNY+92gS1Aw== 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=fwGsNws72j0bUsX8RT3yzn8iKBZDTYed2C6LZvdY94k=; b=y2nLoeQtFTD1SQ5v4eniLN562tklxlwXrwIDQKwuZ/PyzgT0yDCkxYjhH5mHj0CEhAUwRB2jk66qLzMkU5x8A9dSKGh1rltPEuq1Qq6dN3CKZ4/TH5NT2fp3DhOy1Pp21m9vhHTGUncMAFDvRjOYct8LsuUEHelBiXXGnT1Pcdo= Received: from BL1PR13CA0015.namprd13.prod.outlook.com (2603:10b6:208:256::20) by PH0PR12MB5646.namprd12.prod.outlook.com (2603:10b6:510:143::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 10:20:28 +0000 Received: from BN3PEPF0000B072.namprd04.prod.outlook.com (2603:10b6:208:256:cafe::c8) by BL1PR13CA0015.outlook.office365.com (2603:10b6:208:256::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41 via Frontend Transport; Mon, 6 May 2024 10:20:27 +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 BN3PEPF0000B072.mail.protection.outlook.com (10.167.243.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 10:20:27 +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, 6 May 2024 05:20:21 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v9 3/7] cpufreq: amd-pstate: implement cpb_boost sysfs entry for boost control Date: Mon, 6 May 2024 18:19:55 +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: 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: BN3PEPF0000B072:EE_|PH0PR12MB5646:EE_ X-MS-Office365-Filtering-Correlation-Id: 707a6e0e-ba27-4f8a-1481-08dc6db6269d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: FAdoHmAHZNvVC8DdRxb0REP7dYHyOQLU9eUrIaRUIvyjLCwyGYyC5B2cRJfg/GkUF3jss4PGF94fYRVdjFFNfigVsWFVcMJppMhPIFgG1UVN0MDyERB/XXKiq1ZziEY3tL9j3PSC+EvkzvccU/2r2ocjTabn/zevU7u4AaScoxTjC0jkBOSMB4XW1ou9X+z7IBj14lvF0/1QSGVy2MPtdACB+Hw5xcy80rfrnOFVcqefY/UkOXD+cwaBrFwsN6T2EChY79S2IcUh9lYuDv8OqXYNzLfH2kObJqm0jo0FES08UgRohBY/JS7NauDy4bhr4XhT1mcaKQNclGALi7qFrvBGBSJEWIpulGSHbHIrtWdkowFv4/8hxDNfNpo4O5UoBUueXVhXOQ85n94lWWdaTczUhWJQTD0to8B69Hscz/2bLTxxSuK0ljyDLMz2l+mP0+FSoLiDq/8TPCgGrfyMJ6mlVQ+z6VJS3XEnjpyF27lyEG/Pz8OuaRrQ7iLGH9etsdPGKIHHiacx75ChM286jUwxMaDRRNvZKIfesJR/9vMwvvFtnNCjDXVBi6E5w7PcPxLc+pN2YKonojM8jvOTIoSCZSp5Fn7OWrHICKRUqx+2i6KR6bl7XqgOWwwONcHmzw2WN1Il7s5nbkZlUVTfd7XvXCs7/fdZF7KaHQh5U6TfI94R8z3CFMF+Wq9putcj9Ga+ond8iYa+vSbk2l9ULMVY6YEKOHy+GuExBG4W1sFFqYU7ZSWO0l9sxQUktL0G/Zv2AftILxvqAocjB5GaIBCy3PSfNbvTjq4sSi1uWuCF33AecAQpncRBAoUc07330Ilo35xLHZBhG7NS9gBOXwv0OxpBSlOjFBAixYVBNhiQNe4IqOjMFpfBqASAJeKl01mhSsESzR23PLLwJm8fYZKhN7XfXjsETSUThIZ04h4OopLjeqK/0RkXdKiNGRChasvxkhTMzqHvspkYS8dlkYSlHAUKkonSzJqB5vRFoZ0VXt4YmxnM+C9r2GsUy5iEKWi0JTkMGZCxHuQw4d0v5sqb0m/T8pbLlUSuG8MK6BiFSwEodi1SFFmfgnmGC4vVNIPeJQthp1ABCvxu+mfzrW12JkLm0XLnkdjDJYXIP6x/D9rxesEK9+9PWoXHXLq/suBqsrbnErOHXWoGFbLCXX7X4NXIfq1WN3EVinlHsnzUNZsxVtQOSov8AdNagYY2Esiwdm4wRxlmcbnwgf71nAvJDydeupzPH5ExLGIBZQ0qkugZgMPS/pbwDQx0oEobZYGdkTXNld2kSRZJ8RgliWqXxYhmXe/W0PUhLT6O5Ex9wl9ZNz4C9iSzMp7YoYu6 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)(1800799015)(376005)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 10:20:27.8603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 707a6e0e-ba27-4f8a-1481-08dc6db6269d 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: BN3PEPF0000B072.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5646 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-ut.c | 2 +- drivers/cpufreq/amd-pstate.c | 114 +++++++++++++++++++++++++++++++- include/linux/amd-pstate.h | 1 + 3 files changed, 115 insertions(+), 2 deletions(-) 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; diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index f7dab0f7b452..f81fd61dd2a9 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -686,8 +686,10 @@ static int amd_pstate_boost_init(struct amd_cpudata *cpudata) } amd_pstate_global_params.cpb_supported = !(boost_val & MSR_K7_HWCR_CPB_DIS); - if (amd_pstate_global_params.cpb_supported) + if (amd_pstate_global_params.cpb_supported) { current_pstate_driver->boost_enabled = true; + cpudata->boost_state = true; + } amd_pstate_global_params.cpb_boost = amd_pstate_global_params.cpb_supported; @@ -1293,6 +1295,114 @@ static ssize_t prefcore_show(struct device *dev, return sysfs_emit(buf, "%s\n", str_enabled_disabled(amd_pstate_prefcore)); } +static int amd_pstate_cpu_boost_update(struct cpufreq_policy *policy, bool on) +{ + struct amd_cpudata *cpudata = policy->driver_data; + struct cppc_perf_ctrls perf_ctrls; + u32 highest_perf, nominal_perf, nominal_freq, max_freq; + int ret; + + if (!policy) { + pr_err("policy is null\n"); + 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) { + cpufreq_cpu_release(policy); + 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 * 1000; + + policy->max = policy->cpuinfo.max_freq; + + if (cppc_state == AMD_PSTATE_PASSIVE) { + ret = freq_qos_update_request(&cpudata->req[1], + policy->cpuinfo.max_freq); + } + + return ret; +} + +static int amd_pstate_cpu_boost(int cpu, bool state) +{ + int ret; + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); + struct amd_cpudata *cpudata = policy->driver_data; + + if (!policy) { + pr_err("policy is NULL\n"); + ret = -ENODATA; + goto err_exit; + } + + ret = amd_pstate_cpu_boost_update(policy, state); + refresh_frequency_limits(policy); + cpudata->boost_state = !!state; + +err_exit: + cpufreq_cpu_put(policy); + return ret < 0 ? ret : 0; +} + +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; + + 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 ret; + + mutex_lock(&amd_pstate_driver_lock); + for_each_present_cpu(cpu) { + ret = amd_pstate_cpu_boost(cpu, new_state); + if (ret < 0) { + pr_warn("failed to update cpu boost for CPU%d (%d)\n", cpu, ret); + goto err_exit; + } + } + amd_pstate_global_params.cpb_boost = !!new_state; + +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); @@ -1303,6 +1413,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, @@ -1327,6 +1438,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 }; diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index 8ba5dd4d3405..56f616a5cd0f 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -106,6 +106,7 @@ struct amd_cpudata { u32 policy; u64 cppc_cap1_cached; bool suspended; + bool boost_state; }; /* From patchwork Mon May 6 10:19:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13655268 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2076.outbound.protection.outlook.com [40.107.102.76]) (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 826F8142E64; Mon, 6 May 2024 10:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990835; cv=fail; b=SNfDuv5m1ujQBnQtQdsPxbg3bZAU4NpBYmiQw7bHwXUBfClupA22RKNIN0xlA1dwNIMDWm9QC/zJthDehtYuHm6M4QtQmc6LUfse0S2Vt2+x2LOpRFXnyz63BwMbJd7r9Rl55XcqXkBJRg8TavMZhybzer2ogJXo4pKVU8kzrAw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990835; c=relaxed/simple; bh=aj+jVm5Y66yLkhCotmOflseLcnj7xeRrxtuzD4R8NmY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mG7zCT9qylW+NDFkXos2lypzi4Ieg31ybBW9FXpsYdGaHBTkRQIZR1Bf6R0OvbBPfR+nqKuiGkNNx4/Jc9MDRJjquFgRtlSbrpgcPwqmFMZauyqQnX4lBWvVGLp1H4qppo5KuqXAfi/jEXaMuNf+W5EudKIt+fmaYHmzBs1QRXQ= 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=TQJ+YOb5; arc=fail smtp.client-ip=40.107.102.76 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="TQJ+YOb5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VXc0pVxdQaH9lxNPeR8DBJdbsPSoPQCglfUn8Nj7KVMXgImv/ttYi/DILrxc+P8VSNaR3BGQuadHZLA1WuTWBB0ARy6sK4pzUSIX32c4gj5FgE82cFYp+w9T37ndFtGp7Nt75duQV8tAvd/p1osNvfL03RbYpn5tjDLRl3aOjHKHU7aMdWmc+qo67923TzKs7YaTdKKxxSi3aIlW3cBafAP6m+9TtYWtgP8Jumss37cB45foxsK5jia9l79PBrbPQqvXYuRgGOs8JMBAXxDnce2OTCgeBjWPoFuzkdTrUsbXpmrwu/gPthcszzlzq2831wsM2YzWGArFvmju3aDKsQ== 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=Z2+kQZEikSpTsYjgg4K9mRMLS7fHH+01BY367aQ2EI0=; b=NXB2ZLZwPmewGjYaN/il63gYYl+Qfx2ns5ntxuuF0dKJusq5A+mMtHStfsYBBSyof/HGbP3Wq1kKZSrjGIVLgYutF5V7wb3ALTlZvJ8pDJra2ZuFGVuVXhKvI+6bZCYilUlgeoAA++Rvkj8wPYW+q5Xv8sHw+0RHGpOD0BSKYOkZFc66TXT3xXg6rfVFL3asn3WYYRTHvthCloNqERld8fcKrfoq4RNGcaYQ+8OLD4JMK6se/0iCwpsFY76Fr7Q64fYf2YnyE8Bvf9vTTPtq0yeJTOA0RghVNhqAMG64yCw4+sKVP4s3aYgIiHkVP8VM/lmzM4APN7s088D+U+3Alw== 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=Z2+kQZEikSpTsYjgg4K9mRMLS7fHH+01BY367aQ2EI0=; b=TQJ+YOb5mFxQi2NRkU1LgxYmTEROKYjxFXrOVNgjsXpZEjOt9KGhoqX+6yJGBQyArMYgYDRyFLvuGpEIwM055L9DNFXdbVNsOtW+OT3QuEa271edecvRkuUF7k265/5KMIpSyYjwg00xJj/b6T7SSs42Pk/fXEHfsajYWynIBDc= Received: from BN8PR12CA0014.namprd12.prod.outlook.com (2603:10b6:408:60::27) by SA1PR12MB8966.namprd12.prod.outlook.com (2603:10b6:806:385::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 10:20:29 +0000 Received: from BN3PEPF0000B073.namprd04.prod.outlook.com (2603:10b6:408:60:cafe::32) by BN8PR12CA0014.outlook.office365.com (2603:10b6:408:60::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 10:20:29 +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 BN3PEPF0000B073.mail.protection.outlook.com (10.167.243.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 10:20:29 +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, 6 May 2024 05:20:25 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v9 4/7] cpufreq: amd-pstate: fix the MSR highest perf will be reset issue while cpb boost off Date: Mon, 6 May 2024 18:19:56 +0800 Message-ID: <08f1feb0ca38d603b8eef54b2e4db3a1cf35f272.1714989803.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: 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: BN3PEPF0000B073:EE_|SA1PR12MB8966:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e98250e-e68e-4168-a00a-08dc6db62760 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|36860700004|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: j0Zhl3OG4MslFXZq0bCxdRN+FpQqFwkHXPv75klpcbfiiIArvoNCr4a9dkRDNCUfXYxMCmsXNNx82alqSDj8nI2YA0nG+yPrjx2plhQQeIkB1Hv7SASr9hcAGT2kOj9MpmfjKSUXB4Q1p41g4cdYFqNMXp+vvp6zL7+b3XsqJngssqSIzMR4+wccqjmwLwCF3a53CqDTnO2fwrXvNgnuvvNBy9GdKblIfeFUtQGaHO+yaQuHrBcHtch/eTYDtw+e3Mq2zb2wlCosvsqvVnZQP7qFKRXwD0j6LzcpnBwkzVPOs6c0rkXVbaAN2VvjpoOqprCN/SL4I2xLbCEYcvjDXHFsdrYstsay3YX43X7gl++N4UEl0wrk4zhNY8bU5Vo/0mxrmrBE1vWBP5EdXkDe9P8dm3JH5na0V6qbEmcMz2PlSj1QwyR+90eMAvGSEOhRxUHMFpkLILFuuzHw/C911iuUDCIKsJsRc4XniK9110d6zTrsT8vxMfo2tcZpaXThgMHyfXQL2BRWAq1VI67qzzdpMwtuZJ7enYbivfd6EA3EjJcv3rsu92ne0jH6I7t1XVoamvsvyShaE4cKlAEydX1t0lKhzdlWWGdgTAKGu2m43hoPkK5u/VGtKPR8WD/eBXF5ofb9oL640Pr4oKiCbG61YVX7JHQNLC0mNGAdbPtvHNrLuw+GCRSxSaozcoRowB5qkl8RB6p0CL6Rv5rAX+NoY4a3kuUmu14fNWj29MLK7T9x6IFX/dLOu1QFlnC9ONSTJrV3AFjGpCpOJqN4hkbDrIsUo1FforuHbtsnQueJJdW5GnBrSA0oRkpJC9SYHQK9y5YSPvrx1HQDWGGfgmFO7BdkADHfxSgAMY7CiauACbeM233buRaKobIzpnGaonIERfwkiR4zXuz30nj6eLOwbgVoroUU3YobiIaj4G9nRi9aXes/9PGaq3mhZJhm+H7hK6UjJ1v+uoaIbHffVyX1R9fhCFg8V3bwFgcIzxX4pKtER2X1DgzRdxIIoH9AVhizp7o4XGWZAh8pdjgYAG/EomQv3E9kSAffmHmyOuRX/ToVxkv+Ne58LbZUhayDCIT3eqZPZjrHuXESBE4ZODkQU3SpjcwQCi06oswVI00xUkU2UbpMBSe5pg/vperHp/m+7Rc6Lc79tkFaTuHnQNhnUfVfKdPe8ACuQ5vQ5yJAMIKKXcFMO333GIpej5owHqP9ZSBmo5tO3lNCLQRY1n4/VF+rOqWw8KaaRPjIUYvrMCBbixWDuClItRgGVJET6/Q+zqwpGTkx2EfifkF/XBrVwHVNCd/p0vxh69l70aTyo2e+9F9JIxpnQ1pFrzbPebc6Rmxx6WyhRs0fF6tURUCiWw1K0Xj4Zs7aD0pDtJXvf1sDu5SgSctbmKk/LzVV 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)(1800799015)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 10:20:29.1418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e98250e-e68e-4168-a00a-08dc6db62760 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: BN3PEPF0000B073.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8966 From: Perry Yuan Select the min perf to fix the highest perf value while update pstate CPPC request MSR register, here it needs 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 Acked-by: Huang Rui Reviewed-by: Mario Limonciello --- 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 f81fd61dd2a9..11bce2c1db32 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 May 6 10:19:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13655269 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2051.outbound.protection.outlook.com [40.107.220.51]) (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 30D8A14387B; Mon, 6 May 2024 10:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990840; cv=fail; b=fj+zXcOKlyqXM8oivQ5vQC72J//VGEGi03QF7BlHdnOkvthT5iUaL6P6O+pe+q+LetwV/Rx8nD8Uk/n5bo/Gdnt1C6uAQd6GhX3xENOywTHbzbmeCBeALUSBWNee1z57UuD8VK6eUoIHjl67IBYT6y4uUkODxp30gc+7QQvNmC8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990840; c=relaxed/simple; bh=C4p2sKZdGRylYCgyqAJR+AyPOjBO2/pXljtXbG+zUuE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MFaHwECoxK14ZlYmUT13Ytr2ljLpZN1qn+7jTf2AKm4K4hYUkzg72bG1JGy0GAqKxozM7LhygPnPPSN2b7Fx6PlZYOPwDLtafhJ5gszOBZiR6Qo/fx8VRbs8L+e4V+rKnb0TpPxAUiFGuqUbGuqWAoQ0YwSDy4J1mnAbkWUwAmw= 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=dKiWnhFW; arc=fail smtp.client-ip=40.107.220.51 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="dKiWnhFW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hd3wWt+N2fvqW6tucFBoobHD7iKwWvskACEODDC+D2p+Yucash2bBGElhTx1LNheG+TPhKANvhDTp3iY71hU7bD2A4MhhBge9Qm1VCnUD3zl70v5nxplJlXK+fJbhh2vZNETPhO9dcIkT4/VXl8VoRctd276GW26q4Vg1p2VD8sHZ+McqWTLi3+83aatbZzUZqNK9yAYcr46y6sUt3RthNkuslutGzMMEjZ02D+0/QWO/PvovSSlbj+qP3H+hdhcq6eB/5fkYKHTPFl4+GRKvN4tvBy5WMD0mftLVriZ8+TFXKp/n0NMQ9TwjhqflXpVBA/LIuancgi2kEVHhO/LRw== 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=XqzLW2F6MFLyBn7JQVf8j5zr1FG2UBh8bVqCrKBuyes=; b=UFU7T7bys7tyg/YhQan7GMVFkOMa7eSmMNXofxeRuWTVG2xvQJEMYq6J9m/5p44hKHzV9NZMbXcEzwC0/yC3W2kqILjKVDGh2N702mbYpba/gMfCktVzfA5QfCJAwWbjWZCch6GldaC1OA1ePh3JsIl56IZio0BAlkrTzckplSUsl0hBkgbD0mGx++BQ2Z1I3gXz/6nL4HzrjDRhTTi7v1JjO5Hu0G2Hzc5Zja1hQ8askVGBiKrIlks9m9u4L4A6XY1DVeMICHVsUULbkGQw2mNADXNxAGUmmUn+bfhTadbtw+Db5KtRKVYurU14wXlTckNCqgmv0GCOQddu0crAFQ== 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=XqzLW2F6MFLyBn7JQVf8j5zr1FG2UBh8bVqCrKBuyes=; b=dKiWnhFWExCDFcbQRaUxyrQOEoyY9XZSyfycem68IBhRSA+9XWmhHl7hbClOMxvjLH/IjyLmPK5LuTxvDZGByJRzDWAhLlPusvTCqa7fgcidCKS1xot5krxrUvxibrP0cuYiLyNxKHQXQ1qOd87PFIPTV7UFMNOFC35stVEkLic= Received: from BL1P222CA0018.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::23) by DS0PR12MB8563.namprd12.prod.outlook.com (2603:10b6:8:165::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Mon, 6 May 2024 10:20:33 +0000 Received: from BN3PEPF0000B074.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::be) by BL1P222CA0018.outlook.office365.com (2603:10b6:208:2c7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41 via Frontend Transport; Mon, 6 May 2024 10:20:32 +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 BN3PEPF0000B074.mail.protection.outlook.com (10.167.243.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 10:20:32 +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, 6 May 2024 05:20:28 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v9 5/7] Documentation: cpufreq: amd-pstate: introduce the new cpu boost control method Date: Mon, 6 May 2024 18:19:57 +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: 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: BN3PEPF0000B074:EE_|DS0PR12MB8563:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a904711-32b6-482c-d6c3-08dc6db62961 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|1800799015|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: cCU/wv8rUVx3qii4qps/QcLIZJsm+fohpunFnb0l0IIcka3vtEPOCM3Wc4/IeArHp9Smx1ATT+dwE8TMigDwjz+cpbq36SXt0TMGBG52Nnd5wiQPDdV4niAHluTY6sfEupvTyLvxhbTWHBoFwLqCwgJ7tU2MzB1zuovSrZnDzck1DnBkQhq30BkHpRH7Un99+Pol7fme2rHv864SqAmcoJYpBgg00MBZpi4sxhXuxSVcKSy97ie1WRSjxM2sRLBuErM08FN36Jk8DnDUIAdTJ2Pv/OgY/z4/WD133DkY9J/lNcVFK38h01c000ZIw+/NBqsApfCU/CsCNz1rTJ0scN1eDo72VdWvqBpKaGEa06XjKpQRFsyord9ZfmOL98PWwVuSOmkbnxewkpKwns+JOyWazIl0+i1uBr6rAMiv217QHVCsdf6r7AmFMP/M8oK/1gaT7nM3oR7OYKaO19ol8c+g+i9v4ID5sdZwQPZ19vdoFiF6P1gEMAT9OUfi/bcdf0pt1U+Nv4hVTVgM6e4DGszBPaH4Mvewg9jqfrH9wv2ae9mGQtwK9LkgotPoCB4vohZO1uAh+HAQGukWVoaxLH4jdyCVamtHDG2q1nWD4lteD3Moh1d9EdvxKb4+b/eI3UGHQ1Vzid6rycU9On99eZ5FvisWSWSP23ij7ZgwqDkt9PvNWpD72zzQRnwjbuGAHa6dmA7NyFG0bFB4PWqd18ZFfR79Yaq7Z1xb/uc5SspY9V9lQGCS4x3vNj7x783Q9qOzDyFyzEJIlcmRhiQjObYYPmw7subsexV7cZ+FPoilJfAR9CVgq4Za3j31MWsbBvdiQp9luAbGxPI2bUmlWmbP5NQOUjrVFI/P+4qCCgzrQXWLCyWXAW1cxFw1h+CZTvoctoFocnssI8LF5O3Fwa6zj9yJnjdQcn/wg8YvPKHLet+SnCwyyCo+leg1bvPpRC5AsCThkyG/vaSXZXua/9JJJMISwFNtL/QRl06adN15NqOXav7DyQWkQQTtVb+G/YxuOyVKJr54ROfU0YkqR+m/Gb3SxQ9ICqEH2gwvk7xp6J5VGimmS4rUl0LgvDYfuzwy4maAeEPXSMoKv7ublo2FLnxeLe5197UaH01i1EzXKDMH8oOJzmrwKVhZVtpsNvAw+9X81VQcoom8ly/G9WCV3S9DwTHphheAMggYGKggJ3UqK4hMTcQMusgEeMHB4MzfjSIzm8NEb5iaMAwUz0Faf/Qs1NWnBaGVdqoFLZVEjGxVcwbxC1GrcHOZ9Exi2b2ggbr6QZSXW5NhX05oiJvXIj7M0qUvIOgAjDIpjlOMuyfmTew20U5+6IHU5hfA54riXUTXOEBOmkcm85bLZCtF2Vqul+Tpz+skkF24c0hhnHW4iq1Ht9iaPTDdx565 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)(1800799015)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 10:20:32.5052 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a904711-32b6-482c-d6c3-08dc6db62961 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: BN3PEPF0000B074.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8563 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 1e0d101b020a..bcc0d9404c18 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -440,6 +440,16 @@ 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 attribute file which allows + user to change all cores frequency boosting state. It supports all amd-pstate modes. + + "0" Disable Core Performance Boosting + "1" Enable Core Performance Boosting + ``cpupower`` tool support for ``amd-pstate`` =============================================== From patchwork Mon May 6 10:19:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13655270 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2078.outbound.protection.outlook.com [40.107.95.78]) (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 7DD35143895; Mon, 6 May 2024 10:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990841; cv=fail; b=cdE+PqN/BmtCjcReziTQmlvYHQdgYD2i/ySbNYLB6pti6Z77jbDBRldiz+bGf6pfpdlysc10xo42c19T94pm5pRiAlvNkFNoQdWEfUKR/sQ6Ok9SY5JDmw+Jp/izJU6ya4ciXun5kNXZd3wtZmI4R+fTUSreh4dWEwffazK+oVQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990841; c=relaxed/simple; bh=isFPpUyJnBR/hRlNSj+NGC9cdEnzRVEQ+T9uTQv1ywI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FmuLMVQx8OZSE/Qki4yGfO9w629Ua8mxNbFxrqWVg0amXT64XdVYfQtmXvnIKK6ZfYJI3mkrbB/OB3SHBIKNtSQ/y+zMvP6fg76LyD/Mi7CzpeHluy6g/cqjnIbSpNQlGcowRyJRsycnweg3o7vwgLqDMewLIeR6q7EHI+nQCs0= 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=i1lcAJaW; arc=fail smtp.client-ip=40.107.95.78 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="i1lcAJaW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ayEByxG5Et33rALjf4UJYfSeNWDNoJlKzbgGLg/3nFHAfRgzHa4h8iUg4jsW7ao03nJmqS731gxi87icmRi0Ic5uAo8C5l8ec5Xi1pipM/1/cvSwrUfLXHXouzsi3BcU7AFn6RYMve3Gpo3e9W5+wrSe/YW7EJRF6LkmeKngVFbbty7Yy4AXadPaJgzRLFGP6VNEpLV4/26CA3rIphCD9rtVvOywMuQ6LEu2c8gTdMcITibAH0Ryhljp6ygjy37POOwURvAFLVnBUQeQIDKUz9ERo3CuMnIJnscJLUGp07KO19BiUya2GUqNqc6bm228+YqOQIZTCms30L+9Pitw4w== 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=+RApvOUKP2rbFICnNhXz7wnpAt1U9csFWck8V6TnnDo=; b=ksDeRiwczrzMImebTyYfYFphDDZQ0rDPHjaLI1KzhT6JCvsxrpRxLwEsg1vRTBbB7McQFVFYYHJ0Vtf+pq25yKOFSuKtgKzWUnros0ATyhe1OlYw476d+WjppwsUlht/cepBrmF/5nbLD+JN5b1GjvEmDPcn9e1Cv7iVNQ/CDlDgyw83HwX0BcoVms2X9qkVDwoz/sF1icOwvLnCaBb8VLr7lMIArKfnALFqMHb914qhIF17sd5G+o8yqXK8BiAi/KwNYqHfqzjyX8WAvR2AuPqNQDcrNj/GF0OE/RfzBLZg+diFdvcRV3NDrL+j7+/sVmqxfYut9qH9X0H8obm5yA== 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=+RApvOUKP2rbFICnNhXz7wnpAt1U9csFWck8V6TnnDo=; b=i1lcAJaWc5AEkhILnv6F2cy5wVzG11DWF+g9+tD5f/yMZ7WteZGCQuoHYPYSO3e5CfAL1/MEfh/B0d1YDfrc/QtClPa3hfPIurEwzxCr1MdRyg2KoKcWdoSV5iypyH77D17vXHqFSPZ4mi6IxA6dTV/ZeurJJDOKehdVAAuMic8= Received: from BN0PR04CA0205.namprd04.prod.outlook.com (2603:10b6:408:e9::30) by DS7PR12MB6264.namprd12.prod.outlook.com (2603:10b6:8:94::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 10:20:36 +0000 Received: from BN3PEPF0000B078.namprd04.prod.outlook.com (2603:10b6:408:e9:cafe::b7) by BN0PR04CA0205.outlook.office365.com (2603:10b6:408:e9::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39 via Frontend Transport; Mon, 6 May 2024 10:20:36 +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 BN3PEPF0000B078.mail.protection.outlook.com (10.167.243.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 10:20:35 +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, 6 May 2024 05:20:32 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v9 6/7] cpufreq: amd-pstate: introduce per CPU frequency boost control Date: Mon, 6 May 2024 18:19:58 +0800 Message-ID: <2d200d0fb4135465e81b9213de940e31a7b88dce.1714989803.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: 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: BN3PEPF0000B078:EE_|DS7PR12MB6264:EE_ X-MS-Office365-Filtering-Correlation-Id: 34d5d524-4654-413f-a5d1-08dc6db62b4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: 7QMiZfuMsYyGn/xaXLMsB/6Vsa/nIeGUnNPI7O3f4aAsWVFetZOqmOSK2Ts7osEnmUb/cCNct/NPoVeKaoC/6sCql6BP5BzazQg36x02evcQ3khtmlnRt6nHK889eEonVWWnUg5E5rHHYClt8TuUnAF/bspq6rX3WHpK/I91efKcUQEyVXVE33ROYpgXL6wCz5uLMMUt4td0UtDqbMJkc9XUhT9uN8KjXkN/xfDTD9hUmbbx6eUgBWFlz5yCVC/LbOYiocl6avmUgTMcLPdPGQeY/MpSD2nsh4xkaa9fBVAjFobxnKtqvyJbfNLAt6fUiJJ+sKw9Vsvkzig6WcgZY/NkrmV7vQ2ZUcVv554PvTHbDgzE2NY2/GwSyKE53UO3RCCLAby6sCqRGKg2b8b+Q/iZ14PrzUJMe9Sp3QkkpZwN7D+XWtGFDjcsvS4xSD22oBDJ/uZXepjDlyqtJGMkNPUWimXfZmapjms7bjL5ojSlS6qPjhuz9SY2kC0ifqz0R216g82EaA+TDjA50lJQvBagntP0sw2R2ZZb6et9SPsrLwFY9iuq4P4/MdOze8shKim6F5SEN2H5dxSEXtkKWHTYNt4WQ4yj6RIVh5ZmIUlrNnRCryF94+51FItyTJQQ8g4+IKmREJKYQoIJp4osqqP4BmbCgnH18zHiXRjXWqdzeKiEmZTapglgPd87sd9Y4uxY/eQeua/6gAZhwUz7OEIOBsmLjIP4XWRuaY6ZycSyhgKvjRjJlA/ngdZlrBtw7+LZBxsYAPC3V3gyKUNlX15Yqa9+As30FtG2PXGKjg4w809GG0otOiEtkycnZ79tCdi9tgLQsh+8KoKuZ9CoKcs2wQ7ULYNkug/3nbseXtITsXw9DhdLqYQm003aSwnIM1ee2J1tuEVs/vniNmhENiKb2pnDVenVJawMp9hAAAsDHF/JENX+rNjhn4ImjDR3Yiupn1v55HSbF9vNAj3ExSFTxGarR54z2acPyO7OFcQdQYhoV1X31vRqbMahHRG/OAGCZW9J5eTJCc/1S4HHMmQ4Imn8s6MxHbNwH6QNX5EJICk0/tIhhlCOQB/tBkrLRPZS2PX6GklYdZ6a2B4zzGDHnThTDiqniRzFSh9YqDDY1kok8Pb+3JKeUCbJpQajjPeZmGnEitrPfgDKmdnUla8UJ3EHP1T52qKimtFb6aHvONElKo4eUfyFssKpFXqtPd/lJ2TofUS6nann1wjONRAK/Gc55Tz5RM3radHRpOWC8NAul0BanIUdMiLkAsZh/W70Fy1ZkjUDrRxrCJENwsoNmSCP14UtIvEEO5nZnKySSzdHyuVJiXcydT20Q9mszvqQa+iwTDaVfeD/UJ1YksOAg2bUwAK3rQBk7vyqv6w= 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)(1800799015)(376005)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 10:20:35.7505 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34d5d524-4654-413f-a5d1-08dc6db62b4e 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: BN3PEPF0000B078.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6264 Add a new sysfs attribute file to support per CPU frequency boost control, allowing individual CPUs to enable or disable CPB separately. The new sysfs attribute file is located at below path, `/sys/devices/system/cpu/cpuX/cpufreq/amd_pstate_boost_cpb`, where `X` represents the CPU number. To disable CPB for a specific CPU, you can use the following command: $ sudo bash -c "echo 0 > /sys/devices/system/cpu/cpuX/cpufreq/amd_pstate_boost_cpb" After disabling CPB, the CPU frequency will no longer boost beyond the base frequency for that particular CPU. for example: ---------------------------------------------------------------------- CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ MINMHZ MHZ 0 0 0 0 0:0:0:0 yes 4208.0000 400.0000 1666.7740 1 0 0 0 0:0:0:0 yes 4208.0000 400.0000 400.0000 ---------------------------------------------------------------------- $ sudo bash -c "echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/amd_pstate_boost_cpb" CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ MINMHZ MHZ 0 0 0 0 0:0:0:0 yes 3501.0000 400.0000 4154.3140 1 0 0 0 0:0:0:0 yes 4208.0000 400.0000 400.0000 Please be aware that modifying the global variable `amd_pstate_global_params.cpb_boost` will overwrite the individual CPU settings. Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 11bce2c1db32..44531711a5fa 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1371,6 +1371,30 @@ static int amd_pstate_cpu_boost(int cpu, bool state) return ret < 0 ? ret : 0; } +static ssize_t show_amd_pstate_boost_cpb(struct cpufreq_policy *policy, char *buf) +{ + struct amd_cpudata *cpudata = policy->driver_data; + bool boost_val; + + boost_val = READ_ONCE(cpudata->boost_state); + + return sysfs_emit(buf, "%u\n", boost_val); +} + +static ssize_t store_amd_pstate_boost_cpb( + struct cpufreq_policy *policy, const char *buf, size_t count) +{ + bool boost_val; + int ret; + + if (sscanf(buf, "%d", &boost_val) != 1) + return -EINVAL; + + ret = amd_pstate_cpu_boost(policy->cpu, boost_val); + + return ret < 0 ? ret : count; +} + static ssize_t cpb_boost_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1416,6 +1440,7 @@ cpufreq_freq_attr_ro(amd_pstate_prefcore_ranking); cpufreq_freq_attr_ro(amd_pstate_hw_prefcore); cpufreq_freq_attr_rw(energy_performance_preference); cpufreq_freq_attr_ro(energy_performance_available_preferences); +cpufreq_freq_attr_rw(amd_pstate_boost_cpb); static DEVICE_ATTR_RW(status); static DEVICE_ATTR_RO(prefcore); static DEVICE_ATTR_RW(cpb_boost); @@ -1426,6 +1451,7 @@ static struct freq_attr *amd_pstate_attr[] = { &amd_pstate_highest_perf, &amd_pstate_prefcore_ranking, &amd_pstate_hw_prefcore, + &amd_pstate_boost_cpb, NULL, }; @@ -1437,6 +1463,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { &amd_pstate_hw_prefcore, &energy_performance_preference, &energy_performance_available_preferences, + &amd_pstate_boost_cpb, NULL, }; From patchwork Mon May 6 10:19:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13655271 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2064.outbound.protection.outlook.com [40.107.243.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 40B05143C6B; Mon, 6 May 2024 10:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990845; cv=fail; b=DMJvx5bGCEeF7xaNM4OitedFlfnRD15u9QqI9j/fxqzc6tjeQlnBCnsDiPFB1iaI0ZIetE9WMwVvBrxPB1NcFu1Daoat+/eehsTMeAOWZxWma+5gFHPPwNCFzgQCO3iiPss8zpWlgOiCHKBv+JbqmajbNTNdYI91PMSfkY/BzqI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990845; c=relaxed/simple; bh=t029aG3VpGM9EDdeDJfxiYyBAOtulunLbZJNHZx11TE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pkuvREN/YCghf5QcB5f1bSbNg17fdA9z1i1tmkOdZiRlLHE54XClgx7KcURTktyDrqVtl3UqWuWp6xllW2vnSi+FI1iAJJ0zEnq5IFcEmlIuO46tL4wu6eLTVYqzjdhZzXfCkgaVc3qxYNhozdhJeXY33rtwQkewxkDCWv0JVSE= 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=l2hn9EZ+; arc=fail smtp.client-ip=40.107.243.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="l2hn9EZ+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CnZfdVWjJrA5Yd9iiKaPbYQqJOdWU+Y7YDsoqlivR4nx81kckDJ6pA1gQ4XXzgCU/L6dZotwH3zTOo3FquHZ6h5nSt8TeIY4kKB+10z/Xi9Es5fGUW3qij5w6s/odlJHR9l2vlyTwyVsYldZGoeqYpFk/I7llbH0Zt6vVjRvavvslU4mCWo/rt4skXM86FFHpyGqXTxDIuZGdLBIz2ISM/FZ9yD5rJWl60lZir2XYbRJlOpfiUTZ877cuCcu6VCojO3inWq1EtEYS9R8PdlZu0E71uRvS6UADuQkfGStvLKNHvHjqw+zO2qAPsT7tRgqu1STqXFg4Ea4yOpOm9BmVA== 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=XVAEjbK8KM8yi8GYvslYfpne98E+lCZ03mOYSPnzGTA=; b=VbpRuhFknBLXys40e/wd8bCF5igewXrokkdRbDsTYacPBSdMi+nKx8RSOGUfIAkrEIjmRDzdhDh1MY5GleHS9yvazLw89Bhdf4W2Tp/zUZYhignrtYsl/qFzYSRPD0NVDwiaWUeX8gP3rEBsoLzkO+bW/iaMFlTY+CB/bQSU1N64xeA5LSHSWuqGvf5A9c9JTmIfOvWY4BMFOTxNASDrN7ifHyfBt+b+zrjaA3d2Ej8pzcUNdzYZBdUalN9OeppnRixU6mNjqdm9cgaUAWqezOoc2kxE/VaPpVV+/leZA62sNqVm0s12izjpQ2ngOmT03p1tU1loC1vcF45ttW3i3A== 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=XVAEjbK8KM8yi8GYvslYfpne98E+lCZ03mOYSPnzGTA=; b=l2hn9EZ+Qm45zSoStAs0VNd6uKOz2J+CqsmswIXBKlIszwLtVj38fPvVA7L0SmnST/VfEsVydKLmbsmQZexFl/DzM2wCaoJinwasSaOHFSToCD+MYpsiYWM0Q0WfiZQhiwSw3fRleCyLccM4JHexqLvuR7JWDZkg1vx55oxmocc= Received: from BN9PR03CA0125.namprd03.prod.outlook.com (2603:10b6:408:fe::10) by CY5PR12MB6599.namprd12.prod.outlook.com (2603:10b6:930:41::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Mon, 6 May 2024 10:20:39 +0000 Received: from BN3PEPF0000B071.namprd04.prod.outlook.com (2603:10b6:408:fe:cafe::63) by BN9PR03CA0125.outlook.office365.com (2603:10b6:408:fe::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41 via Frontend Transport; Mon, 6 May 2024 10:20:39 +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 BN3PEPF0000B071.mail.protection.outlook.com (10.167.243.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 10:20:39 +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, 6 May 2024 05:20:35 -0500 From: Perry Yuan To: , , , , , CC: , , , , , , Subject: [PATCH v9 7/7] Documentation: cpufreq: amd-pstate: update doc for Per CPU boost control method Date: Mon, 6 May 2024 18:19:59 +0800 Message-ID: <490ec11390350aa5814aa86a4e08cdefb7ce2832.1714989803.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: 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: BN3PEPF0000B071:EE_|CY5PR12MB6599:EE_ X-MS-Office365-Filtering-Correlation-Id: f0fb38f5-2e42-4ea0-b8df-08dc6db62d58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|376005|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: kpTuH2CufZip4ZL1sgGUdLOYdcqI+ZG1aYkLwax+SuhpdsBTkfpyWSh+1HdtD/hnkMqDtHQwjQRZaotGlCVLDnMMMB3bebTBm7H9wmC2+5/N0gMkA+ZZUJQmFnj4IG13P4bC/UIwyYeOzr0N33yDh0CxYornXKBmhGr/wLQukpTkW1UTFLRixzyqNtmQ3bTWjaqNHRteoO3HyuypGBtrID2WSWAYt/s4Qwoa5yz2ulogveLTO6fNHbIEEq4CWnAwaLx6raD7hat/wFu6bdtdjgdsOl+DmdxZ22qOCxF9rBTFYpcutCfE8EchkzgcTiWPVpL7t7PrYDEprFBIWEKZtEX3s4UAOodf3SjvXL0KdIQRSKQNex2lRF3o06t6Gwm/TuQs91yf7TVpnd988gciqG7XEZNvqUWKoW8JCalWbSkkVwSpBkugu6bCkMtO/hCI9Kx7rOnL6Vbc+PZ9wPyAnUKzJ8gBmLv/sCEF7TGzrAVjWONGrEWWtm90VVkRiBWEaYPB04vCaXmVdTHVqaF8tMUu3kxYPtT30GEwxQUQTNysGHKhjAw/8IoYyiGJAC8WCl6/x3jkM5wKxZc88gjPUfoamoT86GvOMrTLMLcq6dCbiFbZdMQzM8kY1g1ETuHvGAua7XuuUvAyR0qRX9Qg5K5B2YoCSvikG4lNi05EWctZTJ8Nm/p2zoiIsyojwv5qr2W/AhhhXwrgdsAXeGYfdV3FzXIouEw9D74z9pLtmEQhuCBBdqkiVC9Am1O6T/q9AbbHcspGNRKRHzHb9UXQOXF4V/MyVnYdgafKP7RohIW9QzvcnD9kc1BrMBUEihsM1BWBhGV4YZq0u5PtS1aN+dQ0lvM4jR2JnqxceOGnY1K1e7XI9A5nk/BYA32ASGObyH/nWMc80U08q0kbXc6fAf1sNJ5glcG8M0s13scTw6TsEioQuPKR5APfYcrrDA5lHB9m9VfC7v/SKGWKzBZWRDHbjnsWNG3colaS4Ff3+7DVnDS09GPIpa9d9N2lxxYM2H2oK772W/iu9d8Nx9vh+cgYMDIOyNYVhNb3tzvrq2w9NYJyY8W5OPKpQJ23m90UEmIDh1vwD+rMgt/ak9fEZUvYFEOWxYN9PnywouFFY7hRaGRnUZNjsU0UEsHrIk0ElU+qLDGc/MVuWACSKSkBmM4ACTl/+i7PUQkyoN8Id9iV73UTyCKitrIvm+VqVAJAS6AxALlyIaGMPCPfDQbqnUbgUdmsPJ7guIUbEYTNV9MGWWJpNPhO8lYV3H8FyjV1BOnjP9CQEDANxyccObbUx8ItirUvBvMKr/bdYByRGkpP9TUo4GoE6mnqLO4q499YOz3jM+c/pv6p5MzdkMV5gMdG5seix8lamFFrxqfeD29xZE21o/eoLBt6pTWkbevh 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)(82310400017)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 10:20:39.1563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f0fb38f5-2e42-4ea0-b8df-08dc6db62d58 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: BN3PEPF0000B071.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6599 Updates the documentation in `amd-pstate.rst` to include information about the per CPU boost control feature. Users can now enable or disable the Core Performance Boost (CPB) feature on individual CPUs using the `amd_pstate_boost_cpb` sysfs attribute. Signed-off-by: Perry Yuan --- Documentation/admin-guide/pm/amd-pstate.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index bcc0d9404c18..8c48b00fc8a3 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -281,6 +281,27 @@ integer values defined between 0 to 255 when EPP feature is enabled by platform firmware, if EPP feature is disabled, driver will ignore the written value This attribute is read-write. +``amd_pstate_boost_cpb`` +The `amd_pstate_boost_cpb` sysfs attribute provides control over the CPU core +performance boost, allowing users to manage the maximum frequency limitation +of the CPU. This attribute can be used to enable or disable the boost feature +on individual CPUs. + +When the boost feature is enabled, the CPU can dynamically increase its frequency +beyond the base frequency, providing enhanced performance for demanding workloads. +On the other hand, disabling the boost feature restricts the CPU to operate at the +base frequency, which may be desirable in certain scenarios to prioritize power +efficiency or manage temperature. + +To manipulate the `amd_pstate_boost_cpb` attribute, users can write a value of `0` +to disable the boost or `1` to enable it, for the respective CPU using the sysfs path +`/sys/devices/system/cpu/cpuX/cpufreq/amd_pstate_boost_cpb`, where `X` represents the +CPU number. + +It is important to note that modifying the global variable +`amd_pstate_global_params.cpb_boost` will override the individual CPU settings. + + Other performance and frequency values can be read back from ``/sys/devices/system/cpu/cpuX/acpi_cppc/``, see :ref:`cppc_sysfs`.