From nobody Wed Nov 27 08:37:12 2024 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) (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 ABCFC1CEAA2; Thu, 10 Oct 2024 19:37:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589070; cv=fail; b=el4YTNyMupXLsI58VmUm16EDWDylB5p9wGSOFaxQRBGAk5LeyW2JQkAqUCep+s9X4/I/Xi6YS3eM++oWgPOJvuoR9gPQQNhR8z1jJ0pstRW4m/D305wPxk1y1Zr3fCsmQIPxJbPZN8VNa/egrWxXHtqpLOdyGMZseAzlqSe8gp8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589070; c=relaxed/simple; bh=AWbDTDSau2BHuzNZLwPqHYvKqTOvE4BEstGe+JxMSLo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oOksw9UHc6hQed2Ggl5UwA+OkW5qW0c5+OY9qb6HxhVNnKH4nmLeYQALgO2pPXn0tH0ZcGR4upE/g8yw9pcMqzj2FZ9JBOM2kqHGpUrSiXU/gZMJK6/HK8apiOxuYLLiscJkNfiTWlBNeG55Z7Od1EBnnTOFKqI9FrCn31g/gt8= 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=GSRCGepd; arc=fail smtp.client-ip=40.107.223.88 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="GSRCGepd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZPNkKoR+GLLogJ2eSgzLnFlxKwP7X3+m5N3eEFmkEKlb9VwDQujick9Lt3gErte34H0ErLm4aBtRxdhW/HT0bphf7sw4S+rzMCF9jnMW6TdnL3bAbY46pwC3dUHDTyld2rkJ9m6coC+BvCGyPDocH1IUmRkLMQ8/6nVZsshCpXmsEaI0hrBtfC1CsHve9nOxgB6htotIR50I8oJZpM+1wuwzWcGdHKrevya0K/fB7pV9KudSDy02txuQVcSZE65utFytKHR0OoO9amqJ/UU7hUvltCGEQObnX0OsQKCoyy66+/wgeAvDfPOZMwSaU+6kyZfuxjn+nb0jo9ljvzg4qQ== 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=EQxLHj1QyU45DTblZmLEvEylSsQzIeiEQhqpOSufMgo=; b=MJy3SbS2DvBchvb+sfQTj94v+v9QdHoqP1jhilHDJM2n4kgrJjUEr+OqO2tnDrMJ9PdvLSw6tI2/yOGEN5beOU3VbHDttOZG7aYu2zYl6WhwucBapIFUj+Nlg7ZGiVkumVDSYXt6qTNMym3XhcJ1Bp196emAPzdT1tKx4ICvQggK89FYYVzVvcgNGcG1/QsVylnPYocpJ1vJ2lKu6olAymGYRf60Cclta8pjalT/Q4fgaB4CleknL0yJXR95n3flSJlWhZXDIkQelmb3Hip7NPqbXQCY74dPlyxTtCbduyDY7XRXMjEmMlVCjeLmeL277iY2QOqOHRXBMUzOgqd1+w== 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=EQxLHj1QyU45DTblZmLEvEylSsQzIeiEQhqpOSufMgo=; b=GSRCGepdBc2M+3CRTxgvGM7tXkBFVcvsFo+rV0uETySYbtqiNompVHsCBAM09YjZwcZOUxZHLOA1c2U2oYGC79C0hZS2cwa5rCWtQgbfDvFiEb7DHer3NU399fl4zf5QWROG4BHI/Z6fJTtVjajfIp3PyGMA6ywhvvKavpWXU7g= Received: from SA1P222CA0153.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::17) by MW4PR12MB7432.namprd12.prod.outlook.com (2603:10b6:303:22d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 19:37:42 +0000 Received: from SA2PEPF000015C7.namprd03.prod.outlook.com (2603:10b6:806:3c3:cafe::47) by SA1P222CA0153.outlook.office365.com (2603:10b6:806:3c3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Thu, 10 Oct 2024 19:37: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 SA2PEPF000015C7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37: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; Thu, 10 Oct 2024 14:37:39 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v2 01/13] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Thu, 10 Oct 2024 14:36:53 -0500 Message-ID: <20241010193705.10362-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015C7:EE_|MW4PR12MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fb3a611-7dd1-4b7b-3f06-08dce9630115 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?WpuNFDpOawt8jRBgGNAyw7LMiERFRn5OAEyDUUF3NtPbLN/YAqIsFCEYamez?= =?us-ascii?Q?SIbHzJhwEIAsf5vHv0VU7gBUrMhfKu9wuP7vRV9F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ZvAd+xV2olfao8LRxJZYf8ple4A/TRPneFRvE6tUIAhB1xXC?= =?us-ascii?Q?q/SGZ4dJsZYfjyDKblLfaIwe34ipjgI52rJgZ+Sn3M6+KaphOEkkvR+mYq04?= =?us-ascii?Q?hmWcQ5ykPprL6tcB8wXCyEH+JxWFfdLivCLnjWHzf/BiAT12Ksg4UDk2JJP6?= =?us-ascii?Q?a8V0oW5g7BYJyO//jWNKrBcShyF8aXQiEAOhsL1vdC3h9dsKzEdZVYpgmonR?= =?us-ascii?Q?ViO+uo5hcpgUf6AcUHE2pnotZSfqh6NudQk9HsxR86Lx48Z6poIPpLLo8J80?= =?us-ascii?Q?Xn2mEMJa8Elicb9EkAngCkT4FLnTqhpvFCdgDtOhu5/EX3oWnUSlRHVBWTl5?= =?us-ascii?Q?3pOc62YOgU0XuwXKcOL8PkH5W6gGFjEWFG5EKqZOGFUJh4Vl8hgxw35A1bf4?= =?us-ascii?Q?3KjFMy8MyfwN3Bn1Vyf5VTk3vt4x?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:40.8190 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fb3a611-7dd1-4b7b-3f06-08dce9630115 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: SA2PEPF000015C7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7432 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Introduce a new documentation file, `amd_hfi.rst`, which delves into the implementation details of the AMD Hardware Feedback Interface and its associated driver, `amd_hfi`. This documentation describes how the driver provides hint to the OS scheduling which depends on the capability of core performance and efficiency ranking data. This documentation describes * The design of the driver * How the driver provides hints to the OS scheduling * How the driver interfaces with the kernel for efficiency ranking data. Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- Documentation/arch/x86/amd-hfi.rst | 116 +++++++++++++++++++++++++++++ Documentation/arch/x86/index.rst | 1 + 2 files changed, 117 insertions(+) create mode 100644 Documentation/arch/x86/amd-hfi.rst diff --git a/Documentation/arch/x86/amd-hfi.rst b/Documentation/arch/x86/am= d-hfi.rst new file mode 100644 index 000000000000..351641ce2821 --- /dev/null +++ b/Documentation/arch/x86/amd-hfi.rst @@ -0,0 +1,116 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Hardware Feedback Interface For Hetero Core Scheduling On AMD Platform +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +:Copyright (C) 2024 Advanced Micro Devices, Inc. All Rights Reserved. + +:Author: Perry Yuan + +Overview +-------- + +AMD Heterogeneous Core implementations are comprised of more than one +architectural class and CPUs are comprised of cores of various efficiency +and power capabilities. Power management strategies must be designed to ac= commodate +the complexities introduced by incorporating different core types. +Heterogeneous systems can also extend to more than two architectural class= es as well. +The purpose of the scheduling feedback mechanism is to provide information= to +the operating system scheduler in real time such that the scheduler can di= rect +threads to the optimal core. + +``Classic cores`` are generally more performant and ``Dense cores`` are ge= nerally more +efficient. +The goal of AMD's heterogeneous architecture is to attain power benefit by= sending +background thread to the dense cores while sending high priority threads t= o the classic +cores. From a performance perspective, sending background threads to dense= cores can free +up power headroom and allow the classic cores to optimally service demandi= ng threads. +Furthermore, the area optimized nature of the dense cores allows for an in= creasing +number of physical cores. This improved core density will have positive mu= ltithreaded +performance impact. + +AMD Heterogeneous Core Driver +----------------------------- + +The ``amd_hfi`` driver delivers the operating system a performance and ene= rgy efficiency +capability data for each CPU in the system. The scheduler can use the rank= ing data +from the HFI driver to make task placement decisions. + +Thread Classification and Ranking Table Interaction +---------------------------------------------------- + +The thread classification is used to select into a ranking table that desc= ribes +an efficiency and performance ranking for each classification. + +Threads are classified during runtime into enumerated classes. The classes= represent +thread performance/power characteristics that may benefit from special sch= eduling behaviors. +The below table depicts an example of thread classification and a preferen= ce where a given thread +should be scheduled based on its thread class. The real time thread classi= fication is consumed +by the operating system and is used to inform the scheduler of where the t= hread should be placed. + +Thread Classification Example Table +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++----------+----------------+-------------------------------+-------------= --------+---------+ +| class ID | Classification | Preferred scheduling behavior | Preemption p= riority | Counter | ++----------+----------------+-------------------------------+-------------= --------+---------+ +| 0 | Default | Performant | Highest = | | ++----------+----------------+-------------------------------+-------------= --------+---------+ +| 1 | Non-scalable | Efficient | Lowest = | PMCx1A1 | ++----------+----------------+-------------------------------+-------------= --------+---------+ +| 2 | I/O bound | Efficient | Lowest = | PMCx044 | ++----------+----------------+-------------------------------+-------------= --------+---------+ + + +AMD Hardware Feedback Interface +-------------------------------- + +The Hardware Feedback Interface provides to the operating system informati= on +about the performance and energy efficiency of each CPU in the system. Each +capability is given as a unit-less quantity in the range [0-255]. A higher +performance value indicates higher performance capability, and a higher +efficiency value indicates more efficiency. Energy efficiency and performa= nce +are reported in separate capabilities in the shared memory based ranking t= able. + +These capabilities may change at runtime as a result of changes in the +operating conditions of the system or the action of external factors. +Power Management FW is responsible for detecting events that would require +a reordering of the performance and efficiency ranking. Table updates would +happen relatively infrequently and occur on the time scale of seconds or m= ore. + +The mechanism used to trigger a table update like below events: + * Thermal Stress Events + * Silent Compute + * Extreme Low Battery Scenarios + +The kernel or a userspace policy daemon can use these capabilities to modi= fy +task placement decisions. For instance, if either the performance or energy +capabilities of a given logical processor becomes zero, it is an indicatio= n that +the hardware recommends to the operating system to not schedule any tasks = on +that processor for performance or energy efficiency reasons, respectively. + +Implementation details for Linux +-------------------------------- + +The implementation of threads scheduling consists of the following steps: + +1. A thread is spawned and scheduled to the ideal core using the default + heterogeneous scheduling policy. +2. The processor profiles thread execution and assigns an enumerated class= ification ID. + This classification is communicated to the OS via logical processor sco= pe MSR. +3. During the thread context switch out the operating system consumes the = workload(WL) + classification which resides in a logical processor scope MSR. +4. The OS triggers the hardware to clear its history by writing to an MSR, + after consuming the WL classification and before switching in the new t= hread. +5. If due to the classification, ranking table, and processor availability, + the thread is not on its ideal processor, the OS will then consider sch= eduling + the thread on its ideal processor (if available). + +Ranking Table update +--------------------------- +The power management firmware issues an platform interrupt after updating = the ranking +table and is ready for the operating system to consume it. CPUs receive su= ch interrupt +and read new ranking table from shared memory which PCCT table has provide= d, then +``amd_hfi`` driver parse the new table to provide new consume data for sch= eduling decisions. + + diff --git a/Documentation/arch/x86/index.rst b/Documentation/arch/x86/inde= x.rst index 8ac64d7de4dc..7f47229f3104 100644 --- a/Documentation/arch/x86/index.rst +++ b/Documentation/arch/x86/index.rst @@ -43,3 +43,4 @@ x86-specific Documentation features elf_auxvec xstate + amd_hfi --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2063.outbound.protection.outlook.com [40.107.101.63]) (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 711531CF2B9; Thu, 10 Oct 2024 19:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589070; cv=fail; b=svjMN0PVUz9r4d3Dfc63d4uc/xE+7sU2BqwzyrmaWKMA5TdQboHH+gkDgz0jUzOcq24GGHJA8+XaQwsgf/t0lHyOxho1rwQN8/hdDoxCNE6XRNe2qb0gCe+vvc7luGLwR5saXPDJXZSuZpC+F5ld0KvTwx9suxwirmmHkeKypQQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589070; c=relaxed/simple; bh=JUGQuUQjs1ZFgp5QIQnERFeT+fFWgmOCyJBP4RP5Nas=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=i7Qsw8sfIWTnN8rptbcxpHEo7SLgCGMH5g1OBxzsZs6nZkG+WDIipQ/JggW7go6EI9mBqFMa56lfKhlfD46ulS+RnTBQ4HK5MkdWjERlqG0kY/TFIBh5PXfRH3fGKFQR5pFaJ/m8WngXnDWf2xtCcSRewycU8WlYIbq2fAAPluY= 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=TADmxxTA; arc=fail smtp.client-ip=40.107.101.63 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="TADmxxTA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fwJ2pJAGlgWVMIqifel4MKRdJFXnrhzdLkn9uWhzoT46//VtG0m2NcCeMc41bl73j6DeiDPsu1mH85ToREzLpyeMznSyp0ZxVAEYFJdG4Oig9PC98vzjbH88Zuqz8dgWwsPqPbnf+z2sH4rtaRajaX1/czu0s6pYkdhx10LiX9aPtTJK7Ez3Z9iFolTCYESKATPNPZx2GDPolGlks5S2TfWKOzoq9hdIQedLUEc/V4WUQsmM2AipHlGHpbhOn7KkV0uChmNHIoyHNC1Rhuf5/C+NCibiFx/+TfdBgaeUPuwkNko/3dqGKxKA4yt02ajmGnFLuMOvXtngY1wLHtGfmA== 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=IscyHjX4ScGr1Xp2u1eW5BQJRksPYchH4CKn0wHE5JQ=; b=u27TcAZQQHLvxEtWxFiKb8RDHaPHLQKjo72EXomh6gTxSoqln9BrQjowP7yXRoIrA9+Jh673QRVNOF3mWEQo0E/OpsJHDyn3MZHgDxLFeSghUzTVXQ54dBvwM42ekXexvlQsz8ScQ4O4yqdwWHGOIlC83NLA6tPHaEHfDWYO8DzmtYINZm/hxCEK6A+jYarQUmUmY2t4n6XA9PyQjM8E5+NYaG+/6p79aT6pluNG9xPLDs9pYiHcr8w8u8PDJoVMg5s6tIKL4+zGz4rsd9qPqIP0D7q5J9FuyS3WFB7iKFmCdPcX42O0tptm9UAkt+IbpLOag+y77MW9pQiwn9Rn9A== 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=IscyHjX4ScGr1Xp2u1eW5BQJRksPYchH4CKn0wHE5JQ=; b=TADmxxTARWSurG5dPxe0KLGCooThjY5YTepwTdlFBoGtKipYJavoze+f8EHpq5FQNpdImKlFcXfBissNt5DAKSmpDd9bjs4f4Ahtp+z9HgmK1QQnHUZRU3Ma5RVfN+qrEog+46jkLWXfNpMKOZWSVGrqozTj6pkDHwTh2mi3mg4= Received: from SA1P222CA0159.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::7) by DS0PR12MB7605.namprd12.prod.outlook.com (2603:10b6:8:13d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:42 +0000 Received: from SA2PEPF000015C7.namprd03.prod.outlook.com (2603:10b6:806:3c3:cafe::bf) by SA1P222CA0159.outlook.office365.com (2603:10b6:806:3c3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Thu, 10 Oct 2024 19:37: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 SA2PEPF000015C7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37: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; Thu, 10 Oct 2024 14:37:40 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v2 02/13] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Thu, 10 Oct 2024 14:36:54 -0500 Message-ID: <20241010193705.10362-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015C7:EE_|DS0PR12MB7605:EE_ X-MS-Office365-Filtering-Correlation-Id: 79fb3897-0cdc-4734-bbcd-08dce9630235 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?PyqoU+T+3ci+uuWXQVdL9V42YavydJ7APSqi+CFbLcDCV3wdHWl9VNx7VlIE?= =?us-ascii?Q?sEFlSBNrEX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C4i4ryHcyQ0abQqU?= =?us-ascii?Q?eoikv5DgVYSrVM31KDjslp9E2yyEPtCq+ENlt8LF6A0t9iwFyv2+mwKYku9R?= =?us-ascii?Q?41pQKLY+9p/JFOje+JA0MWNAy3k1SZvcFTXVJPSFdYurrWlDI7UEw2g+Gjvk?= =?us-ascii?Q?vmrDiw/DcpBp5mjg7ZmyzwO5b2LrbTBemUD6v70jk4urK0g5MElOvlLTCh7v?= =?us-ascii?Q?EzkBAO00UFtKcy7pCiL0RkNunRTGJchOXAoSh5LRkeosR9wegT8M1Rsa2BMH?= =?us-ascii?Q?gxbOXN9fW6Owb5wqKa9+8wW4yzlUyMo581DiJJnfivisBzTBo1QpvZ0Dc9qU?= =?us-ascii?Q?pV6oqoYLkxtDgoWTIhdCEsJ9MuNqrpAYsXjFdNDLbocbJWgDrGjN0EiV+DLh?= =?us-ascii?Q?jrX+qd9pOJXC/we8HdCT2jW8?= 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)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:42.6940 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79fb3897-0cdc-4734-bbcd-08dce9630235 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: SA2PEPF000015C7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7605 Content-Type: text/plain; charset="utf-8" Introduce the `amd_hfi` driver into the MAINTAINERS file. The driver will support AMD Heterogeneous Core design which provides hardware feedback to the OS scheduler. Moving forward, Mario will be responsible for the maintenance and Perry will assist on review of patches related to this driver. Signed-off-by: Mario Limonciello --- v2: * Make Perry Reviewer instead of Maintainer, he asked me to take over this series. --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a097afd76ded..90094e064d94 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1083,6 +1083,15 @@ F: arch/x86/include/asm/amd_hsmp.h F: arch/x86/include/uapi/asm/amd_hsmp.h F: drivers/platform/x86/amd/hsmp.c =20 +AMD HETERO CORE HARDWARE FEEDBACK DRIVER +M: Mario Limonciello +R: Perry Yuan +L: platform-driver-x86@vger.kernel.org +S: Supported +B: https://gitlab.freedesktop.org/drm/amd/-/issues +F: Documentation/arch/x86/amd-hfi.rst +F: drivers/platform/x86/amd/hfi/ + AMD IOMMU (AMD-VI) M: Joerg Roedel R: Suravee Suthikulpanit --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2077.outbound.protection.outlook.com [40.107.93.77]) (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 56CB41E1330; Thu, 10 Oct 2024 19:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589073; cv=fail; b=bE9+dZ2V/DuxpBa2NeV6UMv5hl54fR0f4ZGzjApTV99Rtbvdx9vY/sb4SGqon1p5y/9sdqLkSOHOKLYn2xfSuQhjlZbYWO79IWBWDKRpl0GgWwiFGshzDcQa+Oz2H31rph3NuDM2saVn5YsKkI5EI8o0kwFXNRHbrIR7vTu4lGU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589073; c=relaxed/simple; bh=cc4FYa/Vuesa/XyVg3MKYbcElbdt0wJAvPFjdD24OWE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e33efEkXxZEyw/zVeXbp2e4ebwgTvGIWsaxRQ5vayxELyTaUhCZCRE3yPpXf2hpduvH6XTfE7pvAjwKDKHhPrKzdRj4P8TVuKHYtf3KRoJ4WzyZK1WYxvaYonJZ1/xucbg7aQXRcm9E2ARY1+X7a6IYkQqv5N4VJZV1YGCB4zMU= 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=sXoP4GWe; arc=fail smtp.client-ip=40.107.93.77 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="sXoP4GWe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BxVKNWjDC+2dhCdlKUogGhA/7Zcp+tB23u9qFBhn7gDOvle0AsTicqLOhLV3zIO7koywGB6+M++94+L5bMQyFqnnzF/R242/eClNtZxW/lWNx38XrRnOOteh8wADEv1Li7T0UjXY03/NqpYCMs+KK3OBqlVoAJ1K80TiFBlchLApxmKGZ6zNbuHVQgMSQg+yH1A3cRhLuDQV9t6mpJuPqyXV4UUSAtd00M+WXrI36RkqDFhy1pNPqH4Uj5pHvwhVdRbbwkcH/svhB5m5CJ6LTJ5bszjK75MTRjjCeHvUeyq0tWJl0WjluAA3DBNwWaeKX01Dpd6he0rMCt4GwtKG4Q== 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=sfg4dBKIC3Zfil42gpuoofN+BPB+hdfEIuvwNTO4J74=; b=DQ2PQwCUzkFF1+6ci7vCVmhWNe7EJtPSiu3bQQNgSoo8xmKuRkxh+1diWFnjt3h6KEEJAq1zoYiXJA3anFjBZK2SwVEB6cA9lHad+HBNRZQ0xulFLE1S2pYvVi5eC8siTAFLx9a4dRWniQd87C600RkS4INbBMpzHjBukI6Br8yiTjmlE9GEPOcuxyNKrQDaAF5TqFSDEm8p9e+vtRTUil5NW9fMYVGw0W+vhKEgJEvAyr8s2ZxvvoPoCuOWZJQSuAWwMz4Bp00qFHokE082O2RB3BiRn7/93iC+G1rfcSvRxnqO/oeGQuonzKzSj71uNp+RbF5c9SWEppCfM5lCkw== 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=sfg4dBKIC3Zfil42gpuoofN+BPB+hdfEIuvwNTO4J74=; b=sXoP4GWehzpRabFB3c4MFH4H6jmJy7KnwmeoGUdgOvH9FU5TTpgF/KI6Umt+NbHkxGBB5sG4iOriWjUOHCojIj3DLLDoDdyiNqJJGpYsQhj381xvRxg3/lQztfyxlySiuDQfWdAb4kfvoLNDV3ZUdLyAKCzc3RW25GzqibknAek= Received: from SA1P222CA0167.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::15) by SN7PR12MB7855.namprd12.prod.outlook.com (2603:10b6:806:343::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:43 +0000 Received: from SA2PEPF000015C7.namprd03.prod.outlook.com (2603:10b6:806:3c3:cafe::cf) by SA1P222CA0167.outlook.office365.com (2603:10b6:806:3c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Thu, 10 Oct 2024 19:37: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 SA2PEPF000015C7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37: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; Thu, 10 Oct 2024 14:37:41 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v2 03/13] x86/cpufeatures: add X86_FEATURE_WORKLOAD_CLASS feature bit Date: Thu, 10 Oct 2024 14:36:55 -0500 Message-ID: <20241010193705.10362-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015C7:EE_|SN7PR12MB7855:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b330fe6-0e08-4f34-c7db-08dce96302e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?9Jup9iaUe/+PRvznZ5mUpPO0+CxH8WTbEPvRYq+eltDhmxvm3fpTX7+Unea1?= =?us-ascii?Q?ZGyVq8B+n79cgb4AJZLPWJH5DyovI8vLEKNm0Zqyp/NU+IF3qNOaRg8TK8wp?= =?us-ascii?Q?2lkBlCAo3LoRYPMG1s/fZM2gdW/iM0Qcjs4MV5tzKC4+OCCevPYCGPx7cEEd?= =?us-ascii?Q?g/4bQ8cEXksk0ZuEDCEmZZM/yXp6IULzAcZPLuqmG15BMs4efJpjFS4zcjhm?= =?us-ascii?Q?oqSa0EG8OCo1KL4EfZBG7Miu2D44yO8Ep8aCkeTgRipeTemCkvi0xGatH423?= =?us-ascii?Q?gHNWy7cxdHF0ghlFeAz+4UZkLCYmw3PQryDJNF3cSIH2Y+WC/NKd0ZJgmybs?= =?us-ascii?Q?y34kv8+/w0RxM4YlqnxNo4/YfS+ncf+bA3Jz6T5h64nUb2cwugyiQlOZEnSM?= =?us-ascii?Q?vp2dnOya2e51x6uiLm9VrP/9KUXNYdDDuqY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7mS0n8H3OkTGjKd2xADDmDO6ZbjKlY3ONH5WD9+bwEd?= =?us-ascii?Q?zX0lX0bD5Ttjom+7w1TSA/rDozDs?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:43.8502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b330fe6-0e08-4f34-c7db-08dce96302e3 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: SA2PEPF000015C7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7855 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Add new feature bit that indicates support for workload based heuristic feedback to OS for scheduling decisions. When the bit set, threads are classified during runtime into enumerated classes. The classes represent thread performance/power characteristics that may benefit from special scheduling behaviors. Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello --- 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/cpuf= eatures.h index cea1ed82aeb4..3e8e67b8ec7a 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -474,6 +474,7 @@ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch hi= story at vmexit using SW loop */ #define X86_FEATURE_FAST_CPPC (21*32 + 5) /* AMD Fast CPPC */ #define X86_FEATURE_HETERO_CORE_TOPOLOGY (21*32 + 6) /* Heterogeneous Core= Topology */ +#define X86_FEATURE_WORKLOAD_CLASS (21*32 + 7) /* Workload Classification = */ =20 /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattere= d.c index 3bba55323163..b6547bab9e23 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -49,6 +49,7 @@ static const struct cpuid_bit cpuid_bits[] =3D { { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, + { X86_FEATURE_WORKLOAD_CLASS, CPUID_EAX, 22, 0x80000021, 0 }, { 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 }, --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2042.outbound.protection.outlook.com [40.107.100.42]) (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 A3B381CDFC2; Thu, 10 Oct 2024 19:37:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589069; cv=fail; b=ADQ3VdaSIozT+spHCZ5J1QkgoKji3I2r/kvjnJpzRbItI3E1k/qL9LCb4+uNDJMWNiMjrUUTT2KsvLpNbpjdcYrgHxdd9W8eTrFERKNVBTb4Q0BYKbu4F7HC00agjnXh6gT5FuCcOxCHo1OeiS2X1CC/LITbXwVIW3uxaulGkXE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589069; c=relaxed/simple; bh=ofBvHPgVw5oIr8IlpOP7+JqexZC7i3ifWbwlvmZ6jFw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DxDA7USUv9T5CmXigJEkSUUqGYapVvzusT42HT2wik2W/oq+2jijD9mT7xyJJQTL0iq70aVyU1SaYyCbfkepMI/BjX5A25nbjbkzUtOL2Ue1slGKPHHpgp9b65rH/2RKpow5tYBEVcmYqmjYQNxvCKJH5+yM7BYSA50peCNQ9+M= 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=uN7JkR/r; arc=fail smtp.client-ip=40.107.100.42 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="uN7JkR/r" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pgfiTBDIf/QsPsKBdZRO+vKEd25iNSE4vBUJ4NB611zqZXfytLdQEhE6ApyiNjvoHQVaTKX5ZQjsiJzKnyOC/JIe76uy2WM6w6U2gC8sxl4KHcuJyBTZuDDZIaJoV7TXMDQpXX6Yc24vrfY3lh5tp0N1/ohEacvjM0B3Xahkl+PH4LhzSYKbIaSz7DSZ7kg7hRe99mAbLuzwqmsM/I1girY70JTuD6Um3B0S8iYKgs4RuOPq/GUZbIaaMqmc6kHXJxQRDfVqZEwtlCi+ABlu0noM7vvbgJ4rPMQhxHqMxT6hEJ8fhYG50c/corG7Hkv7nGSIfbS7xI4Vvpzn9I2NGw== 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=0Wpo1JAzLUn85517a0rtcIQKRr3tku7gUFu4sVqSGzw=; b=imSdRQHuHr7J4Qh5ZaQCihHt2t2TkrzFj1x4gmRhRIp766gqN0b3v0q9gj2u4TZ+5aSvLqQonT6kc00+NenZWUTiAsBa9lQvz414YNOVZ3j4NVmGXz9tDPefTOiLu3T8VItHIGu0tM2CEjB+2icykAVnSN1ej5E0c0exFOz8NrykiWpo+jhrO2sQ7AhYuOwZa5cw0xeG04f3cQ3BxM/asvQlIhlN296ZNliFFjSWyGm26ia1w/F2rFvoh2ErpwjntKv7EONAdVmbRxxY3hMI4sbFPR3mQLYUTMAkiLbhpFvysg9ok8NkvOZgPrJefO4ciI9u3gb5sohTXdtOquXnQQ== 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=0Wpo1JAzLUn85517a0rtcIQKRr3tku7gUFu4sVqSGzw=; b=uN7JkR/rqk42ENd7ForisMbD43+dMeh8+zqIH3r0YsOZa/z/ci+y8p9eakFEv8wNgdQgJdGg3Ws14OwWAFAS1dBjDxWpUYcBo2+DcrL2D6tBo5lZU17ekfp1h0aI6wDoeV3k05KQcvjdmCDoZrIUzOwCK14gjiZpvuHJpcjryxQ= Received: from SA1P222CA0151.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::21) by DS0PR12MB8575.namprd12.prod.outlook.com (2603:10b6:8:164::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:44 +0000 Received: from SA2PEPF000015C7.namprd03.prod.outlook.com (2603:10b6:806:3c3:cafe::ee) by SA1P222CA0151.outlook.office365.com (2603:10b6:806:3c3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Thu, 10 Oct 2024 19:37: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 SA2PEPF000015C7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37: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; Thu, 10 Oct 2024 14:37:42 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v2 04/13] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Thu, 10 Oct 2024 14:36:56 -0500 Message-ID: <20241010193705.10362-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015C7:EE_|DS0PR12MB8575:EE_ X-MS-Office365-Filtering-Correlation-Id: bf383d90-b864-4072-0019-08dce963031d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Wtk8Ky5QJjT4UxI1/tlsOx/nKy5qgAU4v3EL4BG0+dDYiF3XQkSnPlM19vEy?= =?us-ascii?Q?j4SxEGJXbqA4FpYYUXGo7FPM1V2gnggeyAvu+yHQfy6L1skmi1G0PvjAyKn5?= =?us-ascii?Q?ArCc5rr9oLS1fkC9bT5MKZBwsrokuCpatjnSi7VqLyAbK2R/uDPO3v9NSUl8?= =?us-ascii?Q?rNSgcUY9z7Orb8yLEQvMkGlCZUCGrVHHiXtX4yXBTeDq1t8NYYDm6pqGBWuf?= =?us-ascii?Q?b4obEUHLwiR62jHZo9MvBfLpP09FptPTq263tE4trpSvEbwtEzEowDONh2EW?= =?us-ascii?Q?13F3anSnzFbbw0tc+0hK22nstIltL/NSKPsuug5lT3kDcGY2wGhmV+wCQfZn?= =?us-ascii?Q?LBeFg2kMDgso2YGD4AfEuZX7LqHwmjAUNDUS+pgeO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?us-ascii?Q?pBnA8HOLKiG+qqWA20aB9g2UIqIWGTW4rdmgmVMd8GnZSvzSM5XEqZkjMQ2y?= =?us-ascii?Q?KifaCE21M+fDBpJfsBfMnLR6Dw5dy6cho0XQU7IF/Ahjegs1WTllNG2yysxU?= =?us-ascii?Q?ZOQy9CqHUaG1773B64nn6NBOn0t4?= 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)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:44.2252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf383d90-b864-4072-0019-08dce963031d 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: SA2PEPF000015C7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8575 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Introduces new MSR registers for AMD hardware feedback support. These registers enable the system to provide workload classification and configuration capabilities. Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello --- arch/x86/include/asm/msr-index.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-in= dex.h index 3ae84c3b8e6d..0cd5ffe50f4a 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -712,6 +712,11 @@ #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302 =20 +/* AMD Hardware Feedback Support MSRs */ +#define AMD_WORKLOAD_CLASS_CONFIG 0xc0000500 +#define AMD_WORKLOAD_CLASS_ID 0xc0000501 +#define AMD_WORKLOAD_HRST 0xc0000502 + /* AMD Last Branch Record MSRs */ #define MSR_AMD64_LBR_SELECT 0xc000010e =20 --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) (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 0D1221CF5C5; Thu, 10 Oct 2024 19:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589071; cv=fail; b=eDXkwkvGSLyfGDdA6v7qEuhfdf+rZ7PTmKv7y6CQHFZnLZ409hX4E8tNtwL6iv/SO3YcOZ4cb2Q2nRuNJdTt+hHOL9KOoZF9Wo91g91FjDmu7DGrwM4MRXN2gDQy+VsnNn6LFs1qsMncHdl42hm4tUk7XusVPJSbwB9ARp47hCI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589071; c=relaxed/simple; bh=PUoWolRt+kVsR0Vo5T1pDdfuqYinHX9XGoPT9sehMlY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ok1z9SBIJR94gCCfuLXqSB/kjN9sgoj+2TACSeeMPhRdA5bS9QjNz2enzyBtPzlnbZPiylebMwoAsTUz2CFo6rQ/JZZAffaa/D7Ut0UW7Jy4GVqGRmUzR/hPWfjaxzieyMfKdWDlN+J8v35KXuYo/nYdl3uxG7b+rp9MO6XOft8= 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=3Pftdgdm; arc=fail smtp.client-ip=40.107.243.68 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="3Pftdgdm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fimk36T467cEgSYyTkR04EUhAxj0FgSy2qOcP9kX0I3156hw+m4PN6mXygdDBsxm3ME6QAQH/q0ORlwNQY4KM52kJfcOBcRcnBfvIEEPG0m38tyzrcnklYl4jaPHDNGbhB09tPKbjFJN8drl+pyON1pULT42Bq0W0JZnixkNtLjKQBRM16Je4NS4V9x6XtNpxJrez1zrWXgJ0QX3ATD71zLkh2HnaTe4vl6Mde18IKpPcV9CK2rp3+4WBKModpJdUOqGcgHx008Fp3enp8yJWB7+YVlLBmhBDgnpUSG/n3wok94xjToU3Ew07vFYBUUVprb2du74bcisPETGnVl79Q== 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=bq0DugTKtOYzkF1f03p2oOVPCBi6aK7stT66UpT7usA=; b=N7m3SaR8A/THv2TvqqvG25BYeIoCN9MKALpIGspwOu/aR9lW0S6rUHSWBUeKQuY+1RSkPy8n6TiFOImw0CoUvYgu2BDCfr0Os3eoSBon+rsr66kVvkXRPURE3dkIImczXZwAQ/TDhVlC1hiumRiRhqCGr+qFVudoJ8q4FtIfcXTCsmc9sh54j1Lc415YVlpvAMGah3z2SW81y2D4cqs+zAv7g5p8TTAETpYGwlv8GYPWIJXw1oA8WsrB2DeRY2vsRub4gT7iZM9QTGpc96Rd/26tKPUsZ+4HHYutYmYc+1MzbOZZ1EO8EKOEq6tWQs4Zo0DqVjnqbktG3kt724NXqA== 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=bq0DugTKtOYzkF1f03p2oOVPCBi6aK7stT66UpT7usA=; b=3PftdgdmB6xtOe7Y5W7+O3G9ZnEiHef1y02ispAUw1O1Wq1c0qkTjCgldDBaH/AhNwMiFvLcfEckiWAdWofXjHneDTFL1Xp4utIvQ55AUbfabj/a7QEIpo44gsE58ztHUezUR4z4gk/9lY1im4ETXKn6hcoc+gb549YwkEyxTX8= Received: from SA1P222CA0164.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::29) by MN2PR12MB4359.namprd12.prod.outlook.com (2603:10b6:208:265::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:45 +0000 Received: from SA2PEPF000015C7.namprd03.prod.outlook.com (2603:10b6:806:3c3:cafe::db) by SA1P222CA0164.outlook.office365.com (2603:10b6:806:3c3::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.19 via Frontend Transport; Thu, 10 Oct 2024 19:37:45 +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 SA2PEPF000015C7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:45 +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; Thu, 10 Oct 2024 14:37:43 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v2 05/13] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Thu, 10 Oct 2024 14:36:57 -0500 Message-ID: <20241010193705.10362-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015C7:EE_|MN2PR12MB4359:EE_ X-MS-Office365-Filtering-Correlation-Id: 20e8579c-eec8-45ef-6e48-08dce96303cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?IqVBRPWC+6p75ZRovi3I7gpbbF6B6TWVmGTay70dB40lHP99usghIYxD1yu4?= =?us-ascii?Q?wqB/V8Ejuw6sD5jFqykwHAnToHQF1FwGKTnn4c+jQFe/RyxVVRYp2WXOb5H1?= =?us-ascii?Q?3gKzKuS8PgpjlfMRPq8qC6GDLJz7imPw91QTHlbEVdhEhdAUQFjHhZu5Aclk?= =?us-ascii?Q?/4V+GA54v6yICO9dYoKyLAWRrc0baKZbuHkVTHmI3zjbF8ouooQrfYAESYfh?= =?us-ascii?Q?5+uHjvhFQDeOe9p9YHb2bQ45ohQtLit56fkUSY75sK45csE/Xnt+m6F4wO12?= =?us-ascii?Q?uq4Csa65CP1WXOj5XhaWhWllWQY7VItZ8B4b2i0CqEXbH9Uq89FBIm0ct7bP?= =?us-ascii?Q?F0yfkWB2JMvCMaFj9AAphc6K57dcgwia96D3Ei6Kg9Qukwc+EPguryh+vFuK?= =?us-ascii?Q?nNBqObFWtODAVF8VuH+MlVCFW1TzgIgSz0IueAY+eWmjWFdBoAZvVg1c4eJ2?= =?us-ascii?Q?y+0pSm6rxm1MW6XM4pmWon/36QN4oKL+eQRW0zGGL6XwdK31tXoFoZw11ERp?= =?us-ascii?Q?wK8nocR6y0n2xJEWnSw/vsNF8m63XgfoSJw2IvYOor0oNiBXTtsPv/BgZzNh?= =?us-ascii?Q?NDRu4kS4fk+pM7yrcFp2dsVojCFoVcLpmBvSS63L2QkIxTRvQYBBmKDCFunb?= =?us-ascii?Q?T2jPGZ0DBP5vz+Eho/53Tez/I0c89EaHFbQQyn3Qwog0HDLdzuEk5sLN4HNv?= =?us-ascii?Q?6udU/gOjhix6XZvwGBZR4wducxCVIpKAjKhRf6Lyp47e5FTptdT+0sj6cqxo?= =?us-ascii?Q?IKj9PUNjG2QgWPwtm4zd0g55C9lRbHeLGQdidD2qr72PWzZBqtzyGDYXrbtT?= =?us-ascii?Q?8tziURSpL7Nofa8f31pniUYh68gtjUxPLcH7fJO8hX6L6Ugfq76f+pfXab8z?= =?us-ascii?Q?0R0SmVLO35V0wLDOWOEn/8M6mrqz+Nf1i2E3rYSVPnJIJVKdSvMZou1UmdRo?= =?us-ascii?Q?cKe4IpSgna3ojc6VdOth0ynFv1ijcFEPkFRQrojsK+/wlkW7YnjL12zXJ773?= =?us-ascii?Q?ebkF2I6MsYjhCOMznpt4lkR2vC2nOiKUjN1HlSnCNbTSRA3GQ2yXLEsDdV3t?= =?us-ascii?Q?8eo55KZ7dAWfxNTxC4wHnB3s62kQWN/hFkrLnPPVlrGIpTSK0kSp3Lp2VSlp?= =?us-ascii?Q?WfrJUrnW+n7SmTnYVYwzsywz1trL85SZ/OnJBcUJOg99ppjZ0+cnu1CdCCs2?= =?us-ascii?Q?1Rc0+nhvKwysrUf7SvbwPH8mr1y5KDGQTtFCyLwiJW1axQlQhk/prAlrH0+M?= =?us-ascii?Q?PW0hjsyT9V1EPNhZtrUJEiFBcbNGmyP1wjYGCmrxPIO+5A/byYEdFgZ3OSP7?= =?us-ascii?Q?XtY3v8OvfRNPN5UC/jOwqKoZ9ag1JNG8mTmzqHzmeCDp3o/U4LT8dCFu4pLC?= =?us-ascii?Q?mHj0rREbLB3VzCd9XcfBZUgl4g6U?= 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)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:45.3815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20e8579c-eec8-45ef-6e48-08dce96303cd 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: SA2PEPF000015C7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4359 Content-Type: text/plain; charset="utf-8" From: Perry Yuan The AMD Heterogeneous core design and Hardware Feedback Interface (HFI) provide behavioral classification and a dynamically updated ranking table for the scheduler to use when choosing cores for tasks. There are two CPU core types defined: `Classic Core` and `Dense Core`. "Classic" cores are the standard performance cores, while "Dense" cores are optimized for area and efficiency. Heterogeneous compute refers to CPU implementations that are comprised of more than one architectural class, each with two capabilities. This means each CPU reports two separate capabilities: "perf" and "eff". Each capability lists all core ranking numbers between 0 and 255, where a higher number represents a higher capability. Heterogeneous systems can also extend to more than two architectural classes. The purpose of the scheduling feedback mechanism is to provide information to the operating system scheduler in real time, allowing the scheduler to direct threads to the optimal core during task scheduling. All core ranking data are provided by the BIOS via a shared memory ranking table, which the driver reads and uses to update core capabilities to the scheduler. When the hardware updates the table, it generates a platform interrupt to notify the OS to read the new ranking table. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D206537 Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2: * Drop unnecessary select * Make tristate instead of bool * Drop error messages * Drop unnecessary function declarations for init * Fix cleanup for amd_hfi_exit() * Drop unnecessary variables for upcoming features --- drivers/platform/x86/amd/Kconfig | 1 + drivers/platform/x86/amd/Makefile | 1 + drivers/platform/x86/amd/hfi/Kconfig | 20 +++ drivers/platform/x86/amd/hfi/Makefile | 7 ++ drivers/platform/x86/amd/hfi/hfi.c | 169 ++++++++++++++++++++++++++ 5 files changed, 198 insertions(+) create mode 100644 drivers/platform/x86/amd/hfi/Kconfig create mode 100644 drivers/platform/x86/amd/hfi/Makefile create mode 100644 drivers/platform/x86/amd/hfi/hfi.c diff --git a/drivers/platform/x86/amd/Kconfig b/drivers/platform/x86/amd/Kc= onfig index f88682d36447..c3f69dbe3037 100644 --- a/drivers/platform/x86/amd/Kconfig +++ b/drivers/platform/x86/amd/Kconfig @@ -5,6 +5,7 @@ =20 source "drivers/platform/x86/amd/pmf/Kconfig" source "drivers/platform/x86/amd/pmc/Kconfig" +source "drivers/platform/x86/amd/hfi/Kconfig" =20 config AMD_HSMP tristate "AMD HSMP Driver" diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/M= akefile index dcec0a46f8af..2676fc81fee5 100644 --- a/drivers/platform/x86/amd/Makefile +++ b/drivers/platform/x86/amd/Makefile @@ -9,3 +9,4 @@ amd_hsmp-y :=3D hsmp.o obj-$(CONFIG_AMD_HSMP) +=3D amd_hsmp.o obj-$(CONFIG_AMD_PMF) +=3D pmf/ obj-$(CONFIG_AMD_WBRF) +=3D wbrf.o +obj-$(CONFIG_AMD_HFI) +=3D hfi/ diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/am= d/hfi/Kconfig new file mode 100644 index 000000000000..08051cd4f74d --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD Hardware Feedback Interface Driver +# + +config AMD_HFI + bool "AMD Hetero Core Hardware Feedback Driver" + depends on ACPI + depends on CPU_SUP_AMD + help + Select this option to enable the AMD Heterogeneous Core Hardware Feedbac= k Interface. If + selected, hardware provides runtime thread classification guidance to th= e operating system + on the performance and energy efficiency capabilities of each heterogene= ous CPU core. + These capabilities may vary due to the inherent differences in the core = types and can + also change as a result of variations in the operating conditions of the= system such + as power and thermal limits. If selected, the kernel relays updates in h= eterogeneous + CPUs' capabilities to userspace, allowing for more optimal task scheduli= ng and + resource allocation, leveraging the diverse set of cores available. + + diff --git a/drivers/platform/x86/amd/hfi/Makefile b/drivers/platform/x86/a= md/hfi/Makefile new file mode 100644 index 000000000000..672c6ac106e9 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# AMD Hardware Feedback Interface Driver +# + +obj-$(CONFIG_AMD_HFI) +=3D amd_hfi.o +amd_hfi-objs :=3D hfi.o diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c new file mode 100644 index 000000000000..da2e667107e8 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD Hardware Feedback Interface Driver + * + * Copyright (C) 2024 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Author: Perry Yuan + * + */ + +#define pr_fmt(fmt) "amd-hfi: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HETERO_CPUID_27 0x80000027 +static struct platform_device *device; + +struct amd_hfi_data { + const char *name; + struct device *dev; + struct mutex lock; +}; + +struct amd_hfi_classes { + u32 perf; + u32 eff; +} __packed; + +/** + * struct amd_hfi_cpuinfo - HFI workload class info per CPU + * @cpu: cpu index + * @cpus: mask of cpus associated with amd_hfi_cpuinfo + * @class_index: workload class ID index + * @nr_class: max number of workload class supported + * @amd_hfi_classes: current cpu workload class ranking data + * + * Parameters of a logical processor linked with hardware feedback class + */ +struct amd_hfi_cpuinfo { + int cpu; + cpumask_var_t cpus; + s16 class_index; + u8 nr_class; + struct amd_hfi_classes *amd_hfi_classes; +}; + +static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) =3D {.class= _index =3D -1}; + +static int amd_hfi_alloc_class_data(struct platform_device *pdev) +{ + struct amd_hfi_cpuinfo *hfi_cpuinfo; + struct device *dev =3D &pdev->dev; + int idx; + int nr_class_id; + + nr_class_id =3D cpuid_eax(AMD_HETERO_CPUID_27); + if (nr_class_id < 0 || nr_class_id > 255) { + dev_warn(dev, "failed to get supported class number from CPUID %d\n", + AMD_HETERO_CPUID_27); + return -EINVAL; + } + + for_each_possible_cpu(idx) { + hfi_cpuinfo =3D per_cpu_ptr(&amd_hfi_cpuinfo, idx); + hfi_cpuinfo->amd_hfi_classes =3D devm_kmalloc(dev, nr_class_id * + sizeof(struct amd_hfi_classes), GFP_KERNEL); + if (!hfi_cpuinfo->amd_hfi_classes) + return -ENOMEM; + + hfi_cpuinfo->nr_class =3D nr_class_id; + } + + return 0; +} + +static void amd_hfi_remove(struct platform_device *pdev) +{ + struct amd_hfi_data *dev =3D platform_get_drvdata(pdev); + + mutex_destroy(&dev->lock); +} + +static const struct acpi_device_id amd_hfi_platform_match[] =3D { + { "AMDI0104", 0}, + { } +}; +MODULE_DEVICE_TABLE(acpi, amd_hfi_platform_match); + +static int amd_hfi_probe(struct platform_device *pdev) +{ + struct amd_hfi_data *amd_hfi_data; + int ret; + + if (!acpi_match_device(amd_hfi_platform_match, &pdev->dev)) + return -ENODEV; + + amd_hfi_data =3D devm_kzalloc(&pdev->dev, sizeof(*amd_hfi_data), GFP_KERN= EL); + if (!amd_hfi_data) + return -ENOMEM; + + amd_hfi_data->dev =3D &pdev->dev; + + mutex_init(&amd_hfi_data->lock); + platform_set_drvdata(pdev, amd_hfi_data); + + /* alloc data array for hardware feedback class data */ + ret =3D amd_hfi_alloc_class_data(pdev); + if (ret) + goto out; + +out: + return ret; +} + +static struct platform_driver amd_hfi_driver =3D { + .driver =3D { + .name =3D AMD_HFI_DRIVER, + .owner =3D THIS_MODULE, + .acpi_match_table =3D ACPI_PTR(amd_hfi_platform_match), + }, + .probe =3D amd_hfi_probe, + .remove_new =3D amd_hfi_remove, +}; + +static int __init amd_hfi_init(void) +{ + int ret; + + if (acpi_disabled || + !boot_cpu_has(X86_FEATURE_HETERO_CORE_TOPOLOGY) || + !boot_cpu_has(X86_FEATURE_WORKLOAD_CLASS)) + return -ENODEV; + + device =3D platform_device_register_simple(AMD_HFI_DRIVER, -1, NULL, 0); + if (IS_ERR(device)) { + pr_err("unable to register hfi platform device\n"); + return PTR_ERR(device); + } + + ret =3D platform_driver_register(&amd_hfi_driver); + if (ret) + pr_err("Failed to register hfi driver\n"); + + return ret; +} + +static __exit void amd_hfi_exit(void) +{ + platform_device_unregister(device); + platform_driver_unregister(&amd_hfi_driver); +} +module_init(amd_hfi_init); +module_exit(amd_hfi_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AMD Hardware Feedback Interface Driver"); --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2042.outbound.protection.outlook.com [40.107.243.42]) (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 02CF41E0099; Thu, 10 Oct 2024 19:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589073; cv=fail; b=bBAlekp/kmbTQSe3ecNalo+jIHjUU98UCpL8tgYMuZ+jgg9lIDccGJJYB3cThLeLsiSIEOA0FqltL2OEiBmats+H4i4SWja4qARzytiiFFepkilfgnYA1GlLRGeNb+A2l7r10wglfj7/GZZjcAyBxKlzRRdNn3JxUpu5nRHXG4U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589073; c=relaxed/simple; bh=dDR1zDXRWXd/vZaEWt4Q+WvqydN5BEvTdRT2PJ6OCB8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fMDTDH3jssl7zUuMrDGkBCyzPx63cS9zuGjersDvGyupRhZWqwSI7sHIKj/B5x0lqG7ygAevYB4tRto9QYhJj18DqQrYiuES9sYRnwIOEI9YVuw4vwAxLJWMCtRQZIEwEq2D5BDA3zsUu7mBFuSC9WReojMNggknUHDtV9joWpQ= 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=Vz7cbhGf; arc=fail smtp.client-ip=40.107.243.42 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="Vz7cbhGf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lWQmtozTEWH2AZGIdCynVFVNC5Ni7JpBgNDevtBGi/lY00ySLLq/TXWYnihsLE4Fr/dy5C0LvOSbdb0zLIEK3fqWTTvAf5ug/9LmdCWOTcnXdijMPGQWkJDamGhP6OL8h4HOdT4bBVlQRxX0kLVGqOski9slp+6PDUIgfrt52HLN7Dxsybzv+tR2e8/FkzmE4/KY964epkdVBigXCX5JkVglF7zcKlvujh3XM9oLS1V6jsi2A8mocBhd5/BIz4Vb80e6NeEHiLxrILIcDi7Hk9I36ykcOZpskD0GYAt/z2lCQaRx0c08AifGbbPElwloVLBW7Of9TSED7/GgYhaeOg== 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=IEKOmnQCEMH32XuCjLsGnwQ+wSLix7ZcHBi9RACin5M=; b=HwQY2ZV3b2jGo96KVGZ2XJL4a8l4GCwgWxCH6vZ8jtQz6pT0Cy0MtpPpypWA/zcl8+ue5MG86fIwCeXPXaTrVVzAc137NojudBimBHd8YneW7JHsgZoa5wPqjBjmsc7ygPXUNs6cOhuZhbIkExfbBpYqIpCCX7FA1kdUVWo5NFqafGzPvERnW5Go4VdL+vZFW6yLLK/ppWG/mP7zLX5T+1g1T4vmpxnIeRqm9duHruBLowqxtgu58NKy8PbnxGZJnuLBTu47gYDD+uhrGM81OZR78pu6YfAWh02Y74AwvFTAttCqvSnqLdGvx90XJ2Jt532HKMO56kcOSxUbdiOUzg== 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=IEKOmnQCEMH32XuCjLsGnwQ+wSLix7ZcHBi9RACin5M=; b=Vz7cbhGfjf9RkfYdljVDBpvhVrBP3eY5D6irVLlRzm2LGMzAZ9hHmnfOiuCpszb0ghjCsvConztnf2m413RjR9VNvzCeUMxIn2cZaPfc+NwDdHU5+k9H1shg85IYM+hTeU8AlgAaoC5vEvP01l04eYwkjoJ3CZHh483CQvGqpR4= Received: from SA1P222CA0151.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::21) by SN7PR12MB6981.namprd12.prod.outlook.com (2603:10b6:806:263::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:45 +0000 Received: from SA2PEPF000015C7.namprd03.prod.outlook.com (2603:10b6:806:3c3:cafe::4a) by SA1P222CA0151.outlook.office365.com (2603:10b6:806:3c3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Thu, 10 Oct 2024 19:37:45 +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 SA2PEPF000015C7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:45 +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; Thu, 10 Oct 2024 14:37:44 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v2 06/13] platform/x86: hfi: parse CPU core ranking data from shared memory Date: Thu, 10 Oct 2024 14:36:58 -0500 Message-ID: <20241010193705.10362-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015C7:EE_|SN7PR12MB6981:EE_ X-MS-Office365-Filtering-Correlation-Id: 9403b82c-42ac-440d-b9cc-08dce9630419 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6AgQl95KQsV45adRzqW1SjCuxiCqtWqbXjcMss668O3ZXoUchiFhZr+gIrTT?= =?us-ascii?Q?h0s9OdFUuhmEgo1pFB1vWymWruLdHdbt3WjupPBTz3D1lq6LAamxbzwjsebl?= =?us-ascii?Q?KiRi7+Us2KiC5fm6UlX7K1mQg/OoyZzLp0zCm7ANXWxDzh9pCab4xo2LI20e?= =?us-ascii?Q?/rrwkO1jYDmF8gfKDCG0+bv/4amjm7yK03PwRbQvXh/21rDk+uqUiUYkvnGx?= =?us-ascii?Q?NG/+5iAKIfLdTOrhyV9HgjeVvWY6CdoYEK2TnZbLh3WWAMvUDeLkOpJfiVZ1?= =?us-ascii?Q?FVjOxfqm6FkdfqLA+aUbfV5SDZrXsgdnToN/Y2lvqnfAJP88cEuePEnrEOXD?= =?us-ascii?Q?z1TS35xsGMluQhvhUFQnPKUP2OmJS4Mi6klKKMFGjNb9UC4te99mPe3uR2T3?= =?us-ascii?Q?7KPVDXi+da96ijZ8iGtqtnmISV1ZhP3ptHE1/vdcRHl7yhUECVzXd7L3y/l3?= =?us-ascii?Q?rh+cZTOZMpAa3Iwp99ytrKDYPIy+kGzSAq6XYZ9Kjhwrl+2G2bqWiXgcHZbw?= =?us-ascii?Q?6VZoa1G0Tp+7w561uXsMjnvly3zJ7p7D0/a3eHUENjUqUIyQOxQ8jj88wxYe?= =?us-ascii?Q?p4kNKYbBjxn1YZkHTSLluym+cflnTVAZ/WVXoLD8F29mZzjY6rSsE59AjIBP?= =?us-ascii?Q?yCMdmTfSIaJOLcCSofdhX9qNfhLhZQj6Jlza0hm7puhNi17PKh5ueoOdPY9y?= =?us-ascii?Q?z8A3qFR933pg1roW4b4qptCxQ2Ip+1y9S9gyq7Y6SZ2MWImLlFCj55u3B6gE?= =?us-ascii?Q?0XTOjdBuPp9YXAmknMGWf8t9S2He5DnEHJpbFJvp8lQqO80Aw/z0B+dy3zm8?= =?us-ascii?Q?AFOTEjuQvB6GAZHpO3rZ0W1f2fg0dllITCG5gHDPxsj1ZqFYtZFw9wtDqqkj?= =?us-ascii?Q?ntATTj8OU7OuOQCAbIfirl7sPCohmHf7IrqCZG22xAWylklIJkTgEw1t6D0P?= =?us-ascii?Q?mmyWSEmieCCzhpgBhfIqQckuNwAEvo+NxAVIb0DaZn8ezTMTDF1hHpnHMVwa?= =?us-ascii?Q?wOgKnXcCjF3GdCEDrU5J8hyPmflJntQQXAUSQvzbF3p9NFHC4avkNMEqHyVb?= =?us-ascii?Q?mPxy8mlNw7dikqupsyyyyJiChy7Xm8e41DCFAWfxh0OfswwdsO+jt0YzfUdF?= =?us-ascii?Q?suEswK8uvkSjMXX6EK2MPpMtOhF3eG/mAPKutAVGBQoPvSQjPq5JuDFQ89YF?= =?us-ascii?Q?itcBFrGQvJtzbOktFrobRkjEeN4dPzi3FjXDIUxGLzU9g6JKmWBBCul2LQ7u?= =?us-ascii?Q?5alktvLQEtcQ/ONgQg5V5wAjEgdXigzKTflClhOYXo5SnoGFqCOLU7VF8xXN?= =?us-ascii?Q?Xn9AqAE0OEYbjfXW4o6sEBLHvRDbyQDThdNKzIEDfCcnXOIWgtUdBaYQ3z7i?= =?us-ascii?Q?WMcz9gq7ZRyeBX/dqYm/bbhMyoH3?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:45.8659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9403b82c-42ac-440d-b9cc-08dce9630419 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: SA2PEPF000015C7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6981 Content-Type: text/plain; charset="utf-8" From: Perry Yuan When `amd_hfi` driver is loaded, it will use PCCT subspace type 4 table to retrieve the shared memory address which contains the CPU core ranking table. This table includes a header that specifies the number of ranking data entries to be parsed and rank each CPU core with the Performance and Energy Efficiency capability as implemented by the CPU power management firmware. Once the table has been parsed, each CPU is assigned a ranking score within its class. Subsequently, when the scheduler selects cores, it chooses from the ranking list based on the assigned scores in each class, thereby ensuring the optimal selection of CPU cores according to their predefined classifications and priorities. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2: * Rework amd_hfi_fill_metatadata to directly use structure instead of pointer math. --- drivers/platform/x86/amd/hfi/hfi.c | 215 ++++++++++++++++++++++++++++- 1 file changed, 212 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index da2e667107e8..10651399cf75 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -18,22 +18,78 @@ #include #include #include +#include #include +#include #include #include #include #include +#include +#include + +#include + +#include +#include =20 #define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HFI_MAILBOX_COUNT 1 +#define AMD_HETERO_RANKING_TABLE_VER 2 + #define AMD_HETERO_CPUID_27 0x80000027 + static struct platform_device *device; =20 +/** + * struct amd_shmem_info - Shared memory table for AMD HFI + * + * @signature: The PCC signature. The signature of a subspace is computed = by + * a bitwise of the value 0x50434300 with the subspace ID. + * @flags: Notify on completion + * @length: Length of payload being transmitted including command field + * @command: Command being sent over the subspace + * @version_number: Version number of the table + * @n_logical_processors: Number of logical processors + * @n_capabilities: Number of ranking dimensions (performance, efficiency= , etc) + * @table_update_context: Command being sent over the subspace + * @n_bitmaps: Number of 32-bit bitmaps to enumerate all the APIC IDs + * This is based on the maximum APIC ID enumerated in the system + * @reserved: 24 bit spare + * @table_data: Bit Map(s) of enabled logical processors + * Followed by the ranking data for each logical processor + */ +struct amd_shmem_info { + struct acpi_pcct_ext_pcc_shared_memory header; + u32 version_number :8, + n_logical_processors :8, + n_capabilities :8, + table_update_context :8; + u32 n_bitmaps :8, + reserved :24; + u32 table_data[]; +} __packed; + struct amd_hfi_data { const char *name; struct device *dev; struct mutex lock; + + /* PCCT table related*/ + struct pcc_mbox_chan *pcc_chan; + void __iomem *pcc_comm_addr; + struct acpi_subtable_header *pcct_entry; + struct amd_shmem_info *shmem; }; =20 +/** + * struct amd_hfi_classes - HFI class capabilities per CPU + * @perf: Performance capability + * @eff: Power efficiency capability + * + * Capabilities of a logical processor in the ranking table. These capabil= ities + * are unitless and specific to each HFI class. + */ struct amd_hfi_classes { u32 perf; u32 eff; @@ -42,23 +98,105 @@ struct amd_hfi_classes { /** * struct amd_hfi_cpuinfo - HFI workload class info per CPU * @cpu: cpu index + * @apic_id: apic id of the current cpu * @cpus: mask of cpus associated with amd_hfi_cpuinfo * @class_index: workload class ID index * @nr_class: max number of workload class supported + * @ipcc_scores: ipcc scores for each class * @amd_hfi_classes: current cpu workload class ranking data * * Parameters of a logical processor linked with hardware feedback class */ struct amd_hfi_cpuinfo { int cpu; + u32 apic_id; cpumask_var_t cpus; s16 class_index; u8 nr_class; + int *ipcc_scores; struct amd_hfi_classes *amd_hfi_classes; }; =20 static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) =3D {.class= _index =3D -1}; =20 +static int find_cpu_index_by_apicid(unsigned int target_apicid) +{ + int cpu_index; + + for_each_possible_cpu(cpu_index) { + struct cpuinfo_x86 *info =3D &cpu_data(cpu_index); + + if (info->topo.apicid =3D=3D target_apicid) { + pr_debug("match APIC id %d for CPU index: %d", + info->topo.apicid, cpu_index); + return cpu_index; + } + } + + return -ENODEV; +} + +static int amd_hfi_fill_metadata(struct amd_hfi_data *amd_hfi_data) +{ + struct acpi_pcct_ext_pcc_slave *pcct_ext =3D + (struct acpi_pcct_ext_pcc_slave *)amd_hfi_data->pcct_entry; + void __iomem *pcc_comm_addr; + + pcc_comm_addr =3D acpi_os_ioremap(amd_hfi_data->pcc_chan->shmem_base_addr, + amd_hfi_data->pcc_chan->shmem_size); + if (!pcc_comm_addr) { + pr_err("failed to ioremap PCC common region mem\n"); + return -ENOMEM; + } + + memcpy_fromio(amd_hfi_data->shmem, pcc_comm_addr, pcct_ext->length); + iounmap(pcc_comm_addr); + + if (amd_hfi_data->shmem->header.signature !=3D PCC_SIGNATURE) { + pr_err("Invalid signature in shared memory\n"); + return -EINVAL; + } + if (amd_hfi_data->shmem->version_number !=3D AMD_HETERO_RANKING_TABLE_VER= ) { + pr_err("Invalid veresion %d\n", amd_hfi_data->shmem->version_number); + return -EINVAL; + } + + for (u32 i =3D 0; i < amd_hfi_data->shmem->n_bitmaps; i++) { + u32 bitmap =3D amd_hfi_data->shmem->table_data[i]; + + for (u32 j =3D 0; j < BITS_PER_TYPE(u32); j++) { + struct amd_hfi_cpuinfo *info; + int apic_id =3D i * BITS_PER_TYPE(u32) + j; + int cpu_index; + + if (!(bitmap & BIT(j))) + continue; + + cpu_index =3D find_cpu_index_by_apicid(apic_id); + if (cpu_index < 0) { + pr_warn("APIC ID %d not found\n", apic_id); + continue; + } + + info =3D per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + info->apic_id =3D apic_id; + + /* Fill the ranking data for each logical processor */ + info =3D per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + for (int k =3D 0; k < info->nr_class; k++) { + u32 *table =3D amd_hfi_data->shmem->table_data + + amd_hfi_data->shmem->n_bitmaps + + i * info->nr_class; + + info->amd_hfi_classes[k].eff =3D table[apic_id + 2 * k]; + info->amd_hfi_classes[k].perf =3D table[apic_id + 2 * k + 1]; + } + } + } + + return 0; +} + static int amd_hfi_alloc_class_data(struct platform_device *pdev) { struct amd_hfi_cpuinfo *hfi_cpuinfo; @@ -68,8 +206,7 @@ static int amd_hfi_alloc_class_data(struct platform_devi= ce *pdev) =20 nr_class_id =3D cpuid_eax(AMD_HETERO_CPUID_27); if (nr_class_id < 0 || nr_class_id > 255) { - dev_warn(dev, "failed to get supported class number from CPUID %d\n", - AMD_HETERO_CPUID_27); + dev_warn(dev, "failed to get number of supported classes\n"); return -EINVAL; } =20 @@ -79,7 +216,10 @@ static int amd_hfi_alloc_class_data(struct platform_dev= ice *pdev) sizeof(struct amd_hfi_classes), GFP_KERNEL); if (!hfi_cpuinfo->amd_hfi_classes) return -ENOMEM; - + hfi_cpuinfo->ipcc_scores =3D devm_kcalloc(dev, nr_class_id, + sizeof(int), GFP_KERNEL); + if (!hfi_cpuinfo->ipcc_scores) + return -ENOMEM; hfi_cpuinfo->nr_class =3D nr_class_id; } =20 @@ -93,6 +233,70 @@ static void amd_hfi_remove(struct platform_device *pdev) mutex_destroy(&dev->lock); } =20 +static int amd_hfi_metadata_parser(struct platform_device *pdev, + struct amd_hfi_data *amd_hfi_data) +{ + struct acpi_pcct_ext_pcc_slave *pcct_ext; + struct acpi_subtable_header *pcct_entry; + struct mbox_chan *pcc_mbox_channels; + struct acpi_table_header *pcct_tbl; + struct pcc_mbox_chan *pcc_chan; + acpi_status status; + int ret; + + pcc_mbox_channels =3D devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_mbox_channels), GFP_KERNEL); + if (!pcc_mbox_channels) { + ret =3D -ENOMEM; + goto out; + } + + pcc_chan =3D devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_chan), GFP_KERNEL); + if (!pcc_chan) { + ret =3D -ENOMEM; + goto out; + } + + status =3D acpi_get_table(ACPI_SIG_PCCT, 0, &pcct_tbl); + if (ACPI_FAILURE(status) || !pcct_tbl) { + ret =3D -ENODEV; + goto out; + } + + /* get pointer to the first PCC subspace entry */ + pcct_entry =3D (struct acpi_subtable_header *) ( + (unsigned long)pcct_tbl + sizeof(struct acpi_table_pcct)); + + pcc_chan->mchan =3D &pcc_mbox_channels[0]; + + amd_hfi_data->pcc_chan =3D pcc_chan; + amd_hfi_data->pcct_entry =3D pcct_entry; + pcct_ext =3D (struct acpi_pcct_ext_pcc_slave *)pcct_entry; + + if (pcct_ext->length <=3D 0) { + ret =3D -EINVAL; + goto out; + } + + amd_hfi_data->shmem =3D devm_kmalloc(amd_hfi_data->dev, pcct_ext->length,= GFP_KERNEL); + if (!amd_hfi_data->shmem) { + ret =3D -ENOMEM; + goto out; + } + + pcc_chan->shmem_base_addr =3D pcct_ext->base_address; + pcc_chan->shmem_size =3D pcct_ext->length; + + /* parse the shared memory info from the pcct table */ + ret =3D amd_hfi_fill_metadata(amd_hfi_data); + + acpi_put_table(pcct_tbl); + +out: + return ret; +} + static const struct acpi_device_id amd_hfi_platform_match[] =3D { { "AMDI0104", 0}, { } @@ -121,6 +325,11 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) goto out; =20 + /* parse PCCT table */ + ret =3D amd_hfi_metadata_parser(pdev, amd_hfi_data); + if (ret) + goto out; + out: return ret; } --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19ACC1E230A; Thu, 10 Oct 2024 19:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589073; cv=fail; b=H658GwckziTqydxHflbuR18INadDkYcYvNJxi+aguwxJGqlpAQkDu+PynJ6w4JToGcBOUZeLNUb6Ti6qhvnkdMaSVAfJ9TmJcI5C95+Au0w7i/gBOy/sFTZE2UcxukLw13t2FfeGrG8Q2VyUNXYp3IunQQjxRV6osCz9R3rFqY4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589073; c=relaxed/simple; bh=muiMyhQ6HOByCuQz5kAf6ocvBnUsDnmDZ4WHyAsUlWY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ecUzvRkqU/Sz6BsljF1Oa3GhMDqLhe7ydtM7EQoRU4WH3TvlfMwa0l6cL1FbP24N3QDV4R0r27waTNPxnV63Prto+dtuOK6ijRaCM2bE6ghDk/MjhOhQclsRwbUUNvrkYGvSSzWwZwylEuYWgBGErR26T2oXV/Npa70OP7dLjkE= 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=LIT1hz+L; arc=fail smtp.client-ip=40.107.220.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="LIT1hz+L" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a1B3HBmFiyJeuq8pD9/XKC8aYz9iKwLKobm73WwCFZPcpgsk8AYtsZ6wkMUJ8wZS3oGG3RR+c0gpZLs00DHBtSIRWfD1PEaFO8hQJYqRcx/b0iKjCRdVdrQZHVEKq2HXfZTfQzoB8UTJb9kMgpjmhDGUcB8wBseMu3SrnJqV6WR0c8kpP6IWQsjzJmAheHmEn0dFtVe2D+H16CLON6rQeID2DvjK8jgQVOVgRI36PgbHLEM7eZ6pDR44hWNS0QhYULH6pzyrQ0izNUrxSaYRzv5vpSo/Ri3I6iPnEr0peQzvJO/V61rLh1g0nCoTMmjZUOVbi6LiHjUU+2qtSfh7yA== 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=GFx/aQdUqk+kQqflSePbD/Gk+tbhSGqsauJki3fOICI=; b=bX2UD9Th2FXjgSXjtu73y6r0ZndcZIvlEbUBF+ITAqP5uUp1KIbq++udElTUKsrvFsO+M+zDeuIC7fmD2FmTamG2mOQv00hqKjd7B5CbFaNt2otk0odLeZ3LlvBwFAZ4jXyDIMXLRw/XdTk0Cx2CO2LB55CW43OY0TPlMrGgXT5Aedlf85/PGCZ8fGwxGJkTPQhiRYp7jZxbPLYi2Im6DxSfB3nHrr0M/Z9Vh+ldRd+D1sYxRE25qPklU4MOkDWwsfxmVHHsnWEjBtog4WuNElgnfyxOiwQj2Tp+grCxKjz4HmvSJ/6684w3rUPcvLrO0Sg9TRFUZR9C4XJlzL1yaA== 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=GFx/aQdUqk+kQqflSePbD/Gk+tbhSGqsauJki3fOICI=; b=LIT1hz+LA1U27lKnO9D79/dUH/Q2Fdbc3jecm41djpTjwWF6lgYMbyeP3SbqnquvXfSHzNo1C6oFYmDhx/78AHodVBhV2QuwhxisZ/Fa7pEBqslhKhMqYPZBtQhHNYV/5kkNj/sLK2asDPZUOXgrS0xPELeA10xPWxWC9GYApjM= Received: from SA0PR11CA0083.namprd11.prod.outlook.com (2603:10b6:806:d2::28) by MW6PR12MB8950.namprd12.prod.outlook.com (2603:10b6:303:24a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20; Thu, 10 Oct 2024 19:37:47 +0000 Received: from SA2PEPF000015CB.namprd03.prod.outlook.com (2603:10b6:806:d2:cafe::d6) by SA0PR11CA0083.outlook.office365.com (2603:10b6:806:d2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.19 via Frontend Transport; Thu, 10 Oct 2024 19:37:47 +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 SA2PEPF000015CB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:47 +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; Thu, 10 Oct 2024 14:37:45 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v2 07/13] platform/x86: hfi: init per-cpu scores for each class Date: Thu, 10 Oct 2024 14:36:59 -0500 Message-ID: <20241010193705.10362-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015CB:EE_|MW6PR12MB8950:EE_ X-MS-Office365-Filtering-Correlation-Id: dd2b95ba-8501-4405-825b-08dce96304dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?VuHKUbOqUXK/SY1GAN47n3CoyxEyIDQGYnjIeGlqfI2DAllETF1Sm/JQ9RkX?= =?us-ascii?Q?kyeFZLBo5wiG8kA5h8Ks27aohp6ppe/wzfirCy2XQ9Dpm2sxp+VH50+sSULo?= =?us-ascii?Q?wSpylKcnXEa3zFyVoAuZ16QsFwWAHJADGV8I51avUbO+aWG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osuEK7HBD3W5q1jB410wH6BB2guHJqENT/VAvr3dE7HvvuJp?= =?us-ascii?Q?fj1ce0ehl02Ow7VJx7JUJg8gcbyvIEhGjFnGI/7fAL1HS9CLwnof7q6hbAru?= =?us-ascii?Q?fuzX98wjQNw7kNF46V3qd+YkccMxrsGV3fOPLiGhrQl7baMjZ+LFiyIs5mB+?= =?us-ascii?Q?0JMAz0Ep0oRZk6y87jywnKHqvej24J7qs9q+woPGGedgDfphI4MIrs/gIYFj?= =?us-ascii?Q?Htog8bMzNagn1Go1aHE/jiKs1hbgaartMbSovJ+vclO/WpFLlZsPEMv/NfaR?= =?us-ascii?Q?iZOOTmjT4IOHYUuC1l/JiM4Q8Po/Y2TxZ2ozP+aYWQoWQVqqb0LovMWRdneR?= =?us-ascii?Q?epS65+prI4EEmIGULV56QcMp48/5?= 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)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:47.1646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd2b95ba-8501-4405-825b-08dce96304dd 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: SA2PEPF000015CB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8950 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Initialize per cpu score `amd_hfi_ipcc_scores` which store energy score and performance score data for each class. `Classic core` and `Dense core` are ranked according to those values as energy efficiency capability or performance capability. OS scheduler will pick cores from the ranking list on each class ID for the thread which provide the class id got from hardware feedback interface. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2: * Rework --- drivers/platform/x86/amd/hfi/hfi.c | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index 10651399cf75..c0065ba0ed18 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -119,6 +119,8 @@ struct amd_hfi_cpuinfo { =20 static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) =3D {.class= _index =3D -1}; =20 +static DEFINE_MUTEX(hfi_cpuinfo_lock); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -233,6 +235,31 @@ static void amd_hfi_remove(struct platform_device *pde= v) mutex_destroy(&dev->lock); } =20 +static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int= cpu) +{ + for (int i =3D 0; i < hfi_cpuinfo->nr_class; i++) + WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], + hfi_cpuinfo->amd_hfi_classes[i].perf); + + return 0; +} + +static int update_hfi_ipcc_scores(struct amd_hfi_data *amd_hfi_data) +{ + int cpu; + int ret; + + for_each_online_cpu(cpu) { + struct amd_hfi_cpuinfo *hfi_cpuinfo =3D per_cpu_ptr(&amd_hfi_cpuinfo, cp= u); + + ret =3D amd_set_hfi_ipcc_score(hfi_cpuinfo, cpu); + if (ret) + return ret; + } + + return 0; +} + static int amd_hfi_metadata_parser(struct platform_device *pdev, struct amd_hfi_data *amd_hfi_data) { @@ -330,6 +357,11 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) goto out; =20 + /* set up IPCC scores */ + ret =3D update_hfi_ipcc_scores(amd_hfi_data); + if (ret) + goto out; + out: return ret; } --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2051.outbound.protection.outlook.com [40.107.94.51]) (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 187C71E0495; Thu, 10 Oct 2024 19:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589072; cv=fail; b=udrimOyZJmXJb85KGblHcDUJoZEA5c9BdNI37RUUm+NWVjgpg4CvqbKE1TK1nXXgVa6thNDDWBezTmsNqk9Sfo2QaNNM/+miR6WROvhyjGXSRPtBc49r5LmP4OTQSZ74vpAtqDqCEMpkXeOWK9eVnvsddSINKTbI6dy34wQO/+8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589072; c=relaxed/simple; bh=c4x74gUUGr7+G0YkUn6OuqDvmXEa08Nm7tqrmQrGwEU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sDsOVc5Qdm0BawOg6e5np7F3svcV+r1cE+dp9Y2rZnl22EUg19qN6/B3Fta4MRQrNf9rUP31RpMkrAAIe1jwp1PbKmh32YxpuO3BdzWd2kv4s8mR3EXVs2LIFNzLL3q+BusiDci60T51qeOaMEvRnXESLy4+U5kRFUNcq/2yboo= 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=Wo2XD1ap; arc=fail smtp.client-ip=40.107.94.51 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="Wo2XD1ap" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uhMNfuhsc8ybwIlQvF1ZcVR61U5l25fX1zkwKqo7J2+u6OEXWurtKZVJKkvQSspkB/0Var+ceZSGvu62a4Fg3EVj/x004Hyc5EhtcB57QY5FfU1nYm/+pfnqecJi9g3utGtIrmfPpGvHOFb/FHZykCxkMDGejK79JKedWgesnpiKU9Isq/Fqeh1Y2p4b/RNl0EzL8tgoj6HQYxF66+nUip8CMpXKpCeGjQljdwUlai2bslb5x6KOWB/b+56q0E9jM54CZWHtCghw42BGVi7W0R/fIjTdmxSzw3/JEIYFT/ZkSisJiPLf7phAJyr0bIbDWzCimEMTqDmEOuvOJOFgzw== 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=tlPMfOG2AfnrLE0YxH40bcGxD+6XcpnN7M/ZJK2u3jE=; b=isy0VdPm/pv9g6uL1ynvg7xfh336PXrTKd4tWabc6lzDW+/k7R1A25rhL47aREuQ8HitltrajSh0p+VtMi3NXrHbpjSKS/yUyeuudJgzmLibdzuysjDoiHUUOXg+A/o8tRkJWbmjr6f9SD55YfEeUXg0/m/l5RSzXIO1zHcRuHVUNxQCrExsc0qYMhrX6120a+F4vKmkyNFEZ9xdY4DPXBCuEev+SYrtjOb1GuApqnEeJHus7V3tyM3rDiKuVhGTJ7wzXeT/yLc5CwtZc0czUYfveijOKNc33idMmk7Y49R1sjH7zQinylB3L5Svh8mt2SGdBGFsf8msmOTISMO5SQ== 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=tlPMfOG2AfnrLE0YxH40bcGxD+6XcpnN7M/ZJK2u3jE=; b=Wo2XD1apfJaIwhnWMr/D1ilCXerTC1y7+27ky5G4mP/dOuGp85Fnt7ZMHPCgN7BxwLHxz1Ym/Yc136AtNdAT6RmFVBWIeabGVTETo73C8xEzGXMOTEtd9T6JEu6yWrCZFLNakhF061muu2j1LfYdEG2uMEAE9glyZ9IOTfOmTPU= Received: from SA0PR11CA0090.namprd11.prod.outlook.com (2603:10b6:806:d2::35) by MN2PR12MB4272.namprd12.prod.outlook.com (2603:10b6:208:1de::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:48 +0000 Received: from SA2PEPF000015CB.namprd03.prod.outlook.com (2603:10b6:806:d2:cafe::5c) by SA0PR11CA0090.outlook.office365.com (2603:10b6:806:d2::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18 via Frontend Transport; Thu, 10 Oct 2024 19:37:48 +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 SA2PEPF000015CB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:48 +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; Thu, 10 Oct 2024 14:37:46 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v2 08/13] platform/x86: hfi: add online and offline callback support Date: Thu, 10 Oct 2024 14:37:00 -0500 Message-ID: <20241010193705.10362-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015CB:EE_|MN2PR12MB4272:EE_ X-MS-Office365-Filtering-Correlation-Id: 2dae8d60-6f36-4cc7-a37f-08dce9630560 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6D7fzATWtxiDcc68EosNcuKRoXBNrWwbusJQU2MXjpBxFqGSK5y5lLamzubt?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maVW9pEb1cVIv+c9Gn7Bu2ihjYF/mOAC8?= =?us-ascii?Q?lCIWuqoMFG+F4dbcjKE9sLE9gX2u/rUl8/TDvDnxTSsObg5Nrce3GNr5UY9n?= =?us-ascii?Q?Z0sMPmHUEE0paqTUuSKOOCLKrLEUbGjM9Jr1J+azivkT+7O7hhyStYBQRJMh?= =?us-ascii?Q?yqPgBxabkDFG+RofCj8i4DyZ8w88UaUUdjH345pO6J9DnbdTZHGJl5N4pqB6?= =?us-ascii?Q?IxYYmPjbCCpKscMjWudHcCSvtVDLxmhqKfdQnjOx9zsreoDIG0RM6oKkWx6l?= =?us-ascii?Q?La9w5bEZfVSHJKIJljm0HRP7m9CG5i+lU4te+LBQtXZpUb+vZCUdJEcRSS0z?= =?us-ascii?Q?XmkDH7akzaQt+QMAJwkcm76rUWADojzLYRbAAT1pYbY7Ke69R3RHnh9fnDXK?= =?us-ascii?Q?ZkRUrp/obF4obSELWgon59DK+9ZaEcwU8UZdzLWGsljEBWAVm/oad2DiXCzY?= =?us-ascii?Q?wFiZgybF6k47cA92FvAU3JN2UQVE?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:48.0083 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2dae8d60-6f36-4cc7-a37f-08dce9630560 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: SA2PEPF000015CB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4272 Content-Type: text/plain; charset="utf-8" From: Perry Yuan There are some firmware parameters that need to be configured when a CPU core is brought online or offline. when CPU is online, it will initialize the workload classification parameters to CPU firmware which will trigger the workload class ID updating function. Once the CPU is going to offline, it will need to disable the workload classification function and clear the history. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2: * Rebase --- drivers/platform/x86/amd/hfi/hfi.c | 90 +++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index c0065ba0ed18..c969ee7ea5ee 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -244,6 +244,89 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuin= fo *hfi_cpuinfo, int cpu) return 0; } =20 +static int amd_hfi_set_state(unsigned int cpu, bool state) +{ + int ret; + + ret =3D wrmsrl_on_cpu(cpu, AMD_WORKLOAD_CLASS_CONFIG, state); + if (ret) + return ret; + + return wrmsrl_on_cpu(cpu, AMD_WORKLOAD_HRST, 0x1); +} + +/** + * amd_hfi_online() - Enable workload classification on @cpu + * @cpu: CPU in which the workload classification will be enabled + * + * Return: 0 on success, negative error code on failure + */ +static int amd_hfi_online(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info =3D per_cpu_ptr(&amd_hfi_cpuinfo, cpu); + struct amd_hfi_classes *hfi_classes; + int ret; + + if (WARN_ON_ONCE(!hfi_info)) + return -EINVAL; + + if (!zalloc_cpumask_var(&hfi_info->cpus, GFP_KERNEL)) + return -ENOMEM; + + mutex_lock(&hfi_cpuinfo_lock); + cpumask_set_cpu(cpu, hfi_info->cpus); + + /* + * Check if @cpu as an associated, initialized and ranking data must be f= illed + */ + hfi_classes =3D hfi_info->amd_hfi_classes; + if (!hfi_classes) + goto unlock; + + /* Enable the workload classification interface */ + ret =3D amd_hfi_set_state(cpu, true); + if (ret) + pr_err("wct enable failed for cpu %d\n", cpu); + + mutex_unlock(&hfi_cpuinfo_lock); + return 0; + +unlock: + free_cpumask_var(hfi_info->cpus); + mutex_unlock(&hfi_cpuinfo_lock); + return ret; +} + +/** + * amd_hfi_offline() - Disable workload classification on @cpu + * @cpu: CPU in which the workload classification will be disabled + * + * Remove @cpu from those covered by its HFI instance. + * + * Return: 0 on success, negative error code on failure + */ +static int amd_hfi_offline(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info =3D &per_cpu(amd_hfi_cpuinfo, cpu); + int ret; + + if (WARN_ON_ONCE(!hfi_info)) + return -EINVAL; + + mutex_lock(&hfi_cpuinfo_lock); + + /* Disable the workload classification interface */ + ret =3D amd_hfi_set_state(cpu, false); + if (ret) + pr_err("wct disable failed for cpu %d\n", cpu); + + mutex_unlock(&hfi_cpuinfo_lock); + + free_cpumask_var(hfi_info->cpus); + + return 0; +} + static int update_hfi_ipcc_scores(struct amd_hfi_data *amd_hfi_data) { int cpu; @@ -362,8 +445,13 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) goto out; =20 + ret =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/amd_hfi:online", + amd_hfi_online, amd_hfi_offline); + if (ret < 0) + goto out; + out: - return ret; + return ret < 0 ? ret : 0; } =20 static struct platform_driver amd_hfi_driver =3D { --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2088.outbound.protection.outlook.com [40.107.100.88]) (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 8E6E41990C1; Thu, 10 Oct 2024 19:37:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589074; cv=fail; b=MF9Uz88QBSACCG7jpuHtVspWaN5epit7JHDs/qmtUm4NIBQI/6YQ5XG48qfe49tdQ0jY6j0t6KqAr30mWBAtlNW/XcAkKQpzaScnz89mrNX4L9ImnnHRk/tm/GSTysCvD0AU8jeAViNIkSVlYtJ3DPMjSt0aUju/KzGb/SbyWDs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589074; c=relaxed/simple; bh=HfdXoUrJCOh1tpdl2DPe0DDRfl2MMYJhInpzYP9fvKI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ggynwJ9woewM6MvFkTKvxAsdvAFQ9rAgyYOSUkycvnT9RyU2O/GDCrcT0kVBORHJBxHoIxLfmB3Z4ARiEs4IcOzio8+icjUllC5svsGD0nCBYd4EvHrAkDVfLhMquZ1l3ddIuU+CIkthZ04i6IrqmBVITJn95INuirIrRUf3keE= 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=VaWvtjD2; arc=fail smtp.client-ip=40.107.100.88 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="VaWvtjD2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tHwE/D1jdD98AOh9J0gXgFbo+8uGv+WBnYv84QIbpukL3qVmE28hXlriiUTB5HLjtBIdrpM8UKzEykNYAFavyDSQNn3Ug+JsGrxsQ6CiduyOdsiybl7faWoYABLyoogsD8vz+pfI8OuspFdV5QTVgcV+oOJtbuX49RlmqQE6TO4G5b/c3/LX8aLT8RGgSdI3JBhYpPXYs/IqBRX8NweUW/Cg8ImsK/M/MPQiQusHO4TIlkkpPj3jjnv9ZjbhpX7CGOgoXpP4T+SDrfLGu1mbslWZXm6EPuSSfuOkSUVuGdIcXCfGOJvQhM5bed2+sK9ZnJDtpliS7W6vLqSbqTodUA== 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=mx9SO3c96XRDlbNKtd8bYfvq1jcUGBe+tEkpG9n1WBs=; b=NnnsfSPl0d8jsKRIyVIYXLizy+mgASQaYZKkjG3jZwdHbHC6Zt7VVvYa/Smsm4Xh8OCWSlx4ctto5nibjYDhpyksqHClwy076F830Yf2i4IBnKVhQ88qxvcR+H8s7C0tPXbKpLZo7avut2amXGztDY7NIqqMr3RrQNE/JB1nHwF7ZpZ54TA4sVjePJV+3KSpaQ5VKqRRD7Y+Ab5F0b/ElkHMZlGAkq+/Cp/6YPP5W51ZyojSQ1StcP4cvGMqUdcWvpXEanrj7EhKZ2GBVZPi1fsKGaXgNIbHIQGJoo6/G2BW2hlqQLYxSrzQMaa7MDzHkgLEcjnq54k1G+LNpXh8fA== 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=mx9SO3c96XRDlbNKtd8bYfvq1jcUGBe+tEkpG9n1WBs=; b=VaWvtjD2eV/u+FRxCjhwvWAK31z+cM66iqjze1MZp1X+we8pHgMJFcKA81fDhsze7ZtJyliGz/oPo26ube6P3dzzXFFlahbDCLpa4fD3hQ9la7Uns8hU0pdTIy93e8V2umwoB6P0mjgqZN4GSyNlzcJek8X7c3yTmW+YSI0+KL0= Received: from SN6PR01CA0024.prod.exchangelabs.com (2603:10b6:805:b6::37) by LV3PR12MB9141.namprd12.prod.outlook.com (2603:10b6:408:1a7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:49 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:805:b6:cafe::49) by SN6PR01CA0024.outlook.office365.com (2603:10b6:805:b6::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Thu, 10 Oct 2024 19:37:49 +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 SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:49 +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; Thu, 10 Oct 2024 14:37:47 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v2 09/13] platform/x86: hfi: add power management callback Date: Thu, 10 Oct 2024 14:37:01 -0500 Message-ID: <20241010193705.10362-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015C6:EE_|LV3PR12MB9141:EE_ X-MS-Office365-Filtering-Correlation-Id: 621fdf6e-811c-48f5-d6bd-08dce963062a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?0REJE2tNXjy3F6ECR0kXrICT+kjJ3XFQT3mpdRrVCFpOaAGUreM3gWkxNJ+z?= =?us-ascii?Q?b9CGSmSKs9nt7jjrQXN+bmGlMZMMlumHLb+LNXqDdv8olGoygGamozjb7MtX?= =?us-ascii?Q?slhmd1DNdPNsLQlDSGlL2VyVDdN/d+nL2SYU5riIFzTx2j4h+pPf8wB1dprr?= =?us-ascii?Q?eycykdfiuiHB/qObdu2J2YAVHRYVjccKyLImRMxmztVKeL3LHWVxsp8aGfLN?= =?us-ascii?Q?1hjGJbRADfH+VL0Yfq14Yvk9APYln3ewzMMW7oGxD2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bpYTbGwxqt2WtDJBUHinE0KB+Q3L22ps3S3xgeu8Il9OSzKy6?= =?us-ascii?Q?uMKLrp4U8jOw6e2+FRO1XeX7d0sZ7yNpBYsGwdRk9ZW3rUQkSV5OtZjvUysx?= =?us-ascii?Q?etTE53bAV6KchtnpS3h+YasVrTjVTi8q3LHGUh5Oq1jxrWDa3blSjPBvuqw7?= =?us-ascii?Q?JjOv3D3Zsou/pCq/lRw/+4MNelD12yFOCwwnr1R1cmA2wgx+G8Nv8ARCCKq/?= =?us-ascii?Q?CWjF+UQZcjNsJc6/kFzcRq1FiXIJ?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:49.3335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 621fdf6e-811c-48f5-d6bd-08dce963062a 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: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9141 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Introduces power management callbacks for the `amd_hfi` driver. Specifically, the `suspend` and `resume` callbacks have been added to handle the necessary operations during system low power states and wake-up. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2: * Whitespace changes * Use on online CPUs not present ones --- drivers/platform/x86/amd/hfi/hfi.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index c969ee7ea5ee..0263993b0a94 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -407,6 +407,38 @@ static int amd_hfi_metadata_parser(struct platform_dev= ice *pdev, return ret; } =20 +static int amd_hfi_pm_resume(struct device *dev) +{ + int ret, cpu; + + for_each_present_cpu(cpu) { + ret =3D amd_hfi_set_state(cpu, true); + if (ret < 0) { + dev_err(dev, "failed to enable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static int amd_hfi_pm_suspend(struct device *dev) +{ + int ret, cpu; + + for_each_online_cpu(cpu) { + ret =3D amd_hfi_set_state(cpu, false); + if (ret < 0) { + dev_err(dev, "failed to disable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, amd_hfi_pm_suspend, amd_hf= i_pm_resume); + static const struct acpi_device_id amd_hfi_platform_match[] =3D { { "AMDI0104", 0}, { } @@ -458,6 +490,7 @@ static struct platform_driver amd_hfi_driver =3D { .driver =3D { .name =3D AMD_HFI_DRIVER, .owner =3D THIS_MODULE, + .pm =3D &amd_hfi_pm_ops, .acpi_match_table =3D ACPI_PTR(amd_hfi_platform_match), }, .probe =3D amd_hfi_probe, --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68]) (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 5D90C1EABA6; Thu, 10 Oct 2024 19:37:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589079; cv=fail; b=MKN/JX4vRvUuy6izm+1xNyVr5qWJoBCz+Ck9QoHxeppEGe/2cr4yGOlrCQN5PwrOBuHuQBqZGpO6bkk9Kx251jgeIsAmFuLjcmXOKRcAM7MlFAwUEc9kpu9GUH69THT4xX4Fs8sPpDFkObn7h2jF20Zzqa6hhFZtPlByQI4CS7c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589079; c=relaxed/simple; bh=UQKR5+GcmqFzl6sl7Pwi8P4c9Xti5ZbCc2ekKsjHmTg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZHFJ+om6+Jfe2ywEc6jLwiIP7yGhOufsS72KIOSrLzsiiCIEvQR/TJDgr75f0pUjoW+hrIYijhYtg8TM/yXmEsqOXC+lgWcXHwiocYoMB+yAVQ1TZPZY+bM++mw7xy1L0jeoUAeXuLaGMsY39c+VjIkc4H4HAMNcLBBopf6fQLE= 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=Jc/EO7T1; arc=fail smtp.client-ip=40.107.94.68 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="Jc/EO7T1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wK2uMqo79bErS7WpndvPsd77fXCEkEK31ycGlTzS7rM6TNNizca2GoeWYTA9vXolHkh+r6NRRbUO0Bcx22aCEsV6TxOgUhPwhQiDBjtkfZ1IZLADANLUdjfJVqSNpMO66WeGSJ/wetJag129H3beHaO3ih27vpVG7xNHQAOqtTh5IgmbchKFzEN2D8Iq/7NVnCuakZizosg0JOHllhNabgliMkRzXIpT1YeuxEAa3qzZCTbQ/JKjo1yHQUkmtBf37Y/GBwOqgw2+giVFLAloQOA6z75NKPe3uKrUQ/1QtLA+qMEJ72eiEZIRVWK/wzF0kko5c7xqtV7iE4EvanNzbw== 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=9Sjoe/LUmiAvjgmyQdQbG7DUvQ25d1VWA899eurarPU=; b=osMVLowasBohpl1sUV2SzJxj614+Iczlk0jwf/rnO5zXeSX+PS0lIVOaoESgR7a2fUXvD/Khq/xJ8UKljRUWFaBj+nT2K3h3SrO69gBSMq6dO3bWhNizW9Xz7GtFoEJj76rFyafrg5A8a8Cx3cV+ag54OieKBkVdrN2BF9VGA8uifuaKKMD4efPV9ZHMMJabSP5ay0iAvhpufeMJOCgUhSP8RrnGF6VBCPSYaE3Fh2UVBoDWxx9aJwfQPSPANcrAWlusYqplKYNXw7O70A69D067RmS+UedsrtHodfGowf6ffcqaptyly3I0Ma2+vze3FZF8Z+ZLUurPu0nmR9IqDQ== 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=9Sjoe/LUmiAvjgmyQdQbG7DUvQ25d1VWA899eurarPU=; b=Jc/EO7T1Hfyj9Mki59hd1xQ7EwPBXIc2BzGa6yA1pWmvaedPHhaELN1k2dU8Emo6Z+Afwx3MAIaz5pVfKtwmUpQgTUvOPALydStojkkLrwuTVmWxPHR6LGu9J+v8ikYeALbKHQ8OZ4YEak0XYh1AA5UMSvkGTohPWNRcNQIyFsY= Received: from SA1PR04CA0006.namprd04.prod.outlook.com (2603:10b6:806:2ce::6) by CY8PR12MB7413.namprd12.prod.outlook.com (2603:10b6:930:5f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 19:37:51 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:806:2ce:cafe::ca) by SA1PR04CA0006.outlook.office365.com (2603:10b6:806:2ce::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Thu, 10 Oct 2024 19:37:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:50 +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; Thu, 10 Oct 2024 14:37:48 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v2 10/13] x86/cpu: Enable SD_ASYM_PACKING for DIE Domain on AMD Processors Date: Thu, 10 Oct 2024 14:37:02 -0500 Message-ID: <20241010193705.10362-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015CA:EE_|CY8PR12MB7413:EE_ X-MS-Office365-Filtering-Correlation-Id: 3aff80c1-5765-407f-a541-08dce96306c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?y6Q3fReQxGnsgimihTNYp/nH+hMgGz4wVVIOamIxwK1sDF8pwuzXCtdujcrl?= =?us-ascii?Q?IfeBkPrwlQTtkGIwyQ8fyos0pOJMB4Gp/TlPrg8wCOCR0eoIGGIKCj+YJlbO?= =?us-ascii?Q?pmD8YKquP8f/6eW8PDS//zLiG67N2oZ5w2037vHkKUaZdmlEoN9ePCZuPIRc?= =?us-ascii?Q?5ANW60iRw0r8xqhAjhgUQDrOqUm0zqttadPCVkDLHliRyA+TrBgbmT8Hi4Jn?= =?us-ascii?Q?SYHcTU5vtDWrAStcKlCjfL1N6vfo4KjMDgcHy7nBjmcgGRA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ZGznrqW7qFC+4PYFoAD3oa5clvhNL0qszzzkV?= =?us-ascii?Q?HncasCjk0ZabeQfk8H13t8KLzAMz/tQxezvQtdu/AsUYe05PbsY2WiJ/BKIw?= =?us-ascii?Q?45M/uYlbM8wgGhITi/bbej/bSne8nXobd31l+hHnInG/T3XvzwmImDATVxse?= =?us-ascii?Q?SCjSrQMIoixiAkSQjqZ2U8pXNT2WDyL8UeRjycbRHt6FTE5sUCsNmC1/wUKb?= =?us-ascii?Q?Nk2bCWjgOXFB2AOeiS4QsZCfbW2M?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:50.3571 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3aff80c1-5765-407f-a541-08dce96306c4 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: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7413 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Enable the SD_ASYM_PACKING domain flag for the DIE domain on AMD heterogeneous processors. This flag is beneficial for processors with one or more CCDs and relies on x86_sched_itmt_flags(). Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello --- v2: * Whitespace --- 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 766f092dab80..c01bb75d0375 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -497,8 +497,9 @@ static int x86_cluster_flags(void) =20 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_HETERO_CORE_TOPOLOGY)) + return x86_sched_itmt_flags(); =20 return 0; } --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) (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 209971E8837; Thu, 10 Oct 2024 19:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589078; cv=fail; b=gFs3Lx80RZ815qWcHBT+rlXemd7uSLGbJwD+JewNH02n5dhR7lC+mtfo2ook2/NpzP26OjgKuKFnvvLdRMZGTkHUNOa8+/oXLLeoY98ltF6MCm6eY/geIOrGYloA56LvqtWcgipAiuac7c3dN88uS19G+suyWoglu6rARGHaWWk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589078; c=relaxed/simple; bh=ZzdKf25essOhTSEl7CEOYGzVkjWlZQm3t6Lml/7nNpA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zb0DSh0hwWr+PFoMvJycOOTADopjLVJvKR1rcuH8trl+TlTKBGD2Y55N0PLxNRxGHm0Wpz6+vldhhkUOhxRBtgnO4+7CXwam8qvOab6y4gMmwPJ63WU+vllOzwZxii0t92HUIS7wdb8jeKrcUpZoXsxOKgzfbzVVyy/yhIdvyPs= 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=oftkFEqM; arc=fail smtp.client-ip=40.107.94.82 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="oftkFEqM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SWnx+3rtV5ZMd41Ysl3LUV7utw2pwDwjff/oEsS5oWHAmuTbyXIudSdnY4lmLqEYljsdPS4cKo56EKO8TtrAm8iJvkDdJVmtczMGOQfMlnNTcWPdkacvxbtPYFy/3ATc9GbIK31frBMYTdtjg4hMgkrRNUfRZNrot2tPPxR3jryByORyCBzWb4n0j2pQp/iKsVqoprd0MI3lUtJ4yX9wH1gSaUnNlPVUjy8h06yxmtkbx1pZ/+NgL5r8y9versOCOST4j1HkKXtZn7s4d4ODIZQm6JV8p9EEE1LULFgJcFot/y/MoYaJXXzMDhOykPHXMLezB6eslmxwsrdJg4DchQ== 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=XopSamKjRL7VvB996UhiT8spS68ru0hhPjos/RZF70c=; b=yjc61pOYBcM3OXniyh2vBwP49Uzp804rbeaghfzOz70xEZBOgwqn30eMRaMdvaZ5vaP9JLbbJOWVd8oqKRvuvf+qXzTmq1AtS74wkuUZKGiw/rRE50K2qTyIJqIGVZEZX5bk7fb9u/a+ke0PVBGlukYNR9JHi5gL/tyTKb6814YyCT43ipxfxUB6SjMrGB6unlPC2OAw5sofSLazJwPkq2Ji8fGQfXOXyA2Xz9rNgXGfJDMiX6cYm4BpaQTIilpjhmljNtbSmdf1R/Pu7vXVGPwiCniDJiyaCq3e6IZ4n8a87CVyEDtDmXH5G1hExOUMJiyiWQwlZA38LsODKZRr4w== 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=XopSamKjRL7VvB996UhiT8spS68ru0hhPjos/RZF70c=; b=oftkFEqMoAQi1rKkJopL2YuRxlIDdgrJ15xUQ7GyjwJmdWcV14hsUWnkUPU/pQ6blTUa3HXKJk0OCEQJ8M4FDfU86KZ0aTYkNvGO2ps6Z4+3L2LXZ0GpUTiH3se7y9rpwEGt+00TWAbz8p5C6N0HT+vOHG7xPyguXuDipzWWWJI= Received: from SA1PR04CA0003.namprd04.prod.outlook.com (2603:10b6:806:2ce::7) by SA1PR12MB7175.namprd12.prod.outlook.com (2603:10b6:806:2b2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Thu, 10 Oct 2024 19:37:53 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:806:2ce:cafe::a) by SA1PR04CA0003.outlook.office365.com (2603:10b6:806:2ce::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18 via Frontend Transport; Thu, 10 Oct 2024 19:37:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:53 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 10 Oct 2024 14:37:49 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v2 11/13] x86/process: Clear hardware feedback history for AMD processors Date: Thu, 10 Oct 2024 14:37:03 -0500 Message-ID: <20241010193705.10362-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015CA:EE_|SA1PR12MB7175:EE_ X-MS-Office365-Filtering-Correlation-Id: a1071107-5749-43ec-3008-08dce9630874 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5vUuDEVW5M+9u4+LIAaZNJQB1TBRQH8bSKmjTWpL9gxBUtW3z/1ng4+8ur9g?= =?us-ascii?Q?cZWLlNAq3v96KJOaZ+DIuZRIf2gSwrK1i5cq/pYy9xMcxOc+ekdwOJXt8jdy?= =?us-ascii?Q?rCMtTXgVrbnPtLylPbloyjIzqPR/6nmksOGAWaGNBDqZ1P08TkHVRV66VWvg?= =?us-ascii?Q?nLJGxvj2IVbTFlmA2fGWafodGV7MDBzv6W+BDx/zC5Fikcalx2+oeMTXf611?= =?us-ascii?Q?YrBzAqQkIkVpWAtCiEO7jaZczgIEsO9NkpEO7t406yaUN2MUC2TH3ObQ1/UF?= =?us-ascii?Q?2Fvzrz3m/GvwNRfG/vqujUZRyDFdstGsz8QhFjq6ihxlfsXAA1Els9jJ01dl?= =?us-ascii?Q?o2y236DdBmx3Zepuc/Bp2mZHpqS/BtCPFIGxJH6SehoDtcL43c/3+T7tVfxT?= =?us-ascii?Q?Dww29vgS2/w8AAyebXm7eknS72/hfDj2oKS6XDFV5GBHOGCf+bOZaYsBtXHW?= =?us-ascii?Q?OtV8yTPwgcOibfI8GK3dtfwfmCQc+o3pU4CRf28+jMnnWnHqzbSE6BD7kjjm?= =?us-ascii?Q?jOgH3zQaumyx86SyP+sB09yhDjqGfRXSP1AxBuMbKoAw4d50v6bc2NTemaPr?= =?us-ascii?Q?THFoWxMUTkAEgKA/KCrlWauBY1nVbUUu1u+WFG39z7/jQAB+EfD5tFtk8BH3?= =?us-ascii?Q?u2L/tIKXXrzKcTZq1NjPuN+hdmb8C4/tofEDpBxWqeg41NaApuDzC3/T17y0?= =?us-ascii?Q?ZceCLJ4/5fAlMLRzMRyOuj9InZqB6wrlkGpRwSMbwfFEE9T1xIoNMDM5+L2W?= =?us-ascii?Q?Sy5taFnUA1uAu5rMLNq1LK/jDHuznoF9DGCYVEomyZmKMzh/DH2PZEA0lIhi?= =?us-ascii?Q?de90Vf0xlhHI2tP08K/8n4TbtZ3Ntwlk/xgU/L+r/ipJ+ELGT9EIBx9AZ17m?= =?us-ascii?Q?iAgmoh2d6nFcwj1JgUUMW8T7dFud7Ll0TktaEexqtRjz5NeLXMpbpIFQx5Lw?= =?us-ascii?Q?Z/QJonrzzjm2EDn4DJqxycjpOZZYMSGYP6xNgX3zi8EZp/DGL7BIqRLpyG/k?= =?us-ascii?Q?8qh2mZ4LywBh6Yk3R3rcA2ZBajZRNWcPdHXleHRrf8EHN3mJIW9nwH6PM4dZ?= =?us-ascii?Q?UZhLozfsdUkqcwX3DuymZxt3skuBbZ3SaciT1uA02AXJBhFDfRl4WHe8H/S8?= =?us-ascii?Q?ah+aD8OhSMX4RAV5iTTrT2ZUxZpb5R5rVVbBLr2IAfHNFu2uJjtero6eUlA8?= =?us-ascii?Q?j/GWBxE1twvdTUZAUP0gw03nDyzh5v1vZzd/icxfjq6lIUFguNRx/3qMAw6o?= =?us-ascii?Q?FAT73DzUKRtr7OO2u5s/z4jrB736C+2ZBGXE5JXv1ZMuF0j4JDv0DEjH2W7D?= =?us-ascii?Q?yoN1VSH1ye8JzepsFuYiICNUvQVDYwBT8IExaKf9MX9nIoZvCbRkppCJeiFC?= =?us-ascii?Q?oi7J8xtFsVtgCMhHejFtO5QRJiFa?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:53.0602 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1071107-5749-43ec-3008-08dce9630874 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: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7175 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Incorporate a mechanism within the context switching code to reset the hardware history for AMD processors. Specifically, when a task is switched in, the class ID was read and reset the hardware workload classification history of CPU firmware and then it start to trigger workload classification for the next running thread. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2: * Fix function name * Use static keys --- arch/x86/include/asm/hreset.h | 6 ++++++ arch/x86/kernel/cpu/common.c | 15 +++++++++++++++ arch/x86/kernel/process_32.c | 3 +++ arch/x86/kernel/process_64.c | 3 +++ 4 files changed, 27 insertions(+) create mode 100644 arch/x86/include/asm/hreset.h diff --git a/arch/x86/include/asm/hreset.h b/arch/x86/include/asm/hreset.h new file mode 100644 index 000000000000..ae1f72602bbd --- /dev/null +++ b/arch/x86/include/asm/hreset.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_HRESET_H + +void reset_hardware_history_hetero(void); + +#endif /* _ASM_X86_HRESET_H */ diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 07a34d723505..887821e97e54 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -403,6 +404,7 @@ static const unsigned long cr4_pinned_mask =3D X86_CR4_= SMEP | X86_CR4_SMAP | X86_C X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED; static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); static unsigned long cr4_pinned_bits __ro_after_init; +static DEFINE_STATIC_KEY_FALSE_RO(hardware_history_features); =20 void native_write_cr0(unsigned long val) { @@ -481,6 +483,12 @@ void cr4_init(void) this_cpu_write(cpu_tlbstate.cr4, cr4); } =20 +static void __init setup_hreset(struct cpuinfo_x86 *c) +{ + if (cpu_feature_enabled(X86_FEATURE_WORKLOAD_CLASS)) + static_key_enable_cpuslocked(&hardware_history_features.key); +} + /* * Once CPU feature detection is finished (and boot params have been * parsed), record any of the sensitive CR bits that are set, and @@ -1844,6 +1852,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) setup_smep(c); setup_smap(c); setup_umip(c); + setup_hreset(c); =20 /* Enable FSGSBASE instructions if available. */ if (cpu_has(c, X86_FEATURE_FSGSBASE)) { @@ -2410,3 +2419,9 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +__always_inline void reset_hardware_history_hetero(void) +{ + if (static_branch_unlikely(&hardware_history_features)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); +} diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 0917c7f25720..6a3a1339f7a7 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -52,6 +52,7 @@ #include #include #include +#include #include =20 #include "process.h" @@ -213,6 +214,8 @@ __switch_to(struct task_struct *prev_p, struct task_str= uct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); =20 + reset_hardware_history_hetero(); + return prev_p; } =20 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 226472332a70..ea7f765c6262 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -709,6 +710,8 @@ __switch_to(struct task_struct *prev_p, struct task_str= uct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); =20 + reset_hardware_history_hetero(); + return prev_p; } =20 --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) (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 103AD1CF5C3; Thu, 10 Oct 2024 19:37:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589080; cv=fail; b=odxIi6w7PlHVRcEf8xX3984lDuszS6rNDuhvuT62W62Mmru+MilvvxMYKEh0v9i92acGXY1HNMFQHxjfW1qKUQj6BLGGTDPZV+1tMmXu4fOLXhrjJKJvvvyHNwktjohzo7vWiwY6NmSRvhl3YTQ5Zt7AvHPIC0724NdU4e/1x44= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589080; c=relaxed/simple; bh=vq6PyZvHUSYtHDOnH5JX8QiULks8YPaXPgLvmkgN0/8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BqUKXMv72ZK8Rbsn8SV61W86sfjsfhr1h2eSCo6WDX2M8Jg+EzBXJMByKeRNoGTBawcacFIOqnLtquckf4uQRvpHhGV9F/nTCdNaAsXnTZlbvv2ZgZCouRqTFn+N8Args5HwALoRyHrYK8aUNoIGvAn3S9CgjWrDIfqnx1m0kKk= 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=pw0cmUHX; arc=fail smtp.client-ip=40.107.237.69 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="pw0cmUHX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fEecSPe5mcfTGiz+TkdmQFdZaIihJpGhyUXg67fcUcWD93hCV18+dUt01rnweWWJciNnsOBNvNcifE1fpNsY1HMcqB/NGk5jFm9GBmnpepS/c++jhv0u5BxcQtUFIqnR+jeNAgqHpPm3Yq0537U3u1V0swNWmYF7yU5xKTThNtBu80tRV0WP7e0UTtYqR4l6mtCP7RgFFgWVDKM7BNDKxGD8pOeBqyRpGqrRTTdw3u1prC2uh+6l81oT0oeN1RdrPY0t2AgCP5eFEn/s16WsLK+FAENJNjgH0oHWFlHLLaW7GUe/vWQirMl4eqjZPhOhdZakme9Et7sb6yeAqITeiw== 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=EfwreEnEewYS0pE9jStWIsLZJZhnleuZNICQAsz10yA=; b=N6oeO8POyMxoVKkQToGlZjQUN85gE13/oC9PShFWXAdgx0DbIvICLBxXo+PwuA8pEtehWiX9+Uj6pxC5WIJ2IDo4ttoSoXXib/G5MKpchFWg8xChN5cGxUUbjS+LTCVZmxwjbopWBYOStZLJhQcLXhJE4sOgVRAjsiBcR+StE7EbGNCjuhOr7Wyq7tqNJ/9YBCWbCRdSVJWSDaiF374S0PsaoC1+wmfmKMSodkQXi6xqz+067b2UQ86KY6c5rfARTIugP7QBaZ5tBk81RzZ0xr8J1wf/6ECx0EDFTj/iGAGa9pzLpEmM3ykuG/ALIwD/Ad14ZeWMXTgOcptYpJbUKg== 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=EfwreEnEewYS0pE9jStWIsLZJZhnleuZNICQAsz10yA=; b=pw0cmUHX/+nfd0nLVkqSEiLyshsQXCK1FzI7JTTpvyhWXezd7Xq0+5aS1J0sI17t2UKHBToj2M4Her3OPLOkWv2L4xSaGhBdXa7H89dNQOIk8orqAhb4e7XRrx30C5X70zqJ7yTqA0a/9S4HLsBLX2AKwX5naa6fxtlmwSN9CnA= Received: from SA1PR04CA0013.namprd04.prod.outlook.com (2603:10b6:806:2ce::19) by BL1PR12MB5873.namprd12.prod.outlook.com (2603:10b6:208:395::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:54 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:806:2ce:cafe::8b) by SA1PR04CA0013.outlook.office365.com (2603:10b6:806:2ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.19 via Frontend Transport; Thu, 10 Oct 2024 19:37:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:53 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 10 Oct 2024 14:37:51 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v2 12/13] cpufreq/amd-pstate: Disable preferred cores on designs with workload classification Date: Thu, 10 Oct 2024 14:37:04 -0500 Message-ID: <20241010193705.10362-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015CA:EE_|BL1PR12MB5873:EE_ X-MS-Office365-Filtering-Correlation-Id: f35635fe-6677-4975-7931-08dce96308df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?oHUZj2RZHOur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YJVTETaX?= =?us-ascii?Q?+KGG5KaamJUqz9VmZnl4Lhe/u7Kl1CsaVomCzFQqjptHsCo8m1YywbRrn82U?= =?us-ascii?Q?j90+w3eZyyXfbg7WJiz/RxasbuwQOJYeCZ5gSCZeA4fuNUB9bvNuoXn9Tm36?= =?us-ascii?Q?LWWdh1taKjwlfutSaF9XNHb/2vwApaor+ic/Fa+1QVlRz8rBNVKQhwJnfcit?= =?us-ascii?Q?b45c66FnKeAdTv6Cw0RTZA1luQ/yqq5awK91yf7CkTBcRfnRgVwzugLgE7ZL?= =?us-ascii?Q?sJq72MVY2yoMCqhlaOEAdT0bf1jI4LufJRcSkAmY6gz4DnPSlEdj3VwxkdEA?= =?us-ascii?Q?k/ULV6QcLkAmj/2GvgFZ1u0yqsGFam1wNYI/V5ulktgMPBal36VG6ikDfU8R?= =?us-ascii?Q?ImdNeWa+wCW4oNZ3zToJolzhcOK4pcosXjIsOFhI/zV0qUa+K5Ev9sWFdlnw?= =?us-ascii?Q?1VBYMgmN4+VC2p6ASDg39RLkPw7pNLxuyTKIpGP7633llyhCcQucr/hAMVPu?= =?us-ascii?Q?gmpdh7QAR6hKPIocV7zi5JICv9/9?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:53.8727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f35635fe-6677-4975-7931-08dce96308df 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: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5873 Content-Type: text/plain; charset="utf-8" On designs that have workload classification, it's preferred that the amd-hfi driver is used to provide hints to the scheduler of which cores to use instead of the amd-pstate driver. Signed-off-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 30415c30d8b4..0751579ef06c 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -780,6 +780,10 @@ static void amd_pstate_init_prefcore(struct amd_cpudat= a *cpudata) /* user disabled or not detected */ if (!amd_pstate_prefcore) return; + /* should use amd-hfi instead */ + if (boot_cpu_has(X86_FEATURE_WORKLOAD_CLASS) && + IS_ENABLED(CONFIG_AMD_HFI)) + return; =20 cpudata->hw_prefcore =3D true; =20 --=20 2.43.0 From nobody Wed Nov 27 08:37:12 2024 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2062.outbound.protection.outlook.com [40.107.95.62]) (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 A456C1CF2B4; Thu, 10 Oct 2024 19:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589079; cv=fail; b=AfxeRTVhroVnwK/kNZez3C6lQ1r5q2TfE+SyqiNHfdBey2FGYD7IT8mFb6VN60CO4poshZQ+Sd42WI6iYUNWwhXAKt4lwPM4GoIzcRolwgmmBStw4gLeKmp3AiHg+u2mxGJhvWbGwBpXV84gtHHMhrL+9dFqW4fUTVufkz1vpxY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728589079; c=relaxed/simple; bh=5MwpwAK0XAOIBD3SIGN511DONmNC0pEPVIZm3eyrnvg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mD0VYhi6WFi72J6MAAtStX6cnwlLy+oubUt6nHVoZaRfbyYi03WYF7PLNn7bbS316mqWXDJwB0J41PMbrOms14XMKcmck1g83Z42nAl4ikByIIpGPQzUvaxRCo0BkBUpDOHkT1ApTWB1dHRFEXAPmMlUfL1sgukfBvvEQ0Vv7Wk= 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=uwVRjs1U; arc=fail smtp.client-ip=40.107.95.62 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="uwVRjs1U" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fmeQEySZIgKBl7ZTDC099U05YryvTxZeFGGWJMsfQVAaYXSy6W2x9wUv6uiGoBQxYB6YFpzHx87ghLS3URrN3RuJ4/o+uKknFedvykvxOGu0ZIiz8PyAf3cxotv5DOqf3BfJyZbP82Tag3wMVbtpa8NYqzIrAFt5jVedHsnTogwKTO9ifixnQCgh36kSkTyNUonFPwdsM2YH+BkewbpyV8owFDzBPP8J6B8RMOXIoblAOUgMsvJGqs4wWMigRToRvjgTi76+B6EH1SXCLII3cGEfXTqFxXQaBDxcMpKpTWH4NMW0WB6rS5HGvb8EataLAb2GimA/aRF6YvB8QiRSAA== 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=GElOAKDz1JLyshcJfsdRfLDz3rfkEDU9C+Or6ZrSaXs=; b=KXuZesrOwqAn9wZ3fuSqgdNKiuhLO5sBXM28l5Lj7wh7m4SNWOqExgn2DGl4eaoNjCXWOba8puWh0DYPOlQBQ27YDk/auU2L8fz9nS7LOpKd695A5yPybcCI+uRwEx/AebPpRNvj9qTYR8c0Zmnxt5GtFJn+hx+eCgaq09WsXLcqKy7OatNt15VA2JbrRNO5sMycmV8cl9AZI3BgzVMiBIVm0ZEdc3zYTg5tKLsBX3E4X7nFKcfAjCgnwscC1YTPBF05vk7QniwGibr5pAStzyuoKuXWZO2vXCkB2TRyd18VJfvUkuSLe2d3jS5CJ6D9ZmtFHsNx0OO6cgUzfzoTzg== 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=GElOAKDz1JLyshcJfsdRfLDz3rfkEDU9C+Or6ZrSaXs=; b=uwVRjs1Uvif5AOz4GRN+yrUzGeLbbFTR0jI93DSNTx1Kz4vkYih9cYhPY6hol/q32lI11E7Ad7SfWQc4XxIh8Al0t3/SVgXaegBc8LLQTI3Aag5TtpBrOnGxTAAnVPzdXN7snG+B0rDXytSpdEnWKrB72w7l3xyWux5Ugt7hpmU= Received: from SA1PR04CA0013.namprd04.prod.outlook.com (2603:10b6:806:2ce::19) by MW5PR12MB5682.namprd12.prod.outlook.com (2603:10b6:303:19f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 19:37:54 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:806:2ce:cafe::9a) by SA1PR04CA0013.outlook.office365.com (2603:10b6:806:2ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.19 via Frontend Transport; Thu, 10 Oct 2024 19:37:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 19:37:54 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 10 Oct 2024 14:37:52 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v2 13/13] platform/x86/amd: hfi: Set ITMT priority from ranking data Date: Thu, 10 Oct 2024 14:37:05 -0500 Message-ID: <20241010193705.10362-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010193705.10362-1-mario.limonciello@amd.com> References: <20241010193705.10362-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: 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: SA2PEPF000015CA:EE_|MW5PR12MB5682:EE_ X-MS-Office365-Filtering-Correlation-Id: a3738b1b-d99c-4f6e-894d-08dce9630930 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?I+5C4qrkIdTNcPemA4x4qRscndtj+8Tjbl31FSswMkKViwy96Um9qPoQU/z7?= =?us-ascii?Q?EhWPpdqoJluYpvRXnCW4bBNP9ie9Nmdu8apI85bvBUT5ieW1Wu4REbdxdoLD?= =?us-ascii?Q?4/cPpVuP8Xr4Ddqqvq8GnWYFWE6FLl/L4wghA/SP9LI9X4VJwsXzwEhLmqYe?= =?us-ascii?Q?i1TbFGwXVLJ1ltniHPItOyXUAAu46GX3QbQJsKcfgFrLAbFgQg+AaCHrbH6t?= =?us-ascii?Q?wl2jl5XnTShB3c5xmoT+4Sl58lWkuuD2//FiTDeRxA81qIzR+yMMvpigDRpv?= =?us-ascii?Q?d+ih3GdlApW3Um7bOeP9xFfX5wkb9kopq1Swq0Xb34Ohlz6IGJjviGQTy6pg?= =?us-ascii?Q?CNoroBuTezLIyVAb4vudCO2gMm07M4aVVGiryGBNYpZBS9vSYtADE8S6q7Zi?= =?us-ascii?Q?T5CfsjMxqsmOqlRqSrLsWn1DGEFmovLEJxF1wgjPPwq9FUxBPQc0E4Rmdfqd?= =?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x3nL6EPkUGiEX1uC8vE?= =?us-ascii?Q?rCmW0Ow=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 19:37:54.4040 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3738b1b-d99c-4f6e-894d-08dce9630930 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: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5682 Content-Type: text/plain; charset="utf-8" The static ranking data that is read at module load should be used to set up the priorities for the cores relative to the performance values. Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/Kconfig | 1 + drivers/platform/x86/amd/hfi/hfi.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/am= d/hfi/Kconfig index 08051cd4f74d..4dfa7641b35b 100644 --- a/drivers/platform/x86/amd/hfi/Kconfig +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -7,6 +7,7 @@ config AMD_HFI bool "AMD Hetero Core Hardware Feedback Driver" depends on ACPI depends on CPU_SUP_AMD + depends on SCHED_MC_PRIO help Select this option to enable the AMD Heterogeneous Core Hardware Feedbac= k Interface. If selected, hardware provides runtime thread classification guidance to th= e operating system diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index 0263993b0a94..f212820a0e4a 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -121,6 +121,12 @@ static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_= cpuinfo) =3D {.class_index =3D =20 static DEFINE_MUTEX(hfi_cpuinfo_lock); =20 +static void amd_hfi_sched_itmt_work(struct work_struct *work) +{ + sched_set_itmt_support(); +} +static DECLARE_WORK(sched_amd_hfi_itmt_work, amd_hfi_sched_itmt_work); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -241,6 +247,8 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinf= o *hfi_cpuinfo, int cpu) WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], hfi_cpuinfo->amd_hfi_classes[i].perf); =20 + sched_set_itmt_core_prio(hfi_cpuinfo->ipcc_scores[0], cpu); + return 0; } =20 @@ -482,6 +490,7 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret < 0) goto out; =20 + schedule_work(&sched_amd_hfi_itmt_work); out: return ret < 0 ? ret : 0; } --=20 2.43.0