From nobody Mon Nov 25 12:44:55 2024 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD392188A08; Mon, 28 Oct 2024 02:03:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081001; cv=fail; b=ATis3GqpR9z+l824ES++H2c6iQYIoPW0h81ew/0A5NzLYAJ9N1LVdog2KPxGRfE06vbm/gQ363hxaQVq9JRxCA2oFOe8rrECwV65ELpQoafNeHeMlZHWl6Ov1kCxsk1Nh1jZKkrrrqrJfK03csC2MPOTdXEbEvH/NGh/7YgzXj8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081001; c=relaxed/simple; bh=8HG1aI0ZH+69GiaPX1fCROITr6TmMRta77jCS37iELE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GhvT9RgT5pQ7g9i1pVIVZY/1R7QktxQIeL+Q7y4xSLX4gMn7OwB/PMdLLFT78D7POUCkwQsHGIIF16/PlRWeJ3Jj4gzuj+YIgpo36QjO9se4M5ALA2UwK2kQjktwF4GVhOkKlV/mZ2Fg4istOFxkbyw/HU23ySvxYcBRM6f76Q8= 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=i5k7CTNn; arc=fail smtp.client-ip=40.107.93.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="i5k7CTNn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NFhmaY9dbqiDhWSQ8xArp+sMWGlxDJ5Y97QAXhB3bl4xpyKW/xOqSxPNSgrnapo6Ns4IPg5O4zgC3Yy76Lc0Li9bS0ciZhHVUZiKH5Wm6k2PQhs2SxzzhHunNrdYnc80gL/N186EBRGkbSEM+L9mnIOa6RvNmliJcQQWBxHs2h4VTrRrEC+Vnp0ksm2JNZfd7+tD5z1smnIG0RI41l3zBz4kMOlQrQWEAZbfmYngNOaqEL5m0LVmWJIM7S8U5Usok8zmmA/HYf7PQ6yQsLUUV6CeNC1+3lLXgy829/NisGVv4HHiiyr+0+AqHRZXjnWbjuC1szWO3Q/ZgbqLtufjvA== 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=fuCe+9169sOZvFFHYStLSQ95SM3TAhSPvmqLex9qHT8=; b=mNe7YTk6u7XziB7JQM4ISHJpOpi32VK/vP6dhUq6h8DWmJx8JQ8gyuXtBCBDy1mGjUCfudvmAQAm76wKf+PIm4Eh27YCZHyQ37c8tg4eH1ob9EB1zA+0pxldDhBX2ZMl6cUXQGcBO/6a343L3M6mLSECiTSLLuVbZbJ2tbSZlLPU2BTAlU4Ey8G1Adlo00CivRiYFchasmrz14VZ7c1WYrfCrml5y1HyT26QJ3g7TT4m+oKpnA8WcgZug5HX5MZeNBkCcFzEIiRvy0kfIK4vQDnlGvTLW2YFxod+oRDgvE2g56x6Up+WjagBOgZdiey46XbrqMoL50jgBkO3HSlBCw== 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=fuCe+9169sOZvFFHYStLSQ95SM3TAhSPvmqLex9qHT8=; b=i5k7CTNnJ8thTy0k7rTPZgGZOatjp+a7yyeCSGtHR3uulF2Ln801sGHFlHvB9GLx+UaPt8clu4KE79g7tKhVEOXBwAOnkEPkGa8LpYb3EMVgCBbOi83/XtnRh/39Cl988e7LeVRLNI05tjuWyb7mrTlYdcGHzIrkRpQfFpashuA= Received: from MN2PR06CA0026.namprd06.prod.outlook.com (2603:10b6:208:23d::31) by SN7PR12MB7300.namprd12.prod.outlook.com (2603:10b6:806:298::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Mon, 28 Oct 2024 02:03:11 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::78) by MN2PR06CA0026.outlook.office365.com (2603:10b6:208:23d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:11 +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; Sun, 27 Oct 2024 21:03:09 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan , "Bagas Sanjaya" Subject: [PATCH v5 01/13] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Sun, 27 Oct 2024 21:02:39 -0500 Message-ID: <20241028020251.8085-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|SN7PR12MB7300:EE_ X-MS-Office365-Filtering-Correlation-Id: 073a1b50-d638-4d60-a0a6-08dcf6f4acef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OCZy8FIdIzZ5JijPM12GdnuasNw7bFuDIW8lx6oscGNqGAokPr7/869ZGwnZ?= =?us-ascii?Q?TLX40XaBCTCc4fqtAZ1G8HJ0s+jcd1rm5zfz/4c2M/bqdV/He9z2PfUa26xs?= =?us-ascii?Q?cF9iAqyaI+JgGM9F3aVQnthVwU888m7C+N9o8b42UX3OAcqRTG0bHRwwEJFK?= =?us-ascii?Q?1DdLG4GmsaGh4DW6zjZxAMBCjemVzD2YReDhzSZtycuoj59pHWq0Rn7SG51A?= =?us-ascii?Q?BFOL35m8VDNXcUr9cQgvxknaSGrisqcaAyBBpcdbfC5SbeE4gRy35/zyifjN?= =?us-ascii?Q?0/3X1pA5u46KdyZRNVP3iKihevQTHMlezhZOZmvkLVp2A6oadtqoWeSL7iy0?= =?us-ascii?Q?Kh/vl3O+2RUYereem+Bk+s7971RCoJrVMr9EMKPagrUFlMpwaYGMBtVRyKsv?= =?us-ascii?Q?8da0S9fyjj+Rw2okjtbwhVQEQHaVHwdtz9OUA0K4uYDl+g+/gMDAV6o1ASKo?= =?us-ascii?Q?LoEqrjJZx1b4eAYZeU84NNk7bdgY0HJvoyTHbqZrbTWZg/Vm6TrVTliG81TW?= =?us-ascii?Q?lRe1y5A8g9tv35X0liIIoF95sdqk7LP2TkE24GaPKLMmhjM8uvusd7B6VsCh?= =?us-ascii?Q?YsU5ZriURMmf5G5YRHmd4i4w6MJrMc51VyKD8dfCSj1wrAW28sYQTitl4XJK?= =?us-ascii?Q?H/s3L1Ai1+K6R28KLXpHel+Mz9Lrp1i06KgnPEFIxp+X2HKS07etIX0qyeW0?= =?us-ascii?Q?2MCORRAEtuMxD23H7Hrb1TsAfwKF0N5eteWKP9SBjsR//IYyZhQXjPHpmTRq?= =?us-ascii?Q?w9Qb/NQhC39WUozjrggwuLNHKKIerORyWuRhQhkngjZa9Q48VcnDKxE71pOE?= =?us-ascii?Q?TT+94FQCQpQACdo1U1mI3YBWGRCQGAMV+NPgK+linVp48q+VG/IPJmBTb1Cy?= =?us-ascii?Q?lQ+LaqjWELXLWoldwVNkIIXjMztJVpkX5MJBg11nsFWHWQymVB1UG0qU1vqG?= =?us-ascii?Q?rhkTL3Iluj9IEAbUe+i3g9HjZfyjdyrR7mkQwSP3hasL179+OctnUJerhsgO?= =?us-ascii?Q?mUxHQliq5/wuSaxm+/Z3k+7Aq+GaFdKH9U07jQYJSBumAwkH9/WEB6g5F+tK?= =?us-ascii?Q?229kVM1hEGvApguUw9Dbt/nxI9SHP5ylZJQiHaKhnPhJfL9BHGw8lhcM1nYD?= =?us-ascii?Q?la22WB+AxSC0D1yKtKTOgppfHwUlNOSOZZCvE0rBFg9BYMveo6pBAlIELPJt?= =?us-ascii?Q?rkmDzZZvV03hOG65NUlmfA/F1LSPeKmTxuEconM78HofwcdcD/NiD8To8hOb?= =?us-ascii?Q?reAs4z4j6UU7rLmNMq4CNeP0lTSh2lFkDSolpSBnwRmDsFpVHxehoDR3zLqY?= =?us-ascii?Q?eCtRCzyjYMZdWVVT1qoYfqXDHrtFZ60OPibatyPH/BpOzb0rmzbhVlpdb4Ww?= =?us-ascii?Q?R57gTU7lgj9tiQc9KtKIWV0vwElnvWYHCPnirQ4ofgIG7Ahv0Q=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:11.2981 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 073a1b50-d638-4d60-a0a6-08dcf6f4acef X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7300 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Introduce a new documentation file, `amd_hfi.rst`, which delves into the implementation details of the AMD Hardware Feedback Interface and its associated driver, `amd_hfi`. This documentation describes how the driver provides hint to the OS scheduling which depends on the capability of core performance and efficiency ranking data. This documentation describes * The design of the driver * How the driver provides hints to the OS scheduling * How the driver interfaces with the kernel for efficiency ranking data. Reviewed-by: Bagas Sanjaya Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- Documentation/arch/x86/amd-hfi.rst | 129 +++++++++++++++++++++++++++++ Documentation/arch/x86/index.rst | 1 + 2 files changed, 130 insertions(+) create mode 100644 Documentation/arch/x86/amd-hfi.rst diff --git a/Documentation/arch/x86/amd-hfi.rst b/Documentation/arch/x86/am= d-hfi.rst new file mode 100644 index 0000000000000..b66ff083855f3 --- /dev/null +++ b/Documentation/arch/x86/amd-hfi.rst @@ -0,0 +1,129 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Hardware Feedback Interface For Hetero Core Scheduling On AMD Platform +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +:Copyright: 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-efficie= nt +*dense cores*. As such, power management strategies must be designed to +accommodate the complexities introduced by incorporating different core ty= pes. +Heterogeneous systems can also extend to more than two architectural class= es as +well. The purpose of the scheduling feedback mechanism is to provide +information to the operating system scheduler in real time such that the +scheduler can 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 t= o the classic +cores. From a performance perspective, sending background threads to dense= cores can free +up power headroom and allow the classic cores to optimally service demandi= ng threads. +Furthermore, the area optimized nature of the dense cores allows for an in= creasing +number of physical cores. This improved core density will have positive mu= ltithreaded +performance impact. + +AMD Heterogeneous Core Driver +----------------------------- + +The ``amd_hfi`` driver delivers the operating system a performance and ene= rgy efficiency +capability data for each CPU in the system. The scheduler can use the rank= ing data +from the HFI driver to make task placement decisions. + +Thread Classification and Ranking Table Interaction +---------------------------------------------------- + +The thread classification is used to select into a ranking table that desc= ribes +an efficiency and performance ranking for each classification. + +Threads are classified during runtime into enumerated classes. The classes= represent +thread performance/power characteristics that may benefit from special sch= eduling behaviors. +The below table depicts an example of thread classification and a preferen= ce where a given thread +should be scheduled based on its thread class. The real time thread classi= fication is consumed +by the operating system and is used to inform the scheduler of where the t= hread should be placed. + +Thread Classification Example Table +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++----------+----------------+-------------------------------+-------------= --------+---------+ +| class ID | Classification | Preferred scheduling behavior | Preemption p= riority | Counter | ++----------+----------------+-------------------------------+-------------= --------+---------+ +| 0 | Default | Performant | Highest = | | ++----------+----------------+-------------------------------+-------------= --------+---------+ +| 1 | Non-scalable | Efficient | Lowest = | PMCx1A1 | ++----------+----------------+-------------------------------+-------------= --------+---------+ +| 2 | I/O bound | Efficient | Lowest = | PMCx044 | ++----------+----------------+-------------------------------+-------------= --------+---------+ + +Thread classification is performed by the hardware each time that the thre= ad 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 informati= on +about the performance and energy efficiency of each CPU in the system. Each +capability is given as a unit-less quantity in the range [0-255]. A higher +performance value indicates higher performance capability, and a higher +efficiency value indicates more efficiency. Energy efficiency and performa= nce +are reported in separate capabilities in the shared memory based ranking t= able. + +These capabilities may change at runtime as a result of changes in the +operating conditions of the system or the action of external factors. +Power Management FW is responsible for detecting events that would require +a reordering of the performance and efficiency ranking. Table updates would +happen relatively infrequently and occur on the time scale of seconds or m= ore. + +The 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 modi= fy +task placement decisions. For instance, if either the performance or energy +capabilities of a given logical processor becomes zero, it is an indicatio= n that +the hardware recommends to the operating system to not schedule any tasks = on +that processor for performance or energy efficiency reasons, respectively. + +Implementation details for Linux +-------------------------------- + +The implementation of threads scheduling consists of the following steps: + +1. A thread is spawned and scheduled to the ideal core using the default + heterogeneous scheduling policy. +2. The processor profiles thread execution and assigns an enumerated class= ification ID. + This classification is communicated to the OS via logical processor sco= pe MSR. +3. During the thread context switch out the operating system consumes the = workload(WL) + classification which resides in a logical processor scope MSR. +4. The OS triggers the hardware to clear its history by writing to an MSR, + after consuming the WL classification and before switching in the new t= hread. +5. If due to the classification, ranking table, and processor availability, + the thread is not on its ideal processor, the OS will then consider sch= eduling + the thread on its ideal processor (if available). + +Ranking Table +------------- +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 classificat= ion. + +.. 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 su= ch interrupt +and read new ranking table from shared memory which PCCT table has provide= d, then +``amd_hfi`` driver parse the new table to provide new consume data for sch= eduling decisions. + + diff --git a/Documentation/arch/x86/index.rst b/Documentation/arch/x86/inde= x.rst index 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 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2044.outbound.protection.outlook.com [40.107.92.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 9ED4618A92C; Mon, 28 Oct 2024 02:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081003; cv=fail; b=CcPU7zj/doIpym7ydhMyzlfqxVzsJ97zC3FC/AQqILOFYzDgzUqkgNu/Y0KzTnJFa7bfuIhF+qm0XiG5hfFqsnD/1vUVoQwRORdQ6/MZfLCEZB0pjq962E46ZPNOmiBQnZwI4aOTME+0ACgkfQg8GgNCEsl2kFisOpEtFFnKx+U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081003; c=relaxed/simple; bh=QdHxzDBwqLPbjz8ikUa6cXymAnUz/qVkAinCUCshOe8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FL7E/TBYW7DaUjcZKGuCRQ0HJaIbx9Bv6cb4Gt+9HNbRu72TsGplDs9S9gF73/iLsoW4And2SEUF9gaSW8JMZI6FWgzwqPih/hkudQb74vLanW5MXkN2UQsQnoJhhlWwQRnk224t85NSM9MzCSzS8xR3pZoaYZZH+/uda14ITCI= 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=PUtLqMLI; arc=fail smtp.client-ip=40.107.92.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="PUtLqMLI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hkomvkUbWPF3WM3+/Fzv1sSLwWURBm/NY7yOc57tSbytAL43iBIoouiZdXBX/quLWYpwPHvaaFB3mZxhUXZyZxNLl+1KRmwulm9xzOGEMhGEJ9HVJ6BFgvv65tXIvBpu6vcAMUZMxcFvKsJl5f6mHXysFJ3PE+GEc+jHDyh2FDxgzTRxxlroxdSuxmz4QPQfALFXZKVM60UPMWYGUalXZMNKPcoz0/xaebTrowoijRUYSZo/towYdhM/rN/iJE7PakdXryjZVW9jh4zNzMj3WxJo9MhedUJ2CdmBswN6vWELJl6EbCwouqjrxBJ8AEwdO3TFVIH0faQ+XJ2Qewm4xw== 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=lzfK7HBjuR0XVqwV0/ERsJPvnfHftLVOFwIxVzsvjJk=; b=qgcwj/vipqAPqF5yiuCJ9SGCQtv85B3wRnSpvAnfAXu/sfilM0EK/piPm/vb0CbbAWxCKBdyOjAYWfJ3a1JeHqSyDZ+xFc3INBe367GoctCkDGUeweDMOsvDigLtkOXA5LJbZslMQTnQOWwGJsJrBNqDAi7URoDgccLvQ1MX5qkDIkdLJSLH7jSq+y6GWhYpAhcSOTzAHAb8zxLeVk8gJ+2sPSKVE7kJMEQ4ibVSIarRoxga78DkZTjwV6r/FeO/5eck+KJ4z/FuRIa4LZXhxX0OwSn7OFV4sqOYs656l4dsW2SLOU4/jLrhQd0NpkWFYFwwz7nmP66+xfwAnDcoTw== 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=lzfK7HBjuR0XVqwV0/ERsJPvnfHftLVOFwIxVzsvjJk=; b=PUtLqMLIU0H3jR3KhlA10ffBTOd8gcUuusbA9VZK0jpacLhHKp4t/xDH6GS0uBYABYGLN4ODYCdBki0Kgj5lLxftPQqekHq9XxXZ7YuLASwnECrW8//ZNPmSAem1YULjizcO+4k+aMMy14C6dK+xfAQSTxi+D6BZVaxEmJy8OAs= Received: from MN2PR06CA0019.namprd06.prod.outlook.com (2603:10b6:208:23d::24) by PH7PR12MB7259.namprd12.prod.outlook.com (2603:10b6:510:207::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:03:13 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::a5) by MN2PR06CA0019.outlook.office365.com (2603:10b6:208:23d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.26 via Frontend Transport; Mon, 28 Oct 2024 02:03:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:13 +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; Sun, 27 Oct 2024 21:03:11 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v5 02/13] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Sun, 27 Oct 2024 21:02:40 -0500 Message-ID: <20241028020251.8085-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|PH7PR12MB7259:EE_ X-MS-Office365-Filtering-Correlation-Id: 10094992-ca0d-4b91-b990-08dcf6f4ae2c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lKR850gQsxWu3TOijv9AbEV2gQXDc8YAl+OqqZaJMNkN2P6+I77kYxEexTJg?= =?us-ascii?Q?K/2LPbP5WXdQZ3DcmDJ2M8Y23R2mLcfnU2Rqlm7ZtUyDGnj1RPz7cVjHLppl?= =?us-ascii?Q?Fmjr4czIVU7Om3VTZHUu2Q6Oe7zbO2CMyPxLc+WPFy7sOTp6Bl6fOJBpUAxN?= =?us-ascii?Q?nY+2JZvRteqlhU7RSE2DqNXacBvesoeo2ynsAFhdD0mDmtqmXZV8toTI8NMs?= =?us-ascii?Q?GgHeXVw0JHOoDPFh7o2m/V6s6WxZbb/USU1EWIHnIXQUDGU+idZ662CYkkhg?= =?us-ascii?Q?85+T6Ut32nx05oLHvZrS71KPA5RI3tQpyfsS7/KbUxGkWt6D3CtNjPlc1uUq?= =?us-ascii?Q?LTBBe/1toLlmRaoIJ3yv95z/sSAnb8FJOo0vEv9xuM2xsLjqu2TZ6R6FunFg?= =?us-ascii?Q?6Riv3Q3IwUdCKfIYgFPUiKuyMYY5JXSUb4msQM4X+auX0UpKrXD34ziZuDf8?= =?us-ascii?Q?agvxwubFjp5RYf5yIORZPof9uT0lR8RCiJHz5LRRN8bTAGxLYwmHu+4DEGNp?= =?us-ascii?Q?65AHVA/muMyenTAghxMMx600VQlz4eHkNpn1ZXAOGh9SzOTCJUoTCVAWTN5M?= =?us-ascii?Q?oHlXWM2Ob4W1f79BS0jnKOcnOFJ526r1tLLdN5FEgOZIbg2otIQSDn+2eVYi?= =?us-ascii?Q?wMey5yAabsnY0oTGkzxh0wUc29WdM4MeI1KSDtUFXO4AveDrNlNlgO30hI3P?= =?us-ascii?Q?mSVnw3bXtQOXuXcTSN/3taqB3BfoOYggeAu5d08J7W0MF/I7+3T96MV6/VaC?= =?us-ascii?Q?Cd8HY5s6FY32uLvjK8op6fLr68PWr2UdrkOeJsnIpTfzYPSfaKi09nOZ7eY0?= =?us-ascii?Q?BuinbFh+zVIckPEMAS8fm/HMkq+qEGxMwSfy39y+abbEsaL72gZ4gX7uAZEA?= =?us-ascii?Q?Z5NBNqTJP3YQsHV3wh5mWR05loW7JoElXefj1kXY0DAbxGYM1u/4wpffNp0S?= =?us-ascii?Q?l4KvL48+4+OEsvT5p1sN7lKGBx4VjyOY/Aeop+xlTjSRgYFKT1JRgF2+2+xE?= =?us-ascii?Q?iVH29Mj+Lzu8Neb+i4U/dkL7/Xt6LapyFSNArTNzq5p9jVAtJGVj+a71oyHs?= =?us-ascii?Q?TGGicCnVezCaHoD5psb5WT2P/20d88LPmwv8UTMtNGlNvfiSAHXn77iDXHAm?= =?us-ascii?Q?PTIv9h+VeMYmWWgk/40RxzyKZo6TwtaXHHiPT6uEhzDwLa6kakiSilIsdiHO?= =?us-ascii?Q?Y5q6bwsFy+nNd/p56XSE9rzgjGeBK59uXArDanDqozYMKWt6jD0Hxjp+81iy?= =?us-ascii?Q?DBnUOtSVqtkOwxe8AYggZqU2x88yMGw3brXpJCQWvNkyPwgnA98PHH5a6mP6?= =?us-ascii?Q?jmf1dwmPX9nzdpl6SJeGHHaYgr4MMMJL22k3KT6RrfEZ8sVJILrHpZR7hjxu?= =?us-ascii?Q?vWyjSaU=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:13.3762 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10094992-ca0d-4b91-b990-08dcf6f4ae2c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7259 Content-Type: text/plain; charset="utf-8" Introduce the `amd_hfi` driver into the MAINTAINERS file. The driver will support AMD Heterogeneous Core design which provides hardware feedback to the OS scheduler. Moving forward, Mario will be responsible for the maintenance and Perry will assist on review of patches related to this driver. Signed-off-by: Mario Limonciello --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index c27f3190737f8..4554cbf3dfa16 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1083,6 +1083,15 @@ F: arch/x86/include/asm/amd_hsmp.h F: arch/x86/include/uapi/asm/amd_hsmp.h F: drivers/platform/x86/amd/hsmp.c =20 +AMD HETERO CORE HARDWARE FEEDBACK DRIVER +M: Mario Limonciello +R: Perry Yuan +L: platform-driver-x86@vger.kernel.org +S: Supported +B: https://gitlab.freedesktop.org/drm/amd/-/issues +F: Documentation/arch/x86/amd-hfi.rst +F: drivers/platform/x86/amd/hfi/ + AMD IOMMU (AMD-VI) M: Joerg Roedel R: Suravee Suthikulpanit --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2067.outbound.protection.outlook.com [40.107.220.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00C311885BF; Mon, 28 Oct 2024 02:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080998; cv=fail; b=DPYrfhZ0sDG4XTNYHebX+MGBdwCxhxhX6RtXLgY3z0U6R+jicGyo2kEWdJq8AisM75BmWyaELK700WuGud03wcj+0HkxNi7DxTMRJBcJFr6e/2JhqqLkRokCdi0DNR+qXogPXWtKCYAC2WaY9CibyEiPi61FY0u2c31kNLn14xo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080998; c=relaxed/simple; bh=CCkmceErCb/j2gFvufuZkzoxAkR6JEeyG7gxO5N1uQU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dhNKphWs23ffqqriUXEUCIzecJ0utkz/ytZqYHpulk/NpRkBbOhWaY3WscvtjKVOTcnH1W09mxOj3KeK7ughhtlgy42He+X8q8FKBk4fnbFH2aVdJ+3nKY4U/h0n1GJqeL9xXvC59BXht+XCMvi5owFfRUkzwmBbSrF8mWaErkQ= 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=i7WWgpyl; arc=fail smtp.client-ip=40.107.220.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="i7WWgpyl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S9yJ4RzwuaXHXo2Zn1RD+hbWEu/U4BAm7jt1Uuj6/kCO5BHZGs01cRwgpr0JjLCmvZo0MRKMSxmcQ2NF3zDNhsgwMSd86zCZoKVreK4FjjgzdzOVF6g4DHwX2fHob+PG3Xf2u5ERDMdSY97cb3pbNqbaXA5mTNzLFYBDWjpbt7U9PSMiQ+z5TZXpsuUqvAXDLLE/JOIcHCZwGYOUYFK+9Tf5GIE9S0U7FPzsLj0YcH0qMEK+zEjkk2uZIg40zdyp+AWp+qdCHg5b6FP7/UF8prtAK3AI8qNB1OrQT4YTqeFSrWczZTJJpbtnrMDLeZAbarnv9Xm5x810NmUu/gNcoQ== 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=1dtm26VWZsdxgOSbXChHpJAJvwwSusxTcg9XCfWU258=; b=Ewmw4DVbySd76y1k+0/MYIML9pMUDoajzZgSU3NIDsZ+oHmQMwYlV54QFWIuOqt5RfSeXIRDk6jYS8DQzTOAV+0wQS5S+AgSe0A9cxlkFjnvnKarLJgN2xqNQjGllFNR/YZhh7hbKCWyCGr5GCAl57Ds7jJVJh7aGqlVJwl/HTCjs+2Yr9G+Tl70iBAvpyOWGqil64z52QTXQOmkwtalfvWu1PvUCDDwQ3pbii71amkw8AgNugYCLUGhTlc3dDL5nN70S49jCDjukHR1gddy2oIyWpjKZ1wluVB/IhumhIRLFOsylBAAReFHpq7svRCnO9LD/3wGM2iOORHmtKlm1g== 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=1dtm26VWZsdxgOSbXChHpJAJvwwSusxTcg9XCfWU258=; b=i7WWgpylTF3zcKM9SytN2psS9aMZ6Uwr6BvsJM962kHew8Og6DQjEvGpCDlMWjwHwPiFnqbMF8GD8MtyFKMxBatZFo4PDY6Aiw+hO0Ab1EhgOpwfhalr5BZrKHOIawXvIHX1z2DOYYhOhNyYTeaUu9MOZ11NRlR0dsixXn7XMTU= Received: from MN2PR06CA0023.namprd06.prod.outlook.com (2603:10b6:208:23d::28) by SA3PR12MB7877.namprd12.prod.outlook.com (2603:10b6:806:31b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Mon, 28 Oct 2024 02:03:14 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::54) by MN2PR06CA0023.outlook.office365.com (2603:10b6:208:23d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:14 +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; Sun, 27 Oct 2024 21:03:12 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v5 03/13] x86/cpufeatures: add X86_FEATURE_AMD_WORKLOAD_CLASS feature bit Date: Sun, 27 Oct 2024 21:02:41 -0500 Message-ID: <20241028020251.8085-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|SA3PR12MB7877:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f4d552b-0209-4085-dc6a-08dcf6f4ae90 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: =?us-ascii?Q?xqGrxs/kE32ewap0LALrv5laYvqf8awISVXa85tnAcbmGVC9oK6r6xJtEndl?= =?us-ascii?Q?w38EMLYdSUZ+upT9ZYVosrY9+O34p1R+Mqy/iRHYJxTIqEzSqwX8ncKdR4SG?= =?us-ascii?Q?s8JFPu3LBxJnE2upHXHJbw6VdQRHNA3CP4209CnMMJHk2nX02XlCISjnYsbi?= =?us-ascii?Q?zjreO3hg/SVAzWY2tD6hzggF1w1nObVQxxEBmQhdXnqVF23jYQtZ3PgXVgY0?= =?us-ascii?Q?LZ5He/MrOSsMNJ7poBRwSfqOjEwz+Lpiz0+SuTdnaz9BYonbbWVvj73oHWiI?= =?us-ascii?Q?iLxfx4CFmtwC0EG3+fNBy5195kpNCI7fTBBdq79hPl3kxK72Rbtpxb8k7vvs?= =?us-ascii?Q?OOsLtm3OHkUu1mdEDCZk16COA0TcQr1uRumpnAo/zzRIIIX1JUw+N9iNM3bB?= =?us-ascii?Q?OhJoSY+JICV42XDYMmjT0qe7Wt/3FUYbg/5Z6UjX3wTsVp23Ms0gNqlMeBZ7?= =?us-ascii?Q?denuPa12omKv2cGeknlNFx/8UlAmxeWRKwcjlLxUPX+3yQ3o8nErfCWnZgH+?= =?us-ascii?Q?kMR7HHu9VN/bYX7I3//UuYECQNWfd7+hbxSg3RUhgmMkVTp48KIwcKOF1e9s?= =?us-ascii?Q?Zyy0lvZVZeUHTcbhEVBXPxFQYNjDtqHvhWVfuEGjC3fCytsHkLvFRVDCWOX/?= =?us-ascii?Q?0HnAsN3cbaDmtgmcKJ/VAOlkMhoEIi9gV1ElpVgqx6+1BSXleMyHiGt+cKaQ?= =?us-ascii?Q?1K7Vn+P9hwO/JNAUETVdNo0pUSrtYJa5YhoOtC5cXmh61s91RacVlZxK029r?= =?us-ascii?Q?L+RgrZ8C8FGLSQvZ5x7q7aupJOrWyKkItbfkn3EGt/L/iNtYNggwnE2WHZnD?= =?us-ascii?Q?dMNTZJNwoxcOkGfpQH07rE3tacNTKpvBpZpFH3++R+mu/3R8jg7aq4uB58mf?= =?us-ascii?Q?JqRd+X/9kS3P1YPmBNbbIfxgP6kmvQmmA50tT4mBigvtQ90GM/IUSOLLSn5P?= =?us-ascii?Q?4ps8CcnT9q+t60B/rizEAyHHqKzikVShq5M180YC45IrJNPG2uF9NfYFbbAv?= =?us-ascii?Q?UaC4nSiOCGxMgq6DoG4qnLr+MTiELv0bSDmYEP/5XsCqROL5cmKcLksGeTDy?= =?us-ascii?Q?ja4riaslX4rs9YP3jGsz0SYoynI/fu4fn0vEhZwbqyqJ3rOJXLZNrYms4eHO?= =?us-ascii?Q?9GPQ6VgMPoxcNpSihv7MR8oH/9V15PT7Sa4SMdStT/WFZJ4KpnNlNeMV5MRJ?= =?us-ascii?Q?iKlw9B749xMJ9UidXhcDIfsxQA4gLzRBOF0U0XXVOi2MkvAXhImVk41rJKgx?= =?us-ascii?Q?Vbw7vle/+RkA9KnGdGDF7ZsdtizeCr0I90qvfWaa8wFKZCExpFlRvvf4uN+M?= =?us-ascii?Q?ewGZbW7VnqhdiYGosILwXcSAVRh7ZVbtqu4SXDQZIEkjrb/kqLH11ud/VFI4?= =?us-ascii?Q?sG43ac65oWp23f66iF09wOpXzNoWo619ERRlTNqCfAYGue4Wrg=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:14.0325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f4d552b-0209-4085-dc6a-08dcf6f4ae90 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7877 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Add new feature bit that indicates support for workload based heuristic feedback to OS for scheduling decisions. When the bit set, threads are classified during runtime into enumerated classes. The classes represent thread performance/power characteristics that may benefit from special scheduling behaviors. Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpuf= eatures.h index 1216a0588ba8e..05e985ce9880d 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -474,6 +474,7 @@ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch hi= story at vmexit using SW loop */ #define X86_FEATURE_AMD_FAST_CPPC (21*32 + 5) /* Fast CPPC */ #define X86_FEATURE_AMD_HETEROGENEOUS_CORES (21*32 + 6) /* Heterogeneous C= ore Topology */ +#define X86_FEATURE_AMD_WORKLOAD_CLASS (21*32 + 7) /* Workload Classificat= ion */ =20 /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattere= d.c index 307a917415343..1e54332594443 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -49,6 +49,7 @@ static const struct cpuid_bit cpuid_bits[] =3D { { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, + { X86_FEATURE_AMD_WORKLOAD_CLASS, CPUID_EAX, 22, 0x80000021, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_PMC_FREEZE, CPUID_EAX, 2, 0x80000022, 0 }, --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2075.outbound.protection.outlook.com [40.107.100.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 090B4189918; Mon, 28 Oct 2024 02:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081002; cv=fail; b=YnAdm6g84/VjKG44tIm8ycEuECxtNiCoDJ7Ah2p0o6hqzuRb17aICQtvHE3W49r1BRCLH5ey48lxr0cgWRxCs8t+tcxsYwxeQ+Pj04pDaaiKlLS+R05ZIJ5lz3WX7ZMOMJ3xBOPXa2v6gQhTvhLxHY5wH/5RW736IPHorsktbMw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081002; c=relaxed/simple; bh=6/GNpT2p5G0nMQWNGh63AxQqGIghyA/swYKFuepemJE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p4DWB4knOwUEK+uP14cJPGPEGdASRG1VRMUUaIhySuHA73nj2EcM8PcDNPlZj0awh4uiDg3VA1XPhl2YhJFuQlNpLuyGnYdgfNcPx25txtYQf7O8nv5AdJwRcuc/ccr1RD3FvExKS2qsBttNdu7Oy/A2jJkYkYXcKr1LdqVAAIA= 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=YbcBoiG8; arc=fail smtp.client-ip=40.107.100.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="YbcBoiG8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vKpKHwuhHeSXuotvnUOF9u77WbeiseYgHXa7w+K8Y1G17ia+PZ6ahWPG+BFC1mFBIKS4d+c7uGRxQ8ulIXAzQK2Ieb8t8OyLE8GjwdAlaQrE2LsEplzRWorZmFxCH849OPwpRLa/pJObImmWH3jI9dfug8b91qvue+x9HKcMobarlXqzpvBDsfJ/l59GLmHvOZdsWuFi5jtcXpb558IDk7KP+RBfl6KgV+rjqmxpnnZLyeWblB4569BPLJs+DJv9g9J51aOxfvlbR2vQE08FnzMwbPf8NtJy0nf/SDDffMhS/nt4drg4+v0nqHO2o4gfObFk0ohPC3MgkqkX4sNTgg== 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=T+YnyB4FvyMZRZGC/CY4g7RFYcz2jzUf529IV8CMKpYhlKLMUXvdZi5ZS9SgJDwtiCaQzOEp90PZIRzAnEIq2TeOh3F5ngY7rlzcRCoiUmCy4T57bp7oWswirM7fGbXov9W2fsqkoQy6p1vE9wL0GQlI2F0t/gJCqHi89t/IZxNBcfK9RhzpEUJAUhIrGRSdqpgRTaYuOUKw2TUaxP7rGwhh1/vvHYfMwPUHw+Wkgsj8Nds5KXmi478Yqt8iO+m5WrgSbehrBRSL7gaUr8YosewkSu4uR3xrAa+a6aFZUdgpy1qq2CMNHiNv0/hxO54WRzyABvmCdnAhfYJ/9+a0gg== 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=YbcBoiG8JLlpG/jMm5dWF3cm62xE8WyRG1Oj0a01eeSg5Au1c04Y/iEzjo6AYb/V+y/83zvK3T3QAvN+1AtMzRzaDHDs6fIw7E9qa2z00IVp706eGIP9BWIBAcjW74PgI6uMpkttHFapiIEf1kwB85NgTGrywbRC+QvYjTt9mI0= Received: from MN2PR06CA0013.namprd06.prod.outlook.com (2603:10b6:208:23d::18) by CY8PR12MB7337.namprd12.prod.outlook.com (2603:10b6:930:53::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Mon, 28 Oct 2024 02:03:16 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::4d) by MN2PR06CA0013.outlook.office365.com (2603:10b6:208:23d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:15 +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; Sun, 27 Oct 2024 21:03:13 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v5 04/13] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Sun, 27 Oct 2024 21:02:42 -0500 Message-ID: <20241028020251.8085-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|CY8PR12MB7337:EE_ X-MS-Office365-Filtering-Correlation-Id: 66a6bdaf-5df8-44c5-f829-08dcf6f4af8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/Jxh3DSewsjOMxKl1Y3r9aKsexnFaLfGS1FLTDgF4K/ctF7XExWK4INGE/AK?= =?us-ascii?Q?qRP/5eCZ6sRAtB1ycVkbZZSUguIGX8TGZTsjCaGdVfYdLWd4D90lHiUbhwGt?= =?us-ascii?Q?AA3zw0Vg26jnMGLvkOM8hyR5fEeEmpgN96+UAENKpvYiRiseznA+E5a1dX+c?= =?us-ascii?Q?pn43Xi5melUZGoINVSXj6zH6141wqsRcBoWPLryWmBoY736bfoWU5riGI6lp?= =?us-ascii?Q?yX+UlNenFHXhVqsUMiB6dcqc1LDLjlFaFRvYLGqH93Kd/UUtOoValntG0O6w?= =?us-ascii?Q?pBOqt69Cna0BitMoVk9biVraeJkysL6PKqqKaEUEg/rZ0J7V/NNqYuV1ssTc?= =?us-ascii?Q?f5I4g7f3b+bY1abty/EIZi4uQDWyEWtXEaYxfH+dHbniSC/842X1VjTzP2AE?= =?us-ascii?Q?EaGbfPFm9LZenB0g8+dX1dCeNaimMkyk2sybGEzkbfvBqRegcXGrYKyrOl2e?= =?us-ascii?Q?FC5nb8/wcebNalpHFpi5xKAti433m1QHgueEnx4/tMRx2LW/My7x5fBqSMVa?= =?us-ascii?Q?/YtiV5l+dvI8+Xx5uL2/YqKxiuYltSea0yWICpBhQNGm8zW9MPFeHMd/E47g?= =?us-ascii?Q?tuTJfA6TR7DWVvAaYldFKyn1FRIOqJmGLcS2iLPB4g5vRIIfxwjzlOK9ZkMv?= =?us-ascii?Q?1FJcoTqnrKsnxTSq70TsXI9gL1XWEL6R5Udvr7CBXynFmzm7SEErRDDP3PYx?= =?us-ascii?Q?1/pKAChLzbGhDdFuaOUmqPAKXYrgS5W/415hiISWEeR2w/BKvnnFqvdnCDwe?= =?us-ascii?Q?bFBIMovG9bEiEr62aEMs+S5q3A32gbPXDeOzHFAoiArFfyDllk281SYUO9PZ?= =?us-ascii?Q?Ly8keFhx8uY1MP9HOqqOXoASqqGQSTHcOOzJhZ8RtqCEI2hvJ+VWv5r/NVry?= =?us-ascii?Q?6SPkNxOhDLMAF4tibQxo1JX1ENATl/Xpy/p49Fz46R6s92oQzqLpSChIhWiu?= =?us-ascii?Q?vHQDy3TyrkUNQS4N2ktOMNOX862gLA5o4DNoKWhjwZ6L6CnUkDYGGXJNy+VK?= =?us-ascii?Q?R+wPJH1iUj2juKToFxsh+AG6uf7VVZCk6BsBOSsMiizDOn8awZlNTQpOkUGE?= =?us-ascii?Q?BgDPXCrDVd11itJoeCpLWw+jCFPgBKoklO9RA2rVkzd1oUGa8asFO7vm0I/l?= =?us-ascii?Q?tggiHm+effNETK6R/To+kLBlZcbv0rX7zIlC05Kp0SI/vscLdzYdJpIk+8Ma?= =?us-ascii?Q?CTAkjEjTADu4jhoMfSRwJzRHyQUWftwpXSBk/zVlo7oelD0TGooLdgS4b+FW?= =?us-ascii?Q?DNwx+JBmKkMI5rhmTYRgiS33NRM52UlM9iuUVhnDffN/FM/pMX9LZbgOArCS?= =?us-ascii?Q?3/bVGfi2O26hdL7t+D/AsLuO1gsHv5k8zH+Nxn8aJRusjO4f5dIR9Ak7dl6E?= =?us-ascii?Q?eEp+wOgjWNqgYlsItCAsUemKq4wPYKlB7h7Ff5f9xzheKy4rUw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:15.6887 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66a6bdaf-5df8-44c5-f829-08dcf6f4af8f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7337 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Introduces new MSR registers for AMD hardware feedback support. These registers enable the system to provide workload classification and configuration capabilities. 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-in= dex.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 =20 +/* AMD Hardware Feedback Support MSRs */ +#define AMD_WORKLOAD_CLASS_CONFIG 0xc0000500 +#define AMD_WORKLOAD_CLASS_ID 0xc0000501 +#define AMD_WORKLOAD_HRST 0xc0000502 + /* AMD Last Branch Record MSRs */ #define MSR_AMD64_LBR_SELECT 0xc000010e =20 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2087.outbound.protection.outlook.com [40.107.237.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB3F6190685; Mon, 28 Oct 2024 02:03:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081006; cv=fail; b=gBs1i1GF1D3PFCS0KZQmWAbppPCTuVn3ZjhZmpCn86F3WvDs7x77xmdPcItafQjTckNgHsaSmIh+AK7QJZTD2qB6mIdb3YupHoy5AIZz2ClFiqPAu8uflVegOjAYSmX0QbBWZIRimTHayQXjSKPS/dkSnC/KWet5BSAGpNAdvf8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081006; c=relaxed/simple; bh=bDG6YPlTYyO5FxN5nPIcCuN3qUVAj9w1jUAV5gAiOVc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dkjMNHymeva/2lI4L6nCT+ehiEK7uLSZc5z1vdYIimugYWDieDdfz/RGM4c/iETUjrw8Iy07B9xaq5LH+FxI/sFCXxH9nvFrlhuVsdzdLdI/wC5I68Bv8KX26peWYoUcPv8K8cgyvYYSBN5p37NpmHQg4b1as2EO70IWjyO5rwI= 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=VoD/2auJ; arc=fail smtp.client-ip=40.107.237.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VoD/2auJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L+VI8SfQwaG9hRB6gLv8D0VUPop3eMWBfLbwbHLXlCHJYA4tw0J5ugSfYjiQz0SWmCeI/BTHnKkRk0CEVome0WnznSULhVoOwaERJwBXdS+kbh2hSoHRXAPyrRTf7p8G28GlGBxdPFo3UpXxEsoTX2F9ZDdngA67O6Dv1Wg45VAAAXjkPvaPtnxlA9ARYgnVfBC4wnUazKRzVUI9Z4Zk1rkotiSDwO02pCx+zvs4VDR6aYDnQeImBMZS9eatzSH0UNVyvQz9m3rr7nAo4gj7MdOco4yWm1//bDvHIe33M8C8WK9cyrqpB0KVpOA3kN6oT292GuPgu2mwNLVhyBvQKA== 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=DIWBewZCbvsLy2Y8C+VvYVLy64BV7JfQyT2KFRrIq2g=; b=ptn6ytXHZVwnIduTzjNNbUAWH/ai3RhJL1oXKrazug28bN1k4G9rBYX3aCz4LrOMxSDgOCIJr05IQR6USwNi7sTvitEFbPbQlfkDmWoB3nDFPeY5BPpqn7G1RDTTD4PoCPbpXlZEhxhR2y/MTDGFeQap5q4J/o+1GKP2YEHXBetNjYplxkcSMiTt2msEoVaRBvLA1T6HdG74q7WOSHrgk0Pfa2az/uqTw876RofTKmYrVwlxEC+e2a1hI8kKBV7kTgFybJ2W1ucvS232rwkjfBlpUBNSbgPA5P1CPSQ6BZZnZA8UaMHigBuJltQBebQIie9suzWV3IFwQvg/SwsTXw== 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=DIWBewZCbvsLy2Y8C+VvYVLy64BV7JfQyT2KFRrIq2g=; b=VoD/2auJ77YlOrSJbhBPU3NfMAkYAeaECgchB1o7S+6E96kqCdNVPfOEVowUiLw3e2z9OkRkqOTDGbleelHDIf4g9OR1Tav02LnuL3ZGYoe8LyE8sdczQBta5jDkoa3FgGuIQ4nNrEED97hI9G7oUT39oifIBYEtNZuaNnl4oZE= Received: from MN2PR06CA0023.namprd06.prod.outlook.com (2603:10b6:208:23d::28) by DM4PR12MB6542.namprd12.prod.outlook.com (2603:10b6:8:89::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 02:03:17 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::d8) by MN2PR06CA0023.outlook.office365.com (2603:10b6:208:23d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:17 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:15 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v5 05/13] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Sun, 27 Oct 2024 21:02:43 -0500 Message-ID: <20241028020251.8085-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|DM4PR12MB6542:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f485666-def7-436c-13e8-08dcf6f4b08f 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: =?us-ascii?Q?uwJB1hC+b/c7AtFxpJ8jY7JIs/GbDHtlLevQCL3TKPcS6iBI80vCOflo62xa?= =?us-ascii?Q?xElgyVjI+xCKlmw0IcyPqtAfavOfjW/ukjScyUZCrY7K1fyP1hnjuC0cgDgW?= =?us-ascii?Q?DuNzEoutDz8qVbfyafEymC0AQfeLYl0CfP0TITDY35AgdVc4QWertzyurSta?= =?us-ascii?Q?MpHG2nlmwyADWOGeq4v488f6I6EhdAKkDetEI623uDmLAWUqqX0Xse8qTaqd?= =?us-ascii?Q?FEfNdLsWvGL0GHtGsqQGItWoMN1MjueA+CKGEAE+GOoa9bilv6wG0/WtZb5K?= =?us-ascii?Q?NA9bIm68NaLs+QuNLQEVU/SEk3x3eZ0cOMO7apSk71uOau0bhiyUn+IxNMJ6?= =?us-ascii?Q?Kzc6YpR9Hbh0m4N9BCkwTH1FQ7Z0HIZdG10XycHFjSzltkWf3KY665+eAte+?= =?us-ascii?Q?9Sn6KLdxm22gAPX4K+WadRZfXD1Cc92LxiKT+rX6ITioyyoVCFF0+YU24tsv?= =?us-ascii?Q?C7TNwGAlkTiaGr2MxY+Hmu01NBfHNuLsFQrSenc33hRNGpgYqWzrc1RRYYOd?= =?us-ascii?Q?ywFKVcvAadWHwfX9umJbTcorMehOsvbDmR2b1XkTamH+gA7vA6M19y2x/1x5?= =?us-ascii?Q?KEWYGqKapPwC52Z74DXaiM/1RcPzqrB+mSKBsS0DPmXW/CxCVt2P+3dZra7a?= =?us-ascii?Q?NXVvpi5IQShxc6bR8eimYwxrO28NR9RXYxuaAgEaAiOcb2vqweup023oJeBr?= =?us-ascii?Q?infN5s55Lstk2YDy4+4eAL2lC/cHfQDBAgurlKlvsFZ8CEBwU0aDns1e7vyF?= =?us-ascii?Q?1z8BT+lrQs3yNDwLNohjDXYTpnbaH2MU4Zi0euuqfxdeYFyLx8/fle2BkN0x?= =?us-ascii?Q?4rKqjJBk2K7ILwTbqU5GelwO74JWpoTLVH4f01W9RcXyyhNARtIWVrm4L/U7?= =?us-ascii?Q?J0aQPK3Y9C+PCiEy4hNnDg+Pgt+XuFxqbONXr/R3uijmLngX2G58q+qtcuEZ?= =?us-ascii?Q?N2YLHpVf4BZjRxraZBDO/kDge1bIHKD/0HzOPlooQPEucTdj976lTJX7/RTg?= =?us-ascii?Q?+4fabKrQzwILWvIzPWyhFThLHDqSv85KnyXsZJozxauZpkAxVGtqnBiMDw+Q?= =?us-ascii?Q?DvVqlBZrUOMR1BJ3IfRGFol7qkNpVTEZjpjOQh0t+sxEYlsLyTu/Lf6OUSP1?= =?us-ascii?Q?SMTZ1EyWlQ/hSZhqObEyRzCnbL7OoYECd/Ib7v+CS21cXTAqUL1XuFenit6a?= =?us-ascii?Q?epURGbSVpoZeONtJ73FEC4ZD5OZJBrNKJ/332UWil22PhwlVu52ya/Soehd5?= =?us-ascii?Q?LV1C+gbBRQZTujo84Y4OgFjCrw6vxK2V9oBvR8CkKT35V56XRgrpljEN+Dtj?= =?us-ascii?Q?Xzcdo/Ind5FM9ieV0LTfeX84MEIx0mnpF8+6PKut5xYFIkf1dKfLPb4VfW95?= =?us-ascii?Q?+2LAL5keT/lCuRQqACKH9iaR9rLZuepKLVEXbqul4WKIobYiCw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:17.3762 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f485666-def7-436c-13e8-08dcf6f4b08f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6542 Content-Type: text/plain; charset="utf-8" From: Perry Yuan The AMD Heterogeneous core design and Hardware Feedback Interface (HFI) provide behavioral classification and a dynamically updated ranking table for the scheduler to use when choosing cores for tasks. There are two CPU core types defined: `Classic Core` and `Dense Core`. "Classic" cores are the standard performance cores, while "Dense" cores are optimized for area and efficiency. Heterogeneous compute refers to CPU implementations that are comprised of more than one architectural class, each with two capabilities. This means each CPU reports two separate capabilities: "perf" and "eff". Each capability lists all core ranking numbers between 0 and 255, where a higher number represents a higher capability. Heterogeneous systems can also extend to more than two architectural classes. The purpose of the scheduling feedback mechanism is to provide information to the operating system scheduler in real time, allowing the scheduler to direct threads to the optimal core during task scheduling. All core ranking data are provided by the BIOS via a shared memory ranking table, which the driver reads and uses to update core capabilities to the scheduler. When the hardware updates the table, it generates a platform interrupt to notify the OS to read the new ranking table. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D206537 Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/Kconfig | 1 + drivers/platform/x86/amd/Makefile | 1 + drivers/platform/x86/amd/hfi/Kconfig | 20 +++ drivers/platform/x86/amd/hfi/Makefile | 7 ++ drivers/platform/x86/amd/hfi/hfi.c | 168 ++++++++++++++++++++++++++ 5 files changed, 197 insertions(+) create mode 100644 drivers/platform/x86/amd/hfi/Kconfig create mode 100644 drivers/platform/x86/amd/hfi/Makefile create mode 100644 drivers/platform/x86/amd/hfi/hfi.c diff --git a/drivers/platform/x86/amd/Kconfig b/drivers/platform/x86/amd/Kc= onfig index f88682d36447c..c3f69dbe3037d 100644 --- a/drivers/platform/x86/amd/Kconfig +++ b/drivers/platform/x86/amd/Kconfig @@ -5,6 +5,7 @@ =20 source "drivers/platform/x86/amd/pmf/Kconfig" source "drivers/platform/x86/amd/pmc/Kconfig" +source "drivers/platform/x86/amd/hfi/Kconfig" =20 config AMD_HSMP tristate "AMD HSMP Driver" diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/M= akefile index dcec0a46f8af1..2676fc81fee54 100644 --- a/drivers/platform/x86/amd/Makefile +++ b/drivers/platform/x86/amd/Makefile @@ -9,3 +9,4 @@ amd_hsmp-y :=3D hsmp.o obj-$(CONFIG_AMD_HSMP) +=3D amd_hsmp.o obj-$(CONFIG_AMD_PMF) +=3D pmf/ obj-$(CONFIG_AMD_WBRF) +=3D wbrf.o +obj-$(CONFIG_AMD_HFI) +=3D hfi/ diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/am= d/hfi/Kconfig new file mode 100644 index 0000000000000..08051cd4f74db --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD Hardware Feedback Interface Driver +# + +config AMD_HFI + bool "AMD Hetero Core Hardware Feedback Driver" + depends on ACPI + depends on CPU_SUP_AMD + help + Select this option to enable the AMD Heterogeneous Core Hardware Feedbac= k Interface. If + selected, hardware provides runtime thread classification guidance to th= e operating system + on the performance and energy efficiency capabilities of each heterogene= ous CPU core. + These capabilities may vary due to the inherent differences in the core = types and can + also change as a result of variations in the operating conditions of the= system such + as power and thermal limits. If selected, the kernel relays updates in h= eterogeneous + CPUs' capabilities to userspace, allowing for more optimal task scheduli= ng and + resource allocation, leveraging the diverse set of cores available. + + diff --git a/drivers/platform/x86/amd/hfi/Makefile b/drivers/platform/x86/a= md/hfi/Makefile new file mode 100644 index 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) +=3D amd_hfi.o +amd_hfi-objs :=3D hfi.o diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c new file mode 100644 index 0000000000000..a92fe74b415e3 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD Hardware Feedback Interface Driver + * + * Copyright (C) 2024 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Authors: Perry Yuan + * Mario Limonciello + */ + +#define pr_fmt(fmt) "amd-hfi: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HETERO_CPUID_27 0x80000027 +static struct platform_device *device; + +struct amd_hfi_data { + const char *name; + struct device *dev; + struct mutex lock; +}; + +struct amd_hfi_classes { + u32 perf; + u32 eff; +}; + +/** + * struct amd_hfi_cpuinfo - HFI workload class info per CPU + * @cpu: cpu index + * @cpus: mask of cpus associated with amd_hfi_cpuinfo + * @class_index: workload class ID index + * @nr_class: max number of workload class supported + * @amd_hfi_classes: current cpu workload class ranking data + * + * Parameters of a logical processor linked with hardware feedback class + */ +struct amd_hfi_cpuinfo { + int cpu; + cpumask_var_t cpus; + s16 class_index; + u8 nr_class; + struct amd_hfi_classes *amd_hfi_classes; +}; + +static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) =3D {.class= _index =3D -1}; + +static int amd_hfi_alloc_class_data(struct platform_device *pdev) +{ + struct amd_hfi_cpuinfo *hfi_cpuinfo; + struct device *dev =3D &pdev->dev; + int idx; + int nr_class_id; + + nr_class_id =3D cpuid_eax(AMD_HETERO_CPUID_27); + if (nr_class_id < 0 || nr_class_id > 255) { + dev_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 =3D devm_kzalloc(dev, + nr_class_id * sizeof(struct amd_hfi_classes), + GFP_KERNEL); + if (!classes) + return -ENOMEM; + hfi_cpuinfo =3D per_cpu_ptr(&amd_hfi_cpuinfo, idx); + hfi_cpuinfo->amd_hfi_classes =3D classes; + hfi_cpuinfo->nr_class =3D nr_class_id; + } + + return 0; +} + +static void amd_hfi_remove(struct platform_device *pdev) +{ + struct amd_hfi_data *dev =3D platform_get_drvdata(pdev); + + mutex_destroy(&dev->lock); +} + +static const struct acpi_device_id amd_hfi_platform_match[] =3D { + { "AMDI0104", 0}, + { } +}; +MODULE_DEVICE_TABLE(acpi, amd_hfi_platform_match); + +static int amd_hfi_probe(struct platform_device *pdev) +{ + struct amd_hfi_data *amd_hfi_data; + int ret; + + if (!acpi_match_device(amd_hfi_platform_match, &pdev->dev)) + return -ENODEV; + + amd_hfi_data =3D devm_kzalloc(&pdev->dev, sizeof(*amd_hfi_data), GFP_KERN= EL); + if (!amd_hfi_data) + return -ENOMEM; + + amd_hfi_data->dev =3D &pdev->dev; + mutex_init(&amd_hfi_data->lock); + platform_set_drvdata(pdev, amd_hfi_data); + + ret =3D amd_hfi_alloc_class_data(pdev); + if (ret) + return ret; + + return 0; +} + +static struct platform_driver amd_hfi_driver =3D { + .driver =3D { + .name =3D AMD_HFI_DRIVER, + .owner =3D THIS_MODULE, + .acpi_match_table =3D ACPI_PTR(amd_hfi_platform_match), + }, + .probe =3D amd_hfi_probe, + .remove =3D amd_hfi_remove, +}; + +static int __init amd_hfi_init(void) +{ + int ret; + + if (acpi_disabled || + !boot_cpu_has(X86_FEATURE_AMD_HETEROGENEOUS_CORES) || + !boot_cpu_has(X86_FEATURE_AMD_WORKLOAD_CLASS)) + return -ENODEV; + + device =3D platform_device_register_simple(AMD_HFI_DRIVER, -1, NULL, 0); + if (IS_ERR(device)) { + pr_err("unable to register HFI platform device\n"); + return PTR_ERR(device); + } + + ret =3D platform_driver_register(&amd_hfi_driver); + if (ret) + pr_err("failed to register HFI driver\n"); + + return ret; +} + +static __exit void amd_hfi_exit(void) +{ + platform_device_unregister(device); + platform_driver_unregister(&amd_hfi_driver); +} +module_init(amd_hfi_init); +module_exit(amd_hfi_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AMD Hardware Feedback Interface Driver"); --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2042.outbound.protection.outlook.com [40.107.244.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 C371B19049A; Mon, 28 Oct 2024 02:03:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081005; cv=fail; b=UCPqK4hW1Gn6r6TNo2B171K/d1oR/rdv7QZfyOBYjMA1qpWy/a1sALQZ/r/smHx7KLBKViBujUkJBbMsHttm9WfDzdMJgjxNnBMYDd3FdZOW7p/0xUD5cjeMBQiWyhbUY/sddkiB7ngWl38ZxygoisibLd9dNgskyzrlI8w+xyA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081005; c=relaxed/simple; bh=m9DsvIoyEVL47DOfQjdYURoN40jhquPqlSgfKI+U5o4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LD80j/ZLTT8lebSSEapaT4HAjHZSxNg3084J30ygubxxoWm8sUK6b+X4raoOA1OKgc6fl0KOmHpd5Tp53JhLut8AFyGH9FDwB1mEq0kcIz/Jmu8Ax6xDADVrIw+I/L5oPUFkXeR5jhwHtMg2Xgby29BPlUQNjDG6q2YOxgo9nWM= 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=45ArENJc; arc=fail smtp.client-ip=40.107.244.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="45ArENJc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Akno6drfO3XebR141R475ILzdTIFC3TvJWA99vYW42ZqGTL7a8nyE4Ca5NKIjDRDHAuJCqeITpnJquZw50jZLWiUcL45wJNTCJNIuBRNhW5B81x2DlJw6YyYS2YShzALbKCo4zNZsv5J7Ke57ru5B9eveKFjUdnbpw7YGlLyxSwmup2phPnXCiZhKXAUjbjN/9cLg/ccAFEOXTncyBnLTyvjNfCjsBpfw0rrYWgse0HlG/PtzsyA4MpTALGLoc+afiarC2CvwVaR3+zJNlLb23wP90YLlyUQFe/1/Mzt1a2kOT12J3cvaofkDpQT8M7j4nimnZUJFjM8deVEgZg18Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DKmKNuX7W471NSvyi+N49QiC6bAANemeibU1F0ELCI4=; b=M8rU5b/IdUz4Ux3Ao1y/v8kmB85F3PhYIXv4BV7+mEckpQgcqx0h6DwIMbxuwugbBu1/Rxk7rJdJTnK0iJFPhkT4/YIOE/yMicuWk7kt0vzE1xUiOAxiF8gygQ8AunV0CpLuwdql7niINp/Yan+v/m2lnxOfMtMNVph/1ee7kg3Ny/pC2G85rCvk506FMEgRW0ii2qa5cf/8A+AUrPdMqgQ49ikCc2WHuyLpyeViNUdgBewhFqSmZxrhN+HD/ZbO32q0gPlnjCqDRe+HtwY8BqoEenhY8PZ6WZlcTBJyzp6jjcGNRx4E9Ijp+CqOQX4+LrAsDro4WTpO/fBnkPqsbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DKmKNuX7W471NSvyi+N49QiC6bAANemeibU1F0ELCI4=; b=45ArENJcFAJT5U9HR5yNtGiJe+gzBMTnmRimgyMT/+zWrFH22HXSy5sGTW+4IEHud7YSuRPbClLajwUX3Tv9/Lg7z8+lr5h4+sEs19sIYSC5GYyh6brOj50ZcxKXkgyruf3fQM9P6X7CE9AwuNTCf6EJLd/qxO1U4FhTT/C7qiM= Received: from MN2PR06CA0003.namprd06.prod.outlook.com (2603:10b6:208:23d::8) by PH7PR12MB7211.namprd12.prod.outlook.com (2603:10b6:510:206::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 28 Oct 2024 02:03:18 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::5d) by MN2PR06CA0003.outlook.office365.com (2603:10b6:208:23d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:18 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:16 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v5 06/13] platform/x86: hfi: parse CPU core ranking data from shared memory Date: Sun, 27 Oct 2024 21:02:44 -0500 Message-ID: <20241028020251.8085-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|PH7PR12MB7211:EE_ X-MS-Office365-Filtering-Correlation-Id: e753bb60-41f3-4c60-4974-08dcf6f4b106 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?zzarXss4h3pdFil/wFhg5DMbh9EgryKr/0TpgxNbMW6ud+afs+De6QyHMmD5?= =?us-ascii?Q?IcC3AHJPDVp16orIB1o8sEivTBZoWdXccnAi2qVKD9qFRfkMy6qAu/qNouKb?= =?us-ascii?Q?iPqXcgbgF9lzs/lQ7dyQ2sCjZ0aI2vl5jSr+VRD6HuTJt1SRgrkRiwlY6pe9?= =?us-ascii?Q?2zo5U59Jh8wbyetR15rkjHTe494DWLGxVfKx8TxNzvKJaKKQW4zKRB99pCTC?= =?us-ascii?Q?8GrLds65OjdytG2fuX6Q6X52V/Vd/Ybvant+mHte1Jx2swB8SXg49Z51fKbi?= =?us-ascii?Q?q9s6sBdN+8xnweBTqSJl6SpvwQEt0ymjLVWgoXh7LGE0QatGNSeVKjrIj1ZC?= =?us-ascii?Q?HTyTh0Z9fW47ml4aGEfrfa81S82Y8DyrRYXWVwvMNruhIfft0A43SxDXE7Et?= =?us-ascii?Q?/MY4/3224YBogwfV2LRw7q62oCPlReXl4mrMeSQiTgaU8ATTz1qoL45YAVVE?= =?us-ascii?Q?U3crHi4oITTbKL77fmQBo03MAbLecCvdVzOMaPTpSA9JjFVVlE4vDhEXiY/F?= =?us-ascii?Q?Va2+ZUdnCQrVn7D0C4K2repZ0wEYVETk0DGcedHsOoC6XcO7xuNrA6vHZjIU?= =?us-ascii?Q?wQIONMG0gdKFv4ubj6Sj4klnhxAQpUwcqrJuefe9xm7HOCfJ3qqV9XWYewo+?= =?us-ascii?Q?OhDFbIeOGrPhq3Aae9Bso8n2h/y9IvjQ3bHtT+YsyamMU/7sTHmX2jm1d9hq?= =?us-ascii?Q?IBAMBYkJ6uby0VsWP5KGMqjVHVha6icO0gM5+OWeuBNaxpSXtzamfIM3ydgB?= =?us-ascii?Q?8/WnT8F+u+4a5JQFfoHa8ryrqDCDCS+Siy6wbL9vbANmozdRrY+IwMNvqdj3?= =?us-ascii?Q?1PvoueK/XW0wbE1YxJ44o5JQVFubU64dhnU/JcWk8bL3VuiS/zRhtGxxa45h?= =?us-ascii?Q?LhTADbPSURYdqXYTRgjK3/xSFjDdzlYfE8GaxgR5gfVjzgNAcY3ib9sUI14a?= =?us-ascii?Q?Yi8EzTwYIO4wjbW8lNf4ZwxmpoAvUv6i66MWALtcgnYvTdCMhHGEfezSYqTR?= =?us-ascii?Q?6aQP3SlQIW7rqT566pol36f3AzD3zcbeeNSiB+F5KNA1koR2fwD/MP9LLFGo?= =?us-ascii?Q?rIFhmp6F39zgWKEu+1YfacduPhr+1NX5xAj904flaanE0KbkiMR9jGEhfWtt?= =?us-ascii?Q?uF1gUGZ7rLMzqpZavJ0w/0dKcoJaUbEv6HgJNSIY3Xvi5+41EAnZcsilgP0U?= =?us-ascii?Q?uMmMNC+rf+3PjnqctHYqUR2NTx4/m0QzD6Cuimefwba86oGBjEsgXc2af/zI?= =?us-ascii?Q?/pQwJ3bOyENk7Ofuiktsnad4gUr4yw2GX9MmmxK16zn+WKbuF5BogJRSSNW2?= =?us-ascii?Q?HDj4RMtgQ4r8yeJw/1Ra1F+umugGYg8V/NIVGGLw73B5dxHNPANG6zeJmbeF?= =?us-ascii?Q?yACvgrxPC5RLArrslCbG/Bbke2IF3dh264iHO4wit3qDQb6S1A=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:18.1418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e753bb60-41f3-4c60-4974-08dcf6f4b106 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7211 Content-Type: text/plain; charset="utf-8" From: Perry Yuan When `amd_hfi` driver is loaded, it will use PCCT subspace type 4 table to retrieve the shared memory address which contains the CPU core ranking table. This table includes a header that specifies the number of ranking data entries to be parsed and rank each CPU core with the Performance and Energy Efficiency capability as implemented by the CPU power management firmware. Once the table has been parsed, each CPU is assigned a ranking score within its class. Subsequently, when the scheduler selects cores, it chooses from the ranking list based on the assigned scores in each class, thereby ensuring the optimal selection of CPU cores according to their predefined classifications and priorities. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/hfi.c | 196 +++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index a92fe74b415e3..b5cfe20c11052 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -18,21 +18,73 @@ #include #include #include +#include #include +#include #include #include #include +#include +#include + +#include + +#include +#include =20 #define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HFI_MAILBOX_COUNT 1 +#define AMD_HETERO_RANKING_TABLE_VER 2 + #define AMD_HETERO_CPUID_27 0x80000027 + static struct platform_device *device; =20 +/** + * struct amd_shmem_info - Shared memory table for AMD HFI + * + * @header: The PCCT table header including signature, length flags and co= mmand. + * @version_number: Version number of the table + * @n_logical_processors: Number of logical processors + * @n_capabilities: Number of ranking dimensions (performance, efficiency= , etc) + * @table_update_context: Command being sent over the subspace + * @n_bitmaps: Number of 32-bit bitmaps to enumerate all the APIC IDs + * This is based on the maximum APIC ID enumerated in the system + * @reserved: 24 bit spare + * @table_data: Bit Map(s) of enabled logical processors + * Followed by the ranking data for each logical processor + */ +struct amd_shmem_info { + struct acpi_pcct_ext_pcc_shared_memory header; + u32 version_number :8, + n_logical_processors :8, + n_capabilities :8, + table_update_context :8; + u32 n_bitmaps :8, + reserved :24; + u32 table_data[]; +} __packed; + struct amd_hfi_data { const char *name; struct device *dev; struct mutex lock; + + /* PCCT table related*/ + struct pcc_mbox_chan *pcc_chan; + void __iomem *pcc_comm_addr; + struct acpi_subtable_header *pcct_entry; + struct amd_shmem_info *shmem; }; =20 +/** + * struct amd_hfi_classes - HFI class capabilities per CPU + * @perf: Performance capability + * @eff: Power efficiency capability + * + * Capabilities of a logical processor in the ranking table. These capabil= ities + * are unitless and specific to each HFI class. + */ struct amd_hfi_classes { u32 perf; u32 eff; @@ -41,23 +93,105 @@ struct amd_hfi_classes { /** * struct amd_hfi_cpuinfo - HFI workload class info per CPU * @cpu: cpu index + * @apic_id: apic id of the current cpu * @cpus: mask of cpus associated with amd_hfi_cpuinfo * @class_index: workload class ID index * @nr_class: max number of workload class supported + * @ipcc_scores: ipcc scores for each class * @amd_hfi_classes: current cpu workload class ranking data * * Parameters of a logical processor linked with hardware feedback class */ struct amd_hfi_cpuinfo { int cpu; + u32 apic_id; cpumask_var_t cpus; s16 class_index; u8 nr_class; + int *ipcc_scores; struct amd_hfi_classes *amd_hfi_classes; }; =20 static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) =3D {.class= _index =3D -1}; =20 +static int find_cpu_index_by_apicid(unsigned int target_apicid) +{ + int cpu_index; + + for_each_present_cpu(cpu_index) { + struct cpuinfo_x86 *info =3D &cpu_data(cpu_index); + + if (info->topo.apicid =3D=3D target_apicid) { + pr_debug("match APIC id %d for CPU index: %d\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 =3D + (struct acpi_pcct_ext_pcc_slave *)amd_hfi_data->pcct_entry; + void __iomem *pcc_comm_addr; + + pcc_comm_addr =3D acpi_os_ioremap(amd_hfi_data->pcc_chan->shmem_base_addr, + amd_hfi_data->pcc_chan->shmem_size); + if (!pcc_comm_addr) { + pr_err("failed to ioremap PCC common region mem\n"); + return -ENOMEM; + } + + memcpy_fromio(amd_hfi_data->shmem, pcc_comm_addr, pcct_ext->length); + iounmap(pcc_comm_addr); + + if (amd_hfi_data->shmem->header.signature !=3D PCC_SIGNATURE) { + pr_err("invalid signature in shared memory\n"); + return -EINVAL; + } + if (amd_hfi_data->shmem->version_number !=3D AMD_HETERO_RANKING_TABLE_VER= ) { + pr_err("invalid version %d\n", amd_hfi_data->shmem->version_number); + return -EINVAL; + } + + for (unsigned int i =3D 0; i < amd_hfi_data->shmem->n_bitmaps; i++) { + u32 bitmap =3D amd_hfi_data->shmem->table_data[i]; + + for (unsigned int j =3D 0; j < BITS_PER_TYPE(u32); j++) { + struct amd_hfi_cpuinfo *info; + int apic_id =3D i * BITS_PER_TYPE(u32) + j; + int cpu_index; + + if (!(bitmap & BIT(j))) + continue; + + cpu_index =3D find_cpu_index_by_apicid(apic_id); + if (cpu_index < 0) { + pr_warn("APIC ID %d not found\n", apic_id); + continue; + } + + info =3D per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + info->apic_id =3D apic_id; + + /* Fill the ranking data for each logical processor */ + info =3D per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + for (unsigned int k =3D 0; k < info->nr_class; k++) { + u32 *table =3D amd_hfi_data->shmem->table_data + + amd_hfi_data->shmem->n_bitmaps + + i * info->nr_class; + + info->amd_hfi_classes[k].eff =3D table[apic_id + 2 * k]; + info->amd_hfi_classes[k].perf =3D table[apic_id + 2 * k + 1]; + } + } + } + + return 0; +} + static int amd_hfi_alloc_class_data(struct platform_device *pdev) { struct amd_hfi_cpuinfo *hfi_cpuinfo; @@ -74,14 +208,19 @@ static int amd_hfi_alloc_class_data(struct platform_de= vice *pdev) =20 for_each_present_cpu(idx) { struct amd_hfi_classes *classes; + int *ipcc_scores; =20 classes =3D devm_kzalloc(dev, nr_class_id * sizeof(struct amd_hfi_classes), GFP_KERNEL); if (!classes) return -ENOMEM; + ipcc_scores =3D devm_kcalloc(dev, nr_class_id, sizeof(int), GFP_KERNEL); + if (!ipcc_scores) + return -ENOMEM; hfi_cpuinfo =3D per_cpu_ptr(&amd_hfi_cpuinfo, idx); hfi_cpuinfo->amd_hfi_classes =3D classes; + hfi_cpuinfo->ipcc_scores =3D ipcc_scores; hfi_cpuinfo->nr_class =3D nr_class_id; } =20 @@ -95,6 +234,59 @@ static void amd_hfi_remove(struct platform_device *pdev) mutex_destroy(&dev->lock); } =20 +static int amd_hfi_metadata_parser(struct platform_device *pdev, + struct amd_hfi_data *amd_hfi_data) +{ + struct acpi_pcct_ext_pcc_slave *pcct_ext; + struct acpi_subtable_header *pcct_entry; + struct mbox_chan *pcc_mbox_channels; + struct acpi_table_header *pcct_tbl; + struct pcc_mbox_chan *pcc_chan; + acpi_status status; + int ret; + + pcc_mbox_channels =3D devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_mbox_channels), GFP_KERNEL); + if (!pcc_mbox_channels) + return -ENOMEM; + + pcc_chan =3D devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_chan), GFP_KERNEL); + if (!pcc_chan) + return -ENOMEM; + + status =3D 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 =3D (struct acpi_subtable_header *) ( + (unsigned long)pcct_tbl + sizeof(struct acpi_table_pcct)); + + pcc_chan->mchan =3D &pcc_mbox_channels[0]; + + amd_hfi_data->pcc_chan =3D pcc_chan; + amd_hfi_data->pcct_entry =3D pcct_entry; + pcct_ext =3D (struct acpi_pcct_ext_pcc_slave *)pcct_entry; + + if (pcct_ext->length <=3D 0) + return -EINVAL; + + amd_hfi_data->shmem =3D devm_kzalloc(amd_hfi_data->dev, pcct_ext->length,= GFP_KERNEL); + if (!amd_hfi_data->shmem) + return -ENOMEM; + + pcc_chan->shmem_base_addr =3D pcct_ext->base_address; + pcc_chan->shmem_size =3D pcct_ext->length; + + /* parse the shared memory info from the pcct table */ + ret =3D amd_hfi_fill_metadata(amd_hfi_data); + + acpi_put_table(pcct_tbl); + + return ret; +} + static const struct acpi_device_id amd_hfi_platform_match[] =3D { { "AMDI0104", 0}, { } @@ -121,6 +313,10 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; =20 + ret =3D amd_hfi_metadata_parser(pdev, amd_hfi_data); + if (ret) + return ret; + return 0; } =20 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BD491917CD; Mon, 28 Oct 2024 02:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081006; cv=fail; b=pZl6zRbVEOrAgIb1fLPuf8+xH8wnyHlebW7J1UEPsifgsoJnB1FLgDcY5pUFzU+sf5atzH2ZUbIq8efDBCFJJKZ8wQhix/b673/c/eR3YM7vNOw08JttPEv4XJffOIM7FrKD5uY0rDIhWurx9jOApNqSefzDL5APVleugjui49E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081006; c=relaxed/simple; bh=itfXua4qpgG9+kXYjPNb/78er2v0xwR5No4sCxPP3y4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=at1xMNLNnsAte0Ae0diCe3OSYkDIcz/SmBlHhj3muTUkmS8NOXXc6eq/xvQwLCa9U70SLebzEcnfzBII/QoeDJqCNuFPU6gq8BQay4MR5zx09UZ/dTAyL/O/bojCtIMz46DEwx4FFsgPPXuJsFAbH+9KjvWdUUohqOtKGWqiWSM= 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=x5AA6tjA; arc=fail smtp.client-ip=40.107.92.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="x5AA6tjA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GasWYO5976EokZjVtDE6j3ebxxDg7AXwzyUjogIlJM5GyyQh11Q1o8uJ3eZ1EwIvJ2xYNCPhXMgPPHgzIUih05ayTWHDIXZpk003OcnNw18CwMXRRavEfWiaOjEhv4yVjlOGAeNLoUpdptQFbnxjolLnj5HFCCX348ahGibDyHrih16GZgjQW5jYuckTXVnTxOBMdqyjvfNFA63QqcrpNeofVqA/pVgALO341J7EOuj3wzYn9/nrkGfcPtgd0CUU70lKnPLG4p5pLz0ciRC9bJ8plpTFLYnhpMv7bDWCyXF4hU4y9k0Bw3PYRIZPIwsj2/MoDFdPkRlKog6xdA6nHg== 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=XR1buJWyFrgM7Z/t+E69AO2DjJlOxtWn+lX4bRidqPA=; b=HDc0FONWZpRn3ZfZr4t52TJR1OuC38NFSizroTvmBBgrk9aMOEMKZQdgyw4vAVk2+u/OP6/XRk19elx/B3Xk9WGsEFza6WEtQAytcZeWw/lgDXGPxIjXJFuUSUN+hsoVOM7s3O2NDjYw0ESSZWGwJJ2V0ctemPfKzeil5JpF02Age0DQpGD+lIJQWNlHnDiZCnPcvJ23Sbokbmx8f5f45hkayOhwWU49efTydvpWB4GrEIShPKac0ZfzXRg9sXTV6yr4pPCrt9TQv7j21lAfuE/a2XTCxlswSKt2OkmZktJC5zMx/O+gezV++3SDE8Da244WgqBXMVOxAmX8ddRD6A== 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=XR1buJWyFrgM7Z/t+E69AO2DjJlOxtWn+lX4bRidqPA=; b=x5AA6tjAU3ONmfcpcgQ+CTebUvDe86QBBcqkiHDwgZ/dWDNHgNSqVT5v5IqwRSwISvlZqB2q+9b7p3kq6YAf5v5ZvwBn5jVn14dIasLUYIVwCbzHpAKzZLwofJ4EjdCLuaNv40Zc9yENEAAwVX3Gk29WFxQoJEcp6AspJ7AY+1U= Received: from MN2PR06CA0026.namprd06.prod.outlook.com (2603:10b6:208:23d::31) by PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Mon, 28 Oct 2024 02:03:19 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::79) by MN2PR06CA0026.outlook.office365.com (2603:10b6:208:23d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:19 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:17 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v5 07/13] platform/x86: hfi: init per-cpu scores for each class Date: Sun, 27 Oct 2024 21:02:45 -0500 Message-ID: <20241028020251.8085-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|PH7PR12MB5712:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a9babae-8945-40a0-b929-08dcf6f4b197 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: =?us-ascii?Q?IWm6uTDCW6pM6nEw6IPc9yGKlbmqQyz2aCfWwdsjYMWR3QC5LX+SGf0eod4G?= =?us-ascii?Q?VZ+0MIhZNYJGrcZ7OgSVhmNnYtbSM+9Mj0giQUxvh33TDKUbQyUSi0jjATYL?= =?us-ascii?Q?Y1+dD6Dr3UU/Ubp35E47fkA0LodyxKmJfa51rYjLL16HwtLgGro3LU4tqZy0?= =?us-ascii?Q?linU+KFk8+HD2fIm2T1fv79T0A7QdkVXOUfnx9jJSBI5LPd49hUf8I/6vUMM?= =?us-ascii?Q?gwRFQT3LTf+zKECS24jgPQChkPHOvxmfHJOXAWJxrCQu5kb6Jq1pAMf51MOS?= =?us-ascii?Q?ncTWYlpmRsC210qR/nOy/ARcBCoOa7gVuvyOJoLXARXA1I9OlWed2ED8GUxi?= =?us-ascii?Q?9siLlhQY4P8fFu9ueAAozxgmtXRiQdIyxLP61xU6Of/VD+NFHZ/0pIMXjZiU?= =?us-ascii?Q?m69DQOBPgFIWWB7FfCFBZdfX3Kn3STtkV88JzDdpGrnKDyRx26TGzD1f03QX?= =?us-ascii?Q?udr87MfKl3mS+s2COajRMeS6HG3ykngayGT2OfyeXSdRHQFq/Z/shjMw3Nse?= =?us-ascii?Q?rIxXHkvrV7x9vMnvrbB+J+OCRGJFOGSgGgyCNFOhHT14pnN/9UUdDYNqPZ1m?= =?us-ascii?Q?4uHcUogfZsoC0NzqYMGt8cFVBF/9XiOD3XS22HyOjasg9V982jmlmctl0EGh?= =?us-ascii?Q?neeUuA9VUiMAXroQzBtLufRSVSwBA2EYd6I4QtoQIG6L9ZDClcoDLpRWA4Nt?= =?us-ascii?Q?cEZJHKouoLESr+cX2dksmVpNG+9Ool79Q2vOAtqNGlcix4A0AtNyuE5cXTh6?= =?us-ascii?Q?leujBhglyUYX1SxdBpEjMBkqAPUUVAQgnw3801VgZwpch/749z67KIbTNcZ1?= =?us-ascii?Q?9xL4jB5LAaQNyikWD6VbcCM6yWmuo26AR9dum8IsuZssAmgeqBU+W7ktp9aJ?= =?us-ascii?Q?tYCWlk5L+xa0P0YTo2b3uKtIfKDqUgdVG6NaHy67BJaIbt7QmN3QNIaZsEsb?= =?us-ascii?Q?563xOe00Vf64X7zF6OS9fmwdtaPv3vDkr5YW9nm80JuYgwFT5SOi+Pt081af?= =?us-ascii?Q?cxwuAB79SCh/Qd5Qh8ZsHChWMQ5cFOBrwrNakNLGGyfVz64bVnL3W3taJi4X?= =?us-ascii?Q?xx3R0h1Ghpw6ja3p44Xp057k5y6slI2WPaZLHOQWI8tw0hquI4K0MyWQcfN8?= =?us-ascii?Q?SJGYBGLpzmy4xFHk2V9uRQDe4aObJp4ISMH7BH0PJvuHY/0UzobSqa3YmS6X?= =?us-ascii?Q?tE4Oju72pLjd6aCIxBqSEHdGoAPN0fnYhNqXeME2EGROee10zNbjI4ezPAv0?= =?us-ascii?Q?X3K+Ymomym5fI2L+/LdWoYOjhdmWBtTFRRaFSTuR2E3RzXleBs9R24ssdmE0?= =?us-ascii?Q?UIMKfmaw4v1uZCjhVAxDP3tu6ARdSZ9t1cocpaLszCnNe/gbXlzm1K2UZ4VH?= =?us-ascii?Q?CHva/q2Vmed9LgtSTRX8UPE0Yk7dYLtU2/09piyXpRka7bSMEA=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:19.1106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a9babae-8945-40a0-b929-08dcf6f4b197 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5712 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Initialize per cpu score `amd_hfi_ipcc_scores` which store energy score and performance score data for each class. `Classic core` and `Dense core` are ranked according to those values as energy efficiency capability or performance capability. OS scheduler will pick cores from the ranking list on each class ID for the thread which provide the class id got from hardware feedback interface. 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 | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index b5cfe20c11052..986ea056fa022 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -114,6 +114,8 @@ struct amd_hfi_cpuinfo { =20 static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) =3D {.class= _index =3D -1}; =20 +static DEFINE_MUTEX(hfi_cpuinfo_lock); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -234,6 +236,31 @@ static void amd_hfi_remove(struct platform_device *pde= v) mutex_destroy(&dev->lock); } =20 +static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int= cpu) +{ + for (int i =3D 0; i < hfi_cpuinfo->nr_class; i++) + WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], + hfi_cpuinfo->amd_hfi_classes[i].perf); + + return 0; +} + +static int update_hfi_ipcc_scores(void) +{ + int cpu; + int ret; + + for_each_present_cpu(cpu) { + struct amd_hfi_cpuinfo *hfi_cpuinfo =3D per_cpu_ptr(&amd_hfi_cpuinfo, cp= u); + + ret =3D amd_set_hfi_ipcc_score(hfi_cpuinfo, cpu); + if (ret) + return ret; + } + + return 0; +} + static int amd_hfi_metadata_parser(struct platform_device *pdev, struct amd_hfi_data *amd_hfi_data) { @@ -317,6 +344,10 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; =20 + ret =3D update_hfi_ipcc_scores(); + if (ret) + return ret; + return 0; } =20 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2042.outbound.protection.outlook.com [40.107.93.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 70BCC1917D0; Mon, 28 Oct 2024 02:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081008; cv=fail; b=qz61zSVKJFAGbllNu3pakUqbWwLS+njpGQ5M0RMGq0edttwhhIQttBSp8v163IEEQs61WhYPl94klz6p4SlQ0Q4g25upwMWDaLtyfPiGNXkSocoR0/RGogLFzA7ImyzFyzHBHHMrY5n1sjyAfWpQBm4FjjGzjR6QfWX0ga2js2Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081008; c=relaxed/simple; bh=zpb+OFazQFWy0mli3lXH/uVjxCvkLhwWEoPjvmdqFDQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Bik1tykB0XHtQIQD6Yer1d4lZKtyIW79PC5GglWr/4AIJfGzy8P1RMz4MweEGderlkBomDFf7JAM9QDWCxqfjzaZMVJ0pMvN+kgZ2W0k9tUGJeTWfqtYh/l7aJh1yStLdMvxhr95MGsTWKky3cDAPryKL0lZreHJlpC6rhY/KHM= 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=0oY1Wol+; arc=fail smtp.client-ip=40.107.93.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="0oY1Wol+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GHvDjeZiGqFMo4Yvp+pPO9wZdeALgTfsETemvhKK9u8sTF8tnW5Tv0BoXzXi3qBwQ1FV2fclTRRJRweonLydw7znf2CmKmxa82UicNcWBtb669uj840roIf7K7QG3tDxFn/f5cRyL4Q2wi3G3eAuD4kz6InQhatq0eR0bRKe8uTwIAjOeVPCl382RCxN+s6rOcNCgUh7c4bYzn/JibhxNHQfokVEcDgqqt08CG05QnqtqbP8t4n72H6/2uIvvTDLvAkEYS1AbyJvRWkngpCdyeQJsSYzipnQMLhMb+0tVrkDllcuBCWQQZHbngys18y+rpFGEi7jdGNB68zf3L6osg== 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=h2kf9Qa/oE6NaY6EdyCmnrCJYVdPqE8ZhNILdRNWrxU=; b=FLkpmmqPtTQ88td5918syT36BN2LUcMkWfnpY/CdLfHEgKyl4r6PZ+7Oibd8JmehlYg89vnYMrp5oLsAfD32RP7m+4w7Zselj+WXyEUw267K1AMFrHXruLLc3tNL3vXM9+5zaDN2qpCmx1bBDvA4yBgGB+405Yce5hBKgfCGRXU7yNyWJ70BryQMtJbCnOccy++UvkaSQnl7GC3jE7xAR55TPD78HrJm36n0y9qYjjFV/SeVHLJPJKh2bq8P/dPTLRSQTak8ZTa6F8I0eViMxxCGql7RVJUyMgH7eoI2G7qbuDpWyX+86vte+zigjLBdcWBm93uWr67Ymt5TiqhWNQ== 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=h2kf9Qa/oE6NaY6EdyCmnrCJYVdPqE8ZhNILdRNWrxU=; b=0oY1Wol+5OiKQi+7GTuAHON0ChqcJZKzljSnHbg2jLjgY41gCrlb0u2FqH6jErSe0VNwMWK2dmfXSCSWlWcqMMCA0pEioagvx6rKiRh6+gBvuEZTklnOhs3hF9W/crft8S4R2FCWjzw8qIanCnf8PfkoFXm3OAvMDpjgKBTdr1k= Received: from MN2PR06CA0027.namprd06.prod.outlook.com (2603:10b6:208:23d::32) by MN2PR12MB4142.namprd12.prod.outlook.com (2603:10b6:208:1dd::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 02:03:21 +0000 Received: from BL02EPF00021F6F.namprd02.prod.outlook.com (2603:10b6:208:23d:cafe::5) by MN2PR06CA0027.outlook.office365.com (2603:10b6:208:23d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6F.mail.protection.outlook.com (10.167.249.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:20 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:18 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v5 08/13] platform/x86: hfi: add online and offline callback support Date: Sun, 27 Oct 2024 21:02:46 -0500 Message-ID: <20241028020251.8085-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6F:EE_|MN2PR12MB4142:EE_ X-MS-Office365-Filtering-Correlation-Id: 608e027b-aa68-41c2-7134-08dcf6f4b2b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?myRr2RyT+Fq9mSz2YIACjuGm+dGnc5mr3hgbNH3TzFFLMeGZiSaSJUiyQH3Z?= =?us-ascii?Q?jDtFRu++4gh1Np3dKEQFbkK62ICJpcsyN6daOr7pLWQfPfNBQgcwFwvGtQL/?= =?us-ascii?Q?yuSCTTZOBuR8M7eIuDCRbwg9EPXYim8GMkRzCD+YsEQMWA6eMRAoyFI+3iOL?= =?us-ascii?Q?hXFxH4CUylYiDd2TdaP+JGb08GrRq95D1qKpH34q2aEFcUihGv2tbn6e5KCS?= =?us-ascii?Q?SHcNOf2TUAScK9zX9GAXrznfPTiM+ZuEkiMayWqyRILHWonKht2Oq9TTvuq8?= =?us-ascii?Q?z/zeemOSa0/QF/UirLGKzdRcOeqmHq1U+681diF+4WmrsTxZot50jlgUvuQC?= =?us-ascii?Q?PzfSt6DZFv580tDJHqROV2en8P9uaceDjeBo+G733MJq8Q4ejHfyoNuuZ60O?= =?us-ascii?Q?8/LstQ/14amiKxx7igX+3gf+/67yBYJ5JwzSm/5lCNnbWast9Hx6qTl4RybK?= =?us-ascii?Q?8a7YQFGH41VVH80+sJdMSPEPpzCiqdNeheuI+SpgYERj1mhHxgPXYpsY6IjH?= =?us-ascii?Q?udYamSbPwPguxcZotrJOdydUyGQYmWykIoqG8IFMVvd2pLFuj+oECe5UhXZ5?= =?us-ascii?Q?UXpOszW2Z/ehRbAL/e9Guj+9WSyKZ/8bwIhzprnLR0QtlTRq3+lcq8FKpqwM?= =?us-ascii?Q?6GK7A9tdZhL0r+AziPtkpwtH6WaXa57yxk6moSS+1bilRIThFv5lMi26Dt4v?= =?us-ascii?Q?2GOx1BPJkou6/BvFHIIGSnRe1LA1jy+GDrbHCJosTzvojWjj8CfcncT4qmIU?= =?us-ascii?Q?PMWS5VkBnPDXilY36qnwK57qrPKRXpbrvF8TbfxGUKUP+Cx1kdrHv2xhRJmB?= =?us-ascii?Q?EULYJq7JWhwiOkkXQf0MtQVbovkkMOItFVtVOawYk3pIJhhsH2Qurt0puOqj?= =?us-ascii?Q?i/5yxsf+hph2JDE1MYAr+f4/CLyAE31WKgzg1UAFFK4YxVgTEumL8AXZHXom?= =?us-ascii?Q?ciCnR9VoApSONpCeVeaUkMFz6GQM7azHAZp7YzBjIFoNPndeSGtJksI/qOxB?= =?us-ascii?Q?0ZYWIYqR8izSBPE/2wFRvT/dMtdmw5TUbJwynTm/+HcZMsHxTOIXRY5RJsaJ?= =?us-ascii?Q?wm6lBIHZhLWtdvhgkXaUEoqzummHKMAG4uu84+Z/30dxWpsB1wMgRdeQC71v?= =?us-ascii?Q?DS4cFBb00jYnX8OSbjdFk1JLG56Vd3rGn9VYSy1CQ/ZVyOWlvhIoPdRMqJ7W?= =?us-ascii?Q?Ge07DoWzxeQhkxX1I0yvtxAUnSXb5TaNYgAhZIcp8B27AghGbYFq9EqoS5Q6?= =?us-ascii?Q?AiVglSY6Jn8Jhpt7yMgBh2vMKEBMQOMtT8U3j+2SMK4Li1ldZDJCbG94fqu3?= =?us-ascii?Q?QJ1HCbQDL5zoKkT5PtmyRiiuYzGgzUrnE/vTnur55tIaGPbUbbMdR4Gq3sB9?= =?us-ascii?Q?pBuqkxuky5vs5oaYifIZFQJ9yqn08JE1I1DDqtzCOUu5PiduPQ=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:20.9700 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 608e027b-aa68-41c2-7134-08dcf6f4b2b3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4142 Content-Type: text/plain; charset="utf-8" From: Perry Yuan There are some firmware parameters that need to be configured when a CPU core is brought online or offline. when CPU is online, it will initialize the workload classification parameters to CPU firmware which will trigger the workload class ID updating function. Once the CPU is going to offline, it will need to disable the workload classification function and clear the history. 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 | 79 ++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index 986ea056fa022..70ddde37f283f 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -245,6 +245,80 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuin= fo *hfi_cpuinfo, int cpu) return 0; } =20 +static int amd_hfi_set_state(unsigned int cpu, bool state) +{ + int ret; + + ret =3D wrmsrl_on_cpu(cpu, AMD_WORKLOAD_CLASS_CONFIG, state); + if (ret) + return ret; + + return wrmsrl_on_cpu(cpu, AMD_WORKLOAD_HRST, 0x1); +} + +/** + * amd_hfi_online() - Enable workload classification on @cpu + * @cpu: CPU in which the workload classification will be enabled + * + * Return: 0 on success, negative error code on failure + */ +static int amd_hfi_online(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info =3D per_cpu_ptr(&amd_hfi_cpuinfo, cpu); + struct amd_hfi_classes *hfi_classes; + int ret; + + if (WARN_ON_ONCE(!hfi_info)) + return -EINVAL; + + /* + * Check if @cpu as an associated, initialized and ranking data must be f= illed + */ + hfi_classes =3D hfi_info->amd_hfi_classes; + if (!hfi_classes) + 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 =3D 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 =3D &per_cpu(amd_hfi_cpuinfo, cpu); + int ret; + + if (WARN_ON_ONCE(!hfi_info)) + return -EINVAL; + + guard(mutex)(&hfi_cpuinfo_lock); + + ret =3D amd_hfi_set_state(cpu, false); + if (ret) + pr_err("WCT disable failed for CPU %d\n", cpu); + + free_cpumask_var(hfi_info->cpus); + + return ret; +} + static int update_hfi_ipcc_scores(void) { int cpu; @@ -348,6 +422,11 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; =20 + ret =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/amd_hfi:online", + amd_hfi_online, amd_hfi_offline); + if (ret < 0) + return ret; + return 0; } =20 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2050.outbound.protection.outlook.com [40.107.92.50]) (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 E423518B47D; Mon, 28 Oct 2024 02:03:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081010; cv=fail; b=rKmUDywladLICPEkzb0eJ37/FEZ6YwIsJCE4VxwMFLwKJ6EtDkqK2qxIrVbERiIzOFlYevNiDvfHiBTxLNx99LWQanmN+1IOJd7Q6ohRxe7WDkvHx4jLzkdH4M7Ay2rnSxDwmO76bI0w6iosAVT+RUs0mwBOrYijZDIfYsDMqKE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081010; c=relaxed/simple; bh=LNPjM+dPgjMNL75vlopqQfkr8adV7T737JOpjxZs+8w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZHe9w0CP59uuScnD2Ib3HtVFlve7UA1axQttSYHC/7XQLdJWUP7oYOv/TKUDNkEB7ISVJ8+HcApf7CPJE9jHXqg/EPr1JbaEmZEhpEKzWHIxmh8FQoSXACI7nWymnH8ZLRBBCIFLknMMPhaMeRqG9N6fiBKceSKFpNLIkp47Li0= 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=RWSgHfqT; arc=fail smtp.client-ip=40.107.92.50 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="RWSgHfqT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JoN+ZqzDlDTjNQIlpbppj77F9b5Z7pA35JV/Pj90DQ+u2R6sw2Xw4r16rwQJQBTYTJCKIZE8NWUn1m0TLLTHh06Amy6kdui2v83B26QBIsJU8tWgggF1fG4cx2goU35okA7WeOopR2EkTcl3TDRRzmm6BVpDxf7/5jiiiYFJTq3XSJurhCBA4eH1eCfNYIKlzzxYYTyxhzS55Scst/MDy5+cSbKGTPYT872dxpaeGbhBDWg8NTb8gmI7YOnnMrGdGXZl1YMR9VTZ03qN4TlpRCKw4vxZneGTlB31jYjCzEuB60aaaPVnQ7yJh2mACl9Nw9IH/eg0QlFHTHFDZ7W5ew== 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=haXGWBrAZ0fxfa3qxHK1ETSJPyswEvws5g3hvbtCKk4=; b=vXfixM5EuG2pQNNUyFGgMjEjo3eLkw+g1x2E9uFoIlBnV8m4KtYIOIE2n5nqHypFl1hzvvYFCdTX+L7wMNFNkEPLcX5zpYhgPhbt0mOvZ/P0ubBcA1c41iG/piEk1YCimofNeNx4yvefQZHOeVJg7LG2hZqStTZzNPCUxWXjcuzOWcSSNgjGlp+mdmJsb7cfmJMaJZ2Vh/Vfaz7GAtZS5isn72r7UOzfWS5Br8C9XPKpXby4ULzOkBPSolcggtxlBD7HdfEJFev7BrbK2gF6O4DCGHendwFPLJ/jwyYaOYZSV9go7gBhnXWcFxrfGEcPcyJCGHRKJHQ+ph9Oh/5Kvg== 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=haXGWBrAZ0fxfa3qxHK1ETSJPyswEvws5g3hvbtCKk4=; b=RWSgHfqTzzMQYGox9fi77J5WJG3bhPQ7Hm5ZWJgNX41srkeklr1JAwa8WvrszC/1Qe/OUEefVD2uPjKY+ENZSE729tcVZuXqOwQ8/JDS4v2UBhtcPe2uJtNBYHqpsLhHO2oijDiRs94KHdEkILIWU8m1rDaFx53dvRzSFvdD1LY= Received: from BN8PR12CA0011.namprd12.prod.outlook.com (2603:10b6:408:60::24) by SN7PR12MB7276.namprd12.prod.outlook.com (2603:10b6:806:2af::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:03:22 +0000 Received: from BL02EPF00021F6E.namprd02.prod.outlook.com (2603:10b6:408:60:cafe::8e) by BN8PR12CA0011.outlook.office365.com (2603:10b6:408:60::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:03:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6E.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:21 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:20 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v5 09/13] platform/x86: hfi: add power management callback Date: Sun, 27 Oct 2024 21:02:47 -0500 Message-ID: <20241028020251.8085-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6E:EE_|SN7PR12MB7276:EE_ X-MS-Office365-Filtering-Correlation-Id: d3b86400-e6ad-41c9-f066-08dcf6f4b338 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lTpeNeRyEUrvq+M1fTKtqZmOtWMLCQca2ETMmseEIL/oGQxXYGKQ6n6Sy88u?= =?us-ascii?Q?PXImfeK/6jJC0CBCKmQDkr5EV7ie/p1NDblN+OzwU8CtAT/0BxZ5nf33H2Dg?= =?us-ascii?Q?IrHNDYaVxwVAYgvegu41S8edbJHtnkmJRZr42MhKhRpIFOeKFulfpKJ60KTQ?= =?us-ascii?Q?J9pkMc8BA3N8+iVNX3yAChPc2B6Mm4/KQQvN6BShZK5FKF1TxMB2rTKqe/4t?= =?us-ascii?Q?sLEuhLA6iQ0oq5a7w4eUMh85gZfcfmapyEOQogn+AWYl+JMm1aJ0eJC9p4R+?= =?us-ascii?Q?n13fCnynkeGazRMwVEyviR2Esm4ZkFVXgPdzvAsWs2saW/IoTpC5DsgudAyT?= =?us-ascii?Q?NwbjFxZooOHPny97IQPZITv/mHahpA/gGEv0ptBV3ogwFvXA2j3seoS4RCGX?= =?us-ascii?Q?OH8hp8vmejudLMVFDBX1s9/d1DzCOdxH+FSsT4KMwDDWIE84nXVGOCQ8DNFM?= =?us-ascii?Q?5NtXWwed/TV9bdne/YuGYhR67VwKbmXuTvfbFw9QYtZgUXYwU9AdCjc4Wh7Q?= =?us-ascii?Q?s3k7c3vbOhjAvgBMBrJW6emPK/sb1rXTcOXkNWOqOyO5gF1oMMiIJMVqxAlW?= =?us-ascii?Q?+5+OEBDM6xi9Tc3c8iFB1JVN3KSO9oDevBd41Z0lPdxEfs3O8fC5kzodJuy7?= =?us-ascii?Q?Fx7qHihVn/y804OncvQHEGuTpYD/Ei3qORh8XLbvZW/Ny8pO8htCqpAuLbIy?= =?us-ascii?Q?z2JAHRYgDHEsqSYwHsJbHnfHaxO33bL8fAYh6HgYT3NPGg0fLxkCoPFBHbBT?= =?us-ascii?Q?8oKvQSG/StPAj+0KwF3wqJd+4ZtF35sLadVHLEQ7LdlJWirKGKNwLQc6QoG/?= =?us-ascii?Q?QUqHnGeiVfwuIVcEjwRMzRg8USbg4LsYvMTfp2e6PLD5QYBlC5mCXLP8Sufw?= =?us-ascii?Q?Jx7i3X4i2psp7/fBt3aIMunluSlndpJTKiWxy26OkUCHt9W7g5bJKLElC9JP?= =?us-ascii?Q?PTLFrOCz3Slftq3U8tJFdHdvc4nnzij9SwZ1qZsH4MOG28+OoDRCJhFvtYsF?= =?us-ascii?Q?tDgtJkqFo6jTIb62vL1UiShZ+MVw3i+/EXh02nhuAOjm97eiSWOv0e17/Eck?= =?us-ascii?Q?mct2koHONoPDg9p+k6UoIUS7Abof+v/h4yWe8V4djxjJkYwzjGbXEd2HRBS4?= =?us-ascii?Q?PKzBGnm3ag2UbCSHHfup3Welobv4pY8O6MIH8DSBL+43ThKXEupqHintxinb?= =?us-ascii?Q?KtlMQh93PoXFJCdny8FTav2TC9jsODtMdtUaGw/o3NkGRBsT86ZcU76HlesB?= =?us-ascii?Q?AFdnaC/eh/qVYR0JiGzhbl/FAlbpP+I/iXAM5qDmgT2oLfkSntlbY7aYwht0?= =?us-ascii?Q?Bns/LK5BEhx4rnWOlGrlrnykFXXS/TyN4ZVHCHNucf05sTlAd3wFjvtXa7xK?= =?us-ascii?Q?CjcxQM/dT4e5kcnD+0nLW+X1QYWfW1n2xK0vm++yWB2GEwhTQQ=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:21.8449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3b86400-e6ad-41c9-f066-08dcf6f4b338 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7276 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Introduces power management callbacks for the `amd_hfi` driver. Specifically, the `suspend` and `resume` callbacks have been added to handle the necessary operations during system low power states and wake-up. 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 70ddde37f283f..c8fe03d0c9ccd 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -388,6 +388,38 @@ static int amd_hfi_metadata_parser(struct platform_dev= ice *pdev, return ret; } =20 +static int amd_hfi_pm_resume(struct device *dev) +{ + int ret, cpu; + + for_each_online_cpu(cpu) { + ret =3D amd_hfi_set_state(cpu, true); + if (ret < 0) { + dev_err(dev, "failed to enable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static int amd_hfi_pm_suspend(struct device *dev) +{ + int ret, cpu; + + for_each_online_cpu(cpu) { + ret =3D amd_hfi_set_state(cpu, false); + if (ret < 0) { + dev_err(dev, "failed to disable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, amd_hfi_pm_suspend, amd_hf= i_pm_resume); + static const struct acpi_device_id amd_hfi_platform_match[] =3D { { "AMDI0104", 0}, { } @@ -434,6 +466,7 @@ static struct platform_driver amd_hfi_driver =3D { .driver =3D { .name =3D AMD_HFI_DRIVER, .owner =3D THIS_MODULE, + .pm =3D &amd_hfi_pm_ops, .acpi_match_table =3D ACPI_PTR(amd_hfi_platform_match), }, .probe =3D amd_hfi_probe, --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2058.outbound.protection.outlook.com [40.107.237.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A8B7192D8E; Mon, 28 Oct 2024 02:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081012; cv=fail; b=fVx6W3r+6WmKdbelMcjfUTi1mOLHrCJL5PHLV6/1bRqMZ9Vw/9Tq9YOebkVTajO7OwmFtIp7U6B7ffBfQwuzIpyOkShSCYwRGE3OjdjDB9OPoeQEOVqA+bpE2ss1V8qSmKTOubXYDhUWmeHLrNGZZBG2qjXWOropPoYdie0lCEc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081012; c=relaxed/simple; bh=WeiwuPFtV668DILjCh+jYeKXuUIMohMCdU2H/SIJEFI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FfI+uZeq2P5atvtlGUMta5jBpFRtTDVQg+sm5huCOnGBusK4GSISP7GKloGSjf4nW0c+jj017nnx1h6wFrLc8i4y0kORd3I3JgLj0qqq7sg+FhzWwtNpjY/JcbDGhlBWBFJOY2/xkZ+6u0JswHt0Gu5QAn8JGEO78Pg0Pnr+vIs= 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=kGRsZZdt; arc=fail smtp.client-ip=40.107.237.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="kGRsZZdt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XXzti22TsskghoMgmAMyM5RGwu2hAO0c6Ym1WdYcIcpMiMAERVRM2cRR6bWrbx3+nwCdJ1ZgjKLjmfeXZLhT0xnX+dAQJ9BCPnOKa5ywQsj566XhM+38JyPnfNQd3ONMRjZz0a5AsWLheNq1NOHamLUK4YpdInwB9VVPQhciOFFPXNlYiOSS+mxuNEk/JdU6WLLGNo006S1pzR2gbLWQ7cNzUf+w/hpI+Zds3jQfgY6AQ6UOyhrUIktxeRNCX/wtqW5g37ETUmS3SexNRStmmMrMmE5BIyncQ0lmbMaGIf4dfp68qA71IgcNAXp1N3MrB7XL459NHyax/b34+rHjgQ== 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=TrV2O76s3V5JeIAZkW21NWsWDkIGx4rTXtlK/PQ+zN0=; b=SFuY5Wk+l2TUuv3yV4YLeY6QOKCmsJWbaF7ZJOraOqBnuL3NWOUFU4TbASTqnGWpoMgdUdkGyWEfFrMGuLSZ4DzEZLqudmHi6qahig5ot5hGHDNjP5G4gl5FduYZdk0WkGeFLRtU4LDkqsrjB+PMw6DJicZUTjbx8h/md6IdPQxgSAN2tbwBZViXeNs/za8P4XxYCzKoMCvg9r7qYl7sew9mLYmEUmuKd3t92skP0kZOmQmLGC407KxWXjLdI8cSG1Ga4x23TbTDI3hloDsRHYwg8nixg95RI9UMB3yc6JHjwRp1haTUJL0HSV1bIbaQVyCvNi9kd7FmkhJveLq5qQ== 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=TrV2O76s3V5JeIAZkW21NWsWDkIGx4rTXtlK/PQ+zN0=; b=kGRsZZdtHmg3xkX2WkjklL6b6ECEofRI/NG6SssyaUbMVF+G1N1oDOHaxxpBivOYnH0qtNhEVyhZcLqg57NC+0G0YsAIR+CE271sLIz9H4hPFN7y5oAViaNP2c7xpXwrMutlAQKhf388ZadNqV4mi6pGMCzDocKCXXvL1YqVazo= Received: from BL1PR13CA0199.namprd13.prod.outlook.com (2603:10b6:208:2be::24) by DS7PR12MB6285.namprd12.prod.outlook.com (2603:10b6:8:96::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Mon, 28 Oct 2024 02:03:24 +0000 Received: from BL02EPF00021F6B.namprd02.prod.outlook.com (2603:10b6:208:2be:cafe::1b) by BL1PR13CA0199.outlook.office365.com (2603:10b6:208:2be::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.13 via Frontend Transport; Mon, 28 Oct 2024 02:03:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6B.mail.protection.outlook.com (10.167.249.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 02:03:23 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:21 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v5 10/13] x86/process: Clear hardware feedback history for AMD processors Date: Sun, 27 Oct 2024 21:02:48 -0500 Message-ID: <20241028020251.8085-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6B:EE_|DS7PR12MB6285:EE_ X-MS-Office365-Filtering-Correlation-Id: 23312e33-30d6-4dc2-c7c2-08dcf6f4b409 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?KOj7rhOc7Ix7ZqLUJw9ulkabjJkekFZeW7TSVHvAmSxPDWPuugmNFYgSXeaP?= =?us-ascii?Q?7yd80Mu4vSrAG8oeT9iz4OBL2CYDdq2bRVesWf56znEk4S3QstIVhPZt/iXl?= =?us-ascii?Q?EZmeWgE4TkCy06TOaN29AdzcgtXJ0bCtxo1Eh3sseMOko/YJQKUVyGr3AjIA?= =?us-ascii?Q?xV+3ubJNf5KJ3yP5VvImK6FaNj8BANgbjwXyTtm3p12uT5aAvFBTo4Q9ipLP?= =?us-ascii?Q?5z9lasWVeYx+yFGuNqMDA4KQXzyefeda9yzLURqiIpIs8csDDUVrLwo2T1er?= =?us-ascii?Q?YGEdRShH9sQYDjHct8z2XAxoDN7r6ihrwmqC0FLcjtPTpqfj44pn2XIIWaIa?= =?us-ascii?Q?8620/V1injUsCmNb/LvPrXN1Arwu6KykckYJ/uvQRlr4FBS02umBaZMYH0YW?= =?us-ascii?Q?8GqwKHDQLaY84O0xDC1/b/d6w5TAFWR7W/LdqB2EZ+yORcMaSFkX3zKadT5S?= =?us-ascii?Q?vdrwHx0oHnN3tiv/yPP5tdNqNvfCGEeH3yTOeZ7IxkTSkuSjQ40aUW3rKbL/?= =?us-ascii?Q?HGqPLyPaYeOiujoYwWApEPPSNtRpRItIdE5K4LzMoyLhMrm8tjL6QCi9nOSg?= =?us-ascii?Q?WPhwrfFZMkmiroU3KDf596g3KU4oRvFNd6Qm4kbvI6+/FA3N6VUyY4zbCt8w?= =?us-ascii?Q?mlkzqbZfJ7tLjmaL1wwCIcxXGIuF6zTjhlFo4NNDEPujrpaFJKjgn2r7hr3H?= =?us-ascii?Q?rNnNyNoxXl+2PVImKx2wOdenqG7oHXGCXRmfNvLkGWKmUi8SUMPy6XeE9e5M?= =?us-ascii?Q?coowGcZqfsVf0uzhkVCsDRk7/7TNFm6koJTQj35zoCePMJQn2I6ey2R5HkAa?= =?us-ascii?Q?3ggOV0rK+FdGVsj6bs+HsM7CvZNuNjXQR71guU9vnd0SK6qKpCnFOraXfNrm?= =?us-ascii?Q?O+cDQSfvv47K5Nto9vlMj8wkrAxYO/LTiWsrreRtoOeyNBJfN5PhjC/4UJPc?= =?us-ascii?Q?rSwM1ZivuNdLSafiE8Lvg2IhUYo8TYSElfPQnBPVdQzme8sajoRZHkjpQWIw?= =?us-ascii?Q?o1RwKC254u1Bh/r6nXTUsL/sX5pXArRHviwLJYQhFJkT8IwNX/23v9WxFYjo?= =?us-ascii?Q?duSNPc/BGYcHgIG/k1Iw4YNlbHmHad2egEadGoPuLtIK9HX4vDHBPlTXx4oT?= =?us-ascii?Q?H1KaSd9AY332mtxsw2bGzjtn+tqNldF+vfyD8V4lT1WQznA8A1C85+3TRC8r?= =?us-ascii?Q?//1YXbbz9B2o+o5thkpNsOnXw3w2dvTLrYzRlKJk+JvpCoKGS2WKtLLSusvn?= =?us-ascii?Q?TOnvz9ljAkeABXNtrlPS1Nv/UetCVgdn0FKyfq5n8wtUuBLf9eya38nxuKX5?= =?us-ascii?Q?g77ySDTTw5ztA+hECfEOyL6KBYRHNQCYmrIC8pMw7fg2yRiKrlMb5FPC+TRl?= =?us-ascii?Q?0svHnCJxuu8VndoUaQV/ACSAbrRSCCfZvhiiRrwgKShSw/x6Xw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:23.2135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23312e33-30d6-4dc2-c7c2-08dcf6f4b409 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6285 Content-Type: text/plain; charset="utf-8" From: Perry Yuan Incorporate a mechanism within the context switching code to reset the hardware history for AMD processors. Specifically, when a task is switched in, the class ID was read and reset the hardware workload classification history of CPU firmware and then it start to trigger workload classification for the next running thread. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- arch/x86/include/asm/hreset.h | 6 ++++++ arch/x86/kernel/cpu/common.c | 15 +++++++++++++++ arch/x86/kernel/process_32.c | 3 +++ arch/x86/kernel/process_64.c | 3 +++ 4 files changed, 27 insertions(+) create mode 100644 arch/x86/include/asm/hreset.h diff --git a/arch/x86/include/asm/hreset.h b/arch/x86/include/asm/hreset.h new file mode 100644 index 0000000000000..ae1f72602bbd0 --- /dev/null +++ b/arch/x86/include/asm/hreset.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_HRESET_H + +void reset_hardware_history_hetero(void); + +#endif /* _ASM_X86_HRESET_H */ diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 07a34d7235057..ed99b5c88ff7e 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -403,6 +404,7 @@ static const unsigned long cr4_pinned_mask =3D X86_CR4_= SMEP | X86_CR4_SMAP | X86_C X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED; static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); static unsigned long cr4_pinned_bits __ro_after_init; +static DEFINE_STATIC_KEY_FALSE_RO(hardware_history_features); =20 void native_write_cr0(unsigned long val) { @@ -481,6 +483,12 @@ void cr4_init(void) this_cpu_write(cpu_tlbstate.cr4, cr4); } =20 +static void __init setup_hreset(struct cpuinfo_x86 *c) +{ + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) + static_key_enable_cpuslocked(&hardware_history_features.key); +} + /* * Once CPU feature detection is finished (and boot params have been * parsed), record any of the sensitive CR bits that are set, and @@ -1951,6 +1959,7 @@ static __init void identify_boot_cpu(void) tsx_init(); tdx_init(); lkgs_init(); + setup_hreset(&boot_cpu_data); } =20 void identify_secondary_cpu(struct cpuinfo_x86 *c) @@ -2410,3 +2419,9 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +__always_inline void reset_hardware_history_hetero(void) +{ + if (static_branch_unlikely(&hardware_history_features)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); +} diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 0917c7f25720b..6a3a1339f7a77 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -52,6 +52,7 @@ #include #include #include +#include #include =20 #include "process.h" @@ -213,6 +214,8 @@ __switch_to(struct task_struct *prev_p, struct task_str= uct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); =20 + reset_hardware_history_hetero(); + return prev_p; } =20 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 226472332a70d..ea7f765c6262a 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -709,6 +710,8 @@ __switch_to(struct task_struct *prev_p, struct task_str= uct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); =20 + reset_hardware_history_hetero(); + return prev_p; } =20 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2049.outbound.protection.outlook.com [40.107.92.49]) (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 D6CAD18B48B; Mon, 28 Oct 2024 02:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081012; cv=fail; b=Pf0tJdFsMobYzZVqEYFf0HIYERAxVhwSFSdViKSXZOYEH42/36Z45HqWRaGKBBBqIix6ggz+foef2vQGXwjeGrxKR8/VFLLCVg+ILBQU81zqq3GOsMSyMAz3hqeHexSi3wwtbHNjKrfrO2l1ZtnorMkL9qe1SMSaSpp/IGLN++4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081012; c=relaxed/simple; bh=xZ+taCNTZ1jgDGLVgjCIOEWuzKCw56wtp5UZIjT6bQE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lxvjO5HWVyc+Pm7/sZiJ0TByPNS6EOHNBhFpEMoQ6vpBdQ3Z25cuicT4Uov47yOUI1CgJ7oKs2cWLh3uzmdk/8QrA1fhuqUdaLf5H5XokcgMrJDF6RNWIIUntFtJeqdopXyiS7VFbbJICwKluGzJH/uxmlZZ/fxj9WM22TLuP38= 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=aHM7gIxB; arc=fail smtp.client-ip=40.107.92.49 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="aHM7gIxB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MR/mTWv1cptAvvTiGSG7qUnLBj5+VVzMGPPF/3XmdZMkYdsW44fvCS1odmsD+fdQNUEaTkWxATb8KR8XkuCxMOYa2ROWZTsrqj/IW90kpHGSfgOwevnCZb8s/qBNjC6+U44yAAHrUXZZL989l8jqpH7l+PayFXUqNXwgAz+RozY1W9DVbdF7IrVJrthmNb/JxLrw5vfoiaIt8M/8HVjcMHv066RfjcmSenzvSV1xSl0u75jAZkyHxQFBgdIbwUUtqXCO1gO3cX3sdHTLDKgN0N5qOfh95sRnuee01qmejLiGISvh9MnzUKEhqc3hpdh2qJrABeKHNLocBLaN3opKKg== 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=AqyRdFVe1qkJ5+RpqpDLFm+LOL0dGKpfbdD5yvEaZJY=; b=tA6ldSvkvOkkxvC2XVxmr6qg73V9Zsw9yIs7rPnYXp/qIydyV8k6maIBKjGypTiJHMB5cf4Z48vL7rNW+v13dW8bkxcK+E8sLKK1WJ5BiGeFkRLuV+eiLncZ2bWP0vhF+9kJrhlSyjmZl3Rf3jtRWD9HnJV67I+5MBoPV6F/9oPiIrgbkO1vlXt3UUoUBrqZzzPF3woIm0W0HGv3VkfxBsH/6wHOF01hA+MDlcetcLa1K0OHGqQJeOfbaciF+xbrGzBdRZADJHzyo1eljPZSuL8h4mJz1hbuVChtc+6BJqYPFZq+IDLg3k9ruWNj9D7OXrx4Oz7ufL99GYu7I+NVtA== 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=AqyRdFVe1qkJ5+RpqpDLFm+LOL0dGKpfbdD5yvEaZJY=; b=aHM7gIxB2nJXeJZAc9xqqYrNDxN1nFcvE5xgQW7MgZSYDeJhzF0gl6b/kuKZDECutjMZsBdOAsagKnzdHpATs+rqWfgn6gn+OP2trUbI71l5Llrkb2356KLHNqpkNqv3ODmLIvnXRyhg4LsXogJJ2wKufpypzmve0vMSfW5VAM0= Received: from BL1PR13CA0184.namprd13.prod.outlook.com (2603:10b6:208:2be::9) by PH0PR12MB7010.namprd12.prod.outlook.com (2603:10b6:510:21c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Mon, 28 Oct 2024 02:03:25 +0000 Received: from BL02EPF00021F6B.namprd02.prod.outlook.com (2603:10b6:208:2be:cafe::ef) by BL1PR13CA0184.outlook.office365.com (2603:10b6:208:2be::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.13 via Frontend Transport; Mon, 28 Oct 2024 02:03:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F6B.mail.protection.outlook.com (10.167.249.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 02:03:24 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:22 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v5 11/13] cpufreq/amd-pstate: Disable preferred cores on designs with workload classification Date: Sun, 27 Oct 2024 21:02:49 -0500 Message-ID: <20241028020251.8085-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6B:EE_|PH0PR12MB7010:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f534a9a-f145-413a-9674-08dcf6f4b4db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?vT1MXzHkWmor+pWqGGZWfIerLGGikuccs5+5hrRiQO549H1WD7krVT+SpVte?= =?us-ascii?Q?npBh5RSMNe7XlJOiXjaQ/LyOoRsFgNtDzzY7EDiekXDaePjEMPfpCvoQusH9?= =?us-ascii?Q?ieHg+OGbLo+IjYBrVS4xkBRdZckRxf+zrTOlFAkPN68ETKV1xcXl2e/z8u5k?= =?us-ascii?Q?bYPXGPmau0jnNWX//Wzapwz1HzcCGLIi3ahhERnhzHzT87FiTjwAFtkt9jJw?= =?us-ascii?Q?HEbMJJBZe/ri0hORacEm4DFimfvbjKz3ySbCmNGaFfBT6flcRJtww/ALM6et?= =?us-ascii?Q?q/I5TSGyTXwImaD1nD4bFT595CGLaDO9YwKaZEX1kU2W7z4VjhdKDmWtWVa5?= =?us-ascii?Q?n/vHaV8TGln0h5Qeye3DRTk5SETapGFilDgfGiMoujqU+XTZ/UrxHfGDh+Ir?= =?us-ascii?Q?r+6k1Bbof/qRYhC8KgEHq/4NMSDc3+BmoCfHKU7xZxox8mPtTU+1Je4xmb3t?= =?us-ascii?Q?0baPwcrTyQrOrSvDtBjLs30lqwBSXElJvPxChJHVEPPUqeP7l2bRU6zejlTW?= =?us-ascii?Q?8MoWPTPo2tHNTnbWEehCpTwEPJ0eG/XtwqM406chCAwmKz/r9v3hBfBEptPi?= =?us-ascii?Q?OVwOUQ9xs/ib9zC9vSo52oyQxPv8a0S5uQPdK9GI35g1DB8w9iQb59maj24/?= =?us-ascii?Q?7F3NOBPvsqxRKqKd9G17OuYLNTQoIqC8BfExhKb2+SQw6xZxKsWWk9r++EsM?= =?us-ascii?Q?wIyhbiKfCW9ORzwTpLx05rRLa1IciSCYIWoAFUD/wKZ9Ui3WeCQJkzuTdnWG?= =?us-ascii?Q?1+Zqo7ukO/bSPDqx+e7C20Y5mfPm+rr1fF6oNWHF73EzLCsdogJp/HNfuu4M?= =?us-ascii?Q?Crfd1HMcqfbSqvRRbc7P/7/Y0Iubjx6ZGzNLUg1wdgEVtwyGOzsD1jEVIz6w?= =?us-ascii?Q?pbUGE4wRnqchLNwTezfV/9/Z8bGJ2LlIMAIfQzVcG1pWi7n6qX3wjlAIrA6V?= =?us-ascii?Q?bUahQMkSxidy36UQZ22lUhrAwTRWW8i5/YnnnP4JfS07ozgydIAcxTCV+unZ?= =?us-ascii?Q?QFik3yfDPzsqAzbvqhDt+wsPjY5eJozSgMwpCEt0w5poOdfrgojhojiCgt6d?= =?us-ascii?Q?/GpEIQ3fDRIIgvWXMJmOxmBC7xvIZsb8oYSCpDdsDnc/QOmWXoKtISUAjQck?= =?us-ascii?Q?tkjj99zx7jd/CsPPDU1lBN9En1QgK8BYeApBPFC6vudAnB4WhIYxgtoO903J?= =?us-ascii?Q?FTsMuA49Tv/eca8hPVYEUWX/DnjW5dfS/xx0BP8pCTk6dB++h7amXSOqRZvA?= =?us-ascii?Q?1lVxK2MlASoNo+BK4RfMyjd1a8BLiclERG5x9OTqCJD69Zo378E8RzJlpKDh?= =?us-ascii?Q?uWhwtalMJF1BaYPpJvX93GVIJCTdaL3AqhWKvFzS0mV/3ajXiO0Ooz17paf7?= =?us-ascii?Q?5o5fPG5quRNVeizXyUq4Gr+LeB4gnZTZLtzQxjiXGdmXbBwG3w=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:24.5729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f534a9a-f145-413a-9674-08dcf6f4b4db X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7010 Content-Type: text/plain; charset="utf-8" On designs that have workload classification, it's preferred that the amd-hfi driver is used to provide hints to the scheduler of which cores to use instead of the amd-pstate driver. Reviewed-by: Gautham R. Shenoy 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 32ddbf37a9f0a..c60cc84866982 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -780,6 +780,12 @@ static void amd_pstate_init_prefcore(struct amd_cpudat= a *cpudata) /* user disabled or not detected */ if (!amd_pstate_prefcore) return; + /* should use amd-hfi instead */ + if (boot_cpu_has(X86_FEATURE_AMD_WORKLOAD_CLASS) && + IS_ENABLED(CONFIG_AMD_HFI)) { + amd_pstate_prefcore =3D false; + return; + } =20 cpudata->hw_prefcore =3D true; =20 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2069.outbound.protection.outlook.com [40.107.96.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D99061CC882; Mon, 28 Oct 2024 02:03:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081014; cv=fail; b=Re2U9qFqQSJVGIm80CalOlfNeNfy8GhtL5WMkmcrDDX3Bp9FNFKTOFkJqegLWwX0D5h8Rcrx8WEy5ut9gafrEbTzwRU9IPAtw8YZPIBscOqRE2z8Wi9fZPWQHLhzm8vhp0WSrvgJ4yQVbrTES7AWvP2fdNRazfx/uz5GYxdLU2A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081014; c=relaxed/simple; bh=v20A+qYcbUcJYDh1KpTP4gkfDSx1jIxGDQLp4XRswGw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l5H5u04Bi5uLv4jhi1iolGw5m0ovgfQ4mLu6Fqn3nYaGiDz6hSCxguaZrbhCIUuIs5iOI5nBlMFVts5UO4kfCdbWiSOd+Goo/N6QLg+yLng4h8W5S0CslMNksfCPAScEo/Gcf4Xvi0Vr1IA2FK9NI8F5RF+RaErG3eK+LuPiLB0= 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=n0NJvWHJ; arc=fail smtp.client-ip=40.107.96.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="n0NJvWHJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fiuYT9ipNrFWYLkD3KkgHZpL2bmKIhnRc3Yb2QSI3zpHO6ZgpwHpRKLyh3ZppqG+Y61Qu+rpY8SvDWTIaEhPt5YNtqPGlzQbjjJ1H3E5ygHpjP4VbhUx4rwrplR4Yp74MaljriKiJXDH4G5AjKKNGmFLn87IVESt+kThC4CGBzJjaNZkAUbUKg1KZ8+ohi3J1CXqAzdD7WYNskTs3KVGbSkBBVqgqT67OjU5UWHGwdNnH6WVvpHLw/gNtrtD1rqnYr8wGfD1gr+UMtiXoW3XYGQ+lz9sgnY0W/RybAps5x52G4vHkmBKrmPJKTnB3hBh77bZjkdO1+Pv7ysypFhWZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kxV7Q56HF37N215gSoJzMyoaTl4ZgHOlFr7GHMSiEq4=; b=i0aJhvOVyN05lbMqV5GK+V7WL/1XXDC7jDSXikCy/SiHxvoEOquh9wB4traBoUXBlTDUd38mel9zoDSqOFtcXlQRUzj41TeP2QRQZZgw1xTUK3DwpT3b7aLzj5xb/aKzsCe8cf3yShDQoj3vzFmfMfduBmpjpIQffw7SUVIbVm8u0PYqB+0Ze+9rlBFYdBREd3qTRGSndqaJBIBKyKUR9yyV+H3tuS6ECji51rNafI1IQxraLVCI/dtfHxkPA/FUwR0ky3/Hp7aeEOQdHZHYIVOLBCXeVlXP4cyySM5xQBTCC/arIaILs8Jlb0SKWx77iGDSTI/fk03hv0lVsLBUFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kxV7Q56HF37N215gSoJzMyoaTl4ZgHOlFr7GHMSiEq4=; b=n0NJvWHJyYao4WR4kJvrrhVP5Mq3+eiOBhiq48Qqj+x2VI7QGSx7ASNbi71opUPllNPFuPGeTTvPHZqf4QThFgaHBpwapWma2eBZFo66SYQCMDzWPKhHpyEc7g2M1645Zq79qoqBdlUDF4cgvBRJe9P1BZsSI62fT8S0AY0Y3MU= Received: from BN9PR03CA0921.namprd03.prod.outlook.com (2603:10b6:408:107::26) by PH0PR12MB8774.namprd12.prod.outlook.com (2603:10b6:510:28e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 02:03:26 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:408:107:cafe::27) by BN9PR03CA0921.outlook.office365.com (2603:10b6:408:107::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Mon, 28 Oct 2024 02:03:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:25 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:24 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v5 12/13] platform/x86/amd: hfi: Set ITMT priority from ranking data Date: Sun, 27 Oct 2024 21:02:50 -0500 Message-ID: <20241028020251.8085-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|PH0PR12MB8774:EE_ X-MS-Office365-Filtering-Correlation-Id: ad50181d-bb6b-46c5-8775-08dcf6f4b59c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?pz4QFsU9id0eGHjmOUFO2G3HNCmWd05oYIt6QWCN2KTJDup8QfLG7t+lekoe?= =?us-ascii?Q?yJYe13CF7MgNckq+k0661TnlRijfmXbRGkVippz+rWkeKb9wtmxHuesweSEd?= =?us-ascii?Q?G4GyjN31Tuzi7gLneiZp3+ZF++RKonw0i81zZ8amYwuemc4QfboaIh8O/gp7?= =?us-ascii?Q?NwHp4KWOTY5JmquQRjEOziAcq4f45PUVcs7zXekP05AMTG1rGhGe5dDUlP4d?= =?us-ascii?Q?L9EOPjBGa2HpL++wlKJe6NIl+UkAuLYo2EZSyKA7yVH5ZpAw2uqJDcJIJieo?= =?us-ascii?Q?/bsVusnoMW+garIzIvCmjG4k7xXqIcGspBbWNEkJBwIl7CzzTi4orev8WcvF?= =?us-ascii?Q?BFP9IeRleU4fDXSurZSgdOz+xTZdiKCE2QqdhfdktZMOisRivw7gedfpQvhw?= =?us-ascii?Q?wz165WCTYXcHmbGMs6YOBWXWzvp06EOIsY2GgYNBQ6+ewDWBBMzEHeQeUF7v?= =?us-ascii?Q?kfjfcz2xqTJxPzInWtsIvDCMQ7jC/suzgT8rCdJWZ2kNm+HlGHME+Czjk4CL?= =?us-ascii?Q?Xgq61CvAtZWNGkcuoTmoG8Ba3MjNXUH2bZwvxjVWL7curzEb5zRvhL3p0yj8?= =?us-ascii?Q?raCHjkZEIdrXN0ZfM3mQ8YAS9m2NXbblYtXapbLTWUkOB+C3BPqqO8hxUXkv?= =?us-ascii?Q?DHOi/Ypf5qMif80DvOC6n/xdKjJKMWym66dJ71rGQCUOoiDDf0i8YN2uIyQY?= =?us-ascii?Q?j8LOQHKJ/ePjdCAPCapWWKLV+CpXamGEP2eC9prLVxK7NuwDKuf1LkGYUrq1?= =?us-ascii?Q?6dkoR2l1DX5bIs1krPw1g7b9eHwP9xHGGMSG+RFq5wWiZFGQJ1EtGPG8mr+s?= =?us-ascii?Q?n4u8qctd5qly+Bvr9EzKJrRUNzwrvY1hZylVQkfDPhcfLCkABSvglgtuZQkz?= =?us-ascii?Q?TqVYNgWZysFZsNlk8eeE/C/qJsxR9QwrT2E8qaZzJURv2kggQ0cohxSaayXN?= =?us-ascii?Q?3YybriUO0whUfdIxtP0XsDLrzat6EyCXRBK7710SDJOpm5aEIKJ/JO/+Qn3j?= =?us-ascii?Q?PfZwDz8FgSDCSdj+Sqwzm5hid+lmaR4O73pm9QhvVfShsi47fYQy/ZlX5jvX?= =?us-ascii?Q?AFM0gJV5wFWzOzDHq0xSKmWIbrxNDeAiUPHuRRvh0/S0URTGeXa/j+FBN9o6?= =?us-ascii?Q?rJzr2BnS7czRzI7SiZg/D/nzh7XnXiGORcrhjnC9bBRWOLi+Ibtq/LjHtfr6?= =?us-ascii?Q?eJpPGyWEIsXvdI+ezyss/bstry4EVucTAppJbODsq6W890TmxEhwd70j9Ps9?= =?us-ascii?Q?OqbTsqdZX7QPYY0I4X6miibZDcIs2yNQJBkc3HcqeKA469x9f9leOnbox3Mj?= =?us-ascii?Q?jEfHr5swD8I8Suow0AHc8T3EdjI6FMURgV+sMaoGSbClHShElOv6h8u6PHPv?= =?us-ascii?Q?/WvWMSaMJky9cxDgb/6HXuuzLglR4Z74dt1Cd3ZPzbX9iDkSeg=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:25.8530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad50181d-bb6b-46c5-8775-08dcf6f4b59c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8774 Content-Type: text/plain; charset="utf-8" The static ranking data that is read at module load should be used to set up the priorities for the cores relative to the performance values. Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/Kconfig | 1 + drivers/platform/x86/amd/hfi/hfi.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/am= d/hfi/Kconfig index 08051cd4f74db..4dfa7641b35bf 100644 --- a/drivers/platform/x86/amd/hfi/Kconfig +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -7,6 +7,7 @@ config AMD_HFI bool "AMD Hetero Core Hardware Feedback Driver" depends on ACPI depends on CPU_SUP_AMD + depends on SCHED_MC_PRIO help Select this option to enable the AMD Heterogeneous Core Hardware Feedbac= k Interface. If selected, hardware provides runtime thread classification guidance to th= e operating system diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index c8fe03d0c9ccd..50407ab805169 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -116,6 +116,12 @@ static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_= cpuinfo) =3D {.class_index =3D =20 static DEFINE_MUTEX(hfi_cpuinfo_lock); =20 +static void amd_hfi_sched_itmt_work(struct work_struct *work) +{ + sched_set_itmt_support(); +} +static DECLARE_WORK(sched_amd_hfi_itmt_work, amd_hfi_sched_itmt_work); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -242,6 +248,8 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinf= o *hfi_cpuinfo, int cpu) WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], hfi_cpuinfo->amd_hfi_classes[i].perf); =20 + sched_set_itmt_core_prio(hfi_cpuinfo->ipcc_scores[0], cpu); + return 0; } =20 @@ -459,6 +467,8 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret < 0) return ret; =20 + schedule_work(&sched_amd_hfi_itmt_work); + return 0; } =20 --=20 2.43.0 From nobody Mon Nov 25 12:44:55 2024 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2042.outbound.protection.outlook.com [40.107.236.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 8002E1CB9E0; Mon, 28 Oct 2024 02:03:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081014; cv=fail; b=Nr2kZLLKWnFrBQvyDyH+n3yFFBUIqq3ibURMxbVzmWnMB2OmZxApgP/jy95EYLlNoEguAui68cggcIrw//+VCyDQNuq0bAFnBXRr8sVFwEiWQiIN3ZvqrAlbZs3VTIivypmBfzqGL7j4/frqsYuMWBZvJd/mqkKq8x+XgPYn7Sk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730081014; c=relaxed/simple; bh=umJJHqwuOCy6C8LmcO5UOXfq97Xmp4VOdH1D5BZmT2M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CzIsAMmXxfrfzdFc+RtYX0xltRfy1EwIaBlC4YDzpd+9mlVAFW1bCORrPrho24EUvpIyGZp6hX/flheRMi5Et36B8o2pjuXT3/TP9d8bgRg8RgHyAEdqooCbXGPhhRAFG4bWUGh3JgJaiNVtqudPMF1NafTX/z+ueS3Y5+AwhF8= 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=TFS+2WK6; arc=fail smtp.client-ip=40.107.236.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="TFS+2WK6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YKxoxp8gyHbo6Avz/Bvoe6XcHnKrtu4NSVgieE6U+qyUamdQ2ehgSX/NYpfcStvoNyMLAxNdNWQhyWxfQpDKrjDVgBSvty5fO8QoTOI4mqKqockWyBRj3+IJSB5Yp96KEYVqUVIzOFk/yRDGccWh1DeTS9+LI7OmNly6T2AznWSISspSEIj8uD3zN4cSVoq+dmQBtlJh5sqkXR/Nwg4LTXASW0ufdmu2434QmxbslAc20XBBfYYDZhqPreNfkOIhV4C6AS2BUCcuGcVB/e05/9OGOrEe2VuSjTrFSGuGRmm0d4LtmCvyVR6wDHkxe5iMCUsfMgRMsbMfRX5AnOzovA== 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=WYZyAnPuYdwR7uSDv5rn0zv/+3aE44TMIWo6CoVMgtc=; b=tNAK2+Hlgb1mxHHDqg29qUYJITbSlXYbEcZlSPicJEXTfhBSBgf8nWizM/KSHqACKchG+79iLhDjtfIa1pLzUs1LsoA3ZNEup2ZNZOoJDdHOTyN6mO/ptiiutkIy+5Ci49bx/FLp9AOdqjrrzVqNlWlr4Me+rWCM7Jwz/cuN8zNnfu+TvqTUKGPzNHJ/q+HRcFgPw3Y1+AChEpW1I21R3c/bjaXuMUkDvpIrRRo4gqWnwyodzADpc17skf9ovH2H55B1RXf13kqYqgfy5AAO7npQGlHbDQwUG/cVJX/bL6ddiPFhBOLOYCt/RT4Wx8dE1uoBuVA4Nq4QhX6bFVP4Og== 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=WYZyAnPuYdwR7uSDv5rn0zv/+3aE44TMIWo6CoVMgtc=; b=TFS+2WK63scMWp6SHEBLRZXJ6Ni6XF66ko9ajRd4/HY9II3DBW06uJmkIC6kIChK4s8njl0KZeSbzTTwc8GCX9kyWwpIunLN1jBtXmVeZgJ0c0A4lmgnEEEtFK78KQd9YN/BX9iLgHxXQnhzwbpGqTqCcomLUAgP3F0cuehUbdc= Received: from BN9PR03CA0905.namprd03.prod.outlook.com (2603:10b6:408:107::10) by CH3PR12MB7546.namprd12.prod.outlook.com (2603:10b6:610:149::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:03:27 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:408:107:cafe::1d) by BN9PR03CA0905.outlook.office365.com (2603:10b6:408:107::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Mon, 28 Oct 2024 02:03:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:03:27 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:03:25 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v5 13/13] platform/x86/amd: hfi: Add debugfs support Date: Sun, 27 Oct 2024 21:02:51 -0500 Message-ID: <20241028020251.8085-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020251.8085-1-mario.limonciello@amd.com> References: <20241028020251.8085-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|CH3PR12MB7546:EE_ X-MS-Office365-Filtering-Correlation-Id: 676cfc29-54fc-424c-922e-08dcf6f4b669 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?JqcXLXzNOB6tgEvsEUM9nzrC6V9ZwiUzRr8FA/jihbDJJDOQc+Q5H6ma/dAb?= =?us-ascii?Q?0PEI8KYHsy6JdBbx9hhDfhjcuAn2rpL8kOD92o0svo0ARjIVX6qkHrAQcSqk?= =?us-ascii?Q?8jLKHyp4WC7iQn7BIpjoFpt4TchpTwZZIRXk/Gpz83qA853Ajy2vkSzpmaeg?= =?us-ascii?Q?LL5cBMoApRCYX3D2RB/4Dg+6zDpt1X7a1whz4tjSSVcy/p0M293BsmhJPyML?= =?us-ascii?Q?HXVa/YI0ARJWu/sZYB+DlHljLtbAaLTne8SVrAzeS66Rj5cTZkR4Eft/buUa?= =?us-ascii?Q?PutGsBrU1PIri1WPgvJpqSaXB6LC0eKzoGZ3Y6HujDk0E0t3IKIej1OVzjsZ?= =?us-ascii?Q?2Yipiozk/m9/dC8CAGx7qh8kDuHMSJFYZRdCdpHSJvfo31Ac5+60VSyBdkvy?= =?us-ascii?Q?/GPfvkfZEYLHkGaNMx1/LsR8g868po1BjLpbLI1mR8InIzBAWSQMxVhL3qiN?= =?us-ascii?Q?q/TjgWrpxEGq/6crntUrOMP+fvfDOsbHomJEDhtT+E2HRBECXwq5Ba53JFu4?= =?us-ascii?Q?WqpsAZhLzUjvddekG80PDcpEBomQpbWq8F3MCV6iNXql9gOKzuHyTfaeAfQ5?= =?us-ascii?Q?F69KAhwE+dqhHdMNpQi5M122o3ggqLkoFaWGtWjtu6o1ibvZtbOlCDz9CZ5H?= =?us-ascii?Q?G9v85ninZg+OJ7pEvg3Xb3zKerpO1H9WJX29KIgZ588RSwhbkIorxQCgK2/y?= =?us-ascii?Q?1NS+FSV9BPQwDaG1oKlTyLuO9njlpWfcn+kNVMWjDysPIt3o4sOAE0i3ZpPv?= =?us-ascii?Q?BHXp7eXWbfcpwVrQuRzwtFCOprdYq3phsmHQLKV/mjZtHKdi3KZtersmK2MY?= =?us-ascii?Q?WA4hcZnmdZg+nJW2VQ+S4mWo39bmMRIntXDDDwXuIMb4jnA0sFN5JghoLbF7?= =?us-ascii?Q?vMowHJ1xQPvRrZbA45CLo/cgaBR0g0FAA0AXkPmhLd65Vw7w7zW/VvV1zeqe?= =?us-ascii?Q?2PcO3n01lCa5vHOq3dhHj9+PaFl+KqDHJoEvPbA5kQM0DOb1cddqi86vVYsy?= =?us-ascii?Q?cxfiYNvN7cV4Lnl2fjt6rCMaYcBtJZA6oJWCCVkjxY116ghXA8J2WFRiIdgO?= =?us-ascii?Q?tLRXyXobtKW4fFpScwmLkXPL0xJ4/e1+uDukrNYDZ9HiR+ddb5j/auwtGm7h?= =?us-ascii?Q?wleVbkkZfvhT775gvMMOGMiLUXD2y21xyKNWNiFfJc7GdozVRsxL9i7mluGh?= =?us-ascii?Q?c1M41fUbv3ryx/CFGjFAy13cbNL7XHgVFmV7FxZtNbgWecgQR1k7unv/V8AM?= =?us-ascii?Q?zCJN+LLvtT1eTRvTr6rN4peIteh4I5c0NiTa7IadvnApiyOEFh9to8TamI/R?= =?us-ascii?Q?wrkgc5fSUdUZ4txCk0Z/VLUd5zWjd0dUDlRoImr3wo9jhNdIuHvv1S3p1Xfm?= =?us-ascii?Q?xMdOCzlbNw7L/f5N5ME/L+f7IBLF14pskrqepqf+ROHExj4wAg=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:03:27.1967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 676cfc29-54fc-424c-922e-08dcf6f4b669 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7546 Content-Type: text/plain; charset="utf-8" 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index 50407ab805169..839007684b049 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -75,6 +76,8 @@ struct amd_hfi_data { void __iomem *pcc_comm_addr; struct acpi_subtable_header *pcct_entry; struct amd_shmem_info *shmem; + + struct dentry *dbgfs_dir; }; =20 /** @@ -239,6 +242,8 @@ static void amd_hfi_remove(struct platform_device *pdev) { struct amd_hfi_data *dev =3D platform_get_drvdata(pdev); =20 + debugfs_remove_recursive(dev->dbgfs_dir); + mutex_destroy(&dev->lock); } =20 @@ -396,6 +401,27 @@ static int amd_hfi_metadata_parser(struct platform_dev= ice *pdev, return ret; } =20 +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 =3D per_cpu_ptr(&amd_hfi_cpuinfo, cp= u); + + seq_printf(s, "%d", cpu); + for (idx =3D 0; idx < hfi_cpuinfo->nr_class; idx++) { + seq_printf(s, "\t%d\t%d\t%d\n", + idx, + hfi_cpuinfo->amd_hfi_classes[idx].perf, + hfi_cpuinfo->amd_hfi_classes[idx].eff); + } + } + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(class_capabilities); + static int amd_hfi_pm_resume(struct device *dev) { int ret, cpu; @@ -469,6 +495,10 @@ static int amd_hfi_probe(struct platform_device *pdev) =20 schedule_work(&sched_amd_hfi_itmt_work); =20 + amd_hfi_data->dbgfs_dir =3D debugfs_create_dir("amd_hfi", arch_debugfs_di= r); + debugfs_create_file("class_capabilities", 0644, amd_hfi_data->dbgfs_dir, = pdev, + &class_capabilities_fops); + return 0; } =20 --=20 2.43.0