From patchwork Mon May 13 02:07: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: 13662973 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2047.outbound.protection.outlook.com [40.107.212.47]) (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 3B20185C4E; Mon, 13 May 2024 02:07:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566072; cv=fail; b=BudtrBWBYXsKixR3GO3tOO7lJ9xn7yaFah1pZ8DCUmXndk3ZBdOT23C+KNal+qCGlutrlVlVrVQosIEt1axpJDe/Ia8ZlVCYFkQFj46Vb30sXjJTVP6YhZnu8Bqre+4pvLCaLeMHINXHclClDqRdA0XhKut6c5HdkH9PT7vESdE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566072; c=relaxed/simple; bh=H+xYJwbz8YnQezNx+x8BVIf290b6zBXVKMgpfUNP3Is=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kv4as5/C62UBVqldbsysQYhN+g9OopK3P/oGqrez6ESaiHigevNXRsfjkyYXeIpwXlOhYdxsRmTakqphaxPL+pqzpb8Q5ErUdYpNayXQhfXIVoMuEvkEe0pvxIrc5wjHbj4iw4F0o8PUs66LkJBMWm+vnliThoS5di2mWcTtXGc= 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=41vKpEeG; arc=fail smtp.client-ip=40.107.212.47 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="41vKpEeG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vq4SK29UZ985Ne5RfG8jodBDrs7zHjMVzrn9l9qwVCrasuuaqNt6BXtjbPrd9AU8axQhAioWDNlPZbBuBmD4YAwHWO8eY+jfVwk5AVZsqtR12wgm132nG1V131f/VRSsHBusP6dozdzAxBlsQcvE5MgKaTKQ8t3sP6GxA1dwBvORLFqk6Zq1wjxcNqav6L5nOobFT5Jp61JPKxKSv4QwFld4oEXhRVzcCDUSS6pYdSx/CKrHcOFjepAJnnkljqdTQvCr2qbZ3vku1qVS9l9IUCFmJTtXq+Oa4VH7ad7XbzlOat9hmX8x29Cq11zQrh0sA92DLNguHzoT3k8YDoRaiQ== 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=i8bkUq9XQ8EktmkaHrkozON4ce4H5PdEQXIPdMJ5sG0=; b=G8ZrYhPYB/Br0DLjR9kIlJ9+OvxiREjFgR+CkaJEk3ergmftF1ITRaTRkb5y8W62yONzPta4ugUHsugOyQ4ptiOXOSU0EYNCagQZtVq+Z3LrEv3kwxt61XW4YNz4aNI6498LDayjd9Lx6Xi6iN4Ene7aOp5MmAgfo87NjpAFPteUlKgdt3UPFNn53pOHcwZpLUgIZ18PAsQK0UMR8rY0p04+4i3yz1q/YaExoDqM6QgDaGN1OaXTlP/qgVgI/WJEyk2geqsK0spiQAwdk3bx5pWKVfWYbeiHkTRpUzfifEXKCIwDdo0G7gvnvqjaNlhXI5tTTKX60P2uZ1pFL2xjjw== 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=i8bkUq9XQ8EktmkaHrkozON4ce4H5PdEQXIPdMJ5sG0=; b=41vKpEeGlzDtM2XfJE/P5hYTQzjzreJmdxyz0wv4tXrRhd+RgLU5+MzVTKod1xnGLdJsIOuddYsEaqfzOEq95GYY2JiIJRVl325nwCT1SQuqB7EzqUmigLDfUiI9c9w9wJEj9LTSk5wN1i9O8ohnMeeUNlBLEyMVt+m0//mGZwg= Received: from SJ0PR13CA0206.namprd13.prod.outlook.com (2603:10b6:a03:2c3::31) by SA1PR12MB7272.namprd12.prod.outlook.com (2603:10b6:806:2b6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:07:47 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::a0) by SJ0PR13CA0206.outlook.office365.com (2603:10b6:a03:2c3::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:07: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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:07: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; Sun, 12 May 2024 21:07:43 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 01/10] cpufreq: amd-pstate: optimize the initial frequency values verification Date: Mon, 13 May 2024 10:07:19 +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: SJ1PEPF00001CDE:EE_|SA1PR12MB7272:EE_ X-MS-Office365-Filtering-Correlation-Id: e4e6ca92-189c-4c05-1506-08dc72f17beb 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: MquwzWO+LNaGCV18Kwf3lBvMw0iSRZ1n+iarvL6RXcRaO1MbStp+kmflvrcMCnYZRm2WcbbYRBH1mes842w4K2JUFvX4LORVFPmm8WyiVXplJM0GoC063J91LYTMecQhdEvPKCQSiLIYbAh51iGP4USfQPXMoUxju6FFBCLfkpIG+3PZjHnrzLhMW11ZtZN/mDjmh5nB/i2bdiMA5IJQNeLum/NiZtJwzR3cgzTUtz7YHhoah2ljuCC3HW0phfd8QIGMdk0/TrzWxkHogzWLm+8cKwKGd7DXoI1EIhRKQpet/z2+AeSHe/H6Np5wu7zDZiuPIh0KfY/TtXQ9pKNao81/AOjjhP5LZwqXabKhC/6D2udELc2dJxDNgmAzEq/B30hC9qjYNn3l/cH0ZHJUosP2QyISQ9A8rGlkuHuBEYdLVOI/rx2BqtpoovxSRvDZKYCFGsDG39YtelslrGlqVyA3Z15zCYLgO14/x82A2sZkHsw2GFebN7QdEl16ddZbEokhx8UJrd/B4/gJYM/x28uiKmYhg5yzVoRbHOe2tYUEe3Y7sFqk5SHM8li4Mlx/1HG4VSDFq+KlCHELpiwan4DMIev+e6WEBpq3xr4lhWVyXbkt40Q3TYk0D+D3tgjrFQGOYI03boxXRaWRzifSp/1W74vAIog22FCuz6CtCkIHK5jU2rgnMoBpQ1g3+r551nHXDDCOivDq0urEBmSFkSzSAc2PDtYjSnzp2EA2VrkkmoK+F5BG448m7GAqL6el/9OEF6eA2DgP8QI3q8FOp48xXuYUskRhYrCpUnJPMrYi6wXNhPIV9e+AdOrS8Eet3QxJt4ay/gIr/RlXwv+RpSGbmpMPKM7xFMx+lLENbiF3n60JyDZ7L5n4QWCflnDLkNHh7d9d/rUd+J28MhWlW8a4znfa2z2P65gYz49ZlSH5tPiIw++Aqc4t3WG1cHi86kmuzL1GLF7/N/dnZQhAUBes77bt4mD6ZXmlYC57Vp7o5mkeXPPLPR77wfEBBFM2NWm84QInz5eRZYrRjmoEaexev7mKM75god5afThfRNRESTOiQSwPS5Rg5BO1bqDsec7VjG3BkHzLPl+DTZ8b6F5Y4a7pdjDSPDS/tmjPpE0MgeOVIciA68ipK3YeXGUH+mjoT+Is3tCQZArSWLwP4dwp4Vv6QV3uasBCWEXDY+ylYwVe1UvAk84AdRT1YvoFx8iWSY4Ic+Yi3otr9FRfxb4MhKZp+HWjTeVWXIdFjYiFuK4NxtlK/ZW2a6UV52CNuToOqwzZ99CH0r1eUsYQpam9ObmOFbmmKnNFGHuxJnru2Fu+vsVGucKwx6s6yQFU87v29qnk2aTVa8oNcXNKzUVL0+jbTYck63EahqRvVe0k8KTMfpqgzDYDEQL+ekzz 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: 13 May 2024 02:07:46.9581 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4e6ca92-189c-4c05-1506-08dc72f17beb 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7272 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 --- 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 6a342b0c0140..614f6fac0764 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -889,6 +889,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); + 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; } @@ -927,15 +945,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); @@ -1388,14 +1397,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 Mon May 13 02:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662974 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2041.outbound.protection.outlook.com [40.107.93.41]) (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 89B7385C4E; Mon, 13 May 2024 02:08:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566082; cv=fail; b=mEbiwff8Vp0y98e2FQs85BIIz9q1MR3OfIk4pYlPKhf/Nj6DDSuxjuhrhLTGgA1769Iee1mhWk/nm6nUQnqjKXzh+Xlik1bVNGMZgpWv4Wc2uqlUfkx45tbFGAcNqebqrDYFATJa8XaMKhvKHFgcKAthqZ8ZmBe72fUgLaLwr5M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566082; c=relaxed/simple; bh=pAwKbu8p5c2m5lTqoqEeABKlCon+dNJ7RJCdaiPIavA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=efj43458gMs/owEBr8+OQMFTayDT1Vayy3tB95FjDWAuvBWol5we+t+eQFp/NrS2NAwhrjc6+f4imOr/8RIEicqcPSE1QkA5pKd6V22zRvYdkuKpYWgzdGUGwRP2KXMReqoVQ7oT7IKzcgsWdPOJAKrG1AHLbo8Dn0ddO9d7HVM= 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=cOTWa5Yh; arc=fail smtp.client-ip=40.107.93.41 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="cOTWa5Yh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PqumbPQmPiNSjhG8qaULkJ6UwJnciaI7hsh55q6fUIsrePUeDnXIzyrFfGLstc9EQ4AlkvWsIqXinVjVeAebuFpIEO15leoQ46BZGJeZa+StCzgH/upFTK6LgCAUyK4RX7jqjMtL1h6lTx2d7ePx0nSepI6sXFZbJRh70j0eNe4geo/fJ5DRRji8u5JHGmob8FrtVrX/40FdUws/mDMfRCH/sOmxMQnnVH+GXPIZm9dJOwc0XsFPxRBoml7aZXL9UqCYiop/R/2ajrC8NRg65y9hYyVbw6PcBTzvC7OGchYkfovuJJDYDznOjFDfsFxBVWtWqc1jiJnPpLRCfd0DIQ== 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=Wh8ZHY3gLW6izqXw0DHlYsLQP6blLeNi/GIFxVIGqXw=; b=PLgdlvum6OpUyb2++afTwB6S80V2FM/uAJkf35Up/WTi0b8Q+E+Se/w5CZC1JS1JXM59l9uko8a1eDYXV32HM/QJVxucoecoFjDvotvBvnk6/2iEJhxAcw4BxfYQtoNAEHpl6u8ERtQ4NdvVM6Lcg+VesSaDQuFLp9f3aZQfppg1B91yqBhHPN/jwShRe6eI0b+8JwlSOrQD0yGJBgsCgJfOr5/rk4uMMs20PZVMcC9TOxRv9932V7FQ+zkHWNy4mSbrK2V8gkjZ+RxLF9pvv1oajm0lN+zI+/r0qUmRLluQC/OB3n3K/ZBcXKkCxak6ex5r4DpfQIKCYMlj9k57ZA== 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=Wh8ZHY3gLW6izqXw0DHlYsLQP6blLeNi/GIFxVIGqXw=; b=cOTWa5YhdmVrz2sEUsrhYh2cVf9L8gtZZ3zYe4Jiqpj9v4hnaHy2dihf1zD989om5D2Zt+b5dY1i8ELJ0TB1mSFpl6Q4sLltH/gmLfF2ydG64Z56jXSTLAPIXOwrZVNNiLEeAeTLoczJbGHM3hS3zYPTEaEMhe5VooFMKqXw7zY= Received: from SJ0PR05CA0127.namprd05.prod.outlook.com (2603:10b6:a03:33d::12) by PH7PR12MB6537.namprd12.prod.outlook.com (2603:10b6:510:1f2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:07:55 +0000 Received: from SJ1PEPF00001CDF.namprd05.prod.outlook.com (2603:10b6:a03:33d:cafe::48) by SJ0PR05CA0127.outlook.office365.com (2603:10b6:a03:33d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:07:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CDF.mail.protection.outlook.com (10.167.242.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:07:55 +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; Sun, 12 May 2024 21:07:46 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 02/10] cpufreq: amd-pstate: remove unused variable nominal_freq Date: Mon, 13 May 2024 10:07:20 +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: SJ1PEPF00001CDF:EE_|PH7PR12MB6537:EE_ X-MS-Office365-Filtering-Correlation-Id: 53f96de2-edb2-4d2c-b94c-08dc72f180ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|36860700004|376005|82310400017; X-Microsoft-Antispam-Message-Info: Rf1+5i9LnRei7Dm2guv2BS8s1Z7gI9NRC1+4bN3AgILeKWHcSyt+kIOWfauqbjFS1+omM/MYurNu7Zt1/pyE3cq+N7JjI8KCqebS8wyGbPl1HmjcIWq15TNMXTI+uoZn0SFINSgkwpOeFalHKMXiEeXKg4nG14iZczL8+tET5TTTCzFpbJba4eNxOSwZJw/O/o2MddCVMpFjZwYciES9r3g7FUqVAYS2KLiNFdcfl05ht4W/7zEPmPIGU8XPe9x8nzftJJb0dlyzehOFXBL9p/AVaFphqvXs/f4ylLVhyabWDL5OiusgWujmDAINhH5CCOYnwehDQmKJk97EFBSHvEv22GJGY15CKXtC0T3Wxx/k1MT45PKJbUmSqy2D+Go7IzPvhOVbdmcXdy0Q5iPvFO16N8yu84rkHpYNgnAMGeUxhzNy5iADyuuhlEyOvwUH/Y7orY15z2kTFfkhKAJcbz9rLLLvUQ9DsIkBx6kizpqWVpxOjaEIo5N0SdFy248Dwh0uPcd7H8UdHWW/cWsmHLGiTpzcmt36Mk54LCYzC6IP3jseTqSD0DqrIMPPr1Bx/6ohdHpZNAin+a0lux9jVFCMCjyT7BEuY7sIe5JPBTGpSifZqt8NDwQOVSFNq/c9CL45MF4YeLSkYLn9FUp9cuwQ4ntRYWyJshSknConvUmOoB1MSZ1UCjfu3RuTQouJr0QY78aAZDA68qNDIEf7p9Z4WNXh+Dbtu7qsstMa2QT86Mc3KPhODp2UsV67+2A9MXiP2FLNvJmJ3RHanT26PDlHZiEG58SAQhlOIxxzJAS8GPGgDa6ilDpZWJxTAZmQYKDblMbUvOIDFTwB2/2S0b1jACzr4dc+CcU0CzZ5A6494n8SZ+ZxHWCv9xyuNKV5I9DbZ6Jyb6DJ8Oym5/UsaE2+zjkhbBFLGgZuaDGqf+0cUvuIULtZDXOLSiB2L1UQKvvF3ZmlcIfEP0TsK8PUjFaIMmScDTl/TzVHghXkHPAamSqzrs4Dwod00fn3MBGsEect7Ijycqj+R5sXCgGt8scD0byoMahsq4djLfDVMDnR3lD1Y+uHDqSBGa+vuD45/Og0W7cZ+UJweq6duT12usdsbhZFka4cMiFcqQooKG6KeXmdDDaVZ0jKjyLPLliTYBr2hEduVljkddbu0uJYnFfzBqLF00vdko/U9zHwtt8fadXGJfunnCH6vkT/BVxQfpGuPLpHDhY89xOIDhB4xFdzXlojB/FGLFvW6cf8aJqHKkKBmaq5+KNOJVrmmvAjEdVOg42Qh2WHncVSCKlOd+eNnLKbnO3XI2dr9x7SulUXJRq0mYrx8TGiMc8dsV+C 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)(36860700004)(376005)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 02:07:55.0923 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53f96de2-edb2-4d2c-b94c-08dc72f180ba 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: SJ1PEPF00001CDF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6537 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 --- 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 614f6fac0764..9ca22e94f3f3 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -912,7 +912,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; @@ -943,7 +943,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); @@ -1363,7 +1362,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; @@ -1396,7 +1395,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 Mon May 13 02:07:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662975 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.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 3493884FCC; Mon, 13 May 2024 02:07:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566084; cv=fail; b=P7L8za1NQ8UjX5dirAVXQvbAQNSsvSldIzTCZ6zwCF5km5GqPtl1/fJxop19wwg+pivZ8X+PKxq9yMdr3oXtqsMM5sHLFB4Pf8fUf8LkpeRGsnTOlKofYlFN/4pPQrW5/hfmqYbcIYuB1OHPxBQ4yM6ksifZRtvwOdSAt/uLjuA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566084; c=relaxed/simple; bh=Ul/9XVgf5jjdqWmqsUG6M+mZ52ltx1t/l/OcVWXeaNg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C012w3So9FqHjuUIZIyqTdn7giFr8qNJ9FzJHnjwgt3Rq7mEZj/RVHabqP+8tX3Bzx3NbdVM0bVf06T57AbdPlqu7pLiabGV201NrFT11J3NEkZsf92tb9KRuiWTFwZdVqfZ+qUMC6BoctC0qn8hplkN6FTF9+w5QEax7tPaakM= 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=xXUeI/40; arc=fail smtp.client-ip=40.107.220.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="xXUeI/40" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FR1wwOItoOLerwpKlKbncHsHUJ1kClkK7YkPPwQF0EojWVKRi4Jo+IFmcd4LSC0rsdhY0sBFdL+Sk6lx6ecQJ/SjAxbVKOz1Tzwrbb9SdOu9E6bwV3BkdznbQGrNUtCi2dx4+4T+0yBG7NOq1d+Cmt8gkrpdlcTZRD7W0uWDtB2GQbuuSZlxcDLJ8FKjpjkHyXzXdaLO/hWJgfZu/PEni3Pb5Iwe9YRaa3CMPNBeDEgac36Ct9G6dcliJuVR7M7RQL79SjnZXzLhDRsQGja2DRWkTvInX6C1+UgGv8D2riLA1JlCJ/4Qti7Sm5b+AdMMvSdDh2x0qCJXh36IM24hog== 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=yLaouRC0u3QXuYxR1X1EMPN+zYuOF4vcWyJcSZdkgIs=; b=Q7hW8NqBAUb07kVqcZKMNI/hEmwiy7hddGFOimbkYQFfR1GszRZeC6VGu9JXbgHAOZkjsTRPIzvoknhS0rkTU/Qy9HUIoPIf/UjfUVJ48SslY0oMPJbFpRKQe6SXXwCuO+ftI8I4qG3oAbq5A4wZ1X8gJobexCMLlOcwhy4rDTJSrZLi8qkNg6Kw5P2jLqq7xCBrDydQ7BW8X42rg3dr3mRbSdmfTuuT7AFCri9O2JzlfEn5FApsJr5jWtMmm4Fe5vuhfeo4372UTE2zk+EAkdsmGeYAmdn91eniXWXEvWuOu9qpqX9y4BbgdZUOVrrMmMQ4MJ87eUFjsUmmRUJxAw== 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=yLaouRC0u3QXuYxR1X1EMPN+zYuOF4vcWyJcSZdkgIs=; b=xXUeI/40cKHdTKjleMLgePtt7Hia39xn9gsU3EpuhDFyQEppexqRG8pNQVwmoiEbm6U0+3SK9lF1mNDGCtUrtqTgNfgZfPGXDunCbv5G0zqfWG7gPI1K4eTC5+jzLU7i0QklEp4xeMX15YFiElG7+FqsdscV75YW8Zlypc8udAo= Received: from SJ0PR03CA0095.namprd03.prod.outlook.com (2603:10b6:a03:333::10) by DS0PR12MB6439.namprd12.prod.outlook.com (2603:10b6:8:c9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:07:58 +0000 Received: from SJ1PEPF00001CDC.namprd05.prod.outlook.com (2603:10b6:a03:333:cafe::49) by SJ0PR03CA0095.outlook.office365.com (2603:10b6:a03:333::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.54 via Frontend Transport; Mon, 13 May 2024 02:07: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 SJ1PEPF00001CDC.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:07:57 +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; Sun, 12 May 2024 21:07:54 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 03/10] cpufreq: amd-pstate: show CPPC debug message if CPPC is not supported Date: Mon, 13 May 2024 10:07:21 +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: SJ1PEPF00001CDC:EE_|DS0PR12MB6439:EE_ X-MS-Office365-Filtering-Correlation-Id: 195d5023-3367-4ad8-e25e-08dc72f18262 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|36860700004|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: m5XEZAphyo8L7sYuF/YyIwHpxsE55t5KAv/Wfl1nDh0s5Da4ApdFbO3o67ue+GlIN3VcF02DHS2mtAfLBqWYnQ8Xua29wf5LNXkMepWzgZh8So64IhFf+c3780FoYs1xX/nMYYE3NzC7/+hVmW5t7l2bCEtroiIryg8SGE55x1zuov4YVzrnoUTPb6O/J3kk6c3dxRheJx/7HgI0dVMnBwx31HdONxpvV1yUBr38SCqPk2mkRFXWNHb8+gOaZc82DDM2+a8TsEzProF8DIRkAtn8N6SmDCTFft8SJHXu+h8D4cU7cyuquZmt9aX0noCNZ2cnmdZPng4Vgv5DFBWC5J9xB65H48XiWfrqrrhqUU8p49r3LHztzYF8lzIGRkO5vBTquMNEJReLItaX63jMLsOaz0UTFFDITC53LEH5TEjNJJmHw9VJP2/rmcJ1Q2vuMP/QyycUB/PAfdOWgRVsXeuu6vFr13sksPoo3mNvCjdPTLIs1XyYr9V+g8yxkLxy8HoeWFYdqjjal/RqSZCygWtkkwm02q5BnP8c+5dqqW8cY5LfJA7AjfzHuxMD7N/GsblHcsydopIk6al1xzsn/VksPk1F4fY5tYfeP+nr0LT4tKRDSnE3OToIpEIw+BwzWy4Hq4puctowuE9wtha4yzNvSg1WNjkVX8jHH73HVUp8JhvN0a60A4yNwakq0HoFow5kIwAFXwm2iiktva3NfVlCLMtLpgC7Vd12vc5iEMl4dCZeryCK8sEFQs3zjtjP29O7R0iWIe/7pOL7ZqSemS3XnYwi4ixpLTjWrhwZZwGQheCfKyT2MtDyP5F0Fl5mFez2QvMXjqHa4T+mWJwn4t2+MT2a7+STIqQcAexHxuxKeZQs5ZF/LF3egKGaB8aHh22BXceR/1sHIbV8C1kjL7yLPpQZ0RqRp/ExNmlHRGeFcta9crRogW/FBpgCCspd1uoPmNZTCdBSj/M/b+nURu87zkZfxIve43PrE+NHeh5jbQexP8dmXueC1VmG8y8Kvc0IL2xrkm+Zadur/piDOIO7PBBtMpZzZDINAnNUeKEl3vMjh9vRBKmS34bqvZEVMjTa5eTU0pfqqj3ElAL8duwoTXA6YsMhsoFRUFd4X/Vyk0K+xfV+HDeA7oI6nWs1WDf2Zuyi7hyKOCNes0jb1RJ/62Pbw0LH+96AbBSGS1/ZIhihIqfKJ0DByMd+c4rIh/WGrRlmzziyRl5MbG6r6lKwdzYgHTCjBASHVj52v04dhjO3N/bvsZpo+Uy2L/kdvycTjlj4JClF/qx2wUu5n4CiUuYGpqpX3TrxV6F3wSm6Tcij4tC8+F2Znlntm4zZ 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)(82310400017)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 02:07:57.8721 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 195d5023-3367-4ad8-e25e-08dc72f18262 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: SJ1PEPF00001CDC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6439 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 --- 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 9ca22e94f3f3..3109b46fb02e 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1701,6 +1701,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; @@ -1709,6 +1723,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 Mon May 13 02:07:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662976 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) (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 EA7F7136E09; Mon, 13 May 2024 02:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566085; cv=fail; b=NHW3A4UcWT1he97xFQ3129+pcBw33R7ie301fyZ3kFWfxuV/GXlPqNJkoGOk1mnSW8qLytw7IwM40IZTx0t154Ktw+BXqYGBYCI3EDNpq11q7cp0j8f1PuhzEw214DAQ+Df4h/sEirI0VoNVR/XWdQt54Ph7lbSCaH2W13J7EF0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566085; c=relaxed/simple; bh=7hPMIh/Tae5hTLWDa2hrzWL5Sl2PAO1vnlF7Nswfg3s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dDYfsyM6vgKQth8Wz0Md+GmLgHst4yxILKZ9t1+CA5RmP4XHkPl6mu5qoefLD1aWRyAFZDmWEAZgfEVZ0onmfIlPkchGQ/z07hrVrxEigL9Kv47HwIN3bZkfmWtpZ0HhVioiaSCtI2+8OgehbbNWz58RRlQ9Co7ET5LQgg+goUs= 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=5ESsNEUs; arc=fail smtp.client-ip=40.107.223.44 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="5ESsNEUs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JEmzb2vIogTBkjUrkh7OWANZi+u2O32AWhAQHX1SRAtTJd1kXVJu9niqbudIVt/XbZEv/HExizIsU1KxIQQwMCpjTEWzSPw3hFEaZEe697MEr8B6Dh2r5+fNjKzu+ECBp0JoIE9rBpSbZC7yhYDoVbx+F768SDL87PNpsgpk4Q2XE3H7FWacea3HBnq5ABIBDCKwrErBNj3Atfj9KRuaD8Vfa11aVT+iZYi5fIc74roPDWkrW0xONA94qxw16SMkxULgX9HPvI+rHD+Zu1KSNdkoCkZcQJMsixQLiObefP2d6yrpR/HPTL88bFDsLnVOvCzGggAKvQDZXv1bIUa3mg== 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=dWEEwnWXbvodA5o/rpCsBp4P6REBonT8BhfFs6ONT34=; b=OU2UZlxcaDIbcZbZRpujLmZuu7f1zAgXITn5j0elEXplNxIaNmnzN0nzOGYOKjKCbq//8QgfcMtIGwXGfIJZhLGzn4/tv2U6wtAxsJ3TewpBp6Xe+aQCYPm/r6R+TIHPCDX2RfipkgNUMObUfC8+f7eE0PD5acXs1ChoYiaU43qh4nZrtCpR+yjFm3/ADXpFK9l/swGcRicQJ5ZEWrBmt307U7IQboRvOJNG1nsJ6GzpBE8HkTmxXIo3E82IzgKr588vfrRWw5nSdCCDURfF2PCb7ieR1QTHLDr7oXYT1DZVQsDuoSdw8NxvCv6oM0C25trcqe2DDWiLS8ojiX+GkQ== 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=dWEEwnWXbvodA5o/rpCsBp4P6REBonT8BhfFs6ONT34=; b=5ESsNEUsbB4Q6mR7cdt8T2KMALfoheqCAxi/1/Foj6dU0pinJp+GagLj1SY/TGVgo4oFjHbjpLY50Un3CVh+Yx38PbRIXY4UV5FvZHgLRcQtsZYRHjXnNqUbvEnjl7Zfg/wC0XIzSe3FKWcO+ULeGjYCw4aITcixbm6nWurapgI= Received: from SJ0PR13CA0189.namprd13.prod.outlook.com (2603:10b6:a03:2c3::14) by DM4PR12MB7527.namprd12.prod.outlook.com (2603:10b6:8:111::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Mon, 13 May 2024 02:08:01 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::97) by SJ0PR13CA0189.outlook.office365.com (2603:10b6:a03:2c3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:08: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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:08:00 +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; Sun, 12 May 2024 21:07:57 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 04/10] cpufreq: amd-pstate: add debug message while CPPC is supported and disabled by SBIOS Date: Mon, 13 May 2024 10:07:22 +0800 Message-ID: <94ad4bca2d8e44a5e53082959220a184c0222e1e.1715356532.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: SJ1PEPF00001CDE:EE_|DM4PR12MB7527:EE_ X-MS-Office365-Filtering-Correlation-Id: 883a0e79-0e22-4f90-2a73-08dc72f1843c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|1800799015|376005|36860700004; X-Microsoft-Antispam-Message-Info: 2UhGpE59nSN4jKvsHuvRDbGwFPSYWwQ2e1DIwRGbqmpfZDnixejUN+ISZvC9k4upeIAx5oE5nPTLozoW4ozHSofTubCF5kqbqVSIcKMWvYKvlZgyAVkB2ivJCcJnRBNdLYwwNn2hMCx/LJtTW9qB9bFRzNmBqmLeoskTyTfuMfNKq77hnX34ajsgK84nK59n6p7Zcgt8c4dYJtBy5D3Uy1n0xK3BWZ3cxFwokNAX2hr+FUk/w0BJwZM0Vg3d2TOCqroBkLdD7Z0gmfzEKbuxxBgAKADxwPnPoimqnw+YbbOoQVhXRtVnkKxgsgVEru0rZ3Xo9V0YF3F7w3LxUodKUuqFbrOWFlwmJXJX+s08c2njmwh0WFXczbm8ZtEzap4P9uiXqEjlBc7acJ2lkn8w8/2Krkh4igzmS6kcSUS+5lp++9buDAU79C3lxDJpV0dsyW3VJ8j5fd5MaoVc4YX7rk0WJT3MYSaPddHNOvinly7DdE/sHHbkc6XMRTdJcy3c1hpbBENDRcIiEsajrxfq8OEMX0+bgWUaeayjdk5HaWgZr9r+8l7q8lgAmpkbpACuRK0Avp3RVvtRJaXKpPPYzO0QSvstX1CKLKxhcy6y6nSy5N1K2Wij1By1XJAFqNc0Bh1BwtzjJKx+SW8TmBH3YIamp1OIFtt7xELy82R9ZFP5YSUlosc9udBE4iPCqYWZfucwhEAPx/shg5D+EXFlpvAO0wIKbX3xawFGgeSmfa6lkvKhsxRsCxIfyYfDSbIfRT+gkKR2DB1N/LrppQ6/tjscMG9b2FpHOe0mWqcXtRcUIGfSYYH19WjHq+HjDYGA4y7kB6X1bNgNPyEa6m15+X+aKfb/F/2RffWwIMORn/C4eJp6vJsRwkyxLflcJFGNqQDgS1p3lXufUPV6CgSIT2OKtz9+/mnpwpxRmdwp/zryQcn8ICQBkjedbXrhzmMV9rlCGHnDg1IyF8NWzdAuLVPQrJ05bg+A0Es6iuQe6t9hEkhIoCD4Po0L0HAtzAVkga2ZnCpNTlEgPY4RgoOZfyyai9JTevkqfbcjBz9bNwWGUA1WEMhJ9v4gYHVCvnFuEI6uswEPp+gZx9cYtPv5v41pg6IfULmpvlAgiW+FvrPJHANEJPoMjAxQLV88ur2yAC0JERux8OVwu9TNsP2hh1gVfY068bjrMx1VHZE5VVj6nB/wEU6CBRZcfwn7RX55vB9QKFLENpedoOf6ICcxeiiE/ytTyjQUS7KhbfsQoNE9iWNlzT8GRVQSlJoXS3ropMN+BjRzJBzajOEiEnS+YtIKvEaUJ9kFT0z0WfoBVsWbjOy3m+OGL2vOCoXeJqYZ 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)(376005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 02:08:00.9738 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 883a0e79-0e22-4f90-2a73-08dc72f1843c 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7527 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 --- drivers/cpufreq/amd-pstate.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 3109b46fb02e..8b624c79c287 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1707,12 +1707,37 @@ static int __init amd_pstate_set_driver(int mode_idx) */ static bool amd_cppc_supported(void) { + struct cpuinfo_x86 *c = &cpu_data(0); + 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 flag is disabled in the BIOS for processors that support MSR-based CPPC + * the AMD Pstate driver may not function correctly. + */ + 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) + goto warn; + } else if (cpu_feature_enabled(X86_FEATURE_ZEN3) || cpu_feature_enabled(X86_FEATURE_ZEN4)) { + if ((c->x86_model > 0x00 && c->x86_model < 0x0F) || (c->x86_model > 0x2f && c->x86_model < 0xaf) || + (c->x86_model > 0x1f && c->x86_model < 0x1f)) { + goto warn; + } + } else { + goto warn; + } + } + return true; + +warn: + pr_debug_once("The CPPC feature is supported but currently disabled by the BIOS.\n" + "Please enable it if your BIOS supports the CPPC option.\n"); + return false; } static int __init amd_pstate_init(void) From patchwork Mon May 13 02:07:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662978 X-Patchwork-Delegate: mario.limonciello@amd.com 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 1A568137915; Mon, 13 May 2024 02:08:10 +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=1715566092; cv=fail; b=MVLGkEFTnB1iiYi3z0OyW5DhO/YIi04s7xy6k8CkPJrpQ0vyFAn5aREqnDIyIkVyCaLfJXQmvIj4G/Q4oIOCkzW1VOpeJ3VQbIdS21aY3AzDoST7mq1Lx79kqhG45LLlNLruWTYZ2ncplNrDD8YTraSEYdJKY5Pmb/B7w1eMKkE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566092; c=relaxed/simple; bh=cOXMENuVdaADztOx21wcB1GoqOtFGByhFz28UNsMN+E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T1flgnPDCIku8vgAmikHP89gjbi9kWQGRyNSxBnj/msmK7YP22gvtoldlPTKDEchtQA6BjmAj3M+qAIS4cM0pvqrUrXSxmSqFWENmLe0ul8LhqsxpZzVvjRWIz3SXUK1esbe02yslfw18bB5QR7yEDM/5+eeRTiDUORI/LCZUGg= 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=x825lKCO; 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="x825lKCO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OewzRbC9iNcWXtNTp0FV7oUtKMB9/giuU9cCjLLNfhqylX8WGb7jjzml0EKYLQEFqoAGf+7XQWEjAxNoDkxV9BxyfvN7AmcvRgXP4ualqPtCYB0D24vrzJyaB8XQkqlepDA9NjvUjsaCAimDdOGV/0PL09v28FTGACyfAKx8U0lYyFeXFR2ztoh8JPkLumcZP4AH+DDsXiXltf3f3X5rr1+3ZWefWwXCrXtc40V6jG3czAB3KKb8kB/qEtDE4xDH5voto6oxaYUceZrjSCU5rHjL15CBo3/adlEcdNGtO5k1r/p9vhfZvgAfim7IMqFJrOEegoJPLuXAqb4BHh6ryQ== 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=EOf+kiEqDJ4292Jkplvh6XWxS5iJPzeS85DFnIYQ+ac=; b=RtM8WwCQl6Qc2VkcN0rEpmxJL+6Z9/it/8+fClscaQ7Fb5AHmmqrHU/50JyXrfaSOyfu6wbBCRwX19J00x3LswlQpr0zHyZTip0S+I+Z5GkAcIadGSUpbB6jRAo92/TG98ykRmbpYV8LCYvJvCZcFSd2MJMyep54a7fKJhtxhaMSOx0rvMDyrkWVozz0Wt9qzc/Agr89xdYbI0E7ANj62BLAJO8jBbLOUjhMYhjmaNp+jbc1gElyyNTmgo5TtRuURGjsLTANAgEQCLD2S5u77AzpS7pooxsyMMcCIgxZ7Kr4fSXHaumqzJiqk3OiWqDJzZpMeqPSWg86BvXdB+bZrw== 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=EOf+kiEqDJ4292Jkplvh6XWxS5iJPzeS85DFnIYQ+ac=; b=x825lKCOxy2tVHrhO/m3E4gJhN4CckDfIjwT1ODLAmCQ5TnbBCn4SzflyE359ZQmLAEZG7l83+BLAjYotJmAyCEk2XmWUFW3lDUrLCSn8Mis+OgCBH5ALxnqggOp0AylJxmD4QcrP7DbFa6xG6Z0nPR7OzPXN5jljbd+hWImlD4= Received: from SJ0PR13CA0181.namprd13.prod.outlook.com (2603:10b6:a03:2c3::6) by BY5PR12MB4177.namprd12.prod.outlook.com (2603:10b6:a03:201::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:08:05 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::fe) by SJ0PR13CA0181.outlook.office365.com (2603:10b6:a03:2c3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:08:05 +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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:08:05 +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; Sun, 12 May 2024 21:08:00 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 05/10] Documentation: PM: amd-pstate: add debugging section for driver loading failure Date: Mon, 13 May 2024 10:07:23 +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: SJ1PEPF00001CDE:EE_|BY5PR12MB4177:EE_ X-MS-Office365-Filtering-Correlation-Id: 6840d32f-ac07-461a-0e9c-08dc72f186a8 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: CHw3pZd6G7NMu8gvH5b8HXw3+AcyaUaq4/GC3+uUPv1iEHPDikgEPcWbjuKynkwsa13I9/lhThek8FRUIz2YrOquHEc0bQoYKTr9yRXKizt4AGRTir0UQf8yqtoIicw0dYKVaOJGVGKh3oZJc3P4DhCl43sljdl5cnrjHgNGXk8GcHAiONU7YGNRSGw975bY8SZwTC8NJ/wOFtyXAidi2YvctukBOw/4+C+OhtbRGLgZDqel1YgFdewWVKiWbHZwUwBI38qD2fvi5LOfZN35YQdCCSPq+sbPoYL5juITRcte7xvLwuGaGZ6DmuqScFyEZAN8IqMkReUK/B+J7VJz103goTtWx37jvYyPQBfTinZUpLvVa20ZXVvSIFaxgdlnS1kP0aH8wmGvFk3WTA26FOZS8V6fNRdHABTPRr9bGby6bcRzT15YAThkEjWC63dVhgW0wgzueuQAHGIURAC0weD7A+l87eZGI8CkX+7IrtaZrLZw71az6ROlaHuppfwZzNWPXrVUsqhVQYRwV47dt9j8iWB6dyXTON6kUppwu6fcukaINyvJQal2q175sDJoEHkiP6bGtMGFFmpOEi1ABymDCDJo01zlNnMD02+o4TM5F+uT+x7OFtjdi1IalHMSqfeDAtmWZKqjxtF2jAB+tHBHpUmqWu+EMMUI5IBuAPt2nQUX8a5MFltJXoVI+OHIZGb6FwsdZMgBMYawouTjv7XvbLObZ83mRvWGXBT1J43H+gPVkruXztsWXspK7ooCLoUFYGpxFoPnOAgY+ct/nJVT0n2mUi+TQI4Au3gDUtOAleESaa8BmL9pHt9Jlv8ejzoRtA6Bx30TD6Hvl6y5cI7mdEIFtwUj+vTBSlmUbxp5g+Gs77ffM3RzUEkZ2I48mB9zdXjn4ifYKfIrLQxE4hhjktn2mB7B8nbH4K7hPhsDtlPmYvRrLfznzMUdYcakEXTmPFESE3cZA2kZWF6qDqwDsUA1S0IDDCWITa6rNNYuTfzlS5mMaySEPG04VWxijrEI569DDG3U2h/LkXCnYOFUTuOx+bXPowoLX0yDJseWFreGLttUv90qZ0lkocbPbhkCdGDJ5eIfdiGoASZXYjfHrexv39bAxLUymV2QCDeZ8XxAwcM/knrhIRo4Ku/TrRSS/PwLqFZZPGcxZ3oWH8SRuxVa3BJA/Ps5aDJkpcTB0UB7KuKomLwwBfSkDyzD7YqN37Og6gxX+pqcGfML1U4qy5H0w+i1RNG9ZvgiZ8wt1XHMpehxAnNJeoBmGqj0LW1vT/wLEeNtgzRGU42J58D2jA+LshDq8dl8Uk63jrrd6yglCgEiapEkWaFEVDEM99dlO5DEgPtSbaDt5kSalKlTLu6jQJ62KJ+jaORecKqZZ1XekkT8dNTCQ0oFONEo 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: 13 May 2024 02:08:05.0519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6840d32f-ac07-461a-0e9c-08dc72f186a8 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4177 To address issues with the loading of the amd-pstate driver on certain platforms, It needs to enable dynamic debugging to capture debug messages during the driver loading process. By adding "amd_pstate.dyndbg=+p cppc_acpi.dyndbg=+p loglevel=4 debug amd_pstate=active" to the kernel command line, driver debug logging is enabled. Signed-off-by: Perry Yuan --- Documentation/admin-guide/pm/amd-pstate.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 1e0d101b020a..de83e742738e 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -472,6 +472,19 @@ operations for the new ``amd-pstate`` module with this tool. :: Diagnostics and Tuning ======================= +Debugging AMD P-State Driver Loading Issues +------------------------------------------ + +On some platforms, there may be issues with the loading of the amd-pstate driver. +To capture debug messages for issue analysis, users can add below parameter, +"amd_pstate.dyndbg=+p cppc_acpi.dyndbg=+p debug" +to the kernel command line. This will enable dynamic debugging and allow better +analysis and troubleshooting of the driver loading process. + +Please note that adding this parameter will only enable debug logging during the +driver loading phase and may affect system behavior. Use this option with caution +and only for debugging purposes. + Trace Events -------------- From patchwork Mon May 13 02:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662977 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) (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 62DCD137925; Mon, 13 May 2024 02:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566091; cv=fail; b=a+JScYWhNS8pr1r5gog4M+diVIW2LSbA1bvk8grHZ6u3iPXZ80AluHOFUjg98shZFOLki4B5fznFOvXqu1XsGjX+zJkKFn/HHuwtUyKb9nvqOY8H9NyNwzwtWcNfhcDe1LGXWVG7KMiFbDl3E1XhZDN1XIcC3yCID+qZ9io5yio= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566091; c=relaxed/simple; bh=Iu2aHbPVK8RZOypYFtPNDVV0ZJvURXShuUm3UYraMjw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sfo4s5cPNSG/CMm/UikeH80bp1iAhV/kFL7v6eRF3DoTpsXC8VDwXuj3a+ws2ysCzI0GTT2r0lDxdD1KuqW6ezF1f8n0neJVAGWDzdzzFavAkMiOQXM1B99HdbUj0Qa+cH17XmeQM5JR/Q5OD8KIAaZE4AB5wYWD+CQg2ni1mtg= 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=TKF9sss4; arc=fail smtp.client-ip=40.107.243.74 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="TKF9sss4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OHl2ozrHspe1VQRXOKGjESMKEyZf93XZ8aJlZ8Qe64KMroVnTMFHL8q87ZaUopHeBCDwGsFQlD8u5T6ESI8jJS16SFxcr24Kt795jmHmQc5qLs9/8Bhd/na78a1O9wNTBmwg20fP8A3lEFCBy4JRrCwkvcflNrp3wxly7U8h0S396jeTbtgQ2+E754KvquP3gTdmL2fAVD6J3qBVKta72M4FcjgrkKdSdB4bl1w7G93fNrxtXhZ+x5Eh2/Bmd1WAI1QBLuFyDOgH31PLiYto0IH9rUwEDl/sTCkGOlsdHLV1Bv923D/ejBFOHo9Uqs1P1Dv+YEA5zJxUf8dHtLPTVQ== 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=9vrcY8j2MM3yB5PQpMNIyq8UzZcb4H4sVlIytplIX4Q=; b=mat41avM8tBVy1PWBZZ+bK8Dm6MxcfQ1qcRb31dQO9ZQ/1yIw+IabwbAe3RLudlOt9sDN8pn8aMICxd/dcKEc1sYSv0sk7NaqP+o7/Rek8zn/8WPgCv34E0HnZv5dVMOLzDuBn31vG3JBM4ZUHZY1VaggQU3Oknw0vZiVEMQrZRnVAZ572PHGH/Fog/DF0m17du8ipNq0UmuPM4h68Gv5uWFbKuNTRZxd2BF8PYzc2/VhwEAfqFUzpQ+9mPFZ2BLlILvCyXTQqRXm01kAaWIbDPayoXDFlqfMBghraTkvjt5wSNmfD9dyn7YIkHbdeCpWxv7YI/2+eXSBAklXqazPQ== 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=9vrcY8j2MM3yB5PQpMNIyq8UzZcb4H4sVlIytplIX4Q=; b=TKF9sss4lFmDfKif3KCUYfSHsllZH3a0h0xTjEtr3LZs4TmOKAI2nKhhO8AsSkgTkzgQdi6l4pj0JNTiTR9Hklfif+hsd1hR+FYZzS2sZ8VoHkWVQk/DSR167PCvL7HhpROsNLHWgtG53PUTkmLCkD0GQ8Qz5aL/3kThDd1NLZE= Received: from SJ0PR13CA0189.namprd13.prod.outlook.com (2603:10b6:a03:2c3::14) by PH7PR12MB6000.namprd12.prod.outlook.com (2603:10b6:510:1dc::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:08:08 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::bb) by SJ0PR13CA0189.outlook.office365.com (2603:10b6:a03:2c3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:08:07 +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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:08:07 +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; Sun, 12 May 2024 21:08:04 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 06/10] Documentation: PM: amd-pstate: add guided mode to the Operation mode Date: Mon, 13 May 2024 10:07:24 +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: SJ1PEPF00001CDE:EE_|PH7PR12MB6000:EE_ X-MS-Office365-Filtering-Correlation-Id: 7794f2d8-fee2-43c2-0ef0-08dc72f1884e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|36860700004|376005|82310400017; X-Microsoft-Antispam-Message-Info: L/xtjcQ8aKoTV7QYPK/BkOCOA1CJHcrPOjfkxzJDRNdZX8M/GJjPZ+L34oBLLLQ2d4C9gGyIZatXJC+F2bjvPLE3VshcHdxWT4ipUJEdg4vN6S4/JrmZkYpMDY2DwaTpB4n6MnJ+j7ixWQUig4A4cBcpW2deGnHk1qHvCUWJTboM6V3kzvoBxsKIEUninVhxHJC55EsuiDZtCewdnEeD9ViNxCbQhaseHouQSXmpxaZFHU+9X87a0Smwvn2yJtDXhVMd2+p7AVKLRX3rIhXdD0uYb4o0nGeY7E3QhW2je47GvOPNjksuVzBWFt7huhLMDpkiidWyJeSepVegFvRMDCth0I7YZcgZvZIO/JDUik9WmA1ZfV9WRlJ9AX8zsdJj4z1b3Q/f9XLeM7isk2WTpuNatje51LtdwoX/5JhnD2U3ttQDteFaRJWUk5RkVe1HJTCrom/4B9/1JJY11AZP6im5NH1HSNE50DkF2FG8g8BqbCWck7wM+RcfFCX8vm+2QyVDzBOPYuhn7WgaghqXJHB7mLeeLTLdQjGZ0OhSeYdRRZWun1cZENNvO/8rvpoXB4M3NJjZEvsvxdbtjYo/r6eUoPZzZ59F4eXWhJjRb1Lepj1TiFMJLaljdqtLT41IhcOfpMXWdJQTTwO1YxogyMuqRSXFugnklPL0KfRb7aPeh7Y/KGiIoH3e33AXo35EG3vgBkvXO0iypAiLUy+C7JSI0JeiVbzHuVEHHU0UeRAnlBXS1gJ+9prglMCAnDlhhEDH96tGHKa2H+vkZXxsS9bu/2V+WoEhlU0/G+Ax+plAMryOtxPqvbkDDaXxkot1afKiYzX7nCfxr2tp1Fb/f161wMM3X/7BhUe8HvOxhATiIJ8NvqKk1zgmXnm8t89oorPk+c+kaD7YjCSJ7w+k1cp8u5jp+E38lc46nAAa7+WaR4b8kzFP0ZcFtK3OS64ZyIEHQo/mfcokcd7NAf0cvwZ+JqH1AzDqua34OXhKy2usjPz2lDOQNdFaBq1qjih10Rc8qpHLPgvyEaXpEpFGeohBlQpis5265CmkacQA3KCksXYopBvSMaBbv/ON3QOeuHd55k9uEdQe9MyjjuIgVVOVf7Ei8Nn5qN+Sa4UZatwGxK5Ar+mj0rafCOp1zmK4vqhe9xjYmVqVS6+4Pph70tv7ufdT3hOVsnIPkw8PXI2TLOx/rYSFlG4GucP6v1VgEpdxa2l/o7cBWqm6O2THeILt3DJ8YDe3BocxI6AlpPlwxt4Xzos/LgStBUjo4oYC4KJaXvd1DAeHc/K4wja1ydWCzld7ISfHDWPKiiwHGlS80DF/g67kl1CgOyGa1HIyURy9+arOzW9r2Izh/HQ+W/pdoVw+XSWnlWJSIsQFjBgy65kGFGUSij8iP3RowwYR 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)(36860700004)(376005)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 02:08:07.8019 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7794f2d8-fee2-43c2-0ef0-08dc72f1884e 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6000 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 --- 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 de83e742738e..7eb35ad21c7d 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 Mon May 13 02:07:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662979 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2041.outbound.protection.outlook.com [40.107.243.41]) (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 4246F137C33; Mon, 13 May 2024 02:08:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566096; cv=fail; b=SSI3Ps/TxPTf37G5X5VQiVHZ3HTVTALkFzP4/+TRF+zIZ6nlfLz/riNJSOTVvrFiQbVRU/I67cOBnDZausHtBCIGZx2H79ZjQeYqJTt1jpGUc+qfvYAgZhywUN5P8ZO3/mu9pFiAODYSkAbPy9uph0o7E8LFqL8nlWEr2RzOvXI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566096; c=relaxed/simple; bh=zVh9a/0yKDp3sGnKY2JnJ8CsuSdXubja1/OSCt1QwDM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tXA3HqZAkCCgxE817Cwqj15/e/vXyaCdd2Q6KF5ig+V+KH5buXzXgxPvZ6/61iW3SV67FylhdxMYDa9jweAmczK1fxuweRlzI/JRS9FOtlZUJCp4s09W+sljaIbQHx7HmwnyYCDSshvslhpD9pDYKPdB4+F6iaXCw6u5vm5SAIM= 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=eYhP3cLs; arc=fail smtp.client-ip=40.107.243.41 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="eYhP3cLs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OWVzZJmPMD1q84OTDopnslBBZe1V7Jbj6XYyo/ny2CZEOABnREuDgesdDyhvTkGOpwbnkBOQdGYxFvvLIPEi5ny0HLWxfSZDy54kazIbCnu1ZWEr+jPSf6vlFT+F5c/riqClefiy0V1VuIXcTM4gCIO+rLm1KgHo5keJWkiqKOCJ3lGz2t7QL5Xp850v5TT++v/stx/JAGKs2onGsN5f6Fd45f0aeRO5BAg1j4dJSD53za6vmr7lZ1lRX0rWPgfU09wBDmdZLS/td2EFbKoGoXZwrl4Q9J29jfsY8vOfpp4EebwWU4a3LKrK5wgcSgShfIA5NpIiKX9QSigQP1hW9A== 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=VEpUnXwibqomQ1d/+0c25thkHNS2HxsgdosAK/uUFuU=; b=bKwDY4yvU+CsQ/2I1tRi+taYevVHsu0AH0yHCwraMZC7pgY/DckL5AlM3fmZk5sG0pw+vd7dsAxDeNfbCIwpm5Bp7kccyXP5kcUMMH82PrUVGjbT/hvF4UgdHT1y6MSvHIGJ8CeHfl8NMbEUvYWKWjN3gcBTQtCbP4CNtVnfu9mnmwu65Djxn+8wnn1zclPr+txybBac4m7V03avFpSLd1sGEVI0hgWRTQaqKpiY4MrgaLYqk4Y9fQzN0NYQOO8HGhIRCMYAOH6n2yiRx0IaKFVUtceZl8k8cjdsqtWvTH3oLG209adoeHAbkHhtW4D51RkiN6ysyzkHaOa3NNZgQg== 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=VEpUnXwibqomQ1d/+0c25thkHNS2HxsgdosAK/uUFuU=; b=eYhP3cLscuCaAZuEaOqRhTj8lEfFWA8zMq481oq2rmtJYIW5bniFIHNacZi4mhuCEKyh+ep4tTY4JVVcf6KCN5n6RiEcna1/zVLUL/MOfvKQtINoMdWlirNEkwafyGyXVU7AmvucCTSrhmlcz9ik8+5T1HBY/IkUwbUw129cG90= Received: from SJ0PR13CA0196.namprd13.prod.outlook.com (2603:10b6:a03:2c3::21) by CY5PR12MB6370.namprd12.prod.outlook.com (2603:10b6:930:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:08:10 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::1d) by SJ0PR13CA0196.outlook.office365.com (2603:10b6:a03:2c3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:08:10 +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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:08:10 +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; Sun, 12 May 2024 21:08:07 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 07/10] cpufreq: amd-pstate: switch boot_cpu_has() to cpu_feature_enabled() Date: Mon, 13 May 2024 10:07:25 +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: SJ1PEPF00001CDE:EE_|CY5PR12MB6370:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a4acefd-d9cb-4566-0f5a-08dc72f189f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|1800799015|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: OjKPWFNqTcvYBqgFXuDVmfbGJ42CfulVgW1qhWOlVWLC5Qv97Ojtp62RuKEwE2tMiOt8GSG9an6ClxZp45MvEvet7S+u1SmRfgwtqxnhr7AHYZuqz/ZvyeyjtUFm295dNLJvCn+dKkzXz8nxEenLq0rmzUIz9sM2ud/Wt9GultN7EFbz9zeKo4k9TIHcC420kv2v7xc1n1y8uHxvUTOYpZD9UFC4zAXuHiX5krLRF94Kc2W4X8Ph0CE4kL5l/cDMyMdPWbdkf+35iSSot1WB2wSfXZj+n64goZFt+gSGqXb6A64ssEBrX3WF72PO7lg+w3KvF3sL0/vfunKXWIsM9NNoV2s/k58FQGMoNGyF049+8307H407z/ipPBQd+tsiS3dsI+EBt7sDRP407JqTzlNNjic2iMvngGqoCLaZJAFe3yTsKZhpci6J+nkH1bsD3O7gWzXsJgOV3Z5r1mm/r+Kl+XRPOUrBlF1XQds/6zPlpDYTi2M6Hf8A/X1nJnsY1oTZYZVIWPpYiaESMS29w83jisPGlXw+pgZqDHtn2pehZcVH/iuEcfCBrJt0iuyUqcejyUKiJR5kI0WTH/Q6lG/TB4b4T3t9TnnUN6qShCBiKbXh3p5260S6BtrRZlQRxeWPg22qTRWLu6csQO3GABx98brlfBxASMj8J9SosyVOk6GwcQgp1U2eFCiB02Rs7Pf8muD5dd3HLKz+Mcao8XI0MXubVK+cNO7HjcaOjz7L0DYMuu4ienSf0R5/dt5HVtUi1UgB6yrP1YuLwEvKCynb2AYjiKngxODtqzLpS2nIMjWjO12b7gLY5Wj0vKk0UBn7pBLXxM9/t/UYhb9ehe/cVm/Hcv/vlsI+zA9Uiac5raBC6Z48udqGJtzMNTysQs3bhwo26fKXfiv3Lmsv9xuxuKOA9qFtHXq0T+j+hc/BWKOhIuFND2afgTv5rbUNh4Wm/TJeAm5FNG+7eTIZzLSNl+8Bg4KlRZ45T6dmDAimcjDNEb9bt+JpLqkU/zDjmS/DXYihuklpHrn3C/PUgUBJxqT/mXxq159bg9y2jBI2BCZxlicErbmcA7v0nvRxFBvYX2jgfVNweMNB/NQJD1oJDCxwDT/m9bqNJODkL9FrSN/byHlsfjOm4jEFpWVRreltmFj+QN99Ql0XiJ0qPtS2VFz1pmkb4h7QBQSm6WBVHz+UjFjwzewjo+FDvXeO4eefUeiuz8AAAlj3+wB0iUkzc9po1/8jSXSK3W4MoCQ/FFTgEtidRU+6n4KcD6kLyLYLz74OzJ97MwM4YNclJolKZviJVMgo23wuGUKzxDl6t03Aq7BMJ8c3N/K491nyYZCIVdrwyKG6ei/pSMsLgO/z8cs/AKH8LVTXxcEIfR6kuIT8K5st6kjOdoel0yAR X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(376005)(1800799015)(36860700004)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 02:08:10.5832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a4acefd-d9cb-4566-0f5a-08dc72f189f4 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6370 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 --- 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 8b624c79c287..8b8cae1b678d 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -125,7 +125,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; @@ -167,7 +167,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); @@ -220,7 +220,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); @@ -721,7 +721,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); @@ -956,7 +956,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], @@ -1189,7 +1189,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) { @@ -1418,7 +1418,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; @@ -1501,7 +1501,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; } @@ -1540,7 +1540,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; @@ -1574,7 +1574,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 */ @@ -1776,7 +1776,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; } @@ -1795,7 +1795,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 Mon May 13 02:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662980 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2063.outbound.protection.outlook.com [40.107.237.63]) (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 3C02A1384AB; Mon, 13 May 2024 02:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566100; cv=fail; b=X3ZiZDCi/bJVRQSA5DIUraxKDMOKtJWgf3xRi3/xB6YMTgd5vEH9zaDGObUWikG3tiuVL8EYl4S/zx+vUWd4wkkTfb7hhh7UOAZWhdqrL5pWrR5NdWD8w1rPw8fu0blWJ29+KuSB30ujEohqKbOBPrmCWmPVLbRbdGkXO4VNF0I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566100; c=relaxed/simple; bh=nJ9cx9bDKy29WZBCgELY0XT2ZBaN0k8Q7mQhwVLq4g4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q7yYnzdJisYrUzTVbqRK24/9q0QTNIou2XcYc15ZO0fDL2zlYVxxurkLQym3C/fTGRHWgtqL+GeL/YuXXWiR4nwA4rMMNaJ80r6WBIQb04jw/PseqbTrCANGFV/prd6ekBtOAheNt+bzQ3v8U0MarJa8W7EixagwGQ5ouDQgLHM= 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=EmhYgqzL; arc=fail smtp.client-ip=40.107.237.63 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="EmhYgqzL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LoM87e2nIOW2zcO09ySpm7msEKxCox7F2KKEy8dp8zEvrB18dUd7BQJy2fcotryzgNL8WufJAMu66eJy5tag+bC0wkuMle4msMl2hj4nOpxhvtj0wn9TMZ1quSa1zKfoYO0z3KbmPtc1K6mYrTw1KLR+e4dgKX5EMUkdvyFpuNANYV+A2zfNWb1hFj2rlNbm7ryw9lnTCWjXcaRWj7Rm/ztN/1gSIhtmL1qfms8BDrhzqpimO7HJPTnjZt8gDZitp3uCcWC6prSzXS8G60V/s0meJe0H2wJ7Y3/IcK9AXwA2ZJsf8Wc802KYeW8tM5LlI+FCBqXnnuG3o46515wSjg== 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=x6067HVF+J0DG+ofMoXQG4B7S9A1I2NXiUJHfzJ1YYQ=; b=aIwaxNZtEc4aaesfOx154CKqE83F97cv9V/5GPgYuRs7//Sgt+kRMcGeESIkHh2dpr5HX1P8/cz6A/qrdsz/GL6wfkquBOIwvIryyD3FBsLaDD+aVuLqgI6hFXGxTehXdgfz6Q6RpFJMuNxJ2U8/6ENz3gUQyrWSFLcCve2kLkKK+Ysj2KFNKcfYmQrFrnErVZFq1zHKJYzRbfLBVPXaXuREUPJ1MOS0tVWT0thG14P5Vs2O5TJsvBCosgB7ZNboEm7oHcuzIIaUto93xkSKVAMu2SisYtpU++RRMFnSc8xnj5QgMa7pyq6i2z8mPHdhX5MDNNxzAWViYhepdD/law== 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=x6067HVF+J0DG+ofMoXQG4B7S9A1I2NXiUJHfzJ1YYQ=; b=EmhYgqzLJj9sjT1K/DAFNwaJAPEc1GIk3UBAiJzZcz2GvKVGi5jIoO1tagbTygITAq023MdEESJk0Zow4RYttfpnvVhN3XmKIldCnozhuTpA3AhmH3FEA3NT7HULHm1TrqiP3Ku+9XWKD0cYBJzoEusZDHXZp4bzpYGEzDhkvN8= Received: from SJ0PR13CA0190.namprd13.prod.outlook.com (2603:10b6:a03:2c3::15) by LV8PR12MB9153.namprd12.prod.outlook.com (2603:10b6:408:185::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:08:14 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::90) by SJ0PR13CA0190.outlook.office365.com (2603:10b6:a03:2c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:08:13 +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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:08:13 +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; Sun, 12 May 2024 21:08:10 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 08/10] x86/cpufeatures: Add feature bits for AMD heterogeneous processor Date: Mon, 13 May 2024 10:07:26 +0800 Message-ID: <519db1e963f35ca0ad9634b0567d31c332c46c0a.1715356532.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: SJ1PEPF00001CDE:EE_|LV8PR12MB9153:EE_ X-MS-Office365-Filtering-Correlation-Id: aff564cd-b4fd-4684-fa41-08dc72f18bc4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|82310400017|36860700004|376005; X-Microsoft-Antispam-Message-Info: QuKY6oI9+YDoc6/oCnw50d9pxiUJDK32KLsMRawCOarLpOCLHk6rJiOg/w23/m4zeu3x7H0hiwMNNUbqGQ0CYAOTTDe2iJP3PnwovcwtMR84YDN8VhZ7csGi1B+PL4Vcz4lyOLY50961ClcwSmqjUqWdzGIRKOfC3uYScgu/0sJ8pXITVRw6JzmD0SXV46vKtBRVGvDQOrKR0hAfaZvO0RKWeq+CJyEjeFHWdu2h6Qo79o157cK18KOEo9vRcC+2UKCFIVAg5FzgEEcnc1Gkdnp9nPNvovd8T4dijQydwV50TNji/hlmUh/7tklgRRpxH5fPuMSBMcTHX8i/3edrsYxSZgncdQMGmTxgyxZxIvYfcoldPgMfDBu5h+qXMpLqrgPJDJ5VdQQGbWodJbTcUWaiKnM8Xht7C2bbHIWVdZlW9g2miCAyD2SRloB25GSAubnKLFzFhwgUa/MZJg69PSKjjVLVGgiDWI003dAA+ET2PVxRBZUlqdUdEqQRA+6RcexDczbaR9GjGyfqN2iBd7H2jEHooKduVgdkqLRTcOae2/TOfFRz3HzJdgiGyCxEum0T/9YcZwpTItodDMW9/aQMwm2QZGxpvWbqScegtLYqvtOgVJpNOCcvQU4bU1d38oMJWRLEV1IzoHP/0d5Xlns+qFglFGpwOqXAvyWuWOCldyuT6317c1yM7tTnR7/1gHTwE8OdHSRPrBSVPxRZoJuKI1bSrUZftP1AKQZzTkTd0T1cSODcF2nK6kudmtuVRdtNFKlFE12vSkpUyzTXowXSxcXWlWCxo5LcTsrZ7n5r8/kzDmLPzj8UO3C+HH7UmY29evOIzaXw4rohqSGf/QXXVXXmlAsrZLgQ7v7OYcnkFsvM8vfctDOw8aPws2kyG+ilHwqf4P9817W6e/4va7maZtGqcEE8E/WAGrqXaaVwdtkrYznoaRuMz37t8cqbF1Oz+7XxGkOHuQEVlVwZ1v+Q//x+Z4MdqJAcmbfqrqdhDs+OLif2iTc0OHoLzL0IohzBplVibjFmUYxUQylpTDeqGczHurWfYobiI9anP9tUIQ//ptllHMdptZwBHN6VRExuvc2sMBQWF0JX+Mt+GxJzaaE5Xi4BfLysz7ZOMUfP075BlD4okjEIvarjDooz7mLPJyXc7V4Azyx6hlPvnM1TrL6VVbyqPscSwKTzJS+FnCjv0mTdmALDE50Vu7Fj6tl5GhrJKYx3GSKrJteeZf0vJPMeh+PTOUu46nSTx56Raly/ARWZ+j/57EuH2V7yiTDakGAeqts+EMr6yB123KkN7Rc0fTeJ/5SjmZLpGSQ9r4KNUnUAJ7QwX4o6gbv1 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)(82310400017)(36860700004)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 02:08:13.6144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aff564cd-b4fd-4684-fa41-08dc72f18bc4 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9153 CPUID leaf 0x80000026 advertises core types with different efficiency rankings Bit 30 indicates the heterogeneous core topology feature, if the bit set, it means not all instances at the current hierarchical level have the same core topology. For better utilization of feature words and help to identify core type, X86_FEATURE_HETERO_CORE_TOPOLOGY is added as a few scattered feature bits. Link: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf PDF p274 Signed-off-by: Perry Yuan --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 3c7434329661..39a92338c015 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -470,6 +470,7 @@ #define X86_FEATURE_BHI_CTRL (21*32+ 2) /* "" BHI_DIS_S HW control available */ #define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* "" BHI_DIS_S HW control enabled */ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* "" Clear branch history at vmexit using SW loop */ +#define X86_FEATURE_HETERO_CORE_TOPOLOGY (21*32+ 5) /* "" Heterogeneous Core Topology */ /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index af5aa2c754c2..9e237a3daf7e 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -51,6 +51,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_PMC_FREEZE, CPUID_EAX, 2, 0x80000022, 0 }, + { X86_FEATURE_HETERO_CORE_TOPOLOGY, CPUID_EAX, 30, 0x80000026, 0 }, { 0, 0, 0, 0, 0 } }; From patchwork Mon May 13 02:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662981 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2048.outbound.protection.outlook.com [40.107.100.48]) (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 896D91384B0; Mon, 13 May 2024 02:08:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566101; cv=fail; b=Mk3m5wohiTlKenX4puzeaY1t0ealEoiT90p6IJ4tzXyITNcKd/xcHEmF5GPVYTuxS3Nr6H4ct9gY4PU6Ul3aE9eqGuyDfvgGkkw9SzBPwzxx+Zvzzb/ZFBNP3nPedlKult0kX/q8RXbT2xkq/oFsTfbq4bWLPAKm7B9buM13ToI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566101; c=relaxed/simple; bh=Ro6TgRrZxMDVyKANqLunzjqR2DtiWvmP1ySZn+wS2XU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OjTmihebYosn/vrlbn8zu+X181XfV7jTR81n+uUOomK+OPKb2+9KTHQeZfTRUAgXNcpEne/4l8A093tFHTdH2/FjjfHXCVNjCY4dGw6999vfWSG8e0/BF1YtB8yDLv0ofCBX/eV9XJwySitpcE17HtoYp04LGY7P8Vyhivr3euk= 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=hsEtK2Qk; arc=fail smtp.client-ip=40.107.100.48 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="hsEtK2Qk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OxK0ZWvu1dd5s8iYwDSIOe8qL3V4n7oQwaWr3Z8BtPWmzOpg714txHdqLkhzZijz1jUs3QpgvVns81LPJcVq0+PRvgSUVhQTFxiB2igGUxHlwapMoBOAjUcDTTA7UZh+yMmKAJtzRrdJ590pcgzfk0WdO8BCdP0Hm8jxPEi3HQ95LcwL08E1jDed/LIDTpme7Ss1Uv6utqAnUB4yPMCSL+E8l30Q/qIhANdvCD/sZwH/WvduNycytpqO1Ym9YSVVNX1Wo7cOh/S5W+A6fYbeHqueic5/H2btZDizc1TK2DJoInav+6Wu5AD9akzR5oXNVd+T0BCrLbnwTKrbfhFOGQ== 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=nGedl+dp/OW8SNhqwmcBSMmVSzYm+lFeij1pJrs+49w=; b=aIQJApmGKttWLq6TA51u2X4yB4ULyE4PWEbX/p+AjTZWnbPr1mCkb0oXJBEZSPdsGTvwyDk+Yy0O29eZqY45/IscbUFab4olB3D5PvqwomTTaUiQcVqoChf5NkiHL0D2AN9+5sCdUzVOVQPb5vWP0eBwDgaeLsnjaM0qbJBeSqO+QwzvuBcE7zZcilfbJpJVhw5HavWTkgSYdkEbE5lv8p9UEVgUVo8YdKy/A/U/NhJnRTWI+K9nnBosfV/AKfQOy1Lwj7y5hOeRXpUIFIHdI9d0ZfpCIr+UFDlGUS8oOSb0VoCrdjk4+ph6UZZvYP//1+lfDD6fkkCcKecFoyIluA== 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=nGedl+dp/OW8SNhqwmcBSMmVSzYm+lFeij1pJrs+49w=; b=hsEtK2QkYEp1/xZAEi+L7f6xJ24SOWf1KH0aQG9aOUmfFv+Bbr6sKUV+SKTCwyumDY1R1hX6L28ptglV7FFyK3pdUjUfy2Tf2Z9Ph0FrS1ogxfyj0NWo2sfTd0rVgyKttsnRTCpM50mHtIFyiQ7Aze9zul/2jVO22XMuZmPFnTk= Received: from SJ0PR13CA0185.namprd13.prod.outlook.com (2603:10b6:a03:2c3::10) by CY5PR12MB6323.namprd12.prod.outlook.com (2603:10b6:930:20::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:08:16 +0000 Received: from SJ1PEPF00001CDE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::db) by SJ0PR13CA0185.outlook.office365.com (2603:10b6:a03:2c3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:08:16 +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 SJ1PEPF00001CDE.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:08:16 +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; Sun, 12 May 2024 21:08:13 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 09/10] cpufreq: amd-pstate: implement heterogeneous core topology for highest performance initialization Date: Mon, 13 May 2024 10:07:27 +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: SJ1PEPF00001CDE:EE_|CY5PR12MB6323:EE_ X-MS-Office365-Filtering-Correlation-Id: 71010524-b9ee-4708-d3eb-08dc72f18d63 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: nnyQURWR3WilfRQtbSfwpvlrpZCYofO1F/VCvYy/8c95VVYDCD2DlS/74Y5N0At5RzCl/nHUJeQTaY94pVLdvnTAojC6Mh3K2Ve/2985q9s5VZ8fzRP2bxR5lIQjQm24rQxEIhIqPNiWjz9M5+vC+eYGz4fbnM8vWyM7jDsoBQsQQxJ/7575/cQx9HyPxLnFIyrjCwcGeZRyXgzzJxCDjw5NN+QwrG1c30YDTzUyxwIJy5PE4Qun8d6oICURfMYSyZgELydi3hg+csRMz4WyRE7j3W9QUuZGkLB0ZaNYJpXd+oS8qssrvY3YyNcANultJuwMLwIuwqdVU2k7yKx6LYdkvrYVRLvMAdFTFh8/PpomVqF5eM4C6jRTqglHhVKP8prLJfgLqQwvSegYcQz01ig5dDwSAiAYJcMYNOgxUYnLyWCxkzip+bNx+CEMoF+UtLt9prZodHPtxuR8n64iUE2JDxjD2y4ZMbwKRvh4IbjzqKm6IbBHYPGgUaTlcNjufEwFuHvknDfGD0zZgd1Pxtn4OVmdABy5BxgyHSxrSZmu/u2cBNIFmW+Sy8XEYayBmnUOdlk/OFZSrz/A2o6/ersOUe6cFpcJ9EAmG91iykZx+mJYOiR8+oKMUS3IcEvo4GhaHUEFohpthfZg871X3GV8rARebzNyfi7CTZd0ZcyLf31YZCp7yF3WTkR8Tchjiplten7h05xNfEKCEizisXCNMn4yR6eIIOYlTKcL4yQaNrtL+g4NsJvfeCHimEjfKxy7R7eFu+syOw6x42PVRQ5o+MjubzmBxVtfLzAtxqyCl4mtAbIBGLA6wSVQopGn9W5kLk0fiNmkymtocci4hIfOQbJnQxgGrfrYeDCO6Bv+5PpLKPgkWd5nP5dyqLAHqeC3a8eMOV4TKtAYMCJV2zu7QrMj8giL5epBG6YdZhZJT8x3qm1+jp8itURiidoANMdpunu0u3k6ColCjZAbLtm0a0qLIjpAVj9e4JnWShkuQ7I239aDIBlnZt8fM69FYamQy1PdyMKRTBjmEBQnrtJu9AaLaPOf8a5NECEalxKqegced817Ep4VaswKm9dswT/Oj3z5HG1i8+ds/ixlrtQFRD0Qirv0RFsxk4VZMkE1MdP613HrBQqRWp0Hy3puVR5hENqpTt9Fl47JA6HvBh88dSG6XQK0FDQTiDh1mG8pRFE3gj+4+QzKn9JlydeQaaoUS6m4mLc9wwP4nIAW1Dk4sTeT9+EYkHmYxpyvQNMXhjly3lQ7Op0S6BbdnJ6V063Q5+JsTQXrJ++r25Eax6vEVbY45BP7rlJKfw7E9LIYlyKGDMEtvYdIFZEusD4hn6XcRtu/9OTLmcJbXdVIJQ== 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: 13 May 2024 02:08:16.3332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71010524-b9ee-4708-d3eb-08dc72f18d63 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: SJ1PEPF00001CDE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6323 Introduces an optimization to the AMD-Pstate driver by implementing a heterogeneous core topology for the initialization of the highest performance value while driver loading. There are two type cores designed including performance core and Efficiency Core. Each core type has different highest performance and frequency values configured by the platform. The `amd_pstate` driver needs to identify the type of core to correctly set an appropriate highest perf value. X86_FEATURE_HETERO_CORE_TOPOLOGY is used to identify whether the processor support heterogeneous core type by reading CPUID leaf Fn_0x80000026_EAX and bit 30. if the bit is set as one, then amd_pstate driver will check EBX 30:28 bits to get the core type. Link: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf PDF p274 Signed-off-by: Perry Yuan --- arch/x86/include/asm/processor.h | 2 + arch/x86/kernel/cpu/amd.c | 19 +++++++++ drivers/cpufreq/amd-pstate.c | 66 ++++++++++++++++++++------------ include/linux/amd-pstate.h | 8 ++++ 4 files changed, 71 insertions(+), 24 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 78e51b0d6433..04d30dd35d0a 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -682,10 +682,12 @@ static inline u32 per_cpu_l2c_id(unsigned int cpu) extern u32 amd_get_highest_perf(void); extern void amd_clear_divider(void); extern void amd_check_microcode(void); +extern int amd_get_this_core_type(void); #else static inline u32 amd_get_highest_perf(void) { return 0; } static inline void amd_clear_divider(void) { } static inline void amd_check_microcode(void) { } +static inline int amd_get_this_core_type(void) { return -1; } #endif extern unsigned long arch_align_stack(unsigned long sp); diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 307302af0aee..67966bdcde65 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -1219,3 +1219,22 @@ void noinstr amd_clear_divider(void) :: "a" (0), "d" (0), "r" (1)); } EXPORT_SYMBOL_GPL(amd_clear_divider); + +#define X86_CPU_TYPE_ID_SHIFT 28 + +/** + * amd_get_this_core_type - Get the type of this heterogeneous CPU + * + * Returns the CPU type [31:28] (i.e., performance or efficient) of + * a CPU in the processor. + * If the processor has no core type support, returns -1. + */ + +int amd_get_this_core_type(void) +{ + if (!cpu_feature_enabled(X86_FEATURE_HETERO_CORE_TOPOLOGY)) + return -1; + + return cpuid_ebx(0x80000026) >> X86_CPU_TYPE_ID_SHIFT; +} +EXPORT_SYMBOL_GPL(amd_get_this_core_type); diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 8b8cae1b678d..dce901a403c9 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -50,8 +50,9 @@ #define AMD_PSTATE_TRANSITION_LATENCY 20000 #define AMD_PSTATE_TRANSITION_DELAY 1000 -#define CPPC_HIGHEST_PERF_PERFORMANCE 196 -#define CPPC_HIGHEST_PERF_DEFAULT 166 +#define CPPC_HIGHEST_PERF_EFFICIENT 132 +#define CPPC_HIGHEST_PERF_PERFORMANCE 196 +#define CPPC_HIGHEST_PERF_DEFAULT 166 /* * TODO: We need more time to fine tune processors with shared memory solution @@ -327,19 +328,47 @@ static inline int amd_pstate_enable(bool enable) return static_call(amd_pstate_enable)(enable); } +static void get_this_core_type(void *data) +{ + int *cpu_type = data; + + *cpu_type = amd_get_this_core_type(); +} + +static int amd_pstate_get_cpu_type(int cpu) +{ + int cpu_type = 0; + + smp_call_function_single(cpu, get_this_core_type, &cpu_type, 1); + + return cpu_type; +} + static u32 amd_pstate_highest_perf_set(struct amd_cpudata *cpudata) { - struct cpuinfo_x86 *c = &cpu_data(0); + u32 highest_perf; + int core_type; - /* - * For AMD CPUs with Family ID 19H and Model ID range 0x70 to 0x7f, - * the highest performance level is set to 196. - * https://bugzilla.kernel.org/show_bug.cgi?id=218759 - */ - if (c->x86 == 0x19 && (c->x86_model >= 0x70 && c->x86_model <= 0x7f)) - return CPPC_HIGHEST_PERF_PERFORMANCE; + core_type = amd_pstate_get_cpu_type(cpudata->cpu); + pr_debug("core_type %d found\n", core_type); - return CPPC_HIGHEST_PERF_DEFAULT; + switch (core_type) { + case CPU_CORE_TYPE_NO_HETERO_SUP: + highest_perf = CPPC_HIGHEST_PERF_DEFAULT; + break; + case CPU_CORE_TYPE_PERFORMANCE: + highest_perf = CPPC_HIGHEST_PERF_PERFORMANCE; + break; + case CPU_CORE_TYPE_EFFICIENCY: + highest_perf = CPPC_HIGHEST_PERF_EFFICIENT; + break; + default: + highest_perf = CPPC_HIGHEST_PERF_DEFAULT; + WARN_ONCE(true, "WARNING: Undefined core type found"); + break; + } + + return highest_perf; } static int pstate_init_perf(struct amd_cpudata *cpudata) @@ -352,15 +381,7 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) if (ret) return ret; - /* For platforms that do not support the preferred core feature, the - * highest_pef may be configured with 166 or 255, to avoid max frequency - * calculated wrongly. we take the AMD_CPPC_HIGHEST_PERF(cap1) value as - * the default max perf. - */ - if (cpudata->hw_prefcore) - highest_perf = amd_pstate_highest_perf_set(cpudata); - else - highest_perf = AMD_CPPC_HIGHEST_PERF(cap1); + highest_perf = amd_pstate_highest_perf_set(cpudata); WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->max_limit_perf, highest_perf); @@ -381,10 +402,7 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) if (ret) return ret; - if (cpudata->hw_prefcore) - highest_perf = amd_pstate_highest_perf_set(cpudata); - else - highest_perf = cppc_perf.highest_perf; + highest_perf = amd_pstate_highest_perf_set(cpudata); WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->max_limit_perf, highest_perf); diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index d58fc022ec46..869d916003f1 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -134,4 +134,12 @@ struct quirk_entry { u32 lowest_freq; }; +/* defined by CPUID_Fn80000026_EBX BIT [31:28] */ +enum amd_core_type { + CPU_CORE_TYPE_NO_HETERO_SUP = -1, + CPU_CORE_TYPE_PERFORMANCE = 0, + CPU_CORE_TYPE_EFFICIENCY = 1, + CPU_CORE_TYPE_UNDEFINED = 2, +}; + #endif /* _LINUX_AMD_PSTATE_H */ From patchwork Mon May 13 02:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13662982 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2077.outbound.protection.outlook.com [40.107.95.77]) (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 1A15313956B; Mon, 13 May 2024 02:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566106; cv=fail; b=SVssFx/UBivOc7wkO+QlPw8FJv+lhjO6GznzwoWwXpRy5X+JEqSwKWMH8c0MyV3PzJD98nIUYwsECKvKtQTzmWFFuwAmWYkXVxY/IsTxL/+a2DOHk5gexXiBj8gRhKN4W6XWtpOecJ3Hm6HG3iSgpYuABnNxPhnFVa5QXH/qpOU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715566106; c=relaxed/simple; bh=xOX5/jL71gOPe+phHcmMOPqzYt6IMtZWbvbb1kZ/FrU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KmJex0h7Fq3BYt+BbUBTm93wdp6OQzI4tHgnmWIxFA9MZW0ZJjkfbBeidjQyTGsJB+1blNFKLoTiGm0fOMw0uul1qtPjLeuEchFqjxso3FlcDo/6XLiHQ+cxSwWudVM02qM580Kb7rCYPtJyHyRA/x/Vhy8Hizx/4lrdQog9Xv0= 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=sNIqxyVK; arc=fail smtp.client-ip=40.107.95.77 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="sNIqxyVK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FSA5QgoJfcbXJi2BzcZ6a8J0tN33Cz3sT7lQvl72aKXeN6CZ8jR2fUKSaVr2umsZb0RRPsWUepwFIsrHEP3OwBiZ87sR1hZ2Sf0pN6AU2mM7sZs3c+ErWQMnf4mkGFbTN4sqTwvUx8xxlO2BUMUiDHobMKNiCOAMYUL5Otz2JI4lxCyO0y25EgN7yZRQxcPd9V4B9pXEpuKR7SkebKSjPTDsoTpclhGa42grrEYXhURChvBkCf5VTvLFsXwS8xKTkdHodG6je0YOgQwD68eJK+YxLkCA1IBF/EDNMQRlSjjyqj0d80hyafv/DWrRh8qZGbdtwkNgc+6b9Pvj/UAfoQ== 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=7FAyYt0HE/cZUL1eFC7ZRF+YdqP/UpH2iZS9/18ppi4=; b=fY/9/QJlnJgQU9z/FT2vXaquBgdfjyVs1+HaCK2OMCd6zml6wUVqJxZn8lP5gegrtNQ1kh15a1xCDVFOwBhylnhr9tZ1x9nYyhJnV4UOITeAXFGtT9kYotbu2Oy7DQEgQvvOllQwEfWWq2Lt10j+t0jqhGXGYSV63tf5cA6aZdhraYzQJ/eQI2eyp5STKJUd2vBmQXlYW6Pl0cbMiTPG+N8ka+SLioOZiUpa7G9046cwHQPQ+g8XS/KTW6Ou0EnJzaV0aZQ9JorPzEtlqXqzfPviiztEaybfZUZ+pG0bm1YocU6d5oCvn02uCv2riYhuA6PzLhzXYizgmA43rNqesg== 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=7FAyYt0HE/cZUL1eFC7ZRF+YdqP/UpH2iZS9/18ppi4=; b=sNIqxyVKzzVYwwFn8I9+q1GGV7XxHMkwyBRPrfb7DCz/ZqMT7Q+LaXpdfhYpfqtQFVSQt7cfQJtWZ8Hop2KXXqvhpGnvCpMd8UiSr45B3NJvehyZuAvJqNsHXvlJsXxqQUtroC/NVY4A15iGPVm2D13X+PtUJcLS6Jo0FTe8RhA= Received: from BY3PR05CA0025.namprd05.prod.outlook.com (2603:10b6:a03:254::30) by PH7PR12MB5950.namprd12.prod.outlook.com (2603:10b6:510:1d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:08:20 +0000 Received: from SJ1PEPF00001CE3.namprd05.prod.outlook.com (2603:10b6:a03:254:cafe::bd) by BY3PR05CA0025.outlook.office365.com (2603:10b6:a03:254::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.22 via Frontend Transport; Mon, 13 May 2024 02:08:20 +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 SJ1PEPF00001CE3.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Mon, 13 May 2024 02:08:19 +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; Sun, 12 May 2024 21:08:16 -0500 From: Perry Yuan To: , , , CC: , , , , , , Subject: [PATCH v2 10/10] cpufreq: amd-pstate: automatically load pstate driver by default Date: Mon, 13 May 2024 10:07:28 +0800 Message-ID: <9b31fbcdfd4e4f00c3302f45e655aa43589b224c.1715356532.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: SJ1PEPF00001CE3:EE_|PH7PR12MB5950:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cd7070c-2e07-4dba-d49f-08dc72f18f8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|36860700004|376005|82310400017; X-Microsoft-Antispam-Message-Info: IrmaSVe3lV6SjTM77XFP6Te4PLy7SG0Yd7hfArHutkNZdFQJD45tBmx8430QGaCcEEbLR4XahUt55Cor4bIlKmitnOd5vGHh/Bk7KtYbA0qUdgtFeBkzD+oVAKaLkpxlGm//rRyCfcf/3+dcRLn4Y7fuRTRy/VbrVyGc6/t4jqpk2CbKg1mqIgt37mZzqxUSOWXHRvICzSU6dOVBNQaJ1/Pf4COboxET7QLsIcmieEk4onPt5Q1FjcWOCPH7goIVIdgEXkbxa60Bq3RNiU61cqsTVrGOE1eZX6PBJ58IbjdB0PIZjseWhtelRymqWRxBu3OisEwRZoFm3AD+XmrAPaQykPz/AGI/i3waK7fiOjf4h5FXTza8Mg7UbypV4UTncUJWp9JetkeKJZ3hsPcLKYh3jBBSuYmuo1vm7UkqsWdKOp/Oo7luuA7Kuhy1Hx19lshp81SZLTk31uR25dCNJzidvV2XazBepQ+W0PpEQfEJUb5l8ADUH+ENeOdMi+HjOdyE4c818gnKA6xaYpqebnHA9g5drhPynMeC/zQKgNiKsNc2OyLWMldXqa+IObiPvPJ0S3WkS15c0fQNsCYgzcbCCd753UdTBCNgQf+J+WpIfPAXslWilgymFLwtjwtuIG6U80RssUUfuQagwuO3597BZvkR0sz24xvQIrsBtd5PXN7fHopRtqjL8T0Y4+Oj/zyAxcOT55BuPelPErUkXmNfIPorU60s4yGBrROIIEfWxTKCk74GBj4GGQTdjJ5WTsToX1ErepsTNpGrNyoZBlnWTFqGMcgT8Ur2E7C5/hejyc75cjg1wbQT6zOMB3Su+JurDsvM06QEJ4LZHpeBTHva0PATqCr4eg1FDsoZbjPCb68v4Fi5AgjeYUnBxBEUAhezq5h1c1oIkl2wQ0/gnxtj6LRiEDXoFgOJCuLbAJE5mIX3BP08kaWqk6M/1LNVYgD8d1Ep1h1wXQXXuZ1J8PuLcKKiTNZoLX0bYn6NjNCMkbKL5Am1vK2POlDHZk7L+uE/jzk+EXtsPUIw8NGG8dwhGHs8NY2hU+Xxal5aIevA6DFPuXYL+GJwoqzbgaxdOVgUHYtPd+/ioeCs5NGRcQHBT7IM8MHx6CmLJXHEIGh2yelMbuLk4RtZHXCAxUALQKWTFIZTM6Fa1C2SAzqQFkbFSwsk34m/EyHzIBtL0w3FBk0jWWkni7FhU9tpbhnFpFGmCmMeSpKfyJU9AptC4bpS+2ZQimOwJ4abBmgoEayWxpQ2/iWGyIBpaOgbwYIsw1hcOaYAuZu5ejfSEZ5nSMa6wcQT71ctCWWJUwY3m3g08Tc0oIgHpHT/pW/Z8X+c 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)(36860700004)(376005)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 02:08:19.9014 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cd7070c-2e07-4dba-d49f-08dc72f18f8d 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: SJ1PEPF00001CE3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5950 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. [ 0.917789] usb usb6: Manufacturer: Linux 6.9.0-rc6-amd-pstate-new-fix-v1 xhci-hcd [ 0.982579] amd_pstate: failed to register with return -22 Reported-by: Andrei Amuraritei Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218705 Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index dce901a403c9..03342fef7d94 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1785,28 +1785,30 @@ static int __init amd_pstate_init(void) /* check if this machine need CPPC quirks */ dmi_check_system(amd_pstate_quirks_table); + /* get default driver mode for loading */ + if (cppc_state == AMD_PSTATE_UNDEFINED) + cppc_state = CONFIG_X86_AMD_PSTATE_DEFAULT_MODE; + + /* Disable on the following configs by default: + * 1. Undefined platforms + * 2. Server platforms + */ + if (amd_pstate_acpi_pm_profile_undefined() || + amd_pstate_acpi_pm_profile_server()) { + pr_info("driver load is disabled for server or undefined platform\n"); + return -ENODEV; + } + switch (cppc_state) { - case AMD_PSTATE_UNDEFINED: - /* 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)) { - 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; 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; @@ -1827,7 +1829,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; }