From patchwork Sat Nov 30 14:06: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: 846538 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2058.outbound.protection.outlook.com [40.107.243.58]) (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 177961A0BE3; Sat, 30 Nov 2024 14:07:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975669; cv=fail; b=sWogneyuaMrgw5pJEMZhigXSx8sT3ZrP7GgDdYCYsOqOAZfOQiUvC+6W/l+5KCWXCK+aHePNzwYwTb5Ih74WqFH1llsuyuTFmyHPJ8e3gcbq3uQsXMSMoggg/SBGOXwxCrH19p+KqmLal8mobcE2NAnc8ZPpc08AOB2SYmHTssM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975669; c=relaxed/simple; bh=DMjuuDJSJxfHSpL4ibtc9T2fw/bT7ago7AntzlFc7a4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C+nQBcP41KiRmu0q4U3vNPTBgWO7ZOKvClIwWSl+kGq2ywwNzhaM/Ibbx+MeeAkg3XhUBgKvGundooyLU2Z5F7Ghn1Owi6m+qS0qsnZPzYcQTfScFiLgAb7qKvbRrt7RmIcZWaHNCNp6bDPVzSYuBw83D1M9juThUNTkKw2adDY= 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=tia6PNWd; arc=fail smtp.client-ip=40.107.243.58 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="tia6PNWd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gI5OPpxdPn53NecFdqc3IU/u+18jahyTPvd9BvBadw6VHsj2ceZIGmTxTvgF7bTJzHLe8ghNTchYwCC0+3cG0qI2g59zSudqaQR6ggfB64FTUUvIEGfl6CiL5STOWH5sV/84c+13sz0qlrCYwon2XddZnrXJyvPqNYEsTbeQFdhtSU+xTocDzsp7rAF4+O8lyrGChm0aVPRDWED1UpuA7Wvouos6GpW5EmtwsMWwq08YcfopFTkP7B0mbXL1MU3OusHvRFkQCCbporj6uVOk5GsjGpJ65LdbWaxrzJjQr/RlYZEV/vKPmbsTZgYuUwiJWxdJ26wyYdq+hl4ibszx0g== 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=EMJT/T88UaQRulFTCrjZGsRHX2tB2kPq7JxN+LCfSgE=; b=LymUvHaUlTvZNPI9hLFG+KCu32WdE/qUzvkTzx18+25QV0Dw2k2ZQJaWtrCcFLM17Qgdg1YDvqS+H8UaSHbSBFKKd7kFa3kJU5XaU6gGqKZwGatdU0c9oA/6R35116/AgkxU8dA8hrT2woSJa7NiNpxfcpoiMjSWcspIcCm38ujtek/20k5L76iVtbA1xNM4BnQgcKdoq1jlrVXc8/5KfUnUFI56N2RzcZ3pLF56SdA5nqlgAt+XANYtw+MeGoy13H3fHSJ5k0TpCYtZT8ySLBwxq4hPrq1NRRGlAFe8YirfWkaLv/TP4yP2ezSDUqbGgd4+OlqXwF8LOaI7jOZSng== 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=EMJT/T88UaQRulFTCrjZGsRHX2tB2kPq7JxN+LCfSgE=; b=tia6PNWd3D4Gst80GICXvF+6o98PEEE7RZWSIHDEr2eNfyZEH9Ag3v68wAM9OkIp5TE9YdTnP2K6xAPrgdZUAfVlxymq6Rf12SibYCoCVViwDTK9d/e4uGF+MfAzkggnE+4MXBYyxZ+KHi/HkSvDNcV/1JBLqqi0K34b+AJJCiI= Received: from PH7PR17CA0024.namprd17.prod.outlook.com (2603:10b6:510:324::21) by PH8PR12MB6986.namprd12.prod.outlook.com (2603:10b6:510:1bd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.16; Sat, 30 Nov 2024 14:07:41 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:510:324:cafe::8b) by PH7PR17CA0024.outlook.office365.com (2603:10b6:510:324::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.15 via Frontend Transport; Sat, 30 Nov 2024 14:07:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:41 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 08:07:38 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta , Perry Yuan , Bagas Sanjaya Subject: [PATCH v7 01/12] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Sat, 30 Nov 2024 08:06:52 -0600 Message-ID: <20241130140703.557-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CA:EE_|PH8PR12MB6986:EE_ X-MS-Office365-Filtering-Correlation-Id: f988543f-a21f-45c1-3eb8-08dd11485abc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: KjFLqHoU6wUm1vg9Qq9+Vr4dUbVOnlqwleBofnDuCSScl2om3gCi7W9+p6a30FP5pf2hlFW2Rj9H0d17440lWzqHvpwIq2RI6adIfLB0U2A9f5SoDdWf+1MZpl65bElosn6gUTBZKotE8L97OcMtG80KHr15w6bC9LmuLagp6dLql4dZ9KpsBJq2B/UNVzgK/RertVAN6bOU9ZDTDY/uYuoz0sdtKB6SvthJ4wb8SOdrmuzOoS2BNET12Xl3pXSG7AHjMwl4XdAjSC+V4LFfGq86nGAtNhNMCtA/eI+oVlcx0IFKCbcTTLxVqgCFTQ5DmRMFiBIDPl4YCJu9Gz/CQb1rTK2szgREp5rVuSyB1wKOs72KKkM7XCxnVn+0z/gssir/EmXBlhzMy9BxL+pz+gL8lRAka7hlDlVrthKhUFMDIe3UPgsaTnJ00kkxdomSv8JqC0gC39IUtoBG/UXy2ouslqH7nvDv7wktdHNgtDsFbtbk6TPszyGbhuGQQKDB/p8ipvKCXndVU0JtB5skV+HINclfDNHFVaM0q/x/mpmrTSxipwPZisnoDzfgd0MQ7yR85wOUHqYULYHt5bCkkjOqfFvNrOV1BGb/PZN+l79zuwiQnc3Ma+Eyn3oIeUghT6Kj4J6XAKti8euSsd/2DavkcS0/oA3KhSpk79b4/haZ4SaZ44m5qXAH8AJDGnS2YAYTqrycocQDyRCXTjpvCZqdkxrYL6xELqi140BWj8oOKg1IYzhoXTJg6QAgc3vG34Kaei0AqXFKM5EcQFKNkjvfqzcwQb3B1pGYVPXBzqeuBsv6HrgWONGx4XSa/p7mYr1vvBEB85N8yPEjdaJZiaboWxgJqOTnJgMUM91GHfVWHaKFmiXJ60OMCOFzbyPQ2WFycjZJR/YYsi830vwI7NBMGGpnVC6xCkpeIzaE4SbmOSsJ8xsA+ZQFq93Np+Zrf+Sk7rtlYF9vN3H131edZ4ZzmAbU+j0DxQ55gmINPxLo8lrlH2I9wTODCZKA3gjAAV6szpc36StWPfPO25PenT+JiVgeb6hHvmWi6+QCuw7MzyYt9uYmkV9DWNb7pij8jAhNcGjWXeb0L7v6OMa2FHkBHoZQ+pUyaZqSMAU7Q1vzJluJvay4hAkm6cGBY6pZNKaoeQxUMOxRh9GuWSq0JA7Zu6Xb9djmGw3cRH5aqWq6mwTzulf9ZyM2AGAeCOzb4AvA+9OMgGEW39aHp1W8qiZVnsTlBrvzade4o7T3Vzsrezclcaw8kv7T0RVAV8PXdbCP1RHbg8b/wE1NCLR30/bR11qYM0CYFerKipMmyr07gygl1cytFZO9RCeszGoFCSDuapir6r+s68U8/M+gCCNdqV8QKNwq39WRKapBZRi2dwz6zKD71qKGjwdbogpu/0qqPH6FpSTMSzVn/WZh5leruoNrtwMBB3IB/PlxFOZdJvy7VdCLgDxLC/ytbifU X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:41.3300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f988543f-a21f-45c1-3eb8-08dd11485abc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6986 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. Reviewed-by: Bagas Sanjaya Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- Documentation/arch/x86/amd-hfi.rst | 127 +++++++++++++++++++++++++++++ Documentation/arch/x86/index.rst | 1 + 2 files changed, 128 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..5d204688470e3 --- /dev/null +++ b/Documentation/arch/x86/amd-hfi.rst @@ -0,0 +1,127 @@ +.. 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 Sat Nov 30 14:06:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846537 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) (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 0E05019F485; Sat, 30 Nov 2024 14:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975670; cv=fail; b=X0b59mDWE/rYDpxDeOKP/yoTdPYZEOwxpw0Etd+3VohdPg7cC/y123IOqxSylZgbCs5k/x40L4Y8VuXPkCRwZfu43qjPn2hyG3QA1rlpoOqwbyXHcAzGE3AUtZ6O5ReQ5/2YgZCN4zF7olFyF2xTiSFkMkWLJ4crHO7WUyAtvss= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975670; c=relaxed/simple; bh=hECZMkZyOmPdRV/C1pJPOiwKMNq1IeQEeYFCaag9Rmc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wpb85lOf7rxoVd46mU1vqFrY/l3l9QGqatN6f/SCHHYHgp9F21VgR3eGIIYHQMj9uyTUTGeF7TouxSabwOsidGT9FX/4VdbPU46YuBBjWzFUFHf/ALtJsKkjMFSbYUVDCUwQBNyN0aLWzN9IxWH3KRP/u5URt7FMerpbc47aYF8= 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=3lDlvuO3; arc=fail smtp.client-ip=40.107.243.45 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="3lDlvuO3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dikaDBmaTy/LSDML67CbQOEyM4e/3SKyCHZgH0Ogrn7UiHXND9tsFVaL6Z0W3fJzz/RfgxHdPERU7GVmvbUYx6qevtpavXjcrJWJbZLxdvQtflOSTbxmejRKo0/WS0CresI/aodChLreoyGIM6z9uY9bQW6fhOH8AFKu90JnKIqKbzuByUTbY7pXmtrOowvoMfzgnu0MV9gLr6nVY3nAuxmSH+ft88Xj8Lznk6E5E2lpjFJOQ8n3gJaHy12ewxUP1+kE8sXHR524KCwVT5vd9yw3AKQHDnlUIZ3JH4C71ZYj2L1OaMBra3xioqrhrCSH4iMXOjkbHWjoKTXevk2kWg== 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=ZmzaxmQPUpba4J+WKUoRefh7jYYsfc17cMXsX7vJa98=; b=u9THBrN86X6mF3TSWz9oYhZwb8LS0PrRUB/fBjSySrba6NNj57sY9YOnB24E+IS0xWnEn8UT0yauN6fNbZbRBF0Bqji5GFybU1PP5xMVz3IUkZc3ecsmWEJcIakiOVtuQFNRU12aQ07KZefg+qm8dRhUONFe1a/RTBW+4D8FngYPiIPy+qWXjVYQtmZWqv6AfEm+dxtu90Rmy1X/1+TZvxNr3GEurfy8vu3emPkJqGE3bubSBJyCtAGxWYAU0NtMxHMHVHXL6yg7rqYpk+/2BDDyf1iGt/o8Xjd32P15SjfQJYIqp3IUD3dg8m41ophitzv1KxYgAArYG7kLCf9RuA== 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=ZmzaxmQPUpba4J+WKUoRefh7jYYsfc17cMXsX7vJa98=; b=3lDlvuO3d3jqZmrIn5qvwq9yW6/CshIFmSFku/7fKQZQH1lOy92pFJ37KAteUQuv/QKI4HxTxY48iYFS/Gsbru6OHpQ/aBSPohezeNBJKkfuLygWqY6mIaMjOkoOgFmgws7hJzMmaAk0Myg3xHaEk0qLJlIMvtjJXtyLIdIeSwU= Received: from SA9PR10CA0008.namprd10.prod.outlook.com (2603:10b6:806:a7::13) by MW3PR12MB4396.namprd12.prod.outlook.com (2603:10b6:303:59::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.16; Sat, 30 Nov 2024 14:07:43 +0000 Received: from SA2PEPF000015C7.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::c9) by SA9PR10CA0008.outlook.office365.com (2603:10b6:806:a7::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.15 via Frontend Transport; Sat, 30 Nov 2024 14:07:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015C7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:42 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 08:07:40 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v7 02/12] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Sat, 30 Nov 2024 08:06:53 -0600 Message-ID: <20241130140703.557-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015C7:EE_|MW3PR12MB4396:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ee11a37-88bb-46eb-1d4f-08dd11485b80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|7416014|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: MbmB/H71QINcrsoL8ELJ+Vua/MzxE7mx5bFiIXhfllyphJ7HmesQwx1RMa/bSk04Kg1JTPU/ZotsPnTx4X7jFQJpfOp6jmskLNeN+meTGnoFDNYo/69oRaHxruyvgfSLejhIXTTbd2O4xlQPRLKz2BBNsqsFerzBz2F7nV4MOQQF30aHyiO3GIwGwRKyuWLsNwLvtGVoo0FF9TGMi5WJQcJXub2nGls8wG0BqwovIIdEZeaMb46XKseBGTnToI7W5wmIIy0QTGTTM9AlReb5opJGM8VjCan1u9oS6DD9dGTAAIf9n7KNDzqkiHRUCTMaHoTGtWhhrAVXTdYG9isF1brDIRqQTvi4ZSk0SnGrUGCpxFAOQbUGRs9FoXjPOlBtMpRd57hvZLU+ZNzQXy0xwdzZq4hNyv6MGRo6HDPV3kpPbCeP8FlEWRZgq0+gLUacRi7pnyKdLIKEvx7Et4d6Ys2Sjr7W5VxD5yn4NEi3BpolZTnMJ9pt9WWUIKeHvZ1rDHtH4Zskdeuwi2J6kx8P9v/t5G6Dgfmq8poWD0kDcbXxZbQ3K1LGmZGAaw55KJ1RePxt9ZaVYzR6X7OpIpgNsBnBZWXb/3kSD8jnw0mfHkWcQtAS7ZK9xilNNirpPAY0lCsOc06fHXV2k5zJ5N90C6CWs2OM4kzZmka4TV7uCqLlGYW8sbVInqc+RjCUZkp84/KRdhn0TitB6y04We2BZE0Lt2GaNQ4M112pv+NWbqpJx0IrQ5KwYhyX7sM5jx7Tt+DJlA6cIWNJUehsVA4EYTEqwqAXOoZCGMR8/iDz2dQMLF+vfxgEE5Lper/gtX03Zh0xSSDatqyc6An8MUksTv/bvAUk9/hFvUI8s6kUdOAtfoj2SkmkHQXOzCy+WgGrnXvWE7Dbtlo9cewyGBd5OF4yfic1iyMCtvSQQZrWsHuYy2/9s3PkHn/u/HFYGlAsKA+BFnnjRC4gANKelGzUT8DWFF8XlXPI59dIlCdwcrB15cjyJVoQD28PZIRfB43qudnLOf6lMQnb4P/2hE6bYxJpATJB+uBjh79d1z3/4uMHgvFDFD0Rnkd7w//sSLpRXcG9HTUFLo/zoKzB9olOHL5fC4bTPn9dLOeUhdExX7AAj6YHLjNCZ4Kgc5Jagosr4TO4aIld7ncKK94gAs6cH7uSYDv0bvpUvfuYSh0dKjPVNWrTuxIs8JOmjWHZ9b14aQgMrKbvjWdO/b3sZ/bqz6LvHFAQC9iqtG75pXk8CB0Li0Ehz1jWnbWaid4c6IIvd96lyR9YBoCOccInZmtUMH7uSpaXH9+bNSiyueSllGMkEKl0uUIUGPUBot19h45512HdpScKNWEfD2Nei3h5hn6Fa5sfw27JNDFwMexOVcfix4V5g0x+0BCDfu8WPhfKAY2P9YtgTDN9jIzGnwpCxg== 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)(7416014)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:42.6137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ee11a37-88bb-46eb-1d4f-08dd11485b80 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4396 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 c1fcc56bf2fba..62f384c41b36b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1085,6 +1085,15 @@ F: arch/x86/include/asm/amd_hsmp.h F: arch/x86/include/uapi/asm/amd_hsmp.h F: drivers/platform/x86/amd/hsmp/ +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 Sat Nov 30 14:06:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846297 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2076.outbound.protection.outlook.com [40.107.212.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDFC21A0BF2; Sat, 30 Nov 2024 14:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975670; cv=fail; b=Xw3IoP1xYui+i6sRgV0Sfft95PahD+2hILUwiRgV78tcd2yat0o/hy5pwXJppvWEEdH07chuOULVdr3wRI0QZ7H4opHl2c255GP/3i49HjZjXSy12ggQgxB44sssfOXOl1PTie6SMN39K4EkBmIBgZndMgV4VOGxSJN5dLacX54= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975670; c=relaxed/simple; bh=6/GNpT2p5G0nMQWNGh63AxQqGIghyA/swYKFuepemJE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JVIgNxzUmdd1gegbbnQBmkrorAS0Gx22dgfX1CBqxo3cJ2FMBtazeVF39/AnAFyaCx/fRD4YJefr0OHxlGYf+RQDsI3ioVPFicu9RJaSRYmRjv8L698vKhd46YVQcJRgH9lju/YOhb9dcQAdZZRFkBvOh61EJgQZMxO3Dskr90U= 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=z5kyEjIo; arc=fail smtp.client-ip=40.107.212.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="z5kyEjIo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YmL3kIO/B8ywxAN93jzkR7uMb06KiVPtx4ZsBjDn2F7z1rOtL0wuX1NWuYCyowqmrAIYlJfmRsXLrPxsxh9DKEFkk6lXVbDCfJ/BEP3R+5/UPAirvAHz6ddIjclIaAlYOHArEDTIUmifWYa2374IPfY15htpFHOczC/nXZCf2Xsbawlo4nuOoSZ00+lidl+zpSEn7AJHJAb0/qmBkI5aT32veWLDyWXTqRr+nJNdWrnkoaUouOsWb8VufgUlHaBRF7CSrKsoUvh/XFwsLdtuU2eKPPw5shBjoSvF8nom/T3kCknjWUwk71282nE+1ANvBS7S+MFC+OmdSrZP2Nkk6A== 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=SldC1lYZ8tJ1QPuMf2obB/Ypomm3f7RwEI4lofL13uVmMStehE10MK/LBt+wdrLox4FiwrCPunuoJcFV94VC55JmXSmJBaaGxR7hmfx6ZTKj1LlXIAyILH2Ogmc+7HcPTUDEJeRdqVZbGv6J8JK88XzzW1abKbx+5AqQ3zYn/Aegbov/Yh8AJh3xEoQiamDT3HV83z3drCbCohXKEqO8/wONiVD8X+NT3NCzLl7aRB4a6Y4foqxUxY7iNG9WzgAf5+jum8OMdhjzIcdq4svUSMWRX5wCAX8pyIk4TiiMTKeAEqwj1RoP5iYmRYmX/iCCAGFR9YC4LOaJjr7z/CEfNg== 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=z5kyEjIoraBV51CI51SsV7+uEcuGJ+lvMRLqeKJh5Q79bh5R7F3kGTs/6+IDMC4gs2qmGzbOzQAj7vtVDGXcOaSXqQYCrYQAXeEjkCMyc3wS/hp3eulAA77IlbUDmXkNRywCkWZPZUw5QhOvehciPe5BPsTXuummfPXo2LKsdyE= Received: from SN6PR04CA0073.namprd04.prod.outlook.com (2603:10b6:805:f2::14) by CYXPR12MB9339.namprd12.prod.outlook.com (2603:10b6:930:d5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Sat, 30 Nov 2024 14:07:45 +0000 Received: from SA2PEPF000015CC.namprd03.prod.outlook.com (2603:10b6:805:f2:cafe::a9) by SN6PR04CA0073.outlook.office365.com (2603:10b6:805:f2::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.14 via Frontend Transport; Sat, 30 Nov 2024 14:07:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:44 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 08:07:42 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v7 03/12] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Sat, 30 Nov 2024 08:06:54 -0600 Message-ID: <20241130140703.557-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CC:EE_|CYXPR12MB9339:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ce1e6fd-8163-43a9-612c-08dd11485c9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|7416014|36860700013|376014; X-Microsoft-Antispam-Message-Info: UHpOiwgRe6FxkV1ExtxtDm0ui3D2bCczv8ZXlNg6c3yJRZlfKbpxYSIGNkvqzWusS/QxFhkxTZvOQvdlU4LySssBmV8VenXhHB/bG5nUcQXIaFNDC9EnBWQoMVZ1wpAuUOSuj+1axhoSYK9x33BMmrlVghwuJVXTlQgqmEt1jjes215oVzmVlRU+JmOiWFbtscJl35xRGEK0O/bGVfP6XS7bNnSDlUI2mRQIyCWr+nQk9e2UuXgHsSO7zVAtXSD/8bQh1XYl2HGlE5DJ3lHu+4JOS8mFnxFFVXHAH7s+bd3HRUj4JYp0U0v29j+9DztKiIBZPlNct6adeshdxOnrlXE4uxhUS3N/Sjmg2pr99RSENE+JbZkG/D4mAj8MoYsRYOpnUejl+dsFQpXvb/YKM9uTjVfKykIdVKa32rbcoIWhhdCwoFuq3v5WafEBrFw2KhNWlRtSSBe0ndgguwt58hyUQn0xhrtlfKR6ASRz6kSRoybEcuM/GZl76umLkRMvwDbr4lE3YS8oo9+U4NQ2g8gvhtz8V6kquegOjRhjSstd81FYtsosSyZtOlfO7lpwjnQm7ZbVrN6gh/1IUvEfJ6AiLq11cxpPO0zt2XDN41tohhWkrmhDlhyfL+6DefMnzGGvfI4bloZFQheDHlSMKl+D3v+ULQTMF7uLawXVSUi0hyvhukA2icdR93E1FIKQSXwJhfQYRLzxyfGEwDSBCAwptVCBQ30hxzU7X1GAnWWtOJshl7ETAUjnGGonmRamuspYHV7QSY6bF54f+/2+xs+RtA3ET9OG/mb4Hnzw1NIE+Ww+k2phgfKf1mypfaRIGxWu45Wk7KteaN8ytAIriIGg7yqbLPi2jUn0d9F4Uwy7sq9xQajswe1cwGMcDFxO6FYKevxDZd03juqwTC+h7K4yrP66F6YNyiObDvMwM5TMP3+7KiTcRaxYa8zpuX0/BiLinjek2nvqkqwg+B6VK8uNQASN0WmVUvcFuqwL57dL9F+5+DNuQ5kOsMMsFEueFwmft6GNo+rLm1lVc1tlCmu3UsCRvS24hPSgvUBiYUealKiIu1y8RogHprb24ajQs54svPn/h2h053LwBSjAqOBpdRzlI7AiJsRPsqXxcbT90A4qkEHvxHbEs0WTjS/bt1yvWYvYL0Ky5DWCn47oaXhKvGFfWxam5RBAPWYpDE51TkVXDhO0LdyXbaOmwIDo/0AfKRsOZYgso7dH6ef3RT/c8q+6HaIc1e1zDBIrUbh/icz0DWQAnSRimbiBrZoO7dKSEhZoR4oq5GR804Red4GthJsNcgxA8rMe4TcbtMRm3Nm3fWKqg1BZAW+1poKFnujVHIhBbEJdz7591pOM8uzSVQVJjDEefqGsZTRdrrgrleyqSAau7S3/bfIuegY1nmScIgYKZ7lQeID50eRps6B9FW7JsBLASXm+L0YJf5ZNpyITS+70yITsbAXtPX0J 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)(7416014)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:44.4742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ce1e6fd-8163-43a9-612c-08dd11485c9e 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: SA2PEPF000015CC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9339 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 Sat Nov 30 14:06:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846296 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2051.outbound.protection.outlook.com [40.107.100.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 D53741A7271; Sat, 30 Nov 2024 14:07:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975675; cv=fail; b=lIVvpMpyISy0uiimybNcyALlouMLqh708i0y+ACFBHHE5xpuC10N4WswAHT18Ul4A+N2EUw8f7UJc1r4myKFpd88N+mDCgN3ijdCqqYqzx0vQFyhWEtuXf8fz0Zky3wsMyH+ClYdQ0W6tXObP7a8TBKVa0u6kpJ42sDO+HWHW7U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975675; c=relaxed/simple; bh=Mv/elKRugYeCY4Rr1u2Vip63588Go70CN6+iTYqb6Os=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Kh+b7o5mqjoFG7AUqKKT2isCvH5kQWXf46irLAvzsV2eX+LYfg4UeciFbBYgNJiBdhcOWi5rtc1hgGBtTaFDhyIF1reZhQEdry1cWeuj4UjFzU6R6bGe1WtwV04VBTrJcdeKdbY0LQgy7cLfYCPxVUYDJNteAVb69PMmVwsONss= 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=QomlhRyH; arc=fail smtp.client-ip=40.107.100.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="QomlhRyH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=frwfhB53i1ecYWqHVuCZmHo204luyAbmXVCCEGbYSBcqCGPjSttkruF7LupK3AzWkuoNQ2SiK2OJbJXlBiemJLY2NtFTlCUfzW+9Z+EPDYN9jpgeSe+qNRc1Unk8bhzCFXayAon8TXibBVR6a25kO7taoCEMjEs+tPgN4kVkOL5GaoISog/T+5q4zYWcdMcDjqL75bqtEkoRHSTG1/nn41SjobC1F4UpUbSgox0bQAEwAkO+SEbFiUwwJS53G1F4t3LGOoHgSPjG/50UYRhVtELFP/ZoG040MY2Sg6YPsqYbJAj6QKxSrvqpwu+ndIGiPfUNZ5iuQVuZB6zo/eusig== 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=TBnR76A1DApi1COQCNWfiO01/rdFBhyA/9yhkZQinVc=; b=vH/nif99JSBV/P4xEZxn0bfYmOAwhgFzh1PwdbCp8YC6/oVbXNMkgb9bi5kFhG0tFP2QJf6koDDPDrwoTPNapPBngqLK5IqKDWj2WSdfYDa59QpYyq1+jFHt3XLSm29Ye5K6wpamxt4wDBdZI9ZWp8L3rGZc9QlDxRpKBQtuFNmQZ2063efbuqRYtkK3V7KukJ3A+rFuie84VZjzK8Vj9Qr57S0/mFCIMyIvQCobmuKHvgqfZm1B/RUVtrM+MJ/QO9E6t+OSw4yty2uIMji+1k9nTvKCsZRw/ZMUS2HSqJoVuevOTIlcczy64BJHnAcWRgC6uyRq7oO4hI0uyktkBA== 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=TBnR76A1DApi1COQCNWfiO01/rdFBhyA/9yhkZQinVc=; b=QomlhRyHS7826IuE96c42Mj9vMwZHgzoZAgS9BFoMuPlw+nK7m61sL1ZfepLYH76eXh3qx+QlntOuowR4jvdDdMtsC+4wwdJ5wJORCdP77vV/ee2kguag4rj3RF1CeGXpI2y87zDSjcsYrLnt013BZ4/PWII+c73Wd+sokhY5WQ= Received: from PH7PR17CA0010.namprd17.prod.outlook.com (2603:10b6:510:324::10) by CH2PR12MB4136.namprd12.prod.outlook.com (2603:10b6:610:a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Sat, 30 Nov 2024 14:07:47 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:510:324:cafe::a) by PH7PR17CA0010.outlook.office365.com (2603:10b6:510:324::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.16 via Frontend Transport; Sat, 30 Nov 2024 14:07:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:46 +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; Sat, 30 Nov 2024 08:07:44 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta , Perry Yuan , Shyam Sundar S K Subject: [PATCH v7 04/12] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Sat, 30 Nov 2024 08:06:55 -0600 Message-ID: <20241130140703.557-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CA:EE_|CH2PR12MB4136:EE_ X-MS-Office365-Filtering-Correlation-Id: f3d1461d-18cd-4c8f-2cb0-08dd11485df5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: +6TqqPgfBkDRXb7rWkVHkz9i7gRbA09FE7kAUUDYUU1Ln820+nsCzomQL9RmZF/1GaemgtE71jzhY+FevGsu9Fg08eQwlQohe28AJ6L2x6jJmuXO0KxHobBqsXdpXrcBMpHriRkpoK27B0j5gE3xDzsphizsvQa0z+cBOu63VgDC+l4lbGOfdryyQkgtoSIVhCHBTD9fD5CSxHsp16f8GrZ9SRR+uNEHDC/kedRrhYCEvuOusZ1/KA17XuOSTL+gjRAPBsl0de6rv3O+PsEo+r15/QoHGC/0h7n/L3l6SSDRUKXHQuBfrOi2SpFKLhhmwpDWe2RlzCRQJWp+eaWR2ZcBGlrxeaUL0+xtnzem66CMrJE+ZSq0JknO+UpDb3Baat7PKJNbIFX5QSK+RoKSrgtPF2AAwB+bvxt46MHTFk+c22W/B4eM1Zjs4q+AwMl1cnPBlS+ggWDvQz7trJg+wC9kVICm81CoMy2iICLUPP3RStgylHRMBO48lsBhuq3dt8mKpt1OSTTpexgFONokSeZbd9ILm+YsmIgOP/StLaWXWE2kSH1mFnjyt5N+vpNL5GP5/1jIyi8HwzhrVAD9JjU0jE4rIfobPq48SHYeXLBmUDRT7rCL7OHtbH8DshtN6ditmEZAXxiUwg5MG4LHQSrE8G/aKTllE44OdVa2Sciy6IdgCbLrDHzXRUGJvpLuHAP6vKOf6tFCBiYJbu2RPzDsggVipr9EuRKRtYI4Z68ZP1AZVVxjRzPwUq5nEmtxfIxsY62nBwEd09RFcdqHSGzos0kaoxVeX9+JYiCMRtEQkqDl4zeBExd9nrA4SQvN2UbaAVHspjmV0FfzA4hRYEZhZ+zVEPzUr86uIsYCcB1nu+bxorp2f+obXREEZvHTr3wvCwofquTAbkhqf42ioK6t0tiGBzlH3n3vhA+kYFe2KbrK+LXHEFeUAw0v7GJUhVnQGsbgFgAzLvGQSq0qIboa/Sr3zus7Vxfn1ub1BTlzc5RYxWvSBAWX/rN+X4YPMP0T3N9U2Ec/FaITqNLERiwEPkm0t5bd6Nix1S8mR7Hp/WK/Tbd77q7HVh7/4rgPfblKkm7WGSI3eJTBC7SD6FdoHkRjZZH08F38afB9WIg6MRtqRd2MmlMf4m+SXMrMeZbz5n1eK7IUtZFYIPF2I/XQsDD0QXTaY4mTC4UMojH2ipF4xjbTEs7jnitxiVOoDsvih0JhN8b1iFCPzxh7uc3J0zh6dL8luhmGjPsrnQbYEgkVONv1ijRCMhuc4pWURGMW8ZtqsMz+Xy/ZK1V3hmCCR6R3t8QZU7C/WOt8UWD7b7jQsBqAukqpwICU3mQ9iQwAseTVYQCa+0QVnww5/1blMeLZMYJkmKW53n3/2nMgFDTVLXzySF7Ehnq0AdjZDphh4cNJ6ofLa+lJgD4PRRUpUoDRLSPibWc4OHSwRKVFPhtJDt8NYQs3dUaJ4yfL X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(7416014)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:46.7363 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3d1461d-18cd-4c8f-2cb0-08dd11485df5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4136 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 PMFW 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 Reviewed-by: Shyam Sundar S K Signed-off-by: Mario Limonciello --- v7: * Adjust Kconfig to 80 characters --- 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 | 161 ++++++++++++++++++++++++++ 5 files changed, 190 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 c3e086ea64fc6..589d61ebf726b 100644 --- a/drivers/platform/x86/amd/Kconfig +++ b/drivers/platform/x86/amd/Kconfig @@ -6,6 +6,7 @@ source "drivers/platform/x86/amd/hsmp/Kconfig" source "drivers/platform/x86/amd/pmf/Kconfig" source "drivers/platform/x86/amd/pmc/Kconfig" +source "drivers/platform/x86/amd/hfi/Kconfig" config AMD_3D_VCACHE tristate "AMD 3D V-Cache Performance Optimizer Driver" diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/Makefile index 56f62fc9c97b4..c50e93c3334cf 100644 --- a/drivers/platform/x86/amd/Makefile +++ b/drivers/platform/x86/amd/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_AMD_PMC) += pmc/ obj-$(CONFIG_AMD_HSMP) += hsmp/ 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..532939eb08a6a --- /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..2cd71d79a22c9 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -0,0 +1,161 @@ +// 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 + +#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 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; + ret = devm_mutex_init(&pdev->dev, &amd_hfi_data->lock); + if (ret) + return ret; + 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, +}; + +static int __init amd_hfi_init(void) +{ + int ret; + + if (acpi_disabled || + !cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES) || + !cpu_feature_enabled(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 Sat Nov 30 14:06:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846535 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2047.outbound.protection.outlook.com [40.107.237.47]) (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 AC87E1AA1CE; Sat, 30 Nov 2024 14:07:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975680; cv=fail; b=Cq97kAElZFfSRwjipsUtkgn1Ezch4E1cYRrRdRszHs09fIt6ihX9T9zuPMDmWsfpObjFsjYvJNnHUKLANyc+bflEXkzgeHolQzYygkuZlIqctdLSb09DljBQsQHHLwJPB+qEsy3AySql6MF8HjMndIeVzYppzt9bHTqcS42wGj8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975680; c=relaxed/simple; bh=ien+250UDGSrySnQglG7UUoGBOSS6C1yuHB+mvVLNHk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JY72qf0UF9IauW53XktB39JRF7n8N1QV3hvXBmPS4pfEzk2bKca5AgN1Yu48yP/jsHCL6bWk1kh61R8x98PYuDNJFiqU13W1Km1YkDGT2twGl+TohAO9biTk3Rj1zySdq93ToeHpbEbqIhacEzokcc4g6mdMz1kBLNcbobZ8dPs= 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=kfEejDZs; arc=fail smtp.client-ip=40.107.237.47 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="kfEejDZs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rPuPyJ3m8L6ElVbIdxHB2T3YXTzaFfZgAKQolVK/gh7ib02w76rceLwzqndLrwUVi5IbbdSrXraLSIfMG0pexI6qA2mdFcrYuDNR4iNgMdBqNaUheEFrmHKsf2mmcyUJSxuvNmiTUCgcd9k3fApk/ECsyMDp+jzS8dEFBEwlFXfLK6vGAgDn8QZnbYPgr/R/h6B4GzRcPKGQnCTHQBipX9MYPwB65cVVDQk5xZCZgy3gGElSr6B3ICtv9zpYpaQgQRWvZW+Z/VRs8X9xN0sTcBiRyUKdTbMN0GpI9RtdVwyEwdruyceXPEKdh6fMj46W7jQjGVxyVCukeONWwupykA== 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=hZ0JhNSo5HIbRJxB/mR7KS3J2do3bzPNbgtturNXyiU=; b=RDgbnR4mVONSz576j5a1wyLEEMV/cb/4Wqgq701H1haO+gC+lMyFTLkGXAkAKLrrM6cKLbZfUctLAS9ULDODd9GsyRNAZQuaTNcBnQiOQbxPn5aMxOeXcwq3Vq28DLBf/PS1BOI9/EoE/YAx3Vtw//0HUK0IwrjKi+p5u7EDJUhWPFQoTpFmc0wa+++PSrohXrknn95uIlgkQilQTW2HKIbtoOFRlALz0lrHGAYGCGvlmGdinVTKGyGXPXJajLeW31x3gl1kQ0fuSq/NlUPWMazGY9KyTKuGgzRJmUp7CfeQFc34RExbjgkj4awpLvP8I2bFV4WzSGI3XED7OkPJvw== 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=hZ0JhNSo5HIbRJxB/mR7KS3J2do3bzPNbgtturNXyiU=; b=kfEejDZsWZjGXq0jH6YBU6KlqREpkZ6YFUTUdrLtxeFpj20orl4DUTBW0e4UxW2qYTY9VQ+sxPR88Jlte4FQxrn4TnpqRilrNfXliRt6xKOfNPWcxWMgqRl26kkPd6mG7hY1U5J2rKEsu+PQNcL6oDIBi02GhuuprN8TvrRF3V4= Received: from PH7PR17CA0023.namprd17.prod.outlook.com (2603:10b6:510:324::24) by DM4PR12MB5794.namprd12.prod.outlook.com (2603:10b6:8:61::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Sat, 30 Nov 2024 14:07:48 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:510:324:cafe::b4) by PH7PR17CA0023.outlook.office365.com (2603:10b6:510:324::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.15 via Frontend Transport; Sat, 30 Nov 2024 14:07:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:48 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 08:07:46 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta , Perry Yuan , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v7 05/12] platform/x86: hfi: parse CPU core ranking data from shared memory Date: Sat, 30 Nov 2024 08:06:56 -0600 Message-ID: <20241130140703.557-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CA:EE_|DM4PR12MB5794:EE_ X-MS-Office365-Filtering-Correlation-Id: 45b5c8de-b434-4bb5-998f-08dd11485ec4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?qi02wXWHu1atrsSEKMw+84OjqTn1H3q?= =?utf-8?q?ILV8pU7NV0W0aRNm01wn4qWbaZaScTroiL+eNEqyw0hEpyZLKUdPw08M/TY69ih7P?= =?utf-8?q?n4E8p0LChvzjgDEvaWbc8RXE89TVyIURrxNZPTIhbww8eg0rC1m0vj5UPYVhLK4j7?= =?utf-8?q?aI6NcAkLBtP7BZUZTRYS8JmAM1o7QDN9T4EkAwUzJHu3ye61olmTiuElxiMEMv6Ta?= =?utf-8?q?QmeBmfqleyiWp5ULhSCU1RSK0pZ7hrkxyGRkOQnYXUFTPZKuw0kuJ2AnKn5vDyQhY?= =?utf-8?q?VrNd+JU3fCG+x18mFtAPLbVlJyQuCIaECYvQOsHUaMxp2kkl08W++JXvcRa/65B+F?= =?utf-8?q?ddChncWFE+TP/kWgCLLo7s2SpOyymKgRi+zPBCz5gJaQF57tPxzySqna66x4YtK7w?= =?utf-8?q?p3V/IQlPR3pCJosQiDFT7oXOs7+JbKf7cGvmSRH0sOrIDgZk4CKBjTdR8rA/ZbC/l?= =?utf-8?q?dZpgVzKF6IIkwyjcRZPuWuzjQ++Z3deM5jCMQC5F3sueuOQ/4HnvrXvre10LPGBPF?= =?utf-8?q?XNqBtqaDHy4aXYkYQRnKPX9tItwRssyuqBXQW8pUbxuEe7UAXpzTjhhTYan6O0Cz6?= =?utf-8?q?YQYBM7cLxfXD7zHVfYEatXovQCD6J44qVDn6u8JBwYXXBhCGQFKzh8KwCozGxYM5T?= =?utf-8?q?6odG688r9vMrK/pDg6GF4ytSVnc6GxvxwIeG5lNbNCsNu0rz+GnoRyukJQL9Nw/fZ?= =?utf-8?q?92lYSpo2C9Yj18R7wHDO0IAhCd2vYMUIDXLbdFkpxLkCXuORp8KmsPI9TMWYRuJVe?= =?utf-8?q?pzj9sQderzNVZ5mPgFQpI3oL/PAqz+oATar4TLpJCQtF9VVxAeM4ZcfVZf3ewJyTM?= =?utf-8?q?lwTN857hQZdfP3QqG1w1dJGgOnzo+nnD7YonCDqVaAVkTVcjdEPEcJg0a2zxu5B4a?= =?utf-8?q?hK33/4rRh0W+4Tz1lv9wGvSw91FMp320z8vwZTAFktesr3d0FdduVgHSQD8RnWltv?= =?utf-8?q?BNBw6JXAQs+74xNTX+9qNaQAMvcUU+9erTOO0x807acVWliZGF8lMdPTllb38ssy3?= =?utf-8?q?A+uP+Bq7nPtdagynQx2p8NUSnfueb2F1N2cS4R2c/qAu740g6M8gpH9kz1tNyHdxt?= =?utf-8?q?2X7+eNrrJJgbcJc1oquFlA5f9XAEPKehEmhJSZD6XNWDH1cKSf85DCe7/zdobZpN7?= =?utf-8?q?FM3uYMuJg5Jehz0Y4yMzhp5sdykhMJs56iXp0RQIdvACK83WIkyH3YIinRKHlKojb?= =?utf-8?q?zhknGi30tPp/XPZ2vHn16YIIkBOU87diPDkdxjCO7/FFrEPgeruvNir7KRck27CJt?= =?utf-8?q?v0flxIT2lqcF2hObpTsNLsD2RQXLeLEjoJZ1tmqdLzTXdtQ7FK+L3Em6987m1XsC9?= =?utf-8?q?86rQTxRVw3AKeWut1n/AnoEcA3CnktZkoKYHn6mEwKagWKFkrNsYeNYm6CL6SUFAk?= =?utf-8?q?EYJKnkTVQ3I?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026)(7416014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:48.0019 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45b5c8de-b434-4bb5-998f-08dd11485ec4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5794 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 Reviewed-by: Ilpo Järvinen Signed-off-by: Mario Limonciello --- * Drop __packed --- 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 2cd71d79a22c9..3c90e93fd192c 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -18,20 +18,72 @@ #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[]; +}; + 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; @@ -40,23 +92,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; @@ -73,20 +207,78 @@ 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; } return 0; } +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}, { } @@ -115,6 +307,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 Sat Nov 30 14:06:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846536 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 626C71A76B4; Sat, 30 Nov 2024 14:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975678; cv=fail; b=hzoR9MyKTKy5JaSa2ZkNyEXVt82pLh6dhT6P4nM6y6CLar18jkddRie1LKTHSsoLSx9AyCB94bcM5oKyWP3y1Q5g4bw3g4sOefvZ8c2PIDSMQThRaF9NsdTIiAtlfxB5ZVORMo04V5ZpZJGznlVe22qTCHgJRsrW5stFGkCTHhs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975678; c=relaxed/simple; bh=PLIN9Di4iSKUgShzNiv/me6wtqLVjfircb034nTlU6g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aBauOPzMmiMk0J9H3s9pYyX9uUQLGzlVonkLXK/lAu8gBLLOhoNf//Nt7v6gnxWibeVtDMPE8L2kqgDyGoLW1GrjBNZPqYuWI8SoqVubpmJk6L0Hal49FB61qMewAaT5Kh1Qr2vYLLLafXAEW0gAC0S/Xs+VWrkrOw8Yf/b2FLo= 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=JrBT2/JM; arc=fail smtp.client-ip=40.107.223.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="JrBT2/JM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k4uq6K+GZMTJXqfof2n0Nc7D76rx3oWZDIA+N2LHTbGiEAbfCHKH+SXUwpOGUBiOTbkInYHGpIR8uunDpMIbcbtlwase8kLkHIX32RtHn5lVUopKLqIY9KgnVUt8AC4X5er3UZKeulruJMc4scI4X2HJCC0dH2dUnh5Lb+qVQV2jMaKSAynKXXjHSklYzF49B8DtIbmapAwKBAB5GBsjwvBxORqdV1Su1MQRDiYRSB0AXii7OG/8VfgSO3LI9nJ1Y+//cLF4zULMsut2fRBGVC/unMlsNOLT9cwmbVIh2dXHBuLmvEdCUKfJ4LYCYlh+1ye1jn32bOCFaMnwIEqP+A== 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=Iy9dv4xCxmrEZGkcGwXZO4M6YugEJjOtZzXUC8M5aL0=; b=eT4d8FPIDzinmDxB9FEdA4Jyj+XXcGP6bGl9EfwefCxWeOj3bBO/CZrbl4bc/bLAQt7/1v+5RKZXJG4OQ3Tf4WBR3xZ+27taD7ND8TD2vcYMtYkW97KZymm5tVh7hHWj9qq4IUbp5Ys78s5H9u1L4l+oWRGWtrvuzM7H5rGrZpbSma1pW0CsmSRBX/12wQ6PiHEiIuAm/paZf+JFx+K6pvV8UvMi29GmRmCrEB4f9CUdY4u9egn9TdO9vL6oeNVMA/t/8fVvs0wzbJIz51df0OW1OtTqoDm0s9qdJCB7ci0T2wnIK2JTh2i6K2nZ0QHwHRYD5ZyCqfrwn4/cKO1j9Q== 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=Iy9dv4xCxmrEZGkcGwXZO4M6YugEJjOtZzXUC8M5aL0=; b=JrBT2/JMFdjX3GRWme2kpKpqu76L5pgVA+g8iK9CEtJX2PD63ypxaX1lMlgEk/ZUJ08aXnWl2pZhlIWVIQnK1EVtScmNwSEhq+oIVkGL2EAe5EEGUsKzYD/zoYqMxdGCUMlVrfDP6j+ozeY4C4HMFMmLaebbHwY2SXt7vOliNyc= Received: from PH7PR17CA0012.namprd17.prod.outlook.com (2603:10b6:510:324::12) by SA1PR12MB8858.namprd12.prod.outlook.com (2603:10b6:806:385::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.16; Sat, 30 Nov 2024 14:07:51 +0000 Received: from SA2PEPF000015CA.namprd03.prod.outlook.com (2603:10b6:510:324:cafe::ed) by PH7PR17CA0012.outlook.office365.com (2603:10b6:510:324::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.15 via Frontend Transport; Sat, 30 Nov 2024 14:07:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:51 +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; Sat, 30 Nov 2024 08:07:47 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta , Perry Yuan Subject: [PATCH v7 06/12] platform/x86: hfi: init per-cpu scores for each class Date: Sat, 30 Nov 2024 08:06:57 -0600 Message-ID: <20241130140703.557-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CA:EE_|SA1PR12MB8858:EE_ X-MS-Office365-Filtering-Correlation-Id: 8aa5fa88-6645-4bed-4aaf-08dd1148607b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: d5nuMICfYRB5o7xvgWeddzI0RbzjT4bu51UeyK0RIpdku1TaHb8shBKsOXxGUXHhVmdaXhx9nIccDF1kVD4kTiR0CtrLpoEe5kw7QnuaV+xtpLYgxGUYiBu2ezoYM4H2KthTFQqJmvELolxJtFCdybqJcqqOfnWYvL4AcqPYLC2FxlLhuPk1aNsr7PjX7MNWIn7ekSPUjuY96TeRcCSVO8sbLW70p4FrYrfRaGs7nfZiahRq0ZvDzVs3g+qicOxEWukGTOcFyla1pPA42HKSF2L1MSduO0lfmcbyuMgQnTPhm6nhgCt7UFvfWmPJGPTdfS8s62mWc8Ayo6v1d2VM5M3eSXnFvTSVIlZTHyfngOb4CGr7FnUBcXm2UP81CZhrhmiaad7+NfO4vP1ksoG8zNYWKKIsUbZ4siwwh46+oUTPWPaBv/SqtLu99olxsy6JdugNOoxgPtHAI+A5P7rZmw/5dviBKGz59xyi3C4c69HE7+Oo9aoK2/mspjw5hx41d2WKFrsEXMPhMwIXgTWjcZjKnM1uemg5FWy+MOhAL/Cu3R91ROcd0prfVhItTG5VVBF+LbfFK5qNb8IX2zEMh8S6IRlLAwWTaxZzzVAXDvr0bkXAiDn+TU7LkKClkcrIjtHWZwrLC+ijfmwmQlsQ2pGHGvmpQJ4VvxiVJ2jTHGidAGIBM802037pnkBmtasVfBK7dB8HDN+TBJ9LVVv8CqThx7UtEbXvGha0H28tKIsQzm4umQHu3YOaBI4DmEazx61KpZdmk4MQoRz9nYu8kM8aaLimvI/DZvCLfuFAzDS67K1OhIjbN3B+YxW1Ot9b3CRK4r4ouh8/rC3zdzfLY4tOxMto97PrOatJLxPlTr3B2SL+0W914/9mIiSgDUlQmtpPVL3ZIypOD2YNOaH2bNf11BOZ4T4NTPdoapp4a9/nD1QhZr0eDXQ0ZcrDuhjU3je0RDIX/guOPYuljvJt8jlI40s7lbzRbnY5frXfd0EUXlaboZNKgxbrySUqs8JFr6GFQkMFu+7QI3m4Q30Px52b/OAKuOVAw/ZMo+xkjwZvw3qsT0xDKl+SZczoSr0mN1TaXLl9L5CHHdxrQn9InxhW6qj6698hT1noa0sfkGmHQIiXBjsmiUSW1kXTdOxUVPL/tJnmPdVzKvFb3Lk9KW1CULNy+23SBT/LwLDYVf9MvqNFDiYWbh0L/yI89gx80vj27QvfXcFAYpz1qpTk9lWWbCShZMiosOnohqNCWE64ea/IGRBTKvlNb9mhUBYw6FqQnbnESG7OHXPif7Tc14emjp3SXQPqBR2kVsLoMu/vwO3x3MgpHtj6L2a+T6/WD3Gm4HrwK7D9GGcfJaBQNGWCx9cfo5FiMU0WDgthn2JdnXxGYhctlw4/yuKLbMMXvAmz2I80/tc2D6fDUEM5pcdeITmGAzHQULau4ohIwLQ59IqPP2XCSS+mXv1gVDvH 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)(7416014)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:51.0019 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8aa5fa88-6645-4bed-4aaf-08dd1148607b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015CA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8858 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 --- v7: * Drop mutex, move to proper patch --- drivers/platform/x86/amd/hfi/hfi.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 3c90e93fd192c..9671f07c76390 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -226,6 +226,31 @@ static int amd_hfi_alloc_class_data(struct platform_device *pdev) return 0; } +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) { @@ -311,6 +336,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 Sat Nov 30 14:06:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846295 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2044.outbound.protection.outlook.com [40.107.93.44]) (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 CB83A1A76DA; Sat, 30 Nov 2024 14:07:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975678; cv=fail; b=MyPDZ2A9grsIT2bzwT0WYN4eDvwAAf/LIYC0xizGarjG6G8zOxS14LJPeapeSzPf4Xw14BOUHxb/G+PRcrrytfhKnfKaS+OyGaKTt544YtMahtsMFvCWX/ZVCM5BBqfpG7mx9SVpILXc+6mH4vzNC3/o1V/uzFzbF4zGiFJa0tw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975678; c=relaxed/simple; bh=FpLsiRAJ0TzAVlqt/XYgzXMXQTsiGNGdRN6lg7gXd6k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Jx7dNU3dmyKhXycYLCbCvUvPXZJUewYsrQezWXRphirlcUyyLqyV9lASZyh+5AxffykZCtz6/65jwrZ/sfCJl6XGejuEtvs4GM/xegWlxjTW5u6oB7r6HzUOqnC6B0JE1J3AIEvTGrEre+eNIAyVIRUwmjM2Yq92+zEaBsO+MAU= 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=UlBnV5jK; arc=fail smtp.client-ip=40.107.93.44 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="UlBnV5jK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Shwz4rkKAleUaNJbGa1b/TtgCUOV4OL42DzyI8YI5NdCT5pbtIovO/qtKSLZBGB5/qsesthi0tkFxWuGiT5TXE/0a+o6o4CJ36CYdj3flrwFKc+cmSBac+knVXX/PxVQQTDgWSHd5wu6q6IouGomv+7QrYLXwE7scVtOIel9YsXaxcgDiccz9YRfD11iFIMfcQqgl2lY5Tdb7ym4YpCoOBbm8CV1rMjs7cU+XNc5/76QDV0R+NKjk4NwBPfVHcpk6goQ9uEMyqKW1i42efmN/xiDs71nHbFrWE5z/r0vm85BznG61ydc12PbaggVVejh/mLiwvAPQsHHdfH+C7BuEQ== 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=RknzHyVcDROpyuEbZtKEZ2l63n4PQHm96/Tru68mFr0=; b=TS8P6LQRNoWBbTR6W7W+s6SXrrmN/zAAZ/028nGrsiNaDXRybIu+xntnyTlDGCqlfPoTXryGLBRQConBgzO8hQKrIWe+YTraEu3/lEsX31tzgi6RuwYjKzjt7aCAbz8n1V991JOEn6PQSzv+6Ox0or0AeeVfT6XkKENNUjMWWlM7tb/341NfxAceciKdailoXCpf3wxsnUpjQ/4K6aPTKB+mvngwtkZK4XFbj2tZn6l3KPBApb2QnkOYiHlZKHD/wWkbKgLM24R0x/d2K9xZka3UGAb++BHpOsdwKIsUT6AYWEQK9HzbfNM7xAJz+CNAh1gMk+SdazY2yl1ndzDsUA== 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=RknzHyVcDROpyuEbZtKEZ2l63n4PQHm96/Tru68mFr0=; b=UlBnV5jK1FpoGWAIx5kexSfGh94fzVis2Q5fxuILcyBBy3caW7BlPfkcecz+zIONEBCdgKr9otSKVTprlzImHUpZvpXoYHiI4WqQvFXdqZgxz+KMWGPfbv/59AQEUcc62ywBSWG66o8MkMbpuL6NvBhVk9YVxbktO5Abxfyux+w= Received: from SN1PR12CA0075.namprd12.prod.outlook.com (2603:10b6:802:20::46) by IA1PR12MB7710.namprd12.prod.outlook.com (2603:10b6:208:422::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 14:07:53 +0000 Received: from SA2PEPF000015CD.namprd03.prod.outlook.com (2603:10b6:802:20:cafe::8) by SN1PR12CA0075.outlook.office365.com (2603:10b6:802:20::46) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.13 via Frontend Transport; Sat, 30 Nov 2024 14:07:52 +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 SA2PEPF000015CD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:52 +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; Sat, 30 Nov 2024 08:07:49 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta , Perry Yuan Subject: [PATCH v7 07/12] platform/x86: hfi: add online and offline callback support Date: Sat, 30 Nov 2024 08:06:58 -0600 Message-ID: <20241130140703.557-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CD:EE_|IA1PR12MB7710:EE_ X-MS-Office365-Filtering-Correlation-Id: a838f119-4641-478a-a949-08dd11486159 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: woMKsHdqXSXLJTo8u7vE5r1M1U9gg/heYNmcnEOzVoWRjhzB2sZEV8NRaPldf2NJhJjGi5vG4gUQWgWuR9EPlIa9PBZC2lvMgfx5nZxL/2csTzz/4y7X4vNE7Dm/B1LiXilP/v5vqqliw46LmssCnVMmlMNQQMAXNd5MIyxn9iFkZjlwl0Nt7v3Y1qZDknR3cs6KUFYDNgK47pKCtvR9w6HuoYiS0AfCQK6IdqFhC7E8jx3sngo4Q2vlQ8vEulqT8HFEJPsXaFYO5pPVlnd40RbBEd6FbJH8Yd8mJEiB+FfdUCNjB1b4egkgHI42hVyg0wZrEr6bvpO0eYNIt24Cwu1RzR8QLLe1R6N89PzSJmHf9uMX1Otf1ExnGJmCGoa1pzIlRCXhd3c1TNaAk6NhzyGen7Fj/j+6dvcBP63qt1vvoHabAn8GcpilRIM/awGqyDWngcOtIExpqQ6Uye5GPYTayG10OOKiirSnNU5imNHbB0SmxhtanyAE/I1ww0NpDmvilripXOOC0wfmp24awBb7i8jvmw2VQo7ydq3jrIYbAT7mHIS+NTgiTdOduhCKkgSXhJ6BqfKMChCpStllS2D1MQBnPECmwUA/tIYMCJO4fVudsp06oACssTbqZpyVtD0RkhPDZvRDV9yihoaQFy9bT16s61+vZvLbiLVmbrDlslKGUVceZJM/NSLSy7mDCE+izSOyI8M88eu8BXP5hHfTZ+Uml8tJrxjioAtPMO9nPB7tARJxwU+mi1QlYJ4E7M7MGpEt/X8F17CqktMJLvTr52z0RMIfx2e6NTBRZpnRxdjWYBXz2cFnHhvtYZSq2xmZdHP3q8fuZHjixZxsUCZeDfNOWT6G7VqwRbFp46lniXWIgNaRyJEJxl9N12ApUSjp6JtMP2yRn9wUjHAwCdA2gohEOISQbxmzDSDQGbJy+UVzXIXxGFLjd+7KaDbSOBb0KBH/S9PPbAz+2hN44Qh10Nt3AyQrG+RK5dqaYhnisi1WLp04OUV1XT08bRib0ISy/u4y0o7117rHYhkQA3O6vWt07tl3IdnE94qXY6qiYoMTOvspBvYPVL1+jTIjY607GK/VVnnMK3HOT38rzwNzHDmCW/Q+lmJMFm5p2n3ZF5KNUS6oaxxGWFLAxUrhVrVhKhKfKWVD7nzoYfPxF5XsD/k6FfeMV/lUh9TduHOC7OjV93l4PSdtp5Ju78HLhw+MBDosbb2XQ+8tj9vc+6Y2sEWjh08hqaIpspAln99H53xfl0yh53ec+RE1kkrbBytJ0cf+FovgojUDtkdiemE1lspA1TNQMbDWgkCMOTwU9q4H5W1/YXHd+1Y6ARj+/A4X4y9oZpRpeGxZYUVxts7GcsiiQaPdIzjWRokC8GKdr4AacGCPLwdLFUNJV6xbVoWbvuOHug/jf9obtXmSVdtIR72U2qBuioo8tzkysTUDt0lo3TuebYLpoqIjKRo6 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)(82310400026)(1800799024)(376014)(7416014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:52.4124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a838f119-4641-478a-a949-08dd11486159 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: SA2PEPF000015CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7710 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. Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v7: * move mutex to this patch --- drivers/platform/x86/amd/hfi/hfi.c | 81 ++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 9671f07c76390..922a9ff0d447a 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -113,6 +113,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; @@ -235,6 +237,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; @@ -340,6 +416,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 Sat Nov 30 14:06:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846534 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 ACCC51AAE24; Sat, 30 Nov 2024 14:08:01 +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=1732975683; cv=fail; b=M9X7Svz3w1KNiIMwncbwzaxslRQJPEKYpjPXECbpqmurbNFxM+sMgpX3+8HHuCCcqw8YXc2IjCLGTPgDXkYzKEB0SxqT7zij+5zbpGsWA/+96nyDvLfd2dhKq+FAcNPCVXsSSstXIIZfDZpDF5ML7Th0tzmmTHwICb8dLqkLXwY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975683; c=relaxed/simple; bh=IOvZRKAPWNZC84/xYTtOAnd86sJc053Z0HhsqFxH+/c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d7NKq11233XsCOlbFZWfUsXCsz2hxJGWHyYvD/dk1JC7rtcEJRjsBTp8SolJLzUlZVeH5h8sigTMhovYyxycb7C5i0k4vrZzq51KSD/1u7nY/IUivJNVOnQw+czH5N84QHLPsDTCajlrZ+sV/f/Z+R8EoSNuXWbOnSaBw8nk3c0= 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=isD6464r; 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="isD6464r" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RWpY9YiPFhzFyZz6SsUiJQCkGGbrgbfHCXIRrDsLHRjgiU1UgwtQ1x9bsvJCJUuES9G3Gc7qiQgTUqZtkr3E9pzmsVBqEmPUpYTcw4A5Gr930ekkWB08OD1/bn+WCDGh8iG5cs6L3ng/3yvpX5IzfQ3u2NRjtxtc7IGaz1UvV6HeU9wm9NQWlOAhwilkUPCkpC1kRypu3C85VwtKd+tNT9M8ic/sKAutWQ1GpO/NbhJxoFSl7a+i+V0CgEGsjarUmPp/RGRB8J7hmQb++OAcYCGeKpVbCa1yIcJid5/aTsXbnIOb89UcDa4gm+Qor6vDhmwbAEHRIJz1cZ3Z+yK7Jg== 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=9rQuoDc8UaCkJTYhrzlrm3g5L3+wEqX60J51gCi0g+c=; b=BUHlwp59lrO2NEi3MvMvhD2ULF6jycDBsIFPXqkt8CkWqhM0A2nVrjBzGPUHU0cQs6T/b/kcg5j3cIhfLDrCoawu5HqvuSnUM67TCaSI3Trtjg6jUT5DV0W5xu3Rbqsb4NNOGWq+gkmiUbpLQ1kIlpWZGa4dZFLnBXIGtFMULP99X/dt4eGnjC/mXAEX8eRYEvEvMVvTT1dQ/Aat+G/IH5tTu6jUPwvEzVhkf1F5QleFmhhFM5Pwf0Y3QQmCuM0u98ze1/CilDVDVHNoHiP0Te0/9oMqCeMd9x7Xy9tvxoPsuv6VkjVy+m2LcF93S9Vtz5pITwedD50eCaE0Vc0Ofw== 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=9rQuoDc8UaCkJTYhrzlrm3g5L3+wEqX60J51gCi0g+c=; b=isD6464rh4xxaNLI9TJ/3ImFvE3laZYB7lw269Knf9zUXV42bYibLCg9vcFk3PRcIQ26io/wQDkEcBPhpuFY0tDZ5exRtYLP6cIOlMbIQPRJkLqQVRx0hwQHefdbb5HkBzRl2s/Bq4vtdKyTH9vK8xaf3jFnL9DGenZ90aMsgxs= Received: from SN6PR04CA0081.namprd04.prod.outlook.com (2603:10b6:805:f2::22) by CH3PR12MB8329.namprd12.prod.outlook.com (2603:10b6:610:12e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 14:07:54 +0000 Received: from SA2PEPF000015CC.namprd03.prod.outlook.com (2603:10b6:805:f2:cafe::81) by SN6PR04CA0081.outlook.office365.com (2603:10b6:805:f2::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.14 via Frontend Transport; Sat, 30 Nov 2024 14:07:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015CC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:54 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 08:07:52 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta , Perry Yuan Subject: [PATCH v7 08/12] platform/x86: hfi: add power management callback Date: Sat, 30 Nov 2024 08:06:59 -0600 Message-ID: <20241130140703.557-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CC:EE_|CH3PR12MB8329:EE_ X-MS-Office365-Filtering-Correlation-Id: 59a76525-df0e-4b74-1e6c-08dd1148626e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|7416014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: 7YAfc/GGAmEQzQjL0jLsNTPC47CfAppFN+FdeJ+1UjwCVTXO5I9xVEE3JSRKwOS/SrN+rBwIDV/LgVDTmWDsrvEpIKqTVB/EQS+unIY9zR3jxJPt0MyoVPCVSwBwVlJA4fMCv0csp6d7Ia6nnp+TgwFb3fsNQco4l8u1rVQYvlMJ9ryaXBg9Vs9WiT34e7Kj23aQ1IrlPN1XylwUrhLF7uVxPVWgmbEfiv7EfvAkTsZKy9yHoZrja9qy7D7ZCXUZyGjS/IS4ftRP6JUPkQz508NDAxhvFDDHbxzPElQJuuOuuNRfHNuzWO1tCzWX9y+NHNJdFBRRqg2JzTDyIMdIcNcu1ZzNLpEDdtUMVylZEf+QeqBsbATYVq5K6z9LAgaqOa9pXBuxBDr0QKCy8pIXrgtDykz3JL77pj/savv/xPVysPN0a+Qvm2jGYiK8khbUVmEcPB8zjlTTd6mkNwrVpTQO42YeAYomJfvkBcgER/YP1WQ24HxigHa6YEFjj3OoJNdu2AzIBGSGjV6fEQ2zm2+MXGY6Rcj/WbSNR/Lit6LlO1oN739Haug26OcQHifjNkuUvTKtLX4x1GQbCgpe+9J2St65nohF/7xYniBkn7zDwZMoR7qpD91qebY+QDvt/SLf3CJQk49srs3vYyN+Zc3pGhDJM3AxNu2VWK+q2vCPVBRGKlct0jDjD64ttbFy+NPJvh6Vv6Ji8lhlSflO3T7I0Ib+GvrNFykvrS+kavjPMDVCf2uViLbe6WfA3qFqAU4SN/MbeQ/f1xmAf/kr3i1MUGpbqQtiUjmaeTkrx2TFKSof1zGK0IlR5/jX2tcpjo1VFc3Q4sflx1KYmj/e5vbrlAUWgTW4AnC90n1uGSd6e/c8zOTE041ChRe+T+26Ek9UEa6+HTvvQssXQPxTqX93HSWm2h16N3Bs+BdlfJEEp44d38l1dkINKltVLsgUMh47uLXHQ0+u7bqvnuUrMwwiJcyxr161DV8fLf02eWUTHkxt/4fOKqWw8cXPZn2swmuC65CUqmcROaBLVtBqbSos3Y4Ml0ZaaO5jdZGhe4BVUtbHcbjtZdWEHzHSWdFxyxYsn6YZ7YN/pfIIKj6Nvqqk0s5C07ZkHy+pXT0UTVAV2sBxwnMkmsTr1tG19yxUnHWRKbFGcFWRGDry0Poj689VCYfRGfmAG+4KJZEZd18z+DOkdx9rZ0bvHipIFSvystHuIKORVb78/Yf6s9BbkjXjSF5Xr3RmYSdhbYmPR8zztpqHRBsqCu1CPS5t/f3ZJz9Z+FVUgMalgj2Td/Asbsh4FjN/AymC3qJv5QL7rCupfq3VL73OB8TB6ddV9nvTMd5XGLCd7RWFAyGstVSU9TtTMZ894wl+fVTEGQk3je6kVVA5v0en0br5kbxZDys+VpKyW0sxnUX38xklgVRkpzy9IKk05LaBWMi9u9Ww7qpCPi5URIwSFOckOO2xA2KF X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(7416014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:54.2398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59a76525-df0e-4b74-1e6c-08dd1148626e 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: SA2PEPF000015CC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8329 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. Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- 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 922a9ff0d447a..80ccc50ee0914 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -380,6 +380,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}, { } @@ -428,6 +460,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 Sat Nov 30 14:07:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846294 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2052.outbound.protection.outlook.com [40.107.92.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 0CCE81AA1FB; Sat, 30 Nov 2024 14:07:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975681; cv=fail; b=e59cw0UZEXrQkxBVQh3/UvHsn/JeUlkkbsODBLJYbqLHHNkiUPp3SnQngeYQAhEuf/LMvjDZQxXNQ+ocb8xSdV36vMTt5A4XuQXnWd3ZxC0foQSNvPSCaUwb3qj6l0yWA18f81WAx+qFVJJsTUQxej8oB9ckxK6dhVd7E76QRYY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975681; c=relaxed/simple; bh=BFlPzCKDOQ/lwYLxGzA4h0BVSXB32LqPDTE4h2a/b/w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rO9iGML6dgwSeW7EejI2ATE/DrVFVSJuaAbYKPC5wUN/uhHu3LyaoWlx1oLvh+OiE+Eood81tspmyn/cZXk7s20qqPR9zVa702lG18OkWSNUQkd0vMdHp4uWmFPippQ6jmDi7WnyIR+4ihJ8dHxwqldMFgJ3E7R6CFTaG7OTK9o= 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=o7mYeOCU; arc=fail smtp.client-ip=40.107.92.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="o7mYeOCU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fxW7fQP52ckhT0+KnMFo+mT5CDfvM9uspwHTq5NFZbys4bmGCzAa6WCmtggYJm29ktbd08j9CGyw1+/uu6hsPLs5fylve9+QVzRFK6AdTKczuOK/btDeQ848DKjGdeqNxumT+AtXJyfqSTJxxbbTJTOiNTco+koIR3af3Cb1gTxc29d3OewcGtsX80LxyYm5UthahNR/XYN6obyUqiQNjdJ3Tdt6p9EdZUauEcO4OnsmLcgFjz+azYHvk/c8M6arFYqc1KH4eEQFhuUBMAxv6DredJds6KoFkoJ/rYK+ztPB5j2Yw4ZzKWzqHc8s3I80CjMfP/p3C/15rtSDlJQtyA== 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=oye4hmxA/QeIDK9bNf843lF0pJB8f8VefTi8+5z/8WI=; b=vSrMl9ka8kofW/uNcGfRnS7kjJTJeotjp7eMVPTDcmla7QwgEsmDZ49Q9txWUnEClyxFbo6rZBqfl32E3AYCOw8MHDyPNQ+pm1tX7kLiyJ2lWX/SUYfRQFqFzMkxOAXI0nh/QIVnCXPMZ75CzqjWMIBGm6H7FVBjn3EYzmQ3SFGii65vrkTGRN0XYwjjPvIk+ElBMMy2s97V+s9AsYb/Movi9u+6T9dXC4o3JVYhiVFCJC4vVMv+TapEk2ilMmCRmp3ZVf98kB7Ib7DQSL0prnaFyDmwyOrCHRSkiJ/2XyyWhbfuUXHYl08BOBRMQm1UMrQm7gdmPZh9p6c+InIDKw== 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=oye4hmxA/QeIDK9bNf843lF0pJB8f8VefTi8+5z/8WI=; b=o7mYeOCUUrXId0AOr7pUF7jqPWrgc/TIFeMw8R2OcTwaoYGs0tSmz2pVDnfhU2+4ZWtZFkAZsJCpFhDKALcSjsRi280L8+koV6IPGNbKK2D0CYXwBEp3+v4SDm6fAtW5iwTOKqhRVLkOOWtsQRyQajHmIlbjRa/izuFlDjlUn5c= Received: from SN6PR04CA0089.namprd04.prod.outlook.com (2603:10b6:805:f2::30) by BL1PR12MB5707.namprd12.prod.outlook.com (2603:10b6:208:386::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Sat, 30 Nov 2024 14:07:56 +0000 Received: from SA2PEPF000015CC.namprd03.prod.outlook.com (2603:10b6:805:f2:cafe::4d) by SN6PR04CA0089.outlook.office365.com (2603:10b6:805:f2::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.13 via Frontend Transport; Sat, 30 Nov 2024 14:07:56 +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 SA2PEPF000015CC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:56 +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; Sat, 30 Nov 2024 08:07:53 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v7 09/12] x86/process: Clear hardware feedback history for AMD processors Date: Sat, 30 Nov 2024 08:07:00 -0600 Message-ID: <20241130140703.557-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015CC:EE_|BL1PR12MB5707:EE_ X-MS-Office365-Filtering-Correlation-Id: 87e5fbaa-fb8f-4c32-d6aa-08dd11486389 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|7416014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: 20oCt3Wr4P6l9wML8eZYtw3eD8/qfi9MoaPa2+OdKarpd1TX/AL1VGeanB5sEusKqbywNDmmmdbUAG/r4BmPGQ8Jwi/Pn/43nFUn8KD/ybJGfvXhGThK5SKfZTIlj7BimrTZOWtJ0hS1yNq6w6K72JjabpWZtj6X+0bMllI3MUhZJyZhCOaRuGlPAm1saEu9hJI15Y7U+lqsnXuP39OA+ILvI0QKxVescJ/Ds0/pPS2lm6NcB4CUdIwlqKNdszzh9Ad2tFQuBbbswspuJgOlVoosD3r4Oqmei9SEL5/w0XCNj3Pd7RBwEiDyXtfhnTfnqxAzpYY+R0C05ed7k0mZ1DxnYZsG0KKsoU/NPZheCJbCixlepWpVnOSH9+jAlMcU6e+YLSHJpwU6FqLsOy7VJctMQk+n9YDJkcRkZZr/VhbwUe3GdFOllh7+GPi39xxby3le12wzwIXgDnGdL1tSHwCyPbORvyPq1lmtSR8jxGrp+u+OtZke0PD9dAwBm3PT4isEWlZ7/MEbhMeUT0gd+9koT68q/1PCh++KddyCSj0XiE0TH6saJuZrTUK3d/F5IUaP58Wv3s+Hu0AYiwnkO9vC8/Js6QyxmrQUsKILAbpscm0iVFMcWLaPchAZH/FS/knTJaBKW1VSlHsNxm/H1u5ccjdXmAB72wTHBNI/p4qiQB8bTP59SC9O+t6J6mgXuM8LQ5ZI0O706KQjPAujO+WKR53XTg7a5oohJyxDSmAIkHFzG7ODvpcHfE9GYNW6MLaFCN3zQvvMHJyYmtZURPFz4AjC5ZyO0cKKszOgVFiB0ar5bEX49h4vaNN3zbb6FpzIn3MEczhj8LSqTV5YOqD/QfEJo2hqt7XKDihFt+04pUw5wTlxQWONgC/S+poJy391coJ7GJJTBeuWg98zlfCNN4wjqLjrlurAG4AjRljaM7Ckpbm0XA5Mj5mrCjreYOcZgSJQ/TvVr2bBOK3DQe33U1L0L8NEgZ0S2+lqKl4rh84LdRQqSILn5dGmRTnOmF9/NvEPARkPu9QSZ7ZNt9jaENvbh+S81AwUhLBEkPtCiGQuCYuj3ZNbcFwYn5w6RG9p7mMnpQxk3tYPpklrEXqX3hr3wiOWrnpR+ttD6u90QqGsfPnex7x6PHbN92llim6MGgNn61jCBS4kWtVi3e1gWjok/+I+T+Pwy6wnFHRm4KkitcCgSH/hnE1n4455Dubj2q/YcGko9/wKDU9T58OBgAnGCBmXDfnmigJmxYAOVtk2FNIr5CwbAY+N0rD6V09FvT2BosNXedevnQg6kFQGx1vJ8eoSMsGLQi/s4Vc74tK7egni8XJH4SZPAfxzasrx9jcivRM38d0PvxoTdRI2+Lf0dxblFJqmOily7fONVoL82+En2Q6Vlub8iR8soqLln8ob11k6j/xL8iuGLl+DH593qZkVk8cZvj3x53MDsgude9fe6NjJnehOZnmf 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)(7416014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:56.0836 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87e5fbaa-fb8f-4c32-d6aa-08dd11486389 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: SA2PEPF000015CC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5707 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/kernel/process_32.c | 4 ++++ arch/x86/kernel/process_64.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 0917c7f25720b..0bb6391b9089b 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -213,6 +213,10 @@ __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 hw history on AMD CPUs */ + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); + return prev_p; } diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 226472332a70d..371e0e8f987fa 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -709,6 +709,10 @@ __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 hw history on AMD CPUs */ + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); + return prev_p; } From patchwork Sat Nov 30 14:07:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846533 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2087.outbound.protection.outlook.com [40.107.95.87]) (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 7E3641C232B; Sat, 30 Nov 2024 14:08:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975686; cv=fail; b=H0zaxEru2/eRJTUtYzEgXSOvjlQYPibgaMYUrRsH4za4P5TD9Fz6dYhuyzq/25gDuN2957s7IcRck1wm8DBpgmgnZTvo3j8GW1Ta2Ki9Ie1kNiKNIMyC7eSCNEASm0XyC5GLM+wP5DrAsxAxTbSyAXeVwGb+si++7iFDwuIKEfg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975686; c=relaxed/simple; bh=raN5KExkCsujKrVcAi0TXfz8VmpAYeESNZ7vG3LUdsQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XFDicnKg83geuxDZQJKDVsnLeiSxc9LZ67k7sSeNfgHNSv63uWRaYIwApalLLHQOGRmxM/bQTGVMA0+MsQVmsJYBRjMjkJnH9PgoheccupCU5Wji6Ng7FzeHQuw91UCAaYXVOSSX0H+gYfH7Y+CVucjJLh2Zb7hjsEDGhJs+Jg4= 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=LAY3/Qck; arc=fail smtp.client-ip=40.107.95.87 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="LAY3/Qck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ltliyj5+9gpfWX7RsgX1IQsZvWgrf2wr208covsUhwNXi2Qo+bXNNM9Dpa9psCZTviHOp7FhpMC+LXhUiTaJM/vYCvoxk4DR5Id6fxbq3q5C7pCf7DrwjswKdg4tPx7h5h/rcdSCRcVnXivkWunTNiZq01oX2yqkMif6y2MRlzAYjK1qq3sG7raoXBCzL4hVFYFRM38SlHWIzRdEL1B6ntz7GTWTpMSy4J1kslfyNLYardJ+kF5LU3T97G1uwDuw5gIq/n2bmspmUmz7wKyV/bQILJQ8d/hGFaoi6td3kMDtHVj40Hp6W5Dml+qI8eDIO9CEm6kiQIujgtRgM41QYQ== 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=QADJVeRreoewXJvxyin7Ng4jHEleXsWtt7TUFdQLkMw=; b=GiEpFAjGpo+Cl5tLytMlPBiIsq5UN0+x4LxIukmbtvC0b7kbV/hEdqIJAkRn0n/bAgqv7Cl+pddtHJGhBcFZmWV6i2riWmRy5CyxSC02yUHXK3VUVvYDKYQVFi9Ln87a0ITKUnHtGSbeJ/tLOcDL4WCiZ80kJavndLEEdDzw/fPhFEhdli1aGMGG0rjFImyaEBb6v5NGWQaXKppzk4q2/j2yxBx8UYm5Olpwnj1e9oe07D8sO42VvFCKnsm2EsOu2WIyzkRGMHetwcZaK/qn1mc2zlZ3gUaK/qlwyag1R8TsaIR81LQUJayfXs0PQYQ8mxRAH18BPzzgY0REhXsX0Q== 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=QADJVeRreoewXJvxyin7Ng4jHEleXsWtt7TUFdQLkMw=; b=LAY3/QckkJSJX5EHHDryQzRsH3hgbGrK3kMY9HJw1V1jjBdytONNjNm/LYPdkY/9H5Z2ES6GxvHLgchx5ZN+F4fwOhsPbGSXsetew+S4cPOgEn0GbqGu5kK9Yh/HxCpaG4yd+ABwrpgOPpDJY8vm3DpPoHXWhqplV7V5uFEt8VU= Received: from PH7P220CA0124.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:327::27) by MN0PR12MB5834.namprd12.prod.outlook.com (2603:10b6:208:379::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 14:07:59 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:510:327:cafe::46) by PH7P220CA0124.outlook.office365.com (2603:10b6:510:327::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.14 via Frontend Transport; Sat, 30 Nov 2024 14:07:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:57 +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; Sat, 30 Nov 2024 08:07:55 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v7 10/12] cpufreq/amd-pstate: Disable preferred cores on designs with workload classification Date: Sat, 30 Nov 2024 08:07:01 -0600 Message-ID: <20241130140703.557-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015C6:EE_|MN0PR12MB5834:EE_ X-MS-Office365-Filtering-Correlation-Id: 677b94ab-5884-4576-1f75-08dd11486490 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: JZzGagHbDu0y/lOGf/YZwzmKTcGfsWr5X9jX4LVSbmcgWTWDR8kiuyMGiqkzEa0R3JvE01namVx3dMMdp6oFQEF4V1AU+TD/IHqCMRuGtF7VfTNyoEQEQLcaTO7HaJleYnikXvnJPUPY+t0T+B/SCIbsdOFNk+jNjfBpcrgGlSLlwJF6+mCDEFnvwKSrwBcUv0lbQsi42TztIPcIPdFuN7JGR+buUze2k6gVNPBAFPMDRdzh/II86I4yYyyr35aO0sgYva4PFMozJVptr4z1C5ZZzc6in7o5cvoFHe1mNi7ZyVKlnjmDguVJKfB8z+tNXAluGpi/YWS+LuNY6gXzh7ThcuUkB5TMqiAvzJWITLYbehK3Gb9ENHVDXl3bCzlrodWePMWwOAqcysAekS+xlxxxmbDDu8pfZY5tivSf2qkIh/RZAeZzPBJuqS7XIqaJWejN+e/2cYjX08O8uhXikECSfAAcMS3ePglVrJbXRFXBmnzfYI57cfIS+8Uf63r7rd3rFOd5FrPCCe63RsdU20on5MKtsaUxnsSki0jIb11mfn6uEBl4q7NZ+jHCr6rING8BI7fO36bkh3OGg/p+0qy7rxU9yc+C1+7lTuGdIP7oOkX6/2000miJYsOSN4CLG03oZwBUf6Bnn1intMloIc7y5k8XVCsJOZswGFHvfG+wkFGUyB9vx0L1uCCBxZCa2bdlK3Yj6aGnobNqZxE/U605M3uMlxRtJKCMsojB84ycG24hLzJEdpfMJPilW3O82z99ear9S+2ejnT+vI7RytYRjSx8MpDg3ENXqZ9rTU3lUjc7cOLCnrrx8zn4zDGZZqhe4VxEGt8m/2xBl2op/PVWsdA3tTYwtEymDlA4s9xR5JaRlfi9ghXBp+qRNiBDP/TKV2EYICAauf4Jn1C4ipbbkXx33NRWF1VJs6wRs8U8CxTI6NVbSau03U8JZwHM2x+NZlnTL55r4t1+JUqiY4DrC6nWmkcaViZ5hX2HQVGzpH/DXNFU8IaxoMVEGvvphzp4Mi1va1JRBenkO80M6o5lxCZn2RTQElsOZ8nd3jxJ9ZRAj6fd7CA/IXU6bUsKxLjnoQi3Ecx8/kkSlII0E/RizrhnW9xPBUv7samNj5tUrSL2bY1GdpEHajMEnMNJSIbD/s7t0ELcuj9Ir1XqpLcePpW9fYPPeiKS1y4E+AP/8h+TX0+mjByg27yMvmn5HiH4Sjc6WX2X3wfa0A5/pQ8hh3hz+iAy6YRunTljNq+dhK/rKiq3iLv3IME+M2sPRGMZhbBn5qGy+Xd5tGzWynjGgmDxcyLnIDqS7Vz+0kp00/mIZR1yiEUOJsLDbtPTEc9EQg7vDxNRAWBVeSGK+uSgcCA/SVix12rUvxjQFtMTS3Sk6joq9BNawfSU+R8AAamUVyGXbP1p0muoILqQ9CiRmmL05RzuUvdVXfZ58LhhvY+eFoMHCF+9EVneCZvr X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:57.8181 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 677b94ab-5884-4576-1f75-08dd11486490 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5834 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. Reviewed-by: Gautham R. Shenoy Reviewed-by: Perry Yuan Signed-off-by: Mario Limonciello --- 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 d7630bab2516f..6039c719961d6 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -788,6 +788,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 (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS) && + IS_ENABLED(CONFIG_AMD_HFI)) { + amd_pstate_prefcore = false; + return; + } cpudata->hw_prefcore = true; From patchwork Sat Nov 30 14:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846293 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.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 33FDF1C2301; Sat, 30 Nov 2024 14:08:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975685; cv=fail; b=Cc+pBntbFWBX5w2z7J6j1Z2H5xvQmozxrHOV4GHz9+p+Nppky6Pfyftnc9fxTjkwaFtDdvPmjIESi4Iesk2sL8aOtKe242VQpLCb8RlbhvKC042GrStpj2NX7X9FTbnE2pWQLM0j6afcxNemJoF0YjUZsM7TlvGgwlsRoHXaf4g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975685; c=relaxed/simple; bh=SyTSHZsCUn82tUVuRI0O8Q8JYKLMIYs/4RA3IHHMzq0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gOxpWQQsIz0VcJGQGlYdXrIdyUpO3i2sMg3aXNhvZlhYtU5H1HV6YcsLPiPxfepxJy2GBimey6ivCloQBZivZiWbNWg9yOATt5+VOUdNJ3gSVX1v2RU7cbtiRCNSe01Oh5YciJ/8AzBV8zhu3rg7Fwkuz+/DH71WvGvKoGTb1A4= 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=yMzQzbaP; arc=fail smtp.client-ip=40.107.92.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="yMzQzbaP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WnfTlmQZer/bZASj64gQ4Nf4+R2he9GBrfObwHczYYBEx5g44jUl+YlzdPVv2W7ICXBEtD3+eNVgVbQ20HKAORPpz5+piH3fs3nSSbnMD1IQD0lLdb4aPFoK4ynYMXiGgeeIguk+LiLyZ6/+BchnWmZrf8ojSjnFz08KI1OBPjaGOU5omY/f5yN+rjUuKtoDfRLrnGLVJwgsH95m0WIpKyE5kdAk8B3nXARqzKRAwBEf7OxpwCpFf+EDEayKPQwY3anlEA68AQBqFT7rNLSKQlmh3hWoPJGCqiFccv8qDu4GIOfwAf3gVHRjI0L+KynQuq5bBAo6qP6tSDE2sxoNPg== 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=Jynr0rR5oKbG7uuIa/0APhD+gIeciu7tVnGInLD4URk=; b=rHGrRfgnAC+NASHqDM8GroJyGx7/0Palvxmdxz34nzsBARn/HZGNH1ZOoG9aL3o+xNTgPgGhJJiunAio+Q3CLRjwFnU41u5bqc3D7gUk3yB+YAxQTLdwYgt5osFvPILuqXmURV1XXbNxA1bkQXhcn33mS+VEwnirtGf/JQ4VXgymXWDXZ971shzoR9cR+dVsg1bGppRprunC0y/aD5+oLJeDeeX1ra6vjkp860XIBL9QFfNmWIF4qEm2zTqBXXs34mKz0hYhSINyZKtaTEUpe2mcslNWjz1m7l/Bbcy0yiUuOS8+ZnpIQdAtq5eOxp/aKLqQJs6myB3Pge4h9MDU8w== 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=Jynr0rR5oKbG7uuIa/0APhD+gIeciu7tVnGInLD4URk=; b=yMzQzbaPzhWCQo0+OfQ4v0hbYyYQArtqV7WE94OULdS0c0013Xh58c3VOdP7Eg8UaKDSatYE/kZZG4wN4SuIM5RsqFhx+gmGbryZ4rVpHY3HMwex3TQ7dHrR1fxkJPdOfL/Ni/nIKJWxCLL71YUu8WgFN89E91PWYGfwuz4M3Z8= Received: from PH7P220CA0143.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:327::25) by MW4PR12MB5668.namprd12.prod.outlook.com (2603:10b6:303:16b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Sat, 30 Nov 2024 14:08:00 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:510:327:cafe::b6) by PH7P220CA0143.outlook.office365.com (2603:10b6:510:327::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.15 via Frontend Transport; Sat, 30 Nov 2024 14:08:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:59 +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; Sat, 30 Nov 2024 08:07:57 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v7 11/12] platform/x86/amd: hfi: Set ITMT priority from ranking data Date: Sat, 30 Nov 2024 08:07:02 -0600 Message-ID: <20241130140703.557-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015C6:EE_|MW4PR12MB5668:EE_ X-MS-Office365-Filtering-Correlation-Id: 9140c8d4-fd88-4475-25e0-08dd114865ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|7416014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: zZYC1VGvj3g6yLz+HXV4Bmb1kX9HOYa2qKGfUKQbdCQDsKgsEAD4IpOBsP+HIrOEY1IWXyRom+rT/+x4w/s2vIH3Idn3mPRlwkK+qQLp7PTXQPR/T8IEpfGDmU4jvrclblkRFgCk0XtbRoxCETR31nSFrBOjjhao8f2w4rzBrBQji7Ms+UsINIhOP0wmq6IS9ACwXZnoz0/DJ96GaGkF+iRYL02l5mw+DmMbsyFzFan+pKdBRa0grWhSQ7bJVu6IvAOsq0uFUV3lKDoOFCQmdSXs2X52qcEZUA3IJTTg5FOLR3v9AvNHlWWY8481EgiPwS3i14khmgzRXQYi9TREy0U8oeNkLzH3osh2KaiLJgdiTdTuY9ttyVqSNQR60YCvpV3xiU5fcrov+IjElH2bxv0sMRcUEOt07/x15XHwacL2nHbEHaPB74FfsDm7pg7meCe0+ux5mSPsjtE4rjOrG3x9n4S2U0o3F1iXtf3pFjWj6SbiEYhN4iTi/5Mf1pHQ8psSdLogaqCBWB5bh54eJ7oBhl/pCIYUDOB+qW/OLQQqokXtgZSLx6qxAzub9H7Tm14xrD4Dfey9SBnyxzf/QMKMbsdELhytXyq5eQmyQL1U6WwhtEv7GT7A7tVFDUIz/l7+/RUZHPnwdjVoKiTV9nQ4CaRvGM40q7hqwlIZI0NWbLCSUu9k877xXamoM+/PWJmju6rGX3nGHU8EpVaKviynJuJJ1a4ya7uteYArs+JpWD+iVBAyHsqUZE8gGH42kkq80Ty5lfPX3/bRts4IkCPTuPFH/Jw0tVq2l2DUE1zVy5VyhK4LpBWih4yanWFHO0pa+BmFk04lKA9hp8o9kPdmyNFe4nTVXiQeTiu5xGRRIgU+j/TrpjJFQwp2CtZ5uZsqqaYZhZITyPN++nbOD758O1jddP1cDCM37QzBNUYEpd+6OYQ7CGgGso9aMmgYhPOwOlNwPes+lmSXBAndTgvpuJ9/Fa6BMfxmrZ5ZSv8deDiO6oWd+klvVt9XFZiklfr+06IfHCNEw7Q3j1LhePwejENeD9/zWhqHgINsztH2ZDKOOeAICCoiEkL5HhLeNhD/8XVaeNewG5y5ps8zEAiHl8YYuKMjPaSwvtqMGjX1zLHBrXqtft8KNYiGWp1/nitjO1KFOHKlQMaCIy4ekpgjlOESusHigJHSNLzXhsMAg9HrXDPDPMTkOh2obtMgrbQyEIlb7kiJJUh7Mhljj74Y1+ALYStP6uK5KcFxhqK8FdTVyHhmr7e1cz1ejOHV/sxk+iqHqnLLS/dn6YvyMAejUnT9lQvdAwQJ66Wq0D1o/PskBA/98mRe4WdI8uNyTuFX2Qe3/ErnEUsMa+C+0JALrXler9wbLDiMsqyz4K7JxG7l1Nob+l7VhzmOJ8ce1YfiW9zp8SAb/DMPjU2EfWtt4nuU0HVVJF89Er3EwdBL/Xr8c84QBmfMHoQotPpR X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(7416014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:59.7712 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9140c8d4-fd88-4475-25e0-08dd114865ba X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5668 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. Reviewed-by: Gautham R. Shenoy 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 532939eb08a6a..045f598f4866c 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 diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 80ccc50ee0914..0940950dd7adc 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -115,6 +115,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; @@ -234,6 +240,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; } @@ -453,6 +461,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 Sat Nov 30 14:07:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846292 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2088.outbound.protection.outlook.com [40.107.96.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 80CF71C2DA4; Sat, 30 Nov 2024 14:08:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975687; cv=fail; b=eWcvETDHgiIA1Meqy40i4ACwZhncJEv0n70F9gLWNWUFKEOUDH3pykCB4om5bJ6BGeyliQ2PAaa6vZPLApj3zhAWPczB2VK1zq/kDFmXBgZz2MhQaLfbJeJwv/bztu4qoijQoc4avydpHZy7yHGhUW3kXHgIWPMCEaNwphD4Z3k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975687; c=relaxed/simple; bh=Q7DY709JgBs+QNd6i5wQZjcCds4ZMiJT05soWR23iNM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ix5yWrHbd7CKQnJoXpgq5QCIdoPeBCVjqj15ldTkddMWU2Wg2o/fuxweDTMwu2UEq/sz1qo2cacmSu6MBKSXjUz98FkNQF1lxU2wiuCZ/pExd5R/1LAqNNCr8ozSZ//ZK5t9UGnk+FOweV/heh3qXYwFdLerTdL1uKHgjSsIQek= 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=ktI7c5TN; arc=fail smtp.client-ip=40.107.96.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="ktI7c5TN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a45NVC0RNr38UC8lE2egntnetA42SHO2PKwzlnbwq49KjagfLTlfBIpl3UlYcquGpbUJJRdtW41ktJSecUqgYxm1hVK9Y3wyYsLNzlWrtFaAFFLhpYId0pr7BT9Wc505YeACsOwoLJoFmbT2jxw173dotZ1UEgCJw5ow4iB/ZSy/1SyArpdcfCmq0NRULRV+jikjusF2pf4r5HLfVn+3LLgbEvBssjf7/i2X7Ea92Z10DNCvLQ0bir7TyXSOYsT+40PpE2GS67Uoq0Uzi2gkaymc7kReyhalAXj1CwTHrQAGaAudL5UqHPe8PqAfhXYKE4DEiE/3tlezZ45O7IPVXA== 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=CbsR33tA3QUueZBtjGdlP0wv8lbAXeI77bNgCXHd8C8=; b=xpffOyo7b8gd8v9p4vjMoKARaqODq0W9kK3xT9gCcBGkgapQksy08Vvy+uYEB9s4TKWyggwWX6vCSMNy/P+K4WmoSt/nZb//7zCx9I/KhQhtKSjE6RmUc6Vl/cItjGcz7Bxu3XiVyFShFrx2kfKh0r2gPPSy9OxXng6CcAB6IXNG+9kXusdAnPz/enra9uAI2zRjGCHLBrLUhOsbDdu/xrvns5Xtdru4fs35F972t0Z7axnyxeNNnKajHfhxcJxmgY+1n0a384UkWsIhgqU2m5Lu9ziV1US9RIVDSo39U0X9NparlxC0XKlz5Wo2Cosu4sKriTmlkL0NL6EAaS0eEQ== 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=CbsR33tA3QUueZBtjGdlP0wv8lbAXeI77bNgCXHd8C8=; b=ktI7c5TNkgAu0oee3kL3dF6hrdux+AaqE8uXB1GaxuTa11FHyCEfZLy8vGAutNyZCu5h07FW5voiDkkQYYY77eTnHgGxoG7yHHKf9LZUcNxHt1AvblBbCKsUY1T/xMZKiDuSXe9Wr+HoP5UuBLx4+dFk7SDwf32M/U0wa9toln4= Received: from PH7P220CA0142.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:327::12) by LV8PR12MB9182.namprd12.prod.outlook.com (2603:10b6:408:192::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Sat, 30 Nov 2024 14:08:01 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:510:327:cafe::87) by PH7P220CA0142.outlook.office365.com (2603:10b6:510:327::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.13 via Frontend Transport; Sat, 30 Nov 2024 14:08:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:08:01 +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; Sat, 30 Nov 2024 08:07:58 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta Subject: [PATCH v7 12/12] platform/x86/amd: hfi: Add debugfs support Date: Sat, 30 Nov 2024 08:07:03 -0600 Message-ID: <20241130140703.557-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@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: SA2PEPF000015C6:EE_|LV8PR12MB9182:EE_ X-MS-Office365-Filtering-Correlation-Id: e61f3559-b313-4743-a780-08dd1148667d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|7416014|1800799024; X-Microsoft-Antispam-Message-Info: Kn69cWulKFmtHeJE634Z7am8bfBwKBYpV05ESRiZB82eTlmGX/m33b6xevi8iCFZwcPKKPZEwXms6caL/AKOdvzojGC38lWEE1kqVEhLXeiXSFkOHxt0R4EK/QSnM+lNU/55fE3q7ngSKWIz/5FrBXT0p5XF/7Tev5ZUn8EGMtkk/ja+rmqQvqlScqy1h9FlsAtu+qOqOm+aLFruHWYDil+KXsZEc7QLGa8oZPAj/i5IJxjl4AK886rMbuD5sth0x1nK/7WO/tOibpTXQFUJ3Jin1eswQHe26LNuAPqDdD9Qyb0HkAyJ7p13ziTtPZzbvE0ht1NsJ43NrPqS1/BjmjoulJlA0oQIh3Jqx2IxQLxRgMXmKqi2Ic/thPn20fO5gizfs2PsvtMsCMXM3ycT/AsTA/bFrCXJIJfGQuPxhTcHyUFnMTCtyGuz67DVPap6Na1ENY6hLbu9aB9udg9uv2U4tFi4a7aX612YyqjRnj+ct5CIH3Cag43UJrumNQevrR/4vD0Y7nwDY8+zS6xRClUKQAJN+44Rpzj+Fc9L6RVgP2FggMh8DJufljcyOxnEn9FnZcl0pmuYFTf/ypJUipNBvm5+ScuRjRI75z8dD59ixjmDDfJ89+wYTMVzSBH+DjFxK5XVkfWxrUiDs/Iy/KnFTSI5aVsPRniAPIY6JWJp2n4do9UfXCvvPMLho7I/J8te676rLN3K0SMb+InfLUg9IZ0mJZZJiTCv9nUi+Ui8Qs+TSscQa8u3AS4dzu3xZofZRQisCO91bJ8mmekZluVXVOB+NgThMNRwqkE6ehEJpjA4bJ5RxFU2BpiFONKG5Nc2HCgH5dzFPY+gOfxmrSkZSsUduSUaZ8h4uk1J6rxujqqKCq/6gh09VKl9iviV+8ujtUgRbWTtP9OQXLsamfTp+328P+z2BlWexgEo/nUvD0JKf3ddTvyMxbiqn8SP/uGiFydz9+bbes1PjHcsw2k1Cexn8PKqWrK+/GwmdjB5b2XDXpPUnB6o0E81GuuTOE007F0gpXkxz+Ir9yTnf00qq7v2eU/I63KYwUV1Wy2RRrWj1sF0UIH5/I8yuvFG+h3DoW5K2+u96mGjg7lJ42IB/Nee9nCo+7ZqdbIui2txQBdpDP4CDdJzOe9jTfC9G+Cr0zymhGt9TIzekD1bhx6Bjx0RKKl8m+y6JAq0/d5xPy8mTCp30DT0C+nn1uSWjTObcMHzjJx9j0eAB5AEClvqwejHBjQtsIJnl3IsbS/V5haXa7ebIl5nIygcSNQ9RTCNZbfF+Ucot1CuRqgJiEQh82Yv9Al86PnzdVsmXo4WB3FRa28h5iNtUo8GD3l+utNSJSV3M6HMSTiOIj2X8YruRMZOJLpJ26Vd0unfn/fOnHp4DdWl6BTsKZwkzz59q2lvO7Z2fl23JMUNKtdJh5heVffUSqsrMoDFNFtxVRQCk36nHd//7TKNCivyZXsR X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(7416014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:08:01.0525 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e61f3559-b313-4743-a780-08dd1148667d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9182 Add a dump of the class and capabilities table to debugfs to assist with debugging scheduler issues. Reviewed-by: Gautham R. Shenoy Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/hfi.c | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 0940950dd7adc..b6dc379bfd546 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 @@ -74,6 +75,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; }; /** @@ -234,6 +237,13 @@ static int amd_hfi_alloc_class_data(struct platform_device *pdev) return 0; } +static void amd_hfi_remove(struct platform_device *pdev) +{ + struct amd_hfi_data *dev = platform_get_drvdata(pdev); + + debugfs_remove_recursive(dev->dbgfs_dir); +} + 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++) @@ -388,6 +398,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; @@ -463,6 +494,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; } @@ -474,6 +509,7 @@ static struct platform_driver amd_hfi_driver = { .acpi_match_table = ACPI_PTR(amd_hfi_platform_match), }, .probe = amd_hfi_probe, + .remove = amd_hfi_remove, }; static int __init amd_hfi_init(void)