From nobody Fri Jun 12 12:46:09 2026 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azon11010032.outbound.protection.outlook.com [52.101.46.32]) (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 E217D3CFF75; Thu, 14 May 2026 21:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.46.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795818; cv=fail; b=Kf7VzluSZyq8hOllHAA7dOJ8iMOa1ffvKyNBtoyGv3W9tvuQHDvLSmjLrcF9rHYV0wXUaKH+CbmaTHRM7BBQ4OMghP84OWePuGQcPMkmAVDiBWY4UTQ380o06+W86sLJF3k96ZhHEJsZ+7u5FJpic4lAZ4R6LPMvIo1hCd+asZk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795818; c=relaxed/simple; bh=zbamKeOKSMgAcoYm6qDK2tLUZCLbcWUrpTUUJwISA3c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SEexJ0gdSUEoOuDbf3kny8jaxmEy/jxby6X0h+ZkiyjW9cTD0K1fJLRQP+JFIAQAwKR8uC1BhelbVNw76iuPqedaDT0rIpW1BTV6a/8pH9N0E34iJ/QTlwqTVC2BaFccS5H8SWVhdm+R5Xz7XWzBxDw9VsRpK3EWv64iJRodB5w= 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=ohnIpMth; arc=fail smtp.client-ip=52.101.46.32 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="ohnIpMth" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iuxTf9k2yp3a5fwu7bQHOTAGBLBKJWZ1BWx0u8aWug0ZwGiBp0fYJJFHXJ4Y5Kj1EWqviKYM6PkV8w9bZifU8c6rE1dI1ahzjSbgMcSZ6dtLsS1Gn7kV4ysJs7ZKLmE7MRtqLqw7/fjwauPEgPauoD7KPkFdN/mxbuKAjDS+N0IfeJUlbKx8aVCknIER0GYXiz7Lwgvmrh+k8KDZ9OcLEoEYV/M9F4qMbLchHDXcatkIVnT/wiQSn+VxN/0zLpMADoqsVKn8MCsztV9gTMaWjhx9fvF3w6aL16u/2r/Cfou0M2EkCw46S3RUNrtHlD8FqDvQBW4vLTb7dk/WGKIxFQ== 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=LIn0DdGD+iz/INFdkv0amtRpN8Rv5do3IeKwO2rH4aY=; b=ScifATzGkj6oFdfkPi5/oVq8zb4q2N+e9qtjPZekwMFsmCqZ20o3TgVEZWeT8CT5HsxLQh/zVAE96jJzppPyHgNIIymazu4CImOXktZuSbEDF+tj2GyA8VGlAYAFDzfJu6Lr63eTKEvH59cQIBSx6E+tLWgua5a4XlQaN7R0ifayrQI7ZegF7Y0ks7rV5YK6TrlmaN2YRmob5XsDKB6SNbRFSfgS/iwAzNLWpVrJnthObGhzPyxtLVMDBA7Mxek1LSC/1EyF3UtmcmDeTqvOqmz2y1t70QfrvhI7X/wecjW/HtZdS//Jr3N//Pkx8oe7WjAJHV+etC8/MWvJMF4LuQ== 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=LIn0DdGD+iz/INFdkv0amtRpN8Rv5do3IeKwO2rH4aY=; b=ohnIpMthesYjTSAbr1oPFDiQMhkVdCFh46pkES6l1QJVr1wft0PeLbkHkqa03LH8g7FzdujUIjGY+dBHDaWuCT4LPWgKmS8OY2VguSylU45GvVSCH1oaWOFN1njTVgqWr6b5JOaIAjt7ew9FlwMvy3oEyZAoFvtQC2izPC03Wiw= Received: from SJ0PR03CA0186.namprd03.prod.outlook.com (2603:10b6:a03:2ef::11) by CH3PR12MB9124.namprd12.prod.outlook.com (2603:10b6:610:1a7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9913.11; Thu, 14 May 2026 21:56:51 +0000 Received: from SJ1PEPF000023CC.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::be) by SJ0PR03CA0186.outlook.office365.com (2603:10b6:a03:2ef::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9913.12 via Frontend Transport; Thu, 14 May 2026 21:56:51 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF000023CC.mail.protection.outlook.com (10.167.244.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.13 via Frontend Transport; Thu, 14 May 2026 21:56:51 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 14 May 2026 16:56:48 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" CC: , , , K Prateek Nayak , , Mario Limonciello Subject: [PATCH v3 1/4] ACPI: CPPC: Add support for reading HighestFreq Date: Thu, 14 May 2026 16:56:23 -0500 Message-ID: <20260514215626.35327-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260514215626.35327-1-mario.limonciello@amd.com> References: <20260514215626.35327-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023CC:EE_|CH3PR12MB9124:EE_ X-MS-Office365-Filtering-Correlation-Id: 47239016-99c5-4c13-a550-08deb203b469 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|82310400026|376014|3023799003|22082099003|56012099003|18002099003|11063799003; X-Microsoft-Antispam-Message-Info: gm1stNtuw5OYyZOg7vSbPLG2UUEiEMIdOYqPgIT/2wAkMUL6oABIkK+noZKTQrv3VPUUo0LouRvYHWBYQx7yc3zlCa9ZDPaFRSW96bRV7c+k20dsqae0YF9WJ05U1ixeawygoXugw0cf054Za559WfjY7vNWoBMDhoaLQfYtAwN82ZgvYXorGj+ZjGe8TRiYMiAA6tnewBEw7eMRPVsi1imPKxYO9O19Y71N+TXKafV+gSGYGk8/NX9BOGLzN2rKOhk5JNAM3/wWEFL+eBD8NgFcdA/SjUjGJ/rckh6fJxYkCcx0dZZcQdmSTtuibr4eTMBdChtRQz/FpHHn8be6YIYPjjr54tE7pGwy9OMmv9yCy8toROq50ePhbzYbNAc4XIyVQ/k9Wa1+TsuvVWxMX0zHAiC2tMRoBpHuSSOSichJyUPWvY+YNTpdB9AQXOltxG9emG8luME7a8uOFZ78PVtqydXXzMElO9mkgEGqabOaud7E+W97a/9AyLk+OUkLEUFXbqH6ZzBNK7BQO1Tr0A59GHAh9TUfOG4Iu4EziIpRxUImXIVWIqByD5hyjekkpDVTVZ9jspf/4auaXZYzhZmVd4KQ5yS3nOjgLarmHyCQ+UAZh9FonkNHBLRVhiFU53q5uoinnFwQXa8NNU55kghL9CCYEpORNuMLxp5M2iR2Z6Y/yfhXGRAs78QztzS2vuO6oHEMT3yCJAeHv5kPJIdK8m/jXXw6s0WshyR6fbQ= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(82310400026)(376014)(3023799003)(22082099003)(56012099003)(18002099003)(11063799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y6+mmKuOppQTH1dbSGJB8xqGJoufYBR+60Q4zlYC9G2wNdeKN/qaObO6LWOJ3kIESO1HddE9wfQaXo6Ixl3OPqSBYRx4kWmF4BCrCRQhx9sHKnWV40PwBRTk5lQdq3e/VD+IslUJlLqi+sgjyCPqCqkJNQtAzy5A3KQS1xYdIvzwS2H/H1mqp4o8tHouIfMxN6zYF4BsCzbZrr3T+7uO0NNoWs7kKicjmqdYDwzp0+/8OmPrrNW42hFsB0TX5geGAxA8MdLOPhqzsXTcgeYfM+V2/MW5D2rlWUCP5Di5Xx4yJaLX9PieJ0xwkMrECd46NYK3qr7+iB+sw5mLkEY6ipxq+NdVNV/keFZdDBm0RGQ33BHToMJVXSvUle4hcj8FavzLpHOqaPS6ckYGqQ8NG+Uw7o1Sdn18gdgancLbCAE5ffLuBEFiEzNk3j9aaRJd X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2026 21:56:51.3313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47239016-99c5-4c13-a550-08deb203b469 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023CC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9124 Content-Type: text/plain; charset="utf-8" A future revision of the ACPI specification will be including a definition for HighestFreq. Add support for reading it. Reviewed-by: K Prateek Nayak Tested-by: K Prateek Nayak Signed-off-by: Mario Limonciello --- drivers/acpi/cppc_acpi.c | 31 +++++++++++++++++++++---------- include/acpi/cppc_acpi.h | 7 ++++++- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index ad6ece16c30df..befe3e3136a6a 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -134,7 +134,7 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); * cpc_regs[] with the corresponding index. 0 means mandatory and 1 * means optional. */ -#define REG_OPTIONAL (0x7FC7D0) +#define REG_OPTIONAL (0x1FFC7D0) =20 /* * Use the index of the register in per-cpu cpc_regs[] to check if @@ -182,6 +182,7 @@ show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowe= st_nonlinear_perf); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, guaranteed_perf); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_freq); show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_freq); +show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, highest_freq); =20 show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time); =20 @@ -222,6 +223,7 @@ static struct attribute *cppc_attrs[] =3D { &nominal_perf.attr, &nominal_freq.attr, &lowest_freq.attr, + &highest_freq.attr, NULL }; ATTRIBUTE_GROUPS(cppc); @@ -756,14 +758,15 @@ int acpi_cppc_processor_probe(struct acpi_processor *= pr) if ((cpc_rev =3D=3D CPPC_V2_REV && num_ent !=3D CPPC_V2_NUM_ENT) || (cpc_rev =3D=3D CPPC_V3_REV && num_ent !=3D CPPC_V3_NUM_ENT) || (cpc_rev =3D=3D CPPC_V4_REV && num_ent !=3D CPPC_V4_NUM_ENT) || - (cpc_rev > CPPC_V4_REV && num_ent <=3D CPPC_V4_NUM_ENT)) { + (cpc_rev =3D=3D CPPC_V5_REV && num_ent !=3D CPPC_V5_NUM_ENT) || + (cpc_rev > CPPC_V5_REV && num_ent <=3D CPPC_V5_NUM_ENT)) { pr_debug("Unexpected number of _CPC return package entries (%d) for CPU:= %d\n", num_ent, pr->id); goto out_free; } - if (cpc_rev > CPPC_V4_REV) { - num_ent =3D CPPC_V4_NUM_ENT; - cpc_rev =3D CPPC_V4_REV; + if (cpc_rev > CPPC_V5_REV) { + num_ent =3D CPPC_V5_NUM_ENT; + cpc_rev =3D CPPC_V5_REV; } =20 cpc_ptr->num_entries =3D num_ent; @@ -1364,9 +1367,10 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_= caps *perf_caps) struct cpc_desc *cpc_desc =3D per_cpu(cpc_desc_ptr, cpunum); struct cpc_register_resource *highest_reg, *lowest_reg, *lowest_non_linear_reg, *nominal_reg, *reference_reg, - *guaranteed_reg, *low_freq_reg =3D NULL, *nom_freq_reg =3D NULL; + *guaranteed_reg, *low_freq_reg =3D NULL, *nom_freq_reg =3D NULL, + *highest_freq_reg =3D NULL; u64 high, low, guaranteed, nom, ref, min_nonlinear, - low_f =3D 0, nom_f =3D 0; + low_f =3D 0, nom_f =3D 0, high_f =3D 0; int pcc_ss_id =3D per_cpu(cpu_pcc_subspace_idx, cpunum); struct cppc_pcc_data *pcc_ss_data =3D NULL; int ret =3D 0, regs_in_pcc =3D 0; @@ -1383,6 +1387,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_c= aps *perf_caps) reference_reg =3D &cpc_desc->cpc_regs[REFERENCE_PERF]; low_freq_reg =3D &cpc_desc->cpc_regs[LOWEST_FREQ]; nom_freq_reg =3D &cpc_desc->cpc_regs[NOMINAL_FREQ]; + highest_freq_reg =3D &cpc_desc->cpc_regs[HIGHEST_FREQ]; guaranteed_reg =3D &cpc_desc->cpc_regs[GUARANTEED_PERF]; =20 /* Are any of the regs PCC ?*/ @@ -1390,7 +1395,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_c= aps *perf_caps) CPC_IN_PCC(lowest_non_linear_reg) || CPC_IN_PCC(nominal_reg) || (CPC_SUPPORTED(reference_reg) && CPC_IN_PCC(reference_reg)) || CPC_IN_PCC(low_freq_reg) || CPC_IN_PCC(nom_freq_reg) || - CPC_IN_PCC(guaranteed_reg)) { + CPC_IN_PCC(guaranteed_reg) || CPC_IN_PCC(highest_freq_reg)) { if (pcc_ss_id < 0) { pr_debug("Invalid pcc_ss_id\n"); return -ENODEV; @@ -1453,7 +1458,7 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_c= aps *perf_caps) goto out_err; } =20 - /* Read optional lowest and nominal frequencies if present */ + /* Read optional lowest, highest and nominal frequencies if present */ if (CPC_SUPPORTED(low_freq_reg)) { ret =3D cpc_read(cpunum, low_freq_reg, &low_f); if (ret) @@ -1466,9 +1471,15 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_= caps *perf_caps) goto out_err; } =20 + if (CPC_SUPPORTED(highest_freq_reg)) { + ret =3D cpc_read(cpunum, highest_freq_reg, &high_f); + if (ret) + goto out_err; + } + perf_caps->lowest_freq =3D low_f; perf_caps->nominal_freq =3D nom_f; - + perf_caps->highest_freq =3D high_f; =20 out_err: if (regs_in_pcc) diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 0b1dcdbea10a2..eb1eb40c6cb8d 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -21,14 +21,16 @@ #define CPPC_V2_REV 2 #define CPPC_V3_REV 3 #define CPPC_V4_REV 4 +#define CPPC_V5_REV 5 #define CPPC_V2_NUM_ENT 21 #define CPPC_V3_NUM_ENT 23 #define CPPC_V4_NUM_ENT 25 +#define CPPC_V5_NUM_ENT 27 =20 #define PCC_CMD_COMPLETE_MASK (1 << 0) #define PCC_ERROR_MASK (1 << 2) =20 -#define MAX_CPC_REG_ENT 23 +#define MAX_CPC_REG_ENT 25 =20 /* CPPC specific PCC commands. */ #define CMD_READ 0 @@ -113,6 +115,8 @@ enum cppc_regs { NOMINAL_FREQ, OSPM_NOMINAL_PERF, RESOURCE_PRIORITY, + HIGHEST_FREQ, + CURRENT_FREQ, }; =20 /* @@ -130,6 +134,7 @@ struct cppc_perf_caps { u32 lowest_nonlinear_perf; u32 lowest_freq; u32 nominal_freq; + u32 highest_freq; }; =20 struct cppc_perf_ctrls { --=20 2.54.0 From nobody Fri Jun 12 12:46:09 2026 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012002.outbound.protection.outlook.com [52.101.53.2]) (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 17CD03D16F4; Thu, 14 May 2026 21:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.53.2 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795819; cv=fail; b=I5fPDgtDz4o2PpuJblsKMcDCQhoIYP0+5vforGWSDCJ1hmDJfTuKZoz5IO26ETK2J08hKhkZSGtRndUVVR9nikH7IWTPKscrtafH6F/0SvE9qx8N7UsJKKEmqGyfbDqK6NTWftej03YVbpeGJQH4W1rqsTzWEPdJr/RB9Q9CAbU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795819; c=relaxed/simple; bh=//GmgP13M6QTUZpfMgWk7gG/bnHtPeJFTloKKDMzYB4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CuLQvINkDrVIOcqg5MdEUHDF7VGPqaQy7Olfn9Xj7tzZOR/pUKlaWE569Q8MtY84uPxodBhSLvatDqa/8yr58es0+ODlMN9iU73NAG84HKt/dO59CALYom/s5VHVxWUbitKIBv9tkD3pevDMWawjoiazXR+eV6gGaTxAOaS5G3o= 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=NiVmP488; arc=fail smtp.client-ip=52.101.53.2 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="NiVmP488" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ibnhdx0ZEJLSXCewcIarLP/5wuRV86qAmRN28HWALt8T0I4v6knIKrNpFIP6gUz5zsC9Nx6NAxlr1RxbRRmmcfqcZRgF0Ag2tdjqQNbQm4H98WuhENnguhVlnh9JTBd55zJLZ4UH0OA3T13psEqxGpKgCf7dGbkJGu07fbR4V3VxQmcZAwYgiUUBy/v6wBdWREh2XugSLQNBH1bXctvqdaOGgEmw6KXS0w0NIk+zQzONvonEjS7ltOu1cBvmlgRvXjBtLoOhsS7Jh4nzSrl0/43UZ6BGHqHC54vTNCg7G8QWQWLl1CqhKxYcrJ+IENHcHauUUQ6MhE9fS+QYQqqDJA== 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=21dPsFUFTJS3lGet6JPWH4cDz76nGpKqyzrhD3V1gUk=; b=vbUTIrZHSgdRvU1+UNjhQIL6eY50ogiTL0jL5klivHn2F2wdyQtH0W0vWVnhUFur5CQ9jSEmdRKXbKiX4qBAc7CZh/FUaVLnxWVMDimzUUN3HGCJwTcPvhqzHaGKyMN7sxvSOhEsGUsTgdeWjfbiYHo+2b5c7VheFIVZerjqsx1i7TgVDYZVrqK29KOX/5RkgDREGGSCuBJmVlGYMCQXlfpOu/Z4ZBMLjSZwPE6q/OsfWzuM5xkkZENvzLZpuqeiimO/TjKD5bRCMnS1NwGb5EZmNGh2sAdLMR1qnx2t40cvtGW7rTun66+1178SPJbEWA52vlpaXVkb4HcLwExDjA== 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=21dPsFUFTJS3lGet6JPWH4cDz76nGpKqyzrhD3V1gUk=; b=NiVmP488AjeSGwhoNADOU47bX2p2grl2jw0DuTeVKcP1g8NF9mJt6lZF9GAWMNW1fSHOPiYaZgE9Vpa14IyUcBjokwfjAFZC2gfoADUrbIzDDEremBKrm2T/wXq2cdzn6S6/1e8jTtdt9+VjEGax3wSdqsSY1Pt0dKu6ycc4hsg= Received: from SJ0PR03CA0203.namprd03.prod.outlook.com (2603:10b6:a03:2ef::28) by DS0PR12MB7947.namprd12.prod.outlook.com (2603:10b6:8:150::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9913.11; Thu, 14 May 2026 21:56:52 +0000 Received: from SJ1PEPF000023CC.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::9) by SJ0PR03CA0203.outlook.office365.com (2603:10b6:a03:2ef::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9913.12 via Frontend Transport; Thu, 14 May 2026 21:56: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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF000023CC.mail.protection.outlook.com (10.167.244.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.13 via Frontend Transport; Thu, 14 May 2026 21:56:52 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 14 May 2026 16:56:49 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" CC: , , , K Prateek Nayak , , Mario Limonciello Subject: [PATCH v3 2/4] ACPI: CPPC: Refactor boost ratio handling Date: Thu, 14 May 2026 16:56:24 -0500 Message-ID: <20260514215626.35327-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260514215626.35327-1-mario.limonciello@amd.com> References: <20260514215626.35327-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023CC:EE_|DS0PR12MB7947:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b4c3aec-b8b3-40d0-2d38-08deb203b4d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700016|11063799003|3023799003|56012099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: BjBPmD0ip3oKjj+DK7IqsAqsi2kSPjBo8D3iaPmxrfrvZV13A4QtEG0JJGq/Vljqn1zvj1HoK6pDmEG2vzBOk5olK1l0QxVqqPBd2MdaEEm9hvs5bKfsIY7yUznsj5UGn5MZUBm80pjLJJ6aaLS547R2JZjl+cClqrmwpSjFBr6Laz2yYUJ1mudMTrMSl6fty8I2g/x52UJk6f02gD5dlJXPwGm6gHa9FazlqrBFoNBNsoboCsSdxzCf0Yrl52CN+a40maYj/eAvXfeZ8hLQRDnXGnFtTB+Ve5l+bDr+UHZZB4BJq45QiyNY63sai8PuBN7Wy0QZEN10e61ZsHS+4chFV+uhaebRAYF50Rar94idzAhVyUdqX3KFCvdiWNIRUAOM2oneDo6FNrF3a91kXV0xBYeOUiMGLy5T9eHQQJZGjHuXTSxXE5tirT6AQrO6VH61GIAFd/pv/s1ZNLiqSLo2jEUQL4yJreRSyWD0ZFUsXZXWwyWIC9lL+qHY+YMIQNexoze0rith2PVeqgYdjhxgcfgqZt3bf2T3v7X3chB3wHd0eczkUcz6DOwZ4Yf0qyi7UKVfXighTb65/GNQfoum9tnnrWd/V0AxZWGARyJr5oVrYZAW4xGz7ZabipexR7QtGKL1YKTruf630jYCQ5u8FGzVWx1SnUeF93VbW6c1SikHwPISxWfsLZf82xD3pLjtnVrFGmrWoEENLysCgC7SFz5AEmy2pPJ7LCP2JHw= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700016)(11063799003)(3023799003)(56012099003)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NzxZZ+9dHV4B2gnWgyGDe+OuRXoqi1gBsbICV4KySyadDnx85atTPN3ZKDv1LTA+qxorJ4heTWaVjk/L6uRy1t4uhk2BrWFu5OkcyZdfBLh2S242/95vS6AzG0wfOJpsABYImNe2XtFL0P53lNvvHwGf8YyFEZ4aiXWWHN6aO57SeG75n9ReWwg18TDcVNurJphuUM97G71peQZNZW41+WPV4tGWM2oim1qI50uP7aYmNI6YMUyyERTsQY/MHuK+sWDuU5FSUDYzmPAHgzcCgijWybB/LI4dSqNDfZNWAqF1Cxfyby9XjO2n3RXMN8NepXhOBu3nPeLc1GZnU85jrlYfB/0FyCVYD6jrQwTJhY8UiNPIG/EtZSVNyMugQ6e7SKD0T0gTOztX8R65h5cuBc2oMAqzKYaOPAvvjNreiMfH9PLZphqXSQPWXjXEmBD1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2026 21:56:52.0233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b4c3aec-b8b3-40d0-2d38-08deb203b4d3 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023CC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7947 Content-Type: text/plain; charset="utf-8" Rename amd_get_boost_ratio_numerator() to amd_get_effective_highest_perf() to better reflect that it returns the effective highest performance value for a CPU, accounting for preferred cores and heterogeneous topologies. Add a new helper amd_get_boost_ratio() for doing both for boost ratio calculations and update callers to use it. This refactoring is needed because on some AMD systems (Zen6+), the boost ratio should be calculated from frequency values rather than performance values. Reviewed-by: K Prateek Nayak Tested-by: K Prateek Nayak Signed-off-by: Mario Limonciello --- arch/x86/kernel/acpi/cppc.c | 122 ++++++++++++++++++--------------- drivers/cpufreq/acpi-cpufreq.c | 5 +- drivers/cpufreq/amd-pstate.c | 12 ++-- include/acpi/cppc_acpi.h | 9 ++- 4 files changed, 86 insertions(+), 62 deletions(-) diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index be4c5e9e5ff6f..b581447711079 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -81,31 +81,18 @@ int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 = val) =20 static void amd_set_max_freq_ratio(void) { - struct cppc_perf_caps perf_caps; - u64 numerator, nominal_perf; + u64 numerator, denominator; u64 perf_ratio; int rc; =20 - rc =3D cppc_get_perf_caps(0, &perf_caps); - if (rc) { - pr_debug("Could not retrieve perf counters (%d)\n", rc); - return; - } - - rc =3D amd_get_boost_ratio_numerator(0, &numerator); + rc =3D amd_get_boost_ratio(0, &numerator, &denominator); if (rc) { - pr_debug("Could not retrieve highest performance (%d)\n", rc); - return; - } - nominal_perf =3D perf_caps.nominal_perf; - - if (!nominal_perf) { - pr_debug("Could not retrieve nominal performance\n"); + pr_debug("Could not retrieve boost ratio (%d)\n", rc); return; } =20 /* midpoint between max_boost and max_P */ - perf_ratio =3D (div_u64(numerator * SCHED_CAPACITY_SCALE, nominal_perf) += SCHED_CAPACITY_SCALE) >> 1; + perf_ratio =3D (div_u64(numerator * SCHED_CAPACITY_SCALE, denominator) + = SCHED_CAPACITY_SCALE) >> 1; =20 freq_invariance_set_perf_ratio(perf_ratio, false); } @@ -225,21 +212,18 @@ int amd_detect_prefcore(bool *detected) EXPORT_SYMBOL_GPL(amd_detect_prefcore); =20 /** - * amd_get_boost_ratio_numerator: Get the numerator to use for boost ratio= calculation - * @cpu: CPU to get numerator for. - * @numerator: Output variable for numerator. + * amd_get_effective_highest_perf: Get the effective highest performance v= alue + * @cpu: CPU to get highest performance for. * - * Determine the numerator to use for calculating the boost ratio on - * a CPU. On systems that support preferred cores, this will be a hardcoded - * value. On other systems this will the highest performance register valu= e. + * Get the effective highest performance value for a CPU, accounting for + * preferred cores and heterogeneous topologies. On systems with preferred + * cores, this may be a hardcoded value. On heterogeneous systems, this + * may be a per-CPU value. On other systems, this is the shared highest + * performance value. * - * If booting the system with amd-pstate enabled but preferred cores disab= led then - * the correct boost numerator will be returned to match hardware capabili= ties - * even if the preferred cores scheduling hints are not enabled. - * - * Return: 0 for success, negative error code otherwise. + * Return: Effective highest performance value, or negative error code. */ -int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator) +int amd_get_effective_highest_perf(unsigned int cpu) { enum x86_topology_cpu_type core_type =3D get_topology_cpu_type(&cpu_data(= cpu)); bool prefcore; @@ -247,14 +231,12 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u= 64 *numerator) u32 tmp; =20 ret =3D amd_detect_prefcore(&prefcore); - if (ret) + if (ret < 0) return ret; =20 /* without preferred cores, return the highest perf register value */ - if (!prefcore) { - *numerator =3D boost_numerator; - return 0; - } + if (!prefcore) + return boost_numerator; =20 /* * For AMD CPUs with Family ID 19H and Model ID range 0x70 to 0x7f, @@ -264,8 +246,7 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u64= *numerator) if (cpu_feature_enabled(X86_FEATURE_ZEN4)) { switch (boot_cpu_data.x86_model) { case 0x70 ... 0x7f: - *numerator =3D CPPC_HIGHEST_PERF_PERFORMANCE; - return 0; + return CPPC_HIGHEST_PERF_PERFORMANCE; default: break; } @@ -273,26 +254,59 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u= 64 *numerator) =20 /* detect if running on heterogeneous design */ if (cpu_feature_enabled(X86_FEATURE_AMD_HTR_CORES)) { - switch (core_type) { - case TOPO_CPU_TYPE_UNKNOWN: - pr_warn("Undefined core type found for cpu %d\n", cpu); - break; - case TOPO_CPU_TYPE_PERFORMANCE: - /* use the max scale for performance cores */ - *numerator =3D CPPC_HIGHEST_PERF_PERFORMANCE; - return 0; - case TOPO_CPU_TYPE_EFFICIENCY: - /* use the highest perf value for efficiency cores */ - ret =3D amd_get_highest_perf(cpu, &tmp); - if (ret) - return ret; - *numerator =3D tmp; - return 0; - } + if (cpu_feature_enabled(X86_FEATURE_ZEN5) && + core_type =3D=3D TOPO_CPU_TYPE_PERFORMANCE) + return CPPC_HIGHEST_PERF_PERFORMANCE; + + /* Zen 5 efficiency, and Zen 6+ */ + ret =3D amd_get_highest_perf(cpu, &tmp); + if (ret < 0) + return ret; + + return tmp; + } + + return CPPC_HIGHEST_PERF_PREFCORE; +} +EXPORT_SYMBOL_GPL(amd_get_effective_highest_perf); + +/** + * amd_get_boost_ratio: Get numerator and denominator for boost ratio + * @cpu: CPU to get the boost ratio for. + * @numerator: Output variable for numerator. + * @denominator: Output variable for denominator. + * + * Get the numerator and denominator for calculating the boost ratio. + * + * Return: 0 for success, negative error code otherwise. + */ +int amd_get_boost_ratio(unsigned int cpu, u64 *numerator, u64 *denominator) +{ + struct cppc_perf_caps perf_caps; + int ret; + + ret =3D cppc_get_perf_caps(cpu, &perf_caps); + if (ret) + return ret; + + /* Use frequency values if available */ + if (perf_caps.highest_freq && perf_caps.nominal_freq) { + *numerator =3D perf_caps.highest_freq; + *denominator =3D perf_caps.nominal_freq; + return 0; } =20 - *numerator =3D CPPC_HIGHEST_PERF_PREFCORE; + /* Fall back to performance values */ + ret =3D amd_get_effective_highest_perf(cpu); + if (ret < 0) + return ret; + + *numerator =3D ret; + + *denominator =3D perf_caps.nominal_perf; + if (!*denominator) + return -EINVAL; =20 return 0; } -EXPORT_SYMBOL_GPL(amd_get_boost_ratio_numerator); +EXPORT_SYMBOL_GPL(amd_get_boost_ratio); diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 21639d9ac753b..a1a005b29daba 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -640,12 +640,13 @@ static u64 get_max_boost_ratio(unsigned int cpu, u64 = *nominal_freq) } =20 if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD) { - ret =3D amd_get_boost_ratio_numerator(cpu, &highest_perf); - if (ret) { + ret =3D amd_get_effective_highest_perf(cpu); + if (ret < 0) { pr_debug("CPU%d: Unable to get boost ratio numerator (%d)\n", cpu, ret); return 0; } + highest_perf =3D ret; } else { highest_perf =3D perf_caps.highest_perf; } diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 62b5d995281d2..ae8d67fb374bd 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -472,10 +472,12 @@ static int msr_init_perf(struct amd_cpudata *cpudata) if (ret) return ret; =20 - ret =3D amd_get_boost_ratio_numerator(cpudata->cpu, &numerator); - if (ret) + ret =3D amd_get_effective_highest_perf(cpudata->cpu); + if (ret < 0) return ret; =20 + numerator =3D ret; + ret =3D rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &cppc_req); if (ret) return ret; @@ -516,10 +518,12 @@ static int shmem_init_perf(struct amd_cpudata *cpudat= a) if (ret) return ret; =20 - ret =3D amd_get_boost_ratio_numerator(cpudata->cpu, &numerator); - if (ret) + ret =3D amd_get_effective_highest_perf(cpudata->cpu); + if (ret < 0) return ret; =20 + numerator =3D ret; + perf.highest_perf =3D numerator; perf.max_limit_perf =3D numerator; perf.min_limit_perf =3D cppc_perf.lowest_perf; diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index eb1eb40c6cb8d..492ebacfe05b4 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -195,7 +195,8 @@ extern int cppc_set_auto_sel(int cpu, bool enable); extern int cppc_get_perf_limited(int cpu, u64 *perf_limited); extern int cppc_set_perf_limited(int cpu, u64 bits_to_clear); extern int amd_get_highest_perf(unsigned int cpu, u32 *highest_perf); -extern int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator); +extern int amd_get_effective_highest_perf(unsigned int cpu); +extern int amd_get_boost_ratio(unsigned int cpu, u64 *numerator, u64 *deno= minator); extern int amd_detect_prefcore(bool *detected); #else /* !CONFIG_ACPI_CPPC_LIB */ static inline int cppc_get_desired_perf(int cpunum, u64 *desired_perf) @@ -306,7 +307,11 @@ static inline int amd_get_highest_perf(unsigned int cp= u, u32 *highest_perf) { return -ENODEV; } -static inline int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *num= erator) +static inline int amd_get_effective_highest_perf(unsigned int cpu) +{ + return -EOPNOTSUPP; +} +static inline int amd_get_boost_ratio(unsigned int cpu, u64 *numerator, u6= 4 *denominator) { return -EOPNOTSUPP; } --=20 2.54.0 From nobody Fri Jun 12 12:46:09 2026 Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013039.outbound.protection.outlook.com [40.93.196.39]) (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 639323D0930; Thu, 14 May 2026 21:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.196.39 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795818; cv=fail; b=jNndOz907XdN6AHknqESs3d49waZSfGYW25G40pAKGFTgzbje0rOTNqpgnmDtOXk3ujmUDs0P8eE1AoDJ3ME7TNY32loUQVfzNVP4ECdwE8zIdQfyuxjDqS/13RM2C2kEWQFaYNSAXEJvlITZhrfQcyU5JME5KR8G/yqyRq3owY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795818; c=relaxed/simple; bh=tXzLkTT3MO98+naUz8HTknpXmSfBMpMHYlU3BgELi9Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K1tvDWUbwWxgzOcnLRXC5R3d4F3oH7SA4jT5149kuIc5vS5HkmVKkIShjSuN4ArKD+rxGInW4aF7WDkk2JKhtxliCl5yf1UkIgqfqnMBoR3cFXd8qAae2Xz+uCrpTmgHkH8vMCqg1zhI+zfv0+LNV/1Dv5a+jztNhAxtjkcpeKE= 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=SH0Kh8tf; arc=fail smtp.client-ip=40.93.196.39 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="SH0Kh8tf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G9xALefxqd7qG0xTKV4rNbS5Eqk3JIEyaXfqS3Zgol5QB9PX1nJ0qskkMlvJre+bJrYLZnI2SBg0QU2d5MnKIGt/wnvaQMMbYyOn/rdJcAfL8+szA9AI0/N783kNMT3bpBpXWkQzIN409qahSFtBYVEbxrN8nDZWzOg/lkmnR+bZT1M4/hON33OTDivlTDkKjyaYURGkx+C15sSr4T+1dwCJ8Xj+NOaQsp8cCcmFqIrPboHOmQtIMN8RFjkGvVll/PyF1XtVYu7+pYiuPhVdvsw1OX10E0P8laYfb1qEg3YgAvuuqLXpHHTD7CZkGqQKCPv/jhsNNaWgJqzvMbovDA== 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=NsuMb5xm29mygM/v0++QXVWwjE4DMWKnDJZKNP2VgFw=; b=A9Uop7LWnJolM9w0YHeso/AtcBYJTfd5ZdO/gX9IDyC8LC2nFNOUMfpaxFZHbYqqjmBa7CBvWfR7nG4J2bBhObFHTXtv55iBgvrMai1qZgTs+p0oHmPX2A6nXvQMJM+RvKUPbi5WZk9ToGNtOrLdqsoGVjVfsR3X/ESclBLGVV/PUJcVfZ6W3XHJnpUcezhd44M5BXkfaZ3YWW4CrJ0zzqa5F1Brr5OxRd1W53nDToogbGH/f2V+aRoS1DiTET5r/YH6J8fo7tMc0SsTrkCVffw2J9Qfrob7xK6fyQn4ynGzWpllgP6Zbn5ydzUixbhAwa50r3jGBmICQdqF6ToaCQ== 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=NsuMb5xm29mygM/v0++QXVWwjE4DMWKnDJZKNP2VgFw=; b=SH0Kh8tfPiy9nreqmCU/tQBM4F8tU2hJ1rCaW95jHlZMQK84l1Lnpyp+wjkH0Yu3NYNZ4quKAYJIjmO85IMIunjJo+y3dHObtWBpPUmA6h8ubfESx8wJ1X24Bwg+L3KEAx5wvZQHox+d+kf8D+DiYvFgzhskrULfknaVfgIjqeg= Received: from SJ0PR03CA0192.namprd03.prod.outlook.com (2603:10b6:a03:2ef::17) by SA1PR12MB6893.namprd12.prod.outlook.com (2603:10b6:806:24c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.19; Thu, 14 May 2026 21:56:53 +0000 Received: from SJ1PEPF000023CC.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::eb) by SJ0PR03CA0192.outlook.office365.com (2603:10b6:a03:2ef::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9913.12 via Frontend Transport; Thu, 14 May 2026 21:56: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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF000023CC.mail.protection.outlook.com (10.167.244.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.13 via Frontend Transport; Thu, 14 May 2026 21:56:52 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 14 May 2026 16:56:49 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" CC: , , , K Prateek Nayak , , Mario Limonciello Subject: [PATCH v3 3/4] cpufreq/acpi-cpufreq: Use amd_get_boost_ratio() Date: Thu, 14 May 2026 16:56:25 -0500 Message-ID: <20260514215626.35327-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260514215626.35327-1-mario.limonciello@amd.com> References: <20260514215626.35327-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023CC:EE_|SA1PR12MB6893:EE_ X-MS-Office365-Filtering-Correlation-Id: 791bc3a7-09ad-4845-dee3-08deb203b565 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|82310400026|376014|1800799024|18002099003|22082099003|56012099003|11063799003; X-Microsoft-Antispam-Message-Info: H8ohnC3+9+9x4OIVVubwDiIx1JjaTxLZakRPdNa4RAHj/6VRl+3F6HE6WTB9lnytfO4L0DBUfp2EsFGjFxK/gWQx1KlLbjekmncrGFW/EgGFgkANLcgM/etSOKoN9Iol0QvB8LNTbTlll535r3k84fOSSJp/gnupPRYEgN60dvrgeXn58A+BNGztxUOUbGXIMnNN2lLyOvbkOuetWd+GUYXqOQ2T7D0c94iJVzbnRzRy+pCZgI9kTDArm9RPOO6SGwizunayhqOjGwTgpG5ERl6q2Wj5BkOvxBYBQBmz/17xLougzypC8D7hatpJxzjHk/4oz3fFpIcwvpsV6/FXw1QQJtldYPkMg0HnReVv+/am7J2ilvewnz7FYIOcBtSwck+0rIPXE+93T4pV3s87C7QuEbG4zzehd/KHXEqqxIj9CldTd3fD/0uEvGD47G482rgKzxfOXUVG1cn+RRJjyK/qc5Tx25dumuKnlTU77brqz7Dk2uUa7wi3Nz8/Oro9psnOZITgDC7C2K9QdvP5+Ku5fMaG6VueMIL+eUrqtaMQqdMbPWSXpnQTCABl50M4YlgRMzAycvZ4SgoZxkL3CDsXpAQ3XAxTE8YP/OVghLx02WzBRjGs/KzFU2ZtqnmsXqK5JLBh9lm6Va4TjFcNkl1yo+VRoPUwrJnhuk9TePxoMdHX4VsyRBRRad8wjyFR31CsL9PmFzR5VcDR3FCgiTYiBEvQ9OETdQESV1Xuvp8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(82310400026)(376014)(1800799024)(18002099003)(22082099003)(56012099003)(11063799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IqqXTiNqu64kdiKYdvOA7QxOY9Doe2csUiRR3vXa5PJG8DL/88giksyicRiuMBnHc/NIdhpJMqzc/4hx+QCtVhu05pFmaloaoTd1z0FRKeu44iEe89baRUlOPUvg957q5MiL8k2QIYilhJOWXYpsozCFpry/sYfK8BOyh0Yk2hVpvcb4D58IwyrKTXzJ6nsP4o9Q+p9KxV3eGwK24u4WkNWdPLLSOFNIA8KC5f9gcQa2xPDGyQ3E4WzAbk+d0Z2xylkH+L/dqcCfknlLmvR9WSvfdNA7DVAYnPR3THRg5NyTMbxaF7VekMg82zZKXZlp1qOkJxGBhodXJtUXB7Bb2LCoxSTDZHiiXsEL/B5QIkwO3KyrI4Ba2BY28xbu2HJSPZBa+eaP4o0h2zj7wRpiyiBUsCavBTkDuYB13WweSyXhK4l61+2VGfqzlYfEVeVr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2026 21:56:52.9843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 791bc3a7-09ad-4845-dee3-08deb203b565 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023CC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6893 Content-Type: text/plain; charset="utf-8" Update get_max_boost_ratio() to use the new amd_get_boost_ratio() helper function instead of calling amd_get_effective_highest_perf() directly. This ensures the boost ratio is calculated correctly on systems where frequency values should be used instead of performance values. Reviewed-by: K Prateek Nayak Tested-by: K Prateek Nayak Signed-off-by: Mario Limonciello --- drivers/cpufreq/acpi-cpufreq.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index a1a005b29daba..6e80540311f60 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -626,7 +626,7 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c) static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq) { struct cppc_perf_caps perf_caps; - u64 highest_perf, nominal_perf; + u64 numerator, denominator; int ret; =20 if (acpi_pstate_strict) @@ -640,33 +640,31 @@ static u64 get_max_boost_ratio(unsigned int cpu, u64 = *nominal_freq) } =20 if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD) { - ret =3D amd_get_effective_highest_perf(cpu); - if (ret < 0) { - pr_debug("CPU%d: Unable to get boost ratio numerator (%d)\n", + ret =3D amd_get_boost_ratio(cpu, &numerator, &denominator); + if (ret) { + pr_debug("CPU%d: Unable to get boost ratio (%d)\n", cpu, ret); return 0; } - highest_perf =3D ret; } else { - highest_perf =3D perf_caps.highest_perf; + numerator =3D perf_caps.highest_perf; + denominator =3D perf_caps.nominal_perf; } =20 - nominal_perf =3D perf_caps.nominal_perf; - if (nominal_freq) *nominal_freq =3D perf_caps.nominal_freq * 1000; =20 - if (!highest_perf || !nominal_perf) { + if (!numerator || !denominator) { pr_debug("CPU%d: highest or nominal performance missing\n", cpu); return 0; } =20 - if (highest_perf < nominal_perf) { + if (numerator < denominator) { pr_debug("CPU%d: nominal performance above highest\n", cpu); return 0; } =20 - return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf); + return div_u64(numerator << SCHED_CAPACITY_SHIFT, denominator); } =20 #else --=20 2.54.0 From nobody Fri Jun 12 12:46:09 2026 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013048.outbound.protection.outlook.com [40.93.201.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 501E63D1CAF; Thu, 14 May 2026 21:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.201.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795820; cv=fail; b=EXEDxQEkh+FHWR3Gk+9xJuq9OOtg47jjZbZr2wlJcRpsSOuIqwldtNfPqfNPAghLWSwpURa7CXBRm6OYlYSaEt4KS2xKVQDGc0k+AcdoNAGe+AAgi5LOU4Vb62vYwEdo1KEudihpzD3ZTZYuklnkG7V4k8WSq02c4Sy+0NQG59U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795820; c=relaxed/simple; bh=wREPvnWJEng/iKvW1iCqSYW308F+6qje+rWUGygDAWk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eE1QPlptRgskNnl4EORgrwDbaaMy1xEW636YDcnlyC70ZIV8sYKGK4epoSeL/+sGFvGg7+bXawzJF3nARC9ZQpqSCXz5h1YuG9/Rr7F1wi6ntvNmf+0/0N9Fv/sqPHDRdTDOhMGTJpPpdLK+RR0pvxJF/OmXlcySp4DjstASa3Q= 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=gss7yGGs; arc=fail smtp.client-ip=40.93.201.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="gss7yGGs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gmV/dIZnQ6UjSvdpKZDm0wrVYBx5p177LxqA94TfxIUZdfg0xWUyFi+uv20yV5LXBJARsE17nimgFsbQpvxgDEvGan2D4u6OuFffBIz6aYYtAuA5xn5le/fMGfYfv5EfKzg73UAd63azOVlYc2TSmUe1Ke8UFyQ3wN/ZzDTKWUX+slN+Plz6VGAfV94xLAy5zjvbNkuTVnEE78GG28WSL2m8kCURSFvH/G4gfOSqiHP8VqgEjNqg+x7eoyXI4EbynBRO6BC7fdUpz3gax4rz87gUwq+CWOTSTVRAH4J0rkRTimm6XbvNPqYe3LJsT5pTB9pNuuxMzNqnYWaV0Yg15g== 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=JQQjDnNuaTS6M7ghP7j6KKtC8Kn3E2Z+epqH7R8ewUw=; b=V75UxG+XbPUJCzqub0nTJ0DecAYjG9u6gvq/xQik9J9YWwKfJyIFBTzF89QJSjmoEEtiLh34ZcErQ9m7PK0LA93jB1MX0zskSiy+DPBtJTWB8mUiIvZeL3UCRUWj8iwom+vy+E+CdFj+ME8qTg2j5bNfJYhUnNwK9fNu2+X6PD3QkR693O3ZegaBH1vm82fVK4lVSWNRukr5ODy9Y2rDXl2Apd/kjU77sN5QRtfcVUrrveU6VGemghzSd41X/c+2P/wCwiUtunPgYfvcGazxNLV14gyQPvtFgKeGoo9kOp1fr/3Xp3b948Yh/0synmV4mlB8B+OskqW5uzty4gmNYA== 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=JQQjDnNuaTS6M7ghP7j6KKtC8Kn3E2Z+epqH7R8ewUw=; b=gss7yGGsknxRMoUxTBeWpM8vjbE4IyQzk4eYrK0OkGU7wFNMJwGGv0wHHWO0sqZAr6G3FTmCcGfK/ump/H8EamXOOIg4K9MCyebCMgAZ23t/XLXMarn4ATkZ7HRrK9uJJSEScB0B+YDbCyqzyoj4NSYD5OLqqfcdFD+0kMeDym8= Received: from SJ0PR03CA0183.namprd03.prod.outlook.com (2603:10b6:a03:2ef::8) by MN2PR12MB4061.namprd12.prod.outlook.com (2603:10b6:208:19a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.18; Thu, 14 May 2026 21:56:55 +0000 Received: from SJ1PEPF000023CC.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::c0) by SJ0PR03CA0183.outlook.office365.com (2603:10b6:a03:2ef::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9913.12 via Frontend Transport; Thu, 14 May 2026 21:56: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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF000023CC.mail.protection.outlook.com (10.167.244.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.13 via Frontend Transport; Thu, 14 May 2026 21:56:55 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 14 May 2026 16:56:50 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" CC: , , , K Prateek Nayak , , Mario Limonciello Subject: [PATCH v3 4/4] cpufreq/amd-pstate: Get highest freq from CPPC if available Date: Thu, 14 May 2026 16:56:26 -0500 Message-ID: <20260514215626.35327-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260514215626.35327-1-mario.limonciello@amd.com> References: <20260514215626.35327-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023CC:EE_|MN2PR12MB4061:EE_ X-MS-Office365-Filtering-Correlation-Id: df031c81-0a88-4df5-fe8d-08deb203b6e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700016|18002099003|22082099003|56012099003|11063799003; X-Microsoft-Antispam-Message-Info: jt5ku/pFwLD+ztzvfdFFjfoT4/eM4m0d6BSpXsqUIC7TxG4IEUeq6+XA4k5caHyWAmdoHdYr/oPpdFQOMxW/JbNPnzle4KFONEdNnlhg1II0ZX5sRF/GUNSkogQBn25zrorjC7cs02RXePCasizuu+lBc734CK1Tjw/otj6GyK1KcUvA8dkdQ+pA2R0D9D0aiSGeSjWSXEskTqWWm/1Q2humyEarGTVHilAWueVlO6qQPV2LFzik1Ogq+oF+hNefMUivkYPPFQL+aaAXhHIM8ceqNH2j4aAxy87OISaSstzfAq8ozB9bKCYCWDWBPHnoGaKvvjD0wde4zGwhxdkv7njaqShY885WI7RRi76IBmMnzRfWsSvgU4spw75Rhff7UIcyDR3ztZ9lmH3MxwkwLgmBDWK+gjpYLgLmqQv13BZKUxykuthvxXkIGEp1FtAa/lSobnFr7SbOsxI+qX/+ojwgz0Ov3aRjOiaoQjzXIJzRQ9g/okjj99PTvx6480gSANtVOERcOtzCZqHYRj1wHa1yPnpOCGPzJG5Evde+GwCIia/+Zn8FtOV5xDgU3faqyH13tz1M1VnvlOHUMotOkMCyJlXXlnvhxoM3DOp0k/QVinxKBAewdWMoRX1WTNVwDwgKduNC6AQIwrjuMej44EY0YlqZRWqoBecJLzfKk2+QYGVZH9nEshVtGb7oXQ6iqq70oTgLb+zg7+MVziFBRgHJY9VTBXKoVvWpttcLUkY= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(36860700016)(18002099003)(22082099003)(56012099003)(11063799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qYToWvawsVJq/wWXZjus0Q2wwKYWgLkYcCiKfq3QQxZeFl5P/jrwMpQi4uAqv3uneyVelMw4aNKiEPjeH+1YW2cULXk/bxH2gsGa3MrJZyO9KoBJ9m/mVV1SdHaaD9Jm2IU4+GyzlAPq5DsFUrRc2T0XnwUWSNlqt0xDNomIs+ZS05E4Mudpq7mqjlA0gQA+vssomEhJ0fiSlSnGsFTwPP2nv3R7kWX2OlWqJLv0J0aEEQyZ5FJQ6/jUis3o7VxMNtzwk7jSLV1LQFtb3MfEYYOHFKVGcOAC3it0+JdbNHpkyHGSVs8/HNhqwerfyqCjy1WFq44zxGaLMHfDb2o1qKhm1rmeq5qyspxgC3zGzJHDRB5FhG3Xy86A5iQt/JSIKasalojxZEfwWt45GcvqH2I0XmPeyQiBIDvyr6TJczCcIBktyaIQMDWGfDkMHRcW X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2026 21:56:55.5043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df031c81-0a88-4df5-fe8d-08deb203b6e6 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023CC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4061 Content-Type: text/plain; charset="utf-8" If the _CPC object advertises the highest frequency for a CPU, use this instead of trying to calculate by linear interpolation. Reviewed-by: K Prateek Nayak Tested-by: K Prateek Nayak Signed-off-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index ae8d67fb374bd..3f06e33f47120 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1022,8 +1022,12 @@ static int amd_pstate_init_freq(struct amd_cpudata *= cpudata) =20 WRITE_ONCE(cpudata->nominal_freq, nominal_freq); =20 + /* max freq came from _CPC */ + if (cppc_perf.highest_freq) + max_freq =3D cppc_perf.highest_freq * 1000; /* max_freq is calculated according to (nominal_freq * highest_perf)/nomi= nal_perf */ - max_freq =3D perf_to_freq(perf, nominal_freq, perf.highest_perf); + else + max_freq =3D perf_to_freq(perf, nominal_freq, perf.highest_perf); WRITE_ONCE(cpudata->max_freq, max_freq); =20 lowest_nonlinear_freq =3D perf_to_freq(perf, nominal_freq, perf.lowest_no= nlinear_perf); --=20 2.54.0