From patchwork Sat Oct 12 17:45:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13834071 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2066.outbound.protection.outlook.com [40.107.94.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71CF517579; Sat, 12 Oct 2024 17:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755158; cv=fail; b=TnW8ANo0RIVikXrzL+Aw+y3kLp2j7y7eR1GrcY1M8VhjMpurQ55XHk/a7aQ5ah5gGnowJP/iJ6uVs2M5K6rcb5E9Dw/YGirCzr+Ms+2+UDRUsfEbdjA4q1MU9NfokAvvf+BcnJKY7FqKY/e0C89siH8gyHCF5BpRkLVQqqm1TSU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755158; c=relaxed/simple; bh=Rws0x9OTrZrU9iu4g0s3ECprm+SsDyl52nAu2LSxSk8=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=IIszE7PxRk5qeKH3gWndO+p7zVGkfPAoDbm3sreNtWceJ98K7uosjsgv1O9skl6WxJaN0iOqyDTWEdGAOe5awlnr4Wv4obimLLfbyzHOytC+ac7n1pYThxxFVfTv/xD41VhI1waM9LgVNNoKDEEx5/CAlbqBQLMXNQNboH2RZvM= 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=zzK6GAR4; arc=fail smtp.client-ip=40.107.94.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="zzK6GAR4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TMDFj6FdwsBaSIeIWuT/3wyE57EbXsR32k103Rj2tyVJnmzfWmznQEjghpm5eC7nh7a2otUf4+6XLeMB+XSeCgAwAnK6u0+Fw5+KZjn3Al9Niib+u1kiWotxrSPxRcPa4UuxCA96/gLzYoDQ6CW+g/j0yO4CBKY2HDAGDqa2nGv1IfO8VVDASNAAPRmHMkl9eUq/nF4jad0QIMUAh4ryHdWNJNbIaSGxh2WzzDAhwBpWeV5LtV7lq61ekA9O9unimnjfc71cz289q6D+7njjdONlkJIs5pDtU7zZFlvvM9dVPjja51/PbY6f83CaOD30TU/Os1XwO/sg2OetdvVltA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=pe8wpd5Ju0riSwsXApkWKKcTYOnpimsaFc+E+fA4Bm0=; b=v3xD+exNqWr+fMKS/E7axRqzVaHyIUQ+vOum6ATvMch/T2P70NMzaV7ymwgQY8i/9b8zPhZoJ3hnV+Fg4ZW4KmwPBWPOEVPJJjEfzLUVIR6N4pBlPCavDt7GX9p1kmGU1i7T0UHkMavQAl8XArhkwS55fLzUvxUbNzG8JeE+dA6e0s7jAwCFqWgZbGluZprV+46pbkz5f3w+Qqkr5HmwF+XPnLp9xAMfSIuzMKFbf3FfRN22mVYa5Fi2L3BtWhFcoUgfkfbG+MsKOuCd3F+nz3XbsBdPOoGme/5+RW0uhsBUqn++Pfro167qkboZD0m6+3Teos6C6ftd7epctAxWnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org 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=pe8wpd5Ju0riSwsXApkWKKcTYOnpimsaFc+E+fA4Bm0=; b=zzK6GAR40PewZRQ2Hu9FNPylDc2ObTbDrobI2mU9dtmD/DMMuHXQAYxjhmr9s6JALEVmTGZXD+N0UKZRsKUq8IaR4vB0tYrYdsjXL1BFOCsb6mtATV8LRKUuBRLdrakGaOMutJ7cHd7rnhIVNY0M2Ts2yQsKUF/clmard7ylJsY= Received: from MW4PR03CA0145.namprd03.prod.outlook.com (2603:10b6:303:8c::30) by DM6PR12MB4433.namprd12.prod.outlook.com (2603:10b6:5:2a1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.22; Sat, 12 Oct 2024 17:45:52 +0000 Received: from SJ1PEPF000023CB.namprd02.prod.outlook.com (2603:10b6:303:8c:cafe::2f) by MW4PR03CA0145.outlook.office365.com (2603:10b6:303:8c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.21 via Frontend Transport; Sat, 12 Oct 2024 17:45:52 +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 SJ1PEPF000023CB.mail.protection.outlook.com (10.167.244.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Sat, 12 Oct 2024 17:45:52 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 12 Oct 2024 12:45:50 -0500 From: Mario Limonciello To: "Gautham R . Shenoy" CC: Perry Yuan , , , Dhananjay Ugwekar , Mario Limonciello , Peter Jung Subject: [PATCH 1/4] cpufreq/amd-pstate: Use nominal perf for limits when boost is disabled Date: Sat, 12 Oct 2024 12:45:16 -0500 Message-ID: <20241012174519.897-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 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: SJ1PEPF000023CB:EE_|DM6PR12MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 0eed917a-ea3c-4c6b-24d6-08dceae5b732 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: jYM5FjYOalzUxAaGFQ9GppbB3HQYR5G385mzIHgu7Wj8Q0Ur79AO06mMvhdDRlUVc1xwkq427BkgNC3diQikPDomIdZMxhvIuCJRPdiZlAHtD3YIDa3FarTQOJg6OIPw8NMLfN3PqVytp5qzlEco6M/ttA18xjBPNLpq8QOSCbQhtbR3S3a6f93FePkDTjxZ2DPsIhwxd9f7kzXufWM7EuY2xn3H7QYHb6YfY+JJdScSo26Qsmpkk6kHLWzk7rVjV1ed7STBDIvWMCCkvWTFy3nJCNV5g3n97MLg25pe7LanPToYLNfB+LEMamqV5EUesz56fx1gf2foCWIiwCuN3LFRiBBagPpW4wtjC3/QK+tdBH8Oqoo1Miohq22Ko04/zdShQlJrLKMtGzCYb9SQm/QZHy/M52IWyS7Su9dgjHyWxSLkCSmFgMB12wMF/SL5uGHyDcQFVSb6SIbVVgcAaFoQVAHuRGcOpRVIKow8KWysdgpbOM8T8JOh/XFnw0gv1M+uJNxdxkoHBqruNGina1zoakdQveB79dX19R193bbXf8HtFyWr8fpTglwrgQhJxin4ohUMHkF9ivLCVgHF9tzxitO2BV0/cEdDRq4lrO9Iz7bpMlSpnvJTpv+FLC//FcngP4S+zniDvH14MZFhtUIrJSCZND5lbDMYjH7JM3Au4Lx20dH4xcOqryYmKv8vy2MAS00hThIO+4qs1QqOS4wqyiKFHJx2WjRpYBYzLFU1Yc6PAB1EcY+nSU4Nr7xrOe4bDzjYJbnSGrXlBWOQnxSnsPSI1E7QT7z2HebolTcbqMfYonERWfhk6GDY+6xNBxYasf6WKFhLUvUddavPQMPuO7S90rjG2Xe8qSt+Ci4PP9/5TMd5+gRSYAZvXkfJmwGJyTykDGcmX3RAEyG8tdx1cfhDDkN920TfGA83RjEsKAgENbjUhKXMBqhdHZrjAMj2T0+8EqxuK7y4fGILI1wU6xk0WER9xVgkl0ficvNqN4y6pJh6IN4OFuVolijc4J01tcmsomPKKJkfoardD7rn9CHu+zA+67GoVEC7kxaICFKFUZAc6gz3zyViNe4XshkKT+KK2OaONahskl1VtauxUF7oMq4EZtO5NkUDw+g+Hh/S3dWEpyC0ptXe78gns7L+e9bUTer/S2MEPHlMTXujilkAFYlU3mSATVzW48OsPagRkJYZgCX2JWs7AvkeCspbnrcl1HbUzsXm2T34ze7ypYN7E2fhwerTBuXlMyn3+T8q9pe1Q0GtP9DNPTEgusaMUxYor6/LHsjs2xw0FA4fD/+jgHRfwx4OBsEGBMjMn1cJUSFfDpPGfHT7WLqLI2KAJEfC+S5svYWIGzCeUePo8/IYouvevf8DwVJEm7UMK8E7bnELbkXnrQzxoXQG 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:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 17:45:52.0288 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0eed917a-ea3c-4c6b-24d6-08dceae5b732 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: SJ1PEPF000023CB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4433 When boost has been disabled the limit for perf should be nominal perf not the highest perf. Using the latter to do calculations will lead to incorrect values that are still above nominal. Fixes: ad4caad58d91 ("cpufreq: amd-pstate: Merge amd_pstate_highest_perf_set() into amd_get_boost_ratio_numerator()") Reported-by: Peter Jung Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219348 Signed-off-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy Reviewed-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 30415c30d8b4..dfa9a146769b 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -536,11 +536,16 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy) static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy) { - u32 max_limit_perf, min_limit_perf, lowest_perf; + u32 max_limit_perf, min_limit_perf, lowest_perf, max_perf; struct amd_cpudata *cpudata = policy->driver_data; - max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); - min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); + if (cpudata->boost_supported && !policy->boost_enabled) + max_perf = READ_ONCE(cpudata->nominal_perf); + else + max_perf = READ_ONCE(cpudata->highest_perf); + + max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq); + min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq); lowest_perf = READ_ONCE(cpudata->lowest_perf); if (min_limit_perf < lowest_perf) @@ -1506,10 +1511,13 @@ static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy) u64 value; s16 epp; - max_perf = READ_ONCE(cpudata->highest_perf); + if (cpudata->boost_supported && !policy->boost_enabled) + max_perf = READ_ONCE(cpudata->nominal_perf); + else + max_perf = READ_ONCE(cpudata->highest_perf); min_perf = READ_ONCE(cpudata->lowest_perf); - max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); - min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); + max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq); + min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq); if (min_limit_perf < min_perf) min_limit_perf = min_perf; From patchwork Sat Oct 12 17:45:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13834072 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2045.outbound.protection.outlook.com [40.107.220.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4286F1B969; Sat, 12 Oct 2024 17:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755158; cv=fail; b=hYtpqUOu7y+UX+mhNjNuPAxK7v4wF9pC9GNFtpl8PXd3Bqd2LtS5xUzf3fcvy5TzOe4u5nptUYU03ul/cjf3GBFy3PgTsycbsbduhIT10XlFstSPwKFYmBDOJOnlhjn028XhD2TOiDoErsW9aqLbleSjb17r5q6f5YLMrDLyzmA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755158; c=relaxed/simple; bh=/rQKjGb3gfjDEWfDCFCw3t+9kxdaxazhPcQ/vgoiItU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b/Kwrz/V3+Z6q+OM76r9FBrWAn51TeisE+6dpEo3KXYsDeJ9Kwm9dMTnQfW29K0hjgiJTyUR5qdLMMjM3WwvTvVSCL3Ev+pY5viEiHSt1PoAMdTqq7qSQGh0OcL+EssDmrOsT2K23y33+2IU886lD/s0Lcz0JunQni+2D/20sgA= 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=PeEx+el4; arc=fail smtp.client-ip=40.107.220.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="PeEx+el4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J7/KMNu4uJzkzmf80fhNnKS2yZlUiQ0X3qHJuxMCIFdGey8sSW6T6ndiCfShNUSjFCuXLONsLiXu/GUfDFBkaTJr+SoQCORNnaSKnzaaeGq0pcHMUb/wINSRtUshjylXLvmetAfdIIfW4cDJc/RvCeGQfjMLWuAXeionJmkPmusMz1lDtLw/Yp4tqvPyB1BzSnr8XvPz0/Tr6RMaeWKXklvs0MgO9sEvQZ2cdeWPXLuraLKvGizQiLFihevLn90jXEn7GdUrrK1uMfoHAJcErkiI5ws/CitYWiim/MzP8yitfqGBuitRHXd3wJj6erWr4DR2RSnv1iH+5yr2N3mQZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=jc4Fjdbllc8QQ2qfQV/5WR4ypUsKxafQbgOWjGqFgUs=; b=Ht0KKaV23DZDdpE3cu6YVpEmii7YwRfeFsKubd0iaQSIsGiostB4FddM5Sh1Sb7HO47Ien178LrmykGbKdcB3N948BIg8+jwdl7eu3iwQCWHAxvP4qUej5iaCw5KLFsrwFi6Fy2FxolZywb/jVU4mzoF9ossBL1CsKZ4PJ/XcgYUkR/cfc025D1wbv8rKDCMjy8ZVd/xS4r99rpYEGu632Bq/BnFDnH1Spqe9qWM2zAObfxedgzHN09upA1SC3aanAwjZa7XN/ebrgzbNtAioCi9I6z92h0u7r+vQ2/QItcG9tHD5eO2NvmgvFuQsgMDDfcaMqxVr8Bwmz66tXPstA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org 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=jc4Fjdbllc8QQ2qfQV/5WR4ypUsKxafQbgOWjGqFgUs=; b=PeEx+el4/Tnxy9JOaYRE4B5o7oZKP3XMXPbd/sypcjr9qyRj3EHr0Z3RlKrq2eYfonDHpwhY1+CgFO/V2V58hoICXjyJVepHPFOaHI8DWq6FEyj9IdOXhwgWa8DKDe+fa2eZA6cejM0njwDWPsJAYLAXLKszaKoNz6B+n6tuKkk= Received: from MW4PR03CA0147.namprd03.prod.outlook.com (2603:10b6:303:8c::32) by CY5PR12MB6324.namprd12.prod.outlook.com (2603:10b6:930:f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Sat, 12 Oct 2024 17:45:53 +0000 Received: from SJ1PEPF000023CB.namprd02.prod.outlook.com (2603:10b6:303:8c:cafe::7d) by MW4PR03CA0147.outlook.office365.com (2603:10b6:303:8c::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.22 via Frontend Transport; Sat, 12 Oct 2024 17:45:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF000023CB.mail.protection.outlook.com (10.167.244.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Sat, 12 Oct 2024 17:45:53 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 12 Oct 2024 12:45:51 -0500 From: Mario Limonciello To: "Gautham R . Shenoy" CC: Perry Yuan , , , Dhananjay Ugwekar , Mario Limonciello Subject: [PATCH 2/4] cpufreq/amd-pstate: Don't update CPPC request in amd_pstate_cpu_boost_update() Date: Sat, 12 Oct 2024 12:45:17 -0500 Message-ID: <20241012174519.897-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012174519.897-1-mario.limonciello@amd.com> References: <20241012174519.897-1-mario.limonciello@amd.com> 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: SJ1PEPF000023CB:EE_|CY5PR12MB6324:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e1f1886-6527-483a-1e54-08dceae5b7cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: BVeawdgu4134W11VHuZ158EevXy4QkT+rilQydvOvPcHbPFXqQMz7pLiSmyM+pOaBA4CBnfNxkjeW0HngxarVsF0uc7BIipRPnRYlfdVmArGv+BJHUYrDbhvluuyRTCe0c7KQkOrXlcrS+vDKGrJJTcQCaqyqER/wKAYxxB89doAS3XeANHMVZWgJGAM//mlFp/kJXTTrXJAB9KhP9Z4oFTm9zoHSStQWNaJuplxT2z2PAKHH/fk390GZrpzSfYUNs+e8zfnOOO0m9v4GnxJwhBictaBl+8FXaS957T4BjkxXoc9OCwAmjkWyXGzMak3/iTYX8GWRod5NdOpBIB9tHNZa94UPvP2sqbq7zCxNwId4ZrFZQudjjLDohCJyWQS+luV+hdAi9o1HYZgr9GpA6kZU3EA5ih+Mq/tlyf5HkuT+BhjdQt1QmFu/p1hQGSeNiMv4KQuH96I0aKV1szkfcnL1rbwZ2sWJRrrgwKPHvivPcI6bNSYQlX3tlds44xprRInHnBhhFzcMLzK+XJUpMtRc6qKnEJec+LjltsZZuiMwiBxQFbT2ytqeNEU5iJdUP1rc7SL65SA8IBccYdVvDORiEn7MyXZtSxwIYU5QB5mttQAInyp6eKSwXMva7q/TxuaDU7wymUJjSlmJP6B0fyC+AS43bxCKVQHw+txJWMmxntpLkEItX3H6EJyzgGGiTPXGzOjeE+VKmONQpl1x4wes7YZjPU0vEI3CiKXRl1li/1Pl32U8ww9fe6VEibbG7ubFwyzyNbalofDoxcrng6v9mweCkjoeMrHcSz03681+oLmlABdQOnDKziHHUNVNH4GDLYb/hYfpweitlgXBBP3Tn5z5SM7R5k2Ax9nXVP788kaR7GjyFwnlTo2gHTn0ynHa/RGKDsKU5CblosnudOkNpPuUuPRVa5lJquThDK/EzahI/v7YPDRcyBic0u52ii7dE5lp2ffh7L+tZIFfVOzkM1o6ECOteAM5G11608MiAV+FFUjy1D5B7L3KH52Wnp6YsxUUO13MB+UvdSpsdLwPinfBr1iRve3couLHn0SFmGsy7A7Zjqn8q48g38Z3vEjm56o6E3Tw1ryt7NoGbDTotuUBgIqedBPWvw0y9DW+0qfgGbwb2jcodc82o/5Vv25eZd1VbrA6wuhmENrRXlPQVBVSmxR8ibVFqX/PkOvdThmjC6wNcexAMbab0DNuyZYtfPDV5FNH2XRTiOOAhYQfr3VJpVewqMps4aZv2ESk1xdmTM1lCyQ6dHeoNdMYRXEbXWSLxmkWnha/enuMCOIBU8FnWIT4sIk3WIQIttZ4KuA/JwDuOWXopC3Rcrzq56MkIn41HJCX9B/5gtaVFPvWiX5xuC4McugxDbxarzDvT/ALfPNAZm5bqWIe7gc 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:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 17:45:53.0289 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e1f1886-6527-483a-1e54-08dceae5b7cd 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: SJ1PEPF000023CB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6324 When boost is changed the CPPC value is changed in amd_pstate_cpu_boost_update() but then changed again when refresh_frequency_limits() and all it's callbacks occur. The first is a pointless write, so instead just update the limits for the policy and let the policy refresh anchor everything properly. Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state") Signed-off-by: Mario Limonciello Reviewed-by: Perry Yuan . Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index dfa9a146769b..13dec8b1e7a8 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -665,34 +665,12 @@ static void amd_pstate_adjust_perf(unsigned int cpu, static int amd_pstate_cpu_boost_update(struct cpufreq_policy *policy, bool on) { struct amd_cpudata *cpudata = policy->driver_data; - struct cppc_perf_ctrls perf_ctrls; - u32 highest_perf, nominal_perf, nominal_freq, max_freq; + u32 nominal_freq, max_freq; int ret = 0; - highest_perf = READ_ONCE(cpudata->highest_perf); - nominal_perf = READ_ONCE(cpudata->nominal_perf); nominal_freq = READ_ONCE(cpudata->nominal_freq); max_freq = READ_ONCE(cpudata->max_freq); - if (boot_cpu_has(X86_FEATURE_CPPC)) { - u64 value = READ_ONCE(cpudata->cppc_req_cached); - - value &= ~GENMASK_ULL(7, 0); - value |= on ? highest_perf : nominal_perf; - WRITE_ONCE(cpudata->cppc_req_cached, value); - - wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); - } else { - perf_ctrls.max_perf = on ? highest_perf : nominal_perf; - ret = cppc_set_perf(cpudata->cpu, &perf_ctrls); - if (ret) { - cpufreq_cpu_release(policy); - pr_debug("Failed to set max perf on CPU:%d. ret:%d\n", - cpudata->cpu, ret); - return ret; - } - } - if (on) policy->cpuinfo.max_freq = max_freq; else if (policy->cpuinfo.max_freq > nominal_freq * 1000) From patchwork Sat Oct 12 17:45:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13834073 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2055.outbound.protection.outlook.com [40.107.237.55]) (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 420BD13211C; Sat, 12 Oct 2024 17:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755160; cv=fail; b=bAEFDogupVdeBhBNqJoIrblhR13u+7vpI0y6+TJbOot7h7PF7jsPIx4qULz0ZDKlbE0Nwi5WNzYLfxot+fMA3g+Qu89CdhV4NqJwk/VgNjA8myoquZ04jfAsUx17ZCpCgzbnqlg/BxCLNvOpN6PTLWuKoIlTVtEqHG4AwUYiRK8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755160; c=relaxed/simple; bh=4RmqTx0MI+2dnQwjze1H2Z0vRTLLuTC/kphpUfBN4mY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O1nMFW8fIwu0zArhaxdKHcI8KvQSAPPpW/BsVJTZ45GNDH4D4m6criRQ172KCJdGLyD5UVt1ffwAYXAR0u1KdlDzOPqEHzydhgArBIWJiuW/YDNPJSvUg4BiBHPYNC7bIPThT3Cq44C3+Qk2H/CS4dx9LhaPCyrQDYc3UsPMfiE= 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=t8GQWwe1; arc=fail smtp.client-ip=40.107.237.55 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="t8GQWwe1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MeXQIJ83Mh3cv77GTQvv88z+nVqn3xPouHRM2UwHdDxU6potmNLfVIoNvwOTIYppXtLzp5I0w6PX5yZuiMlMIIR2OqNEgtVw35oXm7DxWDIIDckna1oRvPOn+Bgkta/qU6DeV9XMLCp4sQaMNWA+rgWHXdmTo/v2t5ImObeMO2+r63pWyr9GVQ2xQAh3eddrU4an2fQg1lFDZUNh3aMtCWRRzp5mlNyGZlyrz+c7TJvy++OwYZggFXcZFLH67XP36FitQJUVWPS7hl1nixA2sgSdEW5+YfCkmnsXH3bR2iIjk4otorZsmEguHsP4dbZ8YqJMIyIK2mKiluKpOmZE7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=B52RCpTCb8NlzBlqTXOFk0bjPZWSW0QLt1PmDxYDob4=; b=I+6lK3tdpm7U6GYQP6yUOByctuGmixXs6Wx/UL8DQAS/UhF77aXn1o0kmA9LqPC44oDkuUpe7kZiHNxCfwn2QodEh49DoQqzikJHUHSD6QksuhiCVbWDeNp10Y2AxrDKS6Ge2xOVzpbXL/ZaZ6Cowx8yqETx3lUmIgOQXULGuMQbecRH90ZYOX9QX6tE67P2lyAm21Fqrp3kwptfLX7ocNmZ2dQ/BWD9Bpx+uyP3EAG0Ck/scDCf2CKmv6eF7x6pd3LVQooQpLCG24IRmlh4SflILn9ceDegoc+SZlahCjb+KuCPg+99nPOecRoBb93OgwwDja5RVQc4PP6xwoyt6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org 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=B52RCpTCb8NlzBlqTXOFk0bjPZWSW0QLt1PmDxYDob4=; b=t8GQWwe1+L0Ci+yq3VZIfb5ih45zRiiupLBE54VedKj4oav9A9JKt72j/cY8cZHRLQliYTr9b3CvLxz5MjL/egfrN+ztWk8L3+IQ5hwgjuiG5vGgfbhwLP2T8oC+0HTROlPXfyqEkggTmpb9BInLEjDFtHPMSA4zTogRIfEt6gE= Received: from MW4PR03CA0146.namprd03.prod.outlook.com (2603:10b6:303:8c::31) by DS7PR12MB5909.namprd12.prod.outlook.com (2603:10b6:8:7a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20; Sat, 12 Oct 2024 17:45:54 +0000 Received: from SJ1PEPF000023CB.namprd02.prod.outlook.com (2603:10b6:303:8c:cafe::11) by MW4PR03CA0146.outlook.office365.com (2603:10b6:303:8c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Sat, 12 Oct 2024 17:45:54 +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 SJ1PEPF000023CB.mail.protection.outlook.com (10.167.244.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Sat, 12 Oct 2024 17:45:53 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 12 Oct 2024 12:45:52 -0500 From: Mario Limonciello To: "Gautham R . Shenoy" CC: Perry Yuan , , , Dhananjay Ugwekar , Mario Limonciello Subject: [PATCH 3/4] cpufreq/amd-pstate: Use amd_pstate_update_min_max_limit() for EPP limits Date: Sat, 12 Oct 2024 12:45:18 -0500 Message-ID: <20241012174519.897-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012174519.897-1-mario.limonciello@amd.com> References: <20241012174519.897-1-mario.limonciello@amd.com> 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: SJ1PEPF000023CB:EE_|DS7PR12MB5909:EE_ X-MS-Office365-Filtering-Correlation-Id: 50d09681-f82b-4641-dd56-08dceae5b84d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: llsJqApD+4sh8spK3JuCdO1wWnaaJ6mEDtK4ESFgwWVhKnxpDsHDGWiKMv06RsB0YfPZ1xdsXQahiXc9YfEAr0RttWehGsfZ0CVhs09nMjmoxrvIE5/4Vl8FjZEhy1resYjELwvjJXfmkFIb1U9zM+gkK8/zppgVSDxqHiUg8AdipTb/FjG/EnYLIhxLjRgLQfXziYkb4EoQVlc2BSPeuYHUPo+tMYsMR/JzEvS/kQMKIr1OdanWvUylaiLjCRgiDqbp4w6nWBerzl96qNSWsT/zmm+XiI5UJKrrlsfjSsYmlFlVUH9JuiF+DpABoy+gmWPRQlcw4bA60s20siCCPqMM1V8VTcTJKA4U/rkE5ik1rgF0AQO7tX+gpwTXkcj/C6+aCZ58srN+o7me2QjUF4A8T5q6ebXAUsmNKxCPEWdhcv471FcL0pk0iiW57AHBEJJuTSTLD0SOsrCAr2ISU+6TQku0pED4u29GkxnGFqjkBTFNhOvDFEH2BqQIYiuhKrXlN5L5pvjUDh6X3W/AfsdbIprkoWMceSEgue7WDcgfFhzeecFNy86V+/FZwAllvuWxI5CAF9axFytSwIg4zUNthXXtIWvGLr2VZpqE7SKSjGkd53p5aBCnG3mjhHrE2psQC4UIAGHX3oxQ4DLTUM/vjqfHKXzNcZz3vFgabi8AN6gOD7g1JoaEgEk1fXOzAaOm3xlS4ErlTSanZ91nbV2KHFY8iLmiNbFsfcufAvkRoqdoEML0/ikLjSh2aSVOyBNrhvbR1GDrn6yxJytZ6yVYK66LCT64kBz+uvXrygQi10240WLULYNtgCQjZ0VV75UVxKKcle5vxQGZ+V2xLMhjYoFYnRPKabm+iJAclURc8UKlsbTBxWoJHVBIWeAIXLLgoMxmGkDtWnlpzM8owZ38AyNR1t8Rq+Lr0pqK7mjg6URZ1JT8R3gsgFRYDCBRxrgHcTyH5dOwaiPrrFNxNL6Ox+TezrT2BTT+qLMGxpQ/csO2mA7ZPqAu2BjBGbns7fuYCp1fZjZQIi6dtBlZItMNNuK8KfYXArouCGw1TYXoXyzwp9k3VF4LKC+7lK0DVm4t+SVj9AYTPQgGP/lAtWjSko8m4YXrannBZay1bi+0HDeDeP2qWIrKtzdqGltBbs2YqPOdKB6SS47W/gsOxmZb6XTRMIJV475ZP70z2CDfqg29J5pDBjvVx+tIcGNqXjLtYZ1cFMG/NgiKYh28WOAq3VbTHTyc9VwTZfrWKmKCZYWoxSCJAqjDxFkAmGolq2NAHMQgaJYjY46yuqdS9T2kvXmjRs/1ve8hgSk59h0GL/nKjEGBhOqLUliP3cFQpiO07FABC4GaARnnhvUPE0rCrByvk60W2w4flstYYcHEv8X5jRaCtVeDPCKiq7J1 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:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 17:45:53.8882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50d09681-f82b-4641-dd56-08dceae5b84d 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: SJ1PEPF000023CB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5909 When the EPP updates are set the maximum capable frequency for the CPU is used to set the upper limit instead of that of the policy. Adjust amd_pstate_epp_update_limit() to reuse policy calculation code from amd_pstate_update_min_max_limit(). Signed-off-by: Mario Limonciello Reviewed-by: Perry Yuan Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 13dec8b1e7a8..8d2541f2c74b 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1485,26 +1485,13 @@ static void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy) { struct amd_cpudata *cpudata = policy->driver_data; - u32 max_perf, min_perf, min_limit_perf, max_limit_perf; + u32 max_perf, min_perf; u64 value; s16 epp; - if (cpudata->boost_supported && !policy->boost_enabled) - max_perf = READ_ONCE(cpudata->nominal_perf); - else - max_perf = READ_ONCE(cpudata->highest_perf); + max_perf = READ_ONCE(cpudata->highest_perf); min_perf = READ_ONCE(cpudata->lowest_perf); - max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq); - min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq); - - if (min_limit_perf < min_perf) - min_limit_perf = min_perf; - - if (max_limit_perf < min_limit_perf) - max_limit_perf = min_limit_perf; - - WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf); - WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf); + amd_pstate_update_min_max_limit(policy); max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf, cpudata->max_limit_perf); From patchwork Sat Oct 12 17:45:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13834074 X-Patchwork-Delegate: mario.limonciello@amd.com Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2074.outbound.protection.outlook.com [40.107.96.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 8CD3C152160; Sat, 12 Oct 2024 17:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755162; cv=fail; b=R4SSPI7bbF5sWGTIgtQiqyeGXEFW8RnG45/TvrHJGwI/rNwcBMWBRZQyX7TTnTKsvJ9iAme/m7x2fmEHqeV9lUBA/YqVCBUA4ew85tl5biX7I4wh2Ktq2Mh721iONOtUmawymk4GmPJXTmD7tuypBa2dy6j6RDqOV1Q9D535dcs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728755162; c=relaxed/simple; bh=hSSkhkYGvEI7Zo+OvaL1hrv0yoW3h/RnsVE648jQXRk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sG5s1IrvTtCU2dql2a4G0aRWRNLeY6deoBTybjgTsja71tCSPEzdXARKSxYdPz80qAMQx+OsxNYYGYd2v23dFKdN6pR+gpNHKPmM6GZTO/zVqdTD5M/qbVRgscOReEKUn/duUh197p7Gj7w/UMavxPgba3ACfQEiPnbdYVJ8/Qw= 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=re2dTQLf; arc=fail smtp.client-ip=40.107.96.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="re2dTQLf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X/dAzY5LZ8SK2rFQOdDkir6P+w3Ha3SRblZ3xcuSHmCUNGNIwRo0Mx+bt/i6lalDbZ6frCZTK5NSTERAIrDM4xXZObQ0jWs60qn0Q2en9KGq0W7GQ/K2MA10uYrnOvxo4Qs+NASoHsDOyUVLphUdzSDlMGg6TNPdfoW7WLjdV+A0y5GvVglDXXVVJutWaATrBGFcBnwCc3xPazWN8TLusS2gyKyV1LyX/reqArbqxK1VxTlOTuyVZ62Qd1GuJdwfo7/LZSqJbQy0MM7i7c1+4JLRgz5J0aRHDMFM/M/LLoV+h7piktxrfA78hdaBknnBnWAjHin5+cktKcJT434LkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=wVvjzGwVNEsPRrdZ45fv02JROZg6rU7BqYkSWWIZyMw=; b=xITNvAaAh7R8K/zysfatl6htdPRPp7dvD1CYqtqff4DaD94nNWRxBhkbobcyInrMFZxfj7HEp1iY1gzXq9zWcNHLI5f3md3r+pJ+6rszD6h6AYcdvwScAIcltk/BxcJarTfR7QqfOzVhml9n+lql7swaFit92h4pF3DcyJfyMbucpk+cqFRm5CoRic0tDcDl/iru6FW1fA82J1Ybafgy7LjX+PCXwfPGXmdaeFjTeZrJm8zC9TvbG2wVmWtpRYkMfigqAZh7oBhdi3VC9ZGVAVBDv0GaPaS0h/2S7YsVZgePVXoDOqojzQiEBGOxEbhV5GMZ7Mf6Q3P8QxhDbFo2SQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org 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=wVvjzGwVNEsPRrdZ45fv02JROZg6rU7BqYkSWWIZyMw=; b=re2dTQLf1dZf6I+v5YXh16oREAOV7K0jwUXZv2SK2ai9ytTLgdhaiYhtX2EiR3S7E0N0ITOLs/bviC0mVoUuQezi6Pmq4PN8jTnD/iSiAoL6jCj8BwqBDFj+MbsxxclbZIgGfB0KWvVlbbGwSnXD9JTG2CEaYwMGSA85RdoCTP8= Received: from MW4PR03CA0131.namprd03.prod.outlook.com (2603:10b6:303:8c::16) by BL3PR12MB6644.namprd12.prod.outlook.com (2603:10b6:208:3b1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.21; Sat, 12 Oct 2024 17:45:55 +0000 Received: from SJ1PEPF000023CB.namprd02.prod.outlook.com (2603:10b6:303:8c:cafe::78) by MW4PR03CA0131.outlook.office365.com (2603:10b6:303:8c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Sat, 12 Oct 2024 17:45: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 SJ1PEPF000023CB.mail.protection.outlook.com (10.167.244.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Sat, 12 Oct 2024 17:45:54 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 12 Oct 2024 12:45:53 -0500 From: Mario Limonciello To: "Gautham R . Shenoy" CC: Perry Yuan , , , Dhananjay Ugwekar , Mario Limonciello Subject: [PATCH 4/4] cpufreq/amd-pstate: Drop needless EPP initialization Date: Sat, 12 Oct 2024 12:45:19 -0500 Message-ID: <20241012174519.897-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012174519.897-1-mario.limonciello@amd.com> References: <20241012174519.897-1-mario.limonciello@amd.com> 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: SJ1PEPF000023CB:EE_|BL3PR12MB6644:EE_ X-MS-Office365-Filtering-Correlation-Id: c31d0665-5624-44fd-24c1-08dceae5b8f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: m7/cHcXErDMHPS//PuNpVGzI0lAZirWDNy4GXnzfyZS2yXkKJLMwKgAIDXqdyJYWRhLf7vNAT7iQSbBfG7OOnsWrX7IhrNW1t5L67sVzw9Ya7pXXiIHK4uJj23WApRxgO+Y8YookjnSyUDIjVrF0tVLLOLN61UfW5JAYgdaddIYtoh+0Zk1TP+Ltf1Ki1j9LXP0ymA2p2q0J+I5lfkjw8PXgQdJ2hWgVwMLas0CKWO8vT/CKLJonyKxXLiZmUsWFNnNUyoJrWYBRCSJMLz0ddwewdLrmqNtWzMTIlCqR9EsL9AkkoNN6ndZi7X4HaTQxhNR9D5ukobz+c0t6KsflxIxECnRAl9aoKsZbwvj5klUvydq2oHJ4aOP1VK31GAYnHSob35TXuMJ6+c3CYtOLxqoMk7OOqweoF4EL/K3k919Y41BcBM7Cc092Yjyr1bfylFlPynX8paLFEH5x2aGWLhdRWHuzAlPYe562dXtKLh13lxnEWbXhOjn0U6GP1bK8mdZyjUre6Sy2b5WT9ITKo7iDd+/94+CZhbWrBK9kzPpF/lgHn6xM2teIYjEHApV1FWlpxW9hyt6R0bEzYxoXkfl8gB36GdG8hKXFmeo2VGNEAmSs1w+BJK4YKPqMW0BVKG3+faP84RB6UQ/Ang+ex/cJHrhtKD3C+9C0CVsvd22LRbreUl8EEOhlPtUCCvu9E61oRKjnW60gWv2MGdUY6sx+oSLppmJZ0p8m4eTI0s4sX+jK/qDhPAwuhkDKwDDZ8+MGK2eaU+Jl5WShScwUBtqMGh1U4I5FjJdoSTygGxwiDftbsuKcrpnt8XJlVCciKf7wMBUluv7Ll85Y81AUkRK24JY5+N8qb/hvS5UA3QshI7BWiN6h6l5CA0QOKPUzRSipKz+cMkxY0JAY7BR07diyE85UBqokjMibKpnTKgyD+Qtc1e7j3xtJcxREd+XQkb8uNhY2KgJP2jc0fuobCYYvHwg/YWRhnJrXfDona6UcgEdFA3GMq1vCSMhgshsssW1cfOVZMAubdjao0RPcvhYjrJqV8dCeneIrdY8HineCY/GYsuxsH2xHpkYBQaNEsbbaVU/hVXUyz8KKMuR9h52C6EFXHs1CVXq9T9aZwnAhQGS6fXSddvEkmU65W5JccVy2FwsbMsoJsAxDTegqxnB2ru+vhVms1ZxN/Sjog69yLQ/scjaAF9hu2DEjHnDE0JCbIHUMKLk6R7fKW4wL5JgahFUEsr2LwTutGKWtKvPow+SnPpvbNQlC+TU0XFBlclQVQkr/uK3i1juaaKziNaL546IBm857pLYxklY0/T/JzHKaawSYMzUUBqO/Iqz/QUblLmI63/+mahXygjHQfqaq3Rqz2xw38nPPPlYs8sfp5u06/qRwf2IUfx5gr9v1 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:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 17:45:54.9820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c31d0665-5624-44fd-24c1-08dceae5b8f7 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: SJ1PEPF000023CB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6644 The EPP value doesn't need to be cached to the CPPC request in amd_pstate_epp_update_limit() because it's passed as an argument at the end to amd_pstate_set_epp() and stored at that time. Signed-off-by: Mario Limonciello Tested-by: Dhananjay Ugwekar Reviewed-by: Perry Yuan Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 8d2541f2c74b..90868c8b214e 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1528,12 +1528,6 @@ static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy) if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) epp = 0; - /* Set initial EPP value */ - if (cpu_feature_enabled(X86_FEATURE_CPPC)) { - value &= ~GENMASK_ULL(31, 24); - value |= (u64)epp << 24; - } - WRITE_ONCE(cpudata->cppc_req_cached, value); return amd_pstate_set_epp(cpudata, epp); }