From nobody Sun Nov 24 14:52:22 2024 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) (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 F10291CACD0; Mon, 4 Nov 2024 17:54:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742887; cv=fail; b=tCFAqhU7sNGmJw/RdjUy5jBGEW8VdYbjYhlPedIU/2/zePQCQkqTbJivU/IRlg7QBdy8vDVFgbFn9VLfmW4bLmuE09HUlAMft8eqs1pqtgRDa2z80MOt2kShDXXCnD8kLl/sVe0bEV9qI6yWKrY3JQASNwBlUtcmDw1rUzeK3GU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742887; c=relaxed/simple; bh=tETJvBrZxG8mdYwOIlQb1JDboHB6ber235TluyJ116k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lYGcOyxmc9T3OpgDsNEfn2o/kAwiqkKqIP6K4Robl40mrGL0ZRSYLZkkeotTUTS5dZk+4lGSY+aywQ/CHoWH34IijPOao0M5M/cbV0Oh9j7qssegczbNAIUa8fNxUzg2FX7CEvD7YH3CYKIsQM/EMGh8xvGCtQD0ehLZWd5lDBg= 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=mISZ0L+c; arc=fail smtp.client-ip=40.107.94.63 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="mISZ0L+c" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Lbn/3Nm03FH/CGNuJtigtvWPugqqSowvWQINmkHL17amC5CJgX+Vtw5IqsNxlyYuknBxZdyl+3tExlJxcGidD6w5oKbslzkf8VNw5mBqx5mKhL+ivO1lPOq+JQ9yO2fgVRcWWq/jZEUCUgedGiGd2t/tlGs8wwdVOGyZHiKQpQJlGSGKLyEgg/b3pvd97yCYkYKOmYXDMlBTnbCshJs2l2tCxFby5NNNq4WtrpZ1PM6eSl12pKvTL6T5n5VIDK8NyUbU9yarmZsD+Y4iS0jqB/7Ttiz1xNOHxIckpUs5BVN5FMmHg0JjhKj7q60DZ9lt3PWi+aTd8JUHpWCHIaLOaw== 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=oFjTqk4aJtehHpi3YxR8SgFYdkShFqv2troH10OZ2m0=; b=aQGodcaZtrV3Is8ACAwlNbmXIB10c2Vfh3G1WJlUfUW6ztJoMVv/aggsRka3cDVC6MW/zYWB0w/9KJxAt/zaDfQzQbuzgHxfNj7+TN7fKZn/SnakJB/PUxRaK0T3+ZowrTAAIlwl9QBBQN/JUfQB4SgKDxrqoWZvScqJMqsKatLZ/W1VC9ivUvdvxhWo+yaJM5qONhy7Q5JOrIWMVMT7d9Q/BXfBo9r2H3eMJbSdNE2HqMSaUWY4akcZGFPg86cPhxFdVNDBoZZks5dtfFR1XR5suwfERl2/1hm77yw58w1GckiaYPOlWprSEdc3lJXTb++uj+hZdBpFEytNC+Sy6A== 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=oFjTqk4aJtehHpi3YxR8SgFYdkShFqv2troH10OZ2m0=; b=mISZ0L+cYTIT5XFaOoaSCki3hGLylZi5F/zkVaDvioCxyZrmMwsHJJu2tpA8b4E/S8KRUhqEtThCa1Q+TUKeWiHw8YtFRTogYCLgbS6E6t9fMhVwYJ099/LKjjltW/PrZuXfBHqbITLDtr0x4tfRVROOKijMzcCra2s/nSwdLj0= Received: from BY3PR03CA0023.namprd03.prod.outlook.com (2603:10b6:a03:39a::28) by CY8PR12MB7635.namprd12.prod.outlook.com (2603:10b6:930:9e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.31; Mon, 4 Nov 2024 17:54:40 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::6d) by BY3PR03CA0023.outlook.office365.com (2603:10b6:a03:39a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:40 +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 SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:40 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:38 -0600 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 v6 01/12] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Mon, 4 Nov 2024 11:53:56 -0600 Message-ID: <20241104175407.19546-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|CY8PR12MB7635:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e83046c-28d5-44bb-f52b-08dcfcf9c1ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?2D/kVzNb0tIcZ6UX7FZ+6fdE9ePrU248kvt8tKqwdxvHzuYXFKKz+/qf0FDc?= =?us-ascii?Q?1vWPrsY4Dop8Zo66ojHwyhr4q4SaCPyAlPXjGdBt2tJAdHOeD50KdWBdIcOS?= =?us-ascii?Q?nlZRSXnjTuL+6Uz5V64ZMFrVDI4GS9fq2+nr9wUKvqIkbFbFbDikkpSeOv1w?= =?us-ascii?Q?1ZlXDjO7jyIl8N8YUm5Sv9zQjE5VGt49lms6MQmz+42Dsgjia25scsP/+0EV?= =?us-ascii?Q?IgiyliqaT84nQRXoJGKWKBMNaCGes088RSij2Z0GcCgfEUSa1vegY5voXLDy?= =?us-ascii?Q?F3jvPjNFD78ZT978Zwtseb8HrVjVNoP8W1qO2zfEZvnqpZ/NAnjbeJtP/yYK?= =?us-ascii?Q?nHqrBQzJYKVwp/v+IlozHq0LkdGbcmiRERMUvIYF0+dVBiCeng3VeQUIMQpw?= =?us-ascii?Q?fc7Z5vckqkt9YnYqTqPvZR+yzCagcqz1jeTWK5xjW5guYXyHb+cAiJ/qWqD+?= =?us-ascii?Q?9z5jArFc0Zkilw9yL0yKCZHPGfxJDuHZt1v0rwzRXTkiHgrr4RIaGTftD2Pe?= =?us-ascii?Q?5hC3sycEhToDZH83b8cK4TRLW30TgSnbY0qdW6FmCJ6ddliF/JDceWEOX88K?= =?us-ascii?Q?7jF35Vx4aG7Hv6bP33sxNusN5vkvRgVkaiWZlYvc7XmK8TjzFIQHgieypTRt?= =?us-ascii?Q?w6YDbyFTQiOu7tA2ixI1SkxSnizOGAYl/IXJvSldcoE7yBR/e9hnXrolRY1T?= =?us-ascii?Q?Sg51lxbDCgAF4cjPfZazfhGoHb/Avg/mzqrCedkvy+r2DcH+i3ADlfPwVXp6?= =?us-ascii?Q?nUHQAAuINJu+v4F+bxdwnKpfugpulifxjrs1nuFlObm50Xem16spIJEYuO//?= =?us-ascii?Q?3F7Zw44Urx2LwKoDuVAwzNt+5Flh9a4f/SIVN1R4Q28OgGTxLgC0q3vwF0KX?= =?us-ascii?Q?1a6CauPdjSKQMMj9LxtehTTXATNGdKBf5BPIRnsyANeSIHn0zHvrIPR5N4nc?= =?us-ascii?Q?GtIGn0MkS15ui0HcGoJS3Rha7uh9rAAgA1DgnKkAotvtrLf/MZqXG4vcqUWN?= =?us-ascii?Q?qU5LGRukkm+tjmTmtdex1sMjLiDkD4BrGsYdZjvkAiewyoba6a2TQZ/0zlFR?= =?us-ascii?Q?iKAduhDZy8uO6U17YD+m42I8IBwaZU5N1dOHEU84RqxfA/Gt8F+ZC9Vh5OO3?= =?us-ascii?Q?0oLaLjlllH9Mb1kDdKmSyDRyHlpNq4TIYvAt6yiajKl1y1IXBzLz+j+I8dJH?= =?us-ascii?Q?U4fQ1gG4BU1QkGvNjPM9i6PDoZgzo/4tDiXvDtFhxyVWWPW53W86Lcz98UKL?= =?us-ascii?Q?ZZwZVa4nMXN9iXljMzffMu6lj/N4EKw5dSKlXhqYS/pxPjppqQs5QdMJfX6V?= =?us-ascii?Q?fveKgG4h7Kg7JOaQcZnbmj8fTU8D743jpHwK8hmk1drOjXsvr8JgBKNryDZF?= =?us-ascii?Q?V8ZPtYldc7zrdEtUtx4HtcI5Qq7YSW4llLALiQMhJyg80SXAxQ=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)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:40.4599 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e83046c-28d5-44bb-f52b-08dcfcf9c1ac 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7635 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 --- v6: * Fix EOF newline --- Documentation/arch/x86/amd-hfi.rst | 127 +++++++++++++++++++++++++++++ Documentation/arch/x86/index.rst | 1 + 2 files changed, 128 insertions(+) create mode 100644 Documentation/arch/x86/amd-hfi.rst diff --git a/Documentation/arch/x86/amd-hfi.rst b/Documentation/arch/x86/am= d-hfi.rst new file mode 100644 index 0000000000000..5d204688470e3 --- /dev/null +++ b/Documentation/arch/x86/amd-hfi.rst @@ -0,0 +1,127 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=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 base-commit: 110213b8f0e7021819d4db273facb27701bc3381 --=20 2.43.0 From nobody Sun Nov 24 14:52:22 2024 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2046.outbound.protection.outlook.com [40.107.244.46]) (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 9695C1C4A1F; Mon, 4 Nov 2024 17:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742886; cv=fail; b=j0sXQ0tatVTAZdiFWTtskpRxWyM/nFJWdNRC8h1v8cX4kqdWAq4tiaH4G/IX3YuxsNcn9K8NcW9OUmkaNIGhJ1He4Dx3C+uRk6zvh+TqpzwwCXOJhH4smVQSPOkSbjwJfKjCJ03AOYBaYog1xo5DOTzFurpVLo3Lc3OA0Lgbgvc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742886; c=relaxed/simple; bh=QdHxzDBwqLPbjz8ikUa6cXymAnUz/qVkAinCUCshOe8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aXmW4rGsnNrECRNSFCylA97lbzc5sZ55/zIONmA6/wt3qOOVV543xsHhoSbW+lQBvnfXIyfCFQ3TX1Y7ICetZ9PMZO4WnXMJ+Vh2cMsCEAe4zaGCZQ2DY4bPXFeOcJD7g/4+bgrOrdzCHgpizf5BA3mtIi7l2GPKyaT8h5QRJEU= 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=KBzDDWcq; arc=fail smtp.client-ip=40.107.244.46 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="KBzDDWcq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hHGY1vqYOkng3ZtkpDNPC5VhuK3/coyYlPN8QSE3lzrWBHibjPfuGQ3oBrmK8VljW+Uy4W2mdtVNYa/eCKpEUJn0rypn78X/u6Q3mGRoPOyDvrgxIWmWh/TBY2gLW9OIn1BF5Bid4eN3dVr0nCEbTOV93y02lei+sO4bk4WCl77ieqSA3v6jX28OviO1nCXb+aK0ZCnOH+nLUF2MXWHK1UfgmiiOxa2mpu8TtkPJDhVKspAT+qcSnpK/6wt+g9G9WYlyVGFbpG43eIcksNqQHvNlDc1A9TQEsQXuadul8tFgnqG1sN5vLUPSNX+vsi3nrDhXaTc10p5AkZ8sgD8x6w== 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=lbwL9cAESeYXX4ZqSBfiqs7mvGntnMR8/y1VSDVXPKEvUO7gIlYaBun6Z+Lv0QxjEbDRe+j0TNO0uz7wPDH5AFwOZ9Ol9c8vLyEgvsKs2D1Mt9JnkLxs2ThlGXbfV/J8uZ3j0ngUIQnsP4LjBui4gCcndddYCJZjAaE3+1/+Ud8/d/m90+hY2dGxAPybbpq/S9WbcvKcaheesrCJnXfMp9TF1XCKwlkkR+kpqSpAl+2HRhtW6ZmuaHl/m6FS2St5jhbq8uIeDi5NmJvivk+K5t+V8XlvTgACYHeUabOwnQbqwVFj3pfH9+ZCaX39sbCOiGKSjbZg3I62Ro0E+CTfLg== 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=KBzDDWcq2Z/WmlgIx5MNYtldfanouH5lxs1kOsGqF6x8neEgs1mE+nlN4r3zKgrTouzDsSqeL5qxxRnesI2GDq2qqBoXeHjF6APnCStTZbFdrtnoJuDSKaSDOjqhy0YYLOFwXWcMsf+ZSkj2yiuqQiMs83p2JlQy5uuxwKZFs2o= Received: from BY3PR03CA0001.namprd03.prod.outlook.com (2603:10b6:a03:39a::6) by PH8PR12MB7422.namprd12.prod.outlook.com (2603:10b6:510:22a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:41 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::49) by BY3PR03CA0001.outlook.office365.com (2603:10b6:a03:39a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:41 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:39 -0600 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 v6 02/12] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Mon, 4 Nov 2024 11:53:57 -0600 Message-ID: <20241104175407.19546-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|PH8PR12MB7422:EE_ X-MS-Office365-Filtering-Correlation-Id: ce65cd0e-be51-4d61-f14b-08dcfcf9c209 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YmSgx5WRSigOrnNdVv5cfwk4Ww8JL6gO6F6a+xBgEXKYAuGVSuhnqS+qo8Uo?= =?us-ascii?Q?kEVmk1dJKPr5x5JTFldJ8oapDZkoD5+XpYj62ua1rvGybEH8Ey03XyM87O0i?= =?us-ascii?Q?9eJ/1LvpvWyfNYjVdMTjJfFNimfC041i9ydKm42J7vdUEZraMjRQImh2BzvQ?= =?us-ascii?Q?gy/myBhrmFaKIw10HCi5i5zNwML5E6/tmNwFLPsQY7GUa1dz4AWaY3byVbYl?= =?us-ascii?Q?s9ti+b6VAOXML1pGb958gBGTnt4Gwt92R6J2ZwzSZ+eNOcb06kT2WEG6aHTS?= =?us-ascii?Q?4qFaj0D7yqcYaO7u9XNluBzyfr2wLwpQ5LggW57Zdwo0Jumwi9ppKX96n2yz?= =?us-ascii?Q?Kc9GVYqcsrMBTId6q/2XT4nT/Vfm2qdL1tgK2vXVSRhgY3db2N5TgeWqiy68?= =?us-ascii?Q?YAMPi6uMurPp8oj2yWIPI9T/WMBxUqTdvj0sDaKm0Dd2q4nscF8jtZaAoTir?= =?us-ascii?Q?GuAzshJYqr9OcnOHjkhTEhc4Fo191KR5dRvTWkjQVD+mPVFpBUkfvzVy9znW?= =?us-ascii?Q?wkq5GR2AtLMTUHsyQvwysjG+1F1ujQLC06iS7jMx3GnCXh1HB4rojeJQr2ws?= =?us-ascii?Q?V0RCrczeHWX3chT4lMs73bxge+vmTFMUhQ5aJ+Ov8kPO5ZUN2zaEzeVu6UJG?= =?us-ascii?Q?7T7yNx646C+8h+whnarXXKvd4TOJboSMvMJQHO0mf8MNwaBFwG2teaoAJBCG?= =?us-ascii?Q?iTXVfYmLEVTEXi9kIpAM+V4gj1Biwn897XMME7DVVElCHu+dotIhufU+k9sN?= =?us-ascii?Q?JTQTA7uGnq9GegWdL5CMgrH6hzuLxeIxKnCTn/boN6V0tAboSV84X6mNEimV?= =?us-ascii?Q?t9/lF+Hn+/L0UUymEhOt0G8MRcvCIN1eZKwWYjsRXuC7kmlfC6S8PeT4ZUN8?= =?us-ascii?Q?mO1Xcr4JhkR3p5IXQ3xuL5UpjS/CdKUMu7LO4Kut/LsH1G11WPvd9LVj9gp4?= =?us-ascii?Q?34F/aOtmSR8gDn4ki/gn+hKvJ+X9fuSd+0+ZnC4VuabGBRBmGOhQEq+4A9CQ?= =?us-ascii?Q?Hdk1J1TMJWtl9RL2k+yIZBhSTsXBzLbz1jq3iQ3n4/Tzz7s4LVyIFPxOQVdO?= =?us-ascii?Q?HMkFbbNT7SJilZsRAFSNV4fyjpgLPyybxASLqQu7RZ787VvRkba8gpVAzO4u?= =?us-ascii?Q?sAFyFN01RkwVxpIFcEvyQXOa4l4hCwH14cUMSrNgTKyJM/oEfwecV7+1WgzO?= =?us-ascii?Q?1/pFT2nSAmZqIVWj6dLKlohZCjg7wdEKVkhQTJA3vwM5UBQ+2ozxCiJ6kKlm?= =?us-ascii?Q?AZ1qkHqTe0sYuYeFeEc69rLwVidZzh/zUt/Aht5d+JPaqV3T08BsJeBdH0Na?= =?us-ascii?Q?4b58jWd7hHRNStjk37AOUOYWQZji10WVXQlZwFgM8gCb0jhz6b1vGYIHmdRK?= =?us-ascii?Q?5ThjGI0=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)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:41.0693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce65cd0e-be51-4d61-f14b-08dcfcf9c209 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7422 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 Sun Nov 24 14:52:22 2024 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2074.outbound.protection.outlook.com [40.107.223.74]) (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 DEB1F1C9EAF; Mon, 4 Nov 2024 17:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742886; cv=fail; b=QehsBJd+io1JL45UUiEORQkrY8/2bnQyyS9exDn8fhWpaCSDlyhiSSA3do+x/GQ8P0xHY9FQGnyRKLHCx5RHCzWliB5uwXE+20NmUPzue2HH+bif/pqe2oww6kCg3MyXJm0+Y0Jm8kTvVqyA0kfjZJCf9UkvSBk2Ic9N+wmsVxw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742886; c=relaxed/simple; bh=6/GNpT2p5G0nMQWNGh63AxQqGIghyA/swYKFuepemJE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FZNdFmg4oAw8688yLgEPM5BdUVbLMgT9kMjcJ8Dd+5BTTD8D/KS9UBY7qaYx7FiavKqsy2tTQ2/ysaCz/GARVLbU2lL77E/H02bIOSVcfhtL6zfhdR1YRQrY2hD1dHAeqeGqb5lPRauXbrisUGQkC5Qg0jfEW840RCnhNgCagYk= 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=W23ipBuT; arc=fail smtp.client-ip=40.107.223.74 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="W23ipBuT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OYiMtRoA4VAqCPCeDVH5e4NzZ0nHW+BvqEGN2kCVMm70vKrUhwCpNGex/DvRBNCyJqCyQv+rYLMu25gGemsfr1SsbYQ0j3FU5EngQi1nO5POzrrnpctx1HqrTtKyuhwK6Hay9PJ/pH619rGPLQEhd4cpRBdPh2SwaroI4VSyuJ6FOYgElANGz280MUxif7E0Lq0PWpvYGRtsuYA23NMXhm6yRbDfbKlz+WrH29p4ymrCURwGQbTPF/U1AGBJtMn/ImWAO8xJ/xc/BsPL4CztIH+Z8BY8EPRKWOXrebzCDyo7VDScysrAl21m1CR3c0FeeltR+IKa+66or040sHnQgw== 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=xD/OoV0xtXlqbxMB/H5KsiPKjqTskCWrdm+zJwFlpti2F/WH+t+r486mErcUWF7fbGrCnSuTW0leh2r/6MKKct3Qvet4wYQcXvmArqBykAZbwANqd6c2nuPh9b29zaWpcdw0TwkMDNEPkUHQU9462NsFTq5eqi6NMkz4nxtW7wRDFixyAro0ZmJHPYWU4Kxh8C4JxuYRS0DHuirXvwgka2ZYgGHyLsggURsKJNZ/cMVeMvTS6aqV1sKFZLqfGKz057tIJMRmYPJLUtZ8N6Sgol3mFOv6p6m3+qIVoMQTrj2/hxn8qYsXEr60JQTlVpURQWhPTgDgVGMdcZS+hQ4Vmg== 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=W23ipBuT+Rah4ejfucqpm8NwEh3I8J8L8EFiNpSRmwOeSbz9+5NwpCGV1x57p/I7xGB6+yrCHf97zLT8PscqJaVuh3hnDC+t/RyVoKgUUz9FCgZB7oVCJyIlXYvAknmz+1LIPe6rRAizNN+urE0Ki6iGf5ue0s8FK1lgfQ88Hrs= Received: from BY3PR03CA0008.namprd03.prod.outlook.com (2603:10b6:a03:39a::13) by PH7PR12MB8121.namprd12.prod.outlook.com (2603:10b6:510:2b5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:42 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::3c) by BY3PR03CA0008.outlook.office365.com (2603:10b6:a03:39a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:41 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:39 -0600 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 v6 03/12] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Mon, 4 Nov 2024 11:53:58 -0600 Message-ID: <20241104175407.19546-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|PH7PR12MB8121:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d2dcb76-4aed-440a-007b-08dcfcf9c27a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OPvs9pwOJzoYpEOor8mAtdHwL8rQOrDZv93Bq+J1DHoLYbyvzJCqg5Kyk1kr?= =?us-ascii?Q?xGmviqE9FCUlG/4RSWPTSyRxN528f3CBFMFOokOqvj8YzXNWI3psUDCtddcJ?= =?us-ascii?Q?rfrxjKh1CosS6PwJs14qhWandkhbhhLwZYxM+/zNb3hbBpPsNCHwiXXEYBM2?= =?us-ascii?Q?iGwlHKQKEAKJ0SNjE0qLeit/8N3ousYBqZJJfP79u2X9/OAipJNQt6GYUjul?= =?us-ascii?Q?WrY+qRhMq+huwIev/evLmt0wr4fjji157dfFbr7e+fitcmgW+A5K0lwitpoW?= =?us-ascii?Q?7+CLKjlw6o8m4tyTWyi9BQTrSTO6S28WAkvk/fdmqEj/eVQ5TxU5r5YJEptN?= =?us-ascii?Q?iGSBi85Z9Qg2Y4njskVZUZnakU9Tfmm6RkEFjg1iJyO+vzTB4g5IaU2oFLP8?= =?us-ascii?Q?DCx0U1kp67quzY4Y5Cr2SwTYaQlQ1uDTP9529VaQpvLO0pw9RqUp9WPxlq5l?= =?us-ascii?Q?pjpxHmTjvRYgrlIDZ/MpcAjxzeF+wvZOPAslTPqjjai45RjQh5vgcOKpZwoZ?= =?us-ascii?Q?8radEPB4IUL4PBKjC2eMY6ums62oV01tafx/pR/vBsn4p4NRuaVUTm7bT4hL?= =?us-ascii?Q?cXHcwJXowa4oAu04PHsruGBg/wyGlSlIMksGEM6K7fGCo2n/Z1QYFYQ5H9Zn?= =?us-ascii?Q?PogPXewRz4I7zBtfaDcCIUmFlog7LfrMx6YwTpLqJipxmmYnC0IQDXWRUUZJ?= =?us-ascii?Q?h9hmY7e65aYISjZJtY+55Tapza4RPWg6/7KxJyQ21drWJUWiDw2klpTCaTw9?= =?us-ascii?Q?OZUepYz9noN18wKa+alEiZNwqZkS+PaA86uymwq+i5RYXQU0gGPDwp1r3qm5?= =?us-ascii?Q?Eiz17+OzcRLWB6QXRf7+/27I9t1ujSjquEQAm9FrlAG/t7KPYgWTwXdQEkYN?= =?us-ascii?Q?xj05WYKAQLKXD7jSYpuzwpZhDIeGQwKrBQUdIfMRddh1RpkNT7FS8j9J+SWP?= =?us-ascii?Q?O+PrKj+fPh4z9DSGChhSOQ08yG7QrJjEnSaLKt73vCl577cnIt0R4AAFJZFh?= =?us-ascii?Q?XEu8ZK0Q/bMTaxuTWcBbrkBL8fvZ/k9xnESPoyIuEcbrXrLNDL1LrxU2plnW?= =?us-ascii?Q?kgx5hbVZCgTjfHKEctHcPDVPpQS406mmHEP/i5Ef5US2SsmbJJKRqNZ1TKDn?= =?us-ascii?Q?DT0ptetEvkQ7SFz+M9+bsmGS5aF+43QnmEIKY7bj00qjL4mIqD1mj3qVjooG?= =?us-ascii?Q?MfgFVzqXz7t+0f6+QiaXFGFydpLrWz/P6prYN0UiYUly43uNxJtDg3v21Psh?= =?us-ascii?Q?lEqqmbCi/+plIHlVDMgSXfe29WQGr5vjVHRKZi0wy4craMW8Lq69WRozpfLT?= =?us-ascii?Q?0NgXSnOdnnlBrObeeN+RcAk801q703uhwhF/BAGHPdKrZodR/FJg6ONogTrH?= =?us-ascii?Q?jkC2wLCXpa78zWzdKjmhlWhJ1xjRhIlzc9UdNZpuEckw72TTBw=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)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:41.8036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d2dcb76-4aed-440a-007b-08dcfcf9c27a 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8121 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 Sun Nov 24 14:52:22 2024 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2089.outbound.protection.outlook.com [40.107.220.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACA481CB533; Mon, 4 Nov 2024 17:54:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742888; cv=fail; b=BEy9kYch+SArjr3y7zzETbGwpto60OUk3F7Lzd1SrVSHgLXVgR+O/f+khnydfpu4i6Rz4jxS/bFhUspL718/kVmUqPdVnAu2frMU2IyCfxWHV43bVMND7omqmk8HmOhnNZJrk7erxpGlHpwdvi7l+8jwxChh+aH6mjIqJ1JIhKw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742888; c=relaxed/simple; bh=cGEdSO2L2DRZa/wlOfdUfdWoi69Z8IMCdWIJZi9Cyo0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P0JYoJNXJvhcy3trLAgQajvG3Te2B8PU6vpiAT+s2l+iv7WnWLCCWOPAneMIpgUwmmyAX9J/QgSzdfL/OkoojWvebMj4x60eYCsHBtZv363SmtzCon7XwPR5/uGqVidiY0f+YXb+SvDw5vCR8z+8+IFc5VN31UDFueq/nHoGqYo= 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=Hv79f3Pz; arc=fail smtp.client-ip=40.107.220.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Hv79f3Pz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JfHv/dI2hz+mw2nE7dF3pBmzuuIrCpQ8X45IlA8If3W/SAI0i1Hbn/xx30T4Y+UOuyZ4lVDZcCGxBAiTuHSCzzAHtDRoL85E4eHMOwGwurMF5HKZ56kHw63vQiIXwWJwyoBy3oI5IXF4OCLtOMvmr3Rv7QJSqVKAgwoUXAi3Msud6ivPUT0xEJqOnv64aoC8S48Alfg+dfoCHjY9AzwhCvBzO6t9CycE6gLwMc44W4PPQMSaqX4mXDE1WCqU65NyH5GB4mUc4jZcgp0r85DZxVKMypbVNUVQ2pypA9pJsxq+qqpevKi2sSsjRnaAb6wc+v3ttoRpjcrk7F/xvJU/dA== 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=PnRVFZwbJkJgdgzOm9Dfmb/Rhqmtwi83TbTk4SSauYY=; b=tF5r3bD9yVw2+UtDY/8FV/YFjb6lyWBXAqvnIGv+RAHO9v3tFIbJG2WjsDcda/OadoTDzalBihObfLBJghdbeSg15HMK1GyBhJDoLUIJCi2BEck/7xM3m0NBI4iDq4qlico3zXWpYl2EFF+W4YZZc/k80E/W7RmiKse6k/k6Dzfo2iYCBpD30GX/mmLj/gPTqGfTJIq2MOOwTJJTRE1sXiCRk6N4e5kTVVw44hzSQqsIYrmtZZc15h+hAbUcvMUxUdKFNId6snVdnZsudsWZnxwuEIx08nGtnVXih4MU17obyKswLtk+ro1pDyINwhhHT68zvvib2NPZwl4bYDL23Q== 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=PnRVFZwbJkJgdgzOm9Dfmb/Rhqmtwi83TbTk4SSauYY=; b=Hv79f3PzfDB1m+yPpsxj4DpxPUmYbLufPsilNyVci/FKlydeBGSnzpJzx9TiCTdAgjHjX5/FOeI/3Q38ftMNLIN21+2e2HGaeR3A6bl56VzfWY0EBCQK2NfjC4mxQaFJYS6e28PTXohFAI1PcV3evOol838mHVE/hRCX38jar2c= Received: from BY3PR03CA0016.namprd03.prod.outlook.com (2603:10b6:a03:39a::21) by PH7PR12MB9151.namprd12.prod.outlook.com (2603:10b6:510:2e9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:42 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::33) by BY3PR03CA0016.outlook.office365.com (2603:10b6:a03:39a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:42 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:40 -0600 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 v6 04/12] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Mon, 4 Nov 2024 11:53:59 -0600 Message-ID: <20241104175407.19546-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|PH7PR12MB9151:EE_ X-MS-Office365-Filtering-Correlation-Id: 8abbe449-ac41-43b0-5ee7-08dcfcf9c2d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?M39d5u8jexXr+Uzz0vMlMFUvRiGfdWJy81osV0fFh7hDpTc+iy24sPHjqh/X?= =?us-ascii?Q?C0kMNHixhvRyxYs0781Cn8SKitSzuwS2goDyejidumNjJfCcFKgrylbO+ZAA?= =?us-ascii?Q?YlFHNIj/nfgyAS2Dt3kevF88twvobm8ps/sYlB55pyCP6OAtJSI6pDwBHmBp?= =?us-ascii?Q?3DMggOhCLhsUbWQRDlLGu8NGcmcNF/oy0MB2ohQUoMZZQ6qjiHafZPuBzQYg?= =?us-ascii?Q?k7ZrCLVt0Tg0sUXeHVY9Dlxh8sdncxcjtx9TrDPIzUOFncTcQqGoyG+ptPdi?= =?us-ascii?Q?d74IqQj+0lirKsQqRHhg0vJC3X5KTR/dbg/hnoMi4zSNjEmHvwSgKp0J/du3?= =?us-ascii?Q?cSzGN7R8XUi+UPy9t9EVkG+Lpv4Log0fgFskLtHdBqq2wiHXof+NBV5PqYqo?= =?us-ascii?Q?b1PEkLKqS8dplmS+IhxCVYvESuPCSSl8H68bj3vFwSxsNOHYNbXM/e6XMtgg?= =?us-ascii?Q?RSkWGtQfmWBzt+OmtAZGi6h6T6ZH6WfCphSKWgzjN2oC4nHydKbOHBO87YVD?= =?us-ascii?Q?eN0jctU6dDAwvpp4A4UMZLr6EL731M0RDT5wjIeDJCzqmZ7ZsZV4/A1GkQ3X?= =?us-ascii?Q?IGgCEpTRwME1rMtG0w3lChkpt4jvPLQicEnzWeBmEbgEyJTH4voK1XNIo545?= =?us-ascii?Q?lqwXlWOBeQNG6b6SK1hd1FKtJNLzhMhgsAoUQXl8zVk4d4oXcy1ZWfJimjcG?= =?us-ascii?Q?CqGrPMdmbXsybGA2TihrNrH63zgeHsOr5yC2BlkcMI9TRwh8hAhgDY/1fl66?= =?us-ascii?Q?rn15nQK3NanWE3hOWdO1N4YXEyxkw2w1vU2ZvhU/5lTqQJTadk/rEIa13Pzz?= =?us-ascii?Q?Qw06k9ZxBCEov2GddpsE76LBj7YF3MJ1W/SW3OhEmQrSnI0ws4vNX3yA59k6?= =?us-ascii?Q?GjE844DfoB2pJ8wYiejVUNE/ZsBhZgIgrm+2SUBNSppmlNcSwgZobo0r7xSJ?= =?us-ascii?Q?suVDYRe2zwsfCq1A7XO35UlYyBBfk5n7/f88HmJ8cvpU4NTPdxfxHnyBtATj?= =?us-ascii?Q?y7fLHE7ghtMYGRG4Pg091gWvv/gLzlpDUsZBQniATWRKKouaIegwzJKEOXRY?= =?us-ascii?Q?H4bOQRl9RK+kltt/vu6dQTtUn+R7CfgmZO5zJjGF33xbRWKPqBguLaltjudX?= =?us-ascii?Q?qGM4B6uvCoy86H94+8PQd78KC3AlWwe793T3LE5sELDjxxeNBhUZs5798hA7?= =?us-ascii?Q?PTdp5B4XPfiTi6yt0DBV+HkVQ+oX/yqOdxeZS0aSvk6ei40B/TjHYlyvOBhn?= =?us-ascii?Q?9VSYEp7AUE9FqRYltMkg15CLRx+wCb6DeVwmynoILdrlE4k8JSfHRFsVaajC?= =?us-ascii?Q?bLWw0WxiC3NLZkUxN8AdTvL1k6H/ZRyqJ4anpclSrxaO20bg4KdHuMPZPU5M?= =?us-ascii?Q?QQfOwnOVAlPU8TCrsnS2Vw9Sqf+pkJmwODIb+2K76cyFHBFXWg=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)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:42.4287 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8abbe449-ac41-43b0-5ee7-08dcfcf9c2d9 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9151 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 PMFW via a shared memory ranking table, which the driver reads and uses to update core capabilities to the scheduler. When the hardware updates the table, it generates a platform interrupt to notify the OS to read the new ranking table. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D206537 Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Reviewed-by: Shyam Sundar S K --- v5->v6: * Whitespace (Shyam) * Use managed mutex (Shyam) * Remove needless include (Shyam) * Commit message text (Shyam) * Use cpu_feature_enabled (Boris) * Remove EOF newline (Boris) --- drivers/platform/x86/amd/Kconfig | 1 + drivers/platform/x86/amd/Makefile | 1 + drivers/platform/x86/amd/hfi/Kconfig | 18 +++ drivers/platform/x86/amd/hfi/Makefile | 7 ++ drivers/platform/x86/amd/hfi/hfi.c | 161 ++++++++++++++++++++++++++ 5 files changed, 188 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..79e3b0073275c --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -0,0 +1,18 @@ +# 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..2cd71d79a22c9 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD Hardware Feedback Interface Driver + * + * Copyright (C) 2024 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Authors: Perry Yuan + * Mario Limonciello + */ + +#define pr_fmt(fmt) "amd-hfi: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HETERO_CPUID_27 0x80000027 +static struct platform_device *device; + +struct amd_hfi_data { + const char *name; + struct device *dev; + struct mutex lock; +}; + +struct amd_hfi_classes { + u32 perf; + u32 eff; +}; + +/** + * struct amd_hfi_cpuinfo - HFI workload class info per CPU + * @cpu: cpu index + * @cpus: mask of cpus associated with amd_hfi_cpuinfo + * @class_index: workload class ID index + * @nr_class: max number of workload class supported + * @amd_hfi_classes: current cpu workload class ranking data + * + * Parameters of a logical processor linked with hardware feedback class + */ +struct amd_hfi_cpuinfo { + int cpu; + cpumask_var_t cpus; + s16 class_index; + u8 nr_class; + struct amd_hfi_classes *amd_hfi_classes; +}; + +static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) =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 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; + ret =3D devm_mutex_init(&pdev->dev, &amd_hfi_data->lock); + if (ret) + return ret; + 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, +}; + +static int __init amd_hfi_init(void) +{ + int ret; + + if (acpi_disabled || + !cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES) || + !cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) + return -ENODEV; + + device =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 Sun Nov 24 14:52:22 2024 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2072.outbound.protection.outlook.com [40.107.95.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4985D1CACE8; Mon, 4 Nov 2024 17:54:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742888; cv=fail; b=uLw3JnKNxPJyIdvEW9CJGMU4hv6YwCvVaM/vjG9jauJuE6vf1lqyUwf/ho277lkt+eGSI4MBTDLY2yMmrKUF9zxFpm5gpClnp9DrkoCgREzKJBetdCaJR4bT3TT4k9BKOKOt+lHe+Q3CbW4gFdJaaww/PPfnKYXoU7/FOZZPZkA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742888; c=relaxed/simple; bh=KKJke1c9NkUZI/EZwFveiL6Qacvt2SHhOk4dUNExIhs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k88GVuWiZszT6/fOF7Hl/5nfZabs/5KcKpAY49cmPXH/hc3yu/bR8CpALSipaJvOghY8dgRg0BDx+zIW+vPwbRpHMHTrIODHR9doaAQTbDTI7lrliQETRVqBoLRQyqsGol12zQRfWmmblsuFCb7RDP+rM2nflUZ8QcJT7Fw701k= 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=wv7nIqDU; arc=fail smtp.client-ip=40.107.95.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="wv7nIqDU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YB9N1j/LWst72yvrqfuFLUSzFZwKKj44h9A+6D3HwnDWHRi9UAkHLwDCn7jOnbuzeubbMDRLGRtGDKIUvQSpAYaAIAfZFN9JZIo4e0ofWc2DaVVwyjU+j5wvYGWPIZWI/ZBzRT0ifADrN0n/ebxBRz/+e5+nL1RITJXvnzRB7wLnSgTTW7aVIND82MYNuxmE6R29MruWihGoKIdTdPH7xx9anxGDLb5EPbE3Tfghu+o508n5OxImaRHUDX8X8qGBuk0bs1t6rkHzVRo+jDZxsSB8DW5xch9xpx86AhzczCkQG75gNbFgH7+1nva7jGWG5gNfx2uXs9PPRai58rudkg== 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=uctgYgmOW4Z9RVGjbUwFp5sBYHMmBn9Q7lcMqZzM3dQ=; b=khc1nEsjtl22B/imx/KVC62PIrJGb4AdIFBFe1EqhJPVTqmrW27+fCzRMaX1x421tKYT+s4iMfdt1M7BhKKFEiR91tVnol2c4cJPRRXJbHpVrs38UIbC6EhMmmwFQprnzaURbps/b7YYFYrYO2L59MIt0BCR7Id0RjzBR+ukt6gw43aL/ANiOdoZbeEIFI2HtC20Z378a4m6N4fBXzfjBrY3XTWw7O2uG+Mg94lhZc0mxuaZ3qpxq68oKrE+8hkiDOh3EGpjQ5mgEOAuEwbODb1vsSvPrmRTJjJjwZ59v/CkHu1iP0uJqUAjTNxRoV5tKSiCkbfp4ypErsPeC58TNg== 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=uctgYgmOW4Z9RVGjbUwFp5sBYHMmBn9Q7lcMqZzM3dQ=; b=wv7nIqDUmikzV+rB5NO4UivufL8KzjbpCRbSHqMbmhRw+fpRcsV6Y9WzT3HAvhes8H0yBNXKomGmQ4p/ASk0SLUsWDFhfBvZx7LC0gv+rtV3ynxgq/bpkIfY5keVeGgskUpptFlikRO7wn40d/CqBloYiqnIrtgkt7CtKOmW8mE= Received: from BY3PR03CA0023.namprd03.prod.outlook.com (2603:10b6:a03:39a::28) by MW4PR12MB6876.namprd12.prod.outlook.com (2603:10b6:303:208::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:43 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::df) by BY3PR03CA0023.outlook.office365.com (2603:10b6:a03:39a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:43 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:41 -0600 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 v6 05/12] platform/x86: hfi: parse CPU core ranking data from shared memory Date: Mon, 4 Nov 2024 11:54:00 -0600 Message-ID: <20241104175407.19546-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|MW4PR12MB6876:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ac9a8ad-47c1-4d5e-969a-08dcfcf9c331 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fNVQSSFs7dEQ8vXG6wEyQ3SWN41t+s1/mrea5JtO3AmMKYx+q1ma/vZymOUX?= =?us-ascii?Q?1LgCs2kGJLoa/cptkDxdDToQFRtFGeaLcK5imcHS0L2WlZfHhol3QoVO4BEz?= =?us-ascii?Q?WAt7IEamVSZyEkhLhgsvVegLeJPED811b+1vta0noqmbId4d76UKd5qpW+t5?= =?us-ascii?Q?sm7VWhROMvdzr7pua+mXjDWiOI5XsPd6RZUosaCtF0b/jKrVF5eqlqhLyyAb?= =?us-ascii?Q?q9vjDNajtOOjLAbA+wRjGWi6oHyfZwYyReUTOSlnkxyUHbX5ljXla2cnI/Q4?= =?us-ascii?Q?8MfBscb2gsLYOdCWq69hepqQqF01XGTjiPm/4j+vH+U8vJUTVvtYvlzVl5AY?= =?us-ascii?Q?376AZRdmu46b1EfLkPDpIVu+WGzNKqgmKQrxqmzPecaIBMuqvPclMInXdrm0?= =?us-ascii?Q?ig95MGzMqHrRinExFgjybVH93GTeXMeT9eAJxZPu0JvgWUxRGphfny3L9Y3Y?= =?us-ascii?Q?mirkALLafzLXFwQNNrhI0IBI5sJrqoyaL/r1LamePnOF8qvJ62BIVYotMn+q?= =?us-ascii?Q?HK629bEvj+3X3jSvED+iIW81UNtw4Zb4RvcNwoRwvnx1nwhlrjod9YIQSu/K?= =?us-ascii?Q?FGtYi4x/af3nsI1nbL4dYuVm4ioJn4whaHAaoMN+jSG8VXkhmhx4y31Vu4oc?= =?us-ascii?Q?Frsfj/dnytRliUqFOdNfEKtnNiGmIY5sZTWCL0oGwLhq7R/fIJD0rX581CiV?= =?us-ascii?Q?IvemSjFSarD6UJBpcAihV5f17/B1dRcP5ykD2KheglVAqcTXBLtczsuDcU09?= =?us-ascii?Q?dnAMUPcYin/LM0nJboKEbL85vWBZbOmq1pPtCAvvsCERK+f7f2nZL+zx6rBA?= =?us-ascii?Q?NMDfrHxZF5czVxmkKEjvETjsDBRwyWkKqwjgoTgtj0uigVW8g9843jZknqlj?= =?us-ascii?Q?k8qngSJPLvTxsi8Iy5Z5Z6fJ488JEtbfrLOxntAsVF6mC51lfk32goH0vK8n?= =?us-ascii?Q?pn/m+SkUCrvCxAjqDE/00FRXxdJ3werZHR6CFRme64qhaTSXPq/T/1AUCc9Y?= =?us-ascii?Q?fYZhNN9VFJKs5njLyoXGp/OMEJKaJjTjHsbUIDrFCpMhWRhC+yCTZff1T/WM?= =?us-ascii?Q?fKxJ+m+famcQYiBFAY1Htn4cVdfzIMPv3LmBPXkm+BEjq8OqqopMcLk80xAS?= =?us-ascii?Q?Ks2kvQ88y/m8kETuXtBQ+axkCy7Dx0+Y0//pZ8YN0WyAGg+nJIwl1cmc0ZY4?= =?us-ascii?Q?SPYhzHsnYIPlMTnGgMzg6Cn0b/c+gqvesss0t5kRpI1Kb6HOHo7H3DNXDK4e?= =?us-ascii?Q?5Ldq35gjGfFHBiTe0Mz/yhW2UcL9kKUuJXBLbXOg/d1f+T9tbnWTkr/WjPqe?= =?us-ascii?Q?qEpvxR2yVKDQ94qbf3uG+c7tDr3avzVOzU20qU0tAU7EBaXzQHFUbkPw1bKx?= =?us-ascii?Q?BYiRG1Vi2Mtk1U282uHCfNv2Z16H1ldTlTzxBQKU1Kz8eFzfFA=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)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:43.0068 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ac9a8ad-47c1-4d5e-969a-08dcfcf9c331 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6876 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 Reviewed-by: Ilpo J=C3=A4rvinen --- drivers/platform/x86/amd/hfi/hfi.c | 196 +++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index 2cd71d79a22c9..708d7d18fe2f2 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -18,20 +18,72 @@ #include #include #include +#include #include +#include #include #include +#include +#include + +#include + +#include +#include =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; @@ -40,23 +92,105 @@ struct amd_hfi_classes { /** * struct amd_hfi_cpuinfo - HFI workload class info per CPU * @cpu: cpu index + * @apic_id: apic id of the current cpu * @cpus: mask of cpus associated with amd_hfi_cpuinfo * @class_index: workload class ID index * @nr_class: max number of workload class supported + * @ipcc_scores: ipcc scores for each class * @amd_hfi_classes: current cpu workload class ranking data * * Parameters of a logical processor linked with hardware feedback class */ struct amd_hfi_cpuinfo { int cpu; + u32 apic_id; cpumask_var_t cpus; s16 class_index; u8 nr_class; + int *ipcc_scores; struct amd_hfi_classes *amd_hfi_classes; }; =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; @@ -73,20 +207,78 @@ 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 return 0; } =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}, { } @@ -115,6 +307,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 Sun Nov 24 14:52:22 2024 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2CAC1CBA01; Mon, 4 Nov 2024 17:54:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742889; cv=fail; b=EoyK9Eu0Gn0sGXcytJ93tYWS3mH+XxGWDHbpPI0MEeVb4Vh+9L78lEDovJMpG4PCazrokK86O8WWcpdiH53K75hJt7jKvEjxuCpNWaHxfILcUMG4jNqubVU+rDuFT/CVMNoDW6oeB6QRoChJJGYs10BeU9z7d3zBtyUQDytB058= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742889; c=relaxed/simple; bh=eGxK2Y+vS6ZwqF8hHY7GKtVt6LHQ+atU6Qa3AJey/AM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KLPeaobiSFpjF1jCZdvqMsFOKIRjd8SoKjXm6rfoVKVC9x2ida8XC9SpBWCgOf2dpxw0V4534V4XzwuVo6H/QSiEjWJ6cyaOpFWiFSAp0ORmKW/7oiZcTv/+ZsurSLuK8QrPKf0t2ivNF0oYg21xkISw5IXC5H08DzB8+U8wVn4= 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=qhE9F5Wy; arc=fail smtp.client-ip=40.107.243.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="qhE9F5Wy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AqcN+WchgSaa/zgiREYAKDLyS+ofYAJ1SxjhlduCRodRdqa4GzC2lkbWoQWKbURNf05EehT4Cu0EGbGl70Ivw16+1Dxhrd64Q1bxPKIiOQOz/ivz16NmBKss0gbkJ4QDXEYu8axNJd3DvBgzGdfJppKGFC6H3PZTFiORzjkhWw4iUV3029FkPbPkQZhCgNjTRvf9lV0C2ie0B6Bru5tKuBXjsB9Vc9eXdUyoMevci+rxtbGaPO4k898kWJlDNTVD3w/lnF1S/v0/5h6m8JJ7764d8stir1VvvTXfK5L6stxXePTsN5aOXrNM/gGAvLeRLSDKDgaYK/a6g+mIU16Y7Q== 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=RQqn5inL38vxsHpZRPV2GUD/L8Bnu2nVxRJ+eYqkMgU=; b=UyjkLEWOk9jCD9y7cz7dlCoeqlbsValdQYxGSf9M6sAMcNzq5UsylKRRgxByHl+IiSUrttufdOuTOGTE94ogOhRJMS3uxJXK1YPgVLN4+Mk3oBksImVVP3mtEv4bOURoFdeF2jAJ1e4Xv4DJN9uQFsFoKno/bvtJ3WOGxpdDRECOY+rqBlH6rzRDyazfr+YIVq3y+9gXCJDcO6dvh4RsE+Au/1ZSqEuCdc7jOH7lvG9YhzUTTIGZ7ONfO+YMiWV68oiCjcyjkKF27cjvn9ZnNFwBs5nAP8SS8WWSDpztdHb/21KynKjVqxqKxRqKRl6uiaOaenj16LikwCeuCBytwA== 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=RQqn5inL38vxsHpZRPV2GUD/L8Bnu2nVxRJ+eYqkMgU=; b=qhE9F5WyEiOLojPRpSODaZg/8xFtZXyO018rTY81ypD1U0sGHQz0/5qq6cnidaTQqDTvUVZ8SuvxM0mftj0N7czaMScGhNOgjnDduxDTFBz3gjW2SWq/UDwJAVQILys1CrN+/dpmZAgY7SRcOW8rFWkWmw6gbaBIwQkRrUTSSbU= Received: from BY3PR03CA0006.namprd03.prod.outlook.com (2603:10b6:a03:39a::11) by MW4PR12MB7167.namprd12.prod.outlook.com (2603:10b6:303:225::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:44 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::4e) by BY3PR03CA0006.outlook.office365.com (2603:10b6:a03:39a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:44 +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 SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:44 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:41 -0600 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 v6 06/12] platform/x86: hfi: init per-cpu scores for each class Date: Mon, 4 Nov 2024 11:54:01 -0600 Message-ID: <20241104175407.19546-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|MW4PR12MB7167:EE_ X-MS-Office365-Filtering-Correlation-Id: 47cd4d36-f274-43ff-dcdf-08dcfcf9c3f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?LQR5Wsy98hXLuAErrPJYzrgfeNuQ59KiggRrUgfNzLqrBvuKVHdFncXAjezW?= =?us-ascii?Q?1dcpFqFgEP7eeOEfNWGw366pC5M3mSnAkk3AjTFQj8ZIf4cpDyVU24inkLGd?= =?us-ascii?Q?s89mHbIkCOnMje/yKH2jTZtIVbw/Q4x8c33moUTjHpeDSzTkevkOPs5WnUHv?= =?us-ascii?Q?gVCtnvXAV5Qm0bQ2t53k2c8o7anEm1n7L0oOCiFlJP7WjCdwLE6XTmdh2+n4?= =?us-ascii?Q?yplLbApMVg9v9u9Pdjk7kBAzpPQpb/8aoS8NusnXj5NPkqBJwcP0L6m7wvvG?= =?us-ascii?Q?xz+dFcbV9T/hzmXRvP8FJaDlhkmc7TjPFcCWmUfDSZTtonR0dIJDQ6BBBER8?= =?us-ascii?Q?rEYNP5oCSlOt3hDWf+84enUdqpIeTt+wHyhweJkSSuZHKBo0+26Z4gkk9HBu?= =?us-ascii?Q?1W+V+6fiumGEO6TrZe43Z289ECNEz8+wpfQGA067p4PJUN7lEKpksoppWdf3?= =?us-ascii?Q?wixCOPw2DPPAZ7eEKs/cpQjiEX/6JXI3WHN/KsrfEcqE/lr5cbnCAbHa0yzQ?= =?us-ascii?Q?LRC3HbGmF9HywGj622NiGVvN8+fXQH/bIt4lUiETsp4AGeuLLXAzUZECWq2D?= =?us-ascii?Q?YUb3Gg2MnCKDD38augppcNIyFSc0BDdMkxRkoZjxxDWsX48nfGUb/JaDBpcO?= =?us-ascii?Q?i5p60jvA6AhDUrDeiPmtCKUlZQYWRbsCQxF/oVECMkbECG2DybMvpD6Hy08A?= =?us-ascii?Q?Pz0SsBIkkaTfWdX698MceNRYlOQxIP4EPe86nB2VCxVfM40PujcHitrPx04p?= =?us-ascii?Q?AH5ag1zhLXnXt6+8wkEyDfeoUTfbhQYQsMHh6ZKFuGj9TzHzYhyI+M8onv8W?= =?us-ascii?Q?6IK/1ENGGNJsTGiRLFG/lznXoAhT0FeJH+/aq8ods0nnTlvyNM3EETIcug8E?= =?us-ascii?Q?CCxn+NKJwF5FeKgbTi6ex43W1b/1T+7cQT0LssPbSxNkPQAXWUvQaV0Ly7P5?= =?us-ascii?Q?ozRxMgoW444r7MZTh9lUfqQo+FkLEziYlX6SQvz+Ey1P4bAGVxfBj/Jruc9D?= =?us-ascii?Q?rwxb7WU52lilEjBcXuNoJtOkTwJ3la7X4CCRbNYw4yt0lQS0B11X620Ieu/j?= =?us-ascii?Q?h6AHO/hRZP6cgwSizxznePQjcgWs6v8iFJ/1NCu4VpBNay0Uw90uTLJc2zVT?= =?us-ascii?Q?usVnn9kjit5lTh7ThY1ypSHpgsTcg18UDGDWKOX7qP5XzOijkKRIdXm6q9M2?= =?us-ascii?Q?03O44S+S3fEXrltZd/WEis9atNSpCMt4k36hN4KtxUDBG/P28PCiePIS+L8r?= =?us-ascii?Q?T8hVq2lpgHmLypXEDkxg4sJx4FkjU5bO52SNRCXJOVU56aMyls94R0pUTVVm?= =?us-ascii?Q?2Ffn4+qzWpnWKF6uT2ah4sKzgbZLW3bG4Bw0+6zvjlHvZmaIcs15GBGhkRuq?= =?us-ascii?Q?kOCtagHt4OChig6TpzMXHDmyK2bBQllfZm5Wmq+w95NWpBv2jg=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)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:44.3193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47cd4d36-f274-43ff-dcdf-08dcfcf9c3f9 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7167 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 708d7d18fe2f2..9bdd9d9a615b8 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -113,6 +113,8 @@ struct amd_hfi_cpuinfo { =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; @@ -226,6 +228,31 @@ static int amd_hfi_alloc_class_data(struct platform_de= vice *pdev) return 0; } =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) { @@ -311,6 +338,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 Sun Nov 24 14:52:22 2024 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2070.outbound.protection.outlook.com [40.107.92.70]) (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 5CDE31CDA1C; Mon, 4 Nov 2024 17:54:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742891; cv=fail; b=bmjAQxnUxZLQhYKUl7Bzt9EHxX98smbK071wigpO5+uyq9/fO4VOg4EviBydlwuYGhw52dv3vbOwpfCIqn91cT+la6py6zUCU2P+rPccGte0/S7ydrdrRyLi2GRBqK/RI6paSwqa3l5Xw7u5COJGOC3ZhCtQZcWwgJQaecW7A8c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742891; c=relaxed/simple; bh=8hyqUBZYzTZYptCwDh84yTVItwnDwvQNG9BISya2Rdk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E+wL02kcGGBxUb24TP0e14iLVSl5aIx+jZ/9XbdLuHdXYb92oeUzaWd0FXQ2aLuUcwo1/WK+OYspxnGjR9x0xHaCKbCpoCH8NKdGZTEZkNElBRyrx8MfNN5eethnt9ORztt+6xfAV4BLwvUP8pKKCZ2iZ9tiRB4a8lcMeD+AXLk= 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=Lh6jd2bs; arc=fail smtp.client-ip=40.107.92.70 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="Lh6jd2bs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SMvWcwA6d+caSJLzhjroMYTnmb44Ippvf84znX5NpLQAFkbS7lRmiTUVEtqciQGDzk9OWyVo58G8C314cPVkCrbejukrsEUz+LD7vi52T+J96nJMA6Uj53Eqtn0BqXn3mh8UpLo7FCLP6XezkvTpUjvr1u20N5jp6zb/jDXazKFgty22riKrrysXoFSSLC6atobM2CD/G8o8Jn5L9uHEwdZWpnDDz6LopQuorkByfOuPlWlNgftNeiXl+AwuXco8cGYLn1+wCa+mxrRxL1/kAAFl8hoei9va0xRfYeyZMbGPPw9RbA6AOEKBAigqMBVa1uPdwowZHHY1VHHFcML9JA== 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=e7KunMFjhHxjgzK5chsTGqMgZNatzcxoVsK/HYkR33M=; b=WaFrSHJgBNzrb+Q4Ipu2xwhLEvcQM1Mnt9392E7r0plLApWkwiIEYKeeoHUlKcYmWRscfrPSTTFVksHO7vByzzX4b+GiRxTkhI/Bct6DyNcFWfxsYYV5yWbyn513QZUFNMLotRhVGccKG3RU+g8KbnLiWXKSMdAjJEOYScoRUv0Emkw6cTVh4Qgy45P93epr34/H6MiNeo7bIBXj+UG/c3nQhBPDz1yk1XjzxU68aV34D9DFjO4MzLma+8wZrcd5QsTQADsCYyKC4eEP5uxLvtax5qu2WxiJG/0FWJKUTcnrnfTTpWPv2ULnTF3Hhnhdm9a0ejA5Cz8tx5YKxwjAkA== 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=e7KunMFjhHxjgzK5chsTGqMgZNatzcxoVsK/HYkR33M=; b=Lh6jd2bsB+SJtRwB2riKXShQBQgwMQ8vxICvd0b2aXUz9fHFowPxn1GtWwYpkI7mT7SpO3qAfrqEFPBojg2YjTBDhObvMSHL5/hwXM8HRECb7cEdQrXH9iCbGZPqA995xJkV/ftZofu0RdxsYCtLMrwgx/DLhiAF+FJEgCOV63Y= Received: from BY3PR03CA0030.namprd03.prod.outlook.com (2603:10b6:a03:39a::35) by IA0PR12MB8254.namprd12.prod.outlook.com (2603:10b6:208:408::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:45 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::be) by BY3PR03CA0030.outlook.office365.com (2603:10b6:a03:39a::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:44 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:42 -0600 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 v6 07/12] platform/x86: hfi: add online and offline callback support Date: Mon, 4 Nov 2024 11:54:02 -0600 Message-ID: <20241104175407.19546-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|IA0PR12MB8254:EE_ X-MS-Office365-Filtering-Correlation-Id: bbd38a14-13b3-4eb6-b1fa-08dcfcf9c44f 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?wscaMnVEa4FSypf16fM3NIJZSNsAeZxB9cxwOdSJyZtYtZpQwAdu7a3o0v2y?= =?us-ascii?Q?nmq7UDaJUWoFt7pEmjet7MOJYBTXED7pBzoStS8AVlQg7UHZ6cIXJN8wYWVb?= =?us-ascii?Q?nJPLXDoEFcHHqaYMTjFqEEhn3V36WBAzX55V80q1UV+SAdpvdT2CEPgscXIU?= =?us-ascii?Q?cvgdwPHo0tIaRONG8kFaE8B3NInqQJAyVOmlPHK2Zi4h7HfpVe5M9q9lcely?= =?us-ascii?Q?dRIHiYOXcBYJnZmHhDzLZd614IOpCt04eA01DiHWDZnD6AKmBLUf2lsZ5avQ?= =?us-ascii?Q?klsmKL1jSTWxpBquHYIvp/RL7zS0ZobLIeDQY5ugxAf98DPovd3iIhzC4j9P?= =?us-ascii?Q?QRRS/D8HZu2eu0RQWz4RnZaySOeoV5I0CaU/q6ZQ2fE1iLg8wo8K+ihOYeS1?= =?us-ascii?Q?2Mb5dSAWNcPbz6YVi+/z0bQYQzWv842Xt8+Jg1eYhKjkGnV5dYuyFbHr/2Cs?= =?us-ascii?Q?wN2bH58ED4rTuOLBfNHECxKiGpNqcShfk/LW2I0+wpHL0wvQZy2SHsOhjnjt?= =?us-ascii?Q?tEGSPiWlKlD+o4qLxQjna71xpQodrpbqN0nfF4wJny8mPoq8xS2GccEIYNfA?= =?us-ascii?Q?59hJd5/5I43/r8Hao7F7Bw1guJs5zCq1DQnLF1dkQE6fpKjS5TrYc83ymp86?= =?us-ascii?Q?upe8rQGiGy+LHi4PRQJw1V1Obvp5gwB/RMkB8Vc865eHKASp+gdr5xnIcDHs?= =?us-ascii?Q?OqJksRo1FFyf0Vk8ks8ngGZbuSop4cNrZCneCZis2XFTzdkgAvF5gy5WJ9+i?= =?us-ascii?Q?Eh7l7QsTJhqxQXaupJMp1OyERMhha3OFycsyFS43pl4DCQIRIzNrHBxNCvS0?= =?us-ascii?Q?14ruryVT93Y3Owy8+1P9Q3SgRTzE5ADtdbWnOPEI4vyXTPQKgikDaYchA20Z?= =?us-ascii?Q?JHBovOmRm4/OYx8Pr85YbI78Ok0PpiAVdUQjk/o3z4dKFaiAjt7JSFzr1Z4i?= =?us-ascii?Q?9pDqdSALs5/aOWxGbg9LR3tZxBLIZOnTlgDgmvF+0xwParVp+ZVrEZBMbmgH?= =?us-ascii?Q?xbTjRV/FP15SbC4Q0jm8vDFPb9DR25BIEeE9dl3DHfbrr4UmispBK7PE7WUH?= =?us-ascii?Q?9eg2SjxN1vtiZdUokvMIl6up5kwH15WyeottueK3h9eHkvMCME4jRJVHmJLs?= =?us-ascii?Q?aOXgYp66U03Z1+QObYWA0cUnpph/a30DIp5VldiOZbJ3KZZUc1E3I9gi136I?= =?us-ascii?Q?QnnugwsELh79CFMjhaFbxc2Hv0p+P6czoP9OEE5OwNuPgo7J35WDo1RRlR7/?= =?us-ascii?Q?w46ojtMVujjjiBqPxLRnBkRtFhRoQqr6hDR/QVPITmo99Mc3UP3QmSQm4WEA?= =?us-ascii?Q?tUm3wiUyP4bITsCRHUGqTFQrX1P1UW69asjZKRjKS9Jx4MycNp39X3398uU4?= =?us-ascii?Q?/aQCFqlVNF5lC/+O4t8iXtVznxt0mxdyoyj01PT/Sd12KIGnWA=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: 04 Nov 2024 17:54:44.8818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bbd38a14-13b3-4eb6-b1fa-08dcfcf9c44f 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8254 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 9bdd9d9a615b8..cb85a538f8168 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -237,6 +237,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; @@ -342,6 +416,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 Sun Nov 24 14:52:22 2024 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2065.outbound.protection.outlook.com [40.107.223.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76F0B1D0942; Mon, 4 Nov 2024 17:54:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742894; cv=fail; b=TnnnOGmVHm31WZyoLRosfz9jiD6VRfDDrLGC4IGsp9Q1ybxkybQ6dZ5dkNU8W64+8DD9vAPvNxEeRRn4KIVVxaIudW7Bpf+szmLTC3V5+I5UX8Cw05ivOtNZQeIJO6FWjGOdXm9Psk57NhHojgotRsZk6gfzMckt8yBSxSkF3l4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742894; c=relaxed/simple; bh=bDvR2K+f+PYR+6MKtv6xsvrS0eo/npy4A7OJFqB4JgE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qx2drOAKyLAfu7dimd1qd7CtVUW/+rtaRYgVQbhFRpkzGKmKhZVW4fh9uRuOjDOxJW70SaV+YTJ1DQHjAKO0fbg2ak1x1y0L94cM2kPsp+8SN6KMa2FKDXgJroOR9oXZTq47aFiB8R/FhC8ZLPDcsfRn43eO0tJQcoJnVENSdIc= 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=qwEmFDCL; arc=fail smtp.client-ip=40.107.223.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="qwEmFDCL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sl1CV5CHF0QH3r1Rktqbb2z43I1zLDEQSnKgr5NoJ1xoNDPgLFbivBjPFqBNyKX90FYRxWsLHzqCM/uBjHj1gxhBPLrfF01a0+07G3zxT+3a6JhWsgFzz7+jtgsPV1+Q9Qg/hJKo1kX0p8v6/qR0LMxWIH9Ax2DNa9zuFi42AnjNZeu+TgqwzixY8sHXXxgrTDhwxHll3BStxjiXE1cvL++tWXsx6/Wg2wCdnNDaRL2PiL4v/4rvp2yJoc6Aoa44+/zrdnipSbklJ+bHBTyZO+AKVilNfZaRVwwBRtfgKO4NB81vSQ70lUKCnn2xYSjGyz1jZZ1ZYSxg5oH2IPU0hw== 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=NWs5FEGQqUd8GyhxRRXB4i4dUwFwI3nWbIVa2kBnoxo=; b=BLZIBFg8r6P5gpa9mPIRCsLIq2UZ8M1mtpML2P4fm2PagxG5WDmB9KgMEMHA23dEpiiRFf0rosaxq8GM1tRigLQAbpAdDKeG7YaMxlgWDc/sQCGxLOdJaDM7Ii67+oMT62cKpwhNFKKJxzSE+K7fhE5rPt8pZTz6Ik4nz52h3S1TqHh91leNHrVoBgm/y2NBUwIJK+AeFx0dbyJL34zKq1iwdeUa8CtDtp1pEcnzzVffIjMw5DRV0uzX+TzIlEBMoqEPaePorLVM9sQDE1sVTXB2+md8NZGpvndGS/jljzHx9c3DaHK3d6A0xybxlVS0FaJ3CKkzMMS/Q9jaT8DU9Q== 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=NWs5FEGQqUd8GyhxRRXB4i4dUwFwI3nWbIVa2kBnoxo=; b=qwEmFDCLXJ3EzRDeHSwCfOpOhUa2YXBnAmEvwARo7LTAVa0k0d9+zZGy9o7K/nlReMAYeQiS9Y6nbjSAaM1ypSHFMJgmDtrsdggMPDCf4UmRRwf/IPr2r/uBGq+6I4xHDwnveNkRkCmtXUh2Pq6nKmgaQ5wKC4dLoTcoJBTjCas= Received: from BY3PR03CA0006.namprd03.prod.outlook.com (2603:10b6:a03:39a::11) by CY5PR12MB6551.namprd12.prod.outlook.com (2603:10b6:930:41::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:48 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::fc) by BY3PR03CA0006.outlook.office365.com (2603:10b6:a03:39a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:46 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:43 -0600 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 v6 08/12] platform/x86: hfi: add power management callback Date: Mon, 4 Nov 2024 11:54:03 -0600 Message-ID: <20241104175407.19546-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|CY5PR12MB6551:EE_ X-MS-Office365-Filtering-Correlation-Id: 846245ec-8538-4465-0b5c-08dcfcf9c52b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hrQ2xPu7bdsRepSG8pQ09fqTjCHz1eWEiAHIY2Tzf3CcvTquaxbXijGRio+v?= =?us-ascii?Q?bc9GDTRw0Xv7QxehgZ48akLbIqpcFAIAhwQzfMX9lChsKbbF78PBMTqr3RQ/?= =?us-ascii?Q?xX7K1dVJ7/xoFMhTikb+vSdkNAJaz1sQBajjDo3SkFcyHH4UQDMSoUJtw+ih?= =?us-ascii?Q?rLzqPYfPQ1Q+moNfJcyRjCYSXevkqWpde77MNLzXYSYFn1tssSHmDDA8uegX?= =?us-ascii?Q?RVG373F/95mjehAFSFr4VHLJTVPGccznfivUwVGRsNSXoc5rwJQdujH4u48Y?= =?us-ascii?Q?4X3tmENbI2G1Mzf2XlTdnqiEhaPEdJ1CORUZxQ5zMaaoECb2rf0msNrJQGCd?= =?us-ascii?Q?U9d8UTl/UO+XYKHFlarIgT4p+8SfnFLu8DflXX2DxYwqcuvzyKy8wAJk7Ktv?= =?us-ascii?Q?wqd7d18BAdTLI29/3J0KklgQ37Ps3EgfdTMuG+78SG34B2OJG1UTdAoTQ5Ag?= =?us-ascii?Q?/kNurGBM0a1qaPpZ3agTG51pT+jU4kbJpoBIhiONT7p4SPvBtIU9opXyd1Yc?= =?us-ascii?Q?TQjEKZk8JPjUpl2ucg2V78dJtKXubnox+d/vXZaqSGumCLk6KcEaGZlKTMc6?= =?us-ascii?Q?cocL2kDKnQmjtKm2ZCKKC1VMdV4iNHwfIXieY3axPUvB/XV+0gDeCvJyjRvg?= =?us-ascii?Q?6PoF1Ew1G5r1AnU03jaHlKeqrX0sJcwuCRCxNkVDNqPBHa57mlbCc4rjC8g/?= =?us-ascii?Q?xo2iJq+gxX9IcXQuvYgbaSNGPJIK0kg3qDgkzAs6isApF/WkSeUHMRIZX1WB?= =?us-ascii?Q?Kq82sXyr6HYOVug4s0N0uHL1FxesiC6EGJvZ//kiKSelbzrReaT8KzcxT9nO?= =?us-ascii?Q?Uz9KOb6w3FobYxE5JPBIvquZ3BO8K1s+T6NS2slRAS8GZ50Rt/7ce5MH/rwt?= =?us-ascii?Q?y9beL81LuRJG6riPvAC41vrc49SRzO5HGJVzh94FQyJky2oM16zAphtAUjHs?= =?us-ascii?Q?LABhlhKi52TmmlI8qJMiFPUl6jhGIKFIrRIQteinKBilyjD60zT+o9xxnT9E?= =?us-ascii?Q?wiAQ4PTg1KzVykOHLtXprZ64n8wogjXiLwIRH9LErqhSQwKxukr13kbRD2Re?= =?us-ascii?Q?PzDNB4305c+5Z8F4aVgg6o/JIuc+FAksedk2HylNn94QoBOv2+lUhUUcltdg?= =?us-ascii?Q?KS8Pi6A3N3nt2wF34Rj2IBsT64T1ujhjBkwb4ZYal+h+QJ156c6Xef6lWtST?= =?us-ascii?Q?8c4jToF5kPIInJOF5FYUkcSLgpOOjEyNRJ+p8I4dkr5fF9Oyfd+M0dBjhnkK?= =?us-ascii?Q?2Z6UQotOywWeF785Q4ReBTOfDM9ND8vgiiope6OEtzTZPdcl63d15JeoDaat?= =?us-ascii?Q?luWsuaFiKOcDd3pI9sS5uAwa5WsODJ2+5TE7y5SNdMQEJ4hNjZAs3nzXBtbQ?= =?us-ascii?Q?o8Q7HLEW4U/ZtE86CarWNP3Za8ZHOFN7h7EP2vk8xy/4fD2d+A=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)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:46.3819 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 846245ec-8538-4465-0b5c-08dcfcf9c52b 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6551 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 cb85a538f8168..cef6aa84bd85e 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -380,6 +380,38 @@ static int amd_hfi_metadata_parser(struct platform_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}, { } @@ -428,6 +460,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 Sun Nov 24 14:52:22 2024 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2058.outbound.protection.outlook.com [40.107.212.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 BC2A91D0BA0; Mon, 4 Nov 2024 17:54:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742894; cv=fail; b=PAtnGvcszk5ljFjbAsQZ98XojJVtJtnSAKnPpZVP3pdRhHSb4UDljt9iRCtSDxnhQK168FGvVFh3DGA4DhzIGHHfTJkahd9NVC4fLI54PuZoi17j/b6K0sBCi43wEg3p+cMqEmbGLzs6+Nx5eeEljWqbaXLh/ok39EEW4RPnsa0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742894; c=relaxed/simple; bh=5QgUYLv++5zqWsxvn/X9o+oB/2GdwFu097Mfhex4vh8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZeQNooEDHgLnNjKbJJ/p9mJ1kD3HKVaw0YKFJ+xH/MdbEYACtUYtGkXBqH2orZBjQiICEHJBFt4/R136C5LAlzH/mhz/LynRyUVhTCGIk9+COa1IeNI3qqCsPI4INgdzSakpDgZIfXAUitBRy2iC/9RHDsWWp/KGXO6b1OvHntc= 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=gXTK84te; arc=fail smtp.client-ip=40.107.212.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="gXTK84te" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HyfVe/wUYiTYCSSRpVuGHec45O/oLIFqMwpqtRlkXY997//aRlPGBX4oijD2jgUMj87Lybt/JzHxTgcN7L58rrr+p8xsx06zL1ll01AAiAHiaB/0AXu39+AIs5E65zfTrHt+xwXG/TJHwRh9ioJ+kwQqe627qOzw2RBZ451sofkiLgf39RBX5qvTUJNL5/tOfkMif0T6eJMaxETynJ8cUf/0pwtwG5F28cRDJ1uvOcwKKQ5ZWWGpuFj/CfCS27w+H7rizKj/j7nXzKTgal3D1rVrxrngay25tAOPc5HwcK7UIrRCQNnkmBdmqeZ1BcBkTIVtHr4QHUiPg2m9geAzYw== 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=7/ZtqGfcR+U/0WNCwGtvpXPNgpS7lRuljENyAtOv9is=; b=I1W/vM//iKIVz6lj4F9se6/w1566WeL+MOrWGwSRQxR65Qd/IsKE8uR0M6f0PS/Ptso+oJVzaqhOTHernbC8u2g1us5d8RYANBncUZOlJ7qlGs6kvAUbKZl+zIqXSbKCIPzUnRMo4mme7k/9e7LZY9HLqRzFgG9qUPo/rfqRxVB+6Ls7MShHQmD5xJ/gYn57P6nBcZKj6qW0zdAYmDIgqSShUGjBRIJKqCxWOnaGNe41b4aldOeApJz6eYiH3dGn7T+czsc7ekMP77Eng/JQdYXbNu0bSEVtiHiyWj5J58F3TA2+NFRqRig6Lxsz22IjxHJlYKOj0H64wRFGIV5oAw== 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=7/ZtqGfcR+U/0WNCwGtvpXPNgpS7lRuljENyAtOv9is=; b=gXTK84teordFnRJhRWFVOMUIZBm2Bg+iIgBVG+utdxui+GNgXmMXTkK2LoSImcy3B8j0xtnIosEiLteP0X1T2rmx2cQZWnjbiYPPbc6Rumi33VeXNyd2ZXVr7RiFUiGm2V3MIQt1T8T5GzszDLafzycoXfVnbflXXqHzFyfvD/s= Received: from BY3PR03CA0013.namprd03.prod.outlook.com (2603:10b6:a03:39a::18) by SA0PR12MB7464.namprd12.prod.outlook.com (2603:10b6:806:24b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:49 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::b) by BY3PR03CA0013.outlook.office365.com (2603:10b6:a03:39a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:48 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:43 -0600 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 v6 09/12] x86/process: Clear hardware feedback history for AMD processors Date: Mon, 4 Nov 2024 11:54:04 -0600 Message-ID: <20241104175407.19546-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|SA0PR12MB7464:EE_ X-MS-Office365-Filtering-Correlation-Id: 426026ec-ba40-43c0-adeb-08dcfcf9c690 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?Ydc6xCSzCHICID9q0XXgAgkWFhfr7bqpuwECWq3TghETtVW2DhPs5ZoOYuDM?= =?us-ascii?Q?cNrqM/h8hwaWbQ0lhJ2RlpF6nRvSNMCB44nBF0rGs+o1Kik714Qwsk5J0DPs?= =?us-ascii?Q?SGnt7fT905lVXFfA3kRA4c3n3Zw4hHLdUfikTEwoTdSsUDzyWTN3q1AJ51Hh?= =?us-ascii?Q?tJAOk/N9OvszqbSyCX2tjG1IJhgKY+ZCafDELdVm2L7R23Eu03d+jZmFVJIT?= =?us-ascii?Q?t3v07j5zCsLKP3KtzYMwC9BgMj+oNIZx9IhE5WOufwwWkYEQotUhJ1YRXdVY?= =?us-ascii?Q?Fd9lcE7XfROUSPNMpsArWfUE4CeTr20K9qfzZfMV1RCqVtDt6xueXFb3xVdc?= =?us-ascii?Q?EC4+OZX1RgWDEEnxUwQYqtrEv075AJIvlugeYk+KTzhte7mZzcudtgzkVsgg?= =?us-ascii?Q?/dDPklQcidxLidTKV/fXgX5k6gPKB9tjTE7bMQSwyb5SPKzwqM1YqOpjTbwv?= =?us-ascii?Q?mfSxmznl8W4vGo3zevvw9Chz2uzxHaG26085mBj49zsXwL9ZkbYhYMS5DaAV?= =?us-ascii?Q?EJ3glyCkhfQ6mEQ+OAUFgQpWXBwJ7HbpmlRe88+PWUOTRj/WL12ZUltPm0Px?= =?us-ascii?Q?tUMTMII1T4dD6go2l37nemNmgyeu4+mMbd4eZIm50JEDccjPsRNGE+Ubx3Vk?= =?us-ascii?Q?9jDi2O2qU/2+Z8DITiYWbST6EjqlEchS+jiI4AI6uW0FiyEjqhIbjcoy3UK0?= =?us-ascii?Q?sj7qNStRSMDIv0psQiWZWokv2tpbMxcWGHAX+OAps43aPUwciwkbsq0S2bCj?= =?us-ascii?Q?3RFWdvny2Lt45UMYXFrZj++QZT5+539hfw4gCLXt9fF3gp8+x3Rz6jc4qKBI?= =?us-ascii?Q?pBnTgQ0E+2JCTvJjOcEiIix82StewAU0UjhnC7pW5+WsmJIi2snL2izfPJck?= =?us-ascii?Q?Aphlfc1XDDd4nXb7Stb/cc4/Cgx8f4czOIluF+bU/mSwZj3Gu65gZUY7elQb?= =?us-ascii?Q?aK+6hr8H055IwoYSi2FTXRpn05f7e8UWn38TwxNBg/flyC25evAowDA0OPjj?= =?us-ascii?Q?4Bq7p2eCsC20l31Jf52rMcCk6x/VylmUJSK5/r/FkoN55rHG3dv7vFZa9YHx?= =?us-ascii?Q?QgywDbYn1rYvljS68Tg+dwr6V6snqIRvr4ePmaxECSNkw4Kydu0Be4ifXrkG?= =?us-ascii?Q?Eyu7wZr+9QwfC6T2Vl8X6lWTXSF+YGk6yd0lpIUB+0JkJ8qiST+szkfcPNPj?= =?us-ascii?Q?Jx2XIpwnZsNFNh4uAy4hM+vhhXBcPVvKpwgf639evWNfm7ZhtedJgdsYbilS?= =?us-ascii?Q?fdkMPiPZNjs6bbpQadJvEkaq5cUp/20SQqQ+DU7RKDHDykXrjkm1lMUys+dV?= =?us-ascii?Q?ol6JugVfHpixKoMHKgGug1Pb0IDPfN7eU2gPPJyqEB5jFINNvgeF4gW3IJHq?= =?us-ascii?Q?eX1UJoBTxNa+EoMzblS8YL5hiIxISm41cDvx/AlK0aDl3TBHnA=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: 04 Nov 2024 17:54:48.6631 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 426026ec-ba40-43c0-adeb-08dcfcf9c690 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7464 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 --- v6: * Drop all static key stuff and just call in __switch_to when cpu feature enabled (Boris) --- arch/x86/kernel/process_32.c | 4 ++++ arch/x86/kernel/process_64.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 0917c7f25720b..0bb6391b9089b 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -213,6 +213,10 @@ __switch_to(struct task_struct *prev_p, struct task_st= ruct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); =20 + /* Reset hw history on AMD CPUs */ + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); + return prev_p; } =20 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 226472332a70d..371e0e8f987fa 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -709,6 +709,10 @@ __switch_to(struct task_struct *prev_p, struct task_st= ruct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); =20 + /* Reset hw history on AMD CPUs */ + if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); + return prev_p; } =20 --=20 2.43.0 From nobody Sun Nov 24 14:52:22 2024 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.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 A02AD1D1E8E; Mon, 4 Nov 2024 17:54:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742897; cv=fail; b=E7vEPb/1aIbZ2DZxwQYPrgANT8uhY1bIKEEU2HkHkwFiiu87Gluf4u8h+i/6iPGtF66I+ql8AWC0R6FbKT4Aj4tkdkP6OKXK5zqioQUYnA6LfFRmYsCLeB5H2d2URTWnLgBIzOrBLAvLGJNOf/BB/MXcJp6T07Pnp77yGLmcTww= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742897; c=relaxed/simple; bh=10H316tACHv9yeq3U6t3bQxdz2Rbs/5sYYPeNWMmITY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p6fZ7LjXmqgMkQUW+r2ksGsrmL1YMnWgu9UAu09rvZuZGZPvzs2Bh8bX/5ogP/w0WS1BB/phzjWE3oRKAtgTFUVtzHpufsnDYgvCXbdGxRuAg6i1c3hrRYHAVY5heMDjQjOjShijdjZcjvEoszcDSQBS8eOoAgBF9qWsPtIuuPI= 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=C3m9dWgJ; arc=fail smtp.client-ip=40.107.244.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="C3m9dWgJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gFhN57YT3dSSjgbL46CGXmrVXeteetPYHA4wfLdiQIbEYEdFFyVS3xfViOl+1dE6TsqL2jt4RZZ0SKXR1bXIvbdp2XYgWt0yWVn53ds4bAlgX9+xBnjdLkhi80MWL4AK/EGpJsVKzKMn/FZm+5rq2V2vd18X9a5MBvv9Aud3aslKvnhO5enOKlvOJZbkG+5NGzcWIIHyvMer6EWUl3mQf/5I0ev4jOqmjQHTh5EKcDNVquWHwnJzNOilIlAWZGk1wrIEdpFOLm0hUOxA0WDaamyQ/5KG3IibBQ8PF7dThFYbKHp0GzDqHJiXo/yvQDeoS1sCJTzKgAQZ7b2dp6TcTA== 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=esECsZTZzmpe+mXpfNUyZtWMv9UTjO2lrfk4s3FUxX0=; b=bpBEr6Rm5NyNUb1YySxKnv6o92+hN054Te32dhiUhdp/Rwo/NzXtRXvil2jyEy4k7QlfxnmKlYxn8cIK6erjIWsn6go8rg9Xja1FeQcQOVKhPIwqtxbxZNlX0IXkNVPleyqN4MFxgSvrihg89X7YM5DLqnuJOZm5+fSvTdboaVPtKvSIPSf49tvTd//Kv9+o6QgH+d5a3oIjIeF7qHRejll3+y8p5RuAqLs4f/YBKjPTAotttRHKtdg/wqiiywPAdGYasXP6AIsP08IbqYiTgeJXotZzhiMmgRnHacyh7u9D7r5LiAPCvzZ5ra5qEeBt8Ouh5WGz1rG4LqgXgCmr9g== 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=esECsZTZzmpe+mXpfNUyZtWMv9UTjO2lrfk4s3FUxX0=; b=C3m9dWgJ03ae8PS3abz8tTY3Uff1yZVWV1NAyKzhx3MwFG9UnnCKibcRCnZGcQq3KpQeEF1fbPMgC7S30Dw1qfnDdpPeKx4646YVscwo/LQENAFxWA+heQ0E1q3kGuUMk5De7xQLtk7v28vyr+SO4UTGTYtdAWpqA2ppH47brNk= Received: from BY3PR03CA0025.namprd03.prod.outlook.com (2603:10b6:a03:39a::30) by BY5PR12MB4212.namprd12.prod.outlook.com (2603:10b6:a03:202::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:49 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::d9) by BY3PR03CA0025.outlook.office365.com (2603:10b6:a03:39a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:49 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:44 -0600 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 v6 10/12] cpufreq/amd-pstate: Disable preferred cores on designs with workload classification Date: Mon, 4 Nov 2024 11:54:05 -0600 Message-ID: <20241104175407.19546-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|BY5PR12MB4212:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f5d05bb-9fd4-4c00-f70a-08dcfcf9c71a 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?I9B2Wt5CceGHO6bv4gYlinzOyPNGRQRH2+k2RacPrT53AlWyKRw2LvsXXzvL?= =?us-ascii?Q?wRNlvi0lv/83TqubP/2YSAb1ed3ftqhoShaqXl2RdMZuqVnxaZ5ByjqKgckk?= =?us-ascii?Q?KFkpTRRZ2bKMywalftQXUjUcdd7sag+qBUaPFZj4Hy9FYKuOAsqWMCaQ3gOO?= =?us-ascii?Q?VIKjbO/434NQcpXbSx3zr1jq3iYwv8Li2HGQJtZ1dsM2t3YCLgMNCwFC/RbS?= =?us-ascii?Q?CkBmN28le3KKie1C6u3oKG+ktmLD/oddBUz3GxDt3tNB8gm96IsHGWOz0GFC?= =?us-ascii?Q?hBl2DOkEjm9DjixieBPZGAtBh70vGwfh68N2MGfcRlSIrcSADqmdwOMrjsrM?= =?us-ascii?Q?ZjTBnH/jFPCD4CcOfWuyfNgYRg74+svxVyT1nmYqAYNEeT77aGJdgZO831/m?= =?us-ascii?Q?sYkdGtnGOiFYvg/hd3O36K8KNCRmQb8AXLHvk3EvusvpndokCpsPolER1HKe?= =?us-ascii?Q?t4Z1Wk2Atq6YSDmecLNayquIM06VHoHd8SX5p0TLw8J5dSl+ZiYIYDjQcrYi?= =?us-ascii?Q?0XCUcs+m26V4SVzvR2jM8mYbcgMYI8hQVmwJY8sjI6HLPd4fHc5/QXt6sfNj?= =?us-ascii?Q?f05Lt10mUsvtW8LedM5avQyM8xz6t4cDDYWJvAoUVwx3dvQbZVAdjfTdqVNj?= =?us-ascii?Q?CQPdp+ZBotbJEUOk72uA67802xRlqjl68pnWsLUBbrZcPWRbkPoa11ghq4QN?= =?us-ascii?Q?lDKsZXggTPzjXL3uDSKKjth1xOOOMuUePXtLFyE7zFD7f1bGsNCz5sV42vnh?= =?us-ascii?Q?DMFspXO85T2829Gd3xyt1MgZd7zIYFvNxMg0WKOKVRCKhtEPtb893hude7Sz?= =?us-ascii?Q?ln1jchsAbKiIGsojGYN+1AMIKUKH/GoSyhG/+1V3Qp5yvnCPt+pG8nC8P/pu?= =?us-ascii?Q?ASvimMg2xTQoIUcVXNszYawSK37jngQm6nW+Z6KQqwcPAvi6gxPsxM9JPT6n?= =?us-ascii?Q?m7ws9dsy8DWxCHNUo424sbCk+2mYMQrg1HIJ91r+wn9EOfr7rYqIkzIG0GCf?= =?us-ascii?Q?SILBpguXCwIOF1UHRUR8xJ/Q1SpngEx+4tJqTDZ5iXuQLT0vKKyDC+dM9vDy?= =?us-ascii?Q?FHApMxFFpWq2Ki7WiMpFC+cNq8wRQMjOX88dlrzTZg5k7vEkeh+SOxppM2Ae?= =?us-ascii?Q?YHBNvcphP/f5eCB4xhy2Zo0tWPI0MhraIDwn7JlZ1WfuAL2apcsvGg7eCve+?= =?us-ascii?Q?aoDFMC6y8EBOkpcWfmT4oJaJvam+vq7coAoA/PkBtkukpdY9Izx96PqfEZDl?= =?us-ascii?Q?mjdbezX/Pqbira+BUr5FXDU5G7EKXhZxs+kgDExx4NQSYc4FBFdNp40I+kO1?= =?us-ascii?Q?vtKHN2qv6mG25kPHL8mnNjgsqJvKR2Qi6TQIw95uml6oupvCB/PKUXxSC34n?= =?us-ascii?Q?0j1WAGcWYdYHOe2gWkbdwJlchuzb/G386SUN1mXk0D2tqaHkiA=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: 04 Nov 2024 17:54:49.5694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f5d05bb-9fd4-4c00-f70a-08dcfcf9c71a 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4212 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 Reviewed-by: Perry Yuan Signed-off-by: Mario Limonciello --- v6: * Use cpu_feature_enabled --- 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..84840666f1d3e 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 (cpu_feature_enabled(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 Sun Nov 24 14:52:22 2024 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2084.outbound.protection.outlook.com [40.107.236.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5FFD1D173E; Mon, 4 Nov 2024 17:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742896; cv=fail; b=FlTgwzzirFk3/1v1E2Enoz96c6yaSWbkK7HXXyapgD7RhTwl/8ZFJ7SSaNom/FNvknd9ina5c9cujme+sYCM0Q2BabmUmXJJGwGgsyo6PCxqbwbr3h5aRN8vCbxZSuj6aRDbn4dYOb3p6z9/2LQ7grW6crNvi2WhvUeNND6YXqY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742896; c=relaxed/simple; bh=HUwctRrds1tf6FMB+v0b8kBmsw1qxyTR1Ve3yh0HTaE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PwaafgCqSEJ+Iog/YSJT/HNodvB8ileDVAG4+K4rj/x1sbxmWhQMDdlU+VibIFUVBrUfRr+IHb61Or+rhURy0hxzevfa135McoIiFRyCM2x97tSDT+1/iYw4umJBLEVlgIiTR6NBT58Mksb1+lsgJik5ZaC02MaALbXmhYSdhOI= 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=rSo48iHW; arc=fail smtp.client-ip=40.107.236.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="rSo48iHW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CUjEVJo4VbZGHoMqGCNAVfHSt0uGBYTTB0tPJmUDWw1ybu53HoCPQicxQUCuGYjaiHbq8jZ7VdxSmU2c1IcYeGt9jIYFt4Sx9Q19FuZ5k+fFZnv1uT1b2GTkIu2RCPnZhY9BAn8eXCiM1uk+v9vMQcTS1C3NZHocgi6dZ6Oakx0PmUA79zYv6+/C8fURZ+kIkfm2FrZjuzQ5jD/5mMSzvq5NrH8a2hRfp2Dp++n955pRN8fkk3KjzTNMRjK1tXzy4+y2auUKMbfkrIms7+b92nI3urV/HdQNScNvB/xCGCQWFplGRN5oj+trayzPkEuuTtA9SQAl+pXUrg6Qt5zC8w== 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=FdX9qPVfi9PzCLqtqgVMNGtMH6DibVFFwW20tp2VzLY=; b=vX57CBTrQWSEEnwlSJmTP5XjrEiz+zoI+VFKuUBL4qPquLCn5JPbqoPUEDT1In6TwivAtVJLNl3omBacaRyh8USdB6OJxJCSU1UzMzVGgUk081hR70wwddUBGjweAyjQLWEe3s9C7KlozJ3KMWQ6ulT1CFnkpZLlcKDNfUsqMNpvmPIibuhPYSlSnFD1AVDn5zP0Cdr8UZMxFAqfYPpyO5Cl42VEzUwuaaEXwYCTB0VX29UjmbB1OjX5cFiXTzNoWUsBWYM+2CJxNZZ5/mXnKW+mTftUmli3ARrgA1meX0Q66aCH7NaI1Q+AW2L8ms0M2KO63ZUKFCM5Pe+8WAc9+g== 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=FdX9qPVfi9PzCLqtqgVMNGtMH6DibVFFwW20tp2VzLY=; b=rSo48iHWlqXD/2oR1Wz9/oyVukg/wzQKX6KY0dBZpI+EJ6gwe5erIUQ1A/aMsLtq/mEjWOl5Yh613jSmhHjwJAxDtsitKCmSJoQt2hS5USDT+OAzR2SftWhl01h+BPVhfKUDJWjZspcKZZo3/btv8VwEWWV6Lu6ZSvI9eBTjrx4= Received: from BY3PR03CA0005.namprd03.prod.outlook.com (2603:10b6:a03:39a::10) by PH7PR12MB7968.namprd12.prod.outlook.com (2603:10b6:510:272::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:50 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::f4) by BY3PR03CA0005.outlook.office365.com (2603:10b6:a03:39a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:50 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:44 -0600 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 v6 11/12] platform/x86/amd: hfi: Set ITMT priority from ranking data Date: Mon, 4 Nov 2024 11:54:06 -0600 Message-ID: <20241104175407.19546-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|PH7PR12MB7968:EE_ X-MS-Office365-Filtering-Correlation-Id: d8de2f22-52ee-4bb2-0746-08dcfcf9c76c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?suZauJVZ+FPD8E7xPCi6xsfJ6j7Sk0pX085AHT9S+mj8r6yRefVilVncmqlo?= =?us-ascii?Q?xP1foIdDEVShk0UhmC4lpbTgjAnY8TvUsMT80IyNJzipod8rLzgNhXQ4ZnOn?= =?us-ascii?Q?K198ts21bx65JyzxCnqQLp1ynI6cCtKushufisR5SkN6LxGfkIBeha3xUL/U?= =?us-ascii?Q?7bMqgNp2UiUYpBh5vw/E7k7I4WYdMLTI0uTO9GcVbPTcDVk/YV607CBsguUT?= =?us-ascii?Q?Pg30P2DDWnER2HPyd4A1IL+PSL0YE8VUMy372P0JidXM5oddxYPaioxKGnso?= =?us-ascii?Q?8BmkjFLLXmDcO8jGNcpqUykYq9+ikaPyFrMe6Ms7tVXVY1EG0Q2+LY9vkuoj?= =?us-ascii?Q?dFGHsLrp+Lq1LecSmCuzYnx5O+aeB/AGreGv7YbZv4YinsV5TAM2hZ239YAL?= =?us-ascii?Q?guJdYfxBsoICiUZrrxwOTstb+HjBKk0sSln2cYBOVbqtSy83qe5ocRGvTjnU?= =?us-ascii?Q?AHnyclrSyoovlMTeMV1/r98TXuAO/2DYKKAlkZfiiS4C9AnTVfKvhogrIc7s?= =?us-ascii?Q?R3BsHYLSpzaTfr7ax3nkfJrkfriwILxKCKQPQTunTgt/4YaJkZgVoy90zXWb?= =?us-ascii?Q?Gl/TkRM+tn6UNscTQNDuEX+9dMs375SnxA44wuFO70q4lIWYJ7oICeBABHtj?= =?us-ascii?Q?gvpfJtLPXDKkdh7NIkQXSK/J8fbrrIHtBhaXE3PX+93mrpvYcmrmPTuTnqib?= =?us-ascii?Q?c/34F3bD9jbiREXd2x/62MTq5aRJpdyke1gXee6avqBYCAPrLry0vgwH3NkN?= =?us-ascii?Q?tB2cpbb8SdkEMhOy+ZsTNXUVkKeDWUDP2keB8n5eTnYW4TK1NGSdu15bPKxk?= =?us-ascii?Q?j6M2fVouLVw6gvJmRYU5Sz8jIlk14Ixx3IT0fIcUwr8Yt8dlA0a+3PSFQ0zP?= =?us-ascii?Q?2V4Zel3BjZHxFxL3Jx1y/gMU9CsbX39PNRnh2S4ksk5+mCdIIKcbRiY48RRO?= =?us-ascii?Q?HLLtu2n3oByBU1Hw6+18pl1gw6TYvTBHFosBy8+kZbcMMWqhEOMOCbUPjx1v?= =?us-ascii?Q?o8bLaJIrh51I1DNZ4nJjQia4dPimNgA2TM+v63BpQoUrGYUugUd7/TlhS4ab?= =?us-ascii?Q?CtixvmhSRtMK3VYY3rYjIuG32ln/vFcrTItFpGKnZzvu6jmQQe/4nXCuS4QR?= =?us-ascii?Q?y5crcklXRvHPUZvCEan31u/z/MdsF9WoDUPL+zCSSkpZlx/UoGPch2YPEZoF?= =?us-ascii?Q?W3DH/uzt0cBD3U8TAwwkFO6umaeJwYIg/+ODLxe+1+pPzCu8n4i9d8tAFYXp?= =?us-ascii?Q?46Vf8lRnCARr9ZDuvNq0MegH4LRS62+v1VlB5qWtE1qmjBigQyCLV/3iWE3j?= =?us-ascii?Q?x6ehZ20p5qEdaL1N1nfPCkJCwH6wtPZn/3yjOoMxWnxmxd/2WTmRkLGloI0j?= =?us-ascii?Q?uB1b1mfX/71FMfTsw3osTR6Cjv52ST5W8+pqmVn+QKKyRbVwKg=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)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 17:54:50.1007 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8de2f22-52ee-4bb2-0746-08dcfcf9c76c 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7968 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 79e3b0073275c..5b7c2865f4aa9 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 cef6aa84bd85e..09905a354efdd 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -115,6 +115,12 @@ static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_= cpuinfo) =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; @@ -234,6 +240,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 @@ -453,6 +461,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 Sun Nov 24 14:52:22 2024 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2051.outbound.protection.outlook.com [40.107.96.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D47D1D1E79; Mon, 4 Nov 2024 17:54:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742897; cv=fail; b=qWw9q7oMzsg9jagQvnpOZHXNUp/0qSntONSl9wvLlAXglUVMdDj7ycmwgjx3+NZffMznwTR8e6v2rsYilKOx6Fo+oDQRlIQcwVa7yrFeiMklxRgeG2YZ8IECGOzll9B168S61Tyx6ZovTk+mrftW2ki2JfkrhsbvZhrrcDyoW74= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742897; c=relaxed/simple; bh=BGla9d8BjQvkYlOfJT0U6neqZ2x1lv21lAU57QkU7rk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m8KcNWrtVJ+EUDYg/HRjWj6UegC9ko5eD7emyLlEt6M0fCUvdX2Uh1KQdseqAgPj1sK6hCQEtfQ9COJ3Vw4jNlTnYVWwEuDkxuknsTkhPaYj4qA444jtGGUE7vIqmxJjvtoqqnN6fAB0MmxsL7JkVsl6E2dLP0GT9OCmDBuH5YE= 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=J0CWI0Pv; arc=fail smtp.client-ip=40.107.96.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="J0CWI0Pv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cyb9VpZL3BhIFhWzHFdkht6kbYOy6pAatNSASxAGSM3JGLKAcmrH74V3EbnRVs0qhoHvNKShiojRykDsaRVlGv030VUX3hY8uzxX67qqnS0VgAxBcHuS/X84opQ6/J5wKREiUAcFoqbYwvh4fNoTu1LOqhNatM9YGQk1VQoHn/5uoSFfIhxyzvDgqhn4+31LLiV/baKmSjb5wjc8QocSAbgJpTqfPIOeovSIXyVv3JKl9GBqtQ/Yv24dU6LaNCkcCa26A+ArFo5r+H3MBNJVVRXlhsechefHhOkLc3bfmEKhKPuG7c1KxbmfjebrsThm4Tij+/9Ku8HfhcWwYkamXg== 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=fe//duN24E6na7HtnCV895JdwLlEtIXMz6qZSJwdCao=; b=RGeg2rcuutuIYOeymCZnZrIDMwjD7tJFmDI/hRid8A11fSBjRgJfcKEljD8y3lxTk1NPhnUcu0C0aQnSvWZg8ic1eRiBhdquord6SKSCHs+f5BvO27eUO1xrqLlFkDs2BQtOD2+IzW9FhKxjMB83G721b1qe9hImazccynKdZYosTrZk/iT9ikTN+376jAikbsMGwPYAl6lc2u1UZ0fJarDIF1St8SZDU8tcmM8p8VIm328/CZRQBy40gcZl7P+wGRWObquVAzC/CRf6lxmJHCL/yiednihdt4N6uY91ZNDHeXb70zkSGWiqJqnfE1f+lRh1BkPWE6QPzzcsU3cSOQ== 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=fe//duN24E6na7HtnCV895JdwLlEtIXMz6qZSJwdCao=; b=J0CWI0Pv9O2SEYQFwOO4DJCoA2XeSmxsr81raNRS6MXD89XkHBOOsAQQjp9u+QG8ud5ANUtoqAYJfS7jjqMWv42oGXpCFn9pfueBEiQKeLnWFscOug7/CWpPUlSAl/oV5ZgnUXo2zRDxPgjCjzyKdWBqOAEP8rSZq24y9P9Lz64= Received: from BY3PR03CA0014.namprd03.prod.outlook.com (2603:10b6:a03:39a::19) by IA1PR12MB6386.namprd12.prod.outlook.com (2603:10b6:208:38a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 17:54:50 +0000 Received: from SJ1PEPF00002312.namprd03.prod.outlook.com (2603:10b6:a03:39a:cafe::d7) by BY3PR03CA0014.outlook.office365.com (2603:10b6:a03:39a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 17:54:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002312.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 17:54:50 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 4 Nov 2024 11:54:45 -0600 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 v6 12/12] platform/x86/amd: hfi: Add debugfs support Date: Mon, 4 Nov 2024 11:54:07 -0600 Message-ID: <20241104175407.19546-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241104175407.19546-1-mario.limonciello@amd.com> References: <20241104175407.19546-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002312:EE_|IA1PR12MB6386:EE_ X-MS-Office365-Filtering-Correlation-Id: 979fcc7a-23db-4826-f07a-08dcfcf9c7b5 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?1yk9PKVVNptE/trC+pckgYevm1qDQjHsWodHMwTGNQ5nJYGX2kxd4Llz2TfD?= =?us-ascii?Q?MoxEKoUrCZJZkZ25/j2C3zH4H8nNUfgiAO7TawoEEhzHGQFuVzAnjIgXygMi?= =?us-ascii?Q?MMPkhZ8MzkSwjgADQTbzC2I0i4zjBplQY/uDWkkvXmwFljO/UK+sFcCEbZEr?= =?us-ascii?Q?tZ/m/ytUjDZhdyOcDzYf/5u9IHtufT+5boCpt7UWCu4UCDwy1rumRy4/aLcq?= =?us-ascii?Q?gdgXXilINzhjrmoKy40FZPQlHZED6hh7Hw0ysvfw1wp+wmQzBtwOTJIiaONG?= =?us-ascii?Q?DVY6bw8LgvDWMXBtG8Etu4BGou3IG4lwg/E0etDFQE2en2ZSlANjYUA/PwNz?= =?us-ascii?Q?bXrIl+WkGr+Kem3z8c8p8VvpGgr9UTbdnqmp5Zmi5D0KlblG7BE1NtOIayzJ?= =?us-ascii?Q?7CfXC1Zy0nNIpFgJu8PmaHuIWjpMBgt6fXVHntAWKI/QE1iss18FLmPZYonY?= =?us-ascii?Q?GDrMz2Kh/dz3rDRL5lhueYIvKgR2Zd3QMn8NwWfvKFfcRyVq+1TkSL+BLdJ5?= =?us-ascii?Q?n4ddKMHnQ2E7bomalSbxFhAg0zvKG9j8LkDur3vfMcMSI7yghelevZbu5sUA?= =?us-ascii?Q?jIQD/qXydJ44crA14J/kTubgj05z/JBqSSeVlfopXFMq+c64YUHmwPF0md4Q?= =?us-ascii?Q?AHVfKHiXUGEyHJEtU03fYCmtD68rC4hFEgu2x3ZYsxJv/rewuCCmtHQze4JD?= =?us-ascii?Q?rGN5VOH26gTdtezTEYRh6Wo4gPWVzTrTrGTAyQGhdx1mOI1Gl/tgOpMmGqQ4?= =?us-ascii?Q?wel2VOrjoKNCkbD9ZjOszLqoYQQepBO5o87avTXcDIQv3HXePDRJ+FNQH8f0?= =?us-ascii?Q?fSAEUtP8MC8EcWWwW57kGJgWc79fwHc5ZavwLxDhL80iitrNINSqAt274Vd4?= =?us-ascii?Q?/akQFyEDY5cbrpSaNHzvD/GYletOum4tXo1OZcaC5CIJCEuEli7+bwYJ2aaH?= =?us-ascii?Q?OuryOPUbQq985vjie5Tq3CZgmSPf3kXcJt9VS/6QHXU/0tpq/v0UDRaDMhIy?= =?us-ascii?Q?0yr2h4MQyZokM2tuKt+pIRpenNAJBtskkBx3yxTiR+6ovic1SXpHUuCtDGEW?= =?us-ascii?Q?LnNR44ZSdCS8iPE3PnZu0IVfW512nqRfVrWJWNB+1cs9N98m1OqmOAXajQKh?= =?us-ascii?Q?UJzwuaaXokOu21nj5NeThAkM6wRjSGCsVB6Pg4KAwUtLq3GYeQVGoZztYrMD?= =?us-ascii?Q?BUh3d5mWIFg/0HJx25FEeRhs8V/ee9aw+vQahuo1r4DHGi5DYlZ3grMxD4KW?= =?us-ascii?Q?pYbO6x4O+Brsy+1e2qEGd9O8pYfgoEEyaDz4OspbcBUJElCN3ffVZ6HcgHXm?= =?us-ascii?Q?KKZBwyhPujYvyZ5lDAJTVwp+MmTbw5JOQNCarepzo+xdehhfh8fcm3dYu1Ad?= =?us-ascii?Q?ab0WB0/n56R108amdwv+l+VIfjvGwoF+r08l8HOa1FiCDkc9Lw=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: 04 Nov 2024 17:54:50.5851 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 979fcc7a-23db-4826-f07a-08dcfcf9c7b5 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: SJ1PEPF00002312.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6386 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 | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/= hfi/hfi.c index 09905a354efdd..840a6a277d062 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,8 @@ struct amd_hfi_data { void __iomem *pcc_comm_addr; struct acpi_subtable_header *pcct_entry; struct amd_shmem_info *shmem; + + struct dentry *dbgfs_dir; }; =20 /** @@ -234,6 +237,13 @@ static int amd_hfi_alloc_class_data(struct platform_de= vice *pdev) return 0; } =20 +static void amd_hfi_remove(struct platform_device *pdev) +{ + struct amd_hfi_data *dev =3D platform_get_drvdata(pdev); + + debugfs_remove_recursive(dev->dbgfs_dir); +} + static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int= cpu) { for (int i =3D 0; i < hfi_cpuinfo->nr_class; i++) @@ -388,6 +398,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; @@ -463,6 +494,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 @@ -474,6 +509,7 @@ static struct platform_driver amd_hfi_driver =3D { .acpi_match_table =3D ACPI_PTR(amd_hfi_platform_match), }, .probe =3D amd_hfi_probe, + .remove =3D amd_hfi_remove, }; =20 static int __init amd_hfi_init(void) --=20 2.43.0