From patchwork Wed Jun 19 15:40: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: 805893 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2061.outbound.protection.outlook.com [40.107.96.61]) (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 8601815253B; Wed, 19 Jun 2024 15:40:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811646; cv=fail; b=apwyxYkv5ZMDCv9rw5gr0BhZiAvxRuS/KVtzGYl+51qozdVHUcY0vLiIt86TUqMa0oYjrmw9j8m7vN0+UGMOAG7VCTur3etd5vH9HlfFSHENFThO6s3jtrTwmKswwPyKh756H4PzhEIRsX0H6DD8SwHOH412gMx4PHr3xo2ZZg4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811646; c=relaxed/simple; bh=SaQ84A9mdXOlivUfJ6Y0mpDmxq4O88+lCsp0/N4Ix5I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tUoT+jRj+Avk2T8g7sMlPBjaUXi/IcYzoEDarwPXFrRLj4WozDe/+Mh1PPXEqtq/PiptRPPNums8EEYnUmOGI9tdUhNfMu6KPOlN6ny5gt2kARIGsDW5of/Z+JnlHm4R+GUW6sdpodQYUy8eyS5acAk7Yld2zwW0luPgHdKeSS8= 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=Rw5u44/s; arc=fail smtp.client-ip=40.107.96.61 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="Rw5u44/s" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z87BprMjMzYp6bAOlUcNDFhbavTbomUiYI4Hm/vd+BoHSqGsSVev2Btz/ZwK1WC9d09va8KLOo03aiKgHXOkj3iN6qjCBi7vRlk/XZlT6kCTU02e1vcTlcmKz7RTeZsS9RMPkietQJGszJxQNU9a+bpM+ex+pHETq2ByWmpPfCKSRsuHvkFqbpyj3yy1Xi6ur/7pkLb3N0BthC5ZRjVvkSLMbtIxUCSKeWMWOhHNpzmswVugUhV4c5MPBtTOBH2j/0zW6hSTVQQhzswWRNqrlaMpttjhpS0n5L+TRbwgjbfpg5ExQNZIqR8vl63QYYEZv+yP6Wju29nmSJqXxfYkgA== 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=4ASNxod0sbZOLlFkXfgYDq7sgE7KelcytOVJjua1Dx0=; b=mOxaL9Za3y1IjEejD1ZDjpHi5SpJixxUm7W6tiMP3ol5JQCCF9rSVFXYwYfODc1qBQa8CB7+Um3OnBXHmE2kumACrv2unnYsDkd5b6GiiwwLTBBIM9YjJY/YOoTiXOhQ+2mlFpuCPD4VzMjM8wZEn4A8Ub8kydQQxl/ynfXEJ5Gb5kwI3ktWm1O08D6gW8LCqL/bnihjcmy/U0FPztq/jRnbR5bLGoRq+96GreFFlBgZkeWov9CMso9Zpr3lnl2gsDW9wfmDX38Be7xjoI/CcSpIYtjrN5RgU1qaGj8a3Tl6hn5/TQUoreejbVvc9f1kVQn1A/DxVZm66LQbbrOKrw== 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=4ASNxod0sbZOLlFkXfgYDq7sgE7KelcytOVJjua1Dx0=; b=Rw5u44/sLpdlwwPVpRDd5SCWBHsleSYCUq7kLpIjZsdZCN6s3Y/wW42eTdUrhNv/RcfKs3CDo1ybb8FuZGCNrKKR7vKuj5qZVC/MBlmSeB9SIr/rPYEgMyLmy7pkxn88tpwOrOIot9JJUJpmP2YZEp+drjIbRAuUBpG21LSC45A= Received: from CH2PR02CA0029.namprd02.prod.outlook.com (2603:10b6:610:4e::39) by DM6PR12MB4449.namprd12.prod.outlook.com (2603:10b6:5:2a5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Wed, 19 Jun 2024 15:40:41 +0000 Received: from CH2PEPF000000A0.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::26) by CH2PR02CA0029.outlook.office365.com (2603:10b6:610:4e::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 15:40:41 +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 CH2PEPF000000A0.mail.protection.outlook.com (10.167.244.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:40:41 +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.39; Wed, 19 Jun 2024 10:40:38 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 1/8] cpufreq: amd-pstate: optimize the initial frequency values verification Date: Wed, 19 Jun 2024 23:40:12 +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: CH2PEPF000000A0:EE_|DM6PR12MB4449:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d83293a-5542-45d7-a6c4-08dc90762d2c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: YB29vTJDFbyCGwpQsL8ynyBFVthxjzu+Vb9pfunEgH6GL8moGDWqadha4CJUpch7ROMH1gjysTmdXejkCbbk+fFXWwzE3ORbavaPW+5bL4QRJFhoKml1C/jkwQJ/KrBku7ACHmTusT7WTxIWD7Pti/okEUWh5fJR0CXg89BxkdlSRbzfMHwnQKiOApVRrL/1HzQKcAyuCG05CMbOJL8vEN2qybpRbU8XI0hqzU6ufhoj9tfSbDG67XwMseZz3WatIqSkStQAidvVykiOfmDXsKCaWz+S4fxaGB3gXQdxjTnGU9RJQXVq4k5GecxVVSdt2tjMvKCRsYydhPP8UBwuvkCSZqn6TdziyAase3nkiMVaOEWiittLpgcrOhO7+omB5fEKgO0KiaLeIXP/6rJ3ONrN0gHr5b8XM0bR42JZ0RYSsj3cdeZ+aumdN4hK67eLDcy2a9q0x4Zhg3fYKTzswA+Em7DKmyl9cf60+rJ8QxMLKm0pancK2gTrDPBqooyS8ssbactQw6CeTFfeUxONcU2yQ3csadS9Rl28Umijhb01hsM0QhWWwbIIfx5Wefz0wj3etnmJ60LmDStC/gChKPSgQQtmIn8GbtjJiwdSDO5I5HsPPjSrPP8wTKSqZ7kuz2kjG5tqpeh1QaPCP4ITcc/9lc95dgCilj4pQgFcDWrdwKv7Ze995dxTyL4tp0kvjDT0f0N+dpS/v60uIcknwilRzcta56q/MmlpHmmz4dwmckUTnlSCsEJUtWaWVCi4SRdAWH3RvZEUdhKEaNuI62HQlyZMCWxK9JhXV7Emazyi2d/SJhDyxCfqM6/NxI5ApyKxMubieFmbmDUVjh3jDtQvI7s4qfebJ5FCMrquLYkHanzuGRE/SViyGBzM0pEBtqy5qznzJWDbl9sYorpY6jPfubys6pa33ZpMNkAB7pY3sQ/GaPaiziGKbs62KsGHMlw8c42FNCgAUHD3JDpErXTAUh3CpI75QNXZ7KKmpTEU/MGFeScGHHNwfjmk9D6MDn2A0iKrlEK5ijTAvE1iqgjfgbIYdW1S+Q98UkRnurGgLPRGl4DRQLoUtbWmcoyt0GuzsWTG3ChnR+XjF63rFu7/NgC1yUxZrk3JenYfVaOKbAQvRUD8N18lqTj8YiJfAY+6gyOe6XhN5q0Fva8gyhDuom5xwlMdSpKyCC6GRWJq/65pVl6yvUWIXIuEfrVkTfD/Q2SKb7H+V+qU6cT/w1WR8iXjWrwy4aaqXhTTq4rXUjM09F846mVRaDSAiwoCBhFjz+kdTotijaja7PkD0YC4REnurFRd5hlZ5BvzYlVIJhf3emcjx4+LtF+cfLlnTPW+mJf/kzklWRoiHdcFWX1LF2FfMtifbHLr33+/U/GA7Bx+51fT/352D53RLo8yVH+ZmnOTgPo651zvyBJ9RQ== 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:(13230037)(36860700010)(376011)(82310400023)(1800799021); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:40:41.7428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d83293a-5542-45d7-a6c4-08dc90762d2c 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: CH2PEPF000000A0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4449 To enhance the debugging capability of the driver loading failure for broken CPPC ACPI tables, it can optimize the expression by moving the verification of `min_freq`, `nominal_freq`, and other dependency values to the `amd_pstate_init_freq()` function where they are initialized. If any of these values are incorrect, the `amd-pstate` driver will not be registered. By ensuring that these values are correct before they are used, it will facilitate the debugging process when encountering driver loading failures due to faulty CPPC ACPI tables from BIOS Signed-off-by: Perry Yuan Acked-by: Gautham R. Shenoy Acked-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 5bdcdd3ea163..d4d7b7cdc4eb 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -924,6 +924,24 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata) WRITE_ONCE(cpudata->nominal_freq, nominal_freq); WRITE_ONCE(cpudata->max_freq, max_freq); + /** + * Below values need to be initialized correctly, otherwise driver will fail to load + * max_freq is calculated according to (nominal_freq * highest_perf)/nominal_perf + * lowest_nonlinear_freq is a value between [min_freq, nominal_freq] + * Check _CPC in ACPI table objects if any values are incorrect + */ + if (min_freq <= 0 || max_freq <= 0 || nominal_freq <= 0 || min_freq > max_freq) { + pr_err("min_freq(%d) or max_freq(%d) or nominal_freq(%d) value is incorrect\n", + min_freq, max_freq, nominal_freq * 1000); + return -EINVAL; + } + + if (lowest_nonlinear_freq <= min_freq || lowest_nonlinear_freq > nominal_freq * 1000) { + pr_err("lowest_nonlinear_freq(%d) value is out of range [min_freq(%d), nominal_freq(%d)]\n", + lowest_nonlinear_freq, min_freq, nominal_freq * 1000); + return -EINVAL; + } + return 0; } @@ -962,15 +980,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) max_freq = READ_ONCE(cpudata->max_freq); nominal_freq = READ_ONCE(cpudata->nominal_freq); - if (min_freq <= 0 || max_freq <= 0 || - nominal_freq <= 0 || min_freq > max_freq) { - dev_err(dev, - "min_freq(%d) or max_freq(%d) or nominal_freq (%d) value is incorrect, check _CPC in ACPI tables\n", - min_freq, max_freq, nominal_freq); - ret = -EINVAL; - goto free_cpudata1; - } - policy->cpuinfo.transition_latency = amd_pstate_get_transition_latency(policy->cpu); policy->transition_delay_us = amd_pstate_get_transition_delay_us(policy->cpu); @@ -1423,14 +1432,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) min_freq = READ_ONCE(cpudata->min_freq); max_freq = READ_ONCE(cpudata->max_freq); nominal_freq = READ_ONCE(cpudata->nominal_freq); - if (min_freq <= 0 || max_freq <= 0 || - nominal_freq <= 0 || min_freq > max_freq) { - dev_err(dev, - "min_freq(%d) or max_freq(%d) or nominal_freq(%d) value is incorrect, check _CPC in ACPI tables\n", - min_freq, max_freq, nominal_freq); - ret = -EINVAL; - goto free_cpudata1; - } policy->cpuinfo.min_freq = min_freq; policy->cpuinfo.max_freq = max_freq; From patchwork Wed Jun 19 15:40:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 806549 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) (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 76597153506; Wed, 19 Jun 2024 15:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811649; cv=fail; b=fcjelUC/m9eh2ilb/GzTFeV8vliZTN8PlN2he7hFyOJoFBKx6wSpbHyZgxvP9ruyMdBaUlWCpg/XUTm8P0+mPqNhwao6VaMvCU6N17HGuD/hTsvbIndF9JtHTfc/Trph5Xtpa/Jmqbe8aDtls8tB+KKTaDKWeyW0lcd5JP42y+A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811649; c=relaxed/simple; bh=nzTg83Tp2KVTOlE7x+0Ug5wzeWbrkQurFgj/6Vnnpfo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Dcv7TZ3wONYnCQ1WaVXGY9jlQdRRBCdMHShsN6PGeJSDsWHHSuyeMncWkMHMZblV+hKH9mTaZzJdGzknYKHjCF/EnAIA2xEiLKq8j8GrWhn7eg8zGD09XPm8cQnZ/bD6VBgpY1PdcifkK5O43+8pn7vcFlffSNXcj7h85QUgu8o= 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=0S7dxpFR; arc=fail smtp.client-ip=40.107.94.82 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="0S7dxpFR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JacAqzOshWlOIZXROVbmTj+cZr+IowIzkweq8DKok2RbuORgwnNhemqFLwLUntxB/acoJYpuBVFX5GbouDmIW6dnyDxfIScyslR9/yCBM2olV/Ah1Zkg6ANJNg73WfCJqEi1p9/stF8X726C8NPvoUBxSYWoXbSVDV8W03TWoyywDTQGtyKnY3w4rTkycOCDNE7XINA/eJwG6NXUysyFLFIyaNINdPG46dRy6ZbvlDcClQh98OmtTlUGIDb29YMkWhLUc8vrA3nf2vFSaHd+TsmgcfOgxBpLEztYs1EiEyocQy/4fgfDq0qg0ri2Y9N4RniY3T3a0JUIkiCw+nTdBQ== 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=8sK5KXlwKPkdIGyjDy5laceL9Hg4OojtpPlfVYO0BjM=; b=OpbDt8pF/fdKMwxtd7BAnLpsDeW+rUvxQcLmDjQT0JYNvjXkis9C11dmiyi8bvl6xpShyJWrz0Wvgl5CxVydpD9zrMLXJneF1Yuypa9pKbD2QQ5yhCpAQDFZo2aKQ+Z9sl5gwIOM7UIiEcrGrTO8/6ck2z01zz+ie+CC+Ar8V5CvMyCXcHOcSXz38/rjTuJe7F8tihGq1bsYNSeP9k+pStwKmSrvRxgMu6eJyaMLaH46LJoBjXv5SCftu8z3ZujCQIdOEPKhNzypjYwfe25+Gxh/JKMuFLRBB9EJpbLGPw6rVBoTJIW4pPsOyI5/rUMJ9bELDbMKaa3w2nPoEnzjEw== 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=8sK5KXlwKPkdIGyjDy5laceL9Hg4OojtpPlfVYO0BjM=; b=0S7dxpFRSi68TYP+OIuvf+LzV7N7RU8hrKoLg6lPPhoefHfkj6L4DuWwXpEbs3D7BGGbyFTaYLXtuvHCvbujn607CclNccZhe5lm9ig5PlrXDKAJUcCQB4HYZq6TGKDLjpwow5s/lVR3yLPk53pwQva59P4WXzvdS9GFRlTpJOc= Received: from CH2PR02CA0018.namprd02.prod.outlook.com (2603:10b6:610:4e::28) by PH7PR12MB8108.namprd12.prod.outlook.com (2603:10b6:510:2bc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 15:40:44 +0000 Received: from CH2PEPF000000A0.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::d4) by CH2PR02CA0018.outlook.office365.com (2603:10b6:610:4e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 15:40:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH2PEPF000000A0.mail.protection.outlook.com (10.167.244.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:40:44 +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.39; Wed, 19 Jun 2024 10:40:41 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 2/8] cpufreq: amd-pstate: remove unused variable nominal_freq Date: Wed, 19 Jun 2024 23:40:13 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: 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: CH2PEPF000000A0:EE_|PH7PR12MB8108:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c25c7f1-9f53-4d86-07d4-08dc90762ef4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|82310400023|1800799021|36860700010|376011; X-Microsoft-Antispam-Message-Info: Nyf4ZIyGdaOshf8KcqITZakJlyMKIfzSAAEpWcrII3ag2ItV7zzcnpnedYG53YqejxyBrXnbSN4Cmnoq7nlj8iTmeeijybYZS35GXZ3zcTCoi3v6D6cwviwaomKx4NZnikoe8yBF8EQhdeQ3PA+4yl1zMMNpokiVtaqb2dY5ptdY8fwIZM1z/r7zI4VNDYAcEmRA5nkOu7x0X49WvNp4ulpRJqOKkeP6brl402AYpqc9aWSzD761GbrlsM35F4KDz/NSSKqKnP0QY0Mq3Jx/aoPOUVEdw+CMF+EitNOdKkjqfZAc1p9GPKe9E3TmlL4FeJbidsI7wWPxzZOSQRuKJD9x+UjjbnUtztDKjKKZOg4QRwWfJ14tjW7L8DXQfIknUEALpxOa+ee6fMNk92NpmEqvFqWULi+mSrLvXr/6tEf9XKetyPyxtjPwrLsrY/JdllaTmLVX5fGadceLnnLxQxsgCk9sFRGb/x0yLku2oHlLQE5xK715cBImo6oe2tiDA7l9KecPRKZ1b8TIGtm2sjoHqbYpaTAxPpbUnAWNpbKUssj55QeYwFFK6JIr+MX216fmKIrIb7qJWjOnnz/Wo+Jybve9vpOWw5jI2D6F2ExKZz1B951AXo592utW7AwYDeLcA7cXNYSs1cxZfdQ+yyMwAAmPPWo+7ScctWNsBIGH7BdoWWMlzjLZaS6G2aXeT7o1/s+/zwfpsVQkgqpn9YSIum7lR5GMnjsgpFuPp0TYkJP/7hgUOmxls7pJxKfZgi9bA5gSzrkCN6k7a/alpTqRniWWwR8zWaOsI34tJ3KoGEMCJ4fM3/ZpO2804c0mWa9wj5PTSiE3mqQgr+Lh+X1qAkzAnG5EhYCcvRnK3kb4Z75h6qGui3iNoWBg4sChFMoBi4eMfBoQoPQYi5qlH5z0+2YKd10TVsPuj0EyQOl9sn2mSVOF6O3zQYOuuPnjV5bQHV2rSTJlR/gxKfcHBdWIF2V0RR/Nv9yQBOUPIFpPiKU0bx6QhI1shZLEvesqAWlzUhBndcO8Fd+M1wzqmN4mNQkg9/eYvre7iMyHSKsZBkqt2gFqPgVT/DVqp3831eZwP3gdwjQCiTm5tScU+hW3cvRwzgI655XTXLIgIKcqDN+SeyXhCUnvdyXQKrHj2DaWuSu3RKfQLXNtAb6NDkaX8N0P+QcOMgz2EGBfepbYv1d8vC4qjzyF0bbGydlp9ki/79HXBx2uupECw2cGNumcVKD6ORd2FNHk/VlIH7B/SjfpRVWn8vaWy6u70BJaAfgUl8kk0wAnOwEmVBK/elzpXbLRy0pA4Yt42b5erI9XJIsgO9/qRU6t/qSA1l9R2FJqXbZwtYmBxYZgpCVUAWZOR6Mbu5qi4N1E9mS/Ndw= 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:(13230037)(82310400023)(1800799021)(36860700010)(376011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:40:44.7115 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c25c7f1-9f53-4d86-07d4-08dc90762ef4 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: CH2PEPF000000A0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8108 removed the unused variable `nominal_freq` for build warning. This variable was defined and assigned a value in the previous code, but it was not used in the subsequent code. Closes: https://lore.kernel.org/oe-kbuild-all/202405080431.BPU6Yg9s-lkp@intel.com/ Reported-by: kernel test robot Signed-off-by: Perry Yuan Reviewed-by: Gautham R. Shenoy Acked-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index d4d7b7cdc4eb..1ce063a22214 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -947,7 +947,7 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata) static int amd_pstate_cpu_init(struct cpufreq_policy *policy) { - int min_freq, max_freq, nominal_freq, ret; + int min_freq, max_freq, ret; struct device *dev; struct amd_cpudata *cpudata; @@ -978,7 +978,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) min_freq = READ_ONCE(cpudata->min_freq); max_freq = READ_ONCE(cpudata->max_freq); - nominal_freq = READ_ONCE(cpudata->nominal_freq); policy->cpuinfo.transition_latency = amd_pstate_get_transition_latency(policy->cpu); policy->transition_delay_us = amd_pstate_get_transition_delay_us(policy->cpu); @@ -1398,7 +1397,7 @@ static bool amd_pstate_acpi_pm_profile_undefined(void) static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) { - int min_freq, max_freq, nominal_freq, ret; + int min_freq, max_freq, ret; struct amd_cpudata *cpudata; struct device *dev; u64 value; @@ -1431,7 +1430,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) min_freq = READ_ONCE(cpudata->min_freq); max_freq = READ_ONCE(cpudata->max_freq); - nominal_freq = READ_ONCE(cpudata->nominal_freq); policy->cpuinfo.min_freq = min_freq; policy->cpuinfo.max_freq = max_freq; From patchwork Wed Jun 19 15:40:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 805892 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) (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 5C8E114F9F1; Wed, 19 Jun 2024 15:40:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811651; cv=fail; b=lhnX1X7hkPu95ptSZihWbOdihvq4meDs5VVg+2GyB3sKZ7vgEUFX39fQ8T2HCu+BnLJi/cck84W4ynXjBrleyP7TzpkMmtMwdfNzjiYOnoHsvOHN4Du6V+O+AW/DKbqPJmczQgHhnCggpHLcbklL6UGnNSDv97dwxNOIKjkh1+s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811651; c=relaxed/simple; bh=flulp2l17ZcMirBGjtuR9DGyLFB5qYQ1O9kTE/k2utA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G+nwKQysalA+Hp2nsVE/d7lF7OzaxeCxScStZrNhOF2OOOSpljJtEz+y+YUwDorvuQHOtnZwseVQVh8QE0ghJ0E7DdVgopcMl5Cfn1JYstXi7GxAyk6e6Gd8Ft9LauSUuPyyZIMUySAWu5IM+DPtSon3u47ubyrJPJYuq8WFDj0= 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=bDyNZBWg; arc=fail smtp.client-ip=40.107.237.67 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="bDyNZBWg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J4sBvEZ7P4zYukSopk05Ag8Wi2xLiFBugu27AYS3wOqD20cokc90f46PLUVNfqfXriNdaTCxarsz8/DSykHYoNDD9JB1QCkQgC9r+y9b7/fGy1bWRxSpjOvSBoApPtWsD/+zWnBaAaZAiN8zllSDem3/z1kdp5fqOrBG6cCAOaeMxHMMG21mmNY/jeNGQp7MIwhYUDh66X5JICNI1AuWDUGnuskoimJR5vk+y4FfwiC8O4R4S0zvXhoqqmqJv9hAxkifzi89ZhUedSFhxPOb/08y1gVr0/NyLbgq6J5k90g6pRBCiXHdI2HWlBrfNEsxYQ/oWz4sCiIVpyZY+wSwbA== 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=WBDCR8wKHm6M0ndj0xbQF2fjvAcPcwvYwUuQn5l17x8=; b=htnIDsRNBCzCpUK8c/oyQORARyazmjz6HQ8t7202zSDQoLRtEd8KBjnM1x3YE8/3DNz0xWDAXD7t7UD8zmuawa5+OIe9ucwumKRiRfgzw/cY6zIIdlLFXGkHsL6EKFvK0F8rGXH8yZEZspVWOHbSf2xzyzjzECzj6LDZSH08hLPifOvr79OwSGbRwvbIa2/YpVh0jDV1cFeW9+1UU98vO+DhKviW9XgzCJk+NTwCE0BBLeoIEkXwYI73OBfVlxmJCEtxlmUnlgCOGYAcx0EJ3zMdsupwjh8bbNmvADqmtFSmlm3V0zIUJWUgzCvPTxXdc2DVIsKWDEsFBN3H9hM3Sg== 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=WBDCR8wKHm6M0ndj0xbQF2fjvAcPcwvYwUuQn5l17x8=; b=bDyNZBWgl3icgRmEx5PT9Ev1R8KV14Rc5WsK7KhQR06NC/3d86BJos/+YgbvCHyB1Zbsx17cBTaDRn1oj3shGMtKTn67XdWg335Gwsnwml90UFJnjZ9kXn6xQ1Qf1cjzkXDEXdemtiD15iw/u0azjA9z+mQfXAoizyp7K6Pn7GU= Received: from CH2PR02CA0005.namprd02.prod.outlook.com (2603:10b6:610:4e::15) by SA3PR12MB8440.namprd12.prod.outlook.com (2603:10b6:806:2f8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.33; Wed, 19 Jun 2024 15:40:47 +0000 Received: from CH2PEPF000000A0.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::d2) by CH2PR02CA0005.outlook.office365.com (2603:10b6:610:4e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.33 via Frontend Transport; Wed, 19 Jun 2024 15:40:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH2PEPF000000A0.mail.protection.outlook.com (10.167.244.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:40:47 +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.39; Wed, 19 Jun 2024 10:40:44 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 3/8] cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported Date: Wed, 19 Jun 2024 23:40:14 +0800 Message-ID: <437dbd581a4119465581330081d9b1e289482ba2.1718811234.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: CH2PEPF000000A0:EE_|SA3PR12MB8440:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e37403c-63fa-4a65-7e74-08dc90763090 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|82310400023|1800799021|36860700010|376011; X-Microsoft-Antispam-Message-Info: kYGRR6ZbrjNzL3bsi8zufhUy/XSFIPkOhJf3ozGZaRrwGdzFM1X7u/RIHZ99DIOhYwH1rxcffvvHQQrhA+yC060jL4VsZQLtMXeh1TILtpwPf2nQN2d7pQUPdMzDoHMUjqI4kFEuXdfSIyiuZpYNX1ybnYuO8BeqNiwg55olA/1ILZyw+Ozc0RYqHY5Y0nk9yT/k6j/C4NTpw5V2hVDuz5IArc8OsiH0T0b2EgTiL8d5Z1AKZVeyXXL+YrbfX5RYSHsUD9aY/M/jHgPj2E/B2rG/C12CGp+luSICmcPnMTG0WubKZyhLjBFDMP2OxHE5vK+ihqILJiahbEsBq4r7ANnA2dnWhMlzsGC2B/x1vdQqhS2mjrq27ulTCFMAyaf3cDWfsYTxJnQliKN1H1dw3kBsmEJJ+Y6voNj/wxDLDbwNlbUJN4oMhzNXSWMDPgv0/fXmpkj7h6PjTfNiwdXD16WMLev3nduMVuy+Ra50CLMB2T0vxAtewVaVEDU6p7U+HjCamCRWm8bK9t/kYIkyCZMQ24BtoVO7viKmp8xC5+QNOCTwy2Xhj95emDoD364yWXLFnb2gdIVUXVPeWo0Eq+z9JN6FZrpQF7MHzbag71PbYbz1oflESP9mCqwhplN6Oz6lw3EAzVJPQ1JZJVR8XLgnCBm4FHTzpiybA6OJ7WlJidpvz3yj3qFC041rfd343b9gaJ7jj96dToRhDmmow3Xel0pFtlmV1ErQMwuzahE3o2rsqForUqszLYGM4C5u/3i3ySPGohf7I3LK77IwyDtaeJgEfIIT7uWKNo6WuX6DV7wSZIHp3HCO1nHoIVJMfS3/h9kRHrqcOcUJAEs6C2qXjz8AeMOhvBdnVBCAcNXupHPVoKuEyiNOT+KkiIi6cfWGzB0MtgfceB/CJ2cjnmSLF/fsl5L4zAPkZRn7965QtUU+378rzYWG0ZZIUdMaLt8wzNkSn1lZJtQd4fCrfQ2Z8+/EIYFCCFDgKw1eRwKcDA0VDlhd6lk20P+Ueup46dCcqXKnv9Ks6/h1Ky6SITNr4fP4NOi+/RPB3yZlFJbhgpvm4QcZdyxn8QG5SgSV+AJjYKTWCg2ThfF1sUKOLvJbx1PNzq5QRJ6qUf4kjgzK2S6l1E61/Fz5JmBe/QzQH4/YO94R5/X8Zrkpfvt6G2dZPQ82mkwE+NmnDKkXRlVv5ka+t9wv8XnH3dvVR4KOXvjOhE2Q5j3JQiEVb6AyDjXTeSrOaMJzJsMj8wWfoRMIRiqRYkjWg+j152z8Ux4rynE8YXf+GE+eRuc06wi6Im/XTRifplg2H2f90nL6PsOUQugMBouTn1rVj9Xh8nEW0ynaoFVqXxJvf/4p/URUP7uPkQuqOK2vyQqhcR8Gkj0= 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:(13230037)(82310400023)(1800799021)(36860700010)(376011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:40:47.4303 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e37403c-63fa-4a65-7e74-08dc90763090 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: CH2PEPF000000A0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8440 Add CPU ID checking in case the driver attempt to load on systems where CPPC functionality is unavailable. And the warning message will not be shown if CPPC is not supported. It will also print debug message if the CPU has no CPPC support that helps to debug the driver loading failure issue. Reported-by: Paul Menzel Closes: https://lore.kernel.org/linux-pm/CYYPR12MB8655D32EA18574C9497E888A9C122@CYYPR12MB8655.namprd12.prod.outlook.com/T/#t Signed-off-by: Perry Yuan Reviewed-by: Gautham R. Shenoy Acked-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 1ce063a22214..76419762c04f 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1743,6 +1743,20 @@ static int __init amd_pstate_set_driver(int mode_idx) return -EINVAL; } +/** + * CPPC function is not supported for family ID 17H with model_ID ranging from 0x10 to 0x2F. + * show the debug message that helps to check if the CPU has CPPC support for loading issue. + */ +static bool amd_cppc_supported(void) +{ + if ((boot_cpu_data.x86 == 0x17) && (boot_cpu_data.x86_model < 0x30)) { + pr_debug_once("CPPC feature is not supported by the processor\n"); + return false; + } + + return true; +} + static int __init amd_pstate_init(void) { struct device *dev_root; @@ -1751,6 +1765,11 @@ static int __init amd_pstate_init(void) if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) return -ENODEV; + /* show debug message only if CPPC is not supported */ + if (!amd_cppc_supported()) + return -EOPNOTSUPP; + + /* show warning message when BIOS broken or ACPI disabled */ if (!acpi_cpc_valid()) { pr_warn_once("the _CPC object is not present in SBIOS or ACPI disabled\n"); return -ENODEV; From patchwork Wed Jun 19 15:40:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 806548 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2075.outbound.protection.outlook.com [40.107.100.75]) (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 9C4FF14F9F1; Wed, 19 Jun 2024 15:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811658; cv=fail; b=VoRukNUXr5WgmntaeXXa6KpTb2UX+XA+feuhq3g+5B7RAUhRsmO2mvDHdyGiawbLv1BnxoF9wTbpxzKF4Ri4zeXxhTj7w9lgflfba+4EoIQ4loh7776fXb1V7/yxiPlHWpBA21Vlemcs06qncdbmrkD/fz/ORI09lBe1FU0RRH8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811658; c=relaxed/simple; bh=Ny0uF5aZ/FeQsrJblVc03pDhAKlF0YUxpi5V+fC9JQA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SOn5EM5v5c+mOQ3K2a2AA7WOC7DmpOwSGO2LFdPF7FSQtfsl58DUy9Ut0n4N5n3u+5hWulpwRWTiKkik/F/P2ihkfBzIC+FZp7DBDyfN+UKqwxXKeMkld6FnAGEbyA4Z3tWIGILnVUj2qe6wjZoKw6ewea4mcKLWl6DJyzbdIhI= 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=PbiXQAwR; arc=fail smtp.client-ip=40.107.100.75 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="PbiXQAwR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=itLnPfLQdhEVMo2ker5dTv4xF33MCRMKquSH8aeVGxCU20nzN2RjRv+04+Z2kR2GTDo/Q9kWwMTEuh3rvWWyM59N0AIhgwCkr0gxgZUAxeqj67O7qxN/feQTkFZ1K9GvpOqPKRXvnp7gydjHOx3ZlbNkXtd+okfCGfHAvJo2xOGNsAaHtga/4RgKVCurl728yr89FuRbDN+UXD66okD1NfIQ0jxP6Y+gt76OCawxAMqs6gC5bzKePyuTO7csR2bmxSvDF0WFkpZJ/rcdb/9hRM39mDbMBvnIEY7o+VewI7BSCfmNz4NlSUDiTQjOp0T0ZgDv4nnTQb2DqoyAvJb6aw== 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=a2k7rycL6MnzZVLP8tEfnjfQzvvGfryfV/i9jWa2Jxc=; b=QJwGYoRi+WdOrjwQYdHx9cNqBcKQswsmhXK60tUhHgLIbfo82lImFf4FoFFhEX65TsStWraoCZBCthHVtKLEuvkQeuD3Of/sV1TuGMwCOIDJPZRDp8UczC6WM9dRGUxce2cx8KUFvbSFY7/afD3ktkk4L40DrLiNq6boFxr3ay6RtyUIIv7MD9/bBqWm7Vfk761D7gbCX95o84W+/xJ2VeD35HZ2jKB2GQIQpe+mLbq1jLXUvVHpU3k5GOckfiw4sFxY4aDQcC+XoL37uyNGy9JTM6iR0iELPnxPT67RZFO4ENiUa7EsEFxgVkk1eZPzzIGLykanZadT1bMkH4w9+Q== 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=a2k7rycL6MnzZVLP8tEfnjfQzvvGfryfV/i9jWa2Jxc=; b=PbiXQAwR3ekaDNWSgH41vBbX4Y6z1pLDQIOmpLtRU04BVR07HxqdN4AOuS/q7tdZWHGLyPH204vYBnLYfra/AeI6EtuCt7hqIafBXTXTXW+8gEwWs4ETBPpUd469bnv5I2RHZgXcKq9Qh+c5FOim8dPcBpm1Z0U0nNAE7RowTm8= Received: from CH2PR02CA0009.namprd02.prod.outlook.com (2603:10b6:610:4e::19) by BL3PR12MB9050.namprd12.prod.outlook.com (2603:10b6:208:3b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 15:40:51 +0000 Received: from CH2PEPF000000A0.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::1f) by CH2PR02CA0009.outlook.office365.com (2603:10b6:610:4e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.33 via Frontend Transport; Wed, 19 Jun 2024 15:40:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH2PEPF000000A0.mail.protection.outlook.com (10.167.244.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:40:50 +0000 Received: from pyuan-Chachani-VN.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 19 Jun 2024 10:40:47 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 4/8] cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS Date: Wed, 19 Jun 2024 23:40:15 +0800 Message-ID: <42c953616ac121bd1e5c329e83d015a02e6b32c7.1718811234.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: CH2PEPF000000A0:EE_|BL3PR12MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: d141c250-e215-465f-f0fa-08dc90763289 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|36860700010|1800799021|82310400023|376011; X-Microsoft-Antispam-Message-Info: FQgY31eGcr4cBhO1fyylmjF2fHc/33x51NKKw5xv3EC5P8XfQ6MdDLfQRWyAmBk2lTgHuFdkGrse11CcLpkpYRGwc0QFO7UTJORdLUWEO73MGM9RW6BV2i+JtJEyp8VkoWbcQfDYoBa+yq4mII64TM85d/NbXI6ffjR/y63Q9UhdEMghiRykdL2Qo7zBVIV3+7+K4Y1ndhtFUtxYs4oaYy4KL8fYHOt4MR84NST1sSPB+M32VUDjuYAhEF0h97+ipG3hNDzkQudo8a8YLmBCwOxF4NR+gCyCg00ml9UGwcJxfgB/U+lyz4VotbyUFfSQVmA9OnNbuuuQ9tDFRoS+yc9Vvs98vExJlUfb56OJyN6I6Eg95rLgGm42SmRCnS9UAkeCOtNd+qma1E6EJ0eZMXzm4HKibjJSMMitR725C/+V9UJqA6uZuJ/pxXGryG4gwDD53qfQqhjauO5BJx9CewyqoOjL/xtTRUsgVJSZVDgnPiBWFSzWXi+cBVOlpW4Y/3dZnFvoBi2x4+ItSyzvOC5+iXHXAZQrSh8ntNLL5dZNvLR9xyHECbukS4GdITxl+WqQ2OYJcR8pfll0coiQd81TMPguZblJjxrKtFnQVC1fGNP8iQFPD+mDV/91Ow0sqQcb2gmdUmZxILvwjJkER1O+k0Qqn/kJFtDWlO/7yTeI5GQlC6uYxCbGoIJZyL1w4wX9sDlQ46uZaeK/uFefKtlIDoeyx3kbMEugZLyJefeZk7aOj8yYYLSpm2y+z4MSfWwPDZ2rKNaqpyUppeF4Q75x63l1nIWruRqIAgBxcm1f5423YRbFWIGu4jgXw9+jQ6crP/ToqexzcduqnLf6o+lABb7jX6xQutAcgDG0oIKpGzgk4vQzruHsu9kHFM64vGjagNyNhStxZZTqZ0JGxthzVgSCO0T864/2GV+umGvEsVpy0k5j6pE+ym20c5zql+jklONe5M45grR5sUDpdSDvtaarrLxAkqUmgUGBuQmq3xKaEgOhS6KqVCRa9YMwHOxWAvCwhyDcO4Y+GBLOmAHva7cMZLx0KPWWvmv1Ld8YX3zL2+Qcq+mBJ9a8hnIC8Rk2gcAa801ee8CXWmkjS9dvt+g0DEjkdFG06tyxLw5jVDcUfu7LpEHc/7hp5F36NLM7i5t15cArMKQf5/mKdkQIPeBKnvCVQ2hAz3Qe0cZERXiVgzOn6tBiDRbWQpSXW8hcOL76xv3+Yo0efLCeofEqwyIuGHLbWQtmoDJhvrFnLJVUoFRqXDFcmPT74nKDYbcybql309jOdiPTWJdQIdQo4Z22/MvRMb+ovfFW5EjFXm/zDENQBi0Mc0bvFAlJQaPPTp0zI8LyjC0K8CgzLPLGacyQfE0GgUc0nGA1nyM= 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:(13230037)(36860700010)(1800799021)(82310400023)(376011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:40:50.7428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d141c250-e215-465f-f0fa-08dc90763289 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: CH2PEPF000000A0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB9050 If CPPC feature is supported by the CPU however the CPUID flag bit is not set by SBIOS, the `amd_pstate` will be failed to load while system booting. So adding one more debug message to inform user to check the SBIOS setting, The change also can help maintainers to debug why amd_pstate driver failed to be loaded at system booting if the processor support CPPC. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218686 Signed-off-by: Perry Yuan Reviewed-by: Gautham R. Shenoy Acked-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 76419762c04f..9aa220a0e3fe 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1749,11 +1749,37 @@ static int __init amd_pstate_set_driver(int mode_idx) */ static bool amd_cppc_supported(void) { + struct cpuinfo_x86 *c = &cpu_data(0); + bool warn = false; + if ((boot_cpu_data.x86 == 0x17) && (boot_cpu_data.x86_model < 0x30)) { pr_debug_once("CPPC feature is not supported by the processor\n"); return false; } + /* + * If the CPPC feature is disabled in the BIOS for processors that support MSR-based CPPC, + * the AMD Pstate driver may not function correctly. + * Check the CPPC flag and display a warning message if the platform supports CPPC. + * Note: below checking code will not abort the driver registeration process because of + * the code is added for debugging purposes. + */ + if (!cpu_feature_enabled(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_ZEN1) || cpu_feature_enabled(X86_FEATURE_ZEN2)) { + if (c->x86_model > 0x60 && c->x86_model < 0xaf) + warn = true; + } else if (cpu_feature_enabled(X86_FEATURE_ZEN3) || cpu_feature_enabled(X86_FEATURE_ZEN4)) { + if ((c->x86_model > 0x10 && c->x86_model < 0x1F) || + (c->x86_model > 0x40 && c->x86_model < 0xaf)) + warn = true; + } else if (cpu_feature_enabled(X86_FEATURE_ZEN5)) { + warn = true; + } + } + + if (warn) + pr_warn_once("The CPPC feature is supported but currently disabled by the BIOS.\n" + "Please enable it if your BIOS has the CPPC option.\n"); return true; } From patchwork Wed Jun 19 15:40:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 805891 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2056.outbound.protection.outlook.com [40.107.236.56]) (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 C54D31514ED; Wed, 19 Jun 2024 15:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811658; cv=fail; b=sSk+ap4Osc1gNNXlqwaq9ogaFyKWVI0uuwtoalfndWgxJQHM6lQaBNl2Kryq9AtXSStQB32o2RrWULItf3yxBVuDWsZxN+d1jOF/U+Ejbi6GicvTugPxbTZO0bR/aZ8G/JPoQyxiya1UpA18KKvJpuTwY3smm6uZZm1fafnuWh4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811658; c=relaxed/simple; bh=8oi56JB51hKIMujwy9l7EX35vtzjTuRgxVMy8CWr1mU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PTnkCtamqjcGL4tYb0xBGoMoNcoa7gYbYUk5VETUJkdqnz/5igtTzRMxWIG69MoTl5BjgG6+nBUiqhVYH/sm0cZfF0EJwpV4ktrYj1dMsIu3zGvIV1BqXVpp+HiXpp0mr6OjY2YUX5wpzEpCy/zDwcgVYC2Scx6FXDEL9lJHKv8= 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=IDJ+amt9; arc=fail smtp.client-ip=40.107.236.56 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="IDJ+amt9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bHrgVLrqn17f5E1/7Ij786p/m0igyISv8vD58JsujZY72rN75jnaQ6OgAP04CELxgWa+ByLIBSV14iJdPMYIPBRC6HTtQYwBWboE9UmxdWn2uUUU19j26as63QYhJtWLSwUmKeQ2YtgfbW0NhBbZFP2WtxZD3nv7jAwU5l4jyh+VyvxRIHziAlNaMzFV1yuc0dLkIkfiKsP2xjwWrJ/IVq0e+nA1VNk2sqrBPJea7GibstYmCilHo+mq9o+HWqoF9jcgYcGSCZtWZVqfFrKejb8kjjjYW+O0J7JXvQaTGn9DVGZOil/nRVr6eovX8lCqdeHYP+FZl1n6P3FJhPVBZg== 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=a/E6IhBOVp2XXEspZ45Wryd1CtYnDAX00CJJW7w12rQ=; b=cY2ICkal2uXV9xjYbFX8Rnr4RwWulESrBuEV0q9cYSrq+KkY8G8k3ByMR+BCy//AQFzBWjpryZ52F9H/pLx4PXT8h9U2Ae8Rwx/srCDTt0/ERu7ZDyTtq4zI/Xj9QTNQK7cGXFRuEjHFgS2G5iygooS8jBpaLFGKUzJDTy0Y7/12NGXoT9PmC84/AC/UlzMVoVLr0vdRBRthw+r745FjjH0UuO8+CQhWWdGrP/+mdmvRULhDSogIRCtQeTlWlSU/S26IEf90R0tllTHbRp5I/UakhfhmwW8vo3rj6BaWsMakqLfNjOid+nHQRGRLEF56+OR0vuuXprelyU3eOh1Hiw== 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=a/E6IhBOVp2XXEspZ45Wryd1CtYnDAX00CJJW7w12rQ=; b=IDJ+amt9oE+GN7e4Ia2ItFpXLfzqcl/IPshsBysFFSlEjCf8iCMAzrTuDt42YUP8ex5dkFwnQO7LAa+d2UjZXVrxiwcDA3J+fSEdZTbiD4duHEe7YADNGuRMhvSjc+2Wyg78wZvp4k0aA+TURYZmto2C+2bxysyWjirNgNRuIdg= Received: from CH2PR11CA0022.namprd11.prod.outlook.com (2603:10b6:610:54::32) by BL1PR12MB5924.namprd12.prod.outlook.com (2603:10b6:208:39b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.18; Wed, 19 Jun 2024 15:40:53 +0000 Received: from CH2PEPF0000009B.namprd02.prod.outlook.com (2603:10b6:610:54:cafe::6d) by CH2PR11CA0022.outlook.office365.com (2603:10b6:610:54::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.33 via Frontend Transport; Wed, 19 Jun 2024 15:40: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 CH2PEPF0000009B.mail.protection.outlook.com (10.167.244.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:40: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.39; Wed, 19 Jun 2024 10:40:50 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 5/8] Documentation: PM: amd-pstate: add guided mode to the Operation mode Date: Wed, 19 Jun 2024 23:40:16 +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: CH2PEPF0000009B:EE_|BL1PR12MB5924:EE_ X-MS-Office365-Filtering-Correlation-Id: a77eb4a7-fda6-43e6-e84e-08dc90763413 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|36860700010|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: r4cE9jB7AcEINVp6F+mKEjQza1ZVmeVW9/zTRHSgBooSTmFpAh4CM3LvTqnWzgX9xhYLFg38Ausr96qDHaLJMX06z+TuTRJiZCq2g9Am+YN9M3E9CCZMxAfvT+ca1veO+Aqn+jaZlRABAmpoJaycRu2vJZnlvNjXEtHICE166uhjeb8yNfkrObpKSIfA+zEbMcc7ZytY15aVzXEuggrG283w34xMAobffRDbKgLClzq9KNDvhVPdt/H4+9wKppfGGy/cDH5NSJV/9Mh+u6wMzVWBGMmYwNHO58EyBnaGeUnNM2VVcoP2/tPuTT06OcBwUbt/+RyDKC5KBqzPGY9aPVTuB6imnvRAY472Zqc2QiS/AdwP6v6E7Xvz76eNJthqmZbSC+26+fcsWabll+DutYKh6MdQx5dLThJ15KyZIz+PTDHyOoHDGKVOjI0CzVe6KLxmCmkNjIUcYfZdiE4aQNoQCJ94bE85a4TR8QUjTuDiyxFRZsZeVoFIEktVRD8FC6jdBxCvtW0Y1rYJguKVIe//KAIxiab9fQ3iezQ3rArMf/Bchmkc9PxzWoa3AfminoNshB7ygTmM92KA7NUWsfQmPgE1RtbN9ce2PCk3KWZ8xCqvZFNYTTcXhLq9O3E+HBinUcyV92KqhcdV21hetNt3o1LfwMIm6fjKkKQzw8CpNmHXKnBbleAAk3ZMUfnMq7eg+PDL5WFHA1wDR0mfVv7CRcoTJoOa8rhZk/k3CNtiqmBhIJka7XnFXRgGiPh72HfkHcVrIZadio2DwvSGu/1/IC4gTuxKdsvMnuKlKqBQVjZ2xVQwEouj+4XHT4p5+x7rV1wpzHKiziH45JR71zmtZqVcllitJexl2NXXAH5w0zdqJpeDKmUKznc3DvpM+XCNp3d/Gy0CIl8o3qfGSmmf2ZJadhQAF+UylCt/5lJEfkbOPjLLpc0H24Zu+4B9VwFN1Dou+ecyDNgIrrDq2feyPQECQOhLJtaEu4bhm89mOkYeLP/UM0tORa3VkdNYrq1gSg9Vje6xG1fE41xNNvjCwWOESRtkRTn1xwQQMKTmexBHqq8gOriVvutJgys6YR6NQDZV8EXn8TvXEy74TBR6AzgUn4CrH/qvTstyuqtVJgPy5nUIpp1bLgmhB6Uo0yDZ4G+vA1QwDEeQnO/HVdrJYIDEHDVZvT9ZoJNwX53+IHkSbwlnPweeE0tvvOcrNyvE7daKLjhzBkW+RB3cmX+OhUkHKoX4CRKr0TgORjA7Mv1t5EdZj9LN1jab0hsR10187HEjX2QcT3q9zNC1oez7KISaTCb+guOsMw3eAznDDDosHBJX2oWbFpGnJnAmQvDfh8myIy2XHsudTxqdF4kElBOze1neYgiXFnhT744zfeiFYUjJBLimZRhKPydXAG0Tszil9grnxSDXQIei9g== 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:(13230037)(36860700010)(376011)(82310400023)(1800799021); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:40:53.3090 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a77eb4a7-fda6-43e6-e84e-08dc90763413 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: CH2PEPF0000009B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5924 the guided mode is also supported, so the operation mode should include that mode as well. Reviewed-by: Mario Limonciello Signed-off-by: Perry Yuan Reviewed-by: Gautham R. Shenoy --- Documentation/admin-guide/pm/amd-pstate.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 1e0d101b020a..f5ee81419a93 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -406,7 +406,7 @@ control its functionality at the system level. They are located in the ``/sys/devices/system/cpu/amd_pstate/`` directory and affect all CPUs. ``status`` - Operation mode of the driver: "active", "passive" or "disable". + Operation mode of the driver: "active", "passive", "guided" or "disable". "active" The driver is functional and in the ``active mode`` From patchwork Wed Jun 19 15:40:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 806547 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.49]) (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 E2BF6155730; Wed, 19 Jun 2024 15:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811660; cv=fail; b=M2B0U6bZDJUe/kbtQfL2MLhk1T0cpkeom1DR919yEU8kGBYVHR68pwR9N+lLnyr8SktpFvtNrnHBDyBJopAbgSmfSSgT12VzOEhoAkuIKpzwC20Mv6X8zvpYAT9R/mh287U/BuSGkJ+RQn+3WP+w2U1BQ5ELd2v0zMji8t9W4qI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811660; c=relaxed/simple; bh=i8eqsDNdLSbpX0zvtYrlJ6MLMAVOl6GOjlMan/f6Ycg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uqUzdVkl5tQoa/tDZM0+71DNCiSUx658T1te9GDv8Ddw2olYD49xJ+BCRRFvqNJfoLWgE4cwnryD5596QX6tOv2s6AHMqRMcX+Tkdp5B9M2otPqGVfmOyw+B6/0tg3+w0U07AUqIE+dkaTEixlC3/lhTUHPiRv1oMavd4M4K/mo= 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=aOOy1Ls8; arc=fail smtp.client-ip=40.107.223.49 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="aOOy1Ls8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NAY1KLRiiTX0qlDvoG6COHcS8cPqYB90gjgDNXGEbnwW3TDFFClkbQTtAyG47mdC/b2GqPPPrmTZYBRwp3tQ8bRu4ETmCXzln7TYM00G39zGWaXEaizzQt5z6yP0Oo+0Lvi7CC7njjwhFhfNFZqw8urPTLDdpyfZhQj4E5qfWulnWBGjV3SyaiZSqvwUYpaALQeg04or9nHiVjkic2AshLXi+a6e5E5XEniyFrH70iE3H8zjIzcSEgeXCxzyh4MocSVFFNzpKodYz6bo4i++8J2Eu+UqhKwndzgWlOZ6PZs9LXUjX4CUnBUBXbNOYiWF/MiwPoC09NtUpw25aGcGLw== 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=a3+50qrB4Yad92PLxPRpV9Koc3tSgHyYMSSXzrds6l8=; b=PMwZ8mo0ZvG6eJUSg6lMtAGoggVESHpT1t6/0xTHFd6p+bIP9kDnVl14Y8zrWu3SJCASGfq0MoX7QwfeVLWjacCihCB0Hf4vcq6OlleOteeHcC1zPyuTog8/mqIEZr1lreYt+BXtdmD2+ePlJdEHFgKJ260G/mTxPVct4iW7Tm0lmvkATIrHRa4kS2ObRsMTFTmhOFx0AQ5TITuamuOmCn9tQaMPa5xByiFm92kWHhEWYoD/e1bnAnnpUuSov3ML7ZKDXgAOby9iilhEHj5NeY3EauIp3UgjS779AHU7TAaFzKFTwcRNnRh0W9zew3gwjpX6k3OP3NMdoUHTYkU2HQ== 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=a3+50qrB4Yad92PLxPRpV9Koc3tSgHyYMSSXzrds6l8=; b=aOOy1Ls8d7I+BnQYddVwYWMtI92j3e6cfjNVD9lQbPx8KZpzwa7WLzWe6lnx5ovZAJbQ+9Ii2XizMpl/ELWpz7Du/E54C4VuqXKBW3K4N7Fl6qjYbaQ+ot2HtOokuQ4pU4RJEdgzbqD9ZmtNRe1vn2mZTnO0IjYJiGVEqXVCL0g= Received: from CH0PR13CA0015.namprd13.prod.outlook.com (2603:10b6:610:b1::20) by SA1PR12MB8724.namprd12.prod.outlook.com (2603:10b6:806:38b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 15:40:56 +0000 Received: from CH2PEPF0000009F.namprd02.prod.outlook.com (2603:10b6:610:b1:cafe::4b) by CH0PR13CA0015.outlook.office365.com (2603:10b6:610:b1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Wed, 19 Jun 2024 15:40:56 +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 CH2PEPF0000009F.mail.protection.outlook.com (10.167.244.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:40:56 +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.39; Wed, 19 Jun 2024 10:40:52 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 6/8] cpufreq: amd-pstate: switch boot_cpu_has() to cpu_feature_enabled() Date: Wed, 19 Jun 2024 23:40:17 +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: CH2PEPF0000009F:EE_|SA1PR12MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: 01c01729-3c93-4163-65e2-08dc907635ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|376011|36860700010|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: /LeNAZX2crznG70aWyWDsVoTLg3GTLxBvkwxYhoWhsCtTqpZeRdf5BFgfwPMCpJdC4odAgZoNhnov1QynC8s+OdxOEVwKsrCq8uOGppB8crgDUFrttH8lLuz4S2ehCu4dnsi4zBNX+Yl4Q/2kh9nLpKhErhgByKlt8DN89+KahvdVgM4Zx/Vi2TC+oTaglfA4bi8fK8JSyfbXmvQMtZq3kGtTy2buu22O6rwgo69r+Nxcc013RlRQ46nnWdU63CoaAVQRXz3HZNSHOgTOx3Iu4OOJNiXQoiZkUivnJWScN715MWq6nEdRkkey3xsF6BvgGscTIkpYJUlJjnk85drqwKwGIHXM/Swdt0bnSAUhK1OhRb0YEAj7WtGv2dhc4bZno9uTcObZfTMwCSkE5osLCFgUI0z+Zf+IXODMpWUuWotV/x+04kRpCZtBhEG/NfDiNU4aPSom7HYXeuP5YujAks7aFUgOK6/WGl+FiZ9DtezoGEXFwBJL5ZNmsjXHpFG7X8GhCnSuPpcJHgn2UXTvlXJ9NdrtZ2uIqUz0iQDxESgOcAE0rrSKl/FaxNs1Xyz7fqIHaT5bFRhUBRLaPwhVsHDIEycGHE9468XF4RyO9Me32hS+6iSHvu3r2AhGNaNWMbihjEIsN/9r+HnNQgXUwSMBEMXJ9M/9t4WGdnadUHvFf6BAGaf80KPkixEVEpiMmswy5eiv+VcMJbpBuVS0m6/aSzb9lbenP9J8HlmVcU8yfDfNfOg1Zl6SHVu7OCu8AGwsf31uVs8g3UJSiNRvT73ZinbCS4+A1M9jLUhcW2g4+ApHi1Uw7RmrdUb8ymiZxI5aM7F0NiL2IM3Tqo3EIzOPSJUBx82GNLGU//dEj7KKYNKynaem59kM1r+nD6Gw0hITtHLFrsywwEiXfalM6+TQeo9a0EyD2TMVuEgJ/zvi+RMTsIvkz18QZMwOmLfNSaDbyz05CV5odl7zGeyQyR7KwRa8R81yysmOlc2c5LsKghy0Cl4j23AucIE++OnkB1wPscU7N2tLhlbSq3R7AL2JUMZB1IKha0vCN/VsiV2j/cA8vGgYfJghjSUZFvUJC4hunXRpocmyIiA8a2Qx88Jj+S3CKC7pE1JNN0Sa/d7aF3bKVZLzAPf+UKzCOGScbOlVQmPIyN5LQelS0r3JFYWpTGNTA8U4OyVnvFOsxTWeLmpHxqVso8DjK7OY9zAQxFm/0GfsKjhIerv3xJevsMHcewNhb8rmSZYieUYh6e0XT9xr9eKfahry74oHLDUNWfn9lrBBXBKBd+IcMgPypa1LgtrlgEr2Fm+Z7wcTrgDAipfgQs2KoWSALvZ92rWSuKwlarDzapJ5Z+hw6vzxRpTEaFmbnUacx06j7wlhagOU27LrCKbys64bERA5Gi5IncLjcg75Jm1iMRlM36RAw== 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:(13230037)(376011)(36860700010)(1800799021)(82310400023); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:40:56.0017 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 01c01729-3c93-4163-65e2-08dc907635ac 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: CH2PEPF0000009F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8724 replace the usage of the deprecated boot_cpu_has() function with the modern cpu_feature_enabled() function. The switch to cpu_feature_enabled() ensures compatibility with the latest CPU feature detection mechanisms and improves code maintainability. Acked-by: Mario Limonciello Suggested-by: Borislav Petkov (AMD) Signed-off-by: Perry Yuan Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9aa220a0e3fe..cb750ef305fe 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -158,7 +158,7 @@ static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi) * broken BIOS lack of nominal_freq and lowest_freq capabilities * definition in ACPI tables */ - if (boot_cpu_has(X86_FEATURE_ZEN2)) { + if (cpu_feature_enabled(X86_FEATURE_ZEN2)) { quirks = dmi->driver_data; pr_info("Overriding nominal and lowest frequencies for %s\n", dmi->ident); return 1; @@ -200,7 +200,7 @@ static s16 amd_pstate_get_epp(struct amd_cpudata *cpudata, u64 cppc_req_cached) u64 epp; int ret; - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { if (!cppc_req_cached) { epp = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &cppc_req_cached); @@ -253,7 +253,7 @@ static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp) int ret; struct cppc_perf_ctrls perf_ctrls; - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { u64 value = READ_ONCE(cpudata->cppc_req_cached); value &= ~GENMASK_ULL(31, 24); @@ -752,7 +752,7 @@ static int amd_pstate_get_highest_perf(int cpu, u32 *highest_perf) { int ret; - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { u64 cap1; ret = rdmsrl_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1); @@ -991,7 +991,7 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) /* It will be updated by governor */ policy->cur = policy->cpuinfo.min_freq; - if (boot_cpu_has(X86_FEATURE_CPPC)) + if (cpu_feature_enabled(X86_FEATURE_CPPC)) policy->fast_switch_possible = true; ret = freq_qos_add_request(&policy->constraints, &cpudata->req[0], @@ -1224,7 +1224,7 @@ static int amd_pstate_change_mode_without_dvr_change(int mode) cppc_state = mode; - if (boot_cpu_has(X86_FEATURE_CPPC) || cppc_state == AMD_PSTATE_ACTIVE) + if (cpu_feature_enabled(X86_FEATURE_CPPC) || cppc_state == AMD_PSTATE_ACTIVE) return 0; for_each_present_cpu(cpu) { @@ -1453,7 +1453,7 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) else policy->policy = CPUFREQ_POLICY_POWERSAVE; - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &value); if (ret) return ret; @@ -1543,7 +1543,7 @@ static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy) epp = 0; /* Set initial EPP value */ - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { value &= ~GENMASK_ULL(31, 24); value |= (u64)epp << 24; } @@ -1582,7 +1582,7 @@ static void amd_pstate_epp_reenable(struct amd_cpudata *cpudata) value = READ_ONCE(cpudata->cppc_req_cached); max_perf = READ_ONCE(cpudata->highest_perf); - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); } else { perf_ctrls.max_perf = max_perf; @@ -1616,7 +1616,7 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy) value = READ_ONCE(cpudata->cppc_req_cached); mutex_lock(&amd_pstate_limits_lock); - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { cpudata->epp_policy = CPUFREQ_POLICY_UNKNOWN; /* Set max perf same as min perf */ @@ -1819,7 +1819,7 @@ static int __init amd_pstate_init(void) */ if (amd_pstate_acpi_pm_profile_undefined() || amd_pstate_acpi_pm_profile_server() || - !boot_cpu_has(X86_FEATURE_CPPC)) { + !cpu_feature_enabled(X86_FEATURE_CPPC)) { pr_info("driver load is disabled, boot with specific mode to enable this\n"); return -ENODEV; } @@ -1838,7 +1838,7 @@ static int __init amd_pstate_init(void) } /* capability check */ - if (boot_cpu_has(X86_FEATURE_CPPC)) { + if (cpu_feature_enabled(X86_FEATURE_CPPC)) { pr_debug("AMD CPPC MSR based functionality is supported\n"); if (cppc_state != AMD_PSTATE_ACTIVE) current_pstate_driver->adjust_perf = amd_pstate_adjust_perf; From patchwork Wed Jun 19 15:40:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 805890 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2075.outbound.protection.outlook.com [40.107.237.75]) (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 6E4DE15666F; Wed, 19 Jun 2024 15:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811663; cv=fail; b=MvxyKPCuaxeFM0G1V2HEARRlVzMB2kK3HK/bBRu/YJ6prhCYO6SZtlBBj05VICgJoeqyB72uogdOBaePBoxycL/MVdoPpIK5rSQD/ZcrrgfZrh3ByG3C9Olcim8dU1O2/PdzSBBygT3yqEaIleb87mQx6okTaYbxZmVzWDkQ7gk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811663; c=relaxed/simple; bh=WbwQO8JdPcf4kLFbtaG1OPNY5dsLdn3zPQCltGWFHEI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UzBXzgsCcxAuMmeA9AOXcHgcTqj5WQ4LD1Udm7ETOG9a6JNoy5r2cJyYEuZ/Nu8IePZ33D+PYcXaLaRjAwzRCEr2VgXiZQYblrcE5HeO8DSrW8vmCZoHYRkUJzDT+o8eBOR6e7yuUOldu+gQcyDoSlm1dm4b7AvIEnvr/7AdTgo= 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=46HXFTEN; arc=fail smtp.client-ip=40.107.237.75 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="46HXFTEN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QA5qS0RScF2qvu9HRhDOFMS4/Lk1/tfAmwFCBEMGlQpyqRvQBU6w0ajPnCwuBDtW58fAPRzR/aLzK4EOe5my+F8Pw0cs/nSBZPcYpgVRMQmwjGTapb4JZeLK2hR4wYnrLUxBbO6FiqgpvqPIk46uZaDf1Ol6orrAUaFRVNBw546sEQC5+jDuXM7rM3j4sDMV0+EcUV9Ny+hi3hVa6ltZDW789IbnCj47SWNDKqIwYtDC+MI8iceKhGIBe+DQOeYVBDIZBiJ5HP1V2NFiHB0fIdqpNFLldUB4XHYalk5byqoD9pAG23zhJq+7+peoNoHyjngtq2aciosthDlAkeMghg== 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=1ZynmX/QXfKCaPcqU6fY4iQPhK0ZtwTKe70opGBMX8w=; b=nnpC35UlSkh/w7NLX5H8cGDtZO0gM4UA7vcMTPLwTbEHDZJ0GUZWYb7XA0bojCUCZih0HgZHkYH0HDHgREknQUIP2mmwVqaQL+NFQJf3eXVmuWIEhyNNqE6eF9nMrGddOSgmYrnA3zDDhkLeXeUeBycYMwbLIV6Un+RAQOTfuEYn6VIyHa6mOsZeBX5TyFq2Sich5zo3CHLyD2IR+mUyi1QnPYvgrkjHZ37XtPBw4h4vIfbIbW8mU5pxVX3fQMcsh+GzVXp5RnNevlzmj0zFwIWDSQI3LTV32cnnh5dhqVn8QRyxDj3XHh5AVolrGdurBTHrfQ+R8abmUtgSfJei8w== 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=1ZynmX/QXfKCaPcqU6fY4iQPhK0ZtwTKe70opGBMX8w=; b=46HXFTENRQPWUpQbEoW42r0h5aoWwMQSj7Z8oo9hbxEpEbl3u3HTYu7Db0eRNKtXyEutjIp1jDhneesWw0xz2+TuSiuPuXe1Z1to95HORZEJ1r1GcomBDq/ULdStXFXqWVnxM1EsaeaIjnDK3D/OBbhNksjMUhvS9iTQ9tfJmNM= Received: from CH0PR13CA0009.namprd13.prod.outlook.com (2603:10b6:610:b1::14) by MW4PR12MB6732.namprd12.prod.outlook.com (2603:10b6:303:1ea::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.18; Wed, 19 Jun 2024 15:40:59 +0000 Received: from CH2PEPF0000009F.namprd02.prod.outlook.com (2603:10b6:610:b1:cafe::66) by CH0PR13CA0009.outlook.office365.com (2603:10b6:610:b1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 15:40:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH2PEPF0000009F.mail.protection.outlook.com (10.167.244.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:40:58 +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.39; Wed, 19 Jun 2024 10:40:55 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 7/8] cpufreq: amd-pstate: enable shared memory type CPPC by default Date: Wed, 19 Jun 2024 23:40:18 +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: CH2PEPF0000009F:EE_|MW4PR12MB6732:EE_ X-MS-Office365-Filtering-Correlation-Id: 323166b2-9fef-4c9a-51da-08dc9076375e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|82310400023|36860700010|1800799021|376011; X-Microsoft-Antispam-Message-Info: GW6dkU3LZFIQ+HBjRT35moSmkIpwtY3Pr2ueIugGEDNWC8oG/xJ7QZgsht3KzEf6o21P3W59e+HL02edy+HlX2N+Jwi/koz04dHFcp6o+2VbJopJPXlcmEY+3WBiBfJQtkWunJTosscOLbqWKu1fezppFkVKEf4nF5zSyblTMIdoBbBOI9JulezT2TPT/FB1DkAK+/JG19lJtSuvoXYjSjak6rN7V7TTdhzBisC4HqRgtgJMMNUchdVNHB4wfHiWMBifTk+X4z1ykn2yY/UP/HEx32GOg5ipqZY+8RjzYDdLVpBDHAfcTZonF5IdwbF6VZz38HGPXNCwJDEKaS2XToAIp0fSZVz6CNUGZOSzNNaPzf3InP/7uaiqGfaY4X5AJMl81J5UqKDwWTBpCjhyRSy2nVf2R3F8Y2Y7RjDOXie7U0AJB0DvHOUitV9kGFLxzptz/Z5uQagqqRYzLe4ZWtUoA5ldOw4nyl6uovoZRavD3jyXMEmyp/fiwvSVFNsAdeNyVpjusa4X/FiXzfNrHolkM6zFd/JPOhGAW4ay3s2586qooP5+z/5x4gmWKScHtyuJFUaNAjadhAxGNbqk7Whj2gTGpgStJoem035/5KgO/iDkE7Y2eCo82jxuns7BR6pIR1gs0Bft9E/2yzcIe8CK4jdNwCdurYm1WpFK1n7r/a9Qpw99j706VwPrjcRMDex8zQjymird0Ne2TSXURuD0KbK5CiVudT5TboLkJYtnJCSrEG8uO4EsZXPC3bbeWkQivY0qiFwf29EO+Rzefubv53r9rFrAyHOMcWbj67FCirRKeMvCFstSZ0U6W69ROEaeQkVOo1FTQ1E0EdDIoOfc9ZPJ2+utfkBywHGp4mD4THcxxJK7u9K+tYgRsd+g2b0yfvtwLdWyBafMMUBBCo3bSIllOYsYEBXUfJ/DpFOoIQ8vPvA5f+B0yjE7+ubWc0eWRmSrHmtkfSvLDeP44l5tvnK+9jDZJzmAARkUpJepTwGjBjQ+iQB8TIqYDdhO8ViErO6FnJ0Hq1UPqyE7wo340XosYzpc9f+KEgk/ttOfODUKVVdTFbKKEJ4WpFzQJJX5a3lASAMiMMaUYUJRrO96nhsRz3wYm44HyrNW1dpYx7vN085JQo9EP1vT8ghU0Azx+EybYKA65KgYqzDzqUoLBrSDbTwJqwLjtq1343e+SLk5FprV8CvqGKyTeum3fdAzto2zx4mqbvX3/fJHzSk9Vpncu8AvSQchC+Yp1I4JlrF7RLtESrQSkPYSUE4sJSrtt9rb1K8q3LUn6w8Cd2fGUObsrdnpCg23rbJUV5NORjjJXeERnbg0UgBhRMUCaHEt7mHzO+ItrXt3DvYtFgsigVSo5iO1m3vutKOh5b+Urr6aMf94sBYENMLG2jSUq5KIH8LWeq4c+9QTGBKxFQ== 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:(13230037)(82310400023)(36860700010)(1800799021)(376011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:40:58.8299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 323166b2-9fef-4c9a-51da-08dc9076375e 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: CH2PEPF0000009F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6732 The amd-pstate-epp driver has been implemented and resolves the performance drop issue seen in passive mode for shared memory type CPPC systems. Users who enable the active mode driver will not experience a performance drop compared to the passive mode driver. Therefore, the EPP driver should be loaded by default for shared memory type CPPC system to get better performance. Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index cb750ef305fe..0f8ffbc0dc2a 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -86,15 +86,6 @@ struct quirk_entry { u32 lowest_freq; }; -/* - * TODO: We need more time to fine tune processors with shared memory solution - * with community together. - * - * There are some performance drops on the CPU benchmarks which reports from - * Suse. We are co-working with them to fine tune the shared memory solution. So - * we disable it by default to go acpi-cpufreq on these processors and add a - * module parameter to be able to enable it manually for debugging. - */ static struct cpufreq_driver *current_pstate_driver; static struct cpufreq_driver amd_pstate_driver; static struct cpufreq_driver amd_pstate_epp_driver; @@ -1815,11 +1806,9 @@ static int __init amd_pstate_init(void) /* Disable on the following configs by default: * 1. Undefined platforms * 2. Server platforms - * 3. Shared memory designs */ if (amd_pstate_acpi_pm_profile_undefined() || - amd_pstate_acpi_pm_profile_server() || - !cpu_feature_enabled(X86_FEATURE_CPPC)) { + amd_pstate_acpi_pm_profile_server()) { pr_info("driver load is disabled, boot with specific mode to enable this\n"); return -ENODEV; } From patchwork Wed Jun 19 15:40:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 806546 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2043.outbound.protection.outlook.com [40.107.93.43]) (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 4AD5315748F; Wed, 19 Jun 2024 15:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811668; cv=fail; b=GxGBi8wqzrr5DYj/inW3dX8QVp44o5iEUmqOaO4l2FzRyQ+X0V8SqQmte8zLka8Fc39TY/thnIq4J2IokZ+K6rFjJNaZawEYzuCiE1ASbFhKr1O7IeeLXM/9te/UvWzxnb4x+nZ+Pc3DdmNg3mvXvA1Z6f0gx1aYbe2eQUigyDs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718811668; c=relaxed/simple; bh=MqqjjlbpEoe/hMWQmt5e6k6TkVxL9smuKXDQll/cBn8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yyzn48nBUAHgkKSSbPAOqIKwol7jYO801a5wCrjkZfkhNz+los/w9pwuTpaBPFTGzaf4SRPd9Rfhi54y3p9m42COzdHXV39TmRK+HrcChbQEqoXpAZ6Om7DkD5SwI8sZtVA7WCFUCy1KsS2BasFWyj17NtRdDwZOz4x+q0sPp34= 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=iyZw7Dtu; arc=fail smtp.client-ip=40.107.93.43 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="iyZw7Dtu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5MkfFIDdQszmgDzTVnXoSezLVN2H+MafUvRdpn7GAcUsvs+LInyJGDZbIGUm8nu/EmFItYsTHaUTzquaPjnX81RKBhModTYxKEFVhLbJUS2PDEh4pgPFI6cY93epZ77nUuwYUqHLsfgzJAcfjxOBiV6OczbJ1sFFco625IGZEtzUiYuZKmN5Lpj+hAiKfYzYihGLjRtqVQIQHe1fr9X34lPJ+40OPOhJhdL7xXSFKZidFh8XuQ62JEoQdTQexUVDEmIRX/YctWhVeyCnUPhgf0nePi3t4V2fBtqFrQY9sh0dENXcZ+ihkRq901CNYQxrDimZCTq29uTZpKsitl+YQ== 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=i7FMMGVltoryByZHgzUsMpJIisVaRGm1ZelwyRhPK8A=; b=Q8ZiYpnYE2ZOOEkMlYvu1SegiNERoIGtTLCIEr9SxB5BZ5owCjqjtQadoFN+mpZbXxbMD5hptA+XirdRxw5wgyfEFcUNumMIAfD141P/Ok0juoO3viK/JUgJAIUlEBhgNRQn7iL0giqf+wbANwYkMj+SbR0pUfCKyVSktac5CNaPNe6ma/M2Ln5IlHTXiSgy4vqr1YhrtexA84007uv35RjJ3c1yh4JlpXP/7TInVGkBlfcXbnvuDZuOQ8p7v9V3UHR7z88AbiBPJ5454ZQNaz6oxDC9zm4kdGR23IOGP9NIUnl+57bprp11XwlT1xnfB7S29mAQNMazau9lUR8bsg== 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=i7FMMGVltoryByZHgzUsMpJIisVaRGm1ZelwyRhPK8A=; b=iyZw7DtuCm7H/Rx9wW1PZgXCg4b/IicOR2XOkiEi78UXmSnLiW8xZTgzwamuOM9YcCpZe0hrdpBf1RFA/6L8NeOsYUYPVpek8E7diWjCO0heKQNnypLJVo2mKHspQzswKw6XTEmzWED3RjBlSgNA1auyOLeky4Vp2BC32pDSjvU= Received: from CH2PR02CA0011.namprd02.prod.outlook.com (2603:10b6:610:4e::21) by PH7PR12MB6907.namprd12.prod.outlook.com (2603:10b6:510:1b9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 15:41:02 +0000 Received: from CH2PEPF000000A0.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::97) by CH2PR02CA0011.outlook.office365.com (2603:10b6:610:4e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.33 via Frontend Transport; Wed, 19 Jun 2024 15:41:01 +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 CH2PEPF000000A0.mail.protection.outlook.com (10.167.244.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 15:41:01 +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.39; Wed, 19 Jun 2024 10:40:58 -0500 From: Perry Yuan To: CC: , , , , , , , , Subject: [PATCH v5 8/8] cpufreq: amd-pstate: auto-load pstate driver by default Date: Wed, 19 Jun 2024 23:40:19 +0800 Message-ID: <83301c4cea4f92fb19e14b23f2bac7facfd8bdbb.1718811234.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: CH2PEPF000000A0:EE_|PH7PR12MB6907:EE_ X-MS-Office365-Filtering-Correlation-Id: d5f4c0aa-53e3-4077-7b0c-08dc9076392b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|1800799021|82310400023|36860700010|376011; X-Microsoft-Antispam-Message-Info: 0xTOO3/7lahKNI/8R3brmm0cwc4Kxnd16XuRPBkKfPO2xg6gvuYSKarrfgtRkLRNfq3u58YbY2486hFOq58Kr0vopv14RIA+ABNFoO4bgLr3JpvtfHZS3VYJMr9/xoL9xQJuTUuQTa0EnaepGRpYcYZ+JGYqQjY2v8Urg0LT5S/NKAMFUbN+WUlHzdoGn+N5hxDxSlYQdgzxCyXVJtfKVpjEsHS4Z0owwEEupkA57Jb8iD2LHi1ZMxprpLoWB3HnuS0BaQQQhXGacPjSQs9CWCWWt3dRVC3UxrMPBSB9qcxYKLm8uRj8T0WJFSj/TYSQhm/mCtDBd3vRv9/LM+QOljtO3FF2ZTih+PKe03SEwURUms/c1TfsoLOcTK9jAssAGx4+EP1WP/XB3hFektvIuZuoDaOpb++aFP770SNOEKYoORvjHM/6ACs8XrleUZhR23ei7QKCxu8TbEaJ1GhAMLkM1ARoZE9zJWGmHoY+05VqPuHO0r7VvaOUb0AJk1lLMThZahFHkwcKT+NPOZTAcd+mk/271mUmbonhh0K3+xwZS4zxDGI1clie40qw653oJn4+e/ptVVrUHQYFic5QAM9s1sIdHeAj5gUSXRhrW7BtlcBV6oFXAbJTENiCP87YqY8/flOE37xuEmWwLRwsCVaTht/tD5pWzHlNJioQd++jkuy4SQ6y6fNADmWOWTRp00knN6lZN3W4EdAMMmbVpWqMHDeycLx/2lkPze9DH1HXZ+CAvNTV5RvS0b8162qY6mdmIAPOA7KahAIIQwlCAtviI3CXAHyiK6Re9ueCwNIJRK1WZklUmdLEGTUs5HyYRBcjoK33B2TUy+luOqkhVw9HNYbvc3ZqoMTvQ2nmINiU7/Czz5Gf4CkAcJaANKv8xYP+wHmnIjUpN5uTCfa0LC6i/hJX8OfXFzbyjlNCykHPZHn+vr9sXf74mui1MqjLzzLoFhEWEIKRT7qUEiE+9Gej2+IvF0WeGUcrAsrQ2eshtZCaQ+Bv0VyuWFtc6+kV014weqwQUGSQ3NYaJRhEc0FUOOvYQ8mEYaqJUf2Rr5xTnCOG3gWmD7uC+PWERv/O1spi8IV8yRANXjevjHXbcpdg05tHg0O3Pm1Hc6t2zCWy9OJxVl1JK8dQvh+jU2Oryc6pS5aucNv5DLGnWP6LuWQCpDemLx38LpCgyc/I7XkieDLszch2GLVNvJAyNKCLoAa4m+ZnRXIzfh7vNkRRni7Ukp2fXnXPLT1kFHPcQuOofT8f/IhFdzXqrxiYpgiyy6mIJKVbU9RVdzCk8CNC6MAzhTAVNz9VratQSnrmm1KxKLN2lqugIT610cnqddRKwBq6RvgOWQOvCyfu28b/ebMXyxWwJ1lRREFX846FC30= 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:(13230037)(1800799021)(82310400023)(36860700010)(376011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 15:41:01.8521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d5f4c0aa-53e3-4077-7b0c-08dc9076392b 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: CH2PEPF000000A0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6907 If the `amd-pstate` driver is not loaded automatically by default, it is because the kernel command line parameter has not been added. To resolve this issue, it is necessary to call the `amd_pstate_set_driver()` function to enable the desired mode (passive/active/guided) before registering the driver instance. This ensures that the driver is loaded correctly without relying on the kernel command line parameter. When there is no parameter added to command line, Kernel config will provide the default mode to load. Meanwhile, user can add driver mode in command line which will override the kernel config default option. Reported-by: Andrei Amuraritei Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218705 Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 0f8ffbc0dc2a..a96ad7d10a4d 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1801,8 +1801,13 @@ static int __init amd_pstate_init(void) /* check if this machine need CPPC quirks */ dmi_check_system(amd_pstate_quirks_table); - switch (cppc_state) { - case AMD_PSTATE_UNDEFINED: + /* + * determine the driver mode from the command line or kernel config. + * If no command line input is provided, cppc_state will be AMD_PSTATE_UNDEFINED. + * command line options will override the kernel config settings. + */ + + if (cppc_state == AMD_PSTATE_UNDEFINED) { /* Disable on the following configs by default: * 1. Undefined platforms * 2. Server platforms @@ -1812,15 +1817,20 @@ static int __init amd_pstate_init(void) pr_info("driver load is disabled, boot with specific mode to enable this\n"); return -ENODEV; } - ret = amd_pstate_set_driver(CONFIG_X86_AMD_PSTATE_DEFAULT_MODE); - if (ret) - return ret; - break; + /* get driver mode from kernel config option [1:4] */ + cppc_state = CONFIG_X86_AMD_PSTATE_DEFAULT_MODE; + } + + switch (cppc_state) { case AMD_PSTATE_DISABLE: + pr_info("driver load is disabled, boot with specific mode to enable this\n"); return -ENODEV; case AMD_PSTATE_PASSIVE: case AMD_PSTATE_ACTIVE: case AMD_PSTATE_GUIDED: + ret = amd_pstate_set_driver(cppc_state); + if (ret) + return ret; break; default: return -EINVAL; @@ -1841,7 +1851,7 @@ static int __init amd_pstate_init(void) /* enable amd pstate feature */ ret = amd_pstate_enable(true); if (ret) { - pr_err("failed to enable with return %d\n", ret); + pr_err("failed to enable driver mode(%d)\n", cppc_state); return ret; }