From patchwork Tue Aug 27 09:36:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779134 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2069.outbound.protection.outlook.com [40.107.212.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 CBC2819E7E7; Tue, 27 Aug 2024 09:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751447; cv=fail; b=WRdhsAew1riml3Uvf+tIg32O+UeLI+ySdXEc/ouXH6ZLkihE5osjNKnD1tjg10SVu+9FH74kLt0ml0XrHd5O6+SbWLzKLmrHbQkPMXvVE9qRtmd7ETsswykvQv5KK+NlhKfnxay+9Ki7d6qtdvePSWhc1GVWM57t9uSVoX3WLoQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751447; c=relaxed/simple; bh=f1HJrwMyY8NsIOBau7DUjfgfPFrRI5n1Z/QQpTxm1YU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AylfNte3DdvioURB33el8qnDaDGV8Oyr4Vax657eK/1AxzGleqT5Dyp8fWnwCNYP5HiW3Uj7w71a699RcaVTXIf7zAYrf9HF8jpem8dnI63wz7m5JdqM6U50rCslmqPW7l95cMhEFvuhejrsiiwf3scG8N7TeVifk94R2VQJCBk= 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=m1gD1VsM; arc=fail smtp.client-ip=40.107.212.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="m1gD1VsM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O6Jbxt7HRAzrvgwpU9Rnc9io1TXHyE+zoC4QkS23kQQwltmJ0B/1z4Boa2yVOxi1cMZ8cWVaR7WevzAIdExPyalvG5oVkO1RBw3Tx3wHC8QdPAAM6olgkAtFlacDSBS18VhKumnyIpOU9OZy6btQVepBMQtnH33OCfY9f690opq2ct19JPE+nhq28VUbFs1W00gsi42oxeluBKvwPlps9H3Oiiv4dHm6AHyW4hodpS8NNzfW0JW0BSoYDldeJKs7Eq4mnB3jnz8HPt4eDDD234+kN+F82b7hDp1YnagtZM/NATWRmqi6wGwXY7+yCDq5UbyGhVIWr/H5/VmQ0EPkbQ== 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=cfEcAdoq4PWvoAXcQ/AMfw63Fvi6El4jlWXjBlokGoA=; b=VZczT+Au5J1yWrsNLZlQ+iQJNUGGxGkOornBeLsqcRWuNvAZrU+pKaBWyCwYyOwWy4sePaY7qGjvQ7tLZgzL/4F/dfEOkAN6AbpdUDZr5wQy7x623bkyhs9FUwTkF4n4ywEDvF7ynjmAUvSN8pXoEPSYbZGLgfUOTuIbEhKX61Z9glJsPyc/fLxDOfh0WPJYiCWgtNCC0SLbgQ+AiaZ99+fm8AAKheDg4Sy7Ps19rkySnXNrybN0X9l9xTOm8sdQmKrjIjJNNRQ1PNKmYyt+vaRo4N0YQCuPP1XQfmmVG6BbP0OavvQwtGw0PvD/CI11hUIOUe/hTeHilIqriqNY7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=cfEcAdoq4PWvoAXcQ/AMfw63Fvi6El4jlWXjBlokGoA=; b=m1gD1VsMSLhh7BShYtXXohI/HYNcjkWklrUn8HrZZ5jcvkaI6+JLLXOKUd5pYKjkbQEH4u4kHt9OpKUkQZsJeL8JzjWIMbj9zPzcGovfg9D2IIoQE64vvRRI7CGo0WV+tmLZl/nlzqNEr5BfOXTLsSIYk478dpcCJY3bZ5qSd2o= Received: from BL1PR13CA0295.namprd13.prod.outlook.com (2603:10b6:208:2bc::30) by SJ2PR12MB8954.namprd12.prod.outlook.com (2603:10b6:a03:541::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:37:20 +0000 Received: from BL02EPF00021F68.namprd02.prod.outlook.com (2603:10b6:208:2bc:cafe::2f) by BL1PR13CA0295.outlook.office365.com (2603:10b6:208:2bc::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.14 via Frontend Transport; Tue, 27 Aug 2024 09:37:19 +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 BL02EPF00021F68.mail.protection.outlook.com (10.167.249.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:19 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:15 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 01/11] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Tue, 27 Aug 2024 17:36:49 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F68:EE_|SJ2PR12MB8954:EE_ X-MS-Office365-Filtering-Correlation-Id: 93360697-4a1d-4cfa-cdb1-08dcc67bd88e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: 4RzumS178sc32/z+sNoSJh8Exmc6cDiT8f03gnBVRf3nuyYjadFsmAcy4qSdKmQT6Qr9uQUCA+KHU2yo2Py/11kgyAXpzSYqpKdWSLK7J5tD5c9riOAyD4xTD2XXFr7HidGCy+bJx39P2ddTwXLeYFsyX5yFfKhFusPrlWctYON4vtwXW7sl+WjdjLxr7WUYrOJWCNZ8OGEiRkCaxRBPQcPAhaEwyqkOFksL4DGQwNjhGG5ZAncfOYXyRPT8KSLJkQwyBbcxcRRUcCMDiIGOjv9hHZzIQ6tFB3F5NGc5mkhBC3f4Z6/FH4ehF4kNKOgkwuNzSI/C5PT42wWCJJIWANrxMKkXjrEjPh3b1q0OA7r4/s1CAHDeYWC3cUxg9HbqxGkNS38kJeJn/mmw6aX7ZkM+jbAsaashiapHIDRuS3T8H83h3fjpZBaD0I4vCrGm3zPqLSFyAfhO1dBu6rEsXQhY9n4+9PgQBYVjnQbiy5xN0UIEJwXknelp52wI2FMeGlW/rxSdxIEXQXzabsLQAzRKaS9UkQ6j+o7aX8LhsTpS4qH8rtUd1iJ5+W5p9sxpxd57XSQn8PFpet0XJIZU7LoncOwJtqg4qA3c3In2uzGGtWErT/HHq+9tQthpS658e6CXkjRvmuo8baGsKbsFyhfKDsM7ZMgOMT3XSPXB6QGhJg4xseCeiRm++TgFOywxbBZ3xsufV0pzW9zUSlB6tsihRYCjrT+6lGV2nwjdX0jUqCxcwx1dB3faA5k7YKlX2gl1VqSm28cUBL2fr2yTgg4j4j/h/r9ngkQBRAAp3G1MNUHz5+yUcGXaYHaX9w8X36rMY6y6U3s0NWXY5FaqPDvJ3+imoKavdCm+OFhTMNf4uJcT6UILmuvPD6t0ZXDslpMTyIsowtgrRxKcXu+2AJ6tfaU9L9wJ0RdPu/ZZGBB9bXuEpf3axbnueEIrRtG+PY5rPk9M7Y1+9bGcQmk4+KxcYa2XtmJqxCKve4xZi9cwEPRKscrgmIVTKo7F7YL1FRIDNlhzqoYHSOSGrtfDNooj0tZgxP0/Cjkau9BzlRDwxMh8YWrGo41eHyzxo3Izps6z2EIHiG9JKxrWL99xTs2cV0YbLBGy2lS5U8Dqfga4Og6lB4iVuN6V4bbIwh8A+37wACRgLa1DpiMmxDKEZcMSR3kC4Ln4WuqXB+DXDsvhv7h6FLustrWrsEdr1k+m6QqAM4frbsh0sND/WZXH4dC4692whaOLegGtL2v4EeyZk6rUjmycBonVwsrtU4vuymAOKF8DvZKjO1nD8QqkK1sJCO12KLlr057YJB+RK1QqG4dqkAgx6XKA9U5CkLts8cYc5J7rQR194opBJYFZH8SrAW/QA6FSq6lbcAdItLi5KbH486TQoGvdPA0GcCIx/CcgKOenCuSRQj70AMxtmSnaS/3G9Z7LGUQjJzRKRU70yl2QlOYIS4CQIeScjckC 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)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:37:19.5032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93360697-4a1d-4cfa-cdb1-08dcc67bd88e 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: BL02EPF00021F68.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8954 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 --- 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/amd-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 + +====================================================================== +Hardware Feedback Interface For Hetero Core Scheduling On AMD Platform +====================================================================== + +: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 accommodate +the complexities introduced by incorporating different core types. +Heterogeneous systems can also extend to more than two architectural classes 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 direct +threads to the optimal core. + +``Classic cores`` are generally more performant and ``Dense cores`` are generally 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 to 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 demanding threads. +Furthermore, the area optimized nature of the dense cores allows for an increasing +number of physical cores. This improved core density will have positive multithreaded +performance impact. + +AMD Heterogeneous Core Driver +----------------------------- + +The ``amd_hfi`` driver delivers the operating system a performance and energy efficiency +capability data for each CPU in the system. The scheduler can use the ranking 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 describes +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 scheduling behaviors. +The below table depicts an example of thread classification and a preference where a given thread +should be scheduled based on its thread class. The real time thread classification is consumed +by the operating system and is used to inform the scheduler of where the thread should be placed. + +Thread Classification Example Table +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++----------+----------------+-------------------------------+---------------------+---------+ +| class ID | Classification | Preferred scheduling behavior | Preemption priority | 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 information +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 performance +are reported in separate capabilities in the shared memory based ranking table. + +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 more. + +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 modify +task placement decisions. For instance, if either the performance or energy +capabilities of a given logical processor becomes zero, it is an indication 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 classification ID. + This classification is communicated to the OS via logical processor scope 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 thread. +5. If due to the classification, ranking table, and processor availability, + the thread is not on its ideal processor, the OS will then consider scheduling + 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 such interrupt +and read new ranking table from shared memory which PCCT table has provided, then +``amd_hfi`` driver parse the new table to provide new consume data for scheduling decisions. + + diff --git a/Documentation/arch/x86/index.rst b/Documentation/arch/x86/index.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 From patchwork Tue Aug 27 09:36:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779135 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51C9519E7ED; Tue, 27 Aug 2024 09:37:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751447; cv=fail; b=QDtow729OCs1F8Q9z7BUjSu96hf0lzAfdXwlWjunleAqyx6oKEEhIgMLlWPXTApsKiQchRxV9k36wShI5wtfnUilgUYJ+zjCDa5hSsburYAt0UD/FsKCFXKgfW2aHT8TVQB3tw3kPpFrXtEC9X+8fwEEtrR5AjPDFvlaJT3HLeo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751447; c=relaxed/simple; bh=A2VBT/H8M5b+TvXnZtnXWfeFNqLZXOIkwyo8AOCLEqs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kBgmir8cR3rKFMCY5sgOGjGXj1qa2IkjywrGtYkY3w+pGJ2brvR+/eyMyQdz1WMhnYw3TRPHaw7Wr2dp4qo14gZr3cyIRuLIl6bGKXdIxJjhI+FwtBCU9hR82isYYDml7z0zMbsVbZ+DeilxOhTArO9znJ4wJ7q6PJLubItS/OM= 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=00pnEXng; arc=fail smtp.client-ip=40.107.93.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="00pnEXng" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ynBUYFE83kpgKEQ25490D7zEufiG2lALVnkwsBYFOhD5LoD16HFSa4+qySp0/Ratr/wp+Gv0c6b4TLAgNhYNb29JPV7bHfa82BSFA2BF9tTEG5Al1YWrgQ0yH4wKKGOJYXQz3eJ3V14IJ0/Ux7TcTHdxv4bO+AKFN82Vw+EJ7FAIUXuPMD4sZd/u5ejyQLBRML1zktkix0TMy843fIVgP/y9VLfMUl4uExNTIDZ2s3E6OKbNKHG0z57MtK5jeTeJYHSMZ+5ueqYINginjofeKcKhqCWNshdnvHN3KTI9gmA8LoCTOh1DiYzvQ1sKjeGIrHD7zIHvRFkxkPuA1txMOg== 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=LpjYKwQZMF9AegQHrTsnTxpSmNrhCwTnBHGDXrb4CSI=; b=P8d/Hp7IcmnNcEZvGr2IkVWnCcSCWDNyAP+WUH4UqLsT6yFGQinYaXwGdsL99g2XIrMOmwjJRHIeMmy02jtEFQy/o+8YyfTkKGgYFP9xVo/+6LMVmyK6ZzzxSsQVbkGFg7RmUJ54vtoFh/J1PPT455a7SRz7pB3LFQgRkLGgkyKFWHZPxcdCmvYrUF2ntAkau0qvKTfHTf5MF/2656t6qhKaVCANjPbWRyISFmFvZeWFSvvj2sZ+JPqa3hpeF+LgB+BHWJP98sUwdyrwMVizIxH/roIt7imJ7dW+TeV5AePPPUKm2t6SSywy4f95D935aIbkjdXeJqeXBoWXlABtyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=LpjYKwQZMF9AegQHrTsnTxpSmNrhCwTnBHGDXrb4CSI=; b=00pnEXngOQHAz1E/jHdwdLQQaDmW8gXnd2L5S1QWigSqJR9qg9tUmfPNl8NU8xFhpOMm0MVpqMGbdP9NamjYwqtj3k/aepYBABuPilqk+le94dZYKzUbB+tkTiePDglM+ws29jUCPLJs2RU10RoVuIjE7wD2AHy0cC7duvnTOyU= Received: from MN2PR01CA0063.prod.exchangelabs.com (2603:10b6:208:23f::32) by SA1PR12MB7270.namprd12.prod.outlook.com (2603:10b6:806:2b9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:37:22 +0000 Received: from BL02EPF00021F6B.namprd02.prod.outlook.com (2603:10b6:208:23f:cafe::fd) by MN2PR01CA0063.outlook.office365.com (2603:10b6:208:23f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25 via Frontend Transport; Tue, 27 Aug 2024 09:37:22 +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 BL02EPF00021F6B.mail.protection.outlook.com (10.167.249.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:22 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:18 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 02/11] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Tue, 27 Aug 2024 17:36:50 +0800 Message-ID: <834ba08575d9c183f38927c9b46105d38170a25e.1724748733.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6B:EE_|SA1PR12MB7270:EE_ X-MS-Office365-Filtering-Correlation-Id: e40bbfd2-4446-4e38-b5ae-08dcc67bda3d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: 4qXtwiq09HwfLO4neFsqeFNj5NnR3PWP3QN2ZRGaHiCcuiYtmYIe0mO/ufIRoTbYDHll83+Kb4vvRCzq5a3tXtkrNP+hbPN4Ck9C9lrvps4HBGuqfY1n+tj09N2dd6yjytEcYixp1UqSGemNZ96PPVNK7iniKkVpaMNmgbVh1Ne3wdvGwWS0nyW7TJTDajSpc3Mw1OJ02ZO4wjL0RkSdik8VlTXFieMd9Neh6bYXI61CHlGlaJjEq7KR70wZ7pj8rUG8bYkIN9/9KqPbmhfDJPTLY1GoYMezKG+0ijmqe9t9whO6J8NzDdbhfT3dCCxjPeqwSYXdHtZDKLdr6A34SPegmO2DYnWs9sakLYMsqATkWRwkpguWpZ9YmrJCXElonBOQwJZFSSLWVmIed6pZewcYh1WUdUCc5mE17UcFhZB3AoeL8I5+PPJ+KnZ1qQpfMcNgV7Eo+Kj6H7DKi9ZoCBTPkfBH3KDKRRhZopW2JFnyWWN8h6q9yKj2BrIDlrmrFvI8CDorHajiEEKFLE718Hlwl+V/RJIcQKIfAKLJvutDMJIkxaBgHJFpn/cJFp00m3YeDznh4b0Oh6OZklDwG3Uluhw2kErpog/erGdUv6kdIadB9d1x7wWh2snNAJ43fnP3eLvm2P3+9nkOpplnsZFaoPgMOR8xVXnCu7qRtU0WH6wWw7TLs1JV38GddzHbbHC83Q9F8EmoP1siR6Mud9LCNZxREk1rZ4/Mxq4Q95NtE2aLx8P2uQTTb+jq2vU+A2MvgR1GbRIEZod0twSGAz1KnNC+FpnJeAqaWhB+ziisdxE2HMN2aTetUuVNVQlMWop11RHeUj75fJbfrEtdet9ORlFdv/T1iUrWD2oz321dugiRIAuqkf1K9vsqIgq541ji3vanRJ/yakQBQ1vQ/AcbklWXEr6gKHWG2vzPpB1iLYmFOlzyNKRgCvE3eIYtzr3kBNLacZ7LMn8gXbcdRHJNSOAdQtonASD0pv6cw6nH91rB/dAKCoTje3z3q+Va7nGDwQsWlCeGGRBtBxkw9a9C1UrU5sAXJ54K5W1Xon9kCpapkSjx8DoL2xPMRMNGCFzT5R/ENeNLb3JmRy/VBS2ElbEpIdPeQlIbp/bsevR2LkAMhgbtnW6ui6Lcau4Y9t2RBuccM1tD3nE3rMarnYZUHaqRltX4Zq7bvRRYLiQBdBwfFjITtEGdIy0ic8AneD95JA4x0mgXfwMYfZWc+cXCU5WcbVNNKYt98ruS3vlyN6YVRGHnByzMaHy0g4TfzwgxhKsMr5vU5YbB90EW4+2bYJrAy0y9oTOL6drlto9d2ETalcm5Jv1AeIPSbsOmDWHA7qeDvSA6/36SHTBg0554P3EeAnyNph4O+FMDwUoaBWJSmWn8un+b/vQh8GMY 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)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:37:22.3272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e40bbfd2-4446-4e38-b5ae-08dcc67bda3d 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: BL02EPF00021F6B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7270 From: Perry Yuan 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, Perry and Mario will be responsible for the maintenance and review of patches related to this driver. Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 03090276a416..3ccc782095f9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1039,6 +1039,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 +AMD HETERO CORE HARDWARE FEEDBACK DRIVER +M: Perry Yuan +M: Mario Limonciello +L: platform-driver-x86@vger.kernel.org +S: Supported +B: https://gitlab.freedesktop.org/drm/amd/-/issues +F: drivers/platform/x86/amd/hfi/ +F: Documentation/arch/x86/amd-hfi.rst + AMD IOMMU (AMD-VI) M: Joerg Roedel R: Suravee Suthikulpanit From patchwork Tue Aug 27 09:36:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779136 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.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 3008B19EECA; Tue, 27 Aug 2024 09:37:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751452; cv=fail; b=hZDXeTZO0NUR7r9s4HPLDOXcpHy1d8dF/9R3t9UES3bOOR+/nQVWebGM9fn8nPHWO62FqklDzlGCr1dIaN69K6kkuWuERIiIm0xX+YsVSbl3YUlY59LVpBvxYUCsDLZJSot0vdEP4ceBEhIrX3DH3bgt2rjfFSRJ7I+S0cDIaBE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751452; c=relaxed/simple; bh=9xa1KtGC/ra5DPs3eD1RNctmHVU/lp0+dw/eYey8LM4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Hd4Ou/NUqJr6PV0kM3nZmt9Bzk/FM1lUomowWG4I6PgBFlEIcSz6v6m7/N/v9/hJRDM2r6msU5A7MULKpef4pgEamyNejP/m4f7jrGExIUYWjg56ZNA+0sB13Dktpk79xZR9I3X5RtMnWMrNtr1ef9Hz2ifECxhW0PPayNQelQ4= 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=sJRJ2cqV; arc=fail smtp.client-ip=40.107.94.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="sJRJ2cqV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ep7SvSB+YeM7bFr3t+udXqp1TIULLmSuFaPFXjko6itdDrPhh/OB0lNRGetsOeP8g6+Hay3PFW3ns6TvzRMsKIA0FtbAOiBBlpIdBRW5BDa+4Af6NLg7Um89bUd7y1NrxxSkV5wAvPx58n2DvQbLXMRetJ7KkvKsXs8bIXvkDdcQ9b5p2XT4j4CPgUsL0M5ibnrtdDp2qiiTvIdX52brKV+TRNkWWgxcadZhwk49M53AwKV+xAeazkVxsYXvkaBWGiOcWEhD5cPC/drdipoDbiH9+Af7rjJwvDBL8M22Mbb9jBZK0RQbcwkudWZ+e8P2jqzq0c/UP4g/gosEkg2EuQ== 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=jqWYsMHaomXleB3MF1h/jI5Ekt1U+yKMHKaZaV3QzCA=; b=UAP/tMxsPUAPz221CJqhXTgGWGHc/gYiFnSShhhabbXBJqSRyqJRP0T1Y6+Zc34BksJ/OVjCCHuKleKtY20KfyeXci1TvEVSo/UaGKAQBDRw6MVv9softtwLeOkzcrYpCJjMnrKT7e5jXCvk0ZOnfqq7l83tE04p+yqn9iWqUEPQHKVc9yjz2bhL+fS699zPe1Rzl+00ZR5aT/rcAzsmUFyl4Si2c/u0mp1GI9xYLvJcA5G58FWagOUBDl6viKkIENWUicRjdQfsp6c/Q+i3UAg2XX/7LmRGiEnwwtWeC0eGO1oV1yAS7DUEGjc92s5zu5A2+X2orzPjhLP2w3sf9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=jqWYsMHaomXleB3MF1h/jI5Ekt1U+yKMHKaZaV3QzCA=; b=sJRJ2cqVduzPus8GksvgR3ffaXznHY515/Lx6ikK4sDKb0JZEMhDMOZl57DmjAriFNYcc4PGbALXh1Yt4rLd+yA8w5MmmRLv6mupJNoxFqGazA/O0VX/i5Vahk04awg5rF5GnRRsPUGfxeMCjQBd1bgATB0MtFDkNaQI8WwmR4o= Received: from MN2PR01CA0054.prod.exchangelabs.com (2603:10b6:208:23f::23) by PH7PR12MB5733.namprd12.prod.outlook.com (2603:10b6:510:1e0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Tue, 27 Aug 2024 09:37:28 +0000 Received: from BL02EPF00021F6B.namprd02.prod.outlook.com (2603:10b6:208:23f:cafe::fd) by MN2PR01CA0054.outlook.office365.com (2603:10b6:208:23f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26 via Frontend Transport; Tue, 27 Aug 2024 09:37:28 +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 BL02EPF00021F6B.mail.protection.outlook.com (10.167.249.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:27 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:21 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 03/11] x86/cpufeatures: add X86_FEATURE_WORKLOAD_CLASS feature bit Date: Tue, 27 Aug 2024 17:36:51 +0800 Message-ID: <067b306ea3457091d5ac97b0cc5b41fcadac10d2.1724748733.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6B:EE_|PH7PR12MB5733:EE_ X-MS-Office365-Filtering-Correlation-Id: 60a538eb-660e-4b46-1ae7-08dcc67bdd8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: YZt2PtcW79yfu92jZpLxWXGKFYWorWUWVLo3/rQDkhUBUjv0KK2Ko458QfFTbAJC0ImJgUYCnVcmWIkg2UTodRUaNGXFkUtpMZ3SvtKdbXlYKJXqhrBnBkTb6vOvfa9k+HgmBprkjCh/QHUXgdYTq0w6MdU0wueJNArLVEaMcotkjVD8MBWtuYysZxOmDVI+8ry9C1jnJ7CfzBuHMpIvXZupkQol9oOF2Ke0yZ1Dsw29f/vH7t1KhAVv4HuIg//qKd5+fflkFIx7EGXKJRTQlGp1n6hEeTFqPDdPVD9EP3sge7T8lGqplYEvOx36B0orolilDEAq/utbw59oWm9Ygm5S5UxGUtHkpFDAEpq5JtyqNF9JfbkE9S3fSQPK0t7gOow25Tu1WVJuieVWXHGRZP7O+Vwb8VBbxi9sX6KAm6hvDdJmclOGCqrhfmuL1Sj+8IIvdexSaE0MLR7Fyxc+Y5SMt9Z8qnMFYjOx4MfxzA52XuL4rCbL+UZUmjlsg2llrHREXWOy6f9uB0ZpiPPC7gK7wNRDJGqDlQvXFvm4wSc8yljkrURvZuF2lGYGpGasNowiV7oU4cSvfdN3JlvD5C3DWn/vWuhIsTJBWt8YhljaixzqasRKZt8C+im92hpSu1EOu+G8YVLbsr2n6HGxKN65isWjf6dL1YDfjRMWVU0DqkGBCYLprgrwHZ2N5JMjMvNXZEYFDMh4yLlR5MJYng3JU+HmtXlrnHHZZtco8K3IJyS/zdE9BJB2SqfbFRvPvtEOcr+ZvoqYIYBfp0nXHVTqJcLA0T9h5FsL9TXkxMjmNp03IMLqCiP2/jF8GanHdHTn65VrLMgzzM0YrQQT/rwTvTfmsXSZUA3sTjh5x3LHnk8FHwIkqmZusMkFpi+8qpszfQ2uTo5gB/5jqvVdfV2i7OuCa5/g1lS4FeD6FEao/hPETkGn3Birph5ojWu1k6hXwf5eeV+d2MpX6h3iqTfccvthdpeqagPzN7NMfXmINR/IW+hnnDoFPScltVTvgsnhgczIxpB2JYC3BAkCHfeIOAazD/NC440CyqoPJg00e5sCtUmjCFRrsOIR1Ex9us3jDy2UWYx0PgD+LvSLYy3fwE5ZjvC57B9XYeRUfK06SCz9C4hBo2RTIVQv/H+quw1rDDPt2TPrsVdKsY7xQBShT8BOgJHo5cV60eAvUXJos3Wfgmz4AqzZb/Rt0whgFeM7mvapUUrcBDvvgj9ykSsdyLjyrVAFsUVTAuzI8ZEPKPtEsWHEM2n+XOVFT3UYJVPpROTHmw9AoVctIoPvw89O/t1KHliDqzLjOOkvHW6VQtOd40Z666ycipeM1zRKiJQ+fNWkHLeCsGJ93c2N2OUjsEA2+pn879SEFyUrkRhhT7hvo2Id5HJrZKXFzg5dmVBn3fR3VGXv2AMkqmIrOoc2j39y+U3VK1OaeiQA33SAiSlTZbficrU2nUGMOtLm X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:37:27.8741 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60a538eb-660e-4b46-1ae7-08dcc67bdd8c 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: BL02EPF00021F6B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5733 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 --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 2975209594cc..10e97c29216d 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -473,6 +473,7 @@ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* "" Clear branch history at vmexit using SW loop */ #define X86_FEATURE_FAST_CPPC (21*32 + 5) /* "" AMD Fast CPPC */ #define X86_FEATURE_HETERO_CORE_TOPOLOGY (21*32+ 6) /* "" Heterogeneous Core Topology */ +#define X86_FEATURE_WORKLOAD_CLASS (21*32+ 7) /* Workload Classification */ /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.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[] = { { 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 }, From patchwork Tue Aug 27 09:36:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779137 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2085.outbound.protection.outlook.com [40.107.93.85]) (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 1A0F719F499; Tue, 27 Aug 2024 09:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751457; cv=fail; b=fCyHLZAU22VAvNdEoZssuB1ih05uV34bRZKgAturWlOCRhMdlpQSaxpRwGBsFgEdNH5NAroKaovkjlFqcHiP8HLHPrUYVwUnR76AXTPUer9NExajSUc5OidhCZmYkuFKRxuzMG/gy0ZxTEd0BV50YsVxeiX70vDF8A5N+hnJGGU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751457; c=relaxed/simple; bh=4ZBpuDPMhi1NdNtbM04s1OFlEZS4RjWPGLVrKIG4d9k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c+KjE92uvKgQwVLdVhWDFV1eCdQtXqo+lwoARGyc1DFyJSURb/eQZVT0dMU2b6N4sN6iFhjLmNS580OaQPndu6btgolnnDIOB6RdNtohp6KiFqYlk9x5aqsha5S9klGpJKvfNvWuqdYP2hdmuNgrhQSshev8D1mCM6zo2k3B8fM= 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=dzGUH1Wu; arc=fail smtp.client-ip=40.107.93.85 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="dzGUH1Wu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cM1O7DIAf2US3VyQuGfdpdRFf9hbUJPhYDm54mMS7PdeetKXelO24a7XDNypjvCWupoMP0aYfaxozP8B2/eacoLNybBo+DGya3gpbRn7+rDTIRFrbDrKh5hrBPeKjETUqMMvqFhR6xVg29vWpo/s50ha1uRu1r1SslW6k1GCTuXoDR/IbfAI3S6oSmUL9LwywxH6s2p5GNXkZy3qsjN2UwFriwSMePfigMv2XVVp3Jqy7uC2IUM1OMU1bTmlmL2YG0y1+PSo93p0HJWwtpwx6X5q91rIl2M590X8CXq49zDJ8wfnQ6lIKdUui/UelQfd9STJx3wsMnFFzi+cSI5Mzg== 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=vf+mEQFECxmiTxpFNGfZy5gdIT7SPH6AUWoKmSIzgfE=; b=q27TRuo3f+iFthiuCYQOwofaSsJlAMQ53VsgQ40qIhL26ddvHgAFJmYI0WNJ/0lyjKMsEzK9kLc7QKHHgAEyji67g+dsmxt+D7SGfGLyxX3b1WsZu01HbQofT80p6AvgoIcaGzvzv1MafTSOgyIkEl4ffLJEy1Oy9rNKbpmq0f3y8Ca3+wQ65dHA2co7tZMoxoxooytkghdPbNok+StLRg4l4qVN6HKfugWzJZv361FXelndZuaM/PNsVGvuaQd766BaHuS1Po6001DWEXdiXQlpISkEFeZvP4dinOh4iNkeA18zOAwU+9bHfqD6f0TfpzGMt67lUKR15/SR2yut4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=vf+mEQFECxmiTxpFNGfZy5gdIT7SPH6AUWoKmSIzgfE=; b=dzGUH1WuXxYC02t+ef4JR8OxvXaR0l4z3Za04NHDsvSLFdnlE/qKDlZ4AgJm3+PLZuTykqwMzuDSPOzFDHwSheYndBIN9kGCGa13jG3c16HRB+AixgLQBm5DZafIgN8//+N4ANraOkBPIN2qCPJ4ptolCfuOiAnd++3o10DO068= Received: from MN2PR01CA0059.prod.exchangelabs.com (2603:10b6:208:23f::28) by SN7PR12MB7204.namprd12.prod.outlook.com (2603:10b6:806:2ab::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 09:37:30 +0000 Received: from BL02EPF00021F6B.namprd02.prod.outlook.com (2603:10b6:208:23f:cafe::49) by MN2PR01CA0059.outlook.office365.com (2603:10b6:208:23f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25 via Frontend Transport; Tue, 27 Aug 2024 09:37:30 +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 BL02EPF00021F6B.mail.protection.outlook.com (10.167.249.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:30 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:25 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 04/11] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Tue, 27 Aug 2024 17:36:52 +0800 Message-ID: <51965506b0b18dac7a64617838602bddac634cfd.1724748733.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6B:EE_|SN7PR12MB7204:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e3309fd-152a-40b8-bb39-08dcc67bdf10 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: eo5lfZDwwjGtiDJz/TPlSMIda9qlhBotANjBS1zyUT0bKckLIEZwiIwvfPA2FAaB30CVLBle/5mqo+udc4o16NQtujeL8HKDLvmk8P9CNwJPesXQ8cLcMAuLh9lLK9X5tC1P9Y/hpXd1ubGTFhOQQg4KhQlYCxBkxoDptxLfLXZLOLGQc7PJDMLiMUNO9/cg1iRaJi6Yzc+xhiWiWrjnPjfzgIfAefJKdDfyQZ1YhKMJqe6fsgQs9FymDNN4lX5P1su8y9UdgbaQ5AbsdPnKCligILTyTv1YjP1adfsjGK+WvC38JSs1PhGZ+wl62ZDGuYNPpRHTy/vQffxf1N+VFxW3D9Ogn64MFvCk5JSrnr+ZUPFK0orxuO4GHdyE5W6Xk0qH/5MZHjVbnREK4ncquusvYDe7tgPXex9yGLQGa8J+84/2rS5f+YsphAdtOECyAjV++Nq5WVLI+WX7RyHFPMBnrr9VQ1R5pzSQ81IbgjIOyin7MLRvuCOR8fiyYM60vwCozfN9AsKgeCezez0XbbiLCGdST94cYfefbRXYkJwC9UeyIzlm068Eu8zFhyV7STlLvD4I3hZqrv9pXZ0bcQ5/ngEG58ePeQh84MV0EQ9JIYTD2OJjcdQ/c095p6cM0yHt0BkH8z8Zfh5Cgpgl19ELkpXyBiYO2eiPwTagKfgOvpnmJ5ProVfnqLnUNItf+L4MBwo9qSj2vRcsWmr4NbdsrRJsqa552lN5sEffM44FO8jzy0n18A6qKL7eNTpSqAMfrrlyAQ48cO6ni72isVoZBFRmX2WEbreC6gXoj4VUmfuc+hz9QDzB4NboUMgYqaNI2WN38+DDBhNxCT8Tw7qUOQq/NtOPa/XJF5r9psmztvGNK7v2z9zw1lqIFvz2Gbv9AK6DHmghEd1lzvv1K4TUVCGeUaMYnX37fOzIYUvqymaMynvV9Vn+Kb0fz6H/16HMckfXCDszW0D07WTqEyWtduefmOv43Q4e50w+vz4g+ln8Q6o0bxxOA8sBk7Tn9N8+z6bDB90oarul2thhcgxfWq0NVhb0tY5fjO1PQ5qDSfBHhFay+wnAKcTjbLmOMEEakQiU4mcvUKH80CWA4O6P32hv57CZrmCnyMxye17j18M1cU0xAD46VNUYjxLLL6KlPn7jEbb2k65cVVPYIk4vUD+ZjI990KHXLMc0VKFxvnlW4uMV6lbNvnApLI78yPI7rQ3Fte4tI9G9vZ3oPMNUxQ1f54HmerpT+aYpag+9oEoqtmNFcCjw4Ea1eK3suiZijgjc2F23McWBudkPd2z8sXH+ji4F6q+R0/KezF4qzrQVfPXm2x6p5oG6I1VndtmXqqmf+MbxexLrbj9FqM3qBQVfR2GqGL2eeQsCBdm3l6jnBdBQddczewxZ9AS5/a/wKOI5dk2Ej6ZAlMxC7ztapCsYKBiy2+hWJ88lmc4O7EzoM/23C0KMIixPx8N9 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: 27 Aug 2024 09:37:30.4523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e3309fd-152a-40b8-bb39-08dcc67bdf10 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: BL02EPF00021F6B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7204 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 --- 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-index.h index 384739d592af..141509ff9cf0 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -682,6 +682,11 @@ #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302 +/* 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 From patchwork Tue Aug 27 09:36:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779138 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2075.outbound.protection.outlook.com [40.107.212.75]) (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 B378E19FA7B; Tue, 27 Aug 2024 09:37:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751460; cv=fail; b=kxhVQfFqayZZRywPc29SahV2DE9eOX5vhdwKDv4M5aTL4JyRpYz5IMgZ4LRfQxMBTcSyU8fH9bJVDmW2XX/yJqNSlLjgnCjktReo47QEaxdZTPrw5jbhoV2MBqojEry9Cd3f2xIKEJwiGZlW+c2IjN7zZJe01v/OimfueHJN1BA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751460; c=relaxed/simple; bh=l4XkFxfSzKibQ1eBv+4yODaRrq+SrejBuE1mMyrEfnI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oGmMCmXEhwZpbDI6pPP+SRE0MEGrIWGh0V8VaA1F6NEA8lbFIfO8QSbNQNdJ5p9Ud75W+NEL712nJLn02Njo7zD0yh1s8wwyQodhEfKzOmMPbjgIp7xyLor3InVwR8OG423vCiNVElmzTGqG/LyF7ClfpVK1mRDl/Se1wO5x50I= 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=xJ9NX8Qw; arc=fail smtp.client-ip=40.107.212.75 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="xJ9NX8Qw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=esognMKxQAy3Xe3suxTALWRGBitoSRpOjgDqrk/9ndG/Zcq977OKxGp1y/mtLBlSJiUr0xzorZpPMloGenjKO9Zia0vmeJVz4abWU0jlS8Y8AbmxZrayUzlG/C/ffdG4JQLPRd8nlW6aFpTR+Po9rNKxX6qhqH0C5O0BEEtBbR10l9nycSMNbHLjoJX6qU/fNtmCl4F1KAW4KlNxBrGrmKhsU96UuWZLsq3Z/Wej8aWcfxY0ev9tOcdMdeWkqtURSZ3TqUP8a6kQWNPKYHA3RywzJU/NRUkoypisYynv1pk6wz4G6USy2t8DNVuEowYXVd8CdjEJLWMaK3Nq3CDGmQ== 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=ZVI/CiHxcPCx4S1knXybWUT9l2XPYzJS5B84mmHsk1c=; b=WTUH5nGOMm9yNznJSXBAXGRdskhMrlZQDSBLBBnSIklnre/t64TSraiUu38Y67l27Pxuei0eNoT5wTtVnKKA2AvB8tJ5fJLsw74YdbGcoKaT4ilIORQeDWVpIDNu/d+4oKH8kijXXSZ4M5rTmNC7boCLea8jXj2rw0RJUAvxUCGqNM4qfSPB+QqkTajWwaBO1aYNT2ZX3DvWkOJbDN+JvXJDQ/oN7SmbHAuuG6Pu/IcNDzdeFnzJoKfX/yW3NzPw7mem8HZ7+Q2cL3+6hsPs4R3iTtuc6T7tvJLTosOxncXM7CRoEdgTTfSN/dYs+dbg3FnpKDveIo2yUDp6eQ1Xrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=ZVI/CiHxcPCx4S1knXybWUT9l2XPYzJS5B84mmHsk1c=; b=xJ9NX8Qwzdbvewqmkajsa0g1DM0ocYmgmnktzrWeK0k+UoG6HHFHq2hei0sJIOv3jHKrsYU59JUiaD6Z/vprdes2KbqUdktqKJt/K+EPouJZ8ZnqvC2f9pAB5DAFbrT1jHAJHYHfytn8dER1enT94FWbJ4hD9UkTprfUnmFtR1c= Received: from BN9PR03CA0706.namprd03.prod.outlook.com (2603:10b6:408:ef::21) by SA1PR12MB8163.namprd12.prod.outlook.com (2603:10b6:806:332::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 09:37:33 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:408:ef:cafe::56) by BN9PR03CA0706.outlook.office365.com (2603:10b6:408:ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21 via Frontend Transport; Tue, 27 Aug 2024 09:37:32 +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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:32 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:28 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 05/11] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Tue, 27 Aug 2024 17:36:53 +0800 Message-ID: <8d3d75941a87839ab88dff20e89b73c0f5e6cb2a.1724748733.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|SA1PR12MB8163:EE_ X-MS-Office365-Filtering-Correlation-Id: 746349bb-03d8-4642-86b5-08dcc67be072 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: 0k14rxh9bp3pkjPek8Jh410MtZx9PFC4/t0C1dJQg9zBwVN/3IUrSuni4nkBYeDoRB2TXj5w0s1QiYAoqv+QUjJjavNPYnz4/ZkZNr3+mO8oApiaPHWyliJI2JxigET2Kz0S0/8qycX0dY6SS8g3A73TG0FkHBDvy+63OvLWsDFwBMG2q0wX2ni+y9y7f25wzpJw0CIC/DtLrYr7JEjOTngYkuz5Zdqh68dQ/Jkqodo+qYyk9XwHKgQ7UAl/8ytkift/zkP1ey2qb2uhhnx7T86fYg5/n7vPxly2hKO8aVD5XCxmy+3GVfJr1ikd7e7oqL5TWaCsU5bHjIBKMK6vKL3Tm33/lBGxKlnqsArNSh8njMTZlKDjBwBAQ35bVV7V407ff4/+0hHVLdHJrEz/WRk7J4ieBz4ttmMpXn1BtqxxJjMCYZNrnpaSvzAglwYjXP3YFfo8DWE+75+zLe4iKxAp88tlLZXTN86ZRuxymisB+vH+NtpaqMK0UxNw4P/XU2tSvoYJ9RiyFahxND6tBkcGV2HJSsc0MvUjwsDRedAemywGsD77O6t7gSAVg+y2wHVl49tQjl9xyfqzA2b7WfL49t0pm1pOWD7JSb1YLvGCSg3suobouZI5mZfNzShF1W2tYmhlCynWTgmKyKDuyy4HQxpqJwXNiCu/0MEkIie4C7t8llB2rqE9xeEwMg7LH1QsQCh1mrPi3kfZSQARC/evmCH8uRG3bIDPpfEeW0+YW5Cc8jLSWo7IX+HWiM9Nd7li8xwYCY+fe5RWNYgkh7nYkjwCMkWMQtwK+KRH5muHB1S/pbSiA82AOLLljo2pZFyFYf0oSq3+3PcPRSrybw6OLsypRNmZNBAZfdtsCsxC99NESYfd3MKUH7gWz9W/1OOoKWkXPMRFLIQJ6mkwCo9TL4dDi1lToFbMQvEohQLIpwFZHRwSN7WmMW2718zvWVB5Z7zw/Re/cGaPSizaepqN7/AYOYXmJua6e2W1Q74S0xVnCbJm4p45zwNX6q7roGX4sa3I20pWIvEsJDTJtt4aNoUeoZAsQxnkaPV/m0Fsf/YVf+4MIk28i5aZPvGGWhsO/16+O7i3/y+UKfQ5U75mmqUDspjxO3mDqFtZCiEESlH2DpQlObuhV4lOd8JRmKW4VmmCEIKMvB4mDprlKehoDI/jf2kpwJXGLdPLQWS6l+kBxRilDQFVf7LiC0i0vaWgtm0TtltVdnBXovqLWciJwR2IjHEYzLJNSwSxxTeVMLR02hQBKdj30JSIkiwrmchsg9x4aGO3fNNmg3A8x9HXv6D/RnjPqUvaAwoj5CZWlfANIi2xLAKlkVZIzA/JL0FTpHOzU/VyF94SWEzmqBn58a81ebZLly+d88MyactZ8PVUFen/hPcr7aON5TTUr2jAukVbt/Teh626JyqQQdXl8NpOuxERjawYs+ukhBGgJd69ykdJ+HZcsvvEjgyJ 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)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:37:32.7396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 746349bb-03d8-4642-86b5-08dcc67be072 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8163 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=206537 Signed-off-by: Perry Yuan --- drivers/platform/x86/amd/Kconfig | 1 + drivers/platform/x86/amd/Makefile | 1 + drivers/platform/x86/amd/hfi/Kconfig | 21 +++ drivers/platform/x86/amd/hfi/Makefile | 7 + drivers/platform/x86/amd/hfi/hfi.c | 209 ++++++++++++++++++++++++++ 5 files changed, 239 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/Kconfig index f88682d36447..c3f69dbe3037 100644 --- a/drivers/platform/x86/amd/Kconfig +++ b/drivers/platform/x86/amd/Kconfig @@ -5,6 +5,7 @@ source "drivers/platform/x86/amd/pmf/Kconfig" source "drivers/platform/x86/amd/pmc/Kconfig" +source "drivers/platform/x86/amd/hfi/Kconfig" config AMD_HSMP tristate "AMD HSMP Driver" diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/Makefile index dcec0a46f8af..2676fc81fee5 100644 --- a/drivers/platform/x86/amd/Makefile +++ b/drivers/platform/x86/amd/Makefile @@ -9,3 +9,4 @@ amd_hsmp-y := hsmp.o obj-$(CONFIG_AMD_HSMP) += amd_hsmp.o obj-$(CONFIG_AMD_PMF) += pmf/ obj-$(CONFIG_AMD_WBRF) += wbrf.o +obj-$(CONFIG_AMD_HFI) += hfi/ diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/amd/hfi/Kconfig new file mode 100644 index 000000000000..4671cc1037a0 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -0,0 +1,21 @@ +# 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 + select IPC_CLASSES + help + Select this option to enable the AMD Heterogeneous Core Hardware Feedback Interface. If + selected, hardware provides runtime thread classification guidance to the operating system + on the performance and energy efficiency capabilities of each heterogeneous 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 heterogeneous + CPUs' capabilities to userspace, allowing for more optimal task scheduling and + resource allocation, leveraging the diverse set of cores available. + + diff --git a/drivers/platform/x86/amd/hfi/Makefile b/drivers/platform/x86/amd/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) += amd_hfi.o +amd_hfi-objs := 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..914390682fef --- /dev/null +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -0,0 +1,209 @@ +// 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 +#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; + acpi_handle dhandle; +}; + +struct amd_hfi_classes { + u32 perf; + u32 eff; +} __packed; + +/** + * struct amd_hfi_cpuinfo - HFI workload class info per CPU + * @cpu: cpu index + * @cpus: cpu mask of cpus + * @class_index: workload class ID index + * @nr_classa: 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) = {.class_index = -1}; + +static int amd_hfi_alloc_class_data(struct platform_device *pdev) +{ + struct amd_hfi_cpuinfo *hfi_cpuinfo; + struct device *dev = &pdev->dev; + int idx; + int nr_class_id; + + nr_class_id = 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 = per_cpu_ptr(&amd_hfi_cpuinfo, idx); + hfi_cpuinfo->amd_hfi_classes = devm_kmalloc(dev, nr_class_id * + sizeof(struct amd_hfi_classes), GFP_KERNEL); + if (!hfi_cpuinfo->amd_hfi_classes) { + pr_err("failed to allocate memory\n"); + return -ENOMEM; + } + + hfi_cpuinfo->nr_class = nr_class_id; + } + + return 0; +} + +static void amd_hfi_remove(struct platform_device *pdev) +{ + struct amd_hfi_data *dev = platform_get_drvdata(pdev); + + mutex_destroy(&dev->lock); +} + +static const struct acpi_device_id amd_hfi_platform_match[] = { + { "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; + const struct acpi_device_id *id; + struct acpi_device *acpi_dev; + acpi_handle dhandle; + int ret; + + id = acpi_match_device(amd_hfi_platform_match, &pdev->dev); + if (!id) + return -ENODEV; + + amd_hfi_data = devm_kzalloc(&pdev->dev, + sizeof(*amd_hfi_data), GFP_KERNEL); + if (!amd_hfi_data) + return -ENOMEM; + + amd_hfi_data->dev = &pdev->dev; + dhandle = ACPI_HANDLE(&pdev->dev); + if (!dhandle) { + dev_err(&pdev->dev, "dhandle is null\n"); + return -ENODEV; + } + + acpi_dev = acpi_fetch_acpi_dev(dhandle); + if (!acpi_dev) + return -ENODEV; + + amd_hfi_data->dhandle = dhandle; + mutex_init(&amd_hfi_data->lock); + platform_set_drvdata(pdev, amd_hfi_data); + + /* alloc data array for hardware feedback class data */ + ret = amd_hfi_alloc_class_data(pdev); + if (ret) + return -ENOMEM; + + return 0; +} + +static struct platform_driver amd_hfi_driver = { + .driver = { + .name = AMD_HFI_DRIVER, + .owner = THIS_MODULE, + .acpi_match_table = ACPI_PTR(amd_hfi_platform_match), + }, + .probe = amd_hfi_probe, + .remove_new = amd_hfi_remove, +}; + +static int amd_platform_hfi_init(void) +{ + struct platform_device *pdev; + int ret; + + pdev = platform_device_register_simple(AMD_HFI_DRIVER, -1, NULL, 0); + if (IS_ERR(pdev)) { + pr_err("unable to register hfi platform device\n"); + return PTR_ERR(pdev); + } + + ret = platform_driver_register(&amd_hfi_driver); + if (ret) { + pr_err("Failed to register hfi driver\n"); + } + + return ret; +} + +static int __init amd_hfi_init(void) +{ + int ret; + + if (acpi_disabled) + return -ENODEV; + + if (!boot_cpu_has(X86_FEATURE_HETERO_CORE_TOPOLOGY)) { + pr_debug("amd Hetero Core feature reporting not supported!\n"); + return -ENODEV; + } + + if (!boot_cpu_has(X86_FEATURE_WORKLOAD_CLASS)) { + pr_debug("workload class reporting not supported!\n"); + return -ENODEV; + } + + /* platform PCC Subspace Type 4 driver init */ + ret = amd_platform_hfi_init(); + if (ret) + return ret; + + return 0; +} + +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"); From patchwork Tue Aug 27 09:36:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779139 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2043.outbound.protection.outlook.com [40.107.102.43]) (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 EB10B19EECA; Tue, 27 Aug 2024 09:37:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751463; cv=fail; b=HNoESKaklekKmILZ38pSH4R4lxEUjfqAv1+1koMYmm+jTlfhxBfp5wA6PV8Hd2MPjpxjZ2XPA4pHzygDplmq4njcC9YMAZYKUAMxWzXvQfBfeihi/iAkf9VKlpon6hAIHVPcDe4qvRrTM0gsnsnaF0NNsUYt8FGtj++ut1Aru9c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751463; c=relaxed/simple; bh=ipYvIKCxu9XioSFZnnP6+kJoVgrms49ZtoKaqwYYJGg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lFAHe0RdP8N/IVl7p9Sd2H1LMkZjo8HF7GFMST1mGeP1fNXwrRxcPvDeXD8AHg2E7xqMGwe6WLKDMnBb3k7kFIa8FDxJAkQvMDNV594tEs9evTiXy9dD0Yh0sSwidEBOsRI8JJe/XD/9Ei3nZQVJK3dfB1aVQyWFDroLBebeJME= 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=w6ic+jAU; arc=fail smtp.client-ip=40.107.102.43 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="w6ic+jAU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h4V5njOnX38LHpl20o6rStdhKltO9lJGTwhr6UFXi5cxTQcLEqBQGCtYHaxz4sYXSeJF05FwcvDIpv50eVMTerek+KpMjdMiFDdI52brNsv77c/iYc8BoA75TUwB5hNSyaB3ARe/B/19WKD+vq/YzYHnxPbkwk9KQ9ah7AcfYAaftxpwxN1ifbDkpmLAUdtGR/fFC4H3S+f5QL2arU8qGDmUdMX7lQfuRz6chCqSrRzviRYugsijSsFBpBWfy4+P2LIR9N297/tc0CqIXM6OywQ3DVElhyxVAwXAWC9H/OVbi7AwaRYP6wc+qly0dlQY2N9/QrVu+n0twb4eHtqxfw== 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=Z+p3fHCP0MXfnBnECaOFF5wBQ75lBrF/UmJQZGbcPsA=; b=l9wL6wuYh4eb6lFQIFS4gcwxODgxC6zPU9UMadwIurLOT7IdWwKkzG4lD0MXT5qVPUgsmG+1R8Il2+aZhshhKdaTM0tt7Jij8uH/BS1NVNy+uuVbj362ADKIRv1mkMTcyxY/XfgBrBy7D2Tz/zrlbvXm5nEQSav99r3emCH/auFei31kwDeRWyQ96s0xDEcHZqU18xpqStp/QAucpY/BEbqa+GbE0uprIrfaKQod3PLsuMf1X5XT7aWTaU3sHnnvGlmYlakfWBkAgGa3LDudO7DBOKQtURyx5txG+X6rLoXR9pDAS9vCSN13oAW8li7Prd3LNJR0DLau33I+Qk+HqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=Z+p3fHCP0MXfnBnECaOFF5wBQ75lBrF/UmJQZGbcPsA=; b=w6ic+jAUUssjHo2fkPlNb7OK1X8O3P2b9a2vetTxHdiNBqakO+ktSEOlQuCrcdsOb2+2WtnLP041AjKVWaZahRB8/LGsXwGOrwp6Cpvj0+xCQSDUMpAP2PMFASwPCgNTPMeOkyjK59iDGWdo3qVtu7LJsiXqV9af6Hi7CP8jhfs= Received: from BN9PR03CA0582.namprd03.prod.outlook.com (2603:10b6:408:10d::17) by MW4PR12MB6951.namprd12.prod.outlook.com (2603:10b6:303:209::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 09:37:36 +0000 Received: from BL02EPF00021F6C.namprd02.prod.outlook.com (2603:10b6:408:10d:cafe::59) by BN9PR03CA0582.outlook.office365.com (2603:10b6:408:10d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26 via Frontend Transport; Tue, 27 Aug 2024 09:37:36 +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 BL02EPF00021F6C.mail.protection.outlook.com (10.167.249.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:36 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:32 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 06/11] platform/x86/: hfi: parse CPU core ranking data from shared memory Date: Tue, 27 Aug 2024 17:36:54 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6C:EE_|MW4PR12MB6951:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a3b406b-d783-4cd8-25eb-08dcc67be2a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: a7aWpST2vx6CZKEn1EwemhYiI1K7STtoUf6Kgwtbek9JvjiommRzBgEjqko6HpvNd9jsj4NSqUca3iWfZAmVFvOldENckZk1gv1oDNSib0vR/9okU0cARDrMXbZBMlhHdHn546h/IuFbcikh2/AH7Cw7LQYjLbWZ7gxNS6iWN4GGLhKKB9Qm8pgn0kMO9oH8ogjwjA6U7+fwXZmVLtHkkJOX+OyT6wbL8psM+k1UXeg5qjC3Ygyof+mLxO3zttFEM0Up0VYL5BL7wDzHcAvaieaNlm9L3uKJjb0b0C/HtJjo1IjCwuiUMk8rTogcLrf9iYu4UXjfKNKf/ZyaJRlInKdvs0Z3jN/PtzIM5St60xS0GVP2S1EufZzzh15WguWD1S+1J5euoD6NMG1m0DDipYVkYy3Gz0Ni6MKEUrdO4RLZTpbkMo6rdqtnnv4CGHwUCwBAWgrGyPBZK6TafbDsJNFdbZC/8AzfewPSc0KILHT7kr4uag7j/YKyYO0ZpEwLPvU9ej1InoqF2fSNM2EvBE49OZZlBfEFO2yb91dvEj77KBWZVwIXmnL+87idFPliQ00iUJ6zrHzbd4JSsMqZhIGLxxlBiUq4BRBA5j0E82M7zN2v6TgMip/AqmM5SGEVXjeICdgstxv+UO86Vv8uRNxjKYVqCTb1sdolAT7iPLLzUiI97PLkMHdZ+XLRQAuEQ+UOU+hTJwatSsFv1WaJCUrdp5d1aEOe4rcWDw3jbgQn/eP+nvndoxU5sii3qAySckLepPsqnuA+drW0n1L/bMkfupXsC0HbuBXOD6jGjIXB8ESqo4UWLDKQkazJjU7I99tQfQ0bw9N81BoqnuOR2zxkmtvOWK67I1YZaZswksAXKjDT5iGhDusnt3Y2DySaa52qb/8T66Zui2+puie3Vj1NJP9fr7NeIFnkovC2OV8inbpwthmEQHzi5g49hGNLwbwhmy0WqeFZ8bxvpHjnjSdKPYoQLV0Egw/322XS7gjwQPyMINfcqkzbkaYtkbGHumGd+p6NH/RULC7L4vpTn4wamOfadzeXWMDDm4Gsk700YM5k0T1VauB/6m055uQg7++ozuBnIBNFRL9aWojfOzkfLnFPPOix9LzM3Q1lJ0STsoSKdFdMcxt4/XH/DziWRJU//cCu2C3QtVIHqaPa5JhQ9Ny7YU6/GQAIV8dYgFSfyJOcByctRczkLxOzRFzTR379IxatkYEn1H1svANKcD7dxDFxl6fCJv1g/yq07Z3DGxbKm2npL3s9jOzmCfZj+8dUgytUVP444bj47oX4PKWcuiurydM0YNYSPi/EvdkcEBP698y61nviwP3JZuVD2XWJqAcBNUs4hpD+TkWYe7yVkb872vR8Jh+OPeKmPowCUcR33D6Ktu1xfwnqybGSjAn8mglzqSN9ShfmYNDavicLxnveHqePfUrQ97+i6AG9i38I3+5n5nVgGsSaH/yF 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)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:37:36.4112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a3b406b-d783-4cd8-25eb-08dcc67be2a5 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: BL02EPF00021F6C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6951 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 --- drivers/platform/x86/amd/hfi/hfi.c | 267 +++++++++++++++++++++++++++++ 1 file changed, 267 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 914390682fef..50f6ca9c148a 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -19,23 +19,108 @@ #include #include #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 +#define AMD_HETERO_RANKING_TABLE_VER 2 static struct platform_device *device; +/** + * struct amd_core_rank_table - HFI capabilities for the logical + * processors in the memory mappep table. + * + * @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: The 24bit spare + * @bitmap_of_apic_id0: Bit Map of enabled logical processors APIC ID for 31:0 + * @bitmap_of_apic_id1: Bit Map of enabled logical processors APIC ID for 64:32 + * @n_classes: Number of workload class + * @dynamic_rank_feature: Table update mode + * @diagnostics: Reserved space for diagnostics + * @timestamp: Timestamp for last table update + * @table_size: Table length of shared memory + * @shmem_info: The table data read from shared memory + * @bitmap_data: Bitmap data read from table + * @max_index: The max data array in the table + * + * A memory mapped table is used to express the capabilities of each logical + * processor for each thread classification. with dynamic table update feature + * supported, the table will be notified to update for all the cores while system + * running, each table update can reorder the cores for much better performance and + * power efficiency. + * + */ +struct amd_hfi_metadata { + u32 signature; + u32 flags:1; + u32 length; + u32 command; + u8 version_number; + u8 n_logical_processors; + u8 n_capabilities; + u8 table_update_context; + u8 n_bitmaps; + u32 reserved:24; + u32 bitmap_of_apic_id0; + u32 bitmap_of_apic_id1; + u8 n_classes; + bool dynamic_rank_feature; + int diagnostics; + u64 timestamp; + u64 table_size; + u32 shmem_info[64]; + u32 bitmap_data; + u32 max_index; +}; + struct amd_hfi_data { const char *name; struct device *dev; struct mutex lock; acpi_handle dhandle; + + /* PCCT table related*/ + int plat_irq; + struct pcc_mbox_chan *pcc_chan; + void __iomem *pcc_comm_addr; + struct completion done; + struct mbox_client cl; + raw_spinlock_t table_lock; + struct acpi_subtable_header *pcct_entry; + struct amd_hfi_metadata *hfi_meta; }; +/** + * struct amd_hfi_classes - HFI class capabilities per CPU + * @perf: Performance capability + * @eff: Power efficiency capability + * + * Capabilities of a logical processor in the rank table. These capabilities are + * unitless and specific to each HFI class. + */ struct amd_hfi_classes { u32 perf; u32 eff; @@ -61,6 +146,118 @@ struct amd_hfi_cpuinfo { static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.class_index = -1}; +static int find_cpu_index_by_apicid(unsigned int target_apicid) +{ + int cpu_index; + + for_each_possible_cpu(cpu_index) { + struct cpuinfo_x86 *info = &cpu_data(cpu_index); + + if (info->topo.apicid == 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 pcc_mbox_chan *pcc_chan = amd_hfi_data->pcc_chan; + struct acpi_subtable_header *pcct_entry = amd_hfi_data->pcct_entry; + struct acpi_pcct_ext_pcc_slave *pcct_ext = + (struct acpi_pcct_ext_pcc_slave *)pcct_entry; + struct amd_hfi_metadata *meta = amd_hfi_data->hfi_meta; + u32 header_index = 0, data_index = 0; + struct amd_hfi_cpuinfo *info; + u32 offset, offset_begin; + void __iomem *pcc_comm_addr; + int idx, ret, length; + u32 *shmem_info; + + length = pcct_ext->length; + if (length <= 0) { + pr_err("length is less than min table length required\n"); + return -EINVAL; + } + + shmem_info = devm_kmalloc_array(amd_hfi_data->dev, length, sizeof(u32), GFP_KERNEL); + if (!shmem_info) { + pr_err("failed to allocate memory %x\n", length); + return -ENOMEM; + } + + pcc_chan->shmem_base_addr = pcct_ext->base_address; + pcc_chan->shmem_size = pcct_ext->length; + + amd_hfi_data->plat_irq = pcct_ext->platform_interrupt; + if (amd_hfi_data->plat_irq < 0) { + pr_err("invalid irq allocated in pcct table\n"); + return -EINVAL; + } + + pcc_comm_addr = acpi_os_ioremap(pcc_chan->shmem_base_addr, pcc_chan->shmem_size); + if (!pcc_comm_addr) { + pr_err("failed to ioremap PCC common region mem\n"); + return -ENOMEM; + } + + raw_spin_lock(&amd_hfi_data->table_lock); + + memcpy_fromio(shmem_info, (u32 __iomem *)pcc_comm_addr, length); + + /* extended PCC subspace shared memory region */ + meta->signature = shmem_info[header_index]; + meta->flags = shmem_info[++header_index]; + meta->length = shmem_info[++header_index]; + meta->command = shmem_info[++header_index]; + idx = header_index + 1; + + /* shared memory region for cores ranking data */ + meta->version_number = shmem_info[idx] & 0xFF; + meta->n_logical_processors = (shmem_info[idx] >> 8) & 0xFF; + meta->n_capabilities = (shmem_info[idx] >> 16) & 0xFF; + meta->table_update_context = (shmem_info[idx] >> 24) & 0xFF; + meta->n_bitmaps = shmem_info[++idx] & 0xFF; + meta->n_classes = (shmem_info[idx] >> 8) & 0xFF; + meta->bitmap_data = shmem_info[++idx]; + meta->max_index = meta->n_bitmaps * 32; + + if (meta->version_number == AMD_HETERO_RANKING_TABLE_VER) + offset_begin = idx + 1; + + for (u32 bit_idx = 0; bit_idx < meta->max_index; bit_idx++) { + if (meta->bitmap_data & (1u << bit_idx)) { + int cpu_index = find_cpu_index_by_apicid(bit_idx); + if (cpu_index < 0) { + ret = -ENODEV; + goto err_map; + } + + info = per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + + offset = data_index * 6 + offset_begin; + for (int i = 0; i < meta->n_classes; i++) { + info->amd_hfi_classes[i].eff = shmem_info[offset + 2 * i]; + info->amd_hfi_classes[i].perf = shmem_info[offset + 2 * i + 1]; + } + } else { + continue; + } + data_index++; + } + raw_spin_unlock(&amd_hfi_data->table_lock); + iounmap(pcc_comm_addr); + + return 0; + +err_map: + raw_spin_unlock(&amd_hfi_data->table_lock); + return ret; +} + static int amd_hfi_alloc_class_data(struct platform_device *pdev) { struct amd_hfi_cpuinfo *hfi_cpuinfo; @@ -96,6 +293,56 @@ static void amd_hfi_remove(struct platform_device *pdev) mutex_destroy(&dev->lock); } +static int amd_hfi_metadata_parser(struct platform_device *pdev, + struct amd_hfi_data *amd_hfi_data) +{ + struct mbox_chan *pcc_mbox_channels; + struct pcc_mbox_chan *pcc_chan; + struct acpi_subtable_header *pcct_entry; + struct acpi_table_header *pcct_tbl; + struct device *dev = &pdev->dev; + acpi_status status; + int ret = 0, count = 1; + + status = acpi_get_table(ACPI_SIG_PCCT, 0, &pcct_tbl); + if (ACPI_FAILURE(status) || !pcct_tbl) { + pr_err("acpi_get_table failed!\n"); + return -ENODEV; + } + + pcc_mbox_channels = devm_kcalloc(dev, count, + sizeof(*pcc_mbox_channels), GFP_KERNEL); + if (!pcc_mbox_channels) { + ret = -ENOMEM; + goto exit_err; + } + + pcc_chan = devm_kcalloc(dev, count, sizeof(*pcc_chan), GFP_KERNEL); + if (!pcc_chan) { + ret = -ENOMEM; + goto exit_err; + } + + /* get pointer to the first PCC subspace entry */ + pcct_entry = (struct acpi_subtable_header *) ( + (unsigned long) pcct_tbl + sizeof(struct acpi_table_pcct)); + + pcc_chan->mchan = &pcc_mbox_channels[0]; + + amd_hfi_data->pcc_chan = pcc_chan; + amd_hfi_data->pcct_entry = pcct_entry; + + /* parse the shared memory info from the pcct table */ + ret = amd_hfi_fill_metadata(amd_hfi_data); + if (ret) { + pr_err("failed to parse core ranking table\n"); + ret = -ENODATA; + } + +exit_err: + acpi_put_table(pcct_tbl); + return ret; +} static const struct acpi_device_id amd_hfi_platform_match[] = { { "AMDI0104", 0}, @@ -120,6 +367,10 @@ static int amd_hfi_probe(struct platform_device *pdev) if (!amd_hfi_data) return -ENOMEM; + amd_hfi_data->hfi_meta = devm_kzalloc(&pdev->dev, + sizeof(*amd_hfi_data->hfi_meta), GFP_KERNEL); + if (!amd_hfi_data->hfi_meta) + return -ENOMEM; amd_hfi_data->dev = &pdev->dev; dhandle = ACPI_HANDLE(&pdev->dev); if (!dhandle) { @@ -132,7 +383,10 @@ static int amd_hfi_probe(struct platform_device *pdev) return -ENODEV; amd_hfi_data->dhandle = dhandle; + + raw_spin_lock_init(&amd_hfi_data->table_lock); mutex_init(&amd_hfi_data->lock); + platform_set_drvdata(pdev, amd_hfi_data); /* alloc data array for hardware feedback class data */ @@ -140,7 +394,20 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return -ENOMEM; + ret = amd_hfi_metadata_parser(pdev, amd_hfi_data); + if (ret) { + dev_err(&pdev->dev, "failed to parse PCCT table data with %d.\n", ret); + goto err_exit; + } + + amd_hfi_data->hfi_meta->dynamic_rank_feature = + cpuid_ebx(AMD_HETERO_CPUID_27) & 0xF; + dev_dbg(&pdev->dev, "%s driver registered.\n", pdev->name); + return 0; + +err_exit: + return ret; } static struct platform_driver amd_hfi_driver = { From patchwork Tue Aug 27 09:36:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779140 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2089.outbound.protection.outlook.com [40.107.92.89]) (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 D93771A00F1; Tue, 27 Aug 2024 09:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751467; cv=fail; b=rNwfdU52HkuU17IGwMALJDboJlcUiSYJSdwgacYJqVToMfVUvSDRDX3UrAu8R8OxXuTLoeqkyPHHrXL1BMI74IHsK2+HE4Rpfs2QInpdkU5Z+yKnrcXYxePWhGLAgqbR37V6rhqPw26bRoj2x94ihsoTxhZ3qo29tioMjpxAz4Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751467; c=relaxed/simple; bh=tjZdoEbkgkvjvvwuPJz9cI5nCjgOaV+rqFQ2Svo4VRk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gllqhsLgcuxuad6KaR0pxiv3K9CJf1Seoq+B5NF5C5Ib2hzUDcTCbu/v+ab1AzrzVeKqYX1kbpqi/upkuRNo5dXxx10EgmIOG/4DzKbU41A2Ht8r/aZsNS9JTV8J1mp1t4a9VYYMuYfO3iNzFcq37UcIX3oV2TwRPlSYnzb+lZE= 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=1hc7BAFZ; arc=fail smtp.client-ip=40.107.92.89 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="1hc7BAFZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Qpg2rDF3vMNT1xN54J8gbhVffIWQ4wcV+bj2afU8jlyFIry/6YiwVEbU93FMxd1QKR+Un+Yed1ii3jC53A/B3ywKRuEx+jXXLodd/yRy1RjjuubTZxHxbsCVFTogdg6mcK4V70NbNDMWMuHUWijod8SkrWP8pEn+KbdMNuxPd4DLFT5Xaf4BZftCpXsWrGsECmSKfsN37wqthPCJ/aMT5MTM1s2G2NWioNwqtD2mV1T6Z04Z99NjVB3UdU2kKxcvc3t/A0VASK09qzsTIGOs6yaHtII6U47R+344BD3IYuoXUJV2Jh7NLL+baXTPItFcaqqARZwkK4/S65Z0weHiYQ== 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=iAfxdSezZ6RxOswLrCWx3fgy7dQPo+gg41ZJ+Adth+I=; b=Iv2HT1MlOLQHXD2ZbxAACz8Szsv50TzLV4n1WQYnqo5PnalefTA5hxLr/jNVKxQLJav2gQK11oPg/1kfHp7zH2kF4ycjUv+29EfiYRpA/zSlUPzgfReEw7Du2Fys4fIEAr5B33YGATITn+5zM9iqrFIJajH1A5FZH4QBfi3v1RMN0GLtTqLU5ixEnPM3rm127v+Nw06DKDUYBqSEG6WzwyvF/xsJCAIkFWoOHKFw/CtgrxrJaQalraQ8vMhLF3Cq3Rgar4F66sPt2k97ymNYnpHIVm9boiCcczNHnQK5FdGzq9Vvwzr6QPlyTdbS0D8RKuQnboKbQ48hAayzHLqhyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=iAfxdSezZ6RxOswLrCWx3fgy7dQPo+gg41ZJ+Adth+I=; b=1hc7BAFZA7hDgYJPeeuVpgGAPSuARMuBs3tqzQovrmYfjwamo+NlnEC1cFQrBe8W9LBB+xOLIPSnhb2NyxZQnMxhYYVC1TapjhkMt0E5ksRtHW6Wq8a57qoA2o67Y4cUCM937eg/DTNAv9Eozd1NPkwfj0XPmffYC82gypmQ7qU= Received: from BN1PR13CA0016.namprd13.prod.outlook.com (2603:10b6:408:e2::21) by CYXPR12MB9425.namprd12.prod.outlook.com (2603:10b6:930:dc::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 09:37:40 +0000 Received: from BL02EPF00021F6E.namprd02.prod.outlook.com (2603:10b6:408:e2:cafe::fe) by BN1PR13CA0016.outlook.office365.com (2603:10b6:408:e2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.14 via Frontend Transport; Tue, 27 Aug 2024 09:37:39 +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 BL02EPF00021F6E.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:39 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:36 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 07/11] platform/x86/: hfi: init per-cpu scores for each class Date: Tue, 27 Aug 2024 17:36:55 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6E:EE_|CYXPR12MB9425:EE_ X-MS-Office365-Filtering-Correlation-Id: 7522b919-138c-45a4-f318-08dcc67be47b 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: zc/6jZHggEKKeln/BqxlTh+XfeJveIGD96Q5NnrFMgO6c/nVXbMSmZ77Z4pRgLyOGrH4ayxoQQO2uLVH11dL1D4ruCU/cuuIPPJRi+uEdbT305KAFvZkTfayf4Y+6rJhtF/IDNJD8ygrkgju+IkoqJPb51hMHVpydxC+p7/E8BPLmXEaNrUaqUG3x0IEGrrCCGwYHEoFXmcQh8DFdz3HeZLjbUE8/AtyQh3xkDfGfUPgfLn66jhv++aqLAS3a+ltrecRmW5uxsq4ZyJ3MOBtkd8limx2drN2srvnzwyjRmX6zdXKR1CVsPYaCq6HN16cDVH/nMNayKqm25irPpRKlMZVWwF+umZ9DBkCc2UYyMXiNiG+iND8+FS1qP9ceha2O1Hdtel8dKstFTJOHvcyr/DCVOTgeZ08IL/4DQdiRJpqTWV1F7HTutrijiLqhzkEEVkpIlEpB2FgInxGDWxW20FI9zzVtmvHFqXmRi01QRCKBjL96yMOimhcm1z7Nt7g+wCcVLhY3PJ5fNR1mZtEZ17DQBh7GtRFepyXVaDV54C6lD70JaUuEo7QgW/SAFE25fSd0sXymXJ4cL7YWnsVHbgq9AQlqrta8MjA/9KqEltyfFr0SwNUOpD5JOA2VgBhfZ/4IJuh1srMcbA0p3d6U7n7GFZHvjfAQMY7CsVZ1ikDwj5tqGLRDG+YhwszbLsPUd7j4qlipxvS8VJ/kDrUSz/zMFwWjNDvBIu29lX80jAXbvLP77B6R96P47pUCvSfhFj6/f071Bsxdf9u/XUoWyDCyHt2XgNgDvAMzHJnNVq+7+uNjcnTLCxe7KgftMvCNTAwHd6eLdRksudJB/Q/d+otF6xEpWDVVHfO8q/zrYFu1nxcxDPFEqtaO16clvacOfxGrVMssVfedeWGKiw83qkrLweVFQqNx928//dlj05l6Wp1jtrLbJvbSO1HcCfO1WolwLE8Kzr83zvz7tQtcvMVQe8bkcK/VoBhWlYoY2kibC5YOodkdj92NUzSODf89K+RFppqAIXTd7OpKRoabA+h99lDMq2XA6Ynuzv4wpMsGutH6O1XrBJjxuYQyRTmpWvpcSwX2pp4ofDmtMsay1XReqwsOtB5bxNr+R6dc+1V/K3SH4Z+PWdBNufimcj01fp4OafZojJUtnFupmBt32TfGDhrwtP9jtyiYnFHLOtUdQDc8Lp0BUlV3aHz0dzoK9xLSL9iagJPRLCQTj+k8kE/lhCzf5Bleyc8ST8HbCPSwkjDbgjK2EYJBG0N44TbkpAtPxcgN9ywhOlirYgofOJObZq0Rk7kB5fWNEFznPYQwSYx+T/b+vjYixoyRXb/PVi5dYj6BJeZzQQSvJXE5EhX1UZ8RijAPqF4tnAqeq9CuMUV91ZXs+kAFfA9SMA5FpH0yFaSmzpCOP2Njhqeb6e1cgXvm4vN68KKkB2eX3TQ6xNrM5Rq7Euyyv9jA2s1 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: 27 Aug 2024 09:37:39.4967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7522b919-138c-45a4-f318-08dcc67be47b 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: BL02EPF00021F6E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9425 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 --- drivers/platform/x86/amd/hfi/hfi.c | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 50f6ca9c148a..cd5f2b708ebf 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -111,6 +111,7 @@ struct amd_hfi_data { raw_spinlock_t table_lock; struct acpi_subtable_header *pcct_entry; struct amd_hfi_metadata *hfi_meta; + raw_spinlock_t hfi_data_lock; }; /** @@ -130,6 +131,7 @@ struct amd_hfi_classes { * struct amd_hfi_cpuinfo - HFI workload class info per CPU * @cpu: cpu index * @cpus: cpu mask of cpus + * @apic_id: apic id of the current cpu * @class_index: workload class ID index * @nr_classa: max number of workload class supported * @amd_hfi_classes: current cpu workload class ranking data @@ -139,6 +141,7 @@ struct amd_hfi_classes { struct amd_hfi_cpuinfo { int cpu; cpumask_var_t cpus; + u32 apic_id; s16 class_index; u8 nr_class; struct amd_hfi_classes *amd_hfi_classes; @@ -146,6 +149,12 @@ struct amd_hfi_cpuinfo { static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.class_index = -1}; +static DEFINE_MUTEX(hfi_cpuinfo_lock); +static int __percpu *amd_hfi_ipcc_scores; + +static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *info, int cpu); +static int update_hfi_ipcc_scores(struct amd_hfi_data *amd_hfi_data); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -293,6 +302,40 @@ static void amd_hfi_remove(struct platform_device *pdev) mutex_destroy(&dev->lock); } + +static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu) +{ + int i, *hfi_scores; + u8 nr_classes = hfi_cpuinfo->nr_class; + + hfi_scores = per_cpu_ptr(amd_hfi_ipcc_scores, cpu); + if (!hfi_scores) + return -ENODEV; + + for (i = 0; i < nr_classes; i++) + WRITE_ONCE(hfi_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; + + raw_spin_lock_irq(&amd_hfi_data->hfi_data_lock); + for_each_online_cpu(cpu) { + struct amd_hfi_cpuinfo *hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, cpu); + + ret = amd_set_hfi_ipcc_score(hfi_cpuinfo, cpu); + if (ret) + return ret; + } + raw_spin_unlock_irq(&amd_hfi_data->hfi_data_lock); + + return 0; +} + static int amd_hfi_metadata_parser(struct platform_device *pdev, struct amd_hfi_data *amd_hfi_data) { @@ -344,6 +387,19 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev, return ret; } +static int alloc_amd_hfi_ipcc_scores(struct amd_hfi_data *amd_hfi_data) +{ + struct amd_hfi_metadata *hfi_meta = amd_hfi_data->hfi_meta; + + amd_hfi_ipcc_scores = __alloc_percpu(sizeof(*amd_hfi_ipcc_scores) * + hfi_meta->n_classes, + sizeof(*amd_hfi_ipcc_scores)); + if (WARN_ON(!amd_hfi_ipcc_scores)) + return -ENOMEM; + + return 0; +} + static const struct acpi_device_id amd_hfi_platform_match[] = { { "AMDI0104", 0}, { } @@ -385,6 +441,7 @@ static int amd_hfi_probe(struct platform_device *pdev) amd_hfi_data->dhandle = dhandle; raw_spin_lock_init(&amd_hfi_data->table_lock); + raw_spin_lock_init(&amd_hfi_data->hfi_data_lock); mutex_init(&amd_hfi_data->lock); platform_set_drvdata(pdev, amd_hfi_data); @@ -402,6 +459,14 @@ static int amd_hfi_probe(struct platform_device *pdev) amd_hfi_data->hfi_meta->dynamic_rank_feature = cpuid_ebx(AMD_HETERO_CPUID_27) & 0xF; + + if (alloc_amd_hfi_ipcc_scores(amd_hfi_data)) + goto err_exit; + + ret = update_hfi_ipcc_scores(amd_hfi_data); + if (ret) + goto err_exit; + dev_dbg(&pdev->dev, "%s driver registered.\n", pdev->name); return 0; From patchwork Tue Aug 27 09:36:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779142 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2076.outbound.protection.outlook.com [40.107.243.76]) (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 64F291A00F1; Tue, 27 Aug 2024 09:37:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751474; cv=fail; b=mR1nhQ3XgYfUk1XSpUavGcVsPWdEYxg009pKxdvPrabEjoK953Kn5VfL+Qqavqs4re34N89M7VjOywSHBoOkloh9gG2m4+S0/2h0Lphxl905Sl4QsHgwAXb0vfDuiZj86T00Dnufs2h7V4Qxwc2q/dCyC2Sc/HcxmnNElqsoYMg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751474; c=relaxed/simple; bh=yiWYKT+tKaxyBJvm11LUMA9ysFzyGINsaYBksG5LMAY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V7dKy0GTXD7JqwZYCOS0N0vuIAV1m5aTDzMHqEpEXV39hU1QpHiXjMZ/vbQEGXcNwCZknjbP9HUeHFf8UnChQ3Tg12IkcaPXlXZ0xQTF3X0PuTn57lhBgk78SFCzwGnliLBUIWuF6UDp4MeMhgCq1MPMTP64O7qjmkt+saX1Eko= 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=YFjoaUjW; arc=fail smtp.client-ip=40.107.243.76 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="YFjoaUjW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wQgMuGrNhVc9trPRyxoy6OPGbt3L7O+87LVM2dcCsq1Mz/zPpcCihcRz73720B6FuZE19xuReujl/Bx6h/SgiOM+vv0O2L5H4gtrNMKbfbWion/kJ3STMH1m9Ju946P5Db6myitF6d1RCegoEYM7d9UIofP4WeqOJzTEResWOdmqxrqoq11+lwNCi2pfIphYPfnh0lvwYaNKDsKwSJ46ZmScuPzpaPZT8wHX9pzkusYFXcitcM8vmaNnH/5ExQPsHpYJIIKHyiJ9Ya4IcJQsSwhW8HCLCAiUu8ZL8C1f2mx5ZUWnQQB+EIrFwvyGzBGCjY8AKD7qS3xCK2H5jr5hWA== 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=IKkrhtSPgaxjFX1LicQ88aZRiiw/k8DNU9Y3ZOeru2M=; b=Ejw10URlSsLmUwthZavyKi1zenwmGTDEu7f0+Xtp9aYLGB0Tn9qKsAfUXlFnHr8W4bT3p47jLgbtA19wmWaRB1xhSl44PFH8sqtSYJdz0MUJ9AruUgaclmFg9BRSN1PfjPvKiLy6ueYLKQPKbPOhz0cJSGGe3SPmgFZ+CeXYRHObQoS3amk4eHRfW9Bgl9wm+DtisAs6+U9QWfmP0N8ue/8NsjAchNqbuJSzZaq4wRUFfvzSW6tFe4hDvgveB91jUGUx+o2PmRr0SuSuyqCVQv3j/NemQt9piKw/SaWA4iKxch7q72jFwO9E32yNJ0Rh0G9P7wHAudG6/b7trpPQLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=IKkrhtSPgaxjFX1LicQ88aZRiiw/k8DNU9Y3ZOeru2M=; b=YFjoaUjWO50acAkG2uE3XUBAGZyxWux/L+REKOp3kCAJTZIVcB4iObm6mcbFJBdruOOKUvjpWdW6gmLkmxlUm5OIM+CZjEblKjn7YoI30aSmhv17V8hzm74rQXNquWlZaZeqBVS2PmOVPTVd+1dohLdriXOSgG4OGCmK60Cc8T8= Received: from MN2PR06CA0023.namprd06.prod.outlook.com (2603:10b6:208:23d::28) by CH2PR12MB4168.namprd12.prod.outlook.com (2603:10b6:610:a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26; Tue, 27 Aug 2024 09:37:43 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::b3) by MN2PR06CA0023.outlook.office365.com (2603:10b6:208:23d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25 via Frontend Transport; Tue, 27 Aug 2024 09: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 BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:43 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:39 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 08/11] platform/x86/: hfi: add online and offline callback support Date: Tue, 27 Aug 2024 17:36:56 +0800 Message-ID: <2661e74beceb9198d0baefe1f145080ef2b812cb.1724748733.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|CH2PR12MB4168:EE_ X-MS-Office365-Filtering-Correlation-Id: c4043ecd-2710-4ff9-58cd-08dcc67be6bc 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: 1UFdV0//zmIMywcr05YExNcKvgH6fi0F7BKwVUM52soV42BUR7hRHCLZKIBuZnSqPL/DNFWmTLvpd5pY4HUdhEQ5TZiepDz1UpFDAZqOocu2XqQL+CoWlxSzZrRG38Y4KVBrR9Txy7LjWkN8CZ4t7hi+G98LogTd1mEEhKCq0gSOXgplwem+JZVM9jmkJYs5+6icsfwDyWtn7u52ZELuVs4YL6Uoytc8US06aQJBF3ngbIb5loVCJo031fsvrtpqD7fu6zU7Gr04oWkobJrBg7TgqjWFPSEBlEpFgKcNisd5bHPjpL0FEE0X8qvRYBXIyII2rEHsh4FIZOUFjldjPmgjS5/q4eJKGtCEJ3wBAOCoV0AzL/xvQ8tgCX75wENFUdnZMYbBjQx3ZfKCn9qAIUKARfiflKb4YfxABG6twfB+zBnZdBh1uQ44a0ZHZSa8PLxDmIEn7RTneEtCgCh1vIc/jmLcbNcJSysnE6oCJ8Pj795TGbVrgYAv7oG75X0bOUL5V4lBCZEYxWLQ1T+aUe+2Jqot9poMjaXIOwmOTXVsWIFF/xoLTR+l9dJ3FKSStpIN1uargVEJdQB/ljDsGEhISFi81B4uXLwTbhj2BhP0KAxhcXgDqDV380Wur4xoLe6lztYcipSX3zmdGU2ygfh0FzsMhe+w445eu6P9cu87WtnqZuLhcbrJcSmwsvj4bjTnFZiGo9hC/xw8glHnEaDFMn180TYpyXta3YExE2GXUs4A9zZjOvA7FPMLk+bdo8WrBW3RsRNCwmYm6CH2bcSdRmamS1Q4bBf6Xc9QqxqzaOzGXx7qSnCirtZBEg3lW49bFvbaUtDC/vWOUCDKOPlUFwWsPmaLBDw7g7E//+fYIuSJXFnL4Z/svK59MUYxl31z/fbyoOgZn3f3dDiHUO4kSDVjcxts/OPhRuVl3sSK4etBihxbqH5QRzfOL6vK9awLwbrQvbqUK70NvkG2+tnFcR9zjeIN/cV4x6P8SPqrWpEqbpPWRQPdg0flXpk8xQ6uzRdu2YTLxHTtooKac3/YDlP/7nPg85knacQP5wvmiBH3vAeUm+FKQ8jxAHCO96o8yN2umdxBWpfMcI6Sdu8zqlobuZGee7cw3rgK114JM1q0C/aMn8PcJVkvl/sv9I9A4fVzwNP8cFdqrq9KpTZUjkT7FKOQ1VDYIZoIDWIU22EvnQNeHb2oyrZGZ4uOtQBn+mTG9EQMcMDR80iJNIvNDLGNy9KfRzNNOtjKGFlUpSrCHhT/6YCiNFPjjq9gC3YURV1O8iAk3YTuaGxSZxBia6DQKehqMxxtO6vS6gJ+Ewx5g8slIplHW5HYkTYnlMz+ow52mDKE0VddIwpPTI9K09zZ+BmNJ9YqO9MmZZpIDrsyA6DFOVsOpgLnkPTYlOBRXAd9AI5gYC/DrNurWR/gBDnjxCKvt9C2itnuzNam8x7D3599TmUWkAoDkYEd 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: 27 Aug 2024 09:37:43.2898 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4043ecd-2710-4ff9-58cd-08dcc67be6bc 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: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4168 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 --- drivers/platform/x86/amd/hfi/hfi.c | 90 ++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index cd5f2b708ebf..57b642c4c522 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -154,6 +154,7 @@ static int __percpu *amd_hfi_ipcc_scores; static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *info, int cpu); static int update_hfi_ipcc_scores(struct amd_hfi_data *amd_hfi_data); +static int amd_hfi_set_state(unsigned int cpu, bool state); static int find_cpu_index_by_apicid(unsigned int target_apicid) { @@ -318,6 +319,87 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu) return 0; } +static int amd_hfi_set_state(unsigned int cpu, bool state) +{ + int ret; + + ret = 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 + * + */ +static int amd_hfi_online(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info = 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 filled + */ + hfi_classes = hfi_info->amd_hfi_classes; + if (!hfi_classes) + goto unlock; + + /* Enable the workload classification interface */ + ret = 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. + * + */ +static int amd_hfi_offline(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info = &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 = 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; @@ -467,6 +549,14 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) goto err_exit; + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/amd_hfi:online", + amd_hfi_online, + amd_hfi_offline); + if (ret < 0) { + pr_warn("failed to setup cpuhp state! (%d)\n", ret); + return ret; + } + dev_dbg(&pdev->dev, "%s driver registered.\n", pdev->name); return 0; From patchwork Tue Aug 27 09:36:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779141 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2062.outbound.protection.outlook.com [40.107.212.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 7BA041A01CB; Tue, 27 Aug 2024 09:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751473; cv=fail; b=fqQ4MHJ695BplhylqXSISYrQKsxIoaxhVfE9lql+AmrRGBtf90xLQPoyst5Ts8kG1FyIxVAxf5+vjhCwxbnjvRqkv1k9q5btPBXR+RiZ6plEuPT7V4oDvsod+Lcir8L1+yl38Yt2cK3S7XNUCCM/ffh260rwF+0fbPPbqiLuuDY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751473; c=relaxed/simple; bh=2jHRvGjuGu3DZogLSRf1OJ8xcMAR7Ad/RKjbUreoC7I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ll2srPNzkMkAJbeaXvKn+Wl40WnPx2xD1cQKjWAbkS4R7f7lvaBrU6kHyzHioB0w5xAa7FrvCjKoDJp036Ut7llsDcupTcvXx1bTvkvXRZM49T2F7tdI3U3NMutWKcYX5DuaNIzvubWzELq5SBqpSOIxYQFejA8vt61cH47WWMs= 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=0Z7l/B8j; arc=fail smtp.client-ip=40.107.212.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="0Z7l/B8j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sJ87utISM/AD5DYQ1jt49bNX7Ue+mKnw0TxLMaLvZST4iIh/NV/QN31wFeWXS5MdD67D+yKo6bqweg/E8d0v7L/u3/sO8tRjby6vkIsvRLjtwILDSxgifcAgguoRhUwgCCSy/S36brDghnn5zdI7PX37AHjLJ8CpiHG2/YcUh40oij3fLGThWvmzuu8wuBxibEsApMmxw0fRAXkqSlPCpN2Y3j0Fjmep7QEfo/DsdPw5xxPoGQjfFRxkHMwVU+opWdz5G9EqDkUYGCCzpNFpT7NaNH2ZaQ8pCZgy5XOh6/OvCaV1ds2f/DNgQ/mEoAdBoTpzvAzmQnbJsaJwMwj+hw== 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=i/u3Pgo8YnUd0eE+CksSIxbMlEX64xhjwrVr6BUtp9E=; b=skNQylf/BfU0uf+5/i6KarrN2CQbnRAtuumNgdd+z0RQ6RNIP3mmph4gij3Vzvb0PdBJ3Xrd27eXyDDjUVsE4K18JiXR5PczftV26+WqsV9IPVq+/c7Qe4TZ7VivOYWkf9o/lJ3dSoqohNPouLMdglVSdcFwYG6jq/mwRV5TCzmqd9OaX4F2iJA11S0smEiTIP9x/OvpGZshgtAJXMrHe/wBlSYA/KM9ONrOdRhd7NjhwrXqVcNfzjrGHUvnt4egmRviEu75jM6VP/NArqjH3wvVusV4hc9JbnuUok93TPdNT9j09pwSqzYg/njYPfLrxzqNRqkpyptUGFWh0Ib41Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=i/u3Pgo8YnUd0eE+CksSIxbMlEX64xhjwrVr6BUtp9E=; b=0Z7l/B8jmcSvhQHjTNQ6WYvyyb2xCH9zFLwnhBFOeAUxAaX9+o70I0AxbRd0npQoRgM76rLvH3hr7qMaJSFDmImE3+HMyWVxcqqNgxqaSlsWC1/xqay/YfX4LrOPOf1jRAaYVd/bm8nrPo8s8thNx65nVmMkau70RcQb/O9xTvQ= Received: from BL0PR02CA0009.namprd02.prod.outlook.com (2603:10b6:207:3c::22) by SA1PR12MB7128.namprd12.prod.outlook.com (2603:10b6:806:29c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 09:37:47 +0000 Received: from BL02EPF00021F6A.namprd02.prod.outlook.com (2603:10b6:207:3c:cafe::5b) by BL0PR02CA0009.outlook.office365.com (2603:10b6:207:3c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25 via Frontend Transport; Tue, 27 Aug 2024 09:37:46 +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 BL02EPF00021F6A.mail.protection.outlook.com (10.167.249.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:46 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:42 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 09/11] platform/x86/: hfi: add power management callback Date: Tue, 27 Aug 2024 17:36:57 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6A:EE_|SA1PR12MB7128:EE_ X-MS-Office365-Filtering-Correlation-Id: bd306d05-6ea8-4f9e-41ab-08dcc67be8c7 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: Y4mwMuRWibMxmMjfp6I/brZY4Bz8vpew+MCsxRl6uNmQ4bieG96f7xqaBONyEMtL76fj+R5fyqO0O5CPQHCR6vJ/n7+FbdUoGOy2eU+YYDBYZ1RUcpZd4mVlLSIvI7EfhCbuMKLAUAGGiaLPman7ZuuOvF3yaPLw7ZbwCqzo8G+D34vAEqvB9e0O4KD2FEChuE+Y9Ju8rc5mDrY0fGKwyLyPkjEBjYkvDcx+oXyKY8vl+HScFICAbSBFMxTPzakuiv3cWG04M+uEGnTEYb0HuGWqnXCgb1ZA84nYZKSrkJ2GMA0Kab8+/3RRZgkKWUntS0bmMnB4vFr7qOJWOqYQYHZ0ziciUDPXs3svzXtjXJD/ZEXpAHUOBw/PXxIri4zwe1Okt/5AZmUJVXHU4EqYA/gh/2ehUxfCNBle+C0gCMZHT7jJfliCSwOxPBz+NofVMuRYv6901chBRNUDfsYlAYXnPvQ5zVYbmpGEI+3MdlaW/QWqLfU58Ifx1wp1wBtRS5uhawHWawuYitmblzpzK5swNTjd0oFgeCDGaCbT9PV0BJln5J51pLw9vrigO1C85a1IP7tgcsOLxTAAZcBPAHYlh9rYZIgITxrIsn7+tYPflZfEiMnZMYsq8n8dSdWjHIvjQNWKeFQO4IvJh6gVh9SOpETj3WDmj2XExUIpWHRmRIo8ji5WJGUtVto1PLa/+DwR56VCCJgdcpQIx0lP7taD10SCsd8wDS5IuLLB9s7ueZKw3OIB5gTqHalg5C+cyjlu0B9HGDJfkjeQapsAqQ5iAmuy0l2QMeISMU5/816szkBu5gy997FkxhrsjzYtjre3Gbh1ZzTpRE4NRBPRYoK1CHdqgLYYbHwxjcyTyj+D6blSk/8iiZ95fdnD8F9G+uGPz1osQRY174nOV1S++VsEkrREtlqAm87ReMY+jkgeGmPL4EGsXqNZ7221rdHa6YEFWuRwmFU2YRvel/sveWrI1L/2t+moBJLtws6EPVTwGUXZfG0UuCG44Xmmtr6TRvMToes2Hm6cB13xC55OTaFHh9qynVIEDOAPmG5VdITSeEvXFWs0qoWqRMMuz6RFZCyN1LsMMwVoko2WBuWBfBMfg/jTchACyTWpOda+TL930rD4/o71oe/vV/MYMn3geOprXNuDL/mgElBPDsOvGUlDNCFCBRSf2IpPS45DIf0NpbzN5soC0+NnDej1wboSaQYkbtVKXOLGgPrKfcOM34Orq3ykNJ9M5Y5NcStqx+IlHeh0TsS0H+vyd0eGuAhYHRKC+72SY8YSWLzskJ0uSZ4Qo9nzfuC9W7qVVUdFI5IN95g+ZNW3fAWl+CDz9dhnmcn6100EOGzsCv7ionaSKdZGeptqXyrC+hLcGcF9aQbabr5wF++enBYddaVNwB/GMPZ+mvwYRurpLcD2SkDuiVArtaPxrnmJ80aJW4HC377cuQleJ0AQG8jJaIyHxfsk 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: 27 Aug 2024 09:37:46.7011 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd306d05-6ea8-4f9e-41ab-08dcc67be8c7 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: BL02EPF00021F6A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7128 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 Reviewed-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/hfi.c | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 57b642c4c522..c3da2edf8590 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -304,6 +304,39 @@ static void amd_hfi_remove(struct platform_device *pdev) mutex_destroy(&dev->lock); } +static int amd_hfi_pm_resume(struct device *dev) +{ + int cpu, err; + + for_each_present_cpu(cpu) { + err = amd_hfi_set_state(cpu, true); + if (err < 0) { + dev_err(dev, "failed to enable workload class config: %d\n", err); + return err; + } + } + + return 0; +} + +static int amd_hfi_pm_suspend(struct device *dev) +{ + int err, cpu; + + for_each_possible_cpu(cpu) { + err = amd_hfi_set_state(cpu, false); + if (err < 0) { + dev_err(dev, "failed to disable workload class config: %d\n", err); + return err; + } + } + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, + amd_hfi_pm_suspend, amd_hfi_pm_resume); + static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu) { int i, *hfi_scores; @@ -569,6 +602,7 @@ static struct platform_driver amd_hfi_driver = { .driver = { .name = AMD_HFI_DRIVER, .owner = THIS_MODULE, + .pm = &amd_hfi_pm_ops, .acpi_match_table = ACPI_PTR(amd_hfi_platform_match), }, .probe = amd_hfi_probe, From patchwork Tue Aug 27 09:36:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779143 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DDCB1A0708; Tue, 27 Aug 2024 09:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751476; cv=fail; b=b3C6w1wxtyQwREmxrqcjNXt2VEp55sAWxDAhmb3n23q3xGYYu1at3hzU+4tQe+B0bxFH6riM2Lyck8cwGcB0uwwOwCwogIAQ3aZLlUdLO85ojJ2e6t2FYWVV324+yU8zZo3LqMokzdPCZGLeAlshBmRNMjzMfCDucvgIbGLVvCE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751476; c=relaxed/simple; bh=68hKaFLnYw8/mXDitCZbqTm27iCu2PbQkz832og0OoA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OdFyUweQYEv16efP9R0zEoNaijubM3ZP78dagKOlou8jSrub6hQeF4S9uCytDQg0IFxppxdEgLf1kAR3zvYAkqDbiHWqQ1hp4Th8dzIUMlg5Hex50z7hH67hSGYfcWz/JrmYraWuWfgbdWx/DZJ91erFbWptwvi8x2sMhvxnqEY= 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=RCx4QAH4; arc=fail smtp.client-ip=40.107.94.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="RCx4QAH4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H15juIC+7NfHgUJVO4OAicX5d6QypQNtVZ4bz3xN+T6X3nDe+ibVFlDkTl7LDgCAqfHD9sHaC49W9dqnAumODmRn+rJDAV0Lqp0+BBYyzsECsX++sU7JqD6MppwpWQy5q9Xdzd6cy5/eF0hC+Ol7WNX6ZQsh5YgYLivEe8Vo4KQQCxZH5aeGUxjmyJYlAekCkutIRwiAa31C3i4hmS+1/mesj41NY+4wgz4m9n4RkUxJLgGKv/XdgyZBPCUquh0XkDH0GQNwh86ETcit2Oau8YFGz4BgJBnL/8hB8QRuCis15IrUTo5f0fNMLQkENWDrDxHYjRLO/SgIs+UMhTPIjA== 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=MKDFanQWgd0EAiVDTKgKUOU6q7SJxPcs60yln3Z4PkQ=; b=bmH/Tjx40yPQAcXLVFJzLqSl0v7x3+oy3c6E4OqwxuplpfOztH0UDIgTK0K/9mprSrxNksnUZElQqbP/JVq+JPnc1/iObv5FyX3UYslJa8EIJZ3H/IfsNz8H/hquSPVJDqK0iJV+ooFy+Ka9s/wV5CDEYI1fuNpwFnC7IEEdtdmFNdb4eZxQZtfIs3RwX9FjHyU2QPl3nt5ZhBK694xeTMq0GphDw0XFmMgFVc8VBe8SQlgcENCc5rof8zzm3bCuzeY3SKxkR3j0PM00Eptqv2t8lVpbud8ehtRKgxoyzhFtUl9lk9bxi9MaXldtr5UrAHe0AShwYlz6xBU2JEnaCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=MKDFanQWgd0EAiVDTKgKUOU6q7SJxPcs60yln3Z4PkQ=; b=RCx4QAH4eRqWY0R4EG4X/qpS0D1mwEgB95gK4alYrtbbnQ0oYTWEGNBCY6cKa1aZHRqRHnn42Md02fT45h9V1KIec6ko/nm/cuj8/f6rFVS81+D5eZOJNU1vpGhH0WoyGEoVLV0r/lRf3atCaLKL1RyQpu2gKjetdO9AyXP+OyI= Received: from MN2PR01CA0043.prod.exchangelabs.com (2603:10b6:208:23f::12) by CH3PR12MB7715.namprd12.prod.outlook.com (2603:10b6:610:151::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Tue, 27 Aug 2024 09:37:50 +0000 Received: from BL02EPF00021F6B.namprd02.prod.outlook.com (2603:10b6:208:23f:cafe::3e) by MN2PR01CA0043.outlook.office365.com (2603:10b6:208:23f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.26 via Frontend Transport; Tue, 27 Aug 2024 09:37:50 +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 BL02EPF00021F6B.mail.protection.outlook.com (10.167.249.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:50 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:46 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 10/11] x86/process: Clear hardware feedback history for AMD processors Date: Tue, 27 Aug 2024 17:36:58 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6B:EE_|CH3PR12MB7715:EE_ X-MS-Office365-Filtering-Correlation-Id: c2207e16-68db-4b0d-eb7f-08dcc67beac0 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: 1gpW7wr6EepzTYov5ri58SbsDeweNiDzea5M8QfwkgQhYbds6AAiEMX3aXCLEudlHIAFTlkCrkSZl+yguDoM18cKv4VlgQ25w0ytG3i6aQJawh+ktTERquPJYS4nF3DlfHu+g1F2aHn7BlFIXjEbJra8IE2cHrGGhFgvIjAZV983Ox1D5+fp8K5w7LbTrCcrE9qeVPCBsxCPGoIpotxV7Ugv1FowupYXDNN96QZlGdjHfPmic0wGGNO6tbRB0Jqrn2RtthQFNehy/7kNIH3b6w2GTL8qYUfhUEggZqfNhVAJcjCenA5eVD94Eqayg7HWSawYxvq2TBHdc6e2rHPVJydebBFbUH18zEThhQhJxMx1/WBVXEozVVypPWtw5qfK9USow9698Zy5d+Q6/oqxttHvDOr8Dvy1lDpuCKmqH9/aF8LQ+cjTUDWWbfDgJEdcBO4PmFclqoMr7a61q5/T4K5JuxXKYd6m4s65mrtE89+r8brEmx7Vm2tdquoq6wQLfeYGAO2wikP5UNb2HTNHFxhSyRc/cKYosbC7ZLAdBLKEAMZGdSt/2IRZNG8OlpOvTrnHolMIwcQDuWD8iGTNXUaWwx1miAVofFQ3xMRgaOILsSZH8vf/RYuPrCvi1J3o1aZSJuls8rcDZN0o/cydIjM/fdMarSm+m38uoqGOxBKsqZMMcquabbRtLXLtzHAGDJ1lzDPMVGom9x8w4CyZ5KYB3IFUx9Pvj6h5wJ0/+sGZDFzzfD6vaKnOBRghq9XYxkZW40m2oem+c+fTDlkRWHoygVjvUzdvsrPhKmzpOzB0umvnfFbcpNwj4iOZxrbn/jvx1s98XZHqLD8D9j/jpg610WuyyxaxMuKEdchUh3mblRWsH+m93XB4JMuBtdbip56tmmDFCIDSazyhgTO378yrT/aExAg6VNv18yGo85z/GTK3f86hF4hPb2FCS9E52l4YjCr5VSOkOwTx2AjT+wi+crlp+ljHO+wN135CgbkD0eM8ue95Gro9AeW8DO9JH6lo36kWBjZxsOMppa1UplnhaR3kJ/OBCn+97n+ounYxjh6nbJLv/p1CyqBHIFKVWJN9usxMutR+tb7jtu8lFTR6VV6PtdDlDCZJAYkFeE499jeUZOWM9OeI7GtM9kQqWM53iSdFl+n9Hb73V0WS3NW2ps/EC6CdKTcVVzn8YyQBSpg283cSNYmxzQKfKd2Zmb9F6YPosJztclXHi+uOyoTm1JeGAJITx1V+0SWgWZzexE8N9svbAM/t7dKks4iS7SCEkERpSnuGUoYyEZf36Wj5peQZgL223wl5UXxwFRar3E6FBSVA6pssQBHiSSNPpC51joeeErwhIgBn01IKfI4R2DINndx1kS7ZTRtY1zWkONxcMZmWnEbEGr+h+sNZCUoc7CuLVXqvZFq9CsdzUgq//PrCH1rIQvvNB0b4L0HAAA4XlpCUfYtSYBGE1ImM 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: 27 Aug 2024 09:37:50.0306 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2207e16-68db-4b0d-eb7f-08dcc67beac0 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: BL02EPF00021F6B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7715 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 --- arch/x86/include/asm/hreset.h | 6 ++++++ arch/x86/kernel/cpu/common.c | 18 ++++++++++++++++++ arch/x86/kernel/process_32.c | 3 +++ arch/x86/kernel/process_64.c | 3 +++ 4 files changed, 30 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 d4e539d4e158..2ef34669fcb6 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 @@ -398,6 +399,14 @@ static __always_inline void setup_umip(struct cpuinfo_x86 *c) cr4_clear_bits(X86_CR4_UMIP); } +static u32 hardware_history_features __ro_after_init; + +static __always_inline void setup_hreset(struct cpuinfo_x86 *c) +{ + if (cpu_feature_enabled(X86_FEATURE_WORKLOAD_CLASS)) + hardware_history_features = 1; +} + /* These bits should not change their value after CPU init is finished. */ static const unsigned long cr4_pinned_mask = X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP | X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED; @@ -1839,6 +1848,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) setup_smep(c); setup_smap(c); setup_umip(c); + setup_hreset(c); /* Enable FSGSBASE instructions if available. */ if (cpu_has(c, X86_FEATURE_FSGSBASE)) { @@ -2392,3 +2402,11 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +__always_inline void reset_hardware_history_hetero() +{ + if (!hardware_history_features) + return; + + 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 #include "process.h" @@ -213,6 +214,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); + reset_hardware_history_hetero(); + return prev_p; } diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 6d3d20e3e43a..096ac69bb8db 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_struct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); + reset_hardware_history_hetero(); + return prev_p; } From patchwork Tue Aug 27 09:36:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13779148 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2069.outbound.protection.outlook.com [40.107.236.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 5ED5219DF5B; Tue, 27 Aug 2024 09:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751479; cv=fail; b=LD/dOQeWL3nekJlc36m4CgnB1vUqJBbjrwkAd9lL76jvD+GU8CCjaGE6B938OdIAmPMpw1+ng6bvvRJTc9LrB6M/oko9K+DcAAOkZKRQmWeY9cyFJ5WsV/Tu0NFrUp0V3HztdvfO7hpkBMd8rLidoqNhFI0mPTYnSk0DmFeS2R0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751479; c=relaxed/simple; bh=xCvwrCcZ0FN9kUdEmOqt3dNT8/JJ6vROXKfTn/pgLP4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XdaPHorpjmvHJEN5zWmj5XvHZq0jrSwsFotxBNukkTZtXrPjYlQLSi9N4jZzH2tKPXJm6hKSm1GMFdDrI/WVa5b8Jf7n97Bb4qwMsM6lUDADwqwN8y+xEvnYA7mUSOs9LZJAj2gE6OqoZBzE32gF2ldO+HJ0szI4MCMkzn9o35Q= 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=mpGzVEdU; arc=fail smtp.client-ip=40.107.236.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="mpGzVEdU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bZbP4vphPpdjzso+XwZ1yUDGwqRdvu7iQd/rx3y60xBDgk6cDoeKfXLdpqU/B8bAR/YWV9Txz1O683GPptqcpB494MWxObW1ZTqLtNr2MpPJajKF6qSzH33JnG5b/A9oUp63/8klQVD4g7NnoSNWz4/yt/FR2jwU8ZXovylYTZGEza3gBXzpXX4hBqKaknkRbgXKoSH/X4C11EqTiLVp51TOjXHoQ/s8nflcJoJ3SD+9ed3C12muw7UpPPZEUrZKsV6ZmOu2efFwTp7bYPOyMVtEygm2R/KkRU+tORPvs9RnVSncuzJoG/nATnH1D/2skV1dA5o7dnl3X3YeuUDBag== 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=1lr40zEtvBWhomm+rqSPYu2oZ8Wh+HVttsWbChLgD8g=; b=fdv2tR5btCeZ6+2Xwabd364ijHXog/E3mT92tZvIGM2VbVuMqZY58uUHXps4iR/u0Ruyct1/sFDuADkoLlp5B3SjuacdVYBPVOKX+jfBCAv8O1LVah9qWxnuB48nAp2ByGO2a5IQv9vdfHVt/MvwOVkjjLqvWkht6ry0SQX2Mhbi4PfX2ltc92EE2o/XJr2JyIiIc1vZhKFhZDiJCBjw3fJujv2EHyYpEouaZfKcX8SmTFQa7BZY3kHUncw+FR5kwmGI86OVDHuXqPKCqlcOtIs6xxwqtPE1yQCcMjON5gYddJ4hGzwJ9Izh2olKkEin7moLnXKVcng+ORJShO9URg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=1lr40zEtvBWhomm+rqSPYu2oZ8Wh+HVttsWbChLgD8g=; b=mpGzVEdUQW+vhlT49tqrRxxb85D01DVhXskrgQjQioLbnN7GcclGagpUghqH6V3mNTTy1rwYv1eOpUb8n5AersHKmmDhKmx8K5AvDOhN8Job8ZXlkqy00RgyAbRbbO4qljFBrdn7LyPw2Zv4JCSBZZEE0hsBzz3doRpV2Iz/aPI= Received: from MN2PR06CA0010.namprd06.prod.outlook.com (2603:10b6:208:23d::15) by SJ0PR12MB7008.namprd12.prod.outlook.com (2603:10b6:a03:486::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:37:53 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::a9) by MN2PR06CA0010.outlook.office365.com (2603:10b6:208:23d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25 via Frontend Transport; Tue, 27 Aug 2024 09: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 BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 27 Aug 2024 09:37:53 +0000 Received: from pyuan-Chachani-VN.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; Tue, 27 Aug 2024 04:37:49 -0500 From: Perry Yuan To: , , , , CC: , , , , , , , Subject: [PATCH 11/11] x86/cpu: Enable SD_ASYM_PACKING for DIE Domain on AMD Processors Date: Tue, 27 Aug 2024 17:36:59 +0800 Message-ID: <111a9bebb6acccb53ed90e6e4563bfd6ca04f1b0.1724748733.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|SJ0PR12MB7008:EE_ X-MS-Office365-Filtering-Correlation-Id: d793485d-fcca-4405-b069-08dcc67becc7 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: 8z0tY0ENB3fd/ScGwbY26cf5T7qqA8Ehc7GfxHXl41JEIw8zxKK9UqLYv/sD8IYt1i56N7lWTzUJbAnH3SXgTNx4qCD0KofLvuY5eqNSL2L3+oYNzrAJWSz5lzdI/WnHKh+TXX1JA2/d73HWFziR1i5Vfe6Qx+eZpB5dxDMc+NhKB21hNGcKxqS24Dx3XHMYtNg2kyA5wrJRujd6oTFT5BDOmyA6nedtsy5EnBpSG5lgKLcj6ewX8x1GELStUJCOrIWv44GxSAgUpRYZG6s8xf0LeT+JP41MdTmsVkBVtkEh2T6boJ2L7tTYADO0hqcp1JTrgiVCYxQB1yR+0egKioro0lA+wKrw35BpztmZfJKkV4EuiQfqIK7FqQe5JXsV/DGXD56e0AFKm9eFvJBbfvT8ed1Q+t99kmTyxLfQC1LxdyJ9lov7UgYq4PCu41Ki0+163vDpC+P04ToZ2UnnZn7wxgLTMUkZxhELXaVpRkmjZhGx4HI4b6a9u6I46cDeYRa/xrsBukrPFOPg77GvEEgkxorxWPq4bhwAnibf/27XpzWVRVPVWUzf0dFGBzCTazeWjYLv9eS3qOYXGBO+G5cGqst2lmqi82QGC0kDvaxqyQWaOscgLcBd/pieJj9a4QF/RPzWH1n0h0Ym6w/4BPWcIY5o7vzsHbRc+FB3DS1ZTXp06ntBBDcTEsryMlScm6Z8Tvh6WzxUbInBJhhuwI6QtVqTnOGKQeweDSw21+4ILMaQ6Qv3I91oqGojmQXrMMwhsbFBpp3604Ge+ECdZz4+l9FysWTI7dOFH/lbvqvfBTH9gHXc3i6IFwsW8Zx0O+vSNyKc9vTCqTlxRWjLf04agujCMwWCaipWdcfxHIHAsYi7ckoml0S69SXIYtbxMRN7C87nHw8TloKTVQi1cKmyUfQBhoNVbfjUdoQ4lXeuwdsBoWrtMyLUNF7iyhGzLWgocxEteN1kjJ8OawfoT5Xl9+xkb8/G3FmBNEkdPFIgImsHSx9louHXe+hKYCSZrEPzMBC3F6BPfON3n+VfzNyFaz9ThU1HnNYrcJLoLjf04bzwBUdhqvujIN9kMi0Id6V8tKG3IalTgrjEmAZN1pe0joCnaZvaqwtXSKeoEdPnZthkvPNWDdMwLoZRNH0HbCocMJqBQdCjbobt9lWaDZOI0h22YJyf8sHaKPSXdijJaOsUaPGgDMa7IhSljW1W0Snhu4sEzKIG43Sk+tmYRbhq9xXSN6FmTX0SphB9h0sByq1CQIrFcR3RAhsKxMVVN3sRiPfHWf59HDSRUOAAtFV/xtloS3asnNCVwqBs3vX4KNkVlZhzr0p6uIZfPzAHT2D6gOlOiQwhnMYF8uBJ+CN07Pt8TYhawV/aWMN4lW52KH8GmUgiyAvPEaYYVS09PwPvmYg6rUyP4wJk883PI+tS7Lp5LhOyBlHOwoqG2+1L4g8W+oKpTnieL0cG5uIx 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: 27 Aug 2024 09:37:53.4304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d793485d-fcca-4405-b069-08dcc67becc7 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: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7008 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 --- arch/x86/kernel/smpboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 0c35207320cb..16a893322c4b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -496,7 +496,8 @@ static int x86_cluster_flags(void) static int x86_die_flags(void) { - if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) + if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU) || + cpu_feature_enabled(X86_FEATURE_HETERO_CORE_TOPOLOGY)) return x86_sched_itmt_flags(); return 0;