From patchwork Wed Oct 23 17:43:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13847755 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2070.outbound.protection.outlook.com [40.107.243.70]) (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 CD50A4087C; Wed, 23 Oct 2024 17:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705487; cv=fail; b=EE9mEHJQp6TBKDoCTWrZWWoeWRog5MNhlWCMqT+xuZBthMLt3fNm3dV5ipsd/t+TwDntxIkIOparnRQwqvBF0H938BjYiN9t+5Ax15MO022ajKm7zn9SRjp/Z+FbPSrY5j3TFqdoutEuMDlEwIfyGtk95ljdIArWtgknBZIIlTI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705487; c=relaxed/simple; bh=REB58hOKyh7fDFvVeANX71MO9NXKoJuFtGfohz8Voug=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lvg1vtT59oOp7afhC3teCJZNHSHWVn5x+eyHV0KIat+284OR66qmopA1BPQxTjaYE8zoeG8rSHk7mEjr+W0Jpk5YvQxYmvOXlSwhY0/q3pNNxkz8i/cKVPbuRAE7GerOzrZ7nCpny8kjRY73/ZuTRb+HBVUHNDX9en1Rbbwx28w= 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=LWtyaJd6; arc=fail smtp.client-ip=40.107.243.70 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="LWtyaJd6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O1XXLosJUo/j6u8H0ynIJchnUTH3GbMXEpvHuYkYO4nSIg3XWuicu0wKqSZTpBRUDkYzo0HQye8r9xfRTn4MZT8anYNX2wsU2W6BwRgqgK27nDWYXQ/TEQCsEVI5nRLdsS3+IJ7WcaBGl+v9ZpOECDHKuEtVSo5JXudUPQVnursGNNStkfOy+KFLF13qZiq3O7B4v0/9sXqe7vuU+QtBYr/Vmn1H3OpqFYVNj8ba+lLrr9QhfoB3mX97QBBYXE9ysSj8GcvUp+7RsfG31h40Y1q3puVuJXadKm6FpBTZzAMCckfxGVtY8+S+foe7tKUKvXg/1jLxIUF/gZdReZnVGg== 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=/52ZQsp8XV9x/pV4X0hD1rqA9RC0NtMeG4YHn071exQ=; b=zEYfKP8zO8akJw7KNWzmHOclxumyLOjrumODSRtWHnECss7Vf095EvWIzBhnW+iM3U6mC3dnmZwP9RKjMDSErEIsA1/F9px42B+79zt9MIdrYAiId21dlK0K2wDUtHCzZOW8Pu9/m4yEyPL9+5qHcxEYmcGhGTi4bX8DPpHOM6QcclIg+jANMVltKcY8kk1oQdD2lzkxH/ieMqBsRKhcTPoJCC7sC1uaSFqzAfC5y7O11+gftD34pQuRriAH/axjpNWxoHQW1LSAH3Fp0qX4glC4TzSdU6sseuwwVrxAXZJRnAf+LxGiUrdmGxg/yGHUVstTQiho2Y2j2pCbZeXaeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=/52ZQsp8XV9x/pV4X0hD1rqA9RC0NtMeG4YHn071exQ=; b=LWtyaJd60+FsQkhH5msyeNasPeaERgLASHymC1O1q+MWJ3QkQiBxadzfHbP8F8ToWNk68T0taYDobalCygr/v/KeFpwcI1B/YvHnaJPU0eS41o0gbXytiuXXv3bfjJ+VcHgLXIXhrhhAN5OsFKo5oExEZuFDj120fCh8K550PLk= Received: from DS7PR06CA0006.namprd06.prod.outlook.com (2603:10b6:8:2a::7) by DS0PR12MB7653.namprd12.prod.outlook.com (2603:10b6:8:13e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 17:44:41 +0000 Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:8:2a:cafe::9f) by DS7PR06CA0006.outlook.office365.com (2603:10b6:8:2a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:44:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:44:40 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 23 Oct 2024 12:44:36 -0500 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v3 1/5] x86/cpufeatures: Rename X86_FEATURE_FAST_CPPC to have AMD prefix Date: Wed, 23 Oct 2024 12:43:53 -0500 Message-ID: <20241023174357.34338-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023174357.34338-1-mario.limonciello@amd.com> References: <20241023174357.34338-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|DS0PR12MB7653:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b6951b2-e04d-490b-bccb-08dcf38a5f4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: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r/aPWCqRvCu1gUr6nQkrp3Rga4a0WW3iUd7w6DhHU+ns0FCVydXZCMU6CyFsBhJ3a6CV1fqC/VpnW5UKGRhraYdFsSLk3Dl6o7rEJv6jbvY/NFzw3/p09sBIzCFqcDBap7b4PvgUIB1xwIqdd5FAnkVmnhuWmBHEG6HtE+dAjLP/mBxW86pRL88WOK0PLJ/vOYXB/i8C83mXrRLJBWomVjg3MfE0e9TKloEM88V+0TbR/ag64ZxRCZri2GoeCtusvIFBqzBrsshspyjTnoiTUI5fxCSAqypiEK5SKzlN5fljG01jp58KM7vmq17RomJyO54EfbprEr1CqKoO++VxB3MeOKQN9n4vtjpeAcb8+UH4zDXndol2sd1kv5+E//NmgxuuSQo3SZKWzTxel2++eJKfcLTGXI5IbaLVGnbrnljxWNhc+g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:44:40.8146 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b6951b2-e04d-490b-bccb-08dcf38a5f4f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7653 This feature is an AMD unique feature of some processors, so put AMD into the name. Signed-off-by: Mario Limonciello --- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/cpu/scattered.c | 2 +- drivers/cpufreq/amd-pstate.c | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 913fd3a7bac65..aa63437a677c0 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -473,7 +473,7 @@ #define X86_FEATURE_BHI_CTRL (21*32+ 2) /* BHI_DIS_S HW control available */ #define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */ -#define X86_FEATURE_FAST_CPPC (21*32 + 5) /* AMD Fast CPPC */ +#define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* Fast CPPC */ /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index c84c30188fdf2..1db2bb81a3847 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -45,7 +45,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_HW_PSTATE, CPUID_EDX, 7, 0x80000007, 0 }, { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, - { X86_FEATURE_FAST_CPPC, CPUID_EDX, 15, 0x80000007, 0 }, + { X86_FEATURE_AMD_FAST_CPPC, CPUID_EDX, 15, 0x80000007, 0 }, { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index b63863f77c677..717b4cf4d9c4c 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -847,7 +847,7 @@ static u32 amd_pstate_get_transition_delay_us(unsigned int cpu) transition_delay_ns = cppc_get_transition_latency(cpu); if (transition_delay_ns == CPUFREQ_ETERNAL) { - if (cpu_feature_enabled(X86_FEATURE_FAST_CPPC)) + if (cpu_feature_enabled(X86_FEATURE_AMD_FAST_CPPC)) return AMD_PSTATE_FAST_CPPC_TRANSITION_DELAY; else return AMD_PSTATE_TRANSITION_DELAY; diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index dd4682857c120..23698d0f4bb47 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -472,7 +472,7 @@ #define X86_FEATURE_BHI_CTRL (21*32+ 2) /* BHI_DIS_S HW control available */ #define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */ -#define X86_FEATURE_FAST_CPPC (21*32 + 5) /* AMD Fast CPPC */ +#define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* AMD Fast CPPC */ /* * BUG word(s) From patchwork Wed Oct 23 17:43:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13847759 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) (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 696211D0797; Wed, 23 Oct 2024 17:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705491; cv=fail; b=LitH24zPe2lXZWvudS/BuhNuk9B8mH+bvwXL0kqPEStSnI8bxe1iSkGoaelMy/toOOF4lX+TeOjGd+mpmWcPL8CKWh+IIDzk59VRQePZd3OyG+JnuPpP2O0iPxKy6BoBdrMDrEH4SA+cJVa8vzZ62CD9Mue5vvjqaG+g5CMpvzQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705491; c=relaxed/simple; bh=jJOLSzkvfP7p+b855UfbCFJoiHhCs8fMRL0tZBRLgZM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ke59hbRykGqs7nbYaT4XcTiP13j6pJDQLg20vXHl45dO2itWl+tmTQ7EaDXSsMfBOK1gxlf00+KlFBRsmDIKCLHSX5Ubjp665q+CprZVuNgZaOsbq0gmxb/H8OfmfqomfVfy9KZcRJM10bNGWr+kXx71Fvd6vvRWH0FiCWVA/X4= 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=wS7h1nbF; arc=fail smtp.client-ip=40.107.223.70 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="wS7h1nbF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tOfVAfhAJ8LMErZ6TatimREU+K1iGVsM2tTB76aL3PIUQGDXAaWdzmzOgyZVd4GTgGAVxSHWIByfoR9zqEEIoKt0wDif5oWYVffuPON79qpLAYdxKjSYW7vrU6BQp7mFMWnAHiyQk/L5l+f2ZjP8aAsKLwNc42N14d33ShcE2+lGrc2P65IC2+eS7WwDTChZ41fjL6qMeTWcmtWkna7IBlEE4Y+BjVvrpGW1hXCrbgf0Hoy+/qA/aoQCgmfBcCEiuE7eJhLxDqdquh+gSHWgj3ifQLuXyMy7+6UDOoOcZeyw6DYaOoePuWh+7/yI5lBfWue2p9LahQeN5G3UyCEWcQ== 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=hDBw8le5kBLx+UpjItK4zlvcDmURMDII5ktiQNH5RNs=; b=XZwzeEVcpxIt3HtmRjbZd7WvFWkvAEAJv8nZ4HU19Cih7AZbrq2eEZFiSsSY/taLn+tUzkoLRy0wPX73s/exMjU8+VORQVjshJf0nhNzMKgi7prt0kb8f4jMMebHbgr4iYlUdPMwCxvC/EVdlZwQZSy5EB2fnfICNsJPnFPNY51zBbHwzjtafjJatgTH5lkucBIWE2GUmmC0lanEmiY/PbpI1beg47dqGO5Jc5hUmm3yEiZ/O4hRwY7QKgr8pwu6obrqpV/HISOVHBh8pd9GdKbHf/OMYWcXz0SPs3GvA8vxRw3fxt9CZ4dD+S9k5lVyMQQzgnu6eKyhWmu5v1Zw1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=hDBw8le5kBLx+UpjItK4zlvcDmURMDII5ktiQNH5RNs=; b=wS7h1nbFKjHCJZniNn0XHDMmKxO2XqfZy6o14ZcQtPMcR5C6KiMwqLIHq4+xRhTa2+nTqCMk7L/ZRopWju6uFGceAfmDkoRD6TOAdjcPt8jVK+ZFPgFTERYPRt8WlCWneXCDPSr4IeWnuYRCtLODTHiuN0BbDRWrx6Rdlmr/qk8= Received: from DS7PR06CA0006.namprd06.prod.outlook.com (2603:10b6:8:2a::7) by PH7PR12MB6785.namprd12.prod.outlook.com (2603:10b6:510:1ab::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Wed, 23 Oct 2024 17:44:42 +0000 Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:8:2a:cafe::3c) by DS7PR06CA0006.outlook.office365.com (2603:10b6:8:2a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:44:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:44:41 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 23 Oct 2024 12:44:37 -0500 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v3 2/5] x86/cpufeatures: Add feature bits for AMD heterogeneous processor Date: Wed, 23 Oct 2024 12:43:54 -0500 Message-ID: <20241023174357.34338-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023174357.34338-1-mario.limonciello@amd.com> References: <20241023174357.34338-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|PH7PR12MB6785:EE_ X-MS-Office365-Filtering-Correlation-Id: 781efb4d-efd0-4052-06dd-08dcf38a5fbb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: L/BNP3VvHTl6Jt6bkGH8lJX5vQxhppkPyfa6yMOIsyTFrfqBeywOBuMUwtQYS35Sw5JtZRMKMgTfMOJCLzF/AwEfNMiDwLdHy/k3r0bJVeH/BA8H1EkuXt956hqGLHlM+ZP0LhbtpBZ/bkZNWdC/14nGkEJi4bqRbIdo19jVsd/fIGwrfXO7oTRFl9dpQbUJrJs9lnI30qG3/ik3iOAg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sfue424CuisgNPdLmun3SJbD3KyvEts9H7lXV+lLqzoPpdoaUSlO0x+Ln17KXuNsX8OBVDlGk5dkVjN8AoQIR7r+zCpBJ7R8ZLogPNsGBJTSJNpy/k1WcnZq8WliJOQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:44:41.5646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 781efb4d-efd0-4052-06dd-08dcf38a5fbb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6785 From: Perry Yuan CPUID leaf 0x80000026 advertises core types with different efficiency rankings. Bit 30 indicates the heterogeneous core topology feature, if the bit set, it means not all instances at the current hierarchical level have the same core topology. This is described in the AMD64 Architecture Programmers Manual Volume 2 and 3, doc ID #25493 and #25494. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v1->v2: * Drop tags * Squash original attempt and new changes with feedback together --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index aa63437a677c0..51b38bc667960 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -474,6 +474,7 @@ #define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */ #define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* Fast CPPC */ +#define X86_FEATURE_AMD_HETEROGENEOUS_CORES (21*32 + 6) /* Heterogeneous Core Topology */ /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 1db2bb81a3847..307a917415343 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -52,6 +52,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_PMC_FREEZE, CPUID_EAX, 2, 0x80000022, 0 }, + { X86_FEATURE_AMD_HETEROGENEOUS_CORES, CPUID_EAX, 30, 0x80000026, 0 }, { 0, 0, 0, 0, 0 } }; From patchwork Wed Oct 23 17:43:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13847756 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2080.outbound.protection.outlook.com [40.107.95.80]) (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 099231BCA07; Wed, 23 Oct 2024 17:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705487; cv=fail; b=Yb57ARw9vycTmuJ8I/9TS7AjOd81MSWBTM1WRo1VuHxC3HqJt7OEKbfv2ipjXiSsq/u1VaiFniXXzhVVyGqrTMIhLmWSR5+S9XaGXaObPaMrnhC+9mnXFnuAawPBCmXtBUB/78Y4mN1UgSa6/D4tdsLka3S+cGAdr88d3/sxc1I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705487; c=relaxed/simple; bh=Plpaew6OcjYJ3boxDMwv3bLOAsi+CZaMGQTANUmHM5M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rY393UofaNiiV1J8r+HS87g9hzCU+1bQwRpmKNSXVfT040f/CpqRtI4sBjI2kzraiatqrDhoOv883nFv8EsxOBljJXDrPt/ewq70LUYwjLp9fRgN4Mek6t7vn4JiXnMBkIARhmEw2OZrp5k9PZEdizDwlPAZref9fMnBfebQRbo= 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=V/lM40Y9; arc=fail smtp.client-ip=40.107.95.80 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="V/lM40Y9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=it4WgkHNDr8HjlRh4NsKwZy+YxPt/dpD1RlWnT83r1GHRAfHS/sPu4ruB+swX1M9tkySgeJq/9iVEC8d9Cz2pb1B2tJhKd2d61BBfKqsqnPrc02KtXqv65XGHxrbjA7Bc7hbsmpEx0AQIh+FXSxmWhJKpe+f3SlX/PLXi+dxtWoWhB56JMHIcovq8sFGdOf6hNqjBSjIH/Vw1VFMGSZkYfJkhjpob0jCbZBML8es1bLsjF200drrmlJyygTKUql04Sde5XjXgdDyzCNeCeEdRaTVe0q2uBT4Xp95mKSJ0O5BDgz532BNw722UfaeNwD7fUeKJo4JJPVhftU5My6lpw== 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=xUSFho06aSLaoMID3uGBG3sYCSv+5pvelFzxIkM5jSc=; b=BC6hRIQ74aHE9Qs7jxvUdQRZUcmMSJ5urANSLeJ+ACmrwqmLcghnsKmlaHmlW7YKqFnwfenXZ/MJiGVYifeR/K8E5XqFfE+76y1gMFGCy42NyBKp93drazcHCVV4JQnrk850p9PRs54a2h3MNsRwm2r3fI4eLXAchGfoK8HNdEEsCC/LUIroAGA+k5hlIbFuBkY5sSQY0HBQ6yCx/AVmP5C60iQms5RcCce5hQIVKunqbnXN2Vtx+MO6M6zR9oCaWpMpQ9wAHlpeHQdzXGPwQ9MuQvaMrL5lkI9BxJ2xlA9zCTwc6LLBh6Ad6lvqesoahjB24eEmsStSoWF2aiJz1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=xUSFho06aSLaoMID3uGBG3sYCSv+5pvelFzxIkM5jSc=; b=V/lM40Y9J81GeWeOwBuP/4ZFZLWrpJ4R0f30RuvLZYULobexVTCk64LVPoLDTjb1il+iGfDC40AXtVO1lBK0S6r3cVnsAincCZ+DoRi38ePq0Op3CV6/nGxII82wGEevNmkb9cc2eHSezyBlh3IXJ+P1i2QlUS+arB82wRMkdWw= Received: from DS7PR06CA0017.namprd06.prod.outlook.com (2603:10b6:8:2a::24) by CY8PR12MB7315.namprd12.prod.outlook.com (2603:10b6:930:51::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.19; Wed, 23 Oct 2024 17:44:42 +0000 Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:8:2a:cafe::4c) by DS7PR06CA0017.outlook.office365.com (2603:10b6:8:2a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Wed, 23 Oct 2024 17:44:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:44:42 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 23 Oct 2024 12:44:38 -0500 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v3 3/5] x86/cpu: Enable SD_ASYM_PACKING for PKG Domain on AMD Processors Date: Wed, 23 Oct 2024 12:43:55 -0500 Message-ID: <20241023174357.34338-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023174357.34338-1-mario.limonciello@amd.com> References: <20241023174357.34338-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|CY8PR12MB7315:EE_ X-MS-Office365-Filtering-Correlation-Id: 02ddfe8b-cd4d-49b9-c4b3-08dcf38a605a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: NNtnSzRYVeTPP06gFQTOdTYdo3Gi6ePGbhVAMbFcmgbxqua0fqek5t1sIOmqltwAlS25913oUosfrh/8lp5k+mUOXKJbjQM6BKyVRNF5082QeqND1h0XaBEIWfYyBwJsVkxTUfpz00pd6dSiKCexGlM1OC7eCo+IfH90yjdlZ5o6gnqfM7D1axL00AQcf8fZtoSYhN8KUaPq3x6/pYDHwvqQYyY8NRy7Df/cVyEquwYX94h9r4BxpIkHWnYNqG8iAgmhBWL9za//pI5ewMWM/S/HUP9U7rbIaqHpkaFXP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/gD5xKAeQzv5VGTbrr4YfzhPny4OuX9Vp8w6bOVYJ9/fYgM++NLUoCobA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:44:42.5646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02ddfe8b-cd4d-49b9-c4b3-08dcf38a605a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7315 From: Perry Yuan Enable the SD_ASYM_PACKING domain flag for the PKG domain on AMD heterogeneous processors. This flag is beneficial for processors with one or more CCDs and relies on x86_sched_itmt_flags(). Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v3: * Pick up tag --- arch/x86/kernel/smpboot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 766f092dab80b..b5a8f0891135b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -497,8 +497,9 @@ static int x86_cluster_flags(void) static int x86_die_flags(void) { - if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) - return x86_sched_itmt_flags(); + if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU) || + cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES)) + return x86_sched_itmt_flags(); return 0; } From patchwork Wed Oct 23 17:43:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13847758 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2086.outbound.protection.outlook.com [40.107.220.86]) (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 5117F1C9DF0; Wed, 23 Oct 2024 17:44:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705489; cv=fail; b=TCre1yGNXK6GmunazQqkBg28Co7FGfNrt6MhEKqf/ryioQwNPRywq0e/sM2kp3la5sY7P+uaEt/qKdeiQOCketJZmuBfCjQMKDiReIdp5lzmF37T601V+HrsY2hW4wLu6jZpZC79McofLEY2zMEmXhs/hOHz1q2x9tlITbXzSks= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705489; c=relaxed/simple; bh=/D63Q25KjY8gAZqJzmI82Fx6EC4b55e0Fwxdsbyqn8A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SEPOI16Y3gUM/nRTjhm4UU/SwGrvo+NAMNYefGJG7cP++MqrAOS9AWj8mRWjhoMW3QLIiHPhh0Dw7c53VaE6a7oPrd7bWrlJMrnj1cWn+HTCRq36wnCcdiw+IPLWuABGAJ9AtEDaysHdLPfkxZ95EcOilcjQBLe+h8LUUZ5MANU= 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=EgSuisx7; arc=fail smtp.client-ip=40.107.220.86 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="EgSuisx7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JPoI50RFdtyiOh7ha6FQlFWzHx98Hhmv/tkmYQJDGIhOqBSmeYnvqSgb+rfbQA9WN2ag98Ctk6+4ActM2vw91TlrqiZcaHsgIKa/4zCITzcBdowGSVXioJmXzTaTUlzri9oedhT8n9q+4m95eODxjeRirhFCEJ1DTKEpH37v6QTxD1uix5/tD1jR573HdaxsLQ96aEvohxlqUDHp1sFGi+ulNQvmSD4h0TPdcW1SDj79WYyc3DC/Sjo8I1yg8nI8rZ9Lq7LM+zed0cRrTfijXDaIqtdNoGv5V/1JNWLHtopnPmYt5AgPdNSoh3H/NEY39NLVAmjA8MEIZrCZo+8KdA== 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=Vi23DQjRuosKmxswA1gpCBi8BwBcnoPIVfbl2NWRQ2A=; b=t4uYxkj2NhVYwm9ES+70Kr5U/lFT8PZi8O2287M3zPNctYV2zmh7FbOYVbxu/01ozjY6a20t3TvlUxU2ytYi8zlm/M9WnzBi03Vr0fB24lux6ZsXvq7rLdsApJx9H89U5F+kUO8vZEqDOxC6EM3/7XZJUdMB82R40Ny2BippuTFp59kR0Fb3PYEz/ez0xRVcfiUK5RiBnnFUa7JGf5KiKg/KddfIcGmbKhQIihgnnlYdrRhFFVA/wzKNzlNXSX3niEUSk1FkyY5kjQ56cjLkZ+VEertzPI6tydY7toMivsw+rXfOR7Kta9ZfIsjgp+PFA8SCqpGsmHZSz8Fo2tpfuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=Vi23DQjRuosKmxswA1gpCBi8BwBcnoPIVfbl2NWRQ2A=; b=EgSuisx7kH+Cnw1vQzFDH328DBhWkUWy9HUEhVjsZPSdJYQCcD5r0zJztdJh/Jzi1yuuqzCyQzUdn6FrdRqSLNCPxfWmbAyjSWgytzFcUJSGm3RCfl5cuw0fQdLLI1jStWCftiT7JaZJVtl6CASc4oIGbxl5YInBxpSdnq1iZDo= Received: from DS7PR06CA0006.namprd06.prod.outlook.com (2603:10b6:8:2a::7) by SJ2PR12MB8181.namprd12.prod.outlook.com (2603:10b6:a03:4f6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 17:44:43 +0000 Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:8:2a:cafe::9f) by DS7PR06CA0006.outlook.office365.com (2603:10b6:8:2a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:44:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:44:43 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 23 Oct 2024 12:44:40 -0500 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v3 4/5] x86/cpu: Add CPU type to struct cpuinfo_topology Date: Wed, 23 Oct 2024 12:43:56 -0500 Message-ID: <20241023174357.34338-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023174357.34338-1-mario.limonciello@amd.com> References: <20241023174357.34338-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|SJ2PR12MB8181:EE_ X-MS-Office365-Filtering-Correlation-Id: 49bcdb5f-a964-47c2-8533-08dcf38a60bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: VCTEEN8OXFj+wubX+2AfM5o+1Vr0hsfRBnhska8h5TRaKhho9O6j/WttTQ3ClLV6Bl61+iM9en4zuFaFQxVvKTnoxw/FMPpRjGHxyrkjd6fVX9VP9rrRQj7PygLf/atasbgBddGD8/tEENVuuJRjdGFzvHg7uSFyDw0lP07bQrXZXD6/DCxXjU9gvyKPAb4ch+iY9AbVeWI5MQmZZylrsfKlM5DW7rWvOisg96dqynjeQusab43FejykngDh8KjMrlM6SMIXgLFkSO2wIYFwQZw4+YMeGktnj0XUwfqd4VC3H3XzBs+//MY27h/cp+rcSkAdYo6NZtSvC/OeCXyZV4TA5QDVYW2QrhihT5pO0Vc7B8N+r37NH51SLRW/pOc8lr7I2wNP8dyTD18dB5SzzlnOpMZOPaI/xOkG0jQ2Iep78FTcIoaiuxCPvf6VENbsS7Sh9Cl1L3QBeiclAWmdOOT0Q2I/w+MmCnE36hnmmJXLeA+vwXyvGSUgUW/yUJk4nL1IZz0Tm2cpn3ER50tEitcFJYsyY/M30wzW3f0Lq2qoQ1huxUx+pUmvesNUA7LRK9l51eF61/hf6Jkm4QDdz6Jq/y0gcMOJWJ64Z86oKstouVSNvSycE75GSJx5/KVZ6svmkUYzZWEToX+WMpf7CvEhrmBdtukjGWE2tmIW3SQeZAA4eYaSQrMOcqnw85pY+fojqV+5lMJD1IINJvnmJ3PDDSNBZ/+1JJ06axDdoDrysTV8qEkgnj1+7fRelzDh2zw/1vlZPUOpHRnh27tHE2DVSTl0kyR2qmTDEv4WU+v1DvO7Kqm2s80rsGFou6MC25JLnO36Ob/tkwZvgtVozoDVBvI9XtTyXC4Cs5wf5dE1xMojjdNBCPQWtU9KnnBgIX+fvvbJy6b6vGPYAcl35pKfK7sa261duWwHbskcGvsQd5lbTVz2/Vx5p+++NSaWpqG9EAPW3dgipfvyH5/YZasU4Vwvn3zMdv62VaurfqaMNGIl2xsOdn2Sgf++xAMqOmDvYYqc5D6aXbs770SBPiGlbpLsk7ONlvshhh6NaT7eY0IWvvctgI2dxvgnqAIbaoMi5WIn21fnduh2aYNgYvlPi/AVa2FLwTRaQ4ncQ5j00YDGkwEN6UdTYmNB2g4yHG3Vjv7v97IOtmxVH8NUxC4lNi6AIVkX74m75rbegQkrPs1ww22+40uo6CVzISq44G+TBmxSqzeMe+rJSFQx+atf4Yna6NsNsl1iuw4/+FIqN6lWM+TZcT+VbguUp6m/5qTqBGUPO6STY5Dei85QJJc/jsQKRlYVQCVLo04vm5WE3dvYtCtC0qOXQPDd+XuY5PlE5943GxaQRq8wm+OZVOTBaAe08npLgcyTa11Ejc5j6SHd9ZTc8RweHawZnY6qFFerIWifgTGFSkK4BZSg8g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:44:43.2209 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49bcdb5f-a964-47c2-8533-08dcf38a60bc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8181 From: Pawan Gupta Sometimes it is required to take actions based on if a CPU is a performance or efficiency core. As an example, intel_pstate driver uses the Intel core-type to determine CPU scaling. Also, some CPU vulnerabilities only affect a specific CPU type, like RFDS only affects Intel Atom. Hybrid systems that have variants P+E, P-only(Core) and E-only(Atom), it is not straightforward to identify which variant is affected by a type specific vulnerability. Such processors do have CPUID field that can uniquely identify them. Like, P+E, P-only and E-only enumerates CPUID.1A.CORE_TYPE identification, while P+E additionally enumerates CPUID.7.HYBRID. Based on this information, it is possible for boot CPU to identify if a system has mixed CPU types. Add a new field hw_cpu_type to struct cpuinfo_topology that stores the hardware specific CPU type. This saves the overhead of IPIs to get the CPU type of a different CPU. CPU type is populated early in the boot process, before vulnerabilities are enumerated. Signed-off-by: Pawan Gupta Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Acked-by: Dave Hansen --- v2->v3: * Remove a bunch of boilerplate code * Convert to showing string in debugfs * Rename to get_topology_generic_cpu_type/get_topology_cpu_type_name * Add Intel definitions to intel-family.h --- arch/x86/include/asm/intel-family.h | 6 +++++ arch/x86/include/asm/processor.h | 18 ++++++++++++++ arch/x86/include/asm/topology.h | 9 +++++++ arch/x86/kernel/cpu/debugfs.c | 1 + arch/x86/kernel/cpu/topology_amd.c | 3 +++ arch/x86/kernel/cpu/topology_common.c | 34 +++++++++++++++++++++++++++ 6 files changed, 71 insertions(+) diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h index 1a42f829667a3..7367644720484 100644 --- a/arch/x86/include/asm/intel-family.h +++ b/arch/x86/include/asm/intel-family.h @@ -183,4 +183,10 @@ /* Family 19 */ #define INTEL_PANTHERCOVE_X IFM(19, 0x01) /* Diamond Rapids */ +/* CPU core types */ +enum intel_cpu_type { + INTEL_CPU_TYPE_ATOM = 0x20, + INTEL_CPU_TYPE_CORE = 0x40, +}; + #endif /* _ASM_X86_INTEL_FAMILY_H */ diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 4a686f0e5dbf6..c0975815980c8 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -105,6 +105,24 @@ struct cpuinfo_topology { // Cache level topology IDs u32 llc_id; u32 l2c_id; + + // Hardware defined CPU-type + union { + u32 cpu_type; + struct { + // CPUID.1A.EAX[23-0] + u32 intel_native_model_id :24; + // CPUID.1A.EAX[31-24] + u32 intel_type :8; + }; + struct { + // CPUID 0x80000026.EBX + u32 amd_num_processors :16, + amd_power_eff_ranking :8, + amd_native_model_id :4, + amd_type :4; + }; + }; }; struct cpuinfo_x86 { diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index aef70336d6247..795619ea13346 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -114,6 +114,12 @@ enum x86_topology_domains { TOPO_MAX_DOMAIN, }; +enum x86_topology_cpu_type { + TOPO_CPU_TYPE_PERFORMANCE, + TOPO_CPU_TYPE_EFFICIENCY, + TOPO_CPU_TYPE_UNKNOWN, +}; + struct x86_topology_system { unsigned int dom_shifts[TOPO_MAX_DOMAIN]; unsigned int dom_size[TOPO_MAX_DOMAIN]; @@ -149,6 +155,9 @@ extern unsigned int __max_threads_per_core; extern unsigned int __num_threads_per_package; extern unsigned int __num_cores_per_package; +const char *get_topology_cpu_type_name(struct cpuinfo_x86 *c); +enum x86_topology_cpu_type get_topology_generic_cpu_type(struct cpuinfo_x86 *c); + static inline unsigned int topology_max_packages(void) { return __max_logical_packages; diff --git a/arch/x86/kernel/cpu/debugfs.c b/arch/x86/kernel/cpu/debugfs.c index 3baf3e4358347..10719aba62768 100644 --- a/arch/x86/kernel/cpu/debugfs.c +++ b/arch/x86/kernel/cpu/debugfs.c @@ -22,6 +22,7 @@ static int cpu_debug_show(struct seq_file *m, void *p) seq_printf(m, "die_id: %u\n", c->topo.die_id); seq_printf(m, "cu_id: %u\n", c->topo.cu_id); seq_printf(m, "core_id: %u\n", c->topo.core_id); + seq_printf(m, "cpu_type: %s\n", get_topology_cpu_type_name(c)); seq_printf(m, "logical_pkg_id: %u\n", c->topo.logical_pkg_id); seq_printf(m, "logical_die_id: %u\n", c->topo.logical_die_id); seq_printf(m, "llc_id: %u\n", c->topo.llc_id); diff --git a/arch/x86/kernel/cpu/topology_amd.c b/arch/x86/kernel/cpu/topology_amd.c index 7d476fa697ca5..03b3c9c3a45e2 100644 --- a/arch/x86/kernel/cpu/topology_amd.c +++ b/arch/x86/kernel/cpu/topology_amd.c @@ -182,6 +182,9 @@ static void parse_topology_amd(struct topo_scan *tscan) if (cpu_feature_enabled(X86_FEATURE_TOPOEXT)) has_topoext = cpu_parse_topology_ext(tscan); + if (cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES)) + tscan->c->topo.cpu_type = cpuid_ebx(0x80000026); + if (!has_topoext && !parse_8000_0008(tscan)) return; diff --git a/arch/x86/kernel/cpu/topology_common.c b/arch/x86/kernel/cpu/topology_common.c index 9a6069e7133c9..60d5d74189a30 100644 --- a/arch/x86/kernel/cpu/topology_common.c +++ b/arch/x86/kernel/cpu/topology_common.c @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -27,6 +28,36 @@ void topology_set_dom(struct topo_scan *tscan, enum x86_topology_domains dom, } } +enum x86_topology_cpu_type get_topology_generic_cpu_type(struct cpuinfo_x86 *c) +{ + if (c->x86_vendor == X86_VENDOR_INTEL) { + switch (c->topo.intel_type) { + case INTEL_CPU_TYPE_ATOM: return TOPO_CPU_TYPE_EFFICIENCY; + case INTEL_CPU_TYPE_CORE: return TOPO_CPU_TYPE_PERFORMANCE; + } + } + if (c->x86_vendor == X86_VENDOR_AMD) { + switch (c->topo.amd_type) { + case 0: return TOPO_CPU_TYPE_PERFORMANCE; + case 1: return TOPO_CPU_TYPE_EFFICIENCY; + } + } + + return TOPO_CPU_TYPE_UNKNOWN; +} + +const char *get_topology_cpu_type_name(struct cpuinfo_x86 *c) +{ + switch (get_topology_generic_cpu_type(c)) { + case TOPO_CPU_TYPE_PERFORMANCE: + return "performance"; + case TOPO_CPU_TYPE_EFFICIENCY: + return "efficiency"; + default: + return "unknown"; + } +} + static unsigned int __maybe_unused parse_num_cores_legacy(struct cpuinfo_x86 *c) { struct { @@ -87,6 +118,7 @@ static void parse_topology(struct topo_scan *tscan, bool early) .cu_id = 0xff, .llc_id = BAD_APICID, .l2c_id = BAD_APICID, + .cpu_type = TOPO_CPU_TYPE_UNKNOWN, }; struct cpuinfo_x86 *c = tscan->c; struct { @@ -132,6 +164,8 @@ static void parse_topology(struct topo_scan *tscan, bool early) case X86_VENDOR_INTEL: if (!IS_ENABLED(CONFIG_CPU_SUP_INTEL) || !cpu_parse_topology_ext(tscan)) parse_legacy(tscan); + if (c->cpuid_level >= 0x1a) + c->topo.cpu_type = cpuid_eax(0x1a); break; case X86_VENDOR_HYGON: if (IS_ENABLED(CONFIG_CPU_SUP_HYGON)) From patchwork Wed Oct 23 17:43:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13847760 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2072.outbound.protection.outlook.com [40.107.212.72]) (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 92DF51D14EA; Wed, 23 Oct 2024 17:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705492; cv=fail; b=JjIrl9QmPzupEDmK9m6Hhpu3QUHUwA2hqk+D1i1mttmK+Xu1lPmEJdNtQDEKYkNpM7X0paU6o5ovpdHJVLLU2/xxId4/jsHbrOCuwEaVubiYt7EZ+Hf8fyLmJEvZMG8iAyka1zh53QFXLoD6Cn+oToiK9XnDsw/g+OQ/uRd+V8Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729705492; c=relaxed/simple; bh=eJaTVdW77eGIqdwfuEd4E2GHWhpXb/HNJgQlDzpkZ9g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dCsLT9ayPwCvYh0zEoUVeDHBHkI9rz9kkF5V/a4nGc8G4HmllEsCVWAjCnCfgGFHQbvYbfBYLqCOar4eZoNV5WfdRsRa49j+HX247BcaVuCn4jziGYH/E904DS8gSrAhHxgNxz1nnp9qh+EI65T0JcDHt7QsBgWCUUlBz3ZWpWQ= 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=DAYyrXJb; arc=fail smtp.client-ip=40.107.212.72 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="DAYyrXJb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eQ042hRRBO+DIVRqXtPt/A3JBm52UOFd0tU4UjYvgIOPh3wHCQqF8QSD9H5pE4PCZBUPQZ+WV45iMIU9dh+3VG/Zi5anZ2GLGRRRH+cMWQpRWgP8fII0Aw9spRdsKNpSfEbIAj5DRideQyF4Wuv99zlB+WUidFnQQycDTh/Hi9nCkVaT1nN7f6n9CoTJlbhE/iYVMmBX2I3zJ1rwAuWV8jgrReXjDHpPjlk4/n8M3ww0196kf4CfXdhEfbIc4+Wa6Rr4vRIhQOFjldO32kpTGTvnpGIgCF1ZEft4H9DsvRCeAisqicDRBm/vQKim4x0Sya2Fam5CwN4sfm0E02ggxg== 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=vG5lDm0MPtPN4IayuoXr1hgZQ7nqDbpxJslmYEjVznc=; b=gOnKzxVOXZ0R3floPerVpmp36RJuhmBY5fdQCZ86IxbsC8hX9+qd3PaDR73YvfsmH5FfJ7bBdboUKqPdM6SwkSD8y/aLO7KTPgOfWZIsOX2hUilpzlbbbCWPUvgl7T0h9UBdCHVg7/XNscsqks6gbIyC+chYdR7nB1dfp0Vf28xeu9PHjaa9t9Kyql5/EvkSOS/NCt8WLzs3doMjqW3+n7BN6tMcLU4smbjXA5w74rbnRm5JIz4VhKFLl9lmR4yWviahiBiuVxiyjvURl63GsZGzHo7hewVC0W0PQtuItFR1TOa7pDHbWzbV0OE+wp9tKr7Io/wMJrMADq8pMUiadg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=vG5lDm0MPtPN4IayuoXr1hgZQ7nqDbpxJslmYEjVznc=; b=DAYyrXJbJo4K7nLsbetX0Vw1/VTIfbtvYllmH2f4yC/uLna7Yeni/DI9z1GAPI7Tz11/SvS2k6udNqr0HP6jJSUVG4wXOufbntc8fLBgQhJBnvALlC8KHQh/bfb7RMEAeg8Cy+yvQkCwwre3RFfnYrVIq05ls5RJG3uROkgkx6g= Received: from DS7PR06CA0020.namprd06.prod.outlook.com (2603:10b6:8:2a::21) by MN2PR12MB4222.namprd12.prod.outlook.com (2603:10b6:208:19a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 17:44:44 +0000 Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:8:2a:cafe::41) by DS7PR06CA0020.outlook.office365.com (2603:10b6:8:2a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Wed, 23 Oct 2024 17:44:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:44:44 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 23 Oct 2024 12:44:41 -0500 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v3 5/5] x86/amd: Use heterogeneous core topology for identifying boost numerator Date: Wed, 23 Oct 2024 12:43:57 -0500 Message-ID: <20241023174357.34338-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023174357.34338-1-mario.limonciello@amd.com> References: <20241023174357.34338-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|MN2PR12MB4222:EE_ X-MS-Office365-Filtering-Correlation-Id: 972544a5-42ab-4bd0-a555-08dcf38a615e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: MsIQymDLo3U7hjHcrAso1uy/yUQICFGqa3PPbJTTnmwAOjdpt5Hn0F/Q2CDU6gMStnSmZh9NEIHtrbGicMs6zNHzCOJgyrw0pLAZ+b50PauJqn59xgY4gX2PND7snfQih9dlKXxVisVTj75QrgHFSRB7Z76AWOnPn3T/JnrapLHZ9/htyVcQYKKy5hm8fcxsB0V0lxzXUxo2ofIXAysnOPV5t3H2wNzj2u/G7t1/yRotsHhCC64UjR6qqoKBwuk+e0S4WMjxpcCdcuk1ISqbDDscxKtfenMH7VI4BcY67hZ8xQu9YaI9mpMO2mohWh4RDWqbXVOblnrjF6JjPL8fAxFVjlW25gzuxCWOuD9koJXatLm174oKmztp1bmESRKHy2AdtzzQbePzpIcO79RCwP384x/RQdlMy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RV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:44:44.2678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 972544a5-42ab-4bd0-a555-08dcf38a615e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4222 AMD heterogeneous designs include two types of cores: * Performance * Efficiency Each core type has different highest performance values configured by the platform. Drivers such as `amd_pstate` need to identify the type of core to correctly set an appropriate boost numerator to calculate the maximum frequency. X86_FEATURE_AMD_HETEROGENEOUS_CORES is used to identify whether the SoC supports heterogeneous core type by reading CPUID leaf Fn_0x80000026. On performance cores the scaling factor of 196 is used. On efficiency cores the scaling factor is the value reported as the highest perf. Efficiency cores have the same preferred core rankings. Suggested-by: Perry Yuan Signed-off-by: Mario Limonciello --- arch/x86/kernel/acpi/cppc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index 956984054bf30..9983d4537968f 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -234,8 +234,10 @@ EXPORT_SYMBOL_GPL(amd_detect_prefcore); */ int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator) { + enum x86_topology_cpu_type core_type = get_topology_generic_cpu_type(&cpu_data(cpu)); bool prefcore; int ret; + u32 tmp; ret = amd_detect_prefcore(&prefcore); if (ret) @@ -261,6 +263,27 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator) break; } } + + /* detect if running on heterogeneous design */ + switch (core_type) { + case TOPO_CPU_TYPE_UNKNOWN: + break; + case TOPO_CPU_TYPE_PERFORMANCE: + /* use the max scale for performance cores */ + *numerator = CPPC_HIGHEST_PERF_PERFORMANCE; + return 0; + case TOPO_CPU_TYPE_EFFICIENCY: + /* use the highest perf value for efficiency cores */ + ret = amd_get_highest_perf(cpu, &tmp); + if (ret) + return ret; + *numerator = tmp; + return 0; + default: + pr_warn("WARNING: Undefined core type %d found\n", core_type); + break; + } + *numerator = CPPC_HIGHEST_PERF_PREFCORE; return 0;