From patchwork Wed Dec 4 14:48:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 847517 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2045.outbound.protection.outlook.com [40.107.93.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 0226F1F709B; Wed, 4 Dec 2024 14:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323787; cv=fail; b=dzRafIzHJsLMMs2qHJ03MZTlJHR+6k/U3U4VQLX6uPSNBMrmqnv7sP9DPY9ev+Tb+up9q0yO/HVVhz3RuKlIXZuxMO/HVSUmzrFz8Nb6VtM/faT4tXzFPLqGk/xs28sIgDMcNCoS8e0vp2ngMmCZvhX05MaHGOjlpFp+Jyrgwkk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323787; c=relaxed/simple; bh=lajOZJ3zNYtrbEAzqQu7C8X5Kz65PJvau/v8WSAw/nI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c/cxEPd/ImuQEgagQFL3sfdBVOLgju87IiRDueXjb6MreiklXqNIXiGrRRzr8VW/0HtHvzGZVdBVrOZ8oG950RjaNO/naxD8xfzMqbjRbsabMG20dLJuf1LvRJSbsX17/T0Psh4m6Gl0odf+DiNzELCw+yg/3G+kSVG+lLoTaqo= 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=gA/FoQZ5; arc=fail smtp.client-ip=40.107.93.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="gA/FoQZ5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kj95xM8xoYMOvTYAFnEQrmX97hz6ee/UhPBNPR8/tMM0cFBY6Kiw0smpeXDlMvVIyE8XjBa51WtF/8LzPz8Y454lUsZ1Xbt0b0CBvqlvgiltg9RWdLbL3objkBH9rumwFLUnD9qgLg3wUcfA5h9mUiq/mMNCejzJ9pWOis5z1Re3dw/rjuvMmGGvzuCtbFvfqlBIXYfXoYI7mt4eYMxpYanE69WK+9idL1OmtHByw0miNLc3vweQBBWz9ChHtkfiQKKxLWNMAARplMF4kAzPVXTNMpBCf9LTs70Qai7Q8CXxHlM/mis9mgSPFrMt5H7eRZpH/T42rn3TQJZoD5kjsw== 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=8JKW00FhiWKJLvZ61pXRfLgTx0yIQTaA5Wwuw0ToXgc=; b=ZFjWNxsll1By3f/h/jfXLnPZNc8MY1MyahVDdIOZSecX3umIKSy0GdgIx41/Pyi8n4hxO8VCI2fpAtw2eaH3KsU8kgdGi1xf7Q3AskTdbRSBi869HR36dWyfgERH7dL9uWRj9UnBKiC0edPBBL66KnC+hUv0iET1CfAxvmnJv6PsaVacwePDVniiXRov8f4my7ev+3v5TJIuB8iOe2mr93Hh0Cmk6sfqz638vMYpoDpRvprUcDbIOzuqF71XZqWeNnHiKwcrjOqH0KN0CSfFi8VOpb0Kmh5wHsSwGbMQ2cJnfNALSg/WO4Hk/eZXfOgAuufu/31/lvh2uzxNpgoq0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=8JKW00FhiWKJLvZ61pXRfLgTx0yIQTaA5Wwuw0ToXgc=; b=gA/FoQZ5syu1T6TKrzjFwf6M/mnoN6vedg+00VPKUz+2Lorks76hoQ52BYKsbtz1uMy+z/AyW0cSjbSyRUA+x7gHeaJDqJJ57X7d/pwKt7kFNra9xqxdf4fh2KTXfbDKmZ6c3KoXrMzL/l4PqcN7SZGkrVMkvw4aVUBzFQCXBZw= Received: from SN6PR2101CA0023.namprd21.prod.outlook.com (2603:10b6:805:106::33) by MN0PR12MB5954.namprd12.prod.outlook.com (2603:10b6:208:37d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Wed, 4 Dec 2024 14:49:41 +0000 Received: from SN1PEPF000252A1.namprd05.prod.outlook.com (2603:10b6:805:106:cafe::4f) by SN6PR2101CA0023.outlook.office365.com (2603:10b6:805:106::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.8 via Frontend Transport; Wed, 4 Dec 2024 14:49:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000252A1.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Wed, 4 Dec 2024 14:49:41 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Dec 2024 08:49:37 -0600 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 1/5] cpufreq/amd-pstate: Convert the amd_pstate_get/set_epp() to static calls Date: Wed, 4 Dec 2024 14:48:38 +0000 Message-ID: <20241204144842.164178-2-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241204144842.164178-1-Dhananjay.Ugwekar@amd.com> References: <20241204144842.164178-1-Dhananjay.Ugwekar@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: SN1PEPF000252A1:EE_|MN0PR12MB5954:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ddefad0-d021-4c29-4510-08dd1472e25a 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: g8CIBTHX2y1p31xrk5yxHXhouQI6Sc+i9mwLwioPbOrSPKns8iZ+xRoXRl76ITl5mhddBBpxcOZ3FbSuwXwIdxZsv9pimScItOXpYMUE49L6EbHpMUrtNwNkCsMDUr4ERyEgs7cOnqSLCOfNpV2MKb8hUMZT6WIMfWc1fTmGF0pBRoIPksmXEi208bfp7Zk/1KvE5sWBz1qVn4SrGftWCpNoBHHKMeUsC6rG8htA9I8LeSEfhAKVsYpvYFrtPAUcxQ+eSay3Ix6/KxJqluo4rz7TET6IImKtXlMmqMOFcVxHKxXwXM+kYiTyy9cWOLpfLdNQlco+ix5EwboJ84Ta+WFU6E2LLVKxwJaLza5LVc5IO+Doaoshq4nCuGQZNmCZRDUrdzCZvzHj2iz+3S8am52fzttHbwTJ1HqxoS14OgpmiNsbEq1ZELB/Z+JG4OJu1JxrqBQ+xmyxeuc0wC4bu7U7Zopoz9G32GHuExD1vXJDIxZuAfBdWnS+QMRKfQNnWdRUlGWXfFWLkvzeu1L2hyFjNRbVvnpd4OL4x2RDO9CBPQtq4c5WiYB85rd4pEYblw09bn9NNG6b1v2uwAJmyNU5Ny4XJ2dyEB36crCkJr5KCCYcuisONVRPk7+PdcC8SvQx3joQJnmEd7JnRPWlWZjkjKm4HKDJ9FdK7Nh/s6yMkeWxBSdF4unscdpoGjwgbua0TXKQ+sk6Yoo2bUONBRLyEe8kvywgV8JmFFPJ4TaFjusgALGl247VHmTYVcrsKT3XS0gRdnkudoDirhqvBcuhY5awx4VdJHGZXBbir8BSIPIgjgZPLaCHMYyeerOQUmPlYuKJp9th2d1oYk/2B1pAeb0/5R2PZoCi9lH0QRnKZm/RP5x8BIdrar9oZiqPmjKOfeGj8S5NIF1m1VdHghXwbnes8QwIpUlAt+NVNlVTgHqVM3DY1nG38XVDPMsdFCrkQk6ploZ9o7KrdZTfMW44Rz0VdqroB0urH8zaVTpN19FHSYJg1y7Ri6BFh38IpdLzrN7NJltYcyaKK6d5WOK59ztOrfZDlZee+CgqCRYS50GVxEwU6QQ25Ls4OfbDiwa7wzEVXb5pflvQICZPCtmXE0IlO8rupOeBWPmcykLqpqyS1L9+8pjFCYN4w4cxqF63RMkyBjfYOv77GtnZhcHsG6NIXNk+l3cpaiZLMO4BVOU1SbahhQYeBGCpQMHqdRKJ3YMcVy1t3H+8R8YpMF20eh5geXQdmeCUNbgIdVncGj0VNQA40V+mgyVcfYoPRLUTkHQQBcMOmrjUnn4gbozLHQNmSjF4M+UpqyXaNAvdcIVjHXYUkGsTlI1owETyKgVlxyg0o7lmErDgh80FzxxhU8OszAJ7c3lAfmmQolZAqFLRkP8YbbpclwM0MMQ/gU8QPLN2G/766yP8LPDTiMaWGPSnYQRP58oBy7EFr07NqyVxR2XaxZbK7HbQPUmp 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: 04 Dec 2024 14:49:41.2090 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ddefad0-d021-4c29-4510-08dd1472e25a 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: SN1PEPF000252A1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5954 MSR and shared memory based systems have different mechanisms to get and set the epp value. Split those mechanisms into different functions and assign them appropriately to the static calls at boot time. This eliminates the need for the "if(cpu_feature_enabled(X86_FEATURE_CPPC))" checks at runtime. Also, propagate the error code from rdmsrl_on_cpu() and cppc_get_epp_perf() to *_get_epp()'s caller, instead of returning -EIO unconditionally. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 92 +++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index d7630bab2516..d391e8cafeca 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -180,26 +180,40 @@ static inline int get_mode_idx_from_str(const char *str, size_t size) static DEFINE_MUTEX(amd_pstate_limits_lock); static DEFINE_MUTEX(amd_pstate_driver_lock); -static s16 amd_pstate_get_epp(struct amd_cpudata *cpudata, u64 cppc_req_cached) +static s16 msr_get_epp(struct amd_cpudata *cpudata, u64 cppc_req_cached) { u64 epp; int ret; - if (cpu_feature_enabled(X86_FEATURE_CPPC)) { - if (!cppc_req_cached) { - epp = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, - &cppc_req_cached); - if (epp) - return epp; - } - epp = (cppc_req_cached >> 24) & 0xFF; - } else { - ret = cppc_get_epp_perf(cpudata->cpu, &epp); + if (!cppc_req_cached) { + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &cppc_req_cached); if (ret < 0) { pr_debug("Could not retrieve energy perf value (%d)\n", ret); - return -EIO; + return ret; } } + epp = (cppc_req_cached >> 24) & 0xFF; + + return (s16)epp; +} + +DEFINE_STATIC_CALL(amd_pstate_get_epp, msr_get_epp); + +static inline s16 amd_pstate_get_epp(struct amd_cpudata *cpudata, u64 cppc_req_cached) +{ + return static_call(amd_pstate_get_epp)(cpudata, cppc_req_cached); +} + +static s16 shmem_get_epp(struct amd_cpudata *cpudata, u64 dummy) +{ + u64 epp; + int ret; + + ret = cppc_get_epp_perf(cpudata->cpu, &epp); + if (ret < 0) { + pr_debug("Could not retrieve energy perf value (%d)\n", ret); + return ret; + } return (s16)(epp & 0xff); } @@ -253,33 +267,45 @@ static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata, max_perf, fast_switch); } -static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp) +static int msr_set_epp(struct amd_cpudata *cpudata, u32 epp) { int ret; - struct cppc_perf_ctrls perf_ctrls; - - if (cpu_feature_enabled(X86_FEATURE_CPPC)) { - u64 value = READ_ONCE(cpudata->cppc_req_cached); - value &= ~GENMASK_ULL(31, 24); - value |= (u64)epp << 24; - WRITE_ONCE(cpudata->cppc_req_cached, value); + u64 value = READ_ONCE(cpudata->cppc_req_cached); - ret = wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); - if (!ret) - cpudata->epp_cached = epp; - } else { - amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U, - cpudata->max_limit_perf, false); + value &= ~GENMASK_ULL(31, 24); + value |= (u64)epp << 24; + WRITE_ONCE(cpudata->cppc_req_cached, value); - perf_ctrls.energy_perf = epp; - ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1); - if (ret) { - pr_debug("failed to set energy perf value (%d)\n", ret); - return ret; - } + ret = wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); + if (!ret) cpudata->epp_cached = epp; + + return ret; +} + +DEFINE_STATIC_CALL(amd_pstate_set_epp, msr_set_epp); + +static inline int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp) +{ + return static_call(amd_pstate_set_epp)(cpudata, epp); +} + +static int shmem_set_epp(struct amd_cpudata *cpudata, u32 epp) +{ + int ret; + struct cppc_perf_ctrls perf_ctrls; + + amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U, + cpudata->max_limit_perf, false); + + perf_ctrls.energy_perf = epp; + ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1); + if (ret) { + pr_debug("failed to set energy perf value (%d)\n", ret); + return ret; } + cpudata->epp_cached = epp; return ret; } @@ -1867,6 +1893,8 @@ static int __init amd_pstate_init(void) static_call_update(amd_pstate_cppc_enable, shmem_cppc_enable); static_call_update(amd_pstate_init_perf, shmem_init_perf); static_call_update(amd_pstate_update_perf, shmem_update_perf); + static_call_update(amd_pstate_get_epp, shmem_get_epp); + static_call_update(amd_pstate_set_epp, shmem_set_epp); } ret = amd_pstate_register_driver(cppc_state); From patchwork Wed Dec 4 14:48:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 847748 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2061.outbound.protection.outlook.com [40.107.237.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27D5B20C016; Wed, 4 Dec 2024 14:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323802; cv=fail; b=U4ZWFAXzx+2we8ZmjMjBDNjVpW84o2cRnoBun9dZ5yue4WZBIYrM2s4yPvUCMajYhqLRmKd40cZec0JoqCrdZVg+MymFyQo2brUeSRigGuClkyTyKQ5DC8vUllhVi9Eavo6Sf//+PgdE+N8eFJXlL4GipwP+HkZL7IDaugdWD48= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323802; c=relaxed/simple; bh=a7dm4YUq3nNQ0u9LVyA2tFX099cqxEyq5H9ddizcdeo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LFAmqFe25V+vRRHTKXKmz3U6DJ39vYH2iQIXTMp5wi6ZJ0WJNiRnUrbk1zKfn6JoRAT9GXr6uOeQz/1BThaDMoxgbRBDT7cjQGZe4geo9Tu6zmdoSwnEKGDDKZEN2629TbpRRG7vktf51MIf/oqj9L2gJU6vfEF5b2xHREIQaqk= 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=0ppwUK5D; arc=fail smtp.client-ip=40.107.237.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="0ppwUK5D" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DqDDLM/fDibDo1Q+YpVtFfBdDoSh2aWcJZkoLcfFkWaFLzjgQR6zmEYS9ntwtvKnsgTVovwg2Vn7SHWIS+CvWYV62BMn+OJLuB/xBK7f4G+dQt+MQ2fuQWMHGKnR5p4mPJGnNR7J4z533dEGVY5mtJJPptN8SFBrldYg89Bpt9cDn39x2+0GAi3cx35dIIfnPNEjhNOGuh0vozg3F5RpvdA0yxARxf8NyMs87p1w9shafj7T5IxRXgwxMyEH96dC4Wo+nvUQhN6w4GJil7V9c+os8GHDHchMj336H0So1W3ymq4Stt+bf2dYBiiInPxZQqs4P7RT8f4K5yqQ4tYcBQ== 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=82wORTNPxN1Rv3PCtL+sh3L2Ph/kRjlqIdLO4Orbm6I=; b=pXLpshXoU2v5yMBUK5DsAxqZj5Ca4m5RhunOr0ylUm3cDMzSjYUMvqR3rPAzPfAKD6lJYJ3X6fs47TuezRvfEJy+26KEdTb7lMu/igI8fJgSSn8JX73titiwbMAdqi2WjwZgZfDYTCWc6ea0Qy35OAl324BQN5kTrRyj98ZYjze6ioOskyBLpau98VjxuRtvjiAXfvydx+mTrm7FLYJQ7JIbidRXjJxbVMuy6ezYWod+7Xb5LdkigWqE+FreRqBcVHBXXbOyqZc0B62AFU0H/HMe4R7yPflv0tfkzIvxsyIYoQNaLrEyLgfFcB43bf3t9hpWRQbiNau44E0+Ny566A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=82wORTNPxN1Rv3PCtL+sh3L2Ph/kRjlqIdLO4Orbm6I=; b=0ppwUK5DAazBt3OwAWnagVI2JzwBUmnb3KyvCtBrCs0c3IPWQlzRLnjnVbkRjX+5heLZJMwhWc80uw0OHwy5RvO/FfvxVrQp9Aq02Th2DrmsxkhOvO456uEZ4WlGs2KYDHSYGc6PX/INN60SsyBcN/QddN6ASl9R2Xyx703hKoA= Received: from PH8PR20CA0024.namprd20.prod.outlook.com (2603:10b6:510:23c::19) by CYYPR12MB8702.namprd12.prod.outlook.com (2603:10b6:930:c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Wed, 4 Dec 2024 14:49:57 +0000 Received: from SN1PEPF0002529F.namprd05.prod.outlook.com (2603:10b6:510:23c:cafe::a0) by PH8PR20CA0024.outlook.office365.com (2603:10b6:510:23c::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.19 via Frontend Transport; Wed, 4 Dec 2024 14:49:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002529F.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.8230.7 via Frontend Transport; Wed, 4 Dec 2024 14:49:56 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Dec 2024 08:49:53 -0600 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 2/5] cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf() Date: Wed, 4 Dec 2024 14:48:39 +0000 Message-ID: <20241204144842.164178-3-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241204144842.164178-1-Dhananjay.Ugwekar@amd.com> References: <20241204144842.164178-1-Dhananjay.Ugwekar@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: SN1PEPF0002529F:EE_|CYYPR12MB8702:EE_ X-MS-Office365-Filtering-Correlation-Id: 60dfe545-a86e-4a83-a703-08dd1472eb7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: ZCeP06T1BsSEjUbwx/8G94jiyhIeqS9WVBWRHGdrYGo88VePqt5KvMtgHeuWUXvfSAXFJlvlks68zjXqfsCZNJBAz7+Ql4vmsvzCPu2byu53LZxcIQHzuMdJONTa7m6YXFDrKnZcrEONHC5/FZaQ0PaQLALUTATFORdQJYWHCrQmiCOghNoBQisjyf0ltDNS8mCXTenhDTNK+hROTDTdP1dQW3uSmbMaNG8L5XUYz34T0JH94Cw2E1NsZOwGoslDdpiEud1IZaTTeyJTBsbBRm9dOZEgo/AQbnvrMqpFQS9qg889abPrjR6fGw2wYkhUe4D3ZBhMUSsaQUhQQSeA/T7XyGjKAFbwTHYQOFDC0qY9ixTClUPeUp64XSdSYUBO1WTrq0DVyqVmwxv8szI1Usldtyef/1oxaC5cIWth9X9aaPIZhIaErgHmS0bNjy3yilG7sfu3i8/clDM3ao6Ra0mUx800CmGwjAEEsdRLhntYoddf7JDNLSUu5bFmRVO3Q6UQeghoIg3Sv+OSLYIykoTw0wrjH+02ZJlpHH3agiHCoGsrTDmkzgFNM/007uVhJcZna7frQQhIYSOZFV2/A7vNkysHERVzR/VKTGU4c4oPrrOq8FaNJd5/TsFVQakOjxcPys9EN9JY83Y1yWmZ7SGytcUeTLg50UqifMHBmu5gXYa4C+gJsiaka6YlVdhyhBe3tuS7HSmRc0U2yM75gi8HB8CDRXraOwRmDvQO6Mw8bpiGHX+xmUGx9cV01AAUhoDywXEdcMa6B9gwe7NyLFx/QPHGy5FJYkEPinEBf79v0WT+8fIFwfF9fohfRGgcC5fMuvCHxpYWV2VLPkDnXznCJCqMy9HPNij6lxHL8HO29/14qV38ACTKO9QQp/UB841LZ4RcxiBdTD0mWywPXAPuPbeLvdwgvSQe4Z33HDY44zAgP/zspzFiiymP52rhe3TQlP/9lNBrLxv5ISXLjqf8R1i4kgZhw+xtUbxKVRqpjN/vMPuku6rjMEch+lWpSSPtQx7xWDMypZSGoeyVg/ykv2AXzpUHbGD1tPtMaxND+t9KPtNaVFBtbDdFlIXz6d2/TVV/i5tT185+g3TGgFcdnzohAPQEQGV34fT0Ul6Q8ZwBZtDeNl7sFzteCV+dDoNK4O02dOpHt58yYhyu1Ftmyd4GQLGt8u19MTPlSAdaHK7s+z4dsj9QduughSralhQ/4KhLw5FOSzRyYjM+EkVKcd33Ja764PXuJTjjyMoD6RDkJ9EHmrIXM6aiUFQNgDQIUyCN1DjqBujMy6q1sDMd7RBcbLvpcR+ENKE2C9YHGnosYyoeQ+t2k/+i2JLqwj3xcK7/+co0xXxTroyTidZgHWnVIAIRdNrh0XHSronvw9g8g6JdjXvH9PedkN+P9AP3MFfNh3lOuLQ2btpEq/8eena8/PtsI2VNu+dRHYWAKdHDEXCGbkg4pSazc0BE 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)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 14:49:56.5273 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60dfe545-a86e-4a83-a703-08dd1472eb7b 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: SN1PEPF0002529F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8702 amd_pstate_update_perf() should not be a part of shmem_set_epp() function, so move it to the amd_pstate_epp_update_limit() function, where it is needed. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index d391e8cafeca..a1b2393cef22 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -296,9 +296,6 @@ static int shmem_set_epp(struct amd_cpudata *cpudata, u32 epp) int ret; struct cppc_perf_ctrls perf_ctrls; - amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U, - cpudata->max_limit_perf, false); - perf_ctrls.energy_perf = epp; ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1); if (ret) { @@ -1598,6 +1595,10 @@ static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy) epp = 0; WRITE_ONCE(cpudata->cppc_req_cached, value); + + amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U, + cpudata->max_limit_perf, false); + return amd_pstate_set_epp(cpudata, epp); } From patchwork Wed Dec 4 14:48:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 847516 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2081.outbound.protection.outlook.com [40.107.92.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDBD920B1F3; Wed, 4 Dec 2024 14:50:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323821; cv=fail; b=Rv++Nyv14RaTqtRmJoeFb6RJMsQdBQFkF3ZMSCzGeLdobq2ycK32WVWWdYAvQcLlGb3+BhLWM0jddeFV589OVPF2TKA7n3iH0UiGMBa112BEfWR9bQ7v11Vh5PfUYM71A7JgpUoK3kJwFOTThqr9x/TKR+7cLHoKJbWblsmCS5g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323821; c=relaxed/simple; bh=ZaEP6yqTRwZ3Up3SAFODPjJ3U/FlBENra9Ifb2XRsyc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=prJnb7F4shvPgPD2y0/vEnYySIacbuwB0Rluhpub3n83OaT253IzCzhXvymLY7RdfWRgXkY6C6T4H1u8n3iTpDw/PPpXvdZtAyVEsHzsIZbssSYem/m5nt+jO5D9aS1FoXF1jyVpL4jhHfuqfiUHUzf+qOSvgsnVU7QessbgLs4= 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=uvmlHwR8; arc=fail smtp.client-ip=40.107.92.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="uvmlHwR8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Bilrq3/ukhNPVER3ckMgZ4ThQ7nE8XGxnATMVwrfYQ2PikeFJQ1QBaUrdtayCay9FesJ5fqwdf38K/DlHQwqJYuMMOLdfolcbBbvf1DGESngmalrDkaQVcdgZE8l1QvAM8gamFkxORA/DKXHgr1eTYstsaVPA+JJLSsxcLXKRYATpXETe/1VL7vtnI6IXITCJqS4G4ziG/yRGkb9RGCSKcOyapxsarDD4nU8y4zK1VVo9bqk2nxM6vscn7wpwCGbeBgxCBxb5NY3bPZWAufKE7cAWmvWGyqh3fVOrvWzk7bpyykZODW6VWlTUb6oeeLMzfvh+x2egqgTCtXIkTaOwA== 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=jAN9rYY9devfMYPumnR1SYaZit3Iw+DAqoWH6mNBBN4=; b=GMsCYvbIcMXCtFm5TUX9w6yHyeHkiT1pQ1OLcPFFg/6sUzpQdWQbz/wzcIShzJuRXFlpozwu8v2TX0jI3hRDrIIm47rGD806QAiyzEHb72fufyDF4CvbYUzP6Tj/f15/HyjhEHKIOLTIo2ZRZMr5iXkbTV0CMAQXWGlJaUtm9rFUkXHgepGexJ9vTA+85YzIF14zeaqqnT/kiiXZT9TclYVMGH4zb0KX7m6x6otzG0DseUT7IJvyFGlgNRaa43nn6oGdoahoGb8DGVmqChUhKUG7ewOPUoF+A7NMVDC6lerkGzcD5p/52vrserEwLBGMcruAWi08z/HQEt+cd1+JKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=jAN9rYY9devfMYPumnR1SYaZit3Iw+DAqoWH6mNBBN4=; b=uvmlHwR8y4wdOjqaL66l/23jVaqbelPMUdnfk1f7Tr4Gv1o6pUOC/4JZggTfXf5CisXyiuQf4ju2NPkOG/L50eC0tC1DkYhuF7L3W8OEgf8eewbVPuszQ5bKlUovHz9t5UefqyE2D4uoBw3/69BWo5yL2g8nrv330MEjh2ibrEw= Received: from SJ0PR03CA0243.namprd03.prod.outlook.com (2603:10b6:a03:3a0::8) by DM4PR12MB8521.namprd12.prod.outlook.com (2603:10b6:8:17e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.18; Wed, 4 Dec 2024 14:50:14 +0000 Received: from SJ1PEPF00001CE9.namprd03.prod.outlook.com (2603:10b6:a03:3a0:cafe::ce) by SJ0PR03CA0243.outlook.office365.com (2603:10b6:a03:3a0::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.19 via Frontend Transport; Wed, 4 Dec 2024 14:50: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 SJ1PEPF00001CE9.mail.protection.outlook.com (10.167.242.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Wed, 4 Dec 2024 14:50:13 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Dec 2024 08:50:08 -0600 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 3/5] cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and amd_pstate_epp_offline() Date: Wed, 4 Dec 2024 14:48:40 +0000 Message-ID: <20241204144842.164178-4-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241204144842.164178-1-Dhananjay.Ugwekar@amd.com> References: <20241204144842.164178-1-Dhananjay.Ugwekar@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: SJ1PEPF00001CE9:EE_|DM4PR12MB8521:EE_ X-MS-Office365-Filtering-Correlation-Id: e87508f1-15ee-4106-18e6-08dd1472f560 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: 0ITsuS29qAo+XXzuYzrX3Z14D36HAFI9qC9e2Cz7xZkVATYp4ME/xlUt+l1WOhAmeKzO6zVbhv7rZHH2oM5lMSbpH6VxMrklOJlREObbOWfvHZuCavc6TJZ8cU4M+017AiDyOvPYvGgxSp7hMF7RDmnnGEZIN9RvmwKS+EUd6sdBnr9S3c9/kT8a5+MDzxnidodSHhbgr3E7WYB84H/b4GrFvD49n+GfL4db9yO7NOCofH5AFZU0m/dcwPr8FDp2Ccz3zOLuq6XW8ZVvI26dTqOc/s1nL/cG1S8pQ0Lnjqzwev/neiVvO2uNvBjiBI7+Cz+xeOf5j4uze75rh0czzXOP3BUERxWx6WwsL4lIY/pXeH1o5NW8nLV6C/LR1zLmTGCl0rdI++5Z4UVIXVEcVuPddZoVhM3WiqgKiQAnS+T27Zz/Y8Fi0hU9SVaG5AN7Pggq0Bag0CuBDlrAEYs89KSB5rRR9XsoSAZElReMJGFY90QtsMJqlnHhiFl7y4pSg9xPiwka04e/HGvFtx+SvEISwP6BvmOjrpT2vJX3KDnSY39LIqoPww7VAiQa7ukY/0thUw5CZYmgGiWKDqFnCHi19RaEsO4d+KRnrl71HxLhygBVSbdAJeIaxH3OHrjS6OVA5bIL9ttxkJ8HemnqCk9Dq/iwq/oYGeSgZrulrB38VF6kyrTQZSXvMKq50JRFKrDyGqunpY9va2RjOpmus1twp+qTtUMth5RYbBZ18OFJF1xN33OJbbR2Paf2+rq8kSkz8in58EQkiU6iRqaP2GKrMITpcgtntKQvzK8/KNZmiVEcLbcI0n23iotEgl85IpVJtxJCwoV8Xmp8tMi9012eRoVCHw1bI2zEzWAum2/WtgTeime1aUGr05/aKzOxtFnjC+Tq2ZntRAtWOhAfv8eDrlJjc7x2e56OOBJzfoDj4MG2fZfRt4Yab9KKW6wFgOi/vt+fjFKAskfuNCTSOnHvUlgL7iCcvNCeX/wwL9v4C5Q5qqmtuDz9/LQssbXal+Ov6IJPOTJaT5HdnQgN9eU5aDjcOyu7ql3ac6Ajwy3DdJkS3qx/a+Aov3UG78BNw7GBeO8Ty/XqSW9nAMhVxasyCDKejNoOFp/9Xd6g++JwJR/wF+/rS/oSb9BvFMYlaJAJmEOGLIgoou1HQdVYIuySD47j54sTBE71Ynv4l/0JmNU9jedANAvnsrEnfkeEYDa/WeyX8t+zKrrO/FC4IPx1LJEi85/Q4vMsgGaYW6V5vTaKvf6E3aEG5e4f82GghpBhR3zlZmeMzGjZHoFl8JNhhfNsJoMf0b5oq/a7Zv3cmszC5Vun6AQdHXBPObxUTALNcjdHjxPsYvfiRd6LoKKK2yUgM8uFykdJxauThs2vcMnHfh9ujqYwAYNWcizjumMBvqMNf1K8hArjilYVAAQEad/olYgKB10RyZE5qN9NLZMiOhG5MJu2jsahJwps 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)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 14:50:13.0458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e87508f1-15ee-4106-18e6-08dd1472f560 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: SJ1PEPF00001CE9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8521 Replace similar code chunks with amd_pstate_update_perf() and amd_pstate_set_epp() function calls. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index a1b2393cef22..a38be7727c9d 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1630,25 +1630,17 @@ static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy) static void amd_pstate_epp_reenable(struct amd_cpudata *cpudata) { - struct cppc_perf_ctrls perf_ctrls; - u64 value, max_perf; + u64 max_perf; int ret; ret = amd_pstate_cppc_enable(true); if (ret) pr_err("failed to enable amd pstate during resume, return %d\n", ret); - value = READ_ONCE(cpudata->cppc_req_cached); max_perf = READ_ONCE(cpudata->highest_perf); - if (cpu_feature_enabled(X86_FEATURE_CPPC)) { - wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); - } else { - perf_ctrls.max_perf = max_perf; - cppc_set_perf(cpudata->cpu, &perf_ctrls); - perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(cpudata->epp_cached); - cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1); - } + amd_pstate_update_perf(cpudata, 0, 0, max_perf, false); + amd_pstate_set_epp(cpudata, cpudata->epp_cached); } static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy) @@ -1668,7 +1660,6 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy) static void amd_pstate_epp_offline(struct cpufreq_policy *policy) { struct amd_cpudata *cpudata = policy->driver_data; - struct cppc_perf_ctrls perf_ctrls; int min_perf; u64 value; @@ -1676,23 +1667,10 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy) value = READ_ONCE(cpudata->cppc_req_cached); mutex_lock(&amd_pstate_limits_lock); - if (cpu_feature_enabled(X86_FEATURE_CPPC)) { - cpudata->epp_policy = CPUFREQ_POLICY_UNKNOWN; - - /* Set max perf same as min perf */ - value &= ~AMD_CPPC_MAX_PERF(~0L); - value |= AMD_CPPC_MAX_PERF(min_perf); - value &= ~AMD_CPPC_MIN_PERF(~0L); - value |= AMD_CPPC_MIN_PERF(min_perf); - wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); - } else { - perf_ctrls.desired_perf = 0; - perf_ctrls.min_perf = min_perf; - perf_ctrls.max_perf = min_perf; - cppc_set_perf(cpudata->cpu, &perf_ctrls); - perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(HWP_EPP_BALANCE_POWERSAVE); - cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1); - } + + amd_pstate_update_perf(cpudata, min_perf, 0, min_perf, false); + amd_pstate_set_epp(cpudata, AMD_CPPC_EPP_BALANCE_POWERSAVE); + mutex_unlock(&amd_pstate_limits_lock); } From patchwork Wed Dec 4 14:48:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 847747 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CF9A20ADF2; Wed, 4 Dec 2024 14:50:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323836; cv=fail; b=hBiwKF4HFCirI60f2xQ7aFK5Ps+Cr1SkGG0ncHJVR4FLUMzRXKutfIuoGFIaLDW/DEGuMk8TaElItqj9In3RweWasU2AXgQGcSGfNkyyMYyR6+ZRYYkXio1tITIk7jriFSABN8fP9pGYdm/LVLwJgEIS/P2KF+p6dQoU4jR+q7Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323836; c=relaxed/simple; bh=gqLKkOHcLQ8UxbAW2Pqsjdsm6AfLIG89krD5xF36xEc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZiJTRqe8Io/zj8Xx8nB304S4IFEHcSpc6roI7iJpWNm43lNAv8jMLcZXVe/bQwDj3Z2r015cShIhFsrtF4a6dUDbdZofKviAS93Rj0rbNoOaaCLLXf8twpXMsa4zWIam7d/RFNXTaYQE6ELC7MysVg5PowDYdydK6Rq8r346i5c= 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=nCMDLnWd; arc=fail smtp.client-ip=40.107.93.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="nCMDLnWd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hrGWxWDcvziwxGNKDFIqF21ToUqkNcHj62/XyUuZK5UEnF7AsIHadehnTNimtLG7IiCTPb+9cBHggqgeeWglZooEpzBfnCJBMLe4C3vku9ThUNJI0fB9ZDisLGzvBm3o6zorw36HlDdH1Ve7AQSnj2wV7JgZRCd9gQKnRy+qcA8pJ4cHBoZubXOLEcCbDGdvz+rjO0U383hj/g/hI0wdGvPIyOKXCehzZWS3uoqasaeflZI91RcpqAfl6J5tJPHMweA8GXMNvlNin+3vMdp/y+yVCkEkQ3ENJrZrbr6JMDo1tLNbJehxm5QteBLrTSEt8MMds8fPZjI2gdshhWgeGA== 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=+9E+IPuG72e8SC/XTBZkRSoTBQRWf9sqlCFIJVsaplk=; b=QaWtZQRHv4+/9nyNs6qNcwQiUhvk+FR/pI8kGU5e+6iQhjQ+Em8q4sapWwuqNP8GJWNULnVKhVEyhIDrRkTIKlQzCdyh144ovDxrS978PN2yNlRle3PlDEAB4c8Uq7/NSUXbrYJtwlpk174CJAaol1lFPRfTT9dZAj10LVubNnu94+9yHoCOQu7Cds+RCRbyYy3EBAZk8iIo7QEFs2c7fWDwlcq/TB3UfAtZdAe8j89cibkxZhsTfIzfaLWoTndV48BBMpCL3ej9shBx591rsx0u/nTwan7lJMoEoxVYrKn2Dhqqz4MQSP87FEWqb06FDA/KTYsFbaRG7jFbHLUB0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=+9E+IPuG72e8SC/XTBZkRSoTBQRWf9sqlCFIJVsaplk=; b=nCMDLnWdMH5GW8nxu8jh4/SZIKPO/hOYpsW4Hiryj53n5LyBYt3Kd1ZqwSi/f672OADHQ+Aoe19qirotf/Az7xrVifAQRKMlgdLxwxmEFzlYO9oh6uL4JTxxq5l+eCXLVWHc6Fh0ZSxwzqQVjPa32RSi2Qy6iT+BP/QoPy5O124= Received: from PH0P220CA0009.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::13) by CH3PR12MB8282.namprd12.prod.outlook.com (2603:10b6:610:124::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Wed, 4 Dec 2024 14:50:28 +0000 Received: from SN1PEPF000252A2.namprd05.prod.outlook.com (2603:10b6:510:d3:cafe::5) by PH0P220CA0009.outlook.office365.com (2603:10b6:510:d3::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.18 via Frontend Transport; Wed, 4 Dec 2024 14:50:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000252A2.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Wed, 4 Dec 2024 14:50:27 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Dec 2024 08:50:24 -0600 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 4/5] cpufreq/amd-pstate: Remove the cppc_state check in offline/online functions Date: Wed, 4 Dec 2024 14:48:41 +0000 Message-ID: <20241204144842.164178-5-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241204144842.164178-1-Dhananjay.Ugwekar@amd.com> References: <20241204144842.164178-1-Dhananjay.Ugwekar@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: SN1PEPF000252A2:EE_|CH3PR12MB8282:EE_ X-MS-Office365-Filtering-Correlation-Id: f117871c-0c27-46a0-0b07-08dd1472fe1f 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: 9N2Yfe63KY2jMHDLbl0w6sOGumCIOOBXbeSZCd5gbUi2V/qF1i4OBEt8K6JHyj6hnQTLZxLG3a3Fb4Vnrz5lAOMZQ2eKU4GuYK8Y9QTVGfSWwT8n7Y5TK1oFi9mzTZj/PZSzm0fLC5sI8cTqMz2XJPcr7r+Hqn1va2HtG1K5DHHsxBfbvCPic/CTe5o9zX0eQ/1Wrbolk8w/LtFEP9Cuwt/WBSnXLnQzIQkkTcattVyIChK395XwxZaXeP1xmr8qRAKqaWeYgt/v1OZ+dCe43zaK9r4zDnwd9uxkBxZfoYxcOu46F+xUcYDhy+6hZhr5Zr1TL3V3UD2TNjvBv61l0Aod+GqiagzkPDLfRfP7Sl5lHCnw/L0MnOnWpcho+PqcGpJYllqHZGzd91J+zwNrZf9M3bk3EIKtguyDwa6vs6Y4PHG5FvtKNSnGCLQK1NstW9IJobs0JoMLfG4nGRKd6Ty4xNcRAHf16/A+qimJ8sjeEP/i4JjeQZOhY/UxOshJPfjfgPgfoENJ4UU12SKHNLb0eRc0FNHFYl+bqv2B9GMVz8etM4DAdlpS9x20p6/WCYAwxbXFWkdlGNCQX7vOJ7H3QH8A1wvNXKPk8QxF+ouSQuHJBvh3CMN7KB37FkUVNr/G2wdMA+7i/RvYra4RzBSSQ9jPrIOfTj3euvpOvaFf4wZcrlj2nTa/d+Sb5mou8/BtK9jKeoQFanktvQxCoy+3i7yvhV6iY14Ppb7SkAbIGLqv98H8qcMSE7JFiz6YDJOqfekipjTeaeReUd7K46vjn+irPaqsqXTUnViv4lPbBy7YmuQE+mFXtGVlAsy+j/C9hyJ3rY7fzeD0VRAWtgk/Tc+qdXu7RuNboZuVJrbebWac3rOGf3amfRq8ye6GUxL+gcMLyt3MBkj+aGEayTfJuH2s82zaQKX76eCUdpMgMPX/EgiJ4+IreeKAyMxpoosF1w1daL6ezgpLkWYjhW/TZBOLyPpzhs+IRhevyvbnmahXXQim1EgTqQ7nDZunM42BhrLUoRP5D5rt6m6sQsCcZis109XjWwVtZgR+Byp2ZhUYWRXYN6RMJZopyUJ39TgpKPzrzHQiz8V6On4INRWMfeiJsPQHit1F9T51nEgNor0PEP7AXBvPP6nXeBMBHGAkY1H3PfQ6bN9XMUHm24d/PsQ6bcRE2PVPnq9u/K2YV1eXai5pttybmiFingXcCNpBFlNLgUrHlpPBnxlBK8yZBakx4XK/HuczAzuoeRnTETu0xlUjnoO+7rLCCNOcoThYanHOPpZbdjfTWStwgWcE8Nhnmyd8UXTO2F5zSRA/ZtJ1FcPpO3uCa2sV498hwL7nsbGVIhzw4zr7P0bKpksdpKIAZbCkbBMHAuJdFLs2deW3yjYyv0t2wCgHtPJzde1OrRtvwud8T1R19qk3IoUfS3VwDWWwWTyVhPOV8aFkFLS0hLZ8bFFOx6TiQTxu 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: 04 Dec 2024 14:50:27.7971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f117871c-0c27-46a0-0b07-08dd1472fe1f 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: SN1PEPF000252A2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8282 Only amd_pstate_epp driver (i.e. cppc_state = ACTIVE) enters the amd_pstate_epp_offline() and amd_pstate_epp_cpu_online() functions, so remove the unnecessary if condition checking if cppc_state is equal to AMD_PSTATE_ACTIVE. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index a38be7727c9d..08a10ef7aa5b 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1649,10 +1649,8 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy) pr_debug("AMD CPU Core %d going online\n", cpudata->cpu); - if (cppc_state == AMD_PSTATE_ACTIVE) { - amd_pstate_epp_reenable(cpudata); - cpudata->suspended = false; - } + amd_pstate_epp_reenable(cpudata); + cpudata->suspended = false; return 0; } @@ -1683,8 +1681,7 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) if (cpudata->suspended) return 0; - if (cppc_state == AMD_PSTATE_ACTIVE) - amd_pstate_epp_offline(policy); + amd_pstate_epp_offline(policy); return 0; } From patchwork Wed Dec 4 14:48:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhananjay Ugwekar X-Patchwork-Id: 847515 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2071.outbound.protection.outlook.com [40.107.94.71]) (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 E4FA820ADE8; Wed, 4 Dec 2024 14:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323852; cv=fail; b=jMM//FH9bfTFY4UBqhlTr+9o988u6GgvUVVH9m/gQ+41NVqT0lxfjgL9UoT9tTRC2fXmAkFR6B4zL+3lrhc4jIO5d8q0ErnozO9kfwWXDJTOlcB/KfkocY2jf0ySeC84opg+n4KmjOLqEZIZ2KLcj0SJU21MXY6mwTMESO3Mvfc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733323852; c=relaxed/simple; bh=lM8g9IonuBVsR3yiRFWJFDhtKkqh53YREPOzPgTKlj0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U52pTGd9UbHKh0q9UpeCgcdnq0lssCRN2Mr4MFPHZUcI/7VsPCGSAUb0ljnc1ExruKzwn69oxAEtd7+H6vIeIrs/JXDTAlSDv7WhyxeWjCCzQ06aRZv+LBr+d0Mu8Q7+DFyaFxzxfNzb+v3k/bFJJtflExklL4ogxD3sHacTD9Q= 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=ca0Cy6xe; arc=fail smtp.client-ip=40.107.94.71 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="ca0Cy6xe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aNwGtuo+1MzUowcchsbyAzSrH/qLzPS1BAIw2NYfZS4c5s4mdM9YRRRRqE/aDjn+ENh0AdCHciQnhP+y5jivifdczs5YgKrTriXBCZUIXklF67YaDdPAhGuCdEPksj2RIq11Osd8adxmo74zzEJDXs4KCuZ/hvOyubWINUMuPf3QRs6y14cEYPDTmVFRiwas+l/gTfAt2k40K5FEAS6aLk4qnS3GykmwpIZTeWqCXlBThtw+847hpKp6XvDIBeP3gg6xGFYDzKQ8WAm2nQF1NkIEUqTsAOeAnX3VubSlJDJEgABYm6caDFF1yJy5x6XhsjKdtDb+ZKBtq+PUGkIAUw== 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=Sg8wdDAQS4KVcKon6AeajUBsitYeJKKNANIlCeGVL/Y=; b=UjhrG6+MqmJGW4uNgvS6Gsh852LPUbFO4WD35d14r45vNbeNk393S7H+e1aFaW/VE2diUL1mLeKZMOW7p8TVWwnIzwLxhs1v2NhxaRJoOxn199k8i2Hsnhcr85B0d3YywOg4zigJ2lH3nYwKyTiS58rTIGOZQ3G88jtFNRBSBs2FT4o73AEva32nSwipC4gVBeBkoAd+hGFinVD0tGqbDObIQfyNejQfhN6DdVeo1Ma0nEEhIykLPt2voVLb2OD2oGmueIztLSdIZlbyXNUO1mj4itmLpujMTxVRRfuCzLDYP3Ri+BvbOeQoTuz3mW9wOQBOwuesqzR6CHX9MwhrbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=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=Sg8wdDAQS4KVcKon6AeajUBsitYeJKKNANIlCeGVL/Y=; b=ca0Cy6xe3Cyp5IMlAyokIY+L7mdOx4ADkCfQAwBeSjqCZHhQUypnLKPrPX/JquiPiS9ayJBnjAcbOZoyRrMqKhBJTqQX827Fvpb79F5LC4hpRjE6mshsjkSDeSFpk02gKH+GNip40ojliE3oOGwOhH1QqMi5LWMsKWmrVEf7NPs= Received: from SA1P222CA0153.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::17) by PH7PR12MB5758.namprd12.prod.outlook.com (2603:10b6:510:1d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Wed, 4 Dec 2024 14:50:43 +0000 Received: from SN1PEPF000252A4.namprd05.prod.outlook.com (2603:10b6:806:3c3:cafe::7b) by SA1P222CA0153.outlook.office365.com (2603:10b6:806:3c3::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.19 via Frontend Transport; Wed, 4 Dec 2024 14:50:43 +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 SN1PEPF000252A4.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.8230.7 via Frontend Transport; Wed, 4 Dec 2024 14:50:43 +0000 Received: from shatadru.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Dec 2024 08:50:40 -0600 From: Dhananjay Ugwekar To: , , , , CC: , , "Dhananjay Ugwekar" Subject: [PATCH 5/5] cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and amd_pstate_epp_offline() Date: Wed, 4 Dec 2024 14:48:42 +0000 Message-ID: <20241204144842.164178-6-Dhananjay.Ugwekar@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241204144842.164178-1-Dhananjay.Ugwekar@amd.com> References: <20241204144842.164178-1-Dhananjay.Ugwekar@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: SN1PEPF000252A4:EE_|PH7PR12MB5758:EE_ X-MS-Office365-Filtering-Correlation-Id: f423e94a-0399-41fa-d6d4-08dd14730790 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: Rmsyy1ZSTbi4uy3t4Ir7DKdjT4UuXgePPsmACrtjAyS5HLltooZiyvLNRPJsUzV77kvjpEDbahn2nUbcNw5M4VuCnQ2pmM5yZjlWLy6z5JxEiUtbxFUEkpgNBLNSgkNqySbs/axE7cDR0GpOLXUc5zlP9UoQRj1D9aMl7z2ld9GntUbvr7+vD7IJosRHAwiCy/N7Sn6csYm7ZQvhEd1SoY7dwQZG8BF/eamovSlqOeH8X+NjzFtaEC3f3y8Uljh28zmmyc+uQwU+sZAgV8xqljkzi2G2uTTV3LTCGYqhKtbqW3yzB1iolyYekp4n3rmKLeCPWMggWJhGKE6yd1IG0chiDrc4yzuy6kSH6WRMUeOkzBfzZ+YUz/trQsxKwLXEuEY1I3uaA13nYMYSQpwf97F9teoKzZV8Up7kLM55ESkFrVAWJujAbaNC06xlQ2y7mtsAedXucAAl++TSue7R/W2FvGVP0Xx6GlefVO1AHMptssN4woAeuw71MXZFboRfj9AZkyBEcjlPo7R5QJzSVLwFGlwp9cEiXnD9+h8II6v47PYAbjmpGhrj/QhHbbuKmrum6qz6XaKqa/vhba+oBM0vnRv2hQGHOLLMqFULFeAC/4/8Mm0rQ6uxNMYNcCHJ7bCed+I79k8Cuwp847O1TW7a18lY95JDmp3eTBVIEfUQI3AmMwe+fz8yCmZej63aEGUchYsc1xe20URWsa/+OW4lAMBIZNI6US+5g2w/3eHeRuYBnsWocmJrY+WbiqSy1/jowQm8Pat7f0t0ayF0nDUujxV0t6i74paMOfFmGo9CGz4RsnEE6s7xPeO6rtmctjETY+L9HV4R6WBo5hgUNO1SSn910VAUfNGRAlwGS7dGvdwf21FoAgMe1uLf4PC6uCfB7WZBbBVfooitExdQz3zcCex8JBYWWV5UE431mYpY9/Sn3XngZrHmyn8AqXo3FSHELFROdTgB9J4LivEEvnbVhJY1L7i2zFVW5Uas6BL8v8GA9cIXiJ0JvUQaRWLBUogxTdDBzFxz1RJR8jeYD8SP0AQrrh6FWZi92yniyy2IazrFO80HMoJqCtxuuNLyHW7207jt1xGGons4Qnw1wB6afU4MefsP3oDfKhgIyKzhk6E0M4hRF54o6Xqvk6sdc16kEzKFg2xMn/NoGv23yZftoGzCe/qunMHyw9i/Z7Z/mnHG8muzC83DM5NHFo7CGtAbr/4Z1uJFmAK4pMdk36mglg5IpIAMigr6r8VksXz338GcEg5RGkM3glgP6IIN9olIXaL8fk2cqehSZnpdegqFZPHRGunHFrVUFFuMfYwycx+nwF92X3YTT/ZpE0KlyyIqlY+SzNh4uJ02ubTwQ2sjwlY8Ts4zQy5LzXpwR6JFMBS7ZG+BY1MUJozlkNJBONCcX4334wiXj9aEZrvXaI+XT4NS1TxQ4TuyK4oKx6kVD+jxsOqiOg9QpR8tF8po 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)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 14:50:43.6424 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f423e94a-0399-41fa-d6d4-08dd14730790 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: SN1PEPF000252A4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5758 amd_pstate_epp_offline() is only called from within amd_pstate_epp_cpu_offline() and doesn't make much sense to have it at all. Hence, remove it. Also remove the unncessary debug print in the offline path while at it. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Gautham R. Shenoy --- drivers/cpufreq/amd-pstate.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 08a10ef7aa5b..298065912976 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1655,12 +1655,15 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy) return 0; } -static void amd_pstate_epp_offline(struct cpufreq_policy *policy) +static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) { struct amd_cpudata *cpudata = policy->driver_data; int min_perf; u64 value; + if (cpudata->suspended) + return 0; + min_perf = READ_ONCE(cpudata->lowest_perf); value = READ_ONCE(cpudata->cppc_req_cached); @@ -1670,18 +1673,6 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy) amd_pstate_set_epp(cpudata, AMD_CPPC_EPP_BALANCE_POWERSAVE); mutex_unlock(&amd_pstate_limits_lock); -} - -static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) -{ - struct amd_cpudata *cpudata = policy->driver_data; - - pr_debug("AMD CPU Core %d going offline\n", cpudata->cpu); - - if (cpudata->suspended) - return 0; - - amd_pstate_epp_offline(policy); return 0; }