From patchwork Sat Nov 30 15:20:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889251 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (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 33C58199FAC; Sat, 30 Nov 2024 15:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980055; cv=fail; b=Gu6H1RNO/z/YOBTSDzx73q5ZsW33j7EDvrFCcRvgMog12G2ubb6EofHg1YO4Q9iq2CU0qi05WgTRRQntHygqnhFYJZeNjYb00nZ3524ZA4JcyBzqdEubPc/2MBu4/JDkqssOcUdj6xWkIZwu2yKN4NImOt8bfzqYFJIpM52G1qk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980055; c=relaxed/simple; bh=DMjuuDJSJxfHSpL4ibtc9T2fw/bT7ago7AntzlFc7a4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KseXXSHFoWS6UPqr6UhrtG5QGjE5IHvkdk9TRbW85dwFlOJ5InCIQafpwXQJOCKDxwGzDSTz/l7Eur+hWrXZf+Rq9sWp2jAWbQ0ideAs42eZxySCfgjrQbw7N/zPoz1HjjvoNax/8O4dgpkrvvmG6OOfduu+uGy7iVurrkxK6og= 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=Te4nnZoN; arc=fail smtp.client-ip=40.107.236.40 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="Te4nnZoN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LZhngobgt0ICRODqCCh5WtufcjJOGH8Z31xLTQX/rydWZ4vpL8LJKeC1ryAtG3DXA7Dveaa0wlLHShEn1FSGI97jTZf5dQl9Q9XiAvUbXhD/w+ewt93//43lX9rhkxqbGvZpoU8KWgjVjKv+hW84z25yWeDhAueDezm5KNQyY7JL5ujffVcsMwEskEJ3v6/omx/sTPuI9sRtjNy1aGujpq4n1F5BW9xXVeFuYWEtI09BKvUvpBV0n1bj//IjKpzC6QnGoYorG0a4IQKnUUYbmcWKGGaeQzE0LUdvCeO6EI+AO9IfqM4uPyRCYLswP30SgGR6he2J0qe+Xhjm0146Iw== 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=opms+vMDx4rmogmIr+sHfSdaGbZxkYR4wTKIHQB9w6y01PtNNaEnz+TIrEOD2vyHfqBrewqlnei9BdxRsrWtqPB6e2iPf4rHZCWAy6WEO99r7mZsNSWZpV7efP0PMojhNBOxmgccL7lvfqo9vNYvLa1Ur/TxcehEc7eqeH2jQg+g9rPTA9rq6v7Uo7FO7FUvlrkM8e4Da0SN3AwqgyKrXd1fUP7r0Bof3RpVX7iV9GaazTgxGc2k20iBW5Wybm7JPu2OF599Eqhun5f2ovudrcxrS9YrPrwXxV0ZeEQxfOL6jlRJjBkwg+trGnG9U7EVdsopCfnN1tewEaE/Pvlikw== 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=Te4nnZoNIMR/bqYc0z2GeAOMRxJjG8Pv+KYnATYs8CL8nQZV1b5KDczv+/H0VnRSzPOzlUaxbTZYpmJS7BR3eXxvmqu8HoGnCSH8OpLwXxckJWklYGql7Duw9ql5nz7FBTCANqgk+CEb+rMIW9wvotPlEsE5Y3v2jMmNBVNGi6A= Received: from CH0PR03CA0315.namprd03.prod.outlook.com (2603:10b6:610:118::15) by SA0PR12MB7073.namprd12.prod.outlook.com (2603:10b6:806:2d5::8) 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 15:20:47 +0000 Received: from DS3PEPF0000C37B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::81) by CH0PR03CA0315.outlook.office365.com (2603:10b6:610:118::15) 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 15:20:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF0000C37B.mail.protection.outlook.com (10.167.23.5) 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 15:20:47 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 09:20:44 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan , "Bagas Sanjaya" Subject: [PATCH v7 01/12] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Sat, 30 Nov 2024 09:20:12 -0600 Message-ID: <20241130152023.684-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37B:EE_|SA0PR12MB7073:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f059d32-84b4-4a53-0f2f-08dd11529123 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: 2sqiyneMZNtTNVRtjnaDxOVb3GDlxmDq56sHW+veMjs9GyapHzPONPr+khJ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c7nqg0YfGVvU0p76+xGr+uskp/ntavIq1tr4lrDzpjHlwI5QrjPndpLMNCHzg4eIrEXnXlxrajKdH0ICRh4a7wAkY0mrhkjBLtsW1wiYAU2UTg+FtsX+f00lED5RUbJTiu/wJqD+AfTVBM9P4oYAJGE/gjyXrQ0k3GgQw+I3kg2b8jPjHyohJe1hlqPW5MPzKu8SbDE02whHKgdRgl5S4WaKy6Bv03phRzh9kZ2Z/BFUQ6WVV6SpptrZXuGdWsjd/wdBFSS7F37xYpuCbVVuL8pBwf0hd6J1Z+3RSFylDMneudBsX20nhkzL4T5MkPoxFOwBbej28vJqKV+W4MfvuQ5t X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:47.5525 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f059d32-84b4-4a53-0f2f-08dd11529123 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: DS3PEPF0000C37B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7073 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 15:20:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889250 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2065.outbound.protection.outlook.com [40.107.243.65]) (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 1FA8C188CB5; Sat, 30 Nov 2024 15:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980054; cv=fail; b=U/Pu3FziCnO+c+Zx4/N7FS6Hju9Yk7eg/mHOKWhx9oEYSc69TwWDufw5HlnzDr/Bo3tIvrWGpI1KpzuGgCzBzwBEEMHGIUdY7bndwVolhCCz3CdGEB5PcgjQK4nDsl4UEkJOnS+Pw0ILqDSr9x1h1uAfrYdHNtqQ8AkKX6kiEIQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980054; c=relaxed/simple; bh=hECZMkZyOmPdRV/C1pJPOiwKMNq1IeQEeYFCaag9Rmc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l8Em5TAdCoSCdh47tSPnUAQpzmb3dplBkkDGpu1GhEipHwKfoG3qGtRjRek3Ig+n/WjBQIAk8Q+vd638NI3ThAivXkkTqQ5EeL1RbYW5FzgIKdy1QuEk8znNEdKVPs18bL51xmETK66xa4r3DaJx4oFIMQgXB77nzNZUpFV0Ma0= 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=FUe2mCon; arc=fail smtp.client-ip=40.107.243.65 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="FUe2mCon" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TbywpTqP1gwKMehbnMrXzjUiFYnsyGUiLgWJWB+ym+0Yz7x/1wt6YQx9m2TmPcGiFTE0lRf/GXQWDcdE9+4LfFPquU0tr1lb9MjyBTAA7yGE1QTjxDYotqBmy9VCcsjfCX+lu/goB8DxalHs8BhvZgddPveqtpo9l2loAoj8x1jePF7BNpK6rDN3L71Ih3WTzu7W6u4X6+QWvmei7q75vYQwX0V0ZwdakxW6BS/fLbIpeUJ/FKeJ5uBD1SGRRuPOaxexuvojLABXmxo9jVq5dyf6De+BHhgwbwRwIdkTr2adiJehCFvXpQe9ScAS3Cr/WiiE/h7H8B8+AR1RNRW3IA== 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=pZwMlqhxyy1mDMrmErvGh3Q1mlF9LTCdRLilR6oGItP+cbyURY+2kjfhO9zsJ6vVz0mri5/fICZ7wOtG2+FXraWrahKT34cOTPSxU8u4ewroZmPrs9xGw2mknE0zvJWLtSzFSgBAAgPvZxKRS2FUdR2tKvTRkfoQa3AcPpn2c8tq9B1039s523nehBnl+ns9ZmDlc23iS9jFyIqcVlPR7tm0th8PKmDAUmG4uo5TeJx5pBIU/jqsbYQ8TYV6ymAo+ijtybjp1MprMpLYZ78WDgaM7YPcIFxvxTzoeHI5rI7UqrYYEDlOa2RukRDhswwh+9NJURaL6/JLd0MlWxC5sw== 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=FUe2mCon6KN3H+swqzsOsGBMuzyp0SX//+XMoerJDpUMs/He7GYo6Xv6Joz9loqJX06mCEYYGsBfYjT/O7OddamJCicxl8YBAYRhk4INmW0nb6FTfDvfrdUH1ZETLOqAR/0R9A02yfGinTdoRyl1YT7NBP4QHJf7qvzg1HQ8SMI= Received: from CH0PR03CA0304.namprd03.prod.outlook.com (2603:10b6:610:118::28) by MW4PR12MB6976.namprd12.prod.outlook.com (2603:10b6:303:20a::21) 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 15:20:48 +0000 Received: from DS3PEPF0000C37B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::b2) by CH0PR03CA0304.outlook.office365.com (2603:10b6:610:118::28) 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 15:20: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 DS3PEPF0000C37B.mail.protection.outlook.com (10.167.23.5) 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 15:20: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 09:20:46 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v7 02/12] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Sat, 30 Nov 2024 09:20:13 -0600 Message-ID: <20241130152023.684-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37B:EE_|MW4PR12MB6976:EE_ X-MS-Office365-Filtering-Correlation-Id: 70fccdc6-56b2-480e-f6f0-08dd1152918b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: mP4REPKerYKgK04f7qZVMU1FrmPKLGojw4B8mceVnouq1L8WFiTg2EVTS40uOewdtigm9qDroUMhbt9W1IWixhW6mqu3VDM+dJUxyYBqubKIbrg1RkTyz3/l9vCeP8JAS2TwL/lfnWxIhDwulqIHtkjr0ZF0V7rtJkO0IuC+WEUvywbyPT2jwq/Ss9YqSY4lkFMiF+8/Giyrbxi7AWhxvr8oZ96Pc+9TjfuR6TJQqOZ5ZpOkC8ttD7u3EAdSdv5h9E7aJf8XQbxYpNHGbt+XLC9eb6M+L28mexVDTmOKu4+IobcbbcW6hkX0l4C+to+qVH6W8BQwJnrnQnTACE4+pfol7xNbfEKbdZEAR31VLT0pF7YI+M1kaBMHzSRaQnhnBJvCr2zHcR9x3YX2eisucFcO9beCAP+mcck4FjMkk4yUQxZ4hCFtX1EeRq84oHANto2mR5bTwPjWwBk1LcJrhe5Qx0G5cuLP6mfqh9Upg5T+ZlLWyQI9cu4/+aREU5wbKSZwH8vbZ34CBTdfUfQg+r4tNtxilwY6d1jaNHAz/ZXjesoEDqVY0JHLB9jS49wPRDnoM0x7S3zg87zDxHzy9EZ/QqsmrPwHebRQ6883C8ebbT6QHzagXmJqHAeNP+iuPwAMQiy6o88uWtjICIDzBAA4JmsTbx6RbjHaO5sTjM4byHqsYCRxWYlYezKXfTk/ih+1CwVExDzLOz+WE7/LMe9n00PaD1mA12vnHWJlGSV0hVRG8v0L8boWGgzSqMEbfMndKDUoVnF/zi6i+rVF3duS4uHbmAQ7nesDuYRoPikFebf1Xkaz6W0yoqyyXc9KuO8cAOZgZ5R0FnHZWm2jsqV7GPJgIRRRPSfhtU6dEViCbb/AIuN1dmejxnfIvL53bcnflRYQ+BZZcZBDMF0Khj6oDZCljnEF3vNig+r55wUqKtuMG8lmbX2+PDqKUrYB9xzo6uhp61l5r4LYh1D+4kru4b/crqIhS/ju/e2/HYcLq7NlK/8kilpiGEfc77rFICqbesLD8lEaSVdgW31PDkWoq480zWIIfFAEFW5ibxSoywaKnsrdaE/869f4l1b0X3THDExyFyYiaG2VSV6nALi1rlJzw60+SYxJNHBbNzjFtknTVZTNt8vOyHzeMvZ0pLBqUXlUtQnYp6cUeFw8jMXmKdV04pT2KsRyFKoGa7WRmnuel2y6ftzdxORsEPq49tGTsYE44RnC+Ec4Hy+V4fIo0ww9qDIcR+QalOvTMmXeYYB4fqoKBBjNNB+klQ89HPswpM3aNYVbQ4MimVjvnD7tz4TNdZeDh2vbPsRzqqMdUIVg04JTsmfUmtfXlLeEACTaOcqJaUBHL0/noPJxgRQ93tJC1BIqwAqtjKyu1TplDlhYJsnT7JkWH6i5+yqPX+jaDrhpRD9nO8Kn0olX6A== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:48.2244 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70fccdc6-56b2-480e-f6f0-08dd1152918b 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: DS3PEPF0000C37B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6976 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 15:20:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889248 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2088.outbound.protection.outlook.com [40.107.101.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 AC62612A177; Sat, 30 Nov 2024 15:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980054; cv=fail; b=cn20exuGdOc4ZsYEeJ4JjzJeiZrlAsuDDkeUg/viNbL8YXogPYskU3PiLiAG2QMmimw6/DEBa6y5QIQpgwNuVdgFejEdTWlBO2b/2EdLfOwN/IPts2+h/KCoMx0Ny8h3B0Ud5MWi/Yh0MBMUFYUTJRFVWYyVMiCOedNLsWTsLWg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980054; c=relaxed/simple; bh=6/GNpT2p5G0nMQWNGh63AxQqGIghyA/swYKFuepemJE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L1RkZWDQh8mIexhwLNSwjJ4jJb6WV10brnOeoieo3E4GoOMilul9WNqGfFNUwg705yPmreHw6vn6FzenaoMtZTq4gHbwqPbR6MuHW42nFuJH6Nt3P4GdKcZHwNcp2180iwjld1Qvcf/LpfMZYZiqOis9Iawz9k34rVNXsk6VQ7Y= 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=Llb4drEK; arc=fail smtp.client-ip=40.107.101.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="Llb4drEK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dX0Ywow2/MAxiyzthzAVXf1YZ8Ub3vP9yTXPvBUR6ff/4nTiOOJvBGM5Y/D2RPNt1bRMdYpZOoLzCtxUM6tFEDMcfQLcT3UADgWzen4jTVMtikyUdSl6+wNqoFUpVwcNYY/7825kQUBEO9OQc9dGd+Z86m8UKyYbypLSIqi9rdUpzFFGjCNmoL2m2FnrwJ2MpcmQxhIj1m2r03+gN5ErDcac5w4TaUUpbEJVVnvr1Pl0eomr4NoJjhSw1DeGQ07nKjhKiynSORsUs2lmkznAlgG/ywwUgZWScy0wwX5puAbq8xTaiYg4L0IoAKba51DLuohZXKAGOQBhazsOBBct+Q== 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=qjma4AZAaqM7HRUEsGMzGcWYw6JicWWOxRRHwtbt4kwpfTWW9mgK9DXyW7E7kdu7KhMYunBujYiXCoAm/oP0MY/flYBYM73wlu5inxFKOdF6eFQZQMus5N7iOlNmOM0gwmTLkQDj7ULg8bUm11tQOoBcpowxB2t4QZFEo7b3rEmYdEwqZ+nKT7tnEEtX3XI1+f3RQ7OcPVZlBCzLu/Bh0xfIhab0V/Uh0vxJ50MRCTvuBtozWFaNLexcV31JpXVpKRMWdYdEVzSWyIafnt/tJJVl2oETCdDqUFSH9s35RlCpZBvaTfIN+KjSCviGbgYA7PF9EtCOw3KeeLmgd+NYkA== 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=Llb4drEKl4YPW6C3RbPxhA2MZdYQDK3xZUUF7r8BjccXeMtRLfQWS4yhTfP+dcjBL61PDwxr45dFiVR4Z49WsrMUc4Yqyf+pEO1+jiB1oesUNvtW6rNzJPZh+nR0XxRHz+YuJWv4YSiqg/V35h9fvmUirWH9htPxmHoug8QOD6g= Received: from CH0PR03CA0309.namprd03.prod.outlook.com (2603:10b6:610:118::30) by SA1PR12MB6846.namprd12.prod.outlook.com (2603:10b6:806:25d::14) 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 15:20:49 +0000 Received: from DS3PEPF0000C37B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::b9) by CH0PR03CA0309.outlook.office365.com (2603:10b6:610:118::30) 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 15:20:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF0000C37B.mail.protection.outlook.com (10.167.23.5) 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 15:20:49 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 09:20:47 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v7 03/12] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Sat, 30 Nov 2024 09:20:14 -0600 Message-ID: <20241130152023.684-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37B:EE_|SA1PR12MB6846:EE_ X-MS-Office365-Filtering-Correlation-Id: f082e2d3-017e-4195-3f48-08dd11529216 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: sNBdIoPcPK2GImYl4Sc9ikgDi0Z0tdZIvRcYZordPWwyQ0X0YqM1e2Kw0f8aKnyL/x6Mpoxd/KvKbTzsFcqW9lvyjkicDmu9ZUc33ylb6bbrO5dmaf45YzMpOqqjQCpC/QArfmR6nPtCMHWBkpjJNSp144WE9Y5qNwwE5ekTiir84fm0cgDoh9oKcngFdTqI7/uVhYh3rDBb2OM8vSg/A4KZeKg1cLJGouIBXF7eEwFpJUa+Q/mPyF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XRX8x4OYs4eES/YiYxg6gN1laUcmUdTD7jkWsTLbZGYmFgzDnhEO2UH7y+oq7LZdnNpiR8/o3i6RPTv5Vi/L5C2NPGJQH1MuVYwAKNQhGXz2bAFbFZj/k+tIP4RdsyTOvXrkYC3UE9I73pX0GK06 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:49.1306 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f082e2d3-017e-4195-3f48-08dd11529216 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: DS3PEPF0000C37B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6846 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 15:20:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889252 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061.outbound.protection.outlook.com [40.107.223.61]) (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 031421A2C0B; Sat, 30 Nov 2024 15:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980057; cv=fail; b=Q7q6UBjh2VtqCw9XRSw2lBkfj7ozfqfgVdGwPdyBQ45kZbn80EXso3Jv9tLN9LWE9sThdD9qIA5X72Xz6obdqSYkVNn42GL/AHA8Wd6G3INP6157LLRM3uvpNMxyigDJ1Y76kVAUvdXlvMVUNzDPILPWxQ38TLg/ujz8rfSjpsw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980057; c=relaxed/simple; bh=Mv/elKRugYeCY4Rr1u2Vip63588Go70CN6+iTYqb6Os=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PNhBHwVDpQxHNtFPjOYC3e/+zZrjaZg5m/MR/IhQ0RkUZ1TZ3WPcwTJLubbbjAOlcDpxedkin+PL6Vp1KsorLiHSiZxj59ivW4E25uyFXsILhEkFsAJkWV6Mv0IjwH1Rd/QegMyz3bhCRi1nQGlMGphua4wEoqxIuXnrKsmsI40= 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=So4oVfVQ; arc=fail smtp.client-ip=40.107.223.61 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="So4oVfVQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EUQtFAjXLg+5g+6BBqrUoYnE/mOM4UDXL+r/mYQDyX9b12ERWSsgUSXwc9eNDWfyDaxVhUWdWcEF66O3UAAj9i4vEdv5Pw9T3WucS6Y+4KNqIaee0S1TD1TsiviukYBWBJc/E11fcNxVRB15ZfFQzloUTIrOcRB767BM4VdhkgCHp+G3vcd9s5Bl+y1o5FQzYmxQlvYZdGd3/llGCkq2bgiDtzK6EQwUVHhrJ/soneIMRH10Bb9q6IbbCI/NIEFj6o6hlFd7kGP5KFuXnrE1XheSxLz802Z4slkH4kxLc9HTLI+HvXQTCofrly6ET41g4+VwNySRhqKvgwccUTV2ag== 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=ai/Xe7/u1ZjhozUguYvmiWnCtUbo8AQjzOrtdPwMs0cFs7R1woHnotvPiqmoMcNlZJWN/Uchh7Ahmusl7jw1HCykhGNZGb6mPtol0xpm+bL+5Zv6xRxttEowEHGaE/vmdg+W2sPnu69lHd0g7zpkHoVVtCYFG2s9p2o9Cz31X+1bNeRwlOIJKqIKtkvU50OAn8dEQaU7fOxABi86gVopqaU49mQv6K3wzvGTkrs6WxFqETCTc0qhfFegmtP+1z6cTEXThdvcBXvqBQ7QozBDkadVmvxmKYnRXF25uRcQBzgxXtQYUerc+r4W+wkgSweshDgvMzNrxlKLi6/Ywa6r9w== 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=So4oVfVQRi3gl/EpdPMHu7Vn5z9W99YwUpeW70nanILVdKuli8QB8D8N7huBR3f2cqt/ewHwFDzDmf9CUbwFps8pMbZiXhUFQpr+MkNuS86M9fVi7XkwIt02DKzwUVQ7krMxKRcHW54L2YeAGFUQQCQge066lw5XkNVePUBqUHU= Received: from CH0PR03CA0303.namprd03.prod.outlook.com (2603:10b6:610:118::16) by PH8PR12MB6988.namprd12.prod.outlook.com (2603:10b6:510:1bf::20) 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 15:20:50 +0000 Received: from DS3PEPF0000C37B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::dc) by CH0PR03CA0303.outlook.office365.com (2603:10b6:610:118::16) 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 15:20:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF0000C37B.mail.protection.outlook.com (10.167.23.5) 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 15:20:50 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 09:20:48 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v7 04/12] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Sat, 30 Nov 2024 09:20:15 -0600 Message-ID: <20241130152023.684-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37B:EE_|PH8PR12MB6988:EE_ X-MS-Office365-Filtering-Correlation-Id: 121d2001-6d2b-46ef-fa3f-08dd115292f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: b1uDTjgut8bzgIJ5J2MJxCoQLO59ByxI3GAUdd/OM4omR2m4LHCc8TRZDh+ad0FpKhOPM/aVeZQ+0vtp/UPM0W3VUb2DBYyNsVOn9rFKOkG+WhykU/Dk+a1ogEAVjS344OnQPpPWaGSEPKhTWUZmczh4m88jwghkaESCF8VYLV07Jxsp4h9/KswJHIM00Vh/57vJiMAdHvAS2wPSEzWF98Pk3yndcbw/IDSVwE5cNhOxS3LpVKYjtw+HvUQZN3pgCAgDX2Oh3nOgNpOYGZZS8sSQ+EmXv2lt1bM8SQua0BxvzPvex/YcPf35ftycbnzAV5CYLCxQlP3YP94I9Rg78up2Z8gTvgYOzxJN78LqmJGfqgj5U8B+n/beS/HGxQeTNNWhjqhJ1X1UKqiHDYzziR7Uq0jW1L1YZ2KzVMrC/BmaBnlsPttI2Z+Ei6rRryiODeIdPny+nRDs7F0EYasY4udhy1B6W7m1c7JIEGTeEP9uL5P/eap95Eg8CQOCA4ZPQu279+aP1c3nlLVASUmj+4C3DuPcQeDcIasV7CFRoWs/X5yVPtNjU4OXrUd0xcSiqjOLTmgWEPTI+jWqSGdE/gLLAiHZm1PgpRc0IJ/K4E7LT8v3cwav2xhvRFdaA0k6aBfk/iEZyDtXdOFX8fnIwg+imM4jvR8BZOj4KjuVI+Oss06jLrYn9m7wZZ+cQlylYQLOZ7lYpvh69rAIKDyZTe4xj3uR31tS/1OvJIUMcbPfM9zkb0hZYJ70nBtinXF6jTcNyfuQP+so91tQhgGZGjsRfxnBbUG7J1T/WHlm4pGUMlfkpaI7O4RIvJyM5FUJLYKtG+mIsswJbVEWVjmUvQKxAszVHKqx/6LLU8ATOAHAdK6oAo/62VEOuF8cs6nuTcVHmgPRYuVOl/8hg0qEyqqmGRvNHiuijPLy/DofD6G3NBZtQ3SlYbaEdiNHqkyhug207N0va7B+Za1ZZaSOxHNkgPMmtCFr6DWmMhHvcGCBXSY93g8RSxKzool/t2+6hAMmL2GrqlKEbSOIjy+8VofGnEyxzxzYHAX86MG1TeL45zTxcb1N9XMVWZHA7aFZ3rrmqNZQLawpNZP6cMxY+wm+8xum37lNM3KgFHcC0DaaDlmr4W7ahTOipYM4HB5ETtswIDNT7nwCCn8uELe+hTR/hDMJtfiuPYU7Xu5S5gU+1FzTzh2IS9fuLKCtiQzX/JoatV76NSWTskRVIiKkWFOuGCNeyybr6sIo2HNj6TLWOHvJhaHRojrzKz9Mww/kN0RZeZ/H8LX8Atst3OgKNFlLG3nmJt15x/ggmjS5SIhH4WL/Nwmw4IeXpvqxBzF78Dce1vZXxT4zeGwwKHAHPPc3x763+wB1WWlFNaqECO4u86tR36CEFfn7dT5eylMKGg/k2qNhCZkBLT6JoVAhay4SRgnKY+5iM/7nA4qKLdY5FcAO65G14A7x8KbMW8qp 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)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:50.5838 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 121d2001-6d2b-46ef-fa3f-08dd115292f3 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: DS3PEPF0000C37B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6988 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 15:20:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889254 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A59151A7045; Sat, 30 Nov 2024 15:20:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980059; cv=fail; b=K+zzbW1o2Ps148UQ7KRWjQjvTwa1nMObmZdG48hO5NRWTuSUekAY3Mj2rA1MADbi7jGy6PKC8rMXRrj7CHkDUKQAOqiYjKPJJQYC452O7sNZ8meTUHrAxXmGENjP/puh72Qkyo8t1IgTLXUXm1FJOHmQsmfvP5Onz5++4/GtWNU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980059; c=relaxed/simple; bh=ien+250UDGSrySnQglG7UUoGBOSS6C1yuHB+mvVLNHk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GLvxUaBHVeyosSpa65OivoYMQl7k1XivIwhxDxm8tURJ5taK8hdzLFdG70OBf+oAPOI4iuwG+XMSQUqeHkqBfe0b84gkj0MUFs75BRLMP+oaBcy7M7hZRLsv8Cvh9GVEtlg2Uxt9ey8T1wy5u/vpwLvk64Nx9ks1CrcgSOkAcqg= 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=CQNK5tb4; arc=fail smtp.client-ip=40.107.243.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="CQNK5tb4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mCuPQLRKSn4oRfM+DewAcOqnk66Tfgbh/n8S2s0izhKxSLkjOAtulE0BodH+aGi51bGg+Iku72/lQ1qaahV0NwoA+LN3PbWmt9/xb8unBsr8furDcImaoqkXKf7N0pFWAqYItS5MQ715j4oiDBZ2/ueNzvNm+m65o6a8SJN6UjJQR3DYNIQ6vxN87NcUvcmVDBvtvQrZoAVMdFoSY9UuuHh2JT/ujupXBTC8SBLJubOzdB6fvbnMcM/SesiBo3h79qkJSmZplAXU9lQhqyNwY1hEzf2+x2jWr0sE4Fz4Xiw6/6nwXsYraePZMnBCn88adYbJzStSc+vLoh2H/MDGSg== 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=wKXKWbqmXH65XECHZ0+/AN24Fl6GUvVsUD/5i7wkzKQ0nAH77nWmCPrH7JDjIsBPe8SZkHFFdnI+4jqyCjFJDVRr2n+LIwSLDeX1CcS7gAMkmksFCpA12o+9+Se953YruXDSzE/9fifzzOfIlLeElX3Z2n90UXn1QvA4n9ISL7K5ZjvwExSrxqheNnQgzXdweO1SO4mCGxQGi+MKsSTqQJHWn+oFkog6KSk5kFvWeFFnM+tNtNm0qBhPQ+dRtC5Dt7VPfqQ7Q/avRlMj6Og57QdonG1q/1zJUVnT12sTUCpdBThhXKeHHgdbt6QJ3BJTpdBFB6Wyp6XR+rG20oEWsg== 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=CQNK5tb4BP75GrCxPdItQ5cokgRqSvoMg1qm3G2cxeDH2+pitC16oSvK61mhb/h5nPZx83/Mz2M0xmBhDAfjFB0s0dVjm64vAiIMi+qbgZtnXsW+DFlzOuU3BGBh3jBtGGdFsWIJCDcPLcX5kqYjZ0hZEYVLUr+tlnWmlfr2Fhc= Received: from CH0PR04CA0020.namprd04.prod.outlook.com (2603:10b6:610:76::25) by MN2PR12MB4144.namprd12.prod.outlook.com (2603:10b6:208:15f::16) 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 15:20:52 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::4) by CH0PR04CA0020.outlook.office365.com (2603:10b6:610:76::25) 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 15:20: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 DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) 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 15:20: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 09:20:50 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v7 05/12] platform/x86: hfi: parse CPU core ranking data from shared memory Date: Sat, 30 Nov 2024 09:20:16 -0600 Message-ID: <20241130152023.684-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|MN2PR12MB4144:EE_ X-MS-Office365-Filtering-Correlation-Id: 305c0d6f-bf37-4e41-b9ea-08dd115293e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?AMLBEG2XTvenJ13aciS0IslIP0CTb6E?= =?utf-8?q?mj6PTDMzMwPOuv3xTdKpkf4TXzhbi2e5mc+P1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fLoq/nOWS6QzOb0Qp93uoAWMLuER?= =?utf-8?q?2d/CHMd2gPFoDX1t44V/7Z0Ffo4k4CxyGlbiIsjppN3ZyrPJ69N/VayNXyEnAOEQA?= =?utf-8?q?wjyF00QvqtMckQjjsRsG1ebzYNeEdMqQMcZV9lB5wVH5HlP2ZSsdYM0jSUXugmOSp?= =?utf-8?q?iOxUtBxSkbBby8sPH/5Y5k5bTjW4AExAaEnbCS7NqLs1ZzCLLhWkh9KsLQV0NIliD?= =?utf-8?q?FPyELcfbmEZtfyXMvoyMN1RhyCIHDalJW3YFTr1GWWuM3inK3ww0oaTgbLnX1wP5J?= =?utf-8?q?3S7/f+7dfAJcUhbUg8N01VoW0wJboxPUReqsbfUe7ZBWdDk+NkqblIptEG7lIDHfG?= =?utf-8?q?rQxfKHx3lIvdhw7yW1kQQSFPxNg2f8ZsJfzY++cUyvamkTmb7icKEJrAI1rhgbRuW?= =?utf-8?q?twrdYNDdj2l82BGJiOiGyzIadOMNBMt3ztiE8BG25oHG3Un5sffsqXTE4mTlcvjCT?= =?utf-8?q?5p4cd9/+Jzh?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:52.1353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 305c0d6f-bf37-4e41-b9ea-08dd115293e0 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: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4144 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 15:20:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889253 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2041.outbound.protection.outlook.com [40.107.102.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 303381A42D8; Sat, 30 Nov 2024 15:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980058; cv=fail; b=m3coCuoPPfxRQdylTu7NQjnaSPFBgLZEWL5i30K7KRkG3R9OfAG177TqBbZFYPPGRMCbxIQwsbESM73jEB4kQRiqRhQOS+a4c4Zpra2frrlvrc2h6YybpmFniMXsqF17jHitbdTIwCsnLJOqu0445P8su4hLwCpSansUASBlFCE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980058; c=relaxed/simple; bh=PLIN9Di4iSKUgShzNiv/me6wtqLVjfircb034nTlU6g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KuuDqFB3K1nV4s+dncFdZwD/Zj2YbqsnXeVJe1iCU/OjUKnRxZNC6+oJIkdb0LuNSqAEGH6KYxDskjWKlqW8IPwruJc2DmvHfAUKqBvIwsOqPw4rtA9iFIBcukHxbOvsmRrBcznbCkVL/Gm83oXe05WPc27NmjV0HvR7XwMvYzQ= 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=jk233gbn; arc=fail smtp.client-ip=40.107.102.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jk233gbn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=blYf1U6HY0n0n3XG12FjQ1txzaYPvf2CyjGfxdXyCKMG9VSJaGcdyZ9Hyv5BbCV5YsJl3BveqE2iP2O37wD4xBreWLnUWXW2YoMSjRjGHAN520tS3gMYplWX/jhTxemcPKIuVf1zOvnIw0EpczAXl1C7sghUcNlj9NTwAF0rUqdkRN9vnFhXvot1nKoDUEWG6tBm4FgIdtJSgcMXxgQZZ3/Iu2/1sq+VSys30GGMqdfW4l/rfSQiOSv14vpCdkwfeR4szwCgQBCIv5avcTm2JIEpG5SunLtuqBpIjUG+bjo+vYuGSx05W9d3hlfPhHpiltJ9UhUJWmw49tW9rpYYog== 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=bRqSVOBp2lHG9UZIgvZqwGdF1nOet8/m+NMJvlMtWczzHZudCZ8BybmLdMUtEeAFx/O4tRjVUynzEoijvb6nT5/jfpZX8B+pLdTIIH8l7STtUnvp0v/D2lscMDxJxn515ZG5oxRcySJc/EDXNlIGB+s3YdJMm4e+K90QatA+vbj5p8aYfiWbHBxceURmk7LZycYy1jcpBMYNwZFB83orDRbZIMmhAmC9sZ7CsbNGkA23i9Lny9EJOjgJKK/E7Z9Twzb6wYWsvBZxBU0maeMnOe3aRSWHSlBpIg2p93ECtoPK58PTPZ6t40eeG01v244r9CRVTx8r9bFc7fJkBFCxug== 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=jk233gbnqNsrLX38fzIe0xOSvHUXy2TfNh0sgz1BNkSVigVRu9864JS7Ds1r/DJcsTHQdvNQIfequagR3beA08xwy3tw/x1Zc0NDjOOW8+1cOLKutqBLje8HX2n3ZCq0mOg7L19UFssIGnUTK34RyTxPAVprzkOHvbCJ1jHQagA= Received: from CH0PR03CA0320.namprd03.prod.outlook.com (2603:10b6:610:118::25) by SA1PR12MB6846.namprd12.prod.outlook.com (2603:10b6:806:25d::14) 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 15:20:54 +0000 Received: from DS3PEPF0000C37B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::6c) by CH0PR03CA0320.outlook.office365.com (2603:10b6:610:118::25) 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 15:20:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF0000C37B.mail.protection.outlook.com (10.167.23.5) 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 15:20:53 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 30 Nov 2024 09:20:51 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v7 06/12] platform/x86: hfi: init per-cpu scores for each class Date: Sat, 30 Nov 2024 09:20:17 -0600 Message-ID: <20241130152023.684-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37B:EE_|SA1PR12MB6846:EE_ X-MS-Office365-Filtering-Correlation-Id: 85b387bf-d457-48bc-bde2-08dd115294bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-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+JOhSw3wad+aB41+eyCJILS8ojOO2F81FZCJezC/Xelm6X2jRJJ03ojL/ZYSRauhoMnUYu5bVmT0HEQgCDSbkk6/mOGTwW5piYRDUV6xwOUhkyxjVFmCesvmLyQ9NmxvzolqPpn59/emfuBVeYwDO3IgEZTfNrrkzeyrP/GJjdyYSLa1mXoBpDcxF29TgbJNBoX1HvKIs1DdcN5rCbnx/jRZ1Xycp9apuHmIxHeaQCxNZYnQ96E1NhC06LcNIpSfYhNlW7q4ERr6zmkBAgx6RyJUfYPfwUK5y9Yvb9025xp/rgPC7RJ7zENUJbX8oIH741HusG6olu/7668zefRBclT2vpEh3mT+w58BsmQQAGR63ADT2uLRZ55WMHpVRzhmMBBbGk6FIS2xPy7/WCzx5ForHl8jrjrMd4JGjnBBiUPkVTkBo9VZS4As+OpYCf8xzENQZWZ6mrNcrKGcEtb1KhARBF78ppX4IeD6 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:53.5994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85b387bf-d457-48bc-bde2-08dd115294bd 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: DS3PEPF0000C37B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6846 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 15:20:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889255 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2077.outbound.protection.outlook.com [40.107.102.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73D111A9B45; Sat, 30 Nov 2024 15:20:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980061; cv=fail; b=PsVV2Vn1NXRClTZz3oGp8Y+n7BKVqi7rM1VDQiXBjkEAFNAp918BYhRA+nhvmTytSjPCans+KHuPbKBxvQDPKXwcCSLP9sARrIZT/c1vfK3yHStXTIFNHCTK7rrKZtQFlttwHRj5q8cyQHlC4MqY+QyNuZ4aVJ1FUaiLk+xhH+U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980061; c=relaxed/simple; bh=FpLsiRAJ0TzAVlqt/XYgzXMXQTsiGNGdRN6lg7gXd6k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FANAQrDIXi+n/GPyEAwfpaudU8BqzN8IyYV0unsM1I8PY3bS3uvTXUd3rsTWVLG8cYkfc9EC+yMKukm9OfIUT6Ska0WhaHA8v/+Ox4VAJ0MoZfxW32D2HVV35+yuWVmmCGVceyTRuTo7XgGDmIVjcvV/MaXCp5aoCGQGrqrXI38= 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=umES217I; arc=fail smtp.client-ip=40.107.102.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="umES217I" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X82a3wJgCDiZZ6Agiskow4SbNAwXEuajlEKQa+CBhCFI8rscdK8m9FAIklHnbvIYKzxNeX0M46N9S27xAAiR9x9GBnERuexWAOQasZ43ARsLhxzL43xiD9wEiD5bTUjnXHUMYqauPZpda28zqVU34LIZAduUA94JXUGr1NirU0nQy/VrhaYGRWvDtPhkHHfof4aACJEyraDscvavNP110VPYW1tOQBgB/DpLtZEteIO9hqpvNTuGkzfhLm/nj5g/iGRKJz3Y7WHMXxvr+cUt8iCPNWJsc72Q6qr/SN6bTvxguDDTrLfT5Br1x2SDbG5YbbenfjT/lHO0npydn5ktrw== 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=UADkIovr6daFp/B+JDIyVFWuazGYcsaYHHrXMCg7KPSSWqr9kiPysgpcpiYw+LzEJhXiAkByWmDxdIsjsid/RUXUW7VWWiZbT6FlY7hSqavkR9r9fTGeq2J/YAhLUSA6j02NL5EquKXSxxHJkd3Ev++roICVZ1Ecx1+HJov3lwYsIzAPB+r0jrjECW54kAPLzA6SCff2NWN197V/MAwL9lESBx1UeBS4ohTjdtQ3pGqWfERqKI+J1ZBlEc4x1otDY/qc73AAddmvX0j0krBh/8iIKLXsx6Vj+NR0iw0nmMbHCeEzrM5zQmOLsyNJLQqFYCL3mPeSe5QiUfXT6Hgipw== 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=umES217IGoiPEmMSngrW/qvZ9lNuHq7zaYR0PuKnKQJJ+w5nQfM2jFf+LW6XnuDC8a0woT9E1FSnmkLoN5DCJZCxzHuBTIUN2d1kYYfoE/x11EPrFJo26UrBlP2poEwmgnBBXMA9iJb9wF44/CbI/KySGBFeLRMjHN+ETFZeqxg= Received: from DS7P220CA0001.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:1ca::6) by CY5PR12MB6081.namprd12.prod.outlook.com (2603:10b6:930:2b::15) 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 15:20:55 +0000 Received: from DS3PEPF0000C37A.namprd04.prod.outlook.com (2603:10b6:8:1ca:cafe::e7) by DS7P220CA0001.outlook.office365.com (2603:10b6:8:1ca::6) 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 15:20:55 +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 DS3PEPF0000C37A.mail.protection.outlook.com (10.167.23.4) 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 15:20:55 +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 09:20:53 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v7 07/12] platform/x86: hfi: add online and offline callback support Date: Sat, 30 Nov 2024 09:20:18 -0600 Message-ID: <20241130152023.684-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37A:EE_|CY5PR12MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: d824bdd5-4ed0-491a-cf66-08dd115295a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: yJ4c7wF7YzNJp+UCwyEeAj+yeQVuJkSlc8+rEnWud+IGmATFWqkAdDcyN6lHhG/8l9DOYFJVI4xNFM03q2qA14AvJs6XflO6oMuCmNMeqC/kdkDg0z3FAlhWuzPtR0CtxWFMgrOs+IDt6M3sjTC6fx6ecvHLFVoZfWKjAQ99pq4ikUpLw7aCMMODdfIDTLpa5aDiv+p5COOcOyvC0gpj14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WbpHKzgHJMplKpU9U+AMyA0lGVX3a4jr8m1+9ofG1hNCKxvP8DlNvjHL5OBPg/4xztf1WKOzzpRbq4HPOB5wLAuziqdgas/M5Gc0b/lNOyffu579q+FzAKHVp2jfiDbe+w3CBbmGRYlbQLlQEyhBnin85poVwsgZoK39db X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:55.1309 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d824bdd5-4ed0-491a-cf66-08dd115295a9 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: DS3PEPF0000C37A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6081 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 15:20:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889256 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.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 5133E19DF9E; Sat, 30 Nov 2024 15:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980061; cv=fail; b=Flm6DqYjq5AoYAqqLprrLDUI9MFXYKII/ikKPIxMDJ/z5QGYjUKLKPB0vQ93i/hBXU3l0aqC/4WhGRA6lN1oZYSwIXnxhgfbqy6ER6LjfvzaBtGJ7aUZzM4ASIdR5sL+r4JmoOjLrgmXwz289oYgsyqju8wxV7YM9h+rTzntcMA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980061; c=relaxed/simple; bh=IOvZRKAPWNZC84/xYTtOAnd86sJc053Z0HhsqFxH+/c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hmuwxTl+MUENluVrlBP7PRmENEM68/3eWDpZTFcLnhm81uqjJ28TDBejrgkTvcbR8c9DadhOvmd9VScWkKiz0DBsx73+MsuiJDsdxVjZh2zwslN8Vnzq8SGh6SYy/2mVqd5padO/Hb0uAefaIDIXAlI78lLRep4QtXfvtXRteJ8= 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=lMnowR7p; arc=fail smtp.client-ip=40.107.244.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="lMnowR7p" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k0cQ6A9QGLg+vMU7icEBt82pNkmRSRbxufXjM59W/r4ZAKqJsdqOZw1w5fryF6Nsoih7RlV9wy71EVj4UgVJ3nf9Qda6H9p55G5mtbGx88/5HH5hUrr1iGqPr7OKpXHulV/yPpwTHhMYQkJ/qD0YsFaAcFnQh+k0dGw5kb+EVvMADrLQ8DcQ3vLS+arTmFZ6pPJlOoOLdWLygDlRWN/8+2D9kIGXJpDKYGz2XKw3lexFP8gTc2wqfNRLFzeUK/Q1W97KG6UASV6Wzp5/bGuBVpN28gQAAmnkOFErUeMhszIVJHahKSa8GLf3Z3y75awGNg2pcsVvCb+EgAWvgm9ABw== 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=keXEEE30ZoPy4/5LB6L0opUI600TIdR1A9SJC9QT2PktaP+hguZ14bJAKF4NpzIgHCiX2vR1v3oymAfuzgdaZGRIDhnetWYMmCLVXZs6kH9rjsdddzNatmLWP4dZHFS5/ClBh1FLCoR9KTwbv7icqaWUBG2KFMW/J5w/5PhTizTMqNEb2D73jbo11+6u6mVXanN2e16RqrV9KP/xwsJL0X1cGGD6QH0bqrvAmv7Ne29qFaNn59l0tpd1B3OpmOFtQJ1hG6CvcRYbWJSr9Hi492L8uGANS2AZwtvjvcLi+Q4UO6TwuFC8noGO3owLqHCVijwdozepqLvqdaU8KBNksQ== 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=lMnowR7pjT94rst+FJ30uj4VCzBPwyJ5GBq4mE9EAteM+QZuK021UYUKIHm7jBEPrraKKl+E9H1/tN4jdDFuiFTHL2uS/qJFaTQ1HegrHxfKuTXWuPgETqAIu9nCxLMSqJGS+GeNXh+JsvwBPrZq7yWCs8/dH2XZIXGq+rsrnyM= Received: from CH0PR03CA0395.namprd03.prod.outlook.com (2603:10b6:610:11b::12) by SJ2PR12MB7798.namprd12.prod.outlook.com (2603:10b6:a03:4c0::21) 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 15:20:57 +0000 Received: from DS3PEPF0000C381.namprd04.prod.outlook.com (2603:10b6:610:11b:cafe::33) by CH0PR03CA0395.outlook.office365.com (2603:10b6:610:11b::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 15:20:57 +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 DS3PEPF0000C381.mail.protection.outlook.com (10.167.23.11) 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 15:20: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 09:20:54 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v7 08/12] platform/x86: hfi: add power management callback Date: Sat, 30 Nov 2024 09:20:19 -0600 Message-ID: <20241130152023.684-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C381:EE_|SJ2PR12MB7798:EE_ X-MS-Office365-Filtering-Correlation-Id: 912c675c-6309-4b83-e420-08dd115296a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: wuk9tGd/R7HpO89Pt7JKathqmX6yke2zU9H2IXmHEBKNtYvl8EHy3/K2j0/6uhXX/5uzoNFhj+geYsMJq2pG3q5LZ9zScYtwKzco4cFMjgfxFADUbLSlt88QG2yfY6Rkr0Za6b27lzukirZ7KDLCpeJd4lgj1DIczGKD98cY/F5W9YU0xWE6Us9oVdTqLGEpF3PnbSBL8DNk4CsYuETTFfLloaNoy7S2nN0Xh+nDhC3oMNxjWAYmurYeIRuzn/2hm4J0p4dHkIGVWxqvzmi6wrp2VWIsh9tEHrGukToZYTBix6q5Lm7+1+Ks+GjTqlQIr0WaPkApiAiq4tbZ4h9zme1YGKOBT3tDwSeqHGDS1P4gPey8xBhqOQkD7aHuNbp8HG5FLtbxEEwJQOFHLclYeY46JnCIKyKvv/TkLfh81vs2KLivTu+vskDz9yUODNJEVW4TkrqQyugorFO5xvYgqSeICzN96LaGLWVM7F9fQAOAt7w/KSRTpHClc9XxEevtLgPUAaUB7n7qs7FE+mYu2YOc1dOkq3nZakgaDDHVQ1CBLjuTsaPcnK07kxJyFGoWW8MKnkmyBPwfkhJSzgeUuHhg/kuxuIKoTKMPSuPpkn6Y6hJiiIZPM1l1rJgxJcM1S/AO1NTMbVqAdpJWnVD6Sb8PJlmgiPcqvehbBK6+Hvh3WsSFOlQarXNzdnz5rOxzbpyFdcM26op1L8jpmzh/wVEdS2jFgdJM3sjGLOXQs3hhPKIZm59TOJKZDADmgzzVUDkWwqYYaQItd9QilVt5+8ADATNJwVl74FueBBzUGOnuT6XwdGIyx/zchu98BT3hzHeY+Gk0iJkVjmP9uUVFBYv83PoOAR3qShFtATpj/iFChmMpRs7te9RzW+HQEesMOBQb6aalyq7vBjs/ahbmIUsO+hjWnFOEgHpdtYNE7zLhA/Ttv82arhwxhDc2WKXwJLsMRvmQ/Fl8BNazoydyqLzrhylBKTgPEYAK80dJ7OSU2FcQdxjvopvQFPd9jYkJi24JLesrPc9GVPi+apJEytBi9wT+wGM9Om1hdCc76mITTK1zz0fuNVoGB4dLDr3SamKhia8dH7OiTkwSWBZHxX8LaXxA79DvS3lJQz7dS0oyFFIDoz3U6rWnE4jXrcVsTqeCc/bhCtE1QrHThvd6GJv3JqhCe4caBjkfb7rr5JAZjrBA1XWre0G2MSxG1wXCvFF3CrmD8Axy3KgQWEOHBabiLtFhpZO6B4Gm/8zmWcGLYr0k39MObxqiRYVCjB+fIzEoSFfDxXQcXranWyCuXHsddZ2QgRI3HaGJGRw6NSyoxUI6UJoZY3lM+h9zqcIkIKPtDvWPwbliEzreSf+nr2ULdxUSgH1yudFfL1WurT0ny8/YgyjjCuYvttuaVqSKqAb/walDk2pNWr4Or9BYTI7RHxKcJrgHHCM+uNQ0nPuw5hcN6zwEoDLFGIamJyc1 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:56.7501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 912c675c-6309-4b83-e420-08dd115296a0 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: DS3PEPF0000C381.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7798 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 15:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889257 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2079.outbound.protection.outlook.com [40.107.236.79]) (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 991821AAE34; Sat, 30 Nov 2024 15:21:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980064; cv=fail; b=McU8mLXvAuqQH6uGvXmRWYELs6M3LLYcv+PvRyKy5miiIoCHQOOMV8APwocfUjKBwUmxvum20oOPrpeHHOkjGsMdtSQfNx5GnSlhbO1oLyvJaCbeMoyXtaIGlnGadeM//WCDPz7q1iUW29sP215Bo0MeBr+6tPFEN07S81wtIq4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980064; 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=oHP4GfkXRn8PMANZZNQKGgQMP3dNUGgAb+Yy5gC5q11fBHdbCGlqkfhFh7VFqbwzZT/5z5J9tn+LqaONq9Q0oCKzme9PQOL1tvRTPpLnhL6fiVmbOLRABxFX7d/KSHw8/tX6/yshYCy0vL4MZQ5eAkSdjUN1zlwr8qGsVmPHbu0= 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=U+RNzbTD; arc=fail smtp.client-ip=40.107.236.79 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="U+RNzbTD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r+15WxwicGOZHW7qEm3Enfn7pR7SGRRaKHWBA5eGZO+41h3UacFMR0PvobQgCjhnOLbzVBeDnSZCra5WXHKqvXV8e5hRwykCFOHN+fDhYPPrvvy6BA+Hf+gQQHz7xck9RqBDr6ObNL96l4gRYSNuYYvsh3O/HT80qBXraV7n9DItU6M9C5/6x7i7CxhU0pn5bfNDUrKK4ATJL2mjduXVjzS0fYG/A3H+fYJQwpeXo3WDo4kzHS/Z6LceKQuY+S2mizk2wemlsHCxoHtbkK1j4aCJB/F9DbUEeQAQwnpHf5BHTVPoiZB7EWDBTAeLyOyvkD5nAngoHUs3DPIEcryjfA== 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=ERkJIQKQcnOTizTB91TPrOjqb+GSq2g1LdZY+jdAJ21UXHv39/DJhHE1bDLI/yaAGBgZ5fWOia0VwbhMPmofgAJttiqqM7e5/mMCPM5qvVSjJ4rRJORd7vdo2e4qPAANuOUbVpSLLzikdstv86LT4Yt004MeMC9foVDwRDo7V95jcvvhcyBzAiwnTe6FHclvQQYpu4inJmZ9qpqNnFcP85Msb+mOvrDg+aX/J41Kzql3DfNUKsOh922pYqpfKjNT5car18oGagnEKX7XNvkzKyZ5w6XwGbH5K4qZD1KyLat1TlVji2mbk3IMjZ3pg6719mA/jrcuy6Z5ArsTM4yyzA== 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=U+RNzbTDTcj9pMlcHkxQfc3NtASLwtcQ6iyEmyTGHSjyWLl8tQhF5JnpVhAEjmBTcQGY+EL0BsMx1USsRLSjeSeSgiE0DBRtXX4MOjOZon2vD99ENdb5dvmhvUvw1fW5kkGngSECjUNPqQ9L577qLxKeaVI1wIA/LUVD1uuoSj0= Received: from CH0PR04CA0012.namprd04.prod.outlook.com (2603:10b6:610:76::17) by SA3PR12MB8023.namprd12.prod.outlook.com (2603:10b6:806:320::9) 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 15:20:58 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::c5) by CH0PR04CA0012.outlook.office365.com (2603:10b6:610:76::17) 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 15:20:58 +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 DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) 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 15:20:58 +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 09:20:56 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v7 09/12] x86/process: Clear hardware feedback history for AMD processors Date: Sat, 30 Nov 2024 09:20:20 -0600 Message-ID: <20241130152023.684-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|SA3PR12MB8023:EE_ X-MS-Office365-Filtering-Correlation-Id: ad811b46-f8f9-458b-cd91-08dd1152975e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: nxFIelBMHZfSJ23zwsg5zbHBgqxnKSD4Prwf3UamlJHHE5u1a1F/Nkh6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9gncver5VVbfPO4glt1Fv9z5CMmB9o3bbDSbIO/eN0T4FJuveJVM1t7gzys6lsBNoNq+67orFvfSFQeHxijd8Kwuo1nEucTaJOUFI6vca9fZyQOp6EGFcyK5AInDxktUOrbtNZrWpo4+bLS+PsUawe7qOVjwmATq529mKphGvt0zGkkIspmcsFAwLwFb8upYfFyEVVT7ojR0R7qQUK6uub2sKG+y3pdr+zJw3SS3Z34jQq+SHv1+mD03YIZf0iSpAcrKfybe4oajygxjfQ0hB/wyYlplfNbUeZQ0MMW6wJ8SEHujmZzvN49cdxxnKhiG0yiY/GOVXNwIECb252khbV9pmk1Htsrblbhnvy5rqdo X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:58.0104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad811b46-f8f9-458b-cd91-08dd1152975e 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: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8023 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 15:20:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889258 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062.outbound.protection.outlook.com [40.107.94.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3E091AC438; Sat, 30 Nov 2024 15:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980066; cv=fail; b=ibs66i3Rl02oyqQbvCUodYeBVcIvcYsI+c2CJBlZ3m8VqezCs/p268UYKRGDPsc3J6Anlav0vNQCMvovJXsSm8AU0gH9FpoEP1MLx+jproT5tmoZol/g12zYZprCoO66beb1TAz8o0g8r1TJI9QTh+KDT5zJO9KAmbqs36cFUoQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980066; c=relaxed/simple; bh=raN5KExkCsujKrVcAi0TXfz8VmpAYeESNZ7vG3LUdsQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VYsAfs8ma/ARP5bjyWX1wselAH8Qy4h47lRWe/8/tSNA8h8nDHxlWYh1YGU2JevIVPHXKgHzeaFDQUs4nYW7IPod0s5LLFU5qkXb7lZpowAOeCLlQQSNeeqaC3DI8KtIS8rDnHerO/qR79CHAHidE+zLckY3nw+msbT6PE4Z8D8= 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=AURki1qG; arc=fail smtp.client-ip=40.107.94.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="AURki1qG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cF97xYaThIiMXS6gz0E1vUd9NtsgBvEuqWb9YuSwxA0yWzX3Uav06nx3gSWfOBX7gzb7vRsaMarx4y2cvq1gb9BCxM8MNOpVnZRQX+r2KQPe4LFhZgQLvYPwC0izkBCJC4KxyeiZEjSR8dMouhnIlV0tupdIxSHwk6a53oAEHGbQRUGg/lhJGsblNSCRS8yHGxTUyq7dEFVujC4q+IHyWaSq90h2cX63TAOLXqyO0/oM/5ZKRnzEvoTfVDFqjuwmSanMkHIPw4H63HCPzRHobY5oYbRufAFbgR0okB8rZYMp8DonbLKqCxWyqDVJ1cO7lZaDPwiwckzAbs3JsmSnWQ== 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=l6qdqhjaM9gNV8CWk3xV15xTF5abgOiKvOmz4LGAFpByRzYJgYtpFe9OuvRFoJh4IAFS+izJv2nB5LiKP6cUe/k2wjg/a1BrkG9fV3kVI+hhN7RKfOfjpsMhzeAF8FnI1K46bjiLkkmCUM8lY4+8D4wjw0uZ8Dwa68zOQQY1EXbr7wWLnzT2GroZN4TWBrWquHFqfRjYdo5bhSSNIaLk134Q7bZxNz9LTwzJ7Dtsc9kLH58v+gn3oevdeMvMIuX+vzT5Fxo4yVPuA9wHVAwfJb9NXsD0dcVnNs27C4lnWnQ6fYMzu3O6ZrjSyapv+ucvXVbQ0Fi8u+z/w+krP1M5MA== 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=AURki1qGS75AdWmgqPEAWNlBo+pjKpmMtLgdaEPYC1dK2YefWGbRJriFQF8kAdGLa4zH8xRcw2E3pS0+6CExvOlIORNWb999ax1hRuIkoKp5pjqI1o9MvKGjYw7Oyciq59hRhB18e1dElQVOehQ6jBc3bVePZgTZRjrUfYuPL5U= Received: from DM5PR07CA0049.namprd07.prod.outlook.com (2603:10b6:4:ad::14) by PH8PR12MB6892.namprd12.prod.outlook.com (2603:10b6:510:1bc::17) 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 15:21:01 +0000 Received: from DS3PEPF0000C37F.namprd04.prod.outlook.com (2603:10b6:4:ad:cafe::27) by DM5PR07CA0049.outlook.office365.com (2603:10b6:4:ad::14) 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 15:21: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 DS3PEPF0000C37F.mail.protection.outlook.com (10.167.23.9) 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 15:20: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 09:20:57 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v7 10/12] cpufreq/amd-pstate: Disable preferred cores on designs with workload classification Date: Sat, 30 Nov 2024 09:20:21 -0600 Message-ID: <20241130152023.684-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37F:EE_|PH8PR12MB6892:EE_ X-MS-Office365-Filtering-Correlation-Id: a04cc726-13b3-40f7-1d65-08dd11529838 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: XlOabpxwo/HYSwF9eD76BgXICi4YgoAPtMfx/tYjiWb0490AC8IGiMnQVRdL73TT2wh2jUGkcyyFt/+9ad5Nz6iO9vLkEt/FZQHksr9NA85nwm3iahvsHNWELtuRPxgadjwLfZh6iUI5pgFqTEmr3sac+3AwAcOlvNfs92Vcn6yzIA7WUj4nmBRHGERMJvphkS2S8AiTwSWezTsjOvPLFiY2JPcwR0G0i74sasA+8AA6x04pLvMBiTpEw1EYkSIoGkpydzfPyx51FjqGVz7bKk2+ccx440/HBarh7xWHDXHgU3aD/6Bo8zMan4iAWksNHogRWLPDRnNjrHJG/nya0OoIebgSrsViux9ZVsX+xAxARzf8/Sba86QT6e74mET7xcBI/+/Bin2ByMeK5HBaTpmRfvxP9QWXmNxCEnV5nTNxE60SN97o3PfklkU/g+bOg48pGhyWJSF4LQkYZoSXy3bj+Mqh3z/VUECFUxSuuxZ+xxb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:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:59.4189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a04cc726-13b3-40f7-1d65-08dd11529838 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: DS3PEPF0000C37F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6892 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 15:20:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889259 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2042.outbound.protection.outlook.com [40.107.223.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A86CA1AE006; Sat, 30 Nov 2024 15:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980067; cv=fail; b=hvSlpEUGJZpqnfMttYvKdMXNhsXtvzV7OYt97q8UBVDpbSLqZpImOMK/Klw4+ZKFJCat+8j1tdqoCUG1ThozfWjdHmUUnXrMdpgAHW+Wg5HoLdInDit4xU5z2Mg+EfqPi3o1bBNKYCgSIE45T62UASNXPyjZieEYInvArtedM3M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980067; c=relaxed/simple; bh=SyTSHZsCUn82tUVuRI0O8Q8JYKLMIYs/4RA3IHHMzq0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gtPZfVQJjCVHOlDniD2AoKAHkwU2wqxYlBK5A6IeW9KAd/tPjGM3cO2lV9XGTT5//Pb7zjSGMwN+pdq2YHDWaO9bXJAFqgx79X6HDeQ56wNBTR5snrAwM5oKOnj0X+QrhL2Lj0NiaSG7HNTwcX7TAvC25AZXEZKhIkSDypMoTkI= 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=uduERjtb; arc=fail smtp.client-ip=40.107.223.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="uduERjtb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ozgUoshgbkTvsisF8hv420LRqVT23WURwFaa//koQ3bQ6by3Gl61t+ovHN0zKlxz2JQaFJOBwD3U82nsbcOuTM5C9F5s/iuDuLEDVmkCpwo9JdLr9tP4YXAcqkudVyI4iRsJnxFvR6+IZTICF45nZy/e1TO6fryD1vVklRaavE5YICS1jur2MX0Sr9LeeYMRMeGbmp/6kY24n371NDEw+ehfwe7WYYeLpqu4HeIw2dsrLmawNjLWFsHHqZ8eHp/jR3Wu2Ipv/uBp5eILV4OEywQcqYXb9REiVotPh++/cpJQoMiU26DLIYV2KjyG4QUhVQ7H4HubTcnLcDkD8QPepw== 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=wpdrWQvuMGN5Fr56sKH/Cyf7jI1qV9GrOYwlcDMz7ZL6EDeDQqJBed+qsCwwJob4UoO4I+iX6sLZEsO00sBJDyNoGeb7PZKB9lcae0GTwlL+3wrd4InKXkzUfqNMHwJ6l1j8I7PSv9JAWPSqaKi3gJqGPy2Y/B7iYtW5LP9Wh1xUZuIS46IJPowddYzjwkpH0II973CAqrs219isbAKSm/a2DmL7lUrBetyMKgdMzYoByCb0iyPBOwC2r7QZQVaiC25dcG0xXgM4UfJkygZFT2Mpl2QGyB1jVtXnxIkqFlIljgrg3o2Cqp4YePWDeVROE/Fdq9yJTvelZYmWBsMbAg== 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=uduERjtbkCXHnz1YGjJxTW7ruTjFbCfP078j6O7zv7kLmgWD2JoA/QXA5/arapHqZ34ApJTTgVwjgvW9un+IfC5M+VP7HbhOsm1wcFoKorjxFk6FiuvtPSs/039GBZQfp038q7QpkmWgg2oxyHY41ATHkwU3ciNp5Of3MtsT7Ho= Received: from DM5PR07CA0070.namprd07.prod.outlook.com (2603:10b6:4:ad::35) by PH0PR12MB7093.namprd12.prod.outlook.com (2603:10b6:510:21d::14) 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 15:21:02 +0000 Received: from DS3PEPF0000C37F.namprd04.prod.outlook.com (2603:10b6:4:ad:cafe::ba) by DM5PR07CA0070.outlook.office365.com (2603:10b6:4:ad::35) 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 15:21: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 DS3PEPF0000C37F.mail.protection.outlook.com (10.167.23.9) 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 15:21: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 09:20:58 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v7 11/12] platform/x86/amd: hfi: Set ITMT priority from ranking data Date: Sat, 30 Nov 2024 09:20:22 -0600 Message-ID: <20241130152023.684-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37F:EE_|PH0PR12MB7093:EE_ X-MS-Office365-Filtering-Correlation-Id: 96d9e9f9-93ad-4145-0f63-08dd1152996e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: dbGvBZD2cPhVfnyi4uBqhfJ7FCxxfFYhR9e3i1wXFkeY8468nx2lraKv/YoUjQS7NlaRYko435pJLkcxHDSbigCMbuHz6R+Cp8kmumXQrvIMPwmB6VN4UtGs0DdQ8ElLfedrVRQU+KHxUYalgTLNS0cS1ubqVQ/wi8/uZzSkcseGcbshsBArz7uoDAzPy81Y5OUIEh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oox145ae0dGBbGQmbpsT+47PPD2WNuXSDn08OexJL0zPDXeMHURAwmNlnDMRox5ywITTEzbBs/7O52+mKc3Ve8pFIyICCeKaQaewmZBttnCl5hEl74YsjxtIQwZ45aSQg9PWaClT0LRevA+wRrzz4/HAXgluQG3bH/WhEmyKqT9oUnTqKpTsRs6xVtIhqrK4sozkth X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:21:01.4502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96d9e9f9-93ad-4145-0f63-08dd1152996e 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: DS3PEPF0000C37F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7093 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 15:20:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889260 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2053.outbound.protection.outlook.com [40.107.93.53]) (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 D250E1AE00B; Sat, 30 Nov 2024 15:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980070; cv=fail; b=Ik5HIJ0Y0q4ahnKJD9UJzDSlLk5i/6JAdKZXVpo5GuLpplzmq0I2+Q1AauxpPOZB7CkPmOYOs4zxJ8u1WcZ5WjNccssro1s3tVI94tavj0g+HwxPN03TQhV3dfWPdofoYIY9yFFdWcsRZbbxRhd3nQ/Mla9HhFzQDKZF4Fzfw0s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980070; c=relaxed/simple; bh=Q7DY709JgBs+QNd6i5wQZjcCds4ZMiJT05soWR23iNM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rlred2T8S1hVbs6Oy2i9FE6w6qIAzebNF+OMh125ggQELfv1hE9X1JRkAF4whuzoVF2dXx3CzzGo+rlyQESSPq3tWD9NjEscgYu3/OoGYmDssufDle3hdtWwvn+eSruHGpGRYu1Dt5L26BiF6fKsnmvja9NHq0HRvg1P0ieZ1/g= 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=i320SDkv; arc=fail smtp.client-ip=40.107.93.53 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="i320SDkv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nM7K1JICHPbHqy5SNC0aQFd/6hCC3BziwTR4andiGpCK5kBGIEC/hVu5D+q+7k/2qdPw3oetV2Bcvau1sOBvtC5uxNmecfwXA+eNZTTT86gMKWWCrHNZ5/nKY6BlQJTL1SnYWtn3uCMBMp2G55oOb3rSgoU1O1R4BZEf0dQdINiX97uh9Uv9vPmx+O1FIXOOIjHnmX7QBGg0ocY+daKvNVSybnbw2FFTkVQjGvw50+Ak2rLyXOmg/o9ctN1IyhLhDjy6lZ9rYwWupSkE7D5YQ6ejIGzKkvJ/nZ7YTNxNLRZxgyt8qi/DQzQ6/5stukwvwUgk+VnQ5W0Smb5Kz2s/sQ== 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=GF8jRaqtgR0g3hV/FArZEYXUpmtFoQfAih24LHJ4TXqMuJ3AP7YJ235Cfrp7Tij5Wh1Ot/xtklmF8tl8kyj0yLHnwf/uHiw41wBoYzDRyVnUYKHYi3TRyvlTmVwMVbJsg5Ay6aSA9ZUkqxJ2HZNEJQuFEb1dKexlrq//aDPwGA9ngNgt29T4LlckZ74vLB9XIbrYEmog+VQ2dw/QsZOST3FO1T+eI2wCTIEDooIcK5BW8nQQR3aKAQZ5hKMPrlef8B5oTWfT0548Wo66mt1gxXT4/NEUGqi8kfwOnStTOfPeCv/iyTcwxL39tbtA8OgvdEfOuprJK6+hrNizdAg3Qg== 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=i320SDkv1UiOVNs/dNFeE1ESCf6+P1bInDa+6qazFHdGovb+PAxQXnyfbahtd3Pqg8cyibzaCIa1JpWEUbFcp8UxNdcqkcKk8CZJnhEfsvloH1Y6wWs/DlY+E2lJoZ4o5lm8mcvnZLU5zLyUqUm8As+6g2BdVvE8QjMzbXP+DVo= Received: from DM5PR07CA0057.namprd07.prod.outlook.com (2603:10b6:4:ad::22) by DS0PR12MB8341.namprd12.prod.outlook.com (2603:10b6:8:f8::10) 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 15:21:02 +0000 Received: from DS3PEPF0000C37F.namprd04.prod.outlook.com (2603:10b6:4:ad:cafe::80) by DM5PR07CA0057.outlook.office365.com (2603:10b6:4:ad::22) 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 15:21:02 +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 DS3PEPF0000C37F.mail.protection.outlook.com (10.167.23.9) 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 15:21:02 +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 09:21:00 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v7 12/12] platform/x86/amd: hfi: Add debugfs support Date: Sat, 30 Nov 2024 09:20:23 -0600 Message-ID: <20241130152023.684-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130152023.684-1-mario.limonciello@amd.com> References: <20241130152023.684-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37F:EE_|DS0PR12MB8341:EE_ X-MS-Office365-Filtering-Correlation-Id: b04c5e12-6ba0-4744-2f76-08dd11529a10 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: 7wz+gVJQMHftqp9NqYnNyyZQwV0+1QDiuaf0bB/Ht0Kz/Qll23XCL+tN2eRLhMgid1A4rekBhrVmvQpBxZMdPEc8c2ZP1L6CLhlibpRR+BVvZYuJz/zYfapcT615bsxxMHoDA13OpHvJSmP0qOqUa9WrXCUlELc5Io5xkdnDYFWM0PZWBVmRfAWmM4AN8zTJzI+tyK3GA0gNzoBeg+MBsrnlx0g6krt4/9s9xR2paC2G47HYrk2T9Jal8SyDpID5gQWFpl0ed2o7g/ZlrTjkKZmTjTRju+BtaxH2yDayacVzLsbO1JBlb1KDo06vD9yUsYlt2cnU8k3g/OBoTbyWbQkbkFaUuatfB4j07rzYiM3lQBA9Kc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B6KsDWZ/PN9D2yTXnbgw X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:21:02.5127 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b04c5e12-6ba0-4744-2f76-08dd11529a10 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: DS3PEPF0000C37F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8341 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)