From patchwork Wed May 8 07:21:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 796004 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2080.outbound.protection.outlook.com [40.107.236.80]) (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 137B9288AE; Wed, 8 May 2024 07:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152896; cv=fail; b=KHnEs7rAEh747iad319aezYAz7vYYdd6STPVRAC/d23nMdOOJLP5R7CL8sqyUwuXnb8vTDk8ZjbX5bTbydZFvCDDgCmy2ZZxWFOY9tjy98v7EPtcZvPcblraae7a31dcxSWm+f3eI4I+0n8Ck3gN4dKT6mpI54j3EemiNb0Bf1Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152896; c=relaxed/simple; bh=oEJ1aIAtGosrFyk4IqINDU+8CxFIH3iJUhgfurIlJY0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BVNijk3q4qSkcsWQOdzbVld4Rl4h6jnOMcy/5Mh2vhzpJP6DKSZUSLPMfTvlsmJLXwRGKKKhf42ntOHbUZ2kWD0nwVypsyqQtZ3co9w9HqYVbFq5ajuH8z4rvEuhxGxEY8oVVJA4Xig86zEl8sb3WLuzjDdQRT0Rn4BNF6r7LoM= 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=M0EFPCTe; arc=fail smtp.client-ip=40.107.236.80 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="M0EFPCTe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mBRkpewO8YQELlplOEFndnaVXH4Xd76L37cIkAJuFzHNnSxTAOusEHZFZSO/2+81sMLoyHOq8UdvM42fb3HnY2ru1m+84ArVavOjr2jFMWWN3BUIIt+bCyr97+4ozxLZXm8X7TpYi/KDLroWof9aNfa10AdMXJYWD9Hi/4BeHcabMKxJ0uoq671ayAK4DefmR/Z8EXy60sfEX8JPfs+oe7Q3DeoRWCiU8PMz/rx4/8wHlmlQduvhb8Q4AmTZ579ynS61j/oMf9os7cwC7NpnOg46imp2BIUCTQGQgMh3dXkdOc0bsorUfnFLLcxv6l2zI008LTDDwZbJvk+YEg/9Gg== 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=Sd8c2usf5VntQ49PuklN+zQkA9w1tcs1w4BZZ2Fqo+uOqt6PUoS/9iIP1KR5+nJH8KYQbpuYDk1+NQ9+mnxfSxYRGcjuPeiAZ4b1u7uNwOsD8BRyCteEe4pRU59PlE3Q+X57PyM99ztF9HXCuQmuGH2i+Vr/JTK0N/M9AXHYbhg9TKFIK7aIiTlhg8TxX2VcDR6My/Adtulyl5XlW6QS8tIbVDjdPA8MBDdAPWO+bSIklCuDGUSHBVFL/+DS+DTbZVFkOGJzJn3j16gRFLx4lmhy/pVhaBVUAHi6nIXCjyZ+WSKAGpwaYo+c8fTGIKS+7ZT4V2lR+LjSnWNbXGQOHg== 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=M0EFPCTeWeqMPpuEz+N7uq+cWCdtWTL102lcJqF+uctS0T3vnsKC6GpNRrQPSoTeBPR+inJxaRO5j3nfdzitT6Bj79rcLOBFforWCBn82YqxGmoDAUTaUC7KZgACHHoeJWCChVCHCltE9/ohWD/esqQDnq2cvNtIopwOymxZvxY= Received: from MN2PR01CA0041.prod.exchangelabs.com (2603:10b6:208:23f::10) by SN7PR12MB7132.namprd12.prod.outlook.com (2603:10b6:806:2a4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.45; Wed, 8 May 2024 07:21:32 +0000 Received: from BL02EPF0001A106.namprd05.prod.outlook.com (2603:10b6:208:23f:cafe::c7) by MN2PR01CA0041.outlook.office365.com (2603:10b6:208:23f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.45 via Frontend Transport; Wed, 8 May 2024 07:21: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 BL02EPF0001A106.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 07:21: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; Wed, 8 May 2024 02:21:28 -0500 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v10 1/7] cpufreq: acpi: move MSR_K7_HWCR_CPB_DIS_BIT into msr-index.h Date: Wed, 8 May 2024 15:21:06 +0800 Message-ID: <5b37025fd0ce8f72ae4667bffd85dfdfb21380c5.1715152592.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: BL02EPF0001A106:EE_|SN7PR12MB7132:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f8722c3-94aa-46e0-7299-08dc6f2f7c5f 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: 4vc1aK2jfGYeYMSl9FgzB7oEs+njfzu3U/QBVhmuMddj7HImEC0RYKiXF7G0LaCty56uHys4l91f62bpLikpQWkkjgDd170yc8yHUz7FLcUVU50t1Do78ZjLKLxWxGJAFYGuejTcSrLirHD0wu+GD6Y+QEbxZpSwcEomIwSWAiMhZ7gKPF54xq2GhnqObRdfXFnoLbCuKbdI01kRyz0Yzy2ArjQm+P4pIdMtmyxoIvlBqeWrXNU0iYh9tW2PIfxOhRFlDCYKQekw8fJL24M+tgQkTS90qyMnsyD3vuz+Rkm1b+Y9T4Cp7LL0ilYnMk8xerNxa/hcp4+DNDmBFD82b9VX2axzZ/l1PGpElFgter7ydo9UL18CWsJ3+5TfHanxDbKnn8/rx2/rmgBDP3j1LNFLIq7LUGTr2eqkzCRziHOv4I+m/YxHIYSD585/MWklTXp1iqDt4yPRGIZI2JvyKD/GAd/ByEBnWTgLrTRjj8riwHqTyKgsFcEtqBc/SVZExUfM1SOxe51OTMbwATgkJrd3nrThFmhgQEklsDmGUD36Y988rbSd4Lqd6+ssdgjttzyvKIJ88bUjksNta7qyMEfjuYz9HzYeZkOxT3yxf8hrASZx+fa+adlXC6la5B6tAM4vODA1ml+sEXLOL9YgVx0ULdijvP9xeCFPkV9N92phyQzx2ULkJWFBMH7W2IwXWjo5aiMURApTkJWZCSryvfjlF02hbd2kahGFjkrCeQPWHYBW0QBDck8njkGqas/7ShllQyovV6sfl/VFpW6xpzXXqTycFTlhAs4LEhFVCA6A+GLSMwltlQVCxOW55vSJUnlR5qX/Z/CzRpd59ubRxp7eNeaXtyrpey8Tn9TyG2RM7h6ODGixo27lG6X9ep6EyKi2GWtENJW9hH/jdUAXugUOCwyP34r7CPNT3NsLhIG37eOIn0znu8vCW3ZZrK+1Gq4NXPGqw0bF2rstYvTgQnHpVv5kC/3vDdyeqJqCR/pkANfVKRDatq5jYRc8PWc1kftjDj+4FjgRoujODcfRb/FCMC69EKZEi1ZuKg2fjjRRzsE1qHMAERI4tyCGcEshuS5iCez0xFRkgQJQQ63svaiyJZ6FhEwT8aTXpkJNjOz4vpHdAy5sU/vd1hw820stpo91RMnb7/uh3UahnjEHEWTLw9h3IHhOb00eKGTUD7eo2bBirA/f5yyhVsfc4v1MwaBlDqkC3cBKPHDALjzGEePBOowE50Cuv3A7tYmjrcAGKNdQRabd6mw4YgqUmLv49R1RyhJV5w/etZsY22euGzaqFkeXSOuNM2q/92hu1FfmDNGEBo7/QAxTv9e1Jx3pV5ZPclOWKCNIEcJlSsC7iZWtUXFtrAYAUe/kEHn6MzQ= 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: 08 May 2024 07:21:32.0231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f8722c3-94aa-46e0-7299-08dc6f2f7c5f 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: BL02EPF0001A106.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7132 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 Wed May 8 07:21:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 795648 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2084.outbound.protection.outlook.com [40.107.220.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 CD4492E40E; Wed, 8 May 2024 07:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152900; cv=fail; b=DIOCavzctb6pJI7KtPOMRUetcYDpna2WyGVNOqXXgHIHLKP+AEtIa2HFGsEwFtl75hpX5UZ3lN/iLQY3oabI75W045dwjEzIr0oZFA+kEN8zvyuwioEB+haqZUGbBU09des+MtNGM0qcIKR+GMvaR4cKpYrkPGaHrIn8Q/kD2X8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152900; c=relaxed/simple; bh=0dghC9Gb1tCE887cWqM58tpg82BP2Al8QCSx8BHQYTI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZPeihnA15UdiGaM7kF92yX8KwLDEAdWMp46tl21W9WvB9wX4g1jWm2yhtEItDsZKUww/z/EmF0Q6ES8ijNfuAU+hpLnaKL95+zw0ypn4YZWCPmImLsD+MjJ783nf4hDzHLkJps33bpz3SmGh/+RU+UcqdJu4YlLmW4oKyBphpgc= 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=OmTEmCyd; arc=fail smtp.client-ip=40.107.220.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="OmTEmCyd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HspvGWzMfN3wBl+laJIlGipAw76W/7C576TuXdANA5g22SwNrYv3R6noiaxyLhRit1DpUu5CDQEqxO5QiZ6xzul7P8K0GQlET0YwW25qfpyHseAX0HfRc3cSxG8G7LUAWx2y9f3cstXeZCTSs5MT75W59hq1GJvK0T0pUjqqc7v09Ex2Jo9bPKTznt3qGDWTukEjYL89QJbcn9rT1FO/rsmVCJAv5rzkazm0P5cpinWAJ4XD3GEFqpLPSlbCfGandf8c9FH81zfyN8LKIWwoGHaqbZuiOn0txSFslsGu6Gin4AuG+CGCvHQZR1RJvPztyoRBaz19/Z1UEe4MnQ7SVg== 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=ZnUi8+nhBqEpbmLJfFJFhKuYUUUt3jc3MinC+Hr0XPsiwL1mQROyKUK7Wdijrl2J0k3sp5mJEL+fVpg8kdD/VDQWnVpPFUnxGPqd3boVfk7faj4dn+wzwi6HhH9qflT2ffEWlycfTTWwuYY++DIis4p+86OJ5PgwS/R4NukPIS/S1UvBu4huMDzzPA7K9sRr7U5tSfnAkTrIL8eJVWuMiv/xPPsvCU7l5x84l4wqEi4z7T9hqUMVW2E6J4UHtfF1EF1JQRc7zqWjToCkzueqi8huLYz29Cly2DU7Z9SnIK7HxYJus7GlGhpBNc03BXsnL2+GH4uxSbuGmKN2vWGk6g== 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=OmTEmCydKPg62b1lAPs8672su0+LxhDS9UUjvJ/7yRu2zhLAVaVga2wIacGKbtO2GjYbqySu+0Oq7itVFpw3jpI6SvYQGhfLVnikMlGYMyWgv3GnrPC+5ExULrarKi0jLiFKKzEt35lJH8Gw7tSEi0SEvcJ6GIjtQbxI0Nx90Jk= Received: from BL0PR03CA0023.namprd03.prod.outlook.com (2603:10b6:208:2d::36) by DM4PR12MB7694.namprd12.prod.outlook.com (2603:10b6:8:102::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.43; Wed, 8 May 2024 07:21:36 +0000 Received: from BL02EPF0001A103.namprd05.prod.outlook.com (2603:10b6:208:2d:cafe::ab) by BL0PR03CA0023.outlook.office365.com (2603:10b6:208:2d::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.45 via Frontend Transport; Wed, 8 May 2024 07:21:35 +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 BL02EPF0001A103.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 07:21: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; Wed, 8 May 2024 02:21:31 -0500 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v10 2/7] cpufreq: amd-pstate: initialize new core precision boost state Date: Wed, 8 May 2024 15:21:07 +0800 Message-ID: <72f480a529166892148d6a5c774b5ede37037fea.1715152592.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: BL02EPF0001A103:EE_|DM4PR12MB7694:EE_ X-MS-Office365-Filtering-Correlation-Id: 312aae9e-907d-4a49-0672-08dc6f2f7e83 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: gxh5rscHvjPMHEgFOKKDL5rZ8GrJyU7CB0GZeNGAmDXFpAlBiuJJcvTA7NfEGxtF+frsyd/iJ/2LRBVMLw7cpvM29moO5UT+H7FSGDwQAjtllmhq4le3CqJZMJo59IJY5AS9RVIj809pPENAiTkE22MNUi8U5d8ruFte/IN6nyR4/Xj9JrLmZ7E3ByxfhhzgSKz1vVi42hFbus61bHkbno5n9tbkYSv7RBE4LlVOT7+CChHGCMRPBZaL1AwVaGo/uKoVfT459uFwynW7gB6v+5T5x6Om0KbaemtZmJ+Z0hak9TGJqMGmEJQbNGGZc66Bo3LwtXLDP8iha2nMl7KFZ4EYExmUVMYrw6QjQP3P2auJR8QCTn8R5W4QGKWyDj3252AwRa6I9TrPbVDEJp8pTDLj2G1ReUCAEBRBRJeD+zE2mizO0lw5CS7E/Jh0A3jbtrDVopv0p791CbuBBig3ZS0B+jn7DJe5iA/DNhrOsjEQ46bBQN3xSMMzrxIiPfwCcJ/HzQsz71oAHBxWtqqXXnNcsFWdGne4ZarcUq10pBTOeNWbNPdMu5Iug1uLGCbjLv2ijaQo47P09taNpIjhhPAU7FyXgjY24bT9KOYNsyPAX73LL3mQdKDZiQ56jTgBrQx8N15c3N1dT9/VAWXH52U7Vjj5hLmKWkGVpxplJZ0UtYEHlVuLTzqwamaPNtR9rASel9oZc0dLJXMyp4aha733BvfF7DSGtjpFGn9R6hZsj71k/6aeGqvs1S4BRp52VP3zKNi1q1Azrp98q+ze3gh7gq8pFDhzxtUzh4fOJYfwlF/eFbMCWqJuufHn4zmiAvaDRg8QuWp8+JM9SseytVg8saR8b+v7qoB+hiVAigxofuydqRoyrugAnSadcnQITHqFxUFQl//sJnobs7zmDAfD+mBvwd5pfUwKDhpBVpND99tZQWyl1begepzecfsltIIGYz34iYrZ30WqFF94dG3wTbubKvghxLZPSyvtA833xiLdE48fCOk7ecg6XN/lOJXYR9VWYMmU1B+rTnockJnIEz/p509oezJCgg95QTFCqgYewyfC9BTtC9zMRD4hdKDlhVG/X0SmMaHvWgl35j3hi6JuSwgKRCMEl4fRI9VTkZGT8ZqcKc3G1z3sCzLXbCxbz6F5mNjJtp8T5wThomEjYKO0qTvgN52O2NR/voKzDtlO9e2C6+jrfNyBMyG6b0iPvA3qilf3AMyQerxfJWtL3NRbE+CU734ocePVDe+1LarJ+eUrFnpql0GrebdRi1kcrzcjmcPzqlWo1z7JS1qm1347vgRSuHp8zhoGs9cbg3H7ZETdCArUY65J2y9g 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: 08 May 2024 07:21:35.5961 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 312aae9e-907d-4a49-0672-08dc6f2f7e83 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: BL02EPF0001A103.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7694 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 Wed May 8 07:21: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: 796003 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2086.outbound.protection.outlook.com [40.107.101.86]) (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 686C839FFD; Wed, 8 May 2024 07:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152904; cv=fail; b=IJnVnl3QN3mX+SqDYYwaY+MUyImpTZiHvSmBArrjxJPEMuHMj7tT1EPGZqTG52+7lh+v14+skYrJ+JqSV5iMoMmOnGaJRVgolRgGhwgk+hlERfYT5i62gF6Z5NBjCSQ2kR2Jk0R9pKTTzneP+85Nk6fXuI2kcN2monE+UaMnRNU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152904; c=relaxed/simple; bh=SPtaTKhKS4kBximrAAIVyLl++Y6fmD1XuYHuKP4/3TM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gPn1mKKJSrgLG9xWe7tvHaUiFex3Ao/JghITUKMUUbV0oc8gQnp5kmDLYIGfcIOO3YTEA1pwEyP4OsDl8gd5ooGgGnUFyx2lKVDTXeRg+hXcK6R0y9QeiXKIg5mEjtL/d7HVRxN5m49Mk5v3RGRw8Qw8RX+w+4U7UbPJBjB797o= 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=TYI/VA4k; arc=fail smtp.client-ip=40.107.101.86 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="TYI/VA4k" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n+NPBdFCxkzBCNp/dR+RTJCRp8Gqxbbn0sSCXwf638NbaJ53PhRbKhC7iNtp+CWHkIe9zRhlv4CHu31s7K8ZtMsep/TppxaAcjIOhNS8T/YYcCUEoUZX9OfXPxXc8jypXQ6ddOUPgKaOPeLxjAyRAtZriF9STW/i5KpmmeP7V6mK1LNgQTdM6I1vDddWv+krfIB+Uis1peSkxEsrKCssUg0fD64f9RRVMwihE505UUcxRd/g26jU4qhVLMGiVXfrdyclKuzG7jR04GtiN924jN4CKg83tyO4TqYL2jNVXqCUOMngbIFjkF/q5bWE94iZq4kttbXrdGZv0ivkJXIuyw== 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=S086xTW9jYFYAYc1aj9UXgDkpbZi/DX1bFWJ9l0pxnriGeSvkv26CZhDBLrlY6vd+eXtF57J4SjnRyuo/ymBqHJsGYR4xmF4l3FRlaZmITq0IbYardyZQ1++7K8Kd+In2n+UNDPykPysML+FCRxMaiwzJStvBIHpeSISbAB85FplH+9sIpu41skvBINVVD8q5JnZ2En37NWgefQVqzHSRhe5BiKuWErhHzLafq1tQ4lZw8B7ayyU4ViK1fMPXUikFBKnRMYimXCCn+77IN8i20+fTp2CV7fIH6DePjyx2liSeclYA1bAy5CqQdM21Yr24ImXQfvQV6rcsdEo6m7m1Q== 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=TYI/VA4k5vuOp9ZnpVQTGvmwcu6H5hqWAQxppWTdGQCZ8DCqtrp50srTIAOxjuhMW4HVoeuIaUBv/jdiTk/gZ4jUCt//YjykOfRuoD+4mNy9PCACCIK6Tr1PIdlFA+dMjsxL30wXBoAkbv4o59ltaiFfTPBBaSJcdqlyfhK58FQ= Received: from MN2PR01CA0043.prod.exchangelabs.com (2603:10b6:208:23f::12) by DS0PR12MB6655.namprd12.prod.outlook.com (2603:10b6:8:d0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43; Wed, 8 May 2024 07:21:39 +0000 Received: from BL02EPF0001A106.namprd05.prod.outlook.com (2603:10b6:208:23f:cafe::6b) by MN2PR01CA0043.outlook.office365.com (2603:10b6:208:23f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.45 via Frontend Transport; Wed, 8 May 2024 07:21: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 BL02EPF0001A106.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 07:21: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; Wed, 8 May 2024 02:21:35 -0500 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v10 3/7] cpufreq: amd-pstate: implement cpb_boost sysfs entry for boost control Date: Wed, 8 May 2024 15:21:08 +0800 Message-ID: <90a2bf1607c525a1e5b42d7327dbcfe5dd338549.1715152592.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: BL02EPF0001A106:EE_|DS0PR12MB6655:EE_ X-MS-Office365-Filtering-Correlation-Id: a7c12b3f-0719-46b8-43cb-08dc6f2f809c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|376005|36860700004|1800799015; X-Microsoft-Antispam-Message-Info: Za0pTc+Yd8NN/0YYALM4CrjQoHVyWQXkrUEIPZqVB/ho9K7cNkcGg5EzD1t2vjDUlHqzJdDDLVYwCoCnK2c8fDgzKsXuIc/ZKsS6EVmQCqzdIoQABIZE4xTh1qY+9X+pQ9nkiVad487Etw4meySvh98dPD1WszQUDbvZfdbbw+lp6OHY4Nuyc1BugFIso706UVy3x43QtLuwCQzo7U9k6VzgKuz36msFOTPssr2Ti8hY2dnAcUHfoVf02twQXFyqObNuqsUBN/h4HQtk4iSpCjab6XBlUl6o7NGCilMFR8IhZkHzoeVvOKLdYyATCCWWsUR4NCXma0kws0y8Pud62EOxZ02nFhXRoPnWRC4vUBBMn+2Ww8NHUPgeVtkbwQicVX8GyH0Ug3syH0f9IQ4JwFcvimlX2AUO/jwfw7GuO7g31s8n7+YvF5nSC/yTVR7GUsJs1zNQUIXcrV64idHFvDQ+thi5gYQlRT1+bbkDx3DJHpQcqCdMCHcNUqszBPqWNZOsDVdkE4GF67d+G47taqVIjHvsvjBhvo9AmegspffxJC6jf0mD4IVQ+rZ5xzGYc+EdlxX1tKfG1Hg06N8QhP1/t8tQ5bxmCWctwBV5WOFYsBCbnY7+DeWWRc0FOIkKM3v8uvwu/mKqR4I3cn0SHWasaoyox2OYxOz5SAiwZ1ozpcqMmxEKuOepvqCCs6MusSr18yrYH7rWYDO9S8BKIMLlhG8t3WSCStMhfKj2XwYAJ12oC+Fsp7x4fc4LzWwQvLfjf8P8pGwSMqMphpUTHL8s4jOD2B0k0ahpNw6/tVHZpGuDFGpalaza6ZcbJnIsEq0JBEwbwVc2nNuGGUETWj3OBP+exnWnY836ylmsnuDC71l4AAaLf9lhEOSPgrxURoSaq8MV1IwBL0LPnaQH26zjacHgh/EF9CAO/aCmzIVDP4YHUOjZWHol31nMXccch5O6iP7JFJ1Pcz8BOlIBKt+cc3t4RuGCuXABqUCw7NruUpFfJa2FXY5HvnjK0lHOTd6ylXoW8UKmx08lLUiX1TdnR74mGdQo3oDkkebLjnqAH/97GuAHVyfaw2Y+xCJGhIZgmoCWaSg1eRkWxeHAf43gPwGrsWtiUVe8yqMYYBTsXHjZj16PNjAHGhgz4ZSqN5cEGrQzu4zBzOGpnS7TB+U7No9uppXcs+buGA2txzKpp5+2un9Xl74Sii67aIUlTqQuBckfdFimA/WSH5XVuDK/Jleu7BUeUz/ZEP6d5h8+i0vJUQg9RRfH+RBMvJQovAHR9uvOTtSnCvOIljDV9eVGzuA+2JwfNBBwPJFOb78KR+atiy4ZYyV4sSndCp6y 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)(376005)(36860700004)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 07:21:39.1325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7c12b3f-0719-46b8-43cb-08dc6f2f809c 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: BL02EPF0001A106.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6655 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 Wed May 8 07:21: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: 795647 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2079.outbound.protection.outlook.com [40.107.95.79]) (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 2B2373D0B3; Wed, 8 May 2024 07:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152907; cv=fail; b=e4usKxFWscaRdUMVxbd0zSoBJwHztRzzVQYQzkDdDyMEB3xGecVXt5Iu5pX3kfjAwDNpzvJcPfupvthQd6hFHKIiL5sp/nvJYiF0KSkJK4YpWvYeZdQZS7LHsO0XxlvCeHDCDsFdLdto/gHFSohcWUprO7T9JLPgYWwAFbSB0r0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152907; c=relaxed/simple; bh=aj+jVm5Y66yLkhCotmOflseLcnj7xeRrxtuzD4R8NmY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oZZb/tLNaObb1+lwz5McH6QgaAxkmF1mzMu1253pJzbP4v/H0MqS+24y7bcqJC5NjMezILYjTzElE8xjPjFxckafZwTL7qG4PzgRDGKk8Yys53QZ+8mE9o82/LdRyOpwy2aTNItULZzgd14y1IoJecFIDteF2qJPEZjFTBc7Xao= 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=5jg8N0pf; arc=fail smtp.client-ip=40.107.95.79 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="5jg8N0pf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q2j9+Fy2SjdbQRYzvy3cIKJt4ureOUMe+RcWS3c+iaGBmpCN5ireG67yrI0JjQUIJW9KXEN1QHrtJZrWTwXaJBgIJxTIKk86aG1VrfpmKiiVABilniwUeknVHp3RRD3C8NSVky9wAYQ44Gg+VvANyzSEv2fb0CG3Nzi/mDZfhXQJwHI1NIFi76+98eyeImwh2mphr2+Lhh7LvyfR003W8ON7qE9uiEZNUax1oZS9mB0eunZDVNStVBHeqmfEYUKJfNZCue/IPng/YQx+PEUxlwIdzOJ0JdhBNRFNind7kXlxDNMu7KrjDXo1SseZkf+WkVeAH8AmHAZyWU2WNYLfvQ== 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=iux3W/HJcCMrNCmpaxDOq05rjmk8qzDH6gyNW32flbfPykTCqve0BjMMvjDYuiQIjzEmR3C4X+1DSI8Zevr2/NeBi+JkXhHvE3+gGIGX+DxiNGr9RV8NU8eA4S+cx54KFG4Y6Ot4XqfKjgPAwbpFVqpwO9bwiV2aMc+yu5cMf8faFitj+Zwd6Vv11vQ16/QudZWwjd3AvccmsqPzCTuOlgo3fhtmTEKqyvmy9G6IZUtmTIafZca/lKCwEXkLfhtOkF8c0rLtqNF7HAER6GUlnOKdYKGnEOJZD6HLZTDb5TF8LGyLm3eUW7f3hLl56hNHXNP0tSaGjCKQbaCPHtP0vQ== 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=5jg8N0pfnXLZ7E06OwWuBcvQMVs1gomZWUz3o66n3ohHzlyn2owatT51P4BqhrAId6wxH1g3SIhkbhwwaWBT+UBFPDnE4UV4QhQxFHCWk8VkJwzh6CDb8ru882LTN5hlTOdmvlatAhSdoq8+sWZofEJBPNnYhAr8ouAzVEi7vb8= Received: from BL0PR03CA0029.namprd03.prod.outlook.com (2603:10b6:208:2d::42) by DS0PR12MB8786.namprd12.prod.outlook.com (2603:10b6:8:149::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Wed, 8 May 2024 07:21:42 +0000 Received: from BL02EPF0001A103.namprd05.prod.outlook.com (2603:10b6:208:2d:cafe::b0) by BL0PR03CA0029.outlook.office365.com (2603:10b6:208:2d::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43 via Frontend Transport; Wed, 8 May 2024 07:21:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A103.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 07:21:42 +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; Wed, 8 May 2024 02:21:39 -0500 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v10 4/7] cpufreq: amd-pstate: fix the MSR highest perf will be reset issue while cpb boost off Date: Wed, 8 May 2024 15:21:09 +0800 Message-ID: <0422737dd49ea6cd6644d8f20f46245682add4a4.1715152592.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: BL02EPF0001A103:EE_|DS0PR12MB8786:EE_ X-MS-Office365-Filtering-Correlation-Id: e1f7657d-40cd-4106-8500-08dc6f2f82b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|1800799015|36860700004|376005; X-Microsoft-Antispam-Message-Info: HLyWYngsF+g8XIJezRYgY/nzt+ASoJuhGrlPHuiTtObPQDiy0XUbcey0qW1iTTs55INoZZGHAHaU8V4l4rME5d7MokWTYHQu0NZUcqx663d+hZuQFN6pihPP402ID9FLKHhNiGOiHfUknbzoqBxlsi4+2TR2DrPY9S/yudzC8vE2dPAZs7eWYZ+4ptwVWUq6tJ1pzTOfM39QrV4etV1eE6nOTIbqloth3NHwTgL8z1HEKG2wUDCv9WOSAJ6QssGahTzHH+7Mn2w3V1nuX1jrNxW3E7TVflDkpx2dUbgHP//aS27JAWfuHmU9E09eNj/Rog4w6fLGXeO0f/BcgrODH8Mf45tbNvugm53Hpf2NQ3Vt/vmvzDVwMTFQXZX9s7C2RjIf9nGLUQdwuIOO4Hq1wgE7YNZ64YzC00kvOxb8zpNFJORRwKZ3naLPohsSPsNykgl3Ee7XeWuosCHTeNdPUPQOAEgnw7bXetp+JKHs0o3N/OTlxkB21Lyro/rgRl3gC5WeOP/URExJ5rAHw1mBxaac7CSBQ3dFfcEAkfhLPCN1qqwwLWK24yQeq7rYS+++EjBo3GEzrW/FBQp/q+Y+8BVmp/VKvt1SJmgnOVnUeM+Yym9taX4VCOxYSMG/tFR0hUjNHmGqFS7Ah0AGAPRhY6gMfO0xxXPHhJQuzBug9HORQXuHLS3rkiOplaiZiEkvWzyCs8WqvCoTfDsmx2z4f+1WEWk4CMd7tE9ZvmGfsUq2aVxTvn84WhAIlY28qbbAlpYT6gnJjrsjiiNnFHJaykCKekWcNZc16dgYEgpyKbpMifugQ+E4oKIKuN35aBsNJJLopm5U+KNsXp3fSYXNU2GFcOr3rnXbbKiX1UR+hQuBOkPxMgycdcgvQVdH7m09lotpeMktS8dlKlMH5RBEVb1EgKnCkAj1Dp599a8m+TpYWvSyuKLYEZ0ZA7C2215PKIZf4X5G0QH9WfLsSeyO2dzE/mXW4Wk3Byn0J/XqABzAurT4j+Y2APsVhxbwNn28i0i+z7NkUOMScnE1fvzZXX8Yz0/X7ENIHkx3mZov7cSZCDjcQWRrhTXrJhQHYFBD3b3tlrwOSoKHnCP1he4tf1hDcjGO5LBwe0Vy6GFQr0eGEWUlFbNhPAKkJ7eWZ4/R45oQf2+pWu1bb4dl+XeKB7ZIUOU2tMeUk0tcINphK1THptzIGOIq7ZD07yAgTnCcp3MFr2nI8zuG0xJFNwP4ODpxQp2qxkWPWDwJiXkx9cuj+YOk3kpsu6TlcaBLlQ9CTBAfW2DoHEKRpQG+OzvOT8xE2NvJow0pEC2o2XF1hexaodPZFDgmamEq/4QKf9w8g/wjiOHQH6tXsLLRDqPkT3rqoIjK0VPUk4p6NjtMVP4iNdu0nUhnskIuCtTx3RMi 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)(1800799015)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 07:21:42.6273 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1f7657d-40cd-4106-8500-08dc6f2f82b1 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: BL02EPF0001A103.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8786 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 Wed May 8 07:21: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: 796002 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2081.outbound.protection.outlook.com [40.107.94.81]) (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 15B773EA9C; Wed, 8 May 2024 07:21:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152910; cv=fail; b=Sb1IZD4BX+2SptNjhdquORKmHG7x4xLAALA/EB8IZPoZaUpx1PROe7aA/G9l4gl7ILlZwwh4yI3UDsH4jG36GB0vGQyN04Gy/ew2k0GQh4nGg16eHy+cjAUFvNtLzCdY1nqu8lncd6RpP72CwC3yHQznj4VLcbu1PwLjHYMqsOU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152910; 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=c53lmylxCmjC8eeCkL427tBm12gchFzilquFczTzuB0Y8sIKcAImjQbLb26a70ddOB4X9il/k23Wbg8eYl3L12MsdsgWXFI6oNE435IDtVbrK2VrpnwPr6ci5QzVDvZpG2NxU8uZ73BQcsP4go+cYpTZrYZAzR6E52gJX1ceEmw= 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=0FQJONlh; arc=fail smtp.client-ip=40.107.94.81 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="0FQJONlh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDQKRWfxBg6iFQhGny1t/o25JF1M+ldlEK53rqIl4OZZRIOkLhKY+aLs3opKSqhDhGvueOORFZzd3AEsSbdjUk7nhLCltt0xA4pmoLU5Na8vIyyyYqmUgBidd1WNDQThlKxNhEQ6Sn2tIuc0QfP+nllQ3bJq5T+7QzBFJ7fdurvhXo+c8HPy0iTqCaIZPP0CUMAQZfhvfoCc3ejX/UYhi2yVpXTLwfhx88PFRICFLPbigmHq/QoaASb9zrehNpIIyhJrRhsyf11KSwwAZ0YXyz5lKnRGijHSHybxFZaFIEUAQIBI3iy/rJSlLA+flQ+yobIJ/WtDMA/TZG0ygs4FjA== 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=B6kM0giNWH9MFHvQn+6Ul1Tf+lZEonlfBZxBYy0NeaaJGM0BDENMxa8BIr3aYILxeniB48YUOIXKmM2ZH5SdODIaOwzDqbhxJc46P6AIb4jYMBiGeMaragJEkpQ9hv9wRUnnwePeQ/LQzwfbKE3T0rPLQcKs99oGjpgmEM59A4uFA/SOy8RJv2JUXrE1rNYTf/ZpIl/4rjkXmpE/2nxpZ+MIPkGReWoJgfdnjqaazukbc48lQY7HNohBpldiOZC+yzvX7RVZrPSxjhNB33AQIHJGcoqN+kbpMKnk4hNJa9aEGwY44/cqwaMVuqAkfHGysL3NMwS6brtlYLPmeRcEAg== 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=0FQJONlhXo4W3Fvr4sAwjplRBpO47rCfDc5WmaiqR7bALPnjcOTn9fo7VpCgPJjGW7q91G7n5tzIxxfbN+qOjbW+xaE0a4v2JvBFb8x9Uo5rBMTW4dom+8RS6d6bwE/SlYN51zkfkpCck288JST2YYOVxGcxg38RvqU1C+zDHCQ= Received: from BLAPR03CA0088.namprd03.prod.outlook.com (2603:10b6:208:329::33) by DM4PR12MB5867.namprd12.prod.outlook.com (2603:10b6:8:66::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46; Wed, 8 May 2024 07:21:46 +0000 Received: from BL02EPF0001A105.namprd05.prod.outlook.com (2603:10b6:208:329:cafe::c5) by BLAPR03CA0088.outlook.office365.com (2603:10b6:208:329::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46 via Frontend Transport; Wed, 8 May 2024 07:21:46 +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 BL02EPF0001A105.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 07:21: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; Wed, 8 May 2024 02:21:42 -0500 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v10 5/7] Documentation: cpufreq: amd-pstate: introduce the new cpu boost control method Date: Wed, 8 May 2024 15:21:10 +0800 Message-ID: <7b7b95877cd49b1aa271c7d1661abc0864577f41.1715152592.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: BL02EPF0001A105:EE_|DM4PR12MB5867:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c281e2f-fdbe-4fc6-3e60-08dc6f2f84d0 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: mz958ZOL7Uz+H9GiJ8ELkYi3nOe+cR6R4PmrEtmbX3od0p5qGWOlq62US5dt0VY37nPiW3wYbsDr5ffYVdSgCvJJ8tzZoduEn5R7HWu1AO66TmTf1btT5nuHGfQZAduAXv3qyWqI/446tKsWlLQP39rdYDFQ0mhD50lQDTbhjL+oMkV73TnK/PxaGeetdqVoNFz21OjlqdumRJNgZsQJRljq4lk3Lj6y1Goj4ejC5wYAuUji4a7SAySqfX1dbLpH28QbB3aJBBAVnCYN6aVs3HalG6hnTgOjZOblnZFdlKJ3ZVWkwlKm9J65Drnrup/bCMB3tCVYRBEmRs6m1m2zFUIXeseUO1tEv53LYlsGPiTxdo+u94CTNDpKbEUDOQCLqMMDt13tfjlDjgf8XT9Saw2J7cJT8U1hu2n+0Gkr/emz6BjixtYA20JbUDs5+yofyYnYAh9PcmL3UnUX8NvTmWHj6qnN9AnQV0jKXvehMpltZei4Q5WVaLBkaSnZYGuHTEMf4D98zHk+KZwqhGbsQMEkxQfvxk9cepEHljt13+4Mojqon5X7jljmkGVJNRN/Qjb7YHcYpy4DeX48Ko7FewAPj19iJo32So7wd9zr2Zz39O3vszxmr8BM6iWHHZ+mjld30qCWTvJEoYdtir16xIao+qcArfEjstMO4Nw6LrnbfEzt5OtTf3ULMT8edvA27Tss3nLrXOjp/hwpJ4YSRF/7dWnw36aEXSZUB2rvYkFb5uWh1b9YVgFJ9zBGTe/RaQvJpv9I3JePHKa/9LvYT8S0ajfh7lTVoBPYi4qPJEF4lcRPlQ7r9HPe8w/732IkpUlYUn3OFikfUN/5AkhDc09NatIfMXRC1Hno8n+JxePsC6BRzsLyMUWJPvQDI4HrtAA5CZjipFjAHqfWdBlUTeVjPGxvQO5pdtH68pbFF787JDXL0bvWobVWN2QdWUE01laGSFVM9chTjIvCQYHwYRaKsIT9Td0lqZ25cpIQJBXViGdvFK55q1cp6CJ8V3UOnGH8cDiYwzhejavBdfeEoCWqZ7MX52SxGL46QMDtIA5e3Fjqim/kzcjf7JpS35WIEBc0TlFoODnRxeJ76g3PIc/n5iyAqHyMwxOz1nrfm9ZIqx1EYYL2aXd/1PIyHSFysmq0b32wrrdohM3E4qaquLp19UVsws10Qdk/Q/NOAYAAf3r/LcMZxjI3PdCTUajJ/Xr72aubQOAsIpvOv41h9aVuvhX/46WdYWsngKxrV7lOG3b8vbmWAe8tajynLbz/bCxcKunK90dByOgaNYsdYzccaAdGMchSqifpwNB9VPygQfHnGgmDnfKulLPctkICN0xvmmdjdCApwSN9pjypNEYJlFMTnqmJ2Cs3k4jaTv0xV1/b7G+wb6JwmQ07v0LV 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: 08 May 2024 07:21:46.1841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c281e2f-fdbe-4fc6-3e60-08dc6f2f84d0 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: BL02EPF0001A105.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5867 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 Wed May 8 07:21: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: 795646 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2073.outbound.protection.outlook.com [40.107.96.73]) (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 893272BD0A; Wed, 8 May 2024 07:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152915; cv=fail; b=YLlx2TVejFZFMW7vLdUWCDoKuCsZYWBdNQkdUBqX0g+6Lm7gYyfd+4MmWQFNjBmerc8Gv3tVzejRRsfnM1IRNE3sy6wyDiuNQz3DGhbQ/qL0LxYXbitsXTHwqdJ1nlnpFI+UDHM4OQpfxaaTLWjC4xTK2nnYV5qh5GE2bTE/tPM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152915; c=relaxed/simple; bh=/sengyBBcEetjyVwAF227oEGabix+LBc90ltd+7c/M4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FaiHDKsI0jHQYr3v4FskpFyGmHAclKUErJ9hlPHoKRjSljHHk8l2PkCNJLEgUjedp7q4dF+KLewZoi5q7t40RXcj0qOOckwMnjG84AGfykDridUGW6/THdZKDquaqo/wFxx2UCEr2/Jn7sxBOXizY6SkgxGBxFzP0PBLsRsNu8U= 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=2G574uGl; arc=fail smtp.client-ip=40.107.96.73 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="2G574uGl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KkWLbMaLQ256qc0N9XPqM+xwXrCjtzs0lUCAD9kaNFLX10s1gQ03cvmgOYsTJqiQ7W48VzmIi1J5+isrLGtypW7DKswY/Ydt79gyyj7MANsap6akQuEDBPGmYAkuQUv0Uomv+2nyN/76XwUwa3cTxN5zIvsYIBf0JNwrWR4eoI8Q6bhmoLBxFN0Wks8TLl8emLTd3Yu7M7vNg9vDqAkgvwCyM3LMQg/mTWfgyXlXk8Q27KPxu0yV45CwlvfihhD2KQfsWd7+cpF3nkyNfGgNe7n98V+UKxV4MBrER1I1rRk/d+oR6ivjHh4R3jJcI1Bs26V8uWkwXxSSZQdAblX2Lw== 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=ApJQMiodT5Ffcn0Ypzad1MSiZQFEnT5Q+zHkF5SGRB0=; b=HHhHpr6DrtXAKEqfUP2lpc4uL9V+zVm9ugOqDC3YrSgmsLz6J4k6BysqxGTevK0UXdspQts7M+4tK52nFH4FUfML9X/Fs6ol31K0GE58P10lkMfVg6rHiw+72DJz0zIKHxY5KY8YpGG3cj8cJYjEm2+qlNU7GWskdk+LrP2SmeZZJJeUFdne8ryythXCx+uysM5hKO3jp3mWelMWDRfvHbOhOQnDVueFmzx5ucTbn2fS38rK3yF8smBWi2j4Lsrnb4DOq/5jBAiTaampb8hCRddDM8ARlGR9laa5ORHpTOcn5lwjTD1L1v1vzSSGzI3WnQ6Cw+rSiCVc12iNPqGmAQ== 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=ApJQMiodT5Ffcn0Ypzad1MSiZQFEnT5Q+zHkF5SGRB0=; b=2G574uGl6lUxg1p/n3PDFBT4KKKphtFvYlIcC2MIkv8FcDZJOrfj9ywT8WtFR9PntRPIKDhO+8BeSVStWJEZ7+hc9eBefg6C1PtpnKV3voHhQ751fEKoR6JlyZytv2WSa7sLNDEH1VKFuwFs5BZ+XY2X6ML5FQLWxbVjvR6HL+4= Received: from BL1P222CA0018.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::23) by LV2PR12MB5775.namprd12.prod.outlook.com (2603:10b6:408:179::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Wed, 8 May 2024 07:21:49 +0000 Received: from BL02EPF0001A102.namprd05.prod.outlook.com (2603:10b6:208:2c7:cafe::2e) 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.45 via Frontend Transport; Wed, 8 May 2024 07:21:49 +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 BL02EPF0001A102.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 07:21:49 +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; Wed, 8 May 2024 02:21:46 -0500 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v10 6/7] cpufreq: amd-pstate: introduce per CPU frequency boost control Date: Wed, 8 May 2024 15:21:11 +0800 Message-ID: <49204c6d4a334c0bfbc589dda79b5cd7c4c28b7c.1715152592.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: BL02EPF0001A102:EE_|LV2PR12MB5775:EE_ X-MS-Office365-Filtering-Correlation-Id: cac16160-961f-41e3-8b0f-08dc6f2f86e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|1800799015|36860700004|376005; X-Microsoft-Antispam-Message-Info: mHjckL2mYsUv8qzJdKUDxvrtvl2FdPdf2ZmgbIzHyeTFAQCWWn2TlMx85gcQHij7ipF4vZVmIWxrkNC4Mlk7JOdqF/ABfmXhk0Aqbz9D+mL95e8PCslzt/kwsidvcg2rpo/vapsCEA/TfFZoI+CYahuxCqRxCQWJVS88qNi0zXiCjxA66mjO/8OvGR99i17yomUuLNmcAQeRnIjpokbOPApSCbzvaqznLjnJAvIMw2OilLyDekd1houuMBrJp2IIz0u9VFIzcnkLPuZkew0RWl/9npcH+qDeOJZCzyVkwsSk8ITF8iNbdVmxqeUMh2u7++iV/9ffWzryia2Y9r23B/BFnkACutUF/PDlD8WshGVzHOr6q2ft0GC5H0JAXCOxZE0A02MvM+nG5nqJhT+z6PngDg5ox1bxbo0xSNlWp9FHUCfG8Eq+m6x3yp6NsO7bULvaCfE8HtpDTVphz6Msds4A1nS9YMFs2/yieD/Lx1DHbE63F3BLz5rPkATUldq18l10SNpC3ZnUUhDsbI+avb/g9yTHhbMFFYYoFvHOl9yLut4AVPVY0Qke2ll9a0cQMSpbh7mKTghvbzec8hfW4N9Anr5wgLia+tg0RHLxgVfWs40GrEJdwCM7s2M5IZv5Cls4vwFehBT4dai2Flkvrt4exhSxAeu4VRA7GwKpmx+J0ZEKqBRNjhyyx7h1MmXcxiMxEQyhbXjPuExXdrIZMZMcGLaY3wzPdTzkBVsrza3SJXrrrqGBBdq+B7aDTb5stQYTV1zMawOQY9gIhRFqAKd9ubsxucZJmrquwrefW6bB8QMRroORKM+dOKwz0mT+EseXqtjgtoMZHlx6MF2TPDHARLTgfnPC1s5suGzXXC2etHDIB/sdKIX7dL6m0+lIsu3pb8TCcP7QYRNYsTZASyTX27wCjCNax135/RCyfzKH+ejqH1aLot2O9XYhenlDasMoiN41EuiTqpNBrf+xrLNZjKzP7ORkeBSQQZz9ElXs1lUdkXVMcUAZCzLJqzslEh8ue1gPJnQAo5hWn1YIqb5lgA4fiyqjk66MIGiuB6gh6xqt+7H2ev+Va+8KPO8EVa7fuLG+5Ph9VAC9S4DdbqiabhoQ+NOsIfRO4MaJtlvwrJRQYuAeIgg3Aw4CN76easxFNdZQ2npkBWPEtP/no5VYXT+Iyrbkm0YsczE1Pm9n5ryOydGdqMKIYaBpyyK6y9LhEXyaqNyIVySmxkWoUDUs5J0NNRw7K6LjNHs42Wh2kxitv6rBrw6knd9erjELFh/juUsxI817tEWlpWwXSkIMjQ0TZfzuMPIG+v+MScocg8eqooQE8DvCwVDZAVtWM9yiSxCouOnX6bc38z+iqy/kiIjWHCdxc6c/HKRIwIE= 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)(1800799015)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 07:21:49.6569 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cac16160-961f-41e3-8b0f-08dc6f2f86e4 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: BL02EPF0001A102.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5775 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/boost`, 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/boost" 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/boost" 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..cb0055e7c842 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_boost(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_boost( + 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(boost); 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, + &boost, NULL, }; @@ -1437,6 +1463,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { &amd_pstate_hw_prefcore, &energy_performance_preference, &energy_performance_available_preferences, + &boost, NULL, }; From patchwork Wed May 8 07:21: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: 796001 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2052.outbound.protection.outlook.com [40.107.92.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 0AE4745BE3; Wed, 8 May 2024 07:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152917; cv=fail; b=OvohLq1qtsNi0HCYmWAcXKKiFzd7WoWmJN0kIQv6SvvL2NhtivxdGpHJ9V96X41LUbW77UPZmMJm9H4iz52UQ17GxNUOQnU3m8O+6LaVbziEkUgmCBkYcqImkAAHgh9hezDGzTwEN7kLbOYCg/L/KI934HwwUTKYiVMfriBS8pA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152917; c=relaxed/simple; bh=591R1c5qWNY+ywR8H9LuF3YeddORv0F+tC41BSUsTms=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZyJK9i0vRqtbQAtslr0GpfQUk1LqMYDJWALcSHmsqtkhOkotU+dJYBiMq97yd2tK2DM7bo7/6RJgrS4SQTvgPpiOg9qFq65kT/ZUpMjUCuXAs9V2Vg7hkGdys22BtHzVnaluM0Cc++Q+MYxq5GcUcykyfFmXJWtvovFafqoRP0k= 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=pDqkYm2T; arc=fail smtp.client-ip=40.107.92.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="pDqkYm2T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aHjRHUWXLB/8hJ2uubvH26/gBi9tOHR70zmG3vO+Be/Sfo/Nsf6GeFAIKztDQb+Aq4nb/fIg3NSOEY0QXosfIScJAw94ugKWM39zH6Ar6eq+1E5XqrMAUcWbIzVIL0m399SC7xNuFtm5urCXsLsClBKoLlErCTOXWXDeN4Ckz2Ov5kswYH6qQPDWwDvOSkMi2fG0wAdZTuyx45z2WB4dm/mxoE/09v68zvFWsAXkajxhPW6Pn8oz70/4UsZ/U7blaCvst2O0LlLsSrtUWIYHav7nOwOuHl3hOybV2sxThcVlCiNxX3m8kzC16YzUPcrswx6opH6s7xF589U88rgsiA== 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=94xdj5VxKlsKg7KcTOXiwELEZ8njjN5NlNAXdX4qank=; b=lqG1EcRzqpMhe/fr2syjB9DanRQTp0oYwxYCJzK/HMJbSvvOvXDQ3wX5TbQUy2pp2enVwYfrZV9kWCsk3is8ktomAzYfG5v2bSgU85hSspPCeSYac937yR1rfuWCcYkYNrRaA65Pb1bX97N10x+JPijYCmj1Ryn3CyLgJX5zq4djV025rYC/td3Cxh1TYmKwcHnjjWGIwWPx6S0szgi21AXKHmb6QAAyFZonIvwUbI/6xWW6qWsa+5mQ0g7vYlvGi8lzQeNm5kBJbytJsdICMLFz4KUxRiD1VSr/vdfJtZWgmYMZhFtaIwIZsqhUmOPgIkbtfnLDRIo4KVlmPWsfmA== 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=94xdj5VxKlsKg7KcTOXiwELEZ8njjN5NlNAXdX4qank=; b=pDqkYm2TjOKeYfhuDB27Cop4M2z0oR1FDFFjf7N/aHLg6oieGBZI+tQHY5/dFSN5wT1+vRv8A9oBZ1IWT0OWPaaXGVQCauzoQagGIEOlNs55nJHivnmernrtT+QHUuYrY357pVxXn7UyAFhiZTF0hlNl4mqBcSennyHDA3iALEw= Received: from BL1P222CA0023.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::28) by LV8PR12MB9083.namprd12.prod.outlook.com (2603:10b6:408:18c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Wed, 8 May 2024 07:21:53 +0000 Received: from BL02EPF0001A102.namprd05.prod.outlook.com (2603:10b6:208:2c7:cafe::37) by BL1P222CA0023.outlook.office365.com (2603:10b6:208:2c7::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43 via Frontend Transport; Wed, 8 May 2024 07:21:53 +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 BL02EPF0001A102.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Wed, 8 May 2024 07:21:53 +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; Wed, 8 May 2024 02:21:49 -0500 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v10 7/7] Documentation: cpufreq: amd-pstate: update doc for Per CPU boost control method Date: Wed, 8 May 2024 15:21:12 +0800 Message-ID: <8661e4fb9a0473bbe74fd9ad008e19380743b46d.1715152592.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: BL02EPF0001A102:EE_|LV8PR12MB9083:EE_ X-MS-Office365-Filtering-Correlation-Id: 8faaa045-d2f5-4aab-619f-08dc6f2f88ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: HnB/L8eGNBYaJluCpFdAlGpDfZo+UVhh6ovq2B4pfSDBwTNmU6c4aTVXDgijnnlo8coqJk6okib8IapT8Xp+6pMedbNOFPVDUr1+Fqzs8yt4KYzJVqkfkxCrpvRcEElr8vKhqBuKKkTGlWRtQ/meBm516Cu5dg69Ria2tS69iSk2Y42O9WFvKTSqIPEMqvX29k2+bEJQCBAlRSZicQ1NaeOmSvwNyIG9scvxss8Na1a7JtGEMtWZRG4SJcUNMZ/99G5htw8En/GWzyeLPtz2sgmwmS2KnX7yMnK98t/Y1WDhWoX1JfrLjBT2Q1vmPLiRy/XoCkGc7ujsZm2diZJvimNvKq9SHWvchOdpn+ZhiitV4m4gJ0lCtALLDG+UlCorvJ0OLO6T5Q2RRPeQC8tjpH1BJLNZsTVfpdK+lwWdGtg17tPgym/FVOwhmlX69zgd1WSI3mhKaxZtW9AKq/fBBo5yXrNlGYIvd8K07uUj7Qp61l9+SCAQeynrFZaduP6btV4O32Je/58YVnmRe1R1+Oqgj/x97RhfkbLygP89gcKRZbp1c8FbRlEb3tae3AzWlX2flo/lwPX24ABRSz6prL495XhRcz/1yzLINWyPYrn2rOc7ueLtCr0EBQysvtEE8j4AWx5foJZfSObG4SC65pjxiv+DNnQQp0wUGFkSNZPdK97jiFJ5/oe4T1VvogABKBEsgW2rYKEknkaqT6hK27qk0LYCCSHiyDUWYYVZ1qMineqKFoZnsoWsT8zp+giJ6ThezgqqrGF2ouS1qvpo1ts6BcHctfFt3Yo9R2s8w4d7cnMqAx4jznWKsOV9wk6Q3zjcYjSQ7+myLZxUkz9iw4cMH5AZTXzmNGH0uPIqVBmUtAdVhRKYn0RHQWACEYkjhd9RWKullb8fYWM1LEeoL77c6goGag5jlMD6hoQM4W0l331XSkrxzgqJ0D1h4HvthBCxVX1qz4Zlb0I/V9/cSkxCVFz4CdFaYHVpCbcWoLB2Y+RB6USsjquxERvEOOfCVZ9a7ZCojiLju0ieZKiVdtRze1sbJl0/BElAmYr3QFQjeGrh1HPD5AP8BkytbKOA+3U5k2oRmQABRG2GDAHCzaTT1f4jc3cWNSeyjBeVrZjE+ecxi8tzo8n6bAOSD4YEr19sCMTVt1ZfG46znfoedF3km65oreAL5PfKaww6akYUllRisdiiM6X7PAZoCZD1zkO9sns8l1MHkYMzU5X4OlXw4+asFmaBByOca14iJAbD5F3nttPhk9qsFOFl+Qc0CL0hxx3NsqMgqarVyr7flkWrNOBAeVP6eHS2PCgc09cw193LjfvWUwAZsTJAzifiSBMdfEGCDG3ybsaKQjdCYYXpXwptEXSpDvYxdSklzKND7bMTPpeOoFni+8J+CI0S 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)(1800799015)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2024 07:21:53.1883 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8faaa045-d2f5-4aab-619f-08dc6f2f88ff 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: BL02EPF0001A102.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9083 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 `boost` sysfs attribute. Signed-off-by: Perry Yuan --- Documentation/admin-guide/pm/amd-pstate.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index bcc0d9404c18..98e43c53c387 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -281,6 +281,26 @@ 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. +``boost`` +The `boost` 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 `boost` 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/boost`, 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`.