From nobody Tue Dec 1 06:22:16 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.57.15 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795627259; b=DS1M8FTVdLk51fVuRqDeYd70vjIv9T+vndR19v3q4XXW5fiMaeisYdR/Wl/5+AK42xgE 9OLrgoV4lFyS31jaaynak0mWfuAw63oZJEiHA4gUBpW9se/GL1Tvf1uqXagDOujiJF3F2 RhQqWA56AdGBr1qPWcsILrdY3Fmn26zfb+y+V9e4kTo+8/OKEJ7W8Mwfw0AKS1rQF5tLF WDzNxcTLiBJFOXqu4J9BznHZlrR8HKNdtklCGfRis87MFRCNpc5CuT/06AQRM2ukD9aqq 0vUH/BCtx4/T7p8pxq2Lwe8/+xbVAPkpJdIx4H0OBAdlqgxfvqxb3JE6j0qeZN/dAxg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795627259; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=Px+biz5ypv+JMPnEwBTTGJxz0qlJ8j8+xv5ooB2c4d8=; b=AAI+rwNZk/XTqwCXxbhPu6EoiAnf15954JRymBW+AjCHPY+C2Fn6LiIA6fNMf8YOCC8K 4vG0VbBEACWFmY4PgwlBlTXFbuhZNMnXhrcYakqYK0Qvi5zVc01WO74voLYQNdx/o2HuL ccLerqktrVbRGVtPR5Ov6Z9YbtpPWRb8BwJv20lC66d+qNwUjeA8RJoXav+ZClW4FYweS euRouK4TDJl39tVAaWn1grzuQK4Gc2Z4sDfnxVilYeSIJeID4mi0ulq0VeBm0sGrIAeOj 80nI8FgHhV+igBsGI0B0VJiMEdqDmOG78t9z1XEt3vFNR6e4ZIxLMCPAPLqC2Q+WtlA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=5BtG3gI2; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.57.15 Received: from BN8PR05CU002.outbound.protection.outlook.com (mail-eastus2azon11011015.outbound.protection.outlook.com [52.101.57.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFE85606A31E; Wed, 25 Nov 2026 17:20:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AFE85606A31E 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, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=5BtG3gI2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F54A219Lhw4FzIeISE5YCLE7mcFmyZict/CnDPoxQM6lMzxn87eLFWyoLLrvfh7FZOZW3wvlJa4oqC00t3AQsfzaSwjz9P2vCgRHBNulxEq8HU+EnqGnWoffvPCAgxyMfjW+rauuuWraXgS7dely60rzpbTE/GDHVMM91d2ewFx/Ov9l4zYZhSbB1Bn0+A+hPvZtxatQJiEAo5OZPZ6HtlEqXrwSE6qcvh+n0AcOGgPN/D844UkgnHADM6pJr+P7XLoyBUkA7eWnwEBIpYz/ExcTTr/s0SDoloIs2tUphUgbWJINjluGG8TBLWE/yFxZvCkf1hE4kDZtLnSIyZWHxA== 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=Px+biz5ypv+JMPnEwBTTGJxz0qlJ8j8+xv5ooB2c4d8=; b=cOwuu/Tw1Wd5/u4jVZ82O+gpjmVeIcrLpnYYLex22g/ShPkiFWbSWTV8GDyWXeq1SlbGcjKSsgmjRZ9yuWu+5emk31eMEPRZe6Z9lJY/0hpxiY6I6D4RjXMYAQf3xLKbeGql/X2FdC43kIvVqHyEQBGde+8jX8t01uqwYhgrAR2eVXUEuadqDJHiEKu1cwA7TCNayJB4NmAIyZKRIe6ZlHoBSeVXGiiOnKpAM5ugClDyF++XqH6mBvZAeNixCXbhXG3R2VBADzXOeaRPpHA593I5nuGzEWuF5F/Hh/IdsrTgWPqQ+tgclWCqVu/mYaseoRGIQaK0wEGyjskCkb1ryg== 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=Px+biz5ypv+JMPnEwBTTGJxz0qlJ8j8+xv5ooB2c4d8=; b=5BtG3gI2mSLqGyUb5IBk9FtUbEYYzc1xDs4E7RKtKIuXZdKlVbzeLtdH53YcWptqDs4m4Ob5EzihDjYcAAgQXzU6uF2W0d5fcg4A7r+bE+XULPCo0BkkiY+yebF1r4+g05VkCsjwxDFBM7PklbjVJfKiTsdD9LdnpgKwr4z/4Rk= Received: from DM6PR05CA0060.namprd05.prod.outlook.com (2603:10b6:5:335::29) by DM4PR12MB6591.namprd12.prod.outlook.com (2603:10b6:8:8e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.7; Wed, 25 Nov 2026 17:20:54 +0000 Received: from CY7PEPF000000F2.namprd05.prod.outlook.com (2603:10b6:5:335:cafe::72) by DM6PR05CA0060.outlook.office365.com (2603:10b6:5:335::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.4 via Frontend Transport; Wed, 25 Nov 2026 17:20:54 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 CY7PEPF000000F2.mail.protection.outlook.com (10.167.247.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.3 via Frontend Transport; Wed, 25 Nov 2026 17:20:54 +0000 Received: from airavat.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.57; Wed, 25 Nov 2026 11:20:50 -0600 From: Vishal Badole To: , , , , , , , , , , CC: Vishal Badole Subject: [PATCH v2 1/3] cpufreq: amd-pstate: Finalize prefcore before registration Date: Wed, 25 Nov 2026 22:50:29 +0530 Message-ID: <20261125172031.741740-2-Vishal.Badole@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261125172031.741740-1-Vishal.Badole@amd.com> References: <20261125172031.741740-1-Vishal.Badole@amd.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: CY7PEPF000000F2:EE_|DM4PR12MB6591:EE_ X-MS-Office365-Filtering-Correlation-Id: 22767ee2-7ba9-4441-37df-08df4b187621 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|376014|23010399003|1800799024|82310400026|921020|56012099006|10067099003|11063799006|261022105027099003|261022075727099003|261026140227099003|261028144727099003|261021121427099003|261026121527099003|261021123027099003|261102123227099003|261009223027099003|261009221227099003|22082099003|18002099003|6133799003; X-Microsoft-Antispam-Message-Info: 24TScElfEflfBIHAowHPnrh8W8BDHtglVkb0odqkScAX8CB2SmPljJk2V2jm9k+sHWly93+sDlfaZxOoWIEmrDGJBp5oIxk5zML4cO5IHBvNquwCBGbh8zuZNu0eByKN+jg1faTLsQ3Qh9D22eNnU+toKVSMxI+PLOm4AhP/OEYO80gTG2aDucy+3Ky0dO+yb2rBAud1LJXsdtNjH0a/vZdB6d2onsF4INiK6OmmuXYrsIvpq514qr1AXDrOfub4D3UW+xkqloZHZTLuMLuI4xK3cQy3ifBMDcXDtln5DQzIoNB4rKoMWTji+QZzfvv3vNEHliGX5GoCw4EaMwaBH0jWWLu0MWFJZurzJCPW+CEJaEbaMo2uHIZs4T8fZ4sLJy2UiR//SsipeTMwbFFlGqeIaZgAPW0dd0RVb9c+4qxjXOvyGxPJKGTW6ViMT8+XZQXTyQyYbRcfhQ8EcCZg76P8QvHjDgBNA7Sp0okYBqVqgnaq0A/rzK6W2d3UfT9Gw7zxxXWuI1SdBExdmJLHA9Ikyjvb+t0X8j54DzMb3f1SBbA9/AWychTvZ9VVdF3nybo/GhF9hJ6Rv6WLysH/v3SagnymcxXrvpm72LDZP1XvtOpe+IbNo6xzMU+LerbenuWYL5wqYClIjiledhc7pUtvvKECOB4fsA8cNAxudMtcLOZbniC94vl6lb4ZlAz2yEAUP+EPquAMA+FGI5EX5AdQ1Vvxo1JIFjNoeL4caBYfH56s+fD3/BRcAxpl6kWL 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)(376014)(23010399003)(1800799024)(82310400026)(921020)(56012099006)(10067099003)(11063799006)(261022105027099003)(261022075727099003)(261026140227099003)(261028144727099003)(261021121427099003)(261026121527099003)(261021123027099003)(261102123227099003)(261009223027099003)(261009221227099003)(22082099003)(18002099003)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YznGvbPioHV/EzqhZigIuZ7FPXs9iOUXlS3JK4cUH+HSspX63mVEseEox6x8xRvZp9j4b982Xete5pDhblpXTbyemfMl3dnwcF8Zb/U4r2j3Yew9yaXhN7W+5RsPdc7RYvP+nJUjrwdTuRy32edV2Ettb34klHKZJJKWMoDBJNyQIVlHrp2kLwU3vr8GYSiAECmL2ICeVlAeGC8/8TeQ9RwtZu5vNKXaAG7mvhZtqE6jmtLiuzVM5bG1i5cWBBiH1gWdEnBpnukkaeKcSwlU/bqHM9OfdhLZMwT56KkphfSsMsObU9WrtKR+mp2dJqOJHuqmZ6vqTHt4mPo+gsJ7t7FQesZNDmjJOmWMuO6V7Aoa28DybAATQX4Hh0GhEpZFozc/jH+hUd5EQgeyipHo3UTw2UISR5H8v7f6sLZQ1Cq3+XXBhd58ADJ1XbisvjrL X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2026 17:20:54.1932 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22767ee2-7ba9-4441-37df-08df4b187621 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: CY7PEPF000000F2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6591 Content-Type: text/plain; charset="utf-8" The choice between amd-hfi and preferred-core scheduling applies to the whole system. However, the HFI check currently runs during per-CPU initialization and clears the global amd_pstate_prefcore flag. Move the check to amd_pstate_init(), after preferred-core detection and before driver registration. Signed-off-by: Vishal Badole Reviewed-by: Mario Limonciello (AMD) --- drivers/cpufreq/amd-pstate.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 4bedfbfc18b66..3e0308f644778 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -956,13 +956,6 @@ static void amd_pstate_init_prefcore(struct amd_cpudat= a *cpudata) if (!amd_pstate_prefcore) return; =20 - /* should use amd-hfi instead */ - if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS) && - IS_ENABLED(CONFIG_AMD_HFI)) { - amd_pstate_prefcore =3D false; - return; - } - cpudata->hw_prefcore =3D true; =20 /* Priorities must be initialized before ITMT support can be toggled on. = */ @@ -2438,6 +2431,10 @@ static int __init amd_pstate_init(void) return ret; } =20 + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS) && + IS_ENABLED(CONFIG_AMD_HFI)) + amd_pstate_prefcore =3D false; + ret =3D amd_pstate_register_driver(cppc_state); if (ret) { pr_err("failed to register with return %d\n", ret); --=20 2.34.1 From nobody Tue Dec 1 06:22:16 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.46.50 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795627265; b=SCKnPxHpZb2m9EsaQkt2oLndVkQ2OerRsSxckPvagCs6oS7Sqg8pv2q9qH7VND8ghl0x 3K3xu+0oHjT3zXwT6sTJ1n3+sKNDRw5THbYfDnSGac2fePm+eA2umT80th7Fx5/Nz0KsT a9EnOohXdu35YSmJ2NSnbtJ2VO7+v8HhWndmcurdQCIHuf4JEbh6Jj6w0enp30nEs8zJY Gy+qtOe76AUqceekdlJ95CWxY+dpX1mDR0fjGD+uVlwJTtEw5GDQ8Tq236iSazGDaWGqk ZLtG7HNZFlXjoT63B0FEPlggHkRQES6+lwcnwooPjAMgYGBcZIpQH+fKGGLLhDa1X2A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795627265; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=6beaJUzXygzvCsFi+Urqbn1lhKhydyCKeD7v9haE7UI=; b=qf7Mis8BrQu7ZHKvJTUFa4LNRz4WW8PwRjmuTPf/zmmIYbH6P/DaPkoDzAgcdLBw+FI5 QD8Ex5k6Fh4o04tFk+GgwKcCt1hZZWRRKYbLU9KZx/g82h+mjmqFC1e++1UJEFVXJMf+d ynoOoXBtt+LPbbiDRQw8SAxCqWWe1dR3gog3fdWq1fM1C2JXYMbmEusqSqqt8+vVqv7VV MRTxeutOqgNOQ6lCHnICF0d+T6YEpPd2dMBhtsT+5a2Qj7KN7TUZrd03f27DEQ/PnszkH wvZZz/h0ILkpoUTsNRlPs+eqc5GLurw8JcKQdu2AV2hXT+BdFnIBMCTUbv66usvOklg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=og1TfZFl; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.46.50 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azon11010050.outbound.protection.outlook.com [52.101.46.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2E1F606A684; Wed, 25 Nov 2026 17:21:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F2E1F606A684 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, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=og1TfZFl ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fWR3YEOiAJkF+NrIiv3BsY0ck8mAfMz772di3AKt/4DVvWU6bUtc5XjM6SmFTo5TUCyLIMUs7C52Fna1Bp+kM89cRAGB1bYyNK0SrcvFSAV2CjROBFzyqWUktuR/Q2ktz3Rubg6+tmrCn/IgvLRHW2J+Q5fmLMqADBP6eVMEb13mwxD2ztXlaxSrB7V2O3aTtcCVx1XzoXdMu259+uNcdR0BqV95w5cJcn0aFdmDht80AS1ggPKUwdtUWWjNqCl172o8sfFnwSsWpSlVD6/fxmQtFEkNOu2Czqkk5S8/LPu4gc2QJ2+UDiwgZBt9EvrqEtMpDNor6HK0PR9I4PwvKg== 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=6beaJUzXygzvCsFi+Urqbn1lhKhydyCKeD7v9haE7UI=; b=fWLZyuSwFJWXXtQ2vQtW2BxAk6dnOq5Bzle4A+hZc1U1ryOtWYBTt04gUowmlsnYXCI+tYNCWDRvHt3C1eXmUEy9aOo9bgH3Ps41m3au4Hc3RONQLlCH1/CsVE14zC6bqwWFinWf/CLtFrlkSfEs0D1ngfd3SoHFY/tbWlKVOKwNYNju1NzRQn8veSxamx6dcm7om4401ZML3kqoWHDUcn5vJQT10WY3M60B4iFC5XHlD0VHaerWH2OKfnYglhDOpf58yZMhDVvBtuW3NaKrUXzIZlPLsn8+PCrzz6s2wo4i1wQnhZfCqwsDDz+052jSO0Huc5T13oy9cjwAB+JG7A== 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=6beaJUzXygzvCsFi+Urqbn1lhKhydyCKeD7v9haE7UI=; b=og1TfZFlCrbo9ovR+C5MF2PeF99C4eXhEDBvGqM0z+pVSzpmXnrmwCm0/K09/tXK3ZqsawTxI4acqaTZhnH8Z5OlDq3rr/HZMjdi8T69SH8QFgi1B6I95rxZe3BZAjfQuUG9UO1GdIHlh9M8XbpxXOSP3R7RN212wTHBHHK1Ovc= Received: from CY5PR16CA0001.namprd16.prod.outlook.com (2603:10b6:930:10::31) by LV1PR12MB999280.namprd12.prod.outlook.com (2603:10b6:408:3f5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.639.14; Wed, 25 Nov 2026 17:20:59 +0000 Received: from CY7PEPF000000F0.namprd05.prod.outlook.com (2603:10b6:930:10:cafe::6a) by CY5PR16CA0001.outlook.office365.com (2603:10b6:930:10::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.7 via Frontend Transport; Wed, 25 Nov 2026 17:20:58 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 CY7PEPF000000F0.mail.protection.outlook.com (10.167.247.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.3 via Frontend Transport; Wed, 25 Nov 2026 17:20:58 +0000 Received: from airavat.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.57; Wed, 25 Nov 2026 11:20:53 -0600 From: Vishal Badole To: , , , , , , , , , , CC: Vishal Badole Subject: [PATCH v2 2/3] cpufreq: amd-pstate: Set asymmetric CPU capacity on hybrid platforms Date: Wed, 25 Nov 2026 22:50:30 +0530 Message-ID: <20261125172031.741740-3-Vishal.Badole@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261125172031.741740-1-Vishal.Badole@amd.com> References: <20261125172031.741740-1-Vishal.Badole@amd.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: CY7PEPF000000F0:EE_|LV1PR12MB999280:EE_ X-MS-Office365-Filtering-Correlation-Id: c6571c7b-861e-4b3d-fad9-08df4b18788a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|23010399003|36860700016|6133799003|18002099003|22082099003|921020|56012099006|11063799006|261021121427099003|261021123027099003|261102130727099003|261028144727099003|261009221227099003|261022075727099003|261022105027099003|261102123227099003|261026140227099003|261009223027099003|261026121527099003|10067099003; X-Microsoft-Antispam-Message-Info: fCrr7WqJ5RYA7gSTQvYgkAfPe8Cm1GFPsOaKu5OzRv2VZSWIws3GFVpl96N5ZH0ZQIb7T60PCwLak6JXr0K8pb2U4TTI1e2/5uv4IvhEy0cwz2IhTMfvEejnZMq2w3TwDvWa+fA0P+3LJEMxnv4ncZpUmK++i9iympbMNCLSZQcXn8SqhDewU0nq/a65h4KHh7gegN5LnR7n5OYNvJF6HXEw6lcBfF32W46ngjZiJ/CQMYDnVi+J7rAtqGZKSHSsfqcTq0mmqOCZYWCxFogZXTxQxCHRA3ZkE4o7izF35cDIEF83u6Muo2TA/He59FJ7owi6j3YrVNhDS8SzVcXS+nuWt4u9qDYVs2SLrWiBIIcTrFzj8duKOXDG+lJ/N+yS9JdL3i37ESC8qsFLkUhCoGa+//B63e4M28cj7i4Lt9rnmDa6qawRQI1FgmmlchLN0k0CZv6DrfO8TXHUgpqGo/EI/JjI+YBt6ui1AuBhHxhyiDbdOgBRccR/HnEyLJ2vxuq+3jvvWvF6kv2a7CgHTHzm/sueTXr6bZJRaGhX2WlG3pu8xYVNIYc3SF0rFJQUkHngToMLL3IevEi0Xywmxi4F4xk4+Ywle6Ny3t7U1jdjBSghwW1JMETsbh4qP8dT9MWGWvOhowlUU8u7TmUI8u1bTollNlVJmmK7ujlwIyOMmaRoBKIJOBnF2T0kLGs4PtlkzSRJeWMnpnSvw2HuWc+QtzpPmzelZB79Ya48eTGzEyz2sd0MMtbWbOyODNmo 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)(1800799024)(82310400026)(376014)(23010399003)(36860700016)(6133799003)(18002099003)(22082099003)(921020)(56012099006)(11063799006)(261021121427099003)(261021123027099003)(261102130727099003)(261028144727099003)(261009221227099003)(261022075727099003)(261022105027099003)(261102123227099003)(261026140227099003)(261009223027099003)(261026121527099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oZOMxTn3TQ3sbyp4G9FH32uirbGRMcSgGGYDfix/43fAIAZw604b/sCQ+hTbqnSgRmfvKEzJrzp2aLcCBQNBkD8laoP9ibyRZ/f2aDkZx22rF0vy6r1fcfBGnUlGStT9OKNIdkZh3VYObt1tx1C7OZNyD39F0J3xZ58RtJNX8hBCpCm0PnYNd024EcfEbSSvEWASs5BheIkBQnww8I+4e6jAElli6kLvnSVhCaOUWWBzzaTU70odEoAV7c5asjMzsYHvHjfceT2j/WR5+PvzZDoMjPNuOxDEcDSw1dki2BlA3Aq58UavYTkMYPbxOchqFnxPVU/TvoXdctV5LidKgnIjrUSp+cvrdwMWi2axs2cYfHZg1frIrUxZsMekcUTfaAKVzQUsFUpzQqKDsvoaow7RZH2kmBTjOO+hwwpwVcqTSSjTQC5LohKt97AJ/asC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2026 17:20:58.2544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6571c7b-861e-4b3d-fad9-08df4b18788a 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: CY7PEPF000000F0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV1PR12MB999280 Content-Type: text/plain; charset="utf-8" AMD heterogeneous processors combine multiple core types (e.g. performance and efficiency cores) whose maximum sustained performance and frequency differ. On such platforms the Linux scheduler relies on per-CPU capacity values to place and balance tasks across cores. Today amd-pstate does not export any per-CPU capacity information. As a result the scheduler sees every CPU as having identical capacity and treats performance and efficiency cores as interchangeable. Tasks are therefore placed and balanced without regard to core strength, which hurts both throughput and energy efficiency on hybrid systems. This happens because the scheduler defaults to a uniform SCHED_CAPACITY_SCALE when no arch- or driver-supplied capacity exists, and amd-pstate never feeds the asymmetry it knows (via CPPC highest frequency or the effective highest performance register) into the arch hybrid capacity scaling interface. Enable capacity aware scheduling by scaling each CPU's capacity relative to a reference CPU. Use the maximum attainable frequencies when available for both CPUs, or their effective highest performance values otherwise. If reference setup fails, keep CAS disabled and continue normal CPUFreq registration. Capacity aware scheduling is enabled by default on supported hardware and can be turned off with the "amd_cas=3Ddisable" boot parameter. Its effective state is exposed through the "cas" sysfs attribute, and also exported via amd_pstate_cas_active() so amd-hfi can stand down when capacity aware scheduling owns the heterogeneous cores. Signed-off-by: Vishal Badole --- MAINTAINERS | 1 + arch/x86/include/asm/amd/amd-pstate.h | 16 +++ arch/x86/kernel/acpi/cppc.c | 4 +- drivers/cpufreq/amd-pstate.c | 150 +++++++++++++++++++++++++- 4 files changed, 167 insertions(+), 4 deletions(-) create mode 100644 arch/x86/include/asm/amd/amd-pstate.h diff --git a/MAINTAINERS b/MAINTAINERS index 44540a1eb2b80..300dce181c1c4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1322,6 +1322,7 @@ R: K Prateek Nayak L: linux-pm@vger.kernel.org S: Supported F: Documentation/admin-guide/pm/amd-pstate.rst +F: arch/x86/include/asm/amd/amd-pstate.h F: drivers/cpufreq/amd-pstate* F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py =20 diff --git a/arch/x86/include/asm/amd/amd-pstate.h b/arch/x86/include/asm/a= md/amd-pstate.h new file mode 100644 index 0000000000000..1c0eb56c8f867 --- /dev/null +++ b/arch/x86/include/asm/amd/amd-pstate.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Public interface for the AMD P-state driver. + */ +#ifndef _ASM_X86_AMD_PSTATE_H_ +#define _ASM_X86_AMD_PSTATE_H_ + +#include + +#if IS_ENABLED(CONFIG_X86_AMD_PSTATE) +bool amd_pstate_cas_active(void); +#else +static inline bool amd_pstate_cas_active(void) { return false; } +#endif + +#endif /* _ASM_X86_AMD_PSTATE_H_ */ diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index 1c6bf56c3215b..15590e9da2dca 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -248,8 +248,8 @@ int amd_get_effective_highest_perf(unsigned int cpu) if (ret < 0) return ret; =20 - /* without preferred cores, return the highest perf register value */ - if (!prefcore) + /* Reuse the cached value for homogeneous CPUs without preferred cores. */ + if (!prefcore && !cpu_feature_enabled(X86_FEATURE_AMD_HTR_CORES)) return boost_numerator; =20 /* diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 3e0308f644778..415553109fc26 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -39,10 +39,12 @@ #include #include #include +#include =20 #include #include =20 +#include #include #include #include @@ -86,6 +88,10 @@ static struct cpufreq_driver amd_pstate_driver; static struct cpufreq_driver amd_pstate_epp_driver; static int cppc_state =3D AMD_PSTATE_UNDEFINED; static bool amd_pstate_prefcore =3D true; +static bool amd_pstate_cas =3D IS_ENABLED(CONFIG_SMP); +static bool amd_pstate_cas_initialized; +static u32 amd_pstate_ref_freq_khz; +static u32 amd_pstate_ref_highest_perf; static struct quirk_entry *quirks; =20 /* @@ -962,6 +968,117 @@ static void amd_pstate_init_prefcore(struct amd_cpuda= ta *cpudata) sched_set_itmt_core_prio((int)READ_ONCE(cpudata->prefcore_ranking), cpuda= ta->cpu); } =20 +bool amd_pstate_cas_active(void) +{ + return READ_ONCE(amd_pstate_cas_initialized); +} +EXPORT_SYMBOL_GPL(amd_pstate_cas_active); + +static void __init amd_pstate_init_cas(void) +{ + int ref_highest_perf =3D 0, ref_max_freq =3D 0; + int cpu, highest_perf, max_freq; + + if (!amd_pstate_cas) + return; + + amd_pstate_cas =3D false; + if (!cpu_feature_enabled(X86_FEATURE_AMD_HTR_CORES)) + return; + + for_each_online_cpu(cpu) { + highest_perf =3D amd_get_effective_highest_perf(cpu); + if (highest_perf <=3D 0) { + pr_warn("Invalid highest performance (%d) on CPU%d\n", + highest_perf, cpu); + return; + } + + max_freq =3D amd_get_max_frequency(cpu); + if (max_freq < 0 || (u32)max_freq > U32_MAX / 1000) { + pr_warn("Invalid maximum frequency (%d) on CPU%d\n", + max_freq, cpu); + return; + } + + if (highest_perf < ref_highest_perf || + (highest_perf =3D=3D ref_highest_perf && max_freq <=3D ref_max_freq)) + continue; + + ref_highest_perf =3D highest_perf; + ref_max_freq =3D max_freq; + } + + if (!ref_highest_perf) { + pr_warn("No reference CPU available for capacity scaling\n"); + return; + } + + amd_pstate_ref_highest_perf =3D ref_highest_perf; + amd_pstate_ref_freq_khz =3D ref_max_freq * 1000U; + + amd_pstate_cas =3D arch_enable_hybrid_capacity_scale(); +} + +static void amd_pstate_update_cpu_capacity(struct amd_cpudata *data, + bool highest_freq_available) +{ + unsigned long capacity, max_capacity, capacity_freq, base_freq; + int cpu =3D data->cpu; + + lockdep_assert_held(&sched_domains_mutex); + + if (highest_freq_available && amd_pstate_ref_freq_khz) { + capacity =3D data->max_freq; + max_capacity =3D amd_pstate_ref_freq_khz; + capacity_freq =3D capacity; + base_freq =3D max_capacity; + } else { + union perf_cached perf =3D READ_ONCE(data->perf); + + capacity =3D perf.highest_perf; + max_capacity =3D amd_pstate_ref_highest_perf; + capacity_freq =3D perf_to_freq(perf, data->nominal_freq, perf.highest_pe= rf); + base_freq =3D perf_to_freq(perf, data->nominal_freq, max_capacity); + } + + arch_set_cpu_capacity(cpu, capacity, max_capacity, capacity_freq, base_fr= eq); + topology_set_cpu_scale(cpu, arch_scale_cpu_capacity(cpu)); +} + +static void amd_pstate_set_cpu_capacity(struct amd_cpudata *cpudata, + bool highest_freq_available) +{ + union perf_cached perf =3D READ_ONCE(cpudata->perf); + int cpu; + + lockdep_assert_cpus_held(); + + guard(mutex)(&sched_domains_mutex); + + if (perf.highest_perf > amd_pstate_ref_highest_perf) { + amd_pstate_ref_highest_perf =3D perf.highest_perf; + amd_pstate_ref_freq_khz =3D highest_freq_available ? cpudata->max_freq := 0; + + for_each_possible_cpu(cpu) { + struct cpufreq_policy *policy; + + if (cpu =3D=3D cpudata->cpu) + continue; + + policy =3D cpufreq_cpu_policy(cpu); + if (policy && policy->driver_data) + amd_pstate_update_cpu_capacity(policy->driver_data, + amd_pstate_ref_freq_khz && + amd_get_max_frequency(cpu) > 0); + } + } + + amd_pstate_update_cpu_capacity(cpudata, highest_freq_available); + x86_topology_update =3D true; + WRITE_ONCE(amd_pstate_cas_initialized, true); +} + static void amd_pstate_update_limits(struct cpufreq_policy *policy) { struct amd_cpudata *cpudata; @@ -1036,6 +1153,7 @@ static int amd_pstate_init_freq(struct amd_cpudata *c= pudata) u32 min_freq, max_freq, nominal_freq, lowest_nonlinear_freq; struct cppc_perf_caps cppc_perf; union perf_cached perf; + bool highest_freq_available; int ret; =20 ret =3D cppc_get_perf_caps(cpudata->cpu, &cppc_perf); @@ -1062,6 +1180,7 @@ static int amd_pstate_init_freq(struct amd_cpudata *c= pudata) =20 /* try to look up from BIOS/quirk first, fall back to (nominal_freq * hig= hest_perf)/nominal_perf */ max_freq =3D amd_get_max_frequency(cpudata->cpu) * 1000; + highest_freq_available =3D !!max_freq; if (!max_freq) max_freq =3D perf_to_freq(perf, nominal_freq, perf.highest_perf); WRITE_ONCE(cpudata->max_freq, max_freq); @@ -1093,6 +1212,9 @@ static int amd_pstate_init_freq(struct amd_cpudata *c= pudata) bios_min_freq, cpudata->cpu); } =20 + if (IS_ENABLED(CONFIG_SMP) && amd_pstate_cas) + amd_pstate_set_cpu_capacity(cpudata, highest_freq_available); + return 0; } =20 @@ -1203,6 +1325,7 @@ static void amd_pstate_cpu_exit(struct cpufreq_policy= *policy) freq_qos_remove_request(&cpudata->req[0]); policy->fast_switch_possible =3D false; kfree(cpudata); + policy->driver_data =3D NULL; } =20 static int amd_pstate_get_balanced_epp(struct cpufreq_policy *policy) @@ -1916,12 +2039,20 @@ static ssize_t prefcore_show(struct device *dev, return sysfs_emit(buf, "%s\n", str_enabled_disabled(amd_pstate_prefcore)); } =20 +static ssize_t cas_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%s\n", str_enabled_disabled(amd_pstate_cas_active= ())); +} + static DEVICE_ATTR_RW(status); static DEVICE_ATTR_RO(prefcore); +static DEVICE_ATTR_RO(cas); =20 static struct attribute *pstate_global_attributes[] =3D { &dev_attr_status.attr, &dev_attr_prefcore.attr, + &dev_attr_cas.attr, NULL }; =20 @@ -2431,8 +2562,10 @@ static int __init amd_pstate_init(void) return ret; } =20 - if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS) && - IS_ENABLED(CONFIG_AMD_HFI)) + amd_pstate_init_cas(); + + if ((cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS) && + IS_ENABLED(CONFIG_AMD_HFI)) || amd_pstate_cas) amd_pstate_prefcore =3D false; =20 ret =3D amd_pstate_register_driver(cppc_state); @@ -2441,6 +2574,10 @@ static int __init amd_pstate_init(void) return ret; } =20 + /* Per-CPU capacities are set during registration; rebuild domains once. = */ + if (amd_pstate_cas) + rebuild_sched_domains(); + dev_root =3D bus_get_dev_root(&cpu_subsys); if (dev_root) { ret =3D sysfs_create_group(&dev_root->kobj, &amd_pstate_global_attr_grou= p); @@ -2481,8 +2618,17 @@ static int __init amd_prefcore_param(char *str) return 0; } =20 +static int __init amd_cas_param(char *str) +{ + if (!strcmp(str, "disable")) + amd_pstate_cas =3D false; + + return 0; +} + early_param("amd_pstate", amd_pstate_param); early_param("amd_prefcore", amd_prefcore_param); +early_param("amd_cas", amd_cas_param); =20 MODULE_AUTHOR("Huang Rui "); MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver"); --=20 2.34.1 From nobody Tue Dec 1 06:22:16 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.62.35 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795627294; b=dmtg7IUfQH8a/R5tzfmntfeVHrJ16PLEM/UNdjUCRyVOLJrOLva59IX58CLI3g9EDwtl hx3bBLjc9hd6mQZlLAZlnSwG0TmLJStgK70Gsm8YMFsG8ThI/mPj713jfDr9nTUj8KTo8 l5vb6TJ+RNzgH3Jev+uPWAB7+/53f4Fm7rZ48Ls5SHSfffCbtja8f8UZTaggTwrU/kSdn wsCXV8V6VOxNt/GTvpdKtm0LJbSdvMx7zqwoRYqs6WWfJk2OHEWUKkU/1rpzK1FZ4sREC PWilQCRgkmMpffD4IzL1OqyvsSy0Y/kyr861lUkMFpOqmt7vg530rXRXW2L+XS5qAaA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795627294; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=T7/Ndim6esUPJAnvpwRukcqFj7pdfQRsiTyJVVPPwPs=; b=kDanYdPeyIN8Z2fAUITLwA4nHVID29UCRRyXuCP/pxFzUTvcuhGGL8yq87RUa8zKz9mM nCsJbt/YOj3mCYgIMwhXIqJMMhXc2kCb0FRj1M9B8ckHq5N0/sNu8+7mQx/8aXnY9iUXk M0MsZc7cCs110w/DRx7E8PVesFAuCXo+HF8vY3fjaY7bfFwZyv5Dx9HjIMEeY736RE0A4 iFGf0CMISbAEldKNZlJUxirtL5M8Uq8SQJ6GJNCIEGvBxZ/WMMz+BvAWdIU9xu/liDPe7 v6NyqycVmYCPBFoeaJUK+jysqpnevYnVDtDIx10bMbbKzoPZ1X15rfv6YBpwpa+nrRA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=LskjDRsH; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.62.35 Received: from DM5PR21CU001.outbound.protection.outlook.com (mail-centralusazon11011035.outbound.protection.outlook.com [52.101.62.35]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 705CA606A323; Wed, 25 Nov 2026 17:21:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 705CA606A323 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, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=LskjDRsH ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l6X8QWt/zpn8FVcAQW8EnzfnUXQ9for8uTieUZtW0QiLafjNWDnGDR9QUXIK8M94Kprlgu3nsJFd+rFS3Y8IrcWKYnYCZW80gRGgwdQ7WTQ7uK8+i7neNcYkssSBFW8N33hAlA1OFVokJc12foq4fV9IGI4wCQWwmvA/OgWvGaIz+JpbkdR6h85+QFQgJJdEgWN6tDlaOyUdh/EJxaDA6/goBvKFaWfXhJ/L1Q9hnFYT/LhW/seXRMtzIQ5P1PeLWlLxD7Ns/+f2FmQxxK4oF9cOPclwKAqKrGt9Se4lXCu5UydR0PMvG8S0SX6ntP7hMd8cn4vedvJmSWn1Gsx95w== 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=T7/Ndim6esUPJAnvpwRukcqFj7pdfQRsiTyJVVPPwPs=; b=RtfhiZMoVQxru9CCBbs8deCEAYHbu8W3qohRKkGJBF+BzL2+FvKSplt7ILrC4aQPD6LxR2Ib0dUu7qfNQEC1XWrpbOsbI3fEqK13tOGJwt481Z6s5byWBpAgD7Lx76t7Id4c9e8TS76UJJ09Sa/KMEN6/JswsgjoZcO5SgaRvgwNmMoYBtOdkAmjmmQNJ6fXsSQ+cdNDTiP68cMxQkiU+A0X3gmViKiwSqahHBLMCoWVLHI+vQ7mX7FWpYkdxDW9ZYFL4494WMKAkMwreSbcNHPAMnhFGeAsbsvtvQDVbup2hHUPNqGE0rDKXqe28YZaoAeMBHVUjZZCuZe2fhZN1g== 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=T7/Ndim6esUPJAnvpwRukcqFj7pdfQRsiTyJVVPPwPs=; b=LskjDRsHcpLnPz4Ppq32SFgam+OjHSrjKTKvQ8NKdj7FoR8MroA4PK33Qhpn3jx6WYYNbJ1nrwfMPKtJj8SsNhuzXlVoEnlqEkKw0diy7Vax0vfhv0nwRnXJtDxNe2CrnRuWLmNZZIKxjyDzpImM99GsAE41t9VEd5CkVJ562f8= Received: from CY5PR16CA0003.namprd16.prod.outlook.com (2603:10b6:930:10::7) by SA1PR12MB8918.namprd12.prod.outlook.com (2603:10b6:806:386::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.6; Wed, 25 Nov 2026 17:21:02 +0000 Received: from CY7PEPF000000F0.namprd05.prod.outlook.com (2603:10b6:930:10:cafe::97) by CY5PR16CA0003.outlook.office365.com (2603:10b6:930:10::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.7 via Frontend Transport; Wed, 25 Nov 2026 17:21:01 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 CY7PEPF000000F0.mail.protection.outlook.com (10.167.247.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.3 via Frontend Transport; Wed, 25 Nov 2026 17:21:01 +0000 Received: from airavat.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.57; Wed, 25 Nov 2026 11:20:57 -0600 From: Vishal Badole To: , , , , , , , , , , CC: Krishnamoorthi M , Vishal Badole Subject: [PATCH v2 3/3] platform/x86/amd: hfi: Stand down when amd-pstate CAS is active Date: Wed, 25 Nov 2026 22:50:31 +0530 Message-ID: <20261125172031.741740-4-Vishal.Badole@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261125172031.741740-1-Vishal.Badole@amd.com> References: <20261125172031.741740-1-Vishal.Badole@amd.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: CY7PEPF000000F0:EE_|SA1PR12MB8918:EE_ X-MS-Office365-Filtering-Correlation-Id: 80c541f2-34ee-4634-8819-08df4b187a7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|23010399003|1800799024|376014|261026140227099003|261022105027099003|10067099003|261026121527099003|261022075727099003|261021123027099003|261102123227099003|261021121427099003|261028144727099003|261009223027099003|6133799003|921020|22082099003|18002099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info: Q3JeHsyrfSM511Mr8+SXqRZYZIHb11S5o8hk4OlaPS3Ot9dz4xiHiLAsfkY3Gjge49GMCJj8HUEQB28OWP0/loexwDSULXK92zHk5PAb7OK7yR2UjbJzUpI8YCFHTVu3iLzwIFT/hdAjtr0yQm49qY/vP6//mga5I0nd7rjzVs341sAYVLCbxzp9xgY5w1N5lr5YMrczZ3rBZLwU3mSRrE+fTYfWNNQmGPI3SznKO3gZ9D2891HapXaORiikxUhhZrUFXwEcR+bmcb8+779XlvcoP6f8QTfjbk1fIYM0tnamJmWT+2NuS/2NkRSIBcdqxrBvkfOAXt5qS4pYofNqbOiewCZe8WSNRA0T7fWEEjjcZLHZsiojwigUhvCuLyOU/lCq3Z+TrD9W9Z1FsznNr0eXmT4k9CFlO/J3WMpnfHRBXGLnsOQibnGxFGu2SEk+ypYLfZo1GdETyCkTjE9jwQ2sZ/+xajRdHJJswXQBiUZu7pInbHHJ5dZVlklaAcS8iH2lospzr6oVCEZFoU3qzgJYxQ8k6Dj9Y3A4pJ1S20zVhDKATrgA8fCGDPC9je/F1+C4YrYfx6ACQ5pWmS0MHrhSSwAoQv3HBPuV4c8/RT6ksz0+fIBq31SWALlz+dSlfvA9v4VubBcMoewCLBt31h0fxG+7erif3AugNFZpSKwxt22sUqf8rTCKoB3v6BYSALIfcADHhI4NPlxEVRRG6D5REOZFqfCTym1sAFwlOFqDhd6Y9RjuHW6HXufrYtlk 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)(82310400026)(36860700016)(23010399003)(1800799024)(376014)(261026140227099003)(261022105027099003)(10067099003)(261026121527099003)(261022075727099003)(261021123027099003)(261102123227099003)(261021121427099003)(261028144727099003)(261009223027099003)(6133799003)(921020)(22082099003)(18002099003)(56012099006)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O5Ah+jpuQyQUVPcrrPPYPYrOT5mFdmhhAthg+iqZBB22seETDTE8MmxnHiXuUalr0yfvb1JspyLSZdF9Covoj/aObWrjDzGYP1qRKZljmgjAykWismxEkrIaMTG/VfLfFdT1FdgPInbcceC6bZQB5N8dB/KFXzM7VEtYpD6wW3Ypy1Tab9xqtTOwtAp8e/j1SXPqTsVe19SLWc8QkfIw1Ctb6r4qP1O9T0teVVh/61oauQecAx7YDdRIxi/mjqwtI4/n4xwVH2Novo3narCk+sGH+c7aurqhXMBNORLFZD5Hr2wOHhmkkzedsoaRgfB/FZgCLwuxEL+iWgcGtpnwy9fntJkGAEFgT2HY21R7V3TzsOCXJdvEGG2c+vxG6rF/fAM4FJnmptjQhYIwrXT5j+hiQgSWC+I7EIifTP+kg06c41sSJe7EnfSOqlC6OodI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2026 17:21:01.4969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80c541f2-34ee-4634-8819-08df4b187a7a 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: CY7PEPF000000F0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8918 Content-Type: text/plain; charset="utf-8" From: Krishnamoorthi M When amd-pstate CAS is active, it takes ownership of per-CPU capacity values that the scheduler uses to distinguish performance and efficiency cores. amd-hfi manages the same scheduler state through its ranking mechanism. Running both simultaneously would cause them to overwrite each other's settings, leading to unpredictable task placement on hybrid platforms. Avoid loading amd-hfi if CAS is enabled. Defer HFI driver initialization to a late initcall so amd-pstate completes initialization before HFI checks whether CAS is active. Signed-off-by: Krishnamoorthi M Signed-off-by: Vishal Badole Reviewed-by: Mario Limonciello (AMD) --- drivers/platform/x86/amd/hfi/hfi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index 86a7f4332c35a..73e53203a838c 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -27,6 +27,7 @@ #include #include =20 +#include #include =20 #include @@ -536,6 +537,12 @@ static int __init amd_hfi_init(void) !cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) return -ENODEV; =20 + /* amd-pstate CAS owns heterogeneous core scheduling when enabled. */ + if (amd_pstate_cas_active()) { + pr_debug("amd-pstate CAS is active, not loading amd-hfi\n"); + return -ENODEV; + } + ret =3D platform_driver_register(&amd_hfi_driver); if (ret) pr_err("failed to register HFI driver\n"); @@ -547,7 +554,7 @@ static __exit void amd_hfi_exit(void) { platform_driver_unregister(&amd_hfi_driver); } -module_init(amd_hfi_init); +late_initcall(amd_hfi_init); module_exit(amd_hfi_exit); =20 MODULE_LICENSE("GPL"); --=20 2.34.1