From patchwork Mon Oct 21 18:02:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837482 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) (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 A603D1F7089; Mon, 21 Oct 2024 18:03:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533803; cv=fail; b=FkWLMpocAbWz04LOpdtzhbNqLKopLOkKJs8PO59KVKu8Dcgc6g8HlqzmZVjB62QHJC232+LfU4Ps45OJ6GgOWaEIzR2+cnKai/bNZ0lD1cNAp8U5X5GATxgix7wku15ySzsDFv8XfZ6lKlIl7WSGLLjWuAIlMLXVahTLQTec/Sg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533803; c=relaxed/simple; bh=BZ37AiFR0qJAtGoTPHADBBdXnT5Ual54NaWDz4rtz/A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UfakaH03+cva+S3z49cAy2rcPl+xKbsKWIbN4MLnLJCePLJKAMKM4fzOnf0dDw9eUuIrnn9gNa3448cQUPQP8x1F/flXEzjKDG9v3jeAn9DVfTOUA5C4vGTncgwKtxXw0F8DTArnnIyKxeIIa14sWNWjDtgqm1+rkiNN6awZnWo= 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=cWcEHMZq; arc=fail smtp.client-ip=40.107.244.84 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="cWcEHMZq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LjtSdhXH7TtawCvZxJllDKKN1AARolE4KyOsnu1hBbACGOhV6laOyk1KXfqevwEdT/Pt8XxIPt9PlQ9oRjfXh+DzENdAeFzQw9eLccNpmXzepcYmKxKvwlYSbjtZh6KrCLSBJoZw4G8CaIj9WWvsPsHb4cYdTCmfTuBvvJwm6Zx3HhdrheKAsuqeEIyeL6PHrb6veNclAu12nzSdM4vhoXYhswzUe/yZurx10yxTGa7D9Q39PqUIxtA05BN9NsUeHIND8zMYvmSOk7SNZrPDoA3HMOP72dtY8uAC8sg1jJ9zE+iQPGRIdV00fLcRaEe2aAQcYFvyFHk5P3/TRFhqfQ== 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=0VzHjc5UbCiWk7vkBe7HoGKIMIMtsjnqRZ1TUsD9/jI=; b=lOCCpt3FbA0IkLuyS2PrA++GpLx3rx4p9hcQCZeuzeo38NPx4wQQ+EBdar0B6G6LIm1Rj3YuBpO6/tWoBax3IbOf1RYMmHwVciU7EXO4SI00XbJjttaJvNtZJXxEPVHmTRM74FKrByMjejZy1qn0MJ62iPZpesfDZhhDcRwuivhNoG9JFoymVQx/wu7d5G+UmlkGa6tRXwwiW2p4SdQC6/M+7jdw5cjXk8SmxXdQrSYb9wCkCRpdS8aEtSjNMJjT23F3cHaHbilr4Cv0AQvCdya+7a8FzY6Kf53qAoTVJZ9TufNfrfwD8jUrzyghekNeTHQipK6cD18cXxVIKk69xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0VzHjc5UbCiWk7vkBe7HoGKIMIMtsjnqRZ1TUsD9/jI=; b=cWcEHMZqXv6dCUdnU84Wb3DKcZfhG1zYIpOIBSDT8CRm/cIZlh2j105ELiJ31VIuvyEz2abGn/MQavL2h5WsTvq9ilbSpY1FXeYj3aZH5+bQF29uYRmcNqBxzYdF4FWTUUpllOU4Xcrq9ePpPAStcdeXRko3oN+yA1PIEYF5Ggw= Received: from BY3PR05CA0033.namprd05.prod.outlook.com (2603:10b6:a03:39b::8) by LV8PR12MB9262.namprd12.prod.outlook.com (2603:10b6:408:1e7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20; Mon, 21 Oct 2024 18:03:17 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::f) by BY3PR05CA0033.outlook.office365.com (2603:10b6:a03:39b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:17 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:17 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:15 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v4 01/13] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Mon, 21 Oct 2024 13:02:40 -0500 Message-ID: <20241021180252.3531-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|LV8PR12MB9262:EE_ X-MS-Office365-Filtering-Correlation-Id: 05f616d1-eb09-4a9a-ff93-08dcf1faa421 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: HMmebuIaKZSpyT1/MDU7QWnbrvB5TC1BpN4YV2+mJwA29eYOmIVBRmci3Mg+omCzGJwmirOfY0ana/ZEhheQODmC13Csuqv4FKPe62vBpWIxltPH6By7sVm+Q+79RIEUv0p/WISFYR+1cnFRB/7p8iAiASxiQqJphA0qn1z0xayjtSidi2Bqa4hjQhwEIPkiuJtaNqJft/jD55vXbblzvtyEy01/nHJcAhf5Dqbf7oUKTXAZuJCETzviozPw16mP89yQ2DXmrREaCIzvQLUiG8huynnQj/ZySlpM6lgLGiFcNQFzHr+PZJhTDn4IYci8jJiChug0gklys/plQcmffK1ERk685X28VauWw1zV6wCv9q9gd6A20rbMBll6qruZhY/88zcfPMod8s31z6EoBN8OnT8+R2rFr5s3K92i6nPZWVQY1el4op/0LOdwkFLLr4VGTDPolZo1reb5ay31JimsQsD5bzZx/AnnHVUKXlgVg0b2d6dN6h6xVRmTwRA+aHIjyQn3MMxZ0IV4GtPiBPT+t0FocY+jHlZz5tnsOFuKYeIIsUyQrIjPYsYkXhiLVNihuqZLY7+8gDdo5sUmEFEiduiJCJ2zzBnXrrW6DYUMaFKFYeh7Y57DsAF/LfrLL8IbVZQ3HrzAJSUVeltXm1rpEbyJQomlWnTmuIoElCvHjuwV0FejEM4HQGDBUWOE7ffVlwpUl+DjLIbKJwTBvuryYGZel7d8MRjfS9V95KgJq8RBchCtSDv/0tpvTUwK/akDJYebRdW1Iqe1ZWkGfAEg3eVbunJcYo/ahWErTt4O/IBqRBmE0hBBlICsxDMZ4zCVmRYvazGabEms5zUQbmQQuOtZe2aIWlGh9Mrsj6GNfpI9Ad1Jf58crL8RopGcB69FKISwrhQo5Lm54i2Z4cNKyjdJM0RLYeS+n9oAqK9Ktic3VcNCYQDCHLJybMU/nvHY0DhcEWDBqT4VZMP2et1zesi+NBiXOjf+2HNCbSnRfx5UrG0b95H3LP7pa/DZLj7H/ONwMlkHMYTI+zuv9pSzQ2og0Vey83fIiHMvhibZshcDkD9b4+L7pHLSX8iSxOnp8oLZMOC9I3XJh4QopGAMXs9/24MDARQPZ9BlVFuRH7peaMgtwzWNo6R1jJXXaWltFrdlAhuzpdydYQZYFLbXoR480WdnmO0DEVFwRK/JJKFKS/ABoSoH/RLgfY1wa5uk5ewmUBlH1YlFizXtla7QbmPICbDyypz/2F3gVkDiyFHEv6Nn1Hw/Gw9hlQTu6nKkmSgRFqRDwukHI/oAed5VuLBQA6gQYMm4v9QVVSyDK5LQpR7DFQFIXWcfBdeCtJVJ57lhOonDibKCa1YVUVRa9UEl6v2jCxMJQVqrPuM+yn8JYjcC03dxnHlaXVGtVFxJSYGfLMOCFRM35AAWDA== 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)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:17.6171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05f616d1-eb09-4a9a-ff93-08dcf1faa421 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9262 From: Perry Yuan Introduce a new documentation file, `amd_hfi.rst`, which delves into the implementation details of the AMD Hardware Feedback Interface and its associated driver, `amd_hfi`. This documentation describes how the driver provides hint to the OS scheduling which depends on the capability of core performance and efficiency ranking data. This documentation describes * The design of the driver * How the driver provides hints to the OS scheduling * How the driver interfaces with the kernel for efficiency ranking data. Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v3->v4: * Add another sentence to classifications (Ricardo) v2->v3: * Rewording (Bagas) * Fix toctree entry name (Bagas) --- Documentation/arch/x86/amd-hfi.rst | 129 +++++++++++++++++++++++++++++ Documentation/arch/x86/index.rst | 1 + 2 files changed, 130 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 0000000000000..b66ff083855f3 --- /dev/null +++ b/Documentation/arch/x86/amd-hfi.rst @@ -0,0 +1,129 @@ +.. SPDX-License-Identifier: GPL-2.0 + +====================================================================== +Hardware Feedback Interface For Hetero Core Scheduling On AMD Platform +====================================================================== + +:Copyright: 2024 Advanced Micro Devices, Inc. All Rights Reserved. + +:Author: Perry Yuan +:Author: Mario Limonciello + +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: performance-oriented *classic cores* and power-efficient +*dense cores*. As such, 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. + +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 | ++----------+----------------+-------------------------------+---------------------+---------+ + +Thread classification is performed by the hardware each time that the thread is switched out. +Threads that don't meet any hardware specified criteria will be classified as "default". + +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 following events trigger a table update: + * 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 +------------- +The ranking table is a shared memory region that is used to communicate the +performance and energy efficiency capabilities of each CPU in the system. + +The ranking table design includes rankings for each APIC ID in the system and +rankings both for performance and efficiency for each workload classification. + +.. kernel-doc:: drivers/platform/x86/amd/hfi/hfi.c + :doc: amd_shmem_info + +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 8ac64d7de4dc9..56f2923f52597 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 Mon Oct 21 18:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837481 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2052.outbound.protection.outlook.com [40.107.243.52]) (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 4BF6D1F943A; Mon, 21 Oct 2024 18:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533806; cv=fail; b=Ua6aQHJdjvnQiThUhSVbD0PJ8QeIaVH3jrp7UBVd7GsZ1mwUSfQsG8RbGsUoeGreQsrzRsCycjg4hdGlPTVxefIusNeBbhPW0QoSO5Rar5XE5Ht5T3JeM8keJfgDShxIu+0x9PnCZlC8K++UxHr6AO76H2e74sjn808bjakZ7Dk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533806; c=relaxed/simple; bh=gA62LSLm/Ugj/RsJqJmdrDhXZI4T51gf5dVZUqTxMR0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MSUeNC6hvmKERc67oP5gA5yhT5Hxe4MG1ffvT9iCr1cyMCWouX2e+cf7kRGzbUJQDnWUnt3zio70lkiDhWdz9E3+IKbKQplcEAXmHYOHI/rEM1LDrIJG3bn9eRPxpdZHM2lolUbceOoDJAiK9P5SEtuY159ovq4QJkOndkFSU1k= 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=LTUFzBZs; arc=fail smtp.client-ip=40.107.243.52 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="LTUFzBZs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZARLeAq2uEijYMCnkO5dugWr09QNVH4Y+XNgpdd4n9BmclUcXk35V9vAxLxmdPLMqqbUoY5S7EcB5k6Nw6MAtWXLX5dnglLJOvpAGejlyD4g21KDlVvuTZBuRmfSX4WnAtFRsoVxQie2QOqH7olkX97ujBGjeUvxmuyCFokOvjoCV6AzdacubtKe0wrEYPLhZTGYPZR76XajSEwQLlOu/FWYPvWpdZq4rlpWb5OyFhVsx+CoqDjXVpd0PwGrzX4Ya/T1+rlzGCNyvhpQcxa3Z7XQ43OaVLinHoruOKrqPcstBGF7DYSBaK/m51tk+Bh5es259I/2Nts1H0ulSGMxqA== 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=3lPPDC2j9oFivZ9+BluFvMWfSnLHcATGH3L7Y4tOdoE=; b=NG+tTv1UbL9ec8/Hvw3YmggozkvmLrSu/4dsjafI1+DXVyNqvvdp+3p6iAD5+MyJqO4jXPk06Wgi5yER1M9FOcDgumvfpEnDvpBAVbo95SNLdofwcbf1ObG/Rp+WuxBNuV1YqEEht4+Y2HvpyhbzmAvChfSrWSmH3Ll41fP+40sRaA0l7j1y+m+1H8EhF7PNWtB9SgxPIHCwHJYZI4be8yZ/m5ggqmkzJRZV1bupPBqx+B2fQ69sIM5iC+OoYP70n0cKPt2ttSL8zZbN9dmrTpZVobC8jddhSzZgEoWu3sYpN4tDWVsWytydmbd5rZsIiGLgf7iaChBlHekyNwwmbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3lPPDC2j9oFivZ9+BluFvMWfSnLHcATGH3L7Y4tOdoE=; b=LTUFzBZsvHis6xORy2CHYwlkg2TneAPM6PEUrC32ImUNb2On53qTj2og/PWBUVoRGtkZUGUo5KjsfkOzohGlJlu3m2GlWHedkL424HHulrHkJKPaFgXLLBBtjSh8vLnS5/9DCzRV22lJasKpGMJgBaovcdwi63wf/IoJ/wa1L/o= Received: from BY3PR05CA0040.namprd05.prod.outlook.com (2603:10b6:a03:39b::15) by SN7PR12MB8025.namprd12.prod.outlook.com (2603:10b6:806:340::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:18 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::e) by BY3PR05CA0040.outlook.office365.com (2603:10b6:a03:39b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:18 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:18 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:16 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v4 02/13] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Mon, 21 Oct 2024 13:02:41 -0500 Message-ID: <20241021180252.3531-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|SN7PR12MB8025:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a779ae7-6cf8-4771-aa40-08dcf1faa4ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: CF72yuqpYttPrJftw+Bq6IJb87X8ZDwdo37er6Qc9JE1Lqr1mUqH+7imYp0mK4H8TwFVnxq6yQSRA3az7mcZrnqo23thElA8ely5NfW4ucVX1MjffI44O9TNQynOQIKjRt8C03Js0c+Gufli2q29kHU617RPVIZ1H4DkLbsdMGwthUD42t5vioOR5/6SipbaL1iEovQdcSTZn9gZvdNj39xXPRo+MMvDEzJhYroli/rjX9mX7BPw/n+BFfWEGzSt61v5+rqCdV3VO95U3TVZLf8E+Pj5EwMpwDvwmpW6vaw64d1rOMmnP1iApNzoV/0+tFrO2f/L03UlNTkfFOK51J7v5Phc/DhTJrp9baLpGmTMuptPvO41QrPHqzjigR9lhWwgkhSW7vbGk2gVAffdFGpDEcjpUDj0ZYZatPEQJHIidkOXNZ1MDVG50ZNGYkpD1TUnRcM284B+Rl4zSx4ZNCF3yx66I0uo4x//Oif8oTzlqZRjalm6T1ei+D4NYB2R6izcoDzVUhvroMveu5pGyzJXcgXLZXiuwDbxhwOWapk58YvKQQwRlI1wLQXF25vvqppKRE16Bo6ZrNaW0FiGOVS6t4enYXNnjX6hlHHn0d6b7geQV6V12QPdM5tPMx78htls/CFu8T2A8DUJuXmGel0cSo0j0uG8aJH3C3+tCUFbe5M2c44z8syeCwvcwE/B1JXsFUQai9th9NAw9wdadj0gRin0/UauHrzC7DPabGDzm4IwwTW2xd5Q68c2pEkHkjJfDPTHf7DoW74PrtJ9b9Vgu9S1jo8QIvbaDtnCMMhDmexlErdPF+lHYWKDSrofYRk/UV/A2iw7T9xJXbYplkM23id32qYpvi5Iv2dT4PHX5iBKZyxeEB5cibM6SSRRekLYhyEnLb8XtvKDRO+C/GmbUu7+NrgqAYZlZyUbkpFEjHxlTsZBY5XoXrrHXM72a5G7T8AR4P674Eda/JNdVLBU1Tk7H8YFsMFxpOWvwXP5kTkKJ8YO5rSATB/cAcfbSi19K91pL174aNwcYEynVnW4tavvemcuQej/EFypcqUOzu0+VL/JIY5eG5Ypvy+8glaO3SlB48KX+oI2vVD7dVPSXw3jtP92WlSAqBskLTrITUU1d9MiJHb1FRYL4IxPosJVIkHgRPCYVA8toT+MeWybQOXQ9WG7jW1GfG8/vwOqLYLgCZylstWDX2vkQFSYGM5z56ej88c6r33SZ0fZIy64mpIgwgZWoF9Cf9T/zS2oGsj3oeDb1Ut2wquDqcHVVI1SOytznEhvfkNjC1mriGkUge5y6H0DDyzbWQ0RhDpa6BBGczou6OALkytEZw1idMTzo1Y1vkiQmddkk1zFqwUHDm2kl+s05gSuOTIVzBw= 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)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:18.5389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a779ae7-6cf8-4771-aa40-08dcf1faa4ae 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8025 Introduce the `amd_hfi` driver into the MAINTAINERS file. The driver will support AMD Heterogeneous Core design which provides hardware feedback to the OS scheduler. Moving forward, Mario will be responsible for the maintenance and Perry will assist on review of patches related to this driver. Signed-off-by: Mario Limonciello --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a097afd76ded4..90094e064d94a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1083,6 +1083,15 @@ F: arch/x86/include/asm/amd_hsmp.h F: arch/x86/include/uapi/asm/amd_hsmp.h F: drivers/platform/x86/amd/hsmp.c +AMD HETERO CORE HARDWARE FEEDBACK DRIVER +M: Mario Limonciello +R: Perry Yuan +L: platform-driver-x86@vger.kernel.org +S: Supported +B: https://gitlab.freedesktop.org/drm/amd/-/issues +F: Documentation/arch/x86/amd-hfi.rst +F: drivers/platform/x86/amd/hfi/ + AMD IOMMU (AMD-VI) M: Joerg Roedel R: Suravee Suthikulpanit From patchwork Mon Oct 21 18:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837728 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2067.outbound.protection.outlook.com [40.107.212.67]) (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 65C201F8EF1; Mon, 21 Oct 2024 18:03:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533805; cv=fail; b=UfbTcKgQn0BcNLGm5la2mGVVJ41MEjXiX7jfkECONDnHYqBglCtlAbQt9sGa7UVMiKfm72tgNNHHUW2DV62FvFuTI4ILjjhFleNT4IIt7PVwhLlI/JEykMpTZa533KZg3Znici7EuDt6aZmMiTRiu85/RRPHhWjj7Pe2ySdxTKw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533805; c=relaxed/simple; bh=tqMgaDDnCyjCP8Vj7sLdAJDiXkijIqTRLnupDNMtRL8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T2Wj9dbcbEI44vJf3NxIHiqfOmfBZalv+LqQ1XMtlHXDceXQbv2vUtQ1APSAI0d+2ZSN3YLL/+xHGTLAlN6mP/KR9uO8RwBajdTAi1aFNFX2Be8SV33u4rMIoc1F1SWn7UTFyNSsvFhyIEvfvhpTKqes4xRdabiDm8OcDMka9wQ= 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=xMQivzP1; arc=fail smtp.client-ip=40.107.212.67 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="xMQivzP1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f4Ye9Q8z4BMjIUT6CbzjUS5rzPMXkglxba+FMX8XbR9M1KCnI2zg+bWNzkxVtMDA5flFLMCrPHDA8Jq5HMvc5H1zLdZNXWvRz4dekFOiu/tkzCfHIUYjTpsUtI1fNvkBC2iOsWt4Wmkh9OcdcWi0jzXHoDR90CLjdUn4lRUyOZ/p9sCVgOIKVEXDH+Ja/x57wPndBaxtF6cMgB5QaoVpJZrOIFiXJigY8JJdYDNQIQJMh+9MFAqL4S8mYKMT0G2EPvi2o1l+dZ9FeDVGo39SoPa/GUBh14biNd/Uikq8OMFyaK0i7OESMC1Fgq5BceQcBOJp8iS7blh7+lqEgj98Jg== 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+zqhKq88bW+CZIXZtkwhqbuSw5OJJmvxROTIYIWXsU=; b=LeT3jVCB9/YdHcCeMNs8s0V+1Bc+LJUB6Z2PAsjIcdQWWMdRBRgXDrsj3RLK3A/xsia3XP+NMwNuXwN9pPIpnOXKftOXIaW9KXPZbJu4ZVHgazRKoI61zOB60Mc9wH2A7zYmv3UrrMY39hvyTn9PM3f33LXQm9KcCIGqCZfBvLzv6xcmMZD0y0GjI1cH2BLjYnhXW4N4zO2vK/E3ZzZtiMUMU7eg5VPizKYZmE2R/Rbd8/JqNjRk6AWaQF+q5pmChwTIpSmcPr8tp4BzugmBAfSqwbRYM28Kg1X4f3LH+KuCHCFImtBd/S7HgLxqqfsYpdRPdytZfb1O2owS2I96WQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z+zqhKq88bW+CZIXZtkwhqbuSw5OJJmvxROTIYIWXsU=; b=xMQivzP1X3pmkRIaSCjcpzR+IjaVD7RJ4fL3nA7sTAqdjbsaYpRKHENcvwJ7BYjAnoIUmyCZurlNm9URljoWYBgnUj5e6eZRs+TRx4aGrZ6huDSZ2aB4YxMk3ZOpyPRMmo04Dm+2eIx1kG3N0KH74bDYzMz8GOCN/o3RHnd4gBE= Received: from BY3PR05CA0054.namprd05.prod.outlook.com (2603:10b6:a03:39b::29) by MW4PR12MB5602.namprd12.prod.outlook.com (2603:10b6:303:169::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29; Mon, 21 Oct 2024 18:03:19 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::2a) by BY3PR05CA0054.outlook.office365.com (2603:10b6:a03:39b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03: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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:19 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:17 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v4 03/13] x86/cpufeatures: add X86_FEATURE_WORKLOAD_CLASS feature bit Date: Mon, 21 Oct 2024 13:02:42 -0500 Message-ID: <20241021180252.3531-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|MW4PR12MB5602:EE_ X-MS-Office365-Filtering-Correlation-Id: 91096a22-dc36-4d32-0845-08dcf1faa50e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: x3R1Xp8sGxNX9arxpSmE4p3951Wq6juoA6tnc9kEG808DlhClctNO07q1PjyLQ60Ci3PqXI2QbH0WtVV5N5N/hqnN6MNT756yoGzlHpIH/zelKoUF5e+O1JFvQgf+D9DTPrWXNPNlViO7zFRrcvQD1yeBFbW9WzzwQSSawKFx5IpUOBIdBu1jzgqZbVkWl5YDht9+KGYoeDmXk/IR70SpgG+RZB9M8qamg4lCqu5BP/ILNvVpb49yBO22jkPYh8WpkWQcphpZv4cLs8oupviHv6aJoJG5SicB1VWIi7Ul4YCZ7fYwFKeYigxRvvQKQyhCR57u7ASpT2D8HyT1rjL9WZCNbIme7r0e3UfTWm6I/HfY04x8I6lBXJdpskWuLyzmZ1BPqrrjxxSd4DTZPeSq3a4F0w2/IdBBhmgg6fyqv6+Y4dxq724SnXNJLxkdExKvfRdqC7GCuw4lz2cLY0n5ga1FsnV0VMJQFRmbeEGrnn1XftuAp2EvK0Qbf35Hwr2uF/Be6RmC7DpQ9sYlP89Y9Vqtnmla29QoozXgpkz0CGph89b5JElXei0FwEUO12obd84UF1nRfkUDbrOUzf4OwHipQUDTNUeiy5tXcQzAGQa03FmVFypAeGDtyFKgpua17mnRI3p4wzH8TIa1u13fDLz5q+SFgGUCwK69yJ/sJhQk5dPSTv/rxfFsrvk8eVDZPqREvUIZjw12aBHUN81ghbr17hJBzbpU9tcyRyhAd+gfE4L9N/KhY9WB7VW+GrxtZqB5wOQolLAkFq2mhiX+AdA1gQx5pD4eyRI0kaJq6qOEvwR8v/woHtqBDIHFrPGuhd5Gbb/6p3UxmQIllvEOPIkQEtQ2PSxXHFBtsA+6PEMVsu2Di1iMe6bfC0ZRPAz0IH6euTnfP1SevqFLdVloPN/vYu3IBuPRwrD/Ls0LbTyzK2PD7wo4HCdrDY9m3fY1NkH9EF94ZnEGciT2yD/62w8EdY8mC66rXvq3N1C4tIYFJ8SOqw6du1USCb7nuHwEvEgNdSQ9D0McD6v74Tq2G/ScThHb/94x1qui7/IvDqb9CHfBsLApJ3bk9Q9ryj9zHoxgSfle0M+ie+zx3PwYJOD9tXsa23bEtYydgF5QCK1taxjFQxA6EEXxkqvs1MaXK1mRqyVFMpjjtlO8CCNqE9jG8SfAwdYZVTn1/OWRzQoK2RtKbojVaKbQda21gmAV0ptGtM9v34yc5DERcUI7uzfWszYAediEClnha/cY9NA7glDzkB9u2lLCozuLc4km2MUqaeFdY3+iHKZ8IOEltAGpbGWNUqHDuPrxFa4MoSKHwM+kmEtHyk6sGwphuGYYKe8dUywld7yWDcuUcHLI2xJtyWas2p5unY+p8N29LCehIi9MOgKMMydRVNr7RqRMTPdTGLb/Y7kD3pg+Sg4dw== 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)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:19.1639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91096a22-dc36-4d32-0845-08dcf1faa50e 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5602 From: Perry Yuan Add new feature bit that indicates support for workload based heuristic feedback to OS for scheduling decisions. When the bit set, threads are classified during runtime into enumerated classes. The classes represent thread performance/power characteristics that may benefit from special scheduling behaviors. Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 7f6c9fc465293..360bbfe8dd44f 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -474,6 +474,7 @@ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */ #define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* Fast CPPC */ #define X86_FEATURE_AMD_HETEROGENEOUS_CORES (21*32 + 6) /* Heterogeneous Core Topology */ +#define X86_FEATURE_AMD_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 307a917415343..1e54332594443 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_AMD_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 Mon Oct 21 18:02:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837479 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2059.outbound.protection.outlook.com [40.107.92.59]) (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 C673C1FAC3B; Mon, 21 Oct 2024 18:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533809; cv=fail; b=Wp4Q5WEFKnom4C3VmCg5vhTU5qXJIuAyQA3MjmYtJTG4exQLcKCMJGX9WxLdCesxE7WZTYc1/f5wUmBF/QW039XFQY8WqJqNLOe4u134xQ2aLMRT5cAPucb70qB2cHsDE+wtf5Rx7u69/7JqaBiVnu8rerJ6noKZJXePNWlBGO8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533809; c=relaxed/simple; bh=6/GNpT2p5G0nMQWNGh63AxQqGIghyA/swYKFuepemJE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fLZ4Ll6z7huWQUDeEtPIYrvwAX5R5MrYmWfFYCsVhvH5YywZro8ZGvmrO148ev9W2jxdPYNw2K0iDAHBBCJP4z1HkTSktUPNRzDZwv//MsgHpgkpKxn0uTIjfxzrZeFmoJCqBpBNDrVnTXFJUY+nDWHTSULv8Ab0a9wdzkso95g= 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=43zFlWv4; arc=fail smtp.client-ip=40.107.92.59 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="43zFlWv4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JUGKj7pEegvTN0WTKwYNntfMvyPg8F59NoSz/QrsaREeE4cIgzXwk1TwsCduTVxAkf8oY65IsXjtIFONNWGZmR5r8M/PnbOOD3HrgrJGeDMuVw1Suj9UcAQL6umbgCV1AWlId3iheVkz698zTb7rZA0+m2jRaLdepmlXmpW/JK0w1OqmOAYhXn5ZY+6ZA7Te0UXMhvHaa0C6CtXPBMhN4cwuot4E4X5MEvIyQ2rdZc5wFDexq3LR3OuGbuwnNDHOlIDb2vTmmG6kWL+HpT6UmJSqGCpX1tK3aSk0jKRz1BH8EVbAThN1N3wwOJV7GeCblWZ3/+1FdVhbe5AYXogcMQ== 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=MK4bqI2kTIwrrtnwYodnqVtCHNR2bI5U4bV4Sc3i77M=; b=FZo6WeTJYS7SkbH7JrcMTk/FkO6pqaYIeug+JeHrsuqoDh5zyTGgzCnfyJsYcOPYVMMwe1crqCDnu2LvvcO6fonoc0nr0SJ4NLTqlTLLTaBF3LEwCmXP8h3dtPjyoAZHilQt7r41QZHg+vUq5Cu2U7o89uOVc51TmGfHIvv0+5hBvAJkf7rDRPSn9GO+4lajkMxNHV58QRC7iolDNJGRN4eRpXCMiM0vf/Vy1iwCxfKi6bpGqRfmIrgzX+eqgDL53v3HehILI53gXnzqNpplBAM/+VUTFJcak1+Wxe8BC0nq68Ev783+zayID3jFTQr9vCivxobzplMVTQemqh8Nzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MK4bqI2kTIwrrtnwYodnqVtCHNR2bI5U4bV4Sc3i77M=; b=43zFlWv4PI21P9VfbI20mtJDEyxqjfL56pGF+VZiIpOALgEt5m1qBKwz5bsfkaZCqHP/EIiRidpkxBuB47bqKBGkYCTUOFK23tcn7kDLc+8kKHKma+btAqPB3Fr0hfe7SCkYRfC7MwVbe++YwGgit3C0Pg9NPWx1oY21OkDTz8A= Received: from BY3PR05CA0045.namprd05.prod.outlook.com (2603:10b6:a03:39b::20) by DM4PR12MB6662.namprd12.prod.outlook.com (2603:10b6:8:b5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:20 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::5b) by BY3PR05CA0045.outlook.office365.com (2603:10b6:a03:39b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:20 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:19 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:17 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v4 04/13] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Mon, 21 Oct 2024 13:02:43 -0500 Message-ID: <20241021180252.3531-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|DM4PR12MB6662:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e79b3b1-c9cd-413d-796b-08dcf1faa580 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: /ohL2zAN7BM+9VamhhrrSs/a7YfcR9zPZK7SJeFEw9uhCyXPiYUeyrSFAoYFjFQqBsxKnk6370nuKEz33sFdJrlmbsR2GUCmlB2VUPV4VmYfBlABLGZx1omZgCWuUTpEG4T9UqEAi5Du/RZxauxvLxBtj00J09/iCTgdwGqW1m/I4QHeHptOp321eLtdlUx9av5GnfJ68KjfTNyyRjpskGx442su4ijW9MWn9AlB1ywdjRc9lNnsGvlFVfn085sM75nEwusw7qN023C9YKlaMzeMiVDfjVOt1pSxdzDSna+UKeF3KKN8nBn+ure81kBTAiUPTh+jMMRylJ9UTV3olMhvFpbXzB26qUSjDVLRnDnU6K8lCL4bdsdUlgF/et8tagj3FtEl2J44ETWznARU59aQbmCLIP1H8EO5NG8NrX8Dp4TRnvmkgAvszMNb2ZJPFGPrLoefKAUg0KQ0Eo42BptmEYXXNB0iI3GDPWH00cVcSnEueppOoh+1hRhFp9bPedGdhozT08SFMkCBxfZ5DxwO1cXXdLE0iuh4zVMh28oQNru/1u3v4YmvxMx4hz00SkVfi1ZmWz3UxrqwCiUtsCHCao6Qq04CpZIDxJgZU+sCVs6qodVJmQNxPBuqlsdT0OF0Ti3cxXQXnyoVhdSwC199Z+VhvEM93v3Zpo34b2ZX1P9PGeR02ZxgqY6LiriX9dXTyTusPqXlWEbcghwm3sfIquKH9Dg+6u3DMgc8Ji2F27/1XVziKwQPRliAleR9Xdy/U6w7E6oYWvn+JMQHx7pPVXg0LOxBmoWvKp8fKKdUEGtYNyE1LIxKT8WtZ2T8JJvm6Ba56XMaKVBFy4CNx1Q9+gdAD6pC9/xqYW76ldJuG+k+bmHhiF3HTHD6nrCH1qgm300i11SQlmXwkv/iRd85Kts6S+X5P/RmCg1KPtD2/qGPo8RVZtCx6PDQlr0jDwZaRjKp9S26hM5mkQLWmMJPh04s4a2dqOCHPsLwnWsg0TMBwCWfdYvkJN9Md2dHYra4rZ4QY7q0s3MP2FdcvdNbxTjnTLMAjxf+zVBbzwBelTDKA66QpbxFuN3BeRotbL4nlt46ZhyEGNx6eBISUcmUTbfg5tNzNChm3k0ulb6c/p9wDnSoM5VfqCrzMVAGTwSe6BJj82+SH7/o4aBvnqncy151kcy0pc4anr0eIhdljlBLhoqFAr9JXL9EtUc/ZM5pLH2vQFVkrNycoAnWwIGvq6896iGFvjbsXPJJApLNk8tTqrH8JWi+7pnBEdIBqeWdF+RnbBLhgOSkhyELym53ncQap5IRmuPT/6CivHTvph/2Uk+17FCYF9BH7gwF5CDi1STWu5Bzx5OHGz+sBS7yw0YWyWlCgBK0DxgLite00pQV60dJO1quqdap6HrlFqz5XD6DKwq73O0kIvjORQ== 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: 21 Oct 2024 18:03:19.9139 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e79b3b1-c9cd-413d-796b-08dcf1faa580 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6662 From: Perry Yuan Introduces new MSR registers for AMD hardware feedback support. These registers enable the system to provide workload classification and configuration capabilities. Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello --- arch/x86/include/asm/msr-index.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 3ae84c3b8e6db..0cd5ffe50f4a4 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -712,6 +712,11 @@ #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302 +/* 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 Mon Oct 21 18:02:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837727 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2062.outbound.protection.outlook.com [40.107.244.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 0BCA61F7080; Mon, 21 Oct 2024 18:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533807; cv=fail; b=g0/bX9ATpoJ7GFbGq2HB4xpjIu9qc6d3AdkcRyiO5mzew/YZRjmeXDP+V17sf718Hzf1gHZepeHGayU6zv2cacmgaNQl5rtLet1uVDiqfTMoe55nJik6r4JnE74ftUblM/0LhIa4AqNF9grCauKP2wZ9W4+qum8z6pGhXyUAsB0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533807; c=relaxed/simple; bh=FMXxcAYCUpYvrbOwzrI0908deBkfN2DM4IP6aO49UC4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VYE0XggaiQ1gLo/e4koN/7J7ZU8DFABORYN2EpLpodsHsKjNJSatorQgewCV71+AVO9Fxy784iV98zjg0dp8JNLdllQ2HUgg/YhQv5GJIxVGoSUln4AsVU0Pgzhump+fitx4bYcwZV83pL/t86qknD9ATTPMtsnz4SqTR05URyU= 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=EN08nwFp; arc=fail smtp.client-ip=40.107.244.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="EN08nwFp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Art2FYSp5iVHlaPiSybnzetK+3uwSvXexpfwqaGBKFQIPsZWklBCxW3Ui4P1f4/c1X4SYNAuNlFCSCYmtjqB9bH9Ua/t4++zJltjpf7I3cKUrFyB1AoGS5v7LkKyp1TkEng5WnRLfFpSabXKH/UwXA58VuaF5wD/HIOXSK0ugZr3vdV6jNqnQJWBetxeqjg976vg0LfJRKrvmBsVeJMB9RjtEjf5J2cF9OOYGoHjqmTWKggpi3JFt+u3S+xxB0o+5HtLoDOC/gB7F1PgoZ0Zuw5Ag1lxqatAq34jpzWRkQASYB1Ipygb26vN3n5qsEK2sf7cxf7iQlCM7f1OEwNoug== 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=o/abZ9mE+1cfNBVOQSEkjqWzKqCwIiNXmKNb82IkBGo=; b=Pnk+4rf0PB2r+y7t922PEArC98CVA8zWx+S6/QhT40QKx4r782X13qFwU9oMvsorlUvRReqry8JxjFLqEhTvhyxBMsKrUZLWD15j0NCOqNE815VGUgLK0TzrzvqXY1M9FgUOyRKGSA4ljISSknN709Kri9cCQ5KQM+0XexxV1ProEsH+uptQeCbMTD51TIXCkVGzW0aYq5zbrmxTnyGuUBo6RFdH1qnQcPsSpkj6WjL55OTDwNJEWSKAcxjRJ5QI1ULnT4yeU1ASrSOkMAZzfs1edVPL94Hw7cYVy2r0nF8h7SYlwC+5/Era50G+r2bhiG6FKWNSeT0E2tzN68mFjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o/abZ9mE+1cfNBVOQSEkjqWzKqCwIiNXmKNb82IkBGo=; b=EN08nwFpxPJlUkdMNyPq5efV7Rw/+g2fdMHJTcUNd7a872OuhmQZCKyu5BojlKaFJ+XN7jQymjEJYLsJlPq9Mzvsz28ZmZDx1a+XgHoTcjCdSt3vqBzJt9JCvtSLmpt4T70wNelc2AXHla/Nut45K7iK87CliRZMyAVM7J7t4/E= Received: from BY3PR05CA0032.namprd05.prod.outlook.com (2603:10b6:a03:39b::7) by PH7PR12MB6882.namprd12.prod.outlook.com (2603:10b6:510:1b8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:20 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::1c) by BY3PR05CA0032.outlook.office365.com (2603:10b6:a03:39b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:20 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:20 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:18 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v4 05/13] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Mon, 21 Oct 2024 13:02:44 -0500 Message-ID: <20241021180252.3531-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|PH7PR12MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: b7988896-b3bc-4ca0-c359-08dcf1faa5eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: QCDd80lQG95wNPp29MWUFixMPZOYupuslQLWgAArwX8zP09SGLEhUkWL9OfofON9AaVr6cmhBc5VLupJvilQxj0vSGcU+X4J+QtBfHOeSaQeES+DR5RBVg9PLkX71C7mI8lkwN1el6eo+Nb/NtHY9WnwoqP73xI0Os8AXRY0tziuoJ2rFVjHsnjwZIfmiK7eXsEzbgQqx3M6uQe9gX+0BfVzDnNOCcVpwVU6HA9wW9UzmEjidTp1rEO99RITYMYzC2/z1tMn2eqksHY4PGKw0jpr5JoNPvXvAWxwjocENHVNS44YnZ4VIUwU/ygE6AYM9J7K+FEgOmrl/xq7ZhxRkkAlD6DSIQDBBOmct1o8WOABBAemujpfN2HkKtlPY7fqGamy7Z5I+JxSbeXyBdaT6D2wtvMJMiTzhagknnjQw2t+Wv6A8pIxFdr5juAHcRVixmThmTbfbZ611cIHemijZGJWR4T/yvDd3es17ph4GopCOVjNEImf2C73E+/A2v8F1mkrb+B7BnANol04qZ14dDMEm6MeP0jL1s2c8890bAJNWalfYAcjxzvbhoOR/mNpV5syJLKhFt8bF/qAv9F8/iGui6wySgfhPx+lF+k3RvPPVc504IWk+u3Dbg2JP292wCZCmhNa/9A2ZND5uziXgILMz62V2Ic/BuOsNfEMVpL57HWrF2e5878JEePfOxBZrUCgHMQs6vl8tlZ04hSugJke7vDEblLmpQNXwzINUjBTs7LsL1tAvfVH7okRprUmwZ7Xzx+bjmISU53jSHdh/EaLQu40l2CS8VWJdzaiNYQA7eUW51pYO/QH7njiS16fDiejU4wrXJrPYzmVGRLhb/v5h4EE8NnapxIAlkW0s/vMR6FwUdmmC03xM3kIeLREtQAcJWa8zoN6qnhAy0s3mczV3Oeg0laR7k1Pr4Oji7yIt9osbA3my5bewJOUuJLY2FadytqFm+v2Rde99ToLeJPGrzDpC6Dw5opMvNSzVfRQ7Nu1sQrQXVwS3NYeBHofmzQXY6zWtoSmxRWgYmFrC87RPvpqA9WV6rBFOkdMnE/z/OmJCHYUY1MIzSrv8QLQpk73ix/Fh6RFVVR6EWHjzIF2veW75ZASAoJTQ1xGNJnM2oYHLsAxSb9XSVqHG/3P0YuIWtKB2aP+NdqJVrYsgDwPRWgzxJqYA+VoiFjnj7YEZyTthynwQ2vtk0bj2vVKm+7JxlD4/qNXwnjy/Ina+ix7fX9EO+ejMHZwnPFFb9zSJ3jnVW4SuO84ByjbqD99dSsUpAxyN7sgX4p3fdyMbBgAT6LWqow+G/wrHZrV/t0hSms+DIfMKjQHVROe2FTf13gGJr+rmeLK25scaeCFPMFin07tKeu6j/1c57BCXlu+uzTh+kGIkk0LpD4/JyOWpoBqUfuEbaHdEMIICN8jaA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:20.6171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7988896-b3bc-4ca0-c359-08dcf1faa5eb 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6882 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 Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v3->v4: * .remove_new ->remove (Uwe, Hans) v2->v3: * Whitespace (Ilpo) * kmalloc -> kzalloc (Ilpo) * Drop needless include (Ilpo) * Capitalization (Ilpo) * Drop needless comment (Ilpo) --- drivers/platform/x86/amd/Kconfig | 1 + drivers/platform/x86/amd/Makefile | 1 + drivers/platform/x86/amd/hfi/Kconfig | 20 +++ drivers/platform/x86/amd/hfi/Makefile | 7 ++ drivers/platform/x86/amd/hfi/hfi.c | 168 ++++++++++++++++++++++++++ 5 files changed, 197 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 f88682d36447c..c3f69dbe3037d 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 dcec0a46f8af1..2676fc81fee54 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 0000000000000..08051cd4f74db --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD Hardware Feedback Interface Driver +# + +config AMD_HFI + bool "AMD Hetero Core Hardware Feedback Driver" + depends on ACPI + depends on CPU_SUP_AMD + help + Select this option to enable the AMD Heterogeneous Core Hardware 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 0000000000000..672c6ac106e95 --- /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 0000000000000..a92fe74b415e3 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD Hardware Feedback Interface Driver + * + * Copyright (C) 2024 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Authors: Perry Yuan + * Mario Limonciello + */ + +#define pr_fmt(fmt) "amd-hfi: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HETERO_CPUID_27 0x80000027 +static struct platform_device *device; + +struct amd_hfi_data { + const char *name; + struct device *dev; + struct mutex lock; +}; + +struct amd_hfi_classes { + u32 perf; + u32 eff; +}; + +/** + * struct amd_hfi_cpuinfo - HFI workload class info per CPU + * @cpu: cpu index + * @cpus: mask of cpus associated with amd_hfi_cpuinfo + * @class_index: workload class ID index + * @nr_class: max number of workload class supported + * @amd_hfi_classes: current cpu workload class ranking data + * + * Parameters of a logical processor linked with hardware feedback class + */ +struct amd_hfi_cpuinfo { + int cpu; + cpumask_var_t cpus; + s16 class_index; + u8 nr_class; + struct amd_hfi_classes *amd_hfi_classes; +}; + +static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.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_err(dev, "failed to get number of supported classes: %d\n", + nr_class_id); + return -EINVAL; + } + + for_each_present_cpu(idx) { + struct amd_hfi_classes *classes; + + classes = devm_kzalloc(dev, + nr_class_id * sizeof(struct amd_hfi_classes), + GFP_KERNEL); + if (!classes) + return -ENOMEM; + hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, idx); + hfi_cpuinfo->amd_hfi_classes = classes; + 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; + int ret; + + if (!acpi_match_device(amd_hfi_platform_match, &pdev->dev)) + 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; + mutex_init(&amd_hfi_data->lock); + platform_set_drvdata(pdev, amd_hfi_data); + + ret = amd_hfi_alloc_class_data(pdev); + if (ret) + return ret; + + 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 = amd_hfi_remove, +}; + +static int __init amd_hfi_init(void) +{ + int ret; + + if (acpi_disabled || + !boot_cpu_has(X86_FEATURE_AMD_HETEROGENEOUS_CORES) || + !boot_cpu_has(X86_FEATURE_AMD_WORKLOAD_CLASS)) + return -ENODEV; + + device = platform_device_register_simple(AMD_HFI_DRIVER, -1, NULL, 0); + if (IS_ERR(device)) { + pr_err("unable to register HFI platform device\n"); + return PTR_ERR(device); + } + + ret = platform_driver_register(&amd_hfi_driver); + if (ret) + pr_err("failed to register HFI driver\n"); + + return ret; +} + +static __exit void amd_hfi_exit(void) +{ + platform_device_unregister(device); + platform_driver_unregister(&amd_hfi_driver); +} +module_init(amd_hfi_init); +module_exit(amd_hfi_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AMD Hardware Feedback Interface Driver"); From patchwork Mon Oct 21 18:02:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837480 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2068.outbound.protection.outlook.com [40.107.96.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A1EF1FA27F; Mon, 21 Oct 2024 18:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533809; cv=fail; b=EPmpsKHKT06nlXs3Clg+w443aVYY8lqqoKtcPrFGlIxdpwzpmdHDwzTzNGhaiqdtc7hUK7cTVVnBe4ycp4mhgnZoV7vDjqnj3FzsfgHC9ag7qGBOT67Dd66pEdFKJeJJw6BaL8CtI3YIWRx2hunnqPal5nivYgwQApfRB11VmDo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533809; c=relaxed/simple; bh=m9DsvIoyEVL47DOfQjdYURoN40jhquPqlSgfKI+U5o4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CwAgihi15ELth5R8N0xsrmXlsMuUaqfQ7cltqFXWEO3RYMf5Or2K0BzKreAuQfCjc/710iKNw2d5bkEkMTll3jMpinY8ejsfQ4SAXYqgpnIvqVTNcKdSlSKKKVRwMj8r6985QiwgxUq98o2JanFnsh/Dn3WVTTQ5wPenymOK/tA= 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=ebZr84r5; arc=fail smtp.client-ip=40.107.96.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ebZr84r5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IpAo6RU4SpdTNYaset4Jg/CKiWuUXCY9P0rRVPajR4Kkk1yT8rLjKbEZT5np3RuvKneAMmsG6PkLOayHZHA4EjjUyqG0WXxr1afqxmbCXLXMe/ZdtUgzZT7Ir/8CHzdgORaYRZPt5dOocyFAxfG5lGNg6uWjffii15zhI7Sa/bFo99yx8FhXQFxZOp5sLOPYPRd9zRbrn6i5Trli9tHWF7pgFEIlrA8ndPa0LwjFHAbP0Q+HuL8eUc8l3UCTZaouTHevwzZl6pV6I7emms72mV2ZBy0IaUWP/vpGinLf5+i5K6nbMgeoIB6JlsqKuEvTio9W0VukeDzHlwQ/JSFrKQ== 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=DKmKNuX7W471NSvyi+N49QiC6bAANemeibU1F0ELCI4=; b=Lhvt74mkGxnME+mTU3P8W4THkF/LApnkWVkc7xsXay+XI9l9yKyg0gtAUVZsMtAXjkaTRstd+OZr/JkZxKNewvD2Vl7UHxj/WWtazDFX9/qpivE2887O3/JqEjQCeBSFiibq1ggdl59ulxNxNuwzbo1HvbfQqGTfnBcE8sbVjim2+bmwfX+DQRW8+yv4A005O6yluZPCHFHVCwB873ai6FdhJK6PazY2A89ss5xLN9YjRXkxnTCWqw5LBbk0mfa4jLSmnI/DT41shKh7AP6pO5sfuS2Xm4geqQKwRGUOOBb7ml//gS2lNkgvR3Nl3+/woy34auIKExuOpBZmhTAZqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DKmKNuX7W471NSvyi+N49QiC6bAANemeibU1F0ELCI4=; b=ebZr84r5rB4MsVTZ2q/YywaoTazQg/9SBeEfv9/2NFjyvY0hfgn9aFpG+r6jYNsKdV5eegmAJMb+a/vT7KEVF27/MGD3uqoUQQX21lCDRepfDDWy2Kbc/v0MXZ9CILDoxl5+XSFL68a3Smyc3IP3d3/AU5bvzxOslu2bYu05uw8= Received: from BY3PR05CA0049.namprd05.prod.outlook.com (2603:10b6:a03:39b::24) by IA0PR12MB8421.namprd12.prod.outlook.com (2603:10b6:208:40f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Mon, 21 Oct 2024 18:03:21 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::ee) by BY3PR05CA0049.outlook.office365.com (2603:10b6:a03:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:21 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:21 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:19 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v4 06/13] platform/x86: hfi: parse CPU core ranking data from shared memory Date: Mon, 21 Oct 2024 13:02:45 -0500 Message-ID: <20241021180252.3531-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|IA0PR12MB8421:EE_ X-MS-Office365-Filtering-Correlation-Id: c9868b5b-f2f5-42e3-7133-08dcf1faa63a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: mT5K+0XxTmqGF7Y6F/t+0Qe3nWEhV+3jutiAgLJCG/2cgzTJro65W75F1F8yWYe4O/Zx7xpZ1+RkIk6xt9M+o8A6sa4o4SwMt0Iq7hPlkj2+y8bclxPGgZCID8rD0GQQIVOhmjFYHnwsr9i+L0F9ILEw6q/h7QrQL/u8rlJw8nPZgpTwU3LuFl3jEmfaqo/zQj9kIs924uMBic09TMy+dUZ/A3rMYkt0dBU2VvDJDf82yMl5AVtuP2l+bUOtBaI5W+7+u7svFpx8nLEi01UCvJcTA2OC/U7DZLqUjBP9bfi2VsNla05ioG19ge0FApmMgxSBj5+hxW262IF26ppufwwHWXyHWh95f1V1mpuO4tw5jn9LIn1PoK7gG6hxI9apMv25eVJn+SF7n/5wfBfykctLsPju6sv3+QDmovsxJt+5dfL9Pt3murTULYE5uxNbNPNCyn9TxqeKREvhpzzF3eAhO3Jw5dQ6U2KMGfYPsPi5gZr5WVzJHnyucKnqkP7jOglPgzIJHxfTgaCSEv1Nb1ojP63EUr2EdzrvlWO2YpIG8dJLKAg61CLQrTisquk2lsVktoZHGxv2Nhc4mi2e4E6zo+lB0DUHEXx6xJ8QQk/bDHUmBGWFT2XmibTpg0VMmi0oUEEzNIBbDZ8705LzNiyKt1Fybu2w6iHmLO8Cqd4mjW7NsmxaUmbhHqkJSGUgjcskFXnucS3kxDW4Z9l8E4ZaeKKd3nJy4hCcyJt5UEjHgVQ08BgSmE1I4JucYOEtenqWdWnM9iDznMDX5a1vqnu+zXuxvo58PHWm9wKjUwyTAW202sGgw9RqykhX3R6yBfwvqlsa6beTTdrQMTuvwzoAHgcyeTkOTpoT1YPCTzxNKJ2JnOWEP8ER0fj4D2ZMN5662aIY4lK+9jhL0Fm6j5/B2wOGmOsmPEtlnU3FwxaT4UPZejRESlOk7nwixXGsds2uOTjqtqSbkErvrc3zhM+WO8Nstd+E8I/fmYJwJrYDrGomcqpPlpIxEqRCVviwD3NepojzHORUlgbmib6WcsACOKXHkFSCoc93TNAM8SX44/c1TTp9gS9MnlJhuoEnOCSCu6Kke3W8ajwl8KFJvZeSFXQamI/vk1JZYJiVQz9dZea3afeC9u8ZBVpFiKJ81j0dSbkblrf51/O8QtZQsJF5EvMmDXLJjD6UtK7FACZPqLhnv8+TxE7NouYufzeHxKwh8HYWc9f0qj+hETdVpSngOHJp2FH/qKQaY2BE8vp/w48Dw2WdskleyDW0nhOQSUFQgc6ULx/9Slxm5BFerv4TFsqJmUqyaV6A4XeAjh2TN06SssB2lq85qFfYzOxEXEUAe1Kia1fMNcDwyNNXizRbSDUFLEvZ2MJBk6mBDSNRPgQ4pHCHAyBlDw/crM6XYAvxZLjbd8Vq13t9b6L+0g== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:21.1327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9868b5b-f2f5-42e3-7133-08dcf1faa63a 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8421 From: Perry Yuan When `amd_hfi` driver is loaded, it will use PCCT subspace type 4 table to retrieve the shared memory address which contains the CPU core ranking table. This table includes a header that specifies the number of ranking data entries to be parsed and rank each CPU core with the Performance and Energy Efficiency capability as implemented by the CPU power management firmware. Once the table has been parsed, each CPU is assigned a ranking score within its class. Subsequently, when the scheduler selects cores, it chooses from the ranking list based on the assigned scores in each class, thereby ensuring the optimal selection of CPU cores according to their predefined classifications and priorities. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/hfi.c | 196 +++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index a92fe74b415e3..b5cfe20c11052 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -18,21 +18,73 @@ #include #include #include +#include #include +#include #include #include #include +#include +#include + +#include + +#include +#include #define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HFI_MAILBOX_COUNT 1 +#define AMD_HETERO_RANKING_TABLE_VER 2 + #define AMD_HETERO_CPUID_27 0x80000027 + static struct platform_device *device; +/** + * struct amd_shmem_info - Shared memory table for AMD HFI + * + * @header: The PCCT table header including signature, length flags and command. + * @version_number: Version number of the table + * @n_logical_processors: Number of logical processors + * @n_capabilities: Number of ranking dimensions (performance, efficiency, etc) + * @table_update_context: Command being sent over the subspace + * @n_bitmaps: Number of 32-bit bitmaps to enumerate all the APIC IDs + * This is based on the maximum APIC ID enumerated in the system + * @reserved: 24 bit spare + * @table_data: Bit Map(s) of enabled logical processors + * Followed by the ranking data for each logical processor + */ +struct amd_shmem_info { + struct acpi_pcct_ext_pcc_shared_memory header; + u32 version_number :8, + n_logical_processors :8, + n_capabilities :8, + table_update_context :8; + u32 n_bitmaps :8, + reserved :24; + u32 table_data[]; +} __packed; + struct amd_hfi_data { const char *name; struct device *dev; struct mutex lock; + + /* PCCT table related*/ + struct pcc_mbox_chan *pcc_chan; + void __iomem *pcc_comm_addr; + struct acpi_subtable_header *pcct_entry; + struct amd_shmem_info *shmem; }; +/** + * struct amd_hfi_classes - HFI class capabilities per CPU + * @perf: Performance capability + * @eff: Power efficiency capability + * + * Capabilities of a logical processor in the ranking table. These capabilities + * are unitless and specific to each HFI class. + */ struct amd_hfi_classes { u32 perf; u32 eff; @@ -41,23 +93,105 @@ struct amd_hfi_classes { /** * struct amd_hfi_cpuinfo - HFI workload class info per CPU * @cpu: cpu index + * @apic_id: apic id of the current cpu * @cpus: mask of cpus associated with amd_hfi_cpuinfo * @class_index: workload class ID index * @nr_class: max number of workload class supported + * @ipcc_scores: ipcc scores for each class * @amd_hfi_classes: current cpu workload class ranking data * * Parameters of a logical processor linked with hardware feedback class */ struct amd_hfi_cpuinfo { int cpu; + u32 apic_id; cpumask_var_t cpus; s16 class_index; u8 nr_class; + int *ipcc_scores; struct amd_hfi_classes *amd_hfi_classes; }; 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_present_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\n", + info->topo.apicid, cpu_index); + return cpu_index; + } + } + + return -ENODEV; +} + +static int amd_hfi_fill_metadata(struct amd_hfi_data *amd_hfi_data) +{ + struct acpi_pcct_ext_pcc_slave *pcct_ext = + (struct acpi_pcct_ext_pcc_slave *)amd_hfi_data->pcct_entry; + void __iomem *pcc_comm_addr; + + pcc_comm_addr = acpi_os_ioremap(amd_hfi_data->pcc_chan->shmem_base_addr, + amd_hfi_data->pcc_chan->shmem_size); + if (!pcc_comm_addr) { + pr_err("failed to ioremap PCC common region mem\n"); + return -ENOMEM; + } + + memcpy_fromio(amd_hfi_data->shmem, pcc_comm_addr, pcct_ext->length); + iounmap(pcc_comm_addr); + + if (amd_hfi_data->shmem->header.signature != PCC_SIGNATURE) { + pr_err("invalid signature in shared memory\n"); + return -EINVAL; + } + if (amd_hfi_data->shmem->version_number != AMD_HETERO_RANKING_TABLE_VER) { + pr_err("invalid version %d\n", amd_hfi_data->shmem->version_number); + return -EINVAL; + } + + for (unsigned int i = 0; i < amd_hfi_data->shmem->n_bitmaps; i++) { + u32 bitmap = amd_hfi_data->shmem->table_data[i]; + + for (unsigned int j = 0; j < BITS_PER_TYPE(u32); j++) { + struct amd_hfi_cpuinfo *info; + int apic_id = i * BITS_PER_TYPE(u32) + j; + int cpu_index; + + if (!(bitmap & BIT(j))) + continue; + + cpu_index = find_cpu_index_by_apicid(apic_id); + if (cpu_index < 0) { + pr_warn("APIC ID %d not found\n", apic_id); + continue; + } + + info = per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + info->apic_id = apic_id; + + /* Fill the ranking data for each logical processor */ + info = per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + for (unsigned int k = 0; k < info->nr_class; k++) { + u32 *table = amd_hfi_data->shmem->table_data + + amd_hfi_data->shmem->n_bitmaps + + i * info->nr_class; + + info->amd_hfi_classes[k].eff = table[apic_id + 2 * k]; + info->amd_hfi_classes[k].perf = table[apic_id + 2 * k + 1]; + } + } + } + + return 0; +} + static int amd_hfi_alloc_class_data(struct platform_device *pdev) { struct amd_hfi_cpuinfo *hfi_cpuinfo; @@ -74,14 +208,19 @@ static int amd_hfi_alloc_class_data(struct platform_device *pdev) for_each_present_cpu(idx) { struct amd_hfi_classes *classes; + int *ipcc_scores; classes = devm_kzalloc(dev, nr_class_id * sizeof(struct amd_hfi_classes), GFP_KERNEL); if (!classes) return -ENOMEM; + ipcc_scores = devm_kcalloc(dev, nr_class_id, sizeof(int), GFP_KERNEL); + if (!ipcc_scores) + return -ENOMEM; hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, idx); hfi_cpuinfo->amd_hfi_classes = classes; + hfi_cpuinfo->ipcc_scores = ipcc_scores; hfi_cpuinfo->nr_class = nr_class_id; } @@ -95,6 +234,59 @@ 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 acpi_pcct_ext_pcc_slave *pcct_ext; + struct acpi_subtable_header *pcct_entry; + struct mbox_chan *pcc_mbox_channels; + struct acpi_table_header *pcct_tbl; + struct pcc_mbox_chan *pcc_chan; + acpi_status status; + int ret; + + pcc_mbox_channels = devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_mbox_channels), GFP_KERNEL); + if (!pcc_mbox_channels) + return -ENOMEM; + + pcc_chan = devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_chan), GFP_KERNEL); + if (!pcc_chan) + return -ENOMEM; + + status = acpi_get_table(ACPI_SIG_PCCT, 0, &pcct_tbl); + if (ACPI_FAILURE(status) || !pcct_tbl) + return -ENODEV; + + /* 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; + pcct_ext = (struct acpi_pcct_ext_pcc_slave *)pcct_entry; + + if (pcct_ext->length <= 0) + return -EINVAL; + + amd_hfi_data->shmem = devm_kzalloc(amd_hfi_data->dev, pcct_ext->length, GFP_KERNEL); + if (!amd_hfi_data->shmem) + return -ENOMEM; + + pcc_chan->shmem_base_addr = pcct_ext->base_address; + pcc_chan->shmem_size = pcct_ext->length; + + /* parse the shared memory info from the pcct table */ + ret = amd_hfi_fill_metadata(amd_hfi_data); + + acpi_put_table(pcct_tbl); + + return ret; +} + static const struct acpi_device_id amd_hfi_platform_match[] = { { "AMDI0104", 0}, { } @@ -121,6 +313,10 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; + ret = amd_hfi_metadata_parser(pdev, amd_hfi_data); + if (ret) + return ret; + return 0; } From patchwork Mon Oct 21 18:02:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837726 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2067.outbound.protection.outlook.com [40.107.243.67]) (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 C60661FA241; Mon, 21 Oct 2024 18:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533809; cv=fail; b=kyqbIL5kDePi9FTMraRfYEUV1R/KZuqjX+EqgHK5wuV05mm1BvIFsFX5ui5afGNvcc4vc2hGlTmKpQl5MsfhtEIvd1a8ijoC/gxAGS7fKki5yJV9YDsXVYytzBIeCrvU7Ivg8pTwF6ORxxlUT0Yre0UaIOVHGvRIMn+YaJPVQls= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533809; c=relaxed/simple; bh=P3m2c9JuF5V/pEKH9uso8u99z3oEsXSpVghxZGJV1bw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ue+ClsZrMuomWPS6VdrBF3woIyUPb5vRGKx75A1II6Viq6F5nsZ8G4RdpUStjeRzzSvleLTYPL5vbYW1VCst4CDk+VyZgyBTPVd06c1s6XEnWH/Tfk9kHMgkc8DNB65uL+8nyHnkLBjJdlPbjq6XWSP082epRZXiaW6Z3KaWbnc= 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=T87Ti4aR; arc=fail smtp.client-ip=40.107.243.67 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="T87Ti4aR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WDv5dywS7owixUenKxMdidQ6AezlrKP8lFyA6nwHdq3KQGqkz/AF/dMX+r9o5ZNsP23KHDLFA62AZbXAqefRYLkfIn0CakOXJqvEFyjtl13a3+TfCr8jrcoHpXrXMG1qoBA31SmswOMKuhbhOH2PH5UnJ+/pT8siLHBHvC7gtifArxRoQMyKCJk8QVRbpSpSNd96hd0XMsehkw47yA5bAaIfQiWQT+YCCdglI+zktdmSWnVrmS5TzM4hs6f1zHAwEuWsktbF7rxVyRWO0/bwBaS5YgqtLb71t1isthPo/fXhBpwuVTb+BT0Vf3Dpa2bToeJzl1+rLrudqVlzm7jFRg== 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=2X8xL95i8IpbtZbeSCxd8/9tjs59kBnkt4S8UPZ0sZI=; b=JZY0xPBKkBxVqpCrT+K0PeQQQit8MDA/oJVQWgvPW56UHM5X0w2bpYeIhqJkPmn99vDwWEPpDF5K0hOHs0l6ZxI8r+qOwsNysiJjfxrJlNGWrHaR+kxXLstH3eDLKU3R+L/J8tmK/+u/4xZS92MZZUM81QBEJnQsWk8McAIdhrev0NY8QUppLU/jl7g8kit+fRG5xK3DKI9DHMjh2ZOVX2dCFiJ7SmxXxmi59m0THSrLHa2J2oAXX3hTKCWt8d6b05e+/r6URGWCudWKRBv9Nun3ZrABG5Fj8yAmAUkKjmAa10tKO5iRcEUOxooOYiO2XykBatoooA9VYcEZlLvO0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2X8xL95i8IpbtZbeSCxd8/9tjs59kBnkt4S8UPZ0sZI=; b=T87Ti4aRH2R5e+1NJLo0uCObPnFLgtQpZ5AV/3yTa5Lp/AtlRKhcc5yOzn6PE4ksV4NDX6/7FJMA4xbK6cClOrUyWlPhDuy9hPt58mvbLOWCPJdGE3+aXlYb9rU7c+xi66nwbjr4oj2GftSAbjkp8WCF0xdktDlWu2qeiWGp8u0= Received: from BY3PR05CA0049.namprd05.prod.outlook.com (2603:10b6:a03:39b::24) by BL1PR12MB5873.namprd12.prod.outlook.com (2603:10b6:208:395::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:22 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::13) by BY3PR05CA0049.outlook.office365.com (2603:10b6:a03:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03: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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:22 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:19 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v4 07/13] platform/x86: hfi: init per-cpu scores for each class Date: Mon, 21 Oct 2024 13:02:46 -0500 Message-ID: <20241021180252.3531-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|BL1PR12MB5873:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fd8c602-1e20-4c41-4323-08dcf1faa6ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: w9CCgdleIcBBzLUg+TYr7AvJCWWYO2D+P4PAyLvZd8D5Qv/c84xRagfugkmNXyYHb9j9pvJEi90+PnGtDrMj4ZEbig7HenCToI4lMglqpTIvolXZdIzC2dkLHi19u4ixGAWRQLrmX/XWIWYaistmIPzWnqYg9upbXGiG641K34eKnjtq4xTClOzD39fam9bTfHxL6aie9m5kgJpUXx+Ca9jRGL2NBHDPxL/970AHooQZfRqliHSU6IUCKMk6vC7URpj4VbPDph6ZcG23PebF+AWocHpoEOIKFIJ/s9stwDWmU6nchI4+ONUlFWWbM+QuzV+ghX+QNJEmgeGxx1VUprrVYwE2c07p5K5oWmNofJjPw/hP7ebjvxR4VSO8Foy0uFT1nkR9u1nrZdyB+AtrH0CxDuaPKSZhuHA9rJfVm2SBETzT+CnreV885es2WahaX61uHeH0qxDGofXymn6XSIzF9Dh49fKcovRRzdRZwsFmsa0Pj4pOfZyxkQ6RSELdYyV1b2GgKQrtGRp0IdoivQ0ws2T+OfKRN8gjtFlQ7v3NapXV4rBn4sqq3IwkFQhEAq1PTIqYfd7iAjbZJ0t5lTbiDk2KcYVjbn+d6c7UpMn3IvMJKDXSgmazSKvb4kbTPmBEEYoL2Te4zhqyySUvf9sUzISuHEuGo7TA9As8+pJFmp2QP8phvuz3JvvAPNVq6rsvOzA5luXJoIovD1eY752Lec/0x5CxxKMU+xd2jqpbtuRXDH4Jb2bD5YoDDcli5HFhQlb+0itN8YZ0vVKstUU6+xgZmEN7Kpfzgy8q1ij2atF1SOgD0TOyBrdb1h+ksny0lJn76+KLrBFU11fmuE4Pc1oO/0nOzSGD+vfLcGWKPFKhx+daQmYCTMzDAuZGDNPQJ/JreN3Ah+3wQJhM9CYaNjWR/v6d2mFDVzwexnYvF14vEtCiWlzKOQvPTQSkWbayWwBKLfZyWPUYhD7J/MVmvWL/LCBgj6QPbdgxLrVX1bge4ybjIoWv1b1BC+UoIaEaxYfFouBmnLXo0xEX/CsV9R7AMUxLynrYzV2Ufah/gWH2QOzKdIq6RJ7BY7LTCq0eBriGYDLvVc3ZQRGFb9duzl01LRqDh9GF2ifh8JKx0d4GxSJQ4NfFlZH4SQzhDMYkmPTjX8yWNzm2O3LUZSieRLrqr5FKLsKL2ypEjxhD/KUD8V7DIE/QDOm4E3/cbqnwVSDFiJ0+n820H2vCKXy5ACucZ+leJoTSx5MldSLl/VDRzvY6HMgGzXMKTzajm9MDLKPuL/luHXgltLF6qH2D7Caqmxfzpuo0XXqpqo6kbWkNHB6AsZW4yvYdUTxTOqTbfgAIUfMlbCmXfBkZXr8snPzeLYadWD2pvdEiyolKzoawyrGRhf66If1X50sKFzU+/sHnFxlkk8xynfMCtQ== 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)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:22.1014 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd8c602-1e20-4c41-4323-08dcf1faa6ce 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5873 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. Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2->v3: * Drop jump label (Ilpo) --- drivers/platform/x86/amd/hfi/hfi.c | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index b5cfe20c11052..986ea056fa022 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -114,6 +114,8 @@ 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 find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -234,6 +236,31 @@ 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) +{ + for (int i = 0; i < hfi_cpuinfo->nr_class; i++) + WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], + hfi_cpuinfo->amd_hfi_classes[i].perf); + + return 0; +} + +static int update_hfi_ipcc_scores(void) +{ + int cpu; + int ret; + + for_each_present_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; + } + + return 0; +} + static int amd_hfi_metadata_parser(struct platform_device *pdev, struct amd_hfi_data *amd_hfi_data) { @@ -317,6 +344,10 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; + ret = update_hfi_ipcc_scores(); + if (ret) + return ret; + return 0; } From patchwork Mon Oct 21 18:02:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837724 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.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 D0C631FAC43; Mon, 21 Oct 2024 18:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533810; cv=fail; b=HSk2yFTk+0gGq/BwYAi/SL+yQiP68QDuPtKLX+Gn8Fpc5UruxaKcunNm2RcoI7bO1vJIwjXa5TGfoItNMK2JF6Z/3KXKp2+5fAoZGrNQ77WmEp3DpbBO+4OJp+3tMMTa5jLKUEiIR05EtMvMV/lEpQqZPcupeKPFMoa0D3vET+4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533810; c=relaxed/simple; bh=Q7K5xQBQbiOpHjAz+AqQ44L4GXm/BMbd+LVpBOzSLO0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d9MSxHGFyk2tf8aNzOdd+qBhLJYYfWWu5fxj3wTi4UYo2uf6dJXIfsdg5GGL8DoQxhn1cylvbTOckY7dGMCf79HIrqYwYkpLuehwh2eTJP6a7lLvY/7+OeWe537PBoNun1f9yZQNJAyNMRR0OMiV1ZJoJrGfCI9KYmyC4QF0Rn4= 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=Q+TMmpVz; arc=fail smtp.client-ip=40.107.220.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="Q+TMmpVz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dPjcdaSVqL0ZOOAjqsCrhf0/TGD3MUjxH8J5UW+AD9Koqhzu8bFFdaXYFAw+9TBF4MJAjZ6Uyok1ytOzAFCr/xtFR9XzjrnwM8W0OeqTf6k70U6R9Fke31QxNHVCeP2k8o676JoQIegTb/8mUKdqmyZcrOaWANLwqyFvJy3wrrG+ynPeZGQubgZC/lH702BogS3+xM7dyAu8OvYe1rEBuaRYf8NHEwR/W6v+rMDC7ofA2O6cl0aAQxWgyu693v9mErShJXclvIpC+XyzhENOP7wc6NEgpbjnaYcYvj8x7xYpodJ6aVtWfHk5W/8htMEG+1vaT/E5KA/5Op0TXmNIPw== 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=Ky1A5wrgkuHisJxrV5VSBFVNavppKXHK7euMKnrCIkg=; b=n6WZulp5DDVluSOcxEKA+GXKHYZSDpNFhb/rDUJOc+1JPsZtkrUSDEMAGz1/7L5fA7H62yZQq+wD8bRdek+Z/PL3XufKvwR9K3H1bUyYLzBrOFHUNMEUDMycRh9j6veC5oBG39qEGl5kQ/VIFfLehuy2CWLk4CqRDF8O6Mqe/Dow8x4ndhyDhnkFqJUelj/AqYLjkJavm5EiAyKxeihyS/UwByVy0QuTWaaqjsUY5ig5uD14oeMsw+jukRdmlghKqdWvkG66Uu3hczJeR33nuhpn4sqe3+gcTl0GBUWZhekVy5DYgmIrRaImS4pjsG3Nei/lsW6nXE+caMgS8klw0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ky1A5wrgkuHisJxrV5VSBFVNavppKXHK7euMKnrCIkg=; b=Q+TMmpVzi+gDFVHZDJF+8SMSS676BUEa7nDvRBZz0A7aOOnfokaJnJYQFqpvfXHwp0AFUjFiz6FgxvT8L8Dw5Fx1BzCBC5ZRAp2FVwOLDnxAM1Uh5evB23+sWcAoOOC2h8c87dO1kB+Sf1f+5qPrnp6U8OvCbN347ocERqARFHo= Received: from BY3PR05CA0037.namprd05.prod.outlook.com (2603:10b6:a03:39b::12) by PH7PR12MB6588.namprd12.prod.outlook.com (2603:10b6:510:210::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:23 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::20) by BY3PR05CA0037.outlook.office365.com (2603:10b6:a03:39b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:23 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:22 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:20 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v4 08/13] platform/x86: hfi: add online and offline callback support Date: Mon, 21 Oct 2024 13:02:47 -0500 Message-ID: <20241021180252.3531-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|PH7PR12MB6588:EE_ X-MS-Office365-Filtering-Correlation-Id: 71111604-9a03-4942-9f9a-08dcf1faa74c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: kE29xwxyk9BuvD1WdU/jj0OX4vL8dSEuRbi7STEMUAfPNjb6zn157ZrhEhRgOpJ1l3XJFMDnj5zrV7OXSkqlwxLTN2z0ePekvD5oh2IEzasiDzFScFLblaRsKZ7pY719OHtoyg+TldYrkQHt6QIruMKHOz6i4frICM743u5mZ4BgO8uWXtG5sY00dX407BwbbtjV7CRhk/wXuq0FE1bGMuP471ZuxB3oHZDU3wNmBPqRLXuRWYInIuBdAIn1SsbHdn4qBaUg0Gip+nZ7RT4cPt9i9AC5ZEPLz3u9r+ibI25dpVIJxsxcZ5/rR/U9vGHPRkBUTw9NYoOwQG0EY+2lP6+IsmClZrChN3/9/KNwQbhJVoWiYZ/J88sKd6NJo14UfY7Nke1S8/LCUD6Fmmk+YHyEmf8nVHkCLDsaUom1hDm7JsQvE3shGETgW2oQU/W0EYzPULcO3WOmnJPVUMzPZU95K/PEsIxkFLCoxFI4C5vgfgX5qSj+Fd9RQjRNnl6SPPuvUhZGe66M6RJc1hy7FzwRzcjqxCZPjpCVnkDrwzHyq86IR3eelg4q42qtTxaM4p0R6owA01AkdUzdag7RDdea44pPgulfYVq/bodSvTr8AyylUwbO2GTyS4CcSADO/KWKvR0U5iXdvcjzH3erWEIAQDbBrcWt+k8yK6UHK9+xXYpsSbday2Em53DDWqfI4mvSyqt1VHULs+aivBTl+M9ke11+AB4hOXTGBCi8ExhcoFz5JUqzVA1X0uoCCBC+tECjrJhRpzS8fQW4zjCSem38GXuWxSJ9nwIzMaNZCMdWctDWdOJGsgE2Vqu5uy5SXdctcmj30dDnH/9xTF5YVinWSPx870rvkSKzbUw2ExF48WXD+jVkawFbGVOwj9DaP8jECMpI9lmDLU7blXNAtrS1lb42K/1VTyuT5f2vKsIpxQbqugsPPoJL8XNPZUlMbi+Oj/qqfZMHM0oy63MmVHBCreY6WKNcFEMJLl0uu1eif7uOGdQ6M9Qr7PboFvcTMCbQxERTrHs/qY1OUDEJGU/aRxc+5GFZivvqwxNJ7xayug/cJYXqKzWh1IWghmEkGqqk/KC2uhQb5+4edG4IG/rsJetuQkWbfv3mzaxS0I88n9Rvcw3Y8XvJXnHbJT3MCPTkwIEvZ499z1EI4nYn8HDr44wV0t2BPsjLJ0nArooXwBGPxO7+EFMV/B8+78QzWTU6t5aEkvVBHu/fjI7fHFs5VLq2QQ2z64hyeaEQvTKePHDKEm0HLo+Po53ejIzIpO/CxaYx4IOaSbune+nPVJ0NlePF9nbiNP23k8MzbsEyH4/9PZPDFakmfcHzscb6Tz2SojQyiyULdvlH2d6LGuIwjr/IEoW01n9OMeK5BG+0FY0iJzN89HogTUxWZL1iWrNAYcJQEgX3L66WmeSo6g== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:22.9296 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71111604-9a03-4942-9f9a-08dcf1faa74c 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6588 From: Perry Yuan There are some firmware parameters that need to be configured when a CPU core is brought online or offline. when CPU is online, it will initialize the workload classification parameters to CPU firmware which will trigger the workload class ID updating function. Once the CPU is going to offline, it will need to disable the workload classification function and clear the history. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v3->v4: * cpu -> CPU (Ilpo) v2->v3: * Use guard() (Ilpo) * Whitespace changes (Ilpo) * Remove labels for unwind (Ilpo) --- drivers/platform/x86/amd/hfi/hfi.c | 79 ++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 986ea056fa022..70ddde37f283f 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -245,6 +245,80 @@ 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 + * + * Return: 0 on success, negative error code on failure + */ +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; + + /* + * Check if @cpu as an associated, initialized and ranking data must be filled + */ + hfi_classes = hfi_info->amd_hfi_classes; + if (!hfi_classes) + return -EINVAL; + + guard(mutex)(&hfi_cpuinfo_lock); + + if (!zalloc_cpumask_var(&hfi_info->cpus, GFP_KERNEL)) + return -ENOMEM; + + cpumask_set_cpu(cpu, hfi_info->cpus); + + ret = amd_hfi_set_state(cpu, true); + if (ret) + pr_err("WCT enable failed for CPU %d\n", cpu); + + return ret; +} + +/** + * amd_hfi_offline() - Disable workload classification on @cpu + * @cpu: CPU in which the workload classification will be disabled + * + * Remove @cpu from those covered by its HFI instance. + * + * Return: 0 on success, negative error code on failure + */ +static int amd_hfi_offline(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info = &per_cpu(amd_hfi_cpuinfo, cpu); + int ret; + + if (WARN_ON_ONCE(!hfi_info)) + return -EINVAL; + + guard(mutex)(&hfi_cpuinfo_lock); + + ret = amd_hfi_set_state(cpu, false); + if (ret) + pr_err("WCT disable failed for CPU %d\n", cpu); + + free_cpumask_var(hfi_info->cpus); + + return ret; +} + static int update_hfi_ipcc_scores(void) { int cpu; @@ -348,6 +422,11 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/amd_hfi:online", + amd_hfi_online, amd_hfi_offline); + if (ret < 0) + return ret; + return 0; } From patchwork Mon Oct 21 18:02:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837477 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2051.outbound.protection.outlook.com [40.107.236.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C95E1FB3CB; Mon, 21 Oct 2024 18:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533811; cv=fail; b=N2iA5ZGLr1EzzPVrZDrO+6iHCmVwyVFAms4SxFjPtvY3GpLU6eNqE1XnShLPiMCg+rgrajuZ0+XLKZkOqWBGmqvwrVEq4MGUdW6FGG6X4uO7wMUoQrZ/rJVBVLmDRm1CopAD4zYQVjNNO1ftLXndPjRL6j54YZkb0PYSvaTjQDg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533811; c=relaxed/simple; bh=KPzuI8HE8WHHX/zzyZJkcJkbwtWd3Vvff/paWvnlU0U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZYu7YTq8531IGeCNkDmbPv+eYGZ+kGEYyjblVh64TatVWbcHZsnoiY3JDSrc1/SS1U4ql5fvCR4wbzd6/tXg1Rb4to66qyEkKaHfwym1sNUJ9AiL7xc86aaBSmQ5ZeTfJFq5JtQaEWru6rIcKMgh8PSRvxCnxEjQO8A6kZeRbY0= 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=jXB2iAs4; arc=fail smtp.client-ip=40.107.236.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jXB2iAs4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r9a6CBzwA0/Hgsf9r+RATgLysWPU438ErN5hLir/mlQ4pZ1y5AaoSt9/nDRTUPUbyPukVeeNW6kCcBxeGP872aJCMS7Byb8m7XsHdpIXFyNqByOp3KCSxvwdIiU0RMEMxc84CjFY0Pol+RqPKwbPcO71xLSeEnlnFMn2DcBWKgqY9gewPkIh9JIlY8B0gvC7eWKZfdMooYqbmAmN4BX7sUUvw+RFN9pYGL4V1pSVDDRjRPIscEU/riETGi5AibT/KWEynT+CX3bVK4BelteVvpkKEPSyfRyl5SkqnjbpXH0mIjjBh+LJntPOV+AfiR+pCFvpGn+8bbfGc6qhfgWHfg== 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=Xq4U4YF25FviaREC9j0lyNGCKcnYOubI1fSCJ0fcrQY=; b=rNX92IYpqJXWIXxYMitTFeR1kYaZfuQWwJs9rvl72rPNMKrMoJbAvlo6AFfzUQ1btDAUSz4SYPNQyNrJtoXUGtjoA61AtUV92tFky8Qu3EzdjDpunD9uKGdPIIwZaymaCJl3sZQWOd/bq0JKL8jUautkdTF/e3HZyY2Xgg55r9KF/35cWfYgEIaM2hEWXXoHdHwOblrJIbpBHqWSN4BhPpx+P5zKvv5imf57G0+t9qdr6iC3HVUtZTG+MJKhPGhJQGvIyiVetA21MGHYRQ70iM7EuWC6HEauJuj72Eq8TH5EQg63oiq1dgxDZa6nSXR22cWfS76HYKREcQrFltT1KQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xq4U4YF25FviaREC9j0lyNGCKcnYOubI1fSCJ0fcrQY=; b=jXB2iAs43FlS3qOzs3A67ATLO7m9DALUVSFlr6/NTOmZzmNhckjMyyObNkO8ZfE1/wIRpmgetqU/KBsnN4cOnw0nJfgivlLkwnqBLXLobVsFB6OyyE2r7gQBo8Fxbo4+Nt6trCY/nzq48YEfjuoq62U4FC+s60kUM1sQ4u3dZw4= Received: from BY3PR05CA0049.namprd05.prod.outlook.com (2603:10b6:a03:39b::24) by CY8PR12MB7362.namprd12.prod.outlook.com (2603:10b6:930:52::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:23 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::49) by BY3PR05CA0049.outlook.office365.com (2603:10b6:a03:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:23 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:23 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:21 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v4 09/13] platform/x86: hfi: add power management callback Date: Mon, 21 Oct 2024 13:02:48 -0500 Message-ID: <20241021180252.3531-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|CY8PR12MB7362:EE_ X-MS-Office365-Filtering-Correlation-Id: 329e59bd-5729-4a9f-d6ba-08dcf1faa7a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: /STAUvap7c06xNrzXp4tYnbjEHnT8sNce7vRjY6mFjCAwNJBO7OtHqCwOCRHC2pzlUvL6o63xWP+l4OIzSUk9owfdhwbSE7lTf7T9iblhSleyrmdblDAOLY3i805hBoY7dN2nqx6Mz8lqsAR5RkF8IZG02LZr8wfgnkUp2G27Ot5t24/baL5qNlnEIzMTjmy3CWzWQfB5PgnDXokLYAGn4p9fmnKbEnjnWy1M7PgUYTfcRMMM38xllqsktEScqH1JyaFCtI54ZIGDvIiLCOapXSrNtttgS96UJM3b9++2864Ib8bJ3oJ56GaM+ov7ur2TKTkVWCmkUyKk1MP9eM2RfJghBh5+h/3dFE9nAELa/CDZnLtgUCzjlnpJ2B53dBruPlstQXSSlClHo8/2fsumgZmMQHs4S1tSQEbVQkQ2gp8/r+DGKz9jDYVy19PYZDURhRVBebMOBVpk7ACQ5scRe/9CRk0QcGYWEe7BjE0fU4vdB+cj/kcqYWhUMkbduwGJUJEZjnNs0EB0dV5jUvFng8nTIy1llWxbLzI1ie9KDRgiPPVJio0wS0TFJL8XQfJBGKEvKFljpBa0VQYdLrmYZFTejwJqwB/k6MeZb2ivTR9i4DE/MpZ/f/uGG4us8quareLoTaAfr/LuIDy2K4JO9w01GRWupLh5NojTdbqVxiYq8JuZXhmmIuSNXd7ohc76AriQf3a9s6eYhYaFUxaAvxwNOxYQqEc55/CYed6Qe+HptNoaXefJe0cCmuoDHNtZsrUwtIEJGKlPNP3mKHz+h9RTou3bM0wt9vK6fU3k0M90m1/GKJOcklexyDKjO9py1ennUQsQY1mRiW436ette/LR9rbZpo+dngI+XsRhJaYVxnptXxM8bh/3h3esnoCvXSZH4ZxC77hNHpUo8ldV/nNUOAqJktSd2nukk9UTusSOJ4IMXhaSROn2KSXL5vhEhTQBT0hA8vOsx1ZC7PbvrtmxorUF4Q+QnpqgZv3oAkbr/M0Pn2w5y/WJp3Bpd59l5QypTdkZy1ShBPZwvcJbWNgWIMZ+zG/74dxaKVwWrBGasBlXxBf3eX1JSgETI9rmvVa7nN/e7WIE6jgJvZNe+4tPnP1vipQSh6LKaXNAl5r6k95JhQABwQI6mhQ0W10shLOY6Iy+7u9XxkJOVCjFt4X9rD0KjmSLNjZSJ0nJulUQCOGZu0+gvZg5DS8OLcZeNeYBwAg8oEgEdTR9wc3Esyxa0E3JOrfcNnTv0rotuLtRgZfTCJHfgbMomVTRh+KLqAM4fCxjcOkqnl6dL6Umm8xL5KeFxMGKH82EHISTo8lmlwXydcD1RoQ5Tw7M3qoQ9JT2UpNhO//5IariPBj6NKyKUT9f7tluQ7ikjFnUttmTP5eldsbfsfRQgvYLr/MKM/OqnkkTqd9HCLi58V0cQ== 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)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:23.4921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 329e59bd-5729-4a9f-d6ba-08dcf1faa7a4 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7362 From: Perry Yuan Introduces power management callbacks for the `amd_hfi` driver. Specifically, the `suspend` and `resume` callbacks have been added to handle the necessary operations during system low power states and wake-up. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- v3->v4: * Use for_each_online_cpu (Gautham) v2->v3: * Whitespace (Ilpo) --- drivers/platform/x86/amd/hfi/hfi.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 70ddde37f283f..c8fe03d0c9ccd 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -388,6 +388,38 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev, return ret; } +static int amd_hfi_pm_resume(struct device *dev) +{ + int ret, cpu; + + for_each_online_cpu(cpu) { + ret = amd_hfi_set_state(cpu, true); + if (ret < 0) { + dev_err(dev, "failed to enable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static int amd_hfi_pm_suspend(struct device *dev) +{ + int ret, cpu; + + for_each_online_cpu(cpu) { + ret = amd_hfi_set_state(cpu, false); + if (ret < 0) { + dev_err(dev, "failed to disable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, amd_hfi_pm_suspend, amd_hfi_pm_resume); + static const struct acpi_device_id amd_hfi_platform_match[] = { { "AMDI0104", 0}, { } @@ -434,6 +466,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 Mon Oct 21 18:02:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837478 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2041.outbound.protection.outlook.com [40.107.102.41]) (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 7950B1FAC52; Mon, 21 Oct 2024 18:03:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533810; cv=fail; b=fW2OuXNRP//9/PKMcsjtGy+0/NmkEfoaSH6aN4m4sQoDYuiFF2qdw10sZd4HnfmfioutH8qGnJMvPYrOiA2GhbVcxiVccfXKvqRf14tZfpW/PjaT8mGnbUTN5pTbS6lo7t9yjh4TXMullIMSE9MzaZXSQH0iogAlaXu1HpECWiE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533810; c=relaxed/simple; bh=WUMJ4tMFtI9aLeB6TwcfcVLz4Cw7Ep78f4agmYwg7+g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ait7G2Mn1vO9HHGLMhVSuJcjpySjh6YW/175y+O4nevHEOkIIlZut3PuZf0s+JvhVmqHXwzDEKk5b9uhH+JsdzCCyAdx7BfX7Fg4/UyxGZ4gWcTbpqzgJcsLRzUyShvgT34vAkRs/1f4JqqSo7GnqRgeO2fO8Ty9VniAGHrOVuc= 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=aB5E9h0S; arc=fail smtp.client-ip=40.107.102.41 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="aB5E9h0S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m5zOSGQX6iaN1v4srZ1XOtctnBhGhumI6PWwOfbtQFu/bthKQWCn31g9jOMMa7n/eeDHNLcSqiZcmopytQ8QWR+OY4WzxqOhwG3HUL/bZsglky6Z7kYfNiezcSOL4NrF/TGh4u0kkhNH08LKRk5egN5+vSISU+dTYIsOZT6hQvLMKs/pLaiOKJIbhTVRd23xjE9rIrPhzmL84EKCJuvj5NHAj0N2wQCVKnUwnytYS+PnFHUePbGmVKLtxv1xNNGMFuFGJT5bDoc9GG6MFCcmLIwk0bHIw5w3Aqbx8bYsaroF1l+kIGRuVsHn27GJURKVz0yxvArmnpxLqeCwE4iiHw== 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=fG23CyCbUHpkJ8l2ycoJy26nAaExlnKcYSpDGGV/GEM=; b=uEH3yB94trQ+eSZyFZDH2TAUiYKEWO76BH10c0qjLnXzmx16E4c4KpCoTJeC78YH6vraYFerXpkM2bBGcWd0MWTcpY71URkOIXS459IRAUf7vekX8Yl22Bajb7bsZFia8rR5/h8WbsWV4Nk9cBPu31c7V3QtYnMxoGrJ+cjwC2UkHWcQgAChBRw9dnORrA4MFcTGnYnmDsNSpcVh1aTh6cV0tSrqSNAJAuirEGOtBZ2NLJYqL187ZcGU4DuDIqjsdZCJsjsuVCkFZKRU7LZphBvBec31cz8wgm3kX2Lo8h1g/UbDjcM/po19jbYyV3I9B9JHtSOXwtEmzq4YTc1UKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fG23CyCbUHpkJ8l2ycoJy26nAaExlnKcYSpDGGV/GEM=; b=aB5E9h0STnYwlTKXhbDgz7t6xIhB5aAE8Q6lWfnv61tcWSR0EuQozLIoxkdd0/s9F6eT9Nnz7l6BUeuvX6km558AxgOs64Tn/+Moihup8ghDPSCq7nTNpSGhIj0dPYDGCfRy/A1nKp/UpcD+IjhytrZYRE82cg1mmomlPFz6A+4= Received: from BY3PR05CA0056.namprd05.prod.outlook.com (2603:10b6:a03:39b::31) by MN2PR12MB4110.namprd12.prod.outlook.com (2603:10b6:208:1dd::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:24 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::1d) by BY3PR05CA0056.outlook.office365.com (2603:10b6:a03:39b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:24 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:24 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:21 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v4 10/13] x86/process: Clear hardware feedback history for AMD processors Date: Mon, 21 Oct 2024 13:02:49 -0500 Message-ID: <20241021180252.3531-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|MN2PR12MB4110:EE_ X-MS-Office365-Filtering-Correlation-Id: ac4828cb-97c7-4c0e-9710-08dcf1faa806 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: ftIeH/a2Aqtt/FYwZyUNfMBnkglowKgTimntiS0uH+4n8nnEKNRq8KlLpar6edpGCBPrtWdAYkO87PryskZTozUksQ61rMEn4/Mo5IL41Zfp64qAyG1U36Pthh0c4nemp+yqlPBVSBja0is3do1Vd1fOWhSP8VI/ZeiM6Tgv7MQsQin65aKNgNBP/75kb9b7I+u5R+LJ7MWJ/0FNJgq4rR40Av6F+FddKepPQ1qkHsr6aobxflWGXvC2RKPPDPZPRIPIAU42jSzv8DF4VYiER5l4zsztISQ5fIypJA4bdIXCJMbBaW4NVyTmBmoJYESZkwerTNLivGa+NUlRhju8vEQjoBnRzyzOIBYFzK67tcqeNpXHmlaUiWkon7WLTyCMhWdP7sEv+TgekpmizOvwzqvZgkTN/6FTeCYY1DJfHonUXGXtCMFxyObKawvHZPR36eYv0Yuh/iSE9geukve/XxFLtQm1Vm65sQQEtJva1GZOtaV6k5uxIhcfzG+k/J8yPtxVw3ptBk/RtGWpaq3W5dNHsxYJdr5ukvNMVKkf+jXRyf4gMEZu3VaqwzECVQHmbipBGxJOyVKMZ5VqeI4hiTwp6Syqaz0R1Vq1fMAR3mqXgjTIWy4JXcmsq6UXe1UWd7ZVRDGdpldefQoEauYDYFjZXD/kqD/DCNpKZlXtrR2TauyHhy/52STypUvZA3AdxIcSvH/zZ5akip9z53tv+Ml7IBEsuCpsniOWwnWZSwjqMFbINCnNVXzXcu2pNM0u9UjBJiCE4u9B76H6S+bHYpF5+YkM38ElmCXSV21Sl42mO9BVUJUr7w/a7rTd9a9mbVSCFGazE0z4/qokayu1EFFuozV4RO27sO3kIi/zKLrZCBd3Voi9BQWsMxRHCXL79k1kJUjKl+D+dF/+FGI62A8+bKsl0IuKf6CbqqJBTomBR2FsCX+dI26MddI3JShFcoBvUG5vjNGJEJuaYIjNc0rn2hLolv2Bj6Miem+JJ1G96J9w5g4yeMN/6IShAU87n1J6wy+SVQcAP/ocfrhmybvjbdRGi3ZJyb8mUjgM+uQ6ArUg6QF/66jSFGGSmpspJR+/4NBHIeYZfcyBzL5aBC2+jAMlzExczuE+dnAns5BhRrqYwnMnn053sbWsc2bi9DrjshZhRAL1r4zUqkwM0OJmFcY+rH59EkBKYkWiWySlJGrH9kTawx6yYk7+LkHcufxbkM+Xiqxh9HIr3Ud08KpIAHyNLV0Pxf2I8GUeFroBo/wClgRmXLQ/2Wc8hIPMngCG7+mxU6QrybLLkr7bbtGbfVW8hwAoxnv8kI8Ee67CoaolxdTGzR+A1edYXpycjIMZ/WRm2HorFauppXBasajuyDbugK9Hj6nuh6E9vFRGYfPc2HdRPaNNBSVvT8Y05yn2JgFYDN0ZAcqmwpbdZA== 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)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:24.1483 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac4828cb-97c7-4c0e-9710-08dcf1faa806 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4110 From: Perry Yuan Incorporate a mechanism within the context switching code to reset the hardware history for AMD processors. Specifically, when a task is switched in, the class ID was read and reset the hardware workload classification history of CPU firmware and then it start to trigger workload classification for the next running thread. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- arch/x86/include/asm/hreset.h | 6 ++++++ arch/x86/kernel/cpu/common.c | 15 +++++++++++++++ arch/x86/kernel/process_32.c | 3 +++ arch/x86/kernel/process_64.c | 3 +++ 4 files changed, 27 insertions(+) create mode 100644 arch/x86/include/asm/hreset.h diff --git a/arch/x86/include/asm/hreset.h b/arch/x86/include/asm/hreset.h new file mode 100644 index 0000000000000..ae1f72602bbd0 --- /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 07a34d7235057..658c8fb4e25df 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -403,6 +404,7 @@ static const unsigned long cr4_pinned_mask = X86_CR4_SMEP | X86_CR4_SMAP | X86_C X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED; static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); static unsigned long cr4_pinned_bits __ro_after_init; +static DEFINE_STATIC_KEY_FALSE_RO(hardware_history_features); void native_write_cr0(unsigned long val) { @@ -481,6 +483,12 @@ void cr4_init(void) this_cpu_write(cpu_tlbstate.cr4, cr4); } +static void __init setup_hreset(struct cpuinfo_x86 *c) +{ + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) + static_key_enable_cpuslocked(&hardware_history_features.key); +} + /* * Once CPU feature detection is finished (and boot params have been * parsed), record any of the sensitive CR bits that are set, and @@ -1844,6 +1852,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) setup_smep(c); setup_smap(c); setup_umip(c); + setup_hreset(c); /* Enable FSGSBASE instructions if available. */ if (cpu_has(c, X86_FEATURE_FSGSBASE)) { @@ -2410,3 +2419,9 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +__always_inline void reset_hardware_history_hetero(void) +{ + if (static_branch_unlikely(&hardware_history_features)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); +} diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 0917c7f25720b..6a3a1339f7a77 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 226472332a70d..ea7f765c6262a 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 Mon Oct 21 18:02:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837725 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2067.outbound.protection.outlook.com [40.107.223.67]) (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 96F2A1F8936; Mon, 21 Oct 2024 18:03:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533810; cv=fail; b=dnsUhjMLFu2aZVZnYBkJ6CjBckdiVlhKxWbTmHX9G6lCv2gjpnEkQmSsutd4eoVnbQ3uwlIfz/rfSfym9+RcmQAhMSTXx5eiBoua+rloZkIUVvayTsg49AlVgLZQlB6a7JYpbvsg2Be5HpE3ZpEekiZh82aenJgD22DV7yXqKD8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533810; c=relaxed/simple; bh=N2X1daJNxpFcwk3aesP39bqcSpNu0EodGBbGgZp3sQQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lLFVj2e8PUXwiStiJc5kZQvL6uusb05ITdYG8bAUwxt6nc0qrPLxxP9U3GUaNyFJfD9SAaOsiMdzBK2SAseLjcg1ICk3YuJRMA9PgSrq6G9N3lUTuZ9xnZecgirG4Uh3fvzaLDTbMeYCpb6MuitPF6ZexK+OLiGhwiwqSYb1HNE= 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=5bBrpXa3; arc=fail smtp.client-ip=40.107.223.67 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="5bBrpXa3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EzdyX/jFze0ULg9/rrK+hgxZ8xV327DmrBtqTLtVnVGp2uU1lb2QepLt9MBiPwFfqvVUmJ6JsZe9RdbNL+3M8VnE6/c8julj2hQ9HOvdoU7by8x3EZhfxa8POtM05o967j+PvWZEqF5A/6Vvmt1ThWZoxZUlTMNgHrkRUpw317UBiv4Ni2K0CNuYO/ORAOGymu9b7cG4dHpQKM/BCPXAcaE47t4fWStGJA5jhIoI6fXgx3l/BPr3WKpCKvjti6ghPKSfKYCkMSNM3yIiW8+6BGpMr9Ec7qHfRM3WI+vae7tnm3K2g9ozWxBd2UZPLCksqB/gwT00Q7So8oelKU7f7Q== 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=kVP+U8ii1Mg3eySxgqncAX3dgI3Dzxd8w4v5szgkmeA=; b=I0lmVvpzdCquk8jjFNKRURIUJ5gaOR/y51TKW7atCpKK4+k9+Wmk05zyZanQILq4hI2gZRJwjnYWD9m/2wkYBuPnyCBcmfEdt/X1EciwwOpfkeXaMsfkEZKAoU1q9oA5ThBeuKj5rTUQs5XJ+dYgdvPHMVmM6ouEs7mntjUSaZBV590ittAizRgXxoDcEB7+Aa8fubUwCP2fLarUqm1YG4N+/1k3wz0+xn3UV0Tiof/Yk9b1EhGnmmLjgtEsmJL4ccku0+igWpZukkb68FfaOWxSBIcIIEeLPulGou6Pv0iW8e6fwnLyqt+AHERwNs3XwO8kvKxpFJkirZy1Ozao5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kVP+U8ii1Mg3eySxgqncAX3dgI3Dzxd8w4v5szgkmeA=; b=5bBrpXa3Ew1NhtLFQXsAYs38bAHFMpU5M0nbNCOFdW6q3HhU6qnSU00M7RqL6jsZLtTV334asOlvg91si3hSLMXC31ri9A9ZkF6KLDg4fmX7vct0K+BLWVXArocu/Z0LlPjRa5Vdxa89D2A2E1U5zgmoxB7Lu0fhOpe+MWlMECk= Received: from BY3PR05CA0046.namprd05.prod.outlook.com (2603:10b6:a03:39b::21) by IA1PR12MB7688.namprd12.prod.outlook.com (2603:10b6:208:420::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Mon, 21 Oct 2024 18:03:25 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::55) by BY3PR05CA0046.outlook.office365.com (2603:10b6:a03:39b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:25 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:24 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:22 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v4 11/13] cpufreq/amd-pstate: Disable preferred cores on designs with workload classification Date: Mon, 21 Oct 2024 13:02:50 -0500 Message-ID: <20241021180252.3531-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|IA1PR12MB7688:EE_ X-MS-Office365-Filtering-Correlation-Id: 08bdd2fc-9e39-49f1-6a9a-08dcf1faa87b 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: dCNUeDBIXlfkXYx8T3POI7cpErfOgenbS+47lCkObQFUy6mn6BNghxp2VDAdJW1UHUdTQDY+p+wajAEyyPVAgj5rnxsqVMWdgXvnDYNBxvqzcSNE7/WnUtRzpiioRNib0ngtroEP/JRa2BuQynZtb98ryzUApbcYDlvzYkUoK6BLDEhHTS2yHwZsUWYYSeGBBTnj3otQnOKHp4i91ZEc78aUP95zrpmM1hE3d+alU0aKQDGSPk+YLzW9F3bzl6Kolyde4kd8exlLmEWRdgwLeEpaQgHUSuhMZSVEXkml/WZIe7Vu01lVIQAAxFV5tZgamHmId7DM9UwI0cWTK1GZr67QcHSYUrWN4Ah+fVFvwKqhM3iF5JEv0gyHVB7aYGZYOPq0Me/Zt/KsU3rR6H3KeRHuPDXubxyGp/zRL6M+Wo6ySupxunHBeksk0u68FHiT+g4nIBLF6bsGle1I6QcPYowufYAJLMJQEW166iH6xGLu38oVLDcaR3sOZm+xLv8sDmEpxTAgHrJzgIjYWUUjfN+hKu8awGiqx9Y7AAA/j+9tuMi7MWjCqz4QC4l6y+enJXdm+XXKoZLmM9oD7Ej/HJNBdS6Fs7YSbQaGtVArVixwzeL0p1zoLf19Q9H0XmYxzephP86E1oC6vd/3jLYsVwb68NoeXj9pni3BzHPqeZscKFIKfKpElGiAHbMGyes2v9mG5IkhJH3/726t/W3D3vm4UiF8jXat0yfHfQmDPBpDqXUxRl8n8AoIX6dHar8Zko0RuAyUxb6ysaUzx3Wrj1CKy5pEJrjnPT7fBjzc/Xbc20Cm1vVvh8R6UhT3D4jlgMVC+Qg6gQfp0c3ZQmoFuyE8cKCd2sEtlkGFGPDVubj1M8lRbtDwFrd/xI8Qhxj5PHvL73MG8WPmsDsvqaThZ+NTO3nM8ri4GmRxADGE8X8yJsNzq9N8i3+se5T/nsvcRpZaUY/fS9vNngnXXMy+b7Pmh0n9EcXM4iS1MVozUH2dkuDQUJoDdQ5qaXxT7ZGoP01BBSZABKvWWj4lK+VGMGqkJVaqIWVmaY7IWS5bIN0eas2U7SrPA2brHEzPmUo0Z3xvo37X/a5SIjZlRbOxtvqz4PmhoWhntGNthgOTZniZooYboTbx8+V/9IWZDWQbsDIyngGMJa9hCNflUENTrPalEZAM/W8641h4gHaOAJD1nAL8y6u2Vn2H7RXx4lVV1HcSIEhk8B3NomXMjqGSq1L+FXyNaSnL0DLwg34wMkHKviDDZj6zo6BoU+he3GIL9b12f3WNogSLyZPXJL7rmC66JYlQPC0Qv4TuIWZl89l92KaHl//qkdWtpFRiV/ctnwyKkCRaSa2OZ71oMaEeTfPkX6jkDGjcwCCEzACQLfjbWBS/oERFJP0HRIO0MyZy0juu5HQrkV/x4A3LvhkOlg== 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: 21 Oct 2024 18:03:24.9140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08bdd2fc-9e39-49f1-6a9a-08dcf1faa87b 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7688 On designs that have workload classification, it's preferred that the amd-hfi driver is used to provide hints to the scheduler of which cores to use instead of the amd-pstate driver. Signed-off-by: Mario Limonciello --- v2->v3: * Disable prefcore sysfs file too --- drivers/cpufreq/amd-pstate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 2670bdcad6eda..4dea5a6f86c11 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -782,6 +782,12 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) /* user disabled or not detected */ if (!amd_pstate_prefcore) return; + /* should use amd-hfi instead */ + if (boot_cpu_has(X86_FEATURE_AMD_WORKLOAD_CLASS) && + IS_ENABLED(CONFIG_AMD_HFI)) { + amd_pstate_prefcore = false; + return; + } cpudata->hw_prefcore = true; From patchwork Mon Oct 21 18:02:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837723 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E27A51FB3D8; Mon, 21 Oct 2024 18:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533812; cv=fail; b=F9mOlqzzF34f1uR/uHNM+tjTTSBwbPuTINxitlTc/cXME7d35ypSQOWTxYVyyqXWHMsY4CjoMGxCoMZ+YwZFbQbh84DXXxynui5PTVMN+pWsWDETBsvRWJ5ouftSEv/ZXY0AR01IQc8qG409dxwvBneyo3wXwQpWDpMUiTsGzH4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533812; c=relaxed/simple; bh=v20A+qYcbUcJYDh1KpTP4gkfDSx1jIxGDQLp4XRswGw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CUwFMr0cLSdDGz34fVrJ0bbQFJyJCkj4h2JGMDk5DQnhFCse1cCTfblWX+prd8HdRZTI3F2SMO07mBWOtxU+AfA8x8tDXYQS8gaED9jTumvdJ3I+IPU+/RxgrA1pERvzXVwl8BZaIczHD25aeGMKHO0rJ/dm2xNXfny+kQODNmo= 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=dOIYQ6fm; arc=fail smtp.client-ip=40.107.223.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="dOIYQ6fm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s1AU+ajeFOAC+m39BUqUcYJ6+A3tfCLS0wGrWowiOk9AS8OVTydHTyOvitlGsf5U16hVsFxYK+enMgbIkw+JvszgeviQ3RRW8OSQrxglm8nzj+iSrCYk0K75OCoClHiT8Ig278QEeEAdU61snOz3h6vXRJeCh8IHBgIGNi850syj0+vX2wbQuvnE7ahTwxoa2Iwy032skAfOG0ILWhakU507HiVtfMQlyKqxZGEny52lW4DdQKKMG220DQvhhxdxXDRK8nVaBESQMglY2bfCnGfr0PiGR2l980W5JW7wLM3qPl/6y+z8Rlg7jxQQguCpwK95VqsGcKX+5DvQJeGZtA== 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=kxV7Q56HF37N215gSoJzMyoaTl4ZgHOlFr7GHMSiEq4=; b=wVl11OYOShf3D5CA/tRK7aurmp1YGohIT3FYBEKhrPuBL4ITJWJbGfQf4NMrGdHX7zn3skc8/lWKyUYwH8rVE3m3UAswqItKbzloOTWs+7GK9BXVA/L4Z3D2lHFvGyonaCt1qAA2Cl4MRpLcXFwbXt8dIu3ppYkY6na8IJni7iTtZzJeBqYNOBHjM8TdDcJ1zKRcRzRvw4UiUUUpt8CUYRT2ggbeigaiQcCM9evMnkLeG8DfU8QxN0CSRnOsS4J2JKYRTf0Oc83kuZnQzAVxhklvOeXdCr6SFGiBnAlnApz7MAZF84QTm1KwssZDz317HwNkEbTd8Cy3/khZ5BTPuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kxV7Q56HF37N215gSoJzMyoaTl4ZgHOlFr7GHMSiEq4=; b=dOIYQ6fmXMpGKHvREDa8LOs/rsgcHNuzXUg/WgWZ8SA0GlK1cDlhRzCj1LKF1in3f0V4j95mxzRqr7yoouU3pB+N5E4eJuVNeiZnL5QNNMw6l3mpw5twg6YL6paYeBn/bUAzeKiR8CO162ef+EuKwaX/KG5fjhDXcgiU2qTKS04= Received: from BY3PR05CA0054.namprd05.prod.outlook.com (2603:10b6:a03:39b::29) by IA1PR12MB7542.namprd12.prod.outlook.com (2603:10b6:208:42e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:26 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::ef) by BY3PR05CA0054.outlook.office365.com (2603:10b6:a03:39b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:25 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:25 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:23 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v4 12/13] platform/x86/amd: hfi: Set ITMT priority from ranking data Date: Mon, 21 Oct 2024 13:02:51 -0500 Message-ID: <20241021180252.3531-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|IA1PR12MB7542:EE_ X-MS-Office365-Filtering-Correlation-Id: 590d0aaa-18fd-424e-ee6f-08dcf1faa900 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: 56Z5G1b46TrD5LN7QN66DctaxmAJxTwkqkfnKjP0LqTx8GbWJsHT7qMbdnhm+bDpZMdtb7S1p1gKTQ4dgceKDHlaDiIbmtzTdA9vKWjFrzyeb8/KnvB4etPXHkBYXA5RusmfitAWoEHdXVUUu5eMsOunaB1p0tlx/WlLxfCOBRGJkDt6j/Z80JIFeX+l1LxcoxqydrQClsOYpvpGs+vfY7fsEqUTOelvbPysZv2AGGni2ciRhYc2kjiw4WyOjwgfnTLMsCX40piCRXQvYhOdtDuNJkEAO7grX9Z2oZcyECcPgZPmxLsBfK32xrVMA8onImqf1oUlBdn4Gc4ZGDk5i+WEsLopdhh+byD6nzDLIwI9y5e8DXq3wDzL6v4wFGx/ZPhTt1uZignqKxsnRdMJXzX4LiGHBK1kVaKc8Q2o6BZ7zRLZDX/94GPx/HDh6nKaqit+nqPdCPm75EMdpr74rwI7BEZxVa5xv8/q1OIqrgIxfNb2MoTqfori38rfEeCYiKMATAjNEe/kWrOzZ/OuiS++AjmZ5vdYG74qmddqYiAghkA/kT6COUs2pxSClng27RIBDFPRLngJ+YNyiXFQizLjGOKXgG4vR/aVNKIG+T5+R9VaIsQan2vQRxz0I6bBZOuvf8mgNKBzX9CYG7ptwZTRG/1uxOaNVl56V7oeAxr5kf6SHPVCDc/1zo+kT0zPZhnlTrEZxQtaOTziLuDLaqSVt/pn/bamOlnvU73dBjMyCQUVArxst9zj9JJvQCZ53kbuEht4VTDPP2bxSYg/QromQZcbU1ayihWrEUd2CjxM7hbLxt93uthFadvn+oDDwpNZrMxpEG29+yN8bZO0H4+PCiMFa66IazfmnCd4GZJPGwZs0pQGMWMojznLB7Y1GoQtqrbcqcK9TWqQ8s4KegUS5oOHGWB1oHXG+u22e2vadwOo0lJziUvLjX9DnmkN2KB95S9D+CgsrQxx3hoUqjoVBCaJzapbdQccJqMBh2pD+qoDxoGYJysaMQ2KGpURtzAE6CreReFnY3ySFCCnEaDmI6brC4ij7M0bOIZdHY+KmErHSF/sG587D+f5lnfCpoS/bMZs/S9Z+OC+PXktgY0ihoQbDLqXnmJ9mrMzmySwwCACsGS92U03OrrLy8ei7LAq5s0ZJQs3Rhs4LV3O7DPM+jkQxs2gVNE8nqol1XaIZmZt+Ph3eQUtvo6Bloj26+9c7kts4n53t1fjRQrvWxKtEEWtPUwQDT7JhwPNnGSwj+e/J7eXkwAZSYcUHvHJS7O4HydcmAs0tv74EpOoV+ZhnDsfE1mIyLqN04C6T6xyWkV7neoMNwqoWmTQlk7m2TCinIzWOXJs0iyqp27zQbAjrZgKSHSE8glWYTIhhGMZz5qzijViNwFML8YDbDK5uQhYJGE/gER63aigBDJCEA== 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)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 18:03:25.7890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 590d0aaa-18fd-424e-ee6f-08dcf1faa900 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7542 The static ranking data that is read at module load should be used to set up the priorities for the cores relative to the performance values. Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/Kconfig | 1 + drivers/platform/x86/amd/hfi/hfi.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/amd/hfi/Kconfig index 08051cd4f74db..4dfa7641b35bf 100644 --- a/drivers/platform/x86/amd/hfi/Kconfig +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -7,6 +7,7 @@ config AMD_HFI bool "AMD Hetero Core Hardware Feedback Driver" depends on ACPI depends on CPU_SUP_AMD + depends on SCHED_MC_PRIO help Select this option to enable the AMD Heterogeneous Core Hardware Feedback Interface. If selected, hardware provides runtime thread classification guidance to the operating system diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index c8fe03d0c9ccd..50407ab805169 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -116,6 +116,12 @@ static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.class_index = static DEFINE_MUTEX(hfi_cpuinfo_lock); +static void amd_hfi_sched_itmt_work(struct work_struct *work) +{ + sched_set_itmt_support(); +} +static DECLARE_WORK(sched_amd_hfi_itmt_work, amd_hfi_sched_itmt_work); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -242,6 +248,8 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu) WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], hfi_cpuinfo->amd_hfi_classes[i].perf); + sched_set_itmt_core_prio(hfi_cpuinfo->ipcc_scores[0], cpu); + return 0; } @@ -459,6 +467,8 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret < 0) return ret; + schedule_work(&sched_amd_hfi_itmt_work); + return 0; } From patchwork Mon Oct 21 18:02:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 837476 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 DDFF01FBF7F; Mon, 21 Oct 2024 18:03:31 +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=1729533814; cv=fail; b=A3sNBJJpRYrJzKwOmkraRHYYgnQvGptXs7PMh19MpPbqfZ6fUlakX0TKV4bYHPL9KGaPSxDLWpzt/lvky9FvgRjxuXMutSyDFOH2vp2tnZWYz7znhy7zjYNotXmkULlZUnYJX+eqDU0gDl5yKb83jnheLIS9v3cos39Gb1LlijA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729533814; c=relaxed/simple; bh=v+nTus0gD6qj+auBQQHGfkWKR/9AiLE3GwDUj5LCzmY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AxBsZjCRxn5kqrqIBISDrExZzd1edWn6Kk2mIzVsfyaMeWKmpU8F6pp4SXSbDtBWISXF/CS9UPxneZU0irBbML8H6yugS/Brf9mbC4V0BlcwxUu6xDQUmB/Ge1wwGZ9nlfJecyPCkL1TsctZl0k63lRZ0auqHviiwfiMJaAqgQw= 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=v4f3mYpa; 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="v4f3mYpa" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o34kzAfhDUPC/ae6/ZXGPaOEIYhwXC7appi1eylbhzSrHBOZqcv207jYrbmWHmOF0yoXIF4Q/0VkQevSESAPEwQ4HVCHbbn8SMiLg5FtXvNzJNTePmLSEySPVEittY684XuyFzdrMUXOt+Er+SJN6C7rCDi/m25JK+5j0Gzi6YAepglXCIQ82Cfj0oXfzDfkW3kbHQ9dSHm0F2SfjIazN9crIsbb43iNKjmQN2C/3fnRW53YkJYyVA53r5IsYxIB/uY5qAOMZy4qfplVQkbMITIbMbpVRfsKQpn3cBEhkcPKSZ5CT6lhM9RaBnN+NAJcRjMWltoUKZOR/WLZSZB4KQ== 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=Qmr49eQLPrG0tFYXwCTU8c79T4nfEKV4Zezby/7jkJQ=; b=QhdD59u85KNTAA9TMmhOBg1IWOtPPm/bF5wXNwZxrAej/oAqAqYq3Zh8/z3JLCkHSY0jbuPajqK/9m/+J5Dj3STwbLeNrbRG886p2UVU4aVtTlT/DNBt7vQB/EG5Y5p6z9MukZpAjCzaek20f9Hf6P0rwkhvPWWtFjO8W6GS0orOxS9E0XRHU4cIV90GLvDlIhCqWykeeRl8uxrJ7qciTBrg3YZDQJ1RwCsrDICMPQcpEq1EotU/OTqiUGV7zai5od1S2ABpi9pVGhKYN99fp4nLEz9Ib3R8cTn1v9Jabjb/YRgeXE5lUzALey7LgjrjTftYAqk2aMZN8KJ0TdKWww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qmr49eQLPrG0tFYXwCTU8c79T4nfEKV4Zezby/7jkJQ=; b=v4f3mYpa/4E3Pp7vZQokHic5IqKLFFLhh51BUrtIB+EEFN8f9VRAAZAL/TKzJWRmW3O44FHFl1NjDR/lm7cpSZ0T0e+JRszjF405J+R66eBeRjovM9CDaoJN/lqLvqlds8jx76LrnDf2vnxlYTuRNBMs3DqAxEoHal1E6QFQ7N4= Received: from BY3PR05CA0036.namprd05.prod.outlook.com (2603:10b6:a03:39b::11) by PH7PR12MB5655.namprd12.prod.outlook.com (2603:10b6:510:138::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 18:03:27 +0000 Received: from SJ1PEPF000023D0.namprd02.prod.outlook.com (2603:10b6:a03:39b:cafe::71) by BY3PR05CA0036.outlook.office365.com (2603:10b6:a03:39b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.15 via Frontend Transport; Mon, 21 Oct 2024 18:03:27 +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 SJ1PEPF000023D0.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 18:03:27 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 21 Oct 2024 13:03:23 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v4 13/13] platform/x86/amd: hfi: Add debugfs support Date: Mon, 21 Oct 2024 13:02:52 -0500 Message-ID: <20241021180252.3531-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021180252.3531-1-mario.limonciello@amd.com> References: <20241021180252.3531-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D0:EE_|PH7PR12MB5655:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a1710d3-8f52-4a87-bd75-08dcf1faa9d2 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: IffY0QXVPI/83oy5zr1MgO65zAjpy+5PS/bU7DBovmVi44zi68UWuoHx7aHZFnlAtX8xJDDLMGvljnBeSkBIVWLrBQa8qqV8UhUrldS5xMzRukBZF12d9jcnqORvhR/YaR6wUxU6L5bDv1L29YGqzuBCjZojfxli47bAsn9xocfpTFPnmNeZ33hMo1ilZ/9N+kXdzTMOr4T+JHjQWkoiqmPzKb48Q7faEi2CMpOncStvWmQ/9OeP2BY9c4h560FipnTkUGyzLkFTpNA+TT5rc0NxT8gXOeGMMTDI+W5lXQEYSQmnRe0OwMv1bX+ntZ4wjIc4pLqlX8/GfRoXXt3iqdF4WtcmUyGP5wyT+K/qWj5ZtpwV3dx7xEhUNMwR/DTvP1GbaPKbRNMnAWSwYdffBs/dmF9PAKAKUsoyW1dlLMnJ7OMoD3dP1Uw85alRU26DST40R0i9MKhVzHNuhvue1berIxOTHsnm9Iel3wzjzkhAbzES75zk62LJRl202Y/g601RZepIN9AT+ccGcg7rWPqWG8SEZfA/6iwa1aDfMgUH7o9CPr6sWb4v1s8pHA3eKOQGit9Ymo7e6bgXd+QHH0En35vEXK/uewZj5dWUj/k3kiQlBQ+5KWtmQTFPaGCvcRY5t5Jt/YgLlY83TjYzDnTxpNt+IYhvDrrkcVg4ZwEXzks5czp/9pPzc5r9aSDsYLyBir/Uk6n5n66giURj94TAIz6F4h/golWhLBngv/7EaXzdOXivWKZPI8srxLxVsZEekJZ+DENEaeUgJD+q00Uq7uGp0QKY09ayRLJNtUYq2rgA0IN3kk40Va+TCaLnqjU87SZMl89sVkIBozViARPDM0DDR6fcyqV/rIfljSSllY8ejl6ioZPOc8ZOsqQ4jxFVjuaWw/m/l+gS+Iy6stgla2fFf9yr50/qzrQpNOpm1cvZLf5QVEaP2DIBUmcCu60Vczj+resvrHrCXpGF5es2STJWOX3YHdGdZETLKh/vAWEWvqTZMrS1IPoAOMToIOG/fr+/Mkihnr/jSaXrPRRMsh3S9OIgQoBFeCh1bAnUxAdma0WtECimwAJJQbs8F0/2GKXI6oDM8asOQXn5e6n2gW1r3bGxB5SVbUIowOJf5+/jxuDh4FPsMg3cYM6Kjiqq+v5KKpTupQ/Mo00twrArpcUThgOHYxF9is5cjYBrSESyZRRi+uWBN3xWvi95qG9KIXonQgRZzZV69P5mlrVVaSplxt3HXbfHaJ481YtfWru8HEz0gB53/W/7UZw/uojctk7RN8G/QB00Nn0LpBCJUq1bZ6KyL8I3Z4Qnquet13M949RC9KgpHCz6QmxxGtuVJ1mNG4mzQ0auMVkJVNk0oPlPjhvICndH/NoqvSZIQ8XA8NEJsRNI/CwciN06Cd5ejmsTkvn7ebwTDkUpOg== 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: 21 Oct 2024 18:03:27.1640 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a1710d3-8f52-4a87-bd75-08dcf1faa9d2 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: SJ1PEPF000023D0.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5655 Add a dump of the class and capabilities table to debugfs to assist with debugging scheduler issues. Signed-off-by: Mario Limonciello --- v3->v4: * Drop conditional printing (Ilpo) v2->v3: * New patch --- drivers/platform/x86/amd/hfi/hfi.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 50407ab805169..839007684b049 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -75,6 +76,8 @@ struct amd_hfi_data { void __iomem *pcc_comm_addr; struct acpi_subtable_header *pcct_entry; struct amd_shmem_info *shmem; + + struct dentry *dbgfs_dir; }; /** @@ -239,6 +242,8 @@ static void amd_hfi_remove(struct platform_device *pdev) { struct amd_hfi_data *dev = platform_get_drvdata(pdev); + debugfs_remove_recursive(dev->dbgfs_dir); + mutex_destroy(&dev->lock); } @@ -396,6 +401,27 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev, return ret; } +static int class_capabilities_show(struct seq_file *s, void *unused) +{ + int cpu, idx; + + seq_puts(s, "CPU #\tWLC\tPerf\tEff\n"); + for_each_present_cpu(cpu) { + struct amd_hfi_cpuinfo *hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, cpu); + + seq_printf(s, "%d", cpu); + for (idx = 0; idx < hfi_cpuinfo->nr_class; idx++) { + seq_printf(s, "\t%d\t%d\t%d\n", + idx, + hfi_cpuinfo->amd_hfi_classes[idx].perf, + hfi_cpuinfo->amd_hfi_classes[idx].eff); + } + } + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(class_capabilities); + static int amd_hfi_pm_resume(struct device *dev) { int ret, cpu; @@ -469,6 +495,10 @@ static int amd_hfi_probe(struct platform_device *pdev) schedule_work(&sched_amd_hfi_itmt_work); + amd_hfi_data->dbgfs_dir = debugfs_create_dir("amd_hfi", arch_debugfs_dir); + debugfs_create_file("class_capabilities", 0644, amd_hfi_data->dbgfs_dir, pdev, + &class_capabilities_fops); + return 0; }