From patchwork Tue Oct 15 21:36:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 836068 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2041.outbound.protection.outlook.com [40.107.92.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C101146A9B; Tue, 15 Oct 2024 21:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028250; cv=fail; b=PeOnKEAgPzcIAht9tUXyIjrKpImCDiSlkVST/01cqcJGdr7Kvb3V1VLwLMkmZux3PaEiVTL9uujQbDebpQEQVBPekZt0ftDJErbT9W0RvhKfAfV7ft17bF+Ui/7v6io2im0W8Umr/vfKQGR+uxVYSJ4b7CpTxd4ME7hve7kL2L4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028250; c=relaxed/simple; bh=JVaAMc3NKAH+ogx6hOMvRNIyg0m7Iq6iQcvdWQfixm4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CKchDi+VLKTYvfZo4Qzhe1USR9IGW2yUNpjIeQC+kUq+t55UEGnwPBWaEPgy70v2YpD9QIhdmzib36iRI+8mNInbQCG5R/KN+s1ui0kPlbnf4Jgsa7bhCuc1yelZrND8M/SRxIJUwvuJ+I0jiqV+ZX1T68WIsDi+OzgZxVRxU6Y= 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=Tru1rjIK; arc=fail smtp.client-ip=40.107.92.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Tru1rjIK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JhtxqDk3O7k6iZCPu1hDy18ctgtka4xOc+PbFFYybjXla0lSUnLgcITAV47hTURsnr6hEQPgO/xU4tdWqBcQ4EmsnOgA+mB1N02J1QGzOMGiVFBEikbHi19l4M2buqxJJzbrwX4HkuiA++Vbjg+v1LGWJH9S4X4m/M3o+mNxsZO97vXlfnx6BooqDoJPr2Ek1JxQ3l9/lXRbaS6j3IbTaNs6SmD6dz6N03A2unzZ980XxwEBhVCFP8QTrGXxxyfLZ5XqgNT5R1tE53UjSDgXHsgk1SFMvAyTKCWYigsUBSvoHnlAmgU6XEvBOOIlYkrhYCKOKTCSqijOgssz4OOmBA== 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=XIIgTo5XY8T0QIZHwi7L+nzf1d5dFoNq+W9rpiL9sOM=; b=OmigUb8Y1Eq5zYMkq7L1fYc2nYY96Ogb//SpekD+o/N8T90U6lMmnX5Jtwxhbd0txDjTfIySIrB3JpLJ5X3cyo2oadqPe8NLQ1pNy1jnSWLQX80bmPzMsvvT3Lcs+N1W8o9Vdw7UZnEZjCQ1nmgJQpIGZS3MIMz/KMhgxmhMgY6WGttGLB80wc3zUl22Gauqz3iQGKKNVr61MqHEqmJIyEEgyfmczij4b3a0KS0XcOXuZG3MeamofddW5EaMnNcfhIdK4S0ZCzwKVyxC53L3mqGKybBWrQ4aWmdZKQmPJAn7ayLAmjG33qtFZEL1kcehPcAe6E7/2gkThfcMe99XvQ== 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=XIIgTo5XY8T0QIZHwi7L+nzf1d5dFoNq+W9rpiL9sOM=; b=Tru1rjIKYO5C7IPAbGhOjp+GaF4eFLSUmpk0gm+IvUc2ENVFQ9GnLtn+HpWF1+/e/KMt70oFwG6NXxd4SM8bNflPO2aDZJbDHYByjX9wqMh00qA+dNG9QoUyHlkMHdoeS2OJBJ2xcv607iES9Ea8AUsJBMfLIc722nszqhxv83Y= Received: from BL0PR01CA0023.prod.exchangelabs.com (2603:10b6:208:71::36) by SA3PR12MB8048.namprd12.prod.outlook.com (2603:10b6:806:31e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 21:37:23 +0000 Received: from MN1PEPF0000F0E1.namprd04.prod.outlook.com (2603:10b6:208:71:cafe::93) by BL0PR01CA0023.outlook.office365.com (2603:10b6:208:71::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Tue, 15 Oct 2024 21:37:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000F0E1.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:22 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 15 Oct 2024 16:37:21 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v3 01/14] Documentation: x86: Add AMD Hardware Feedback Interface documentation Date: Tue, 15 Oct 2024 16:36:32 -0500 Message-ID: <20241015213645.1476-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E1:EE_|SA3PR12MB8048:EE_ X-MS-Office365-Filtering-Correlation-Id: e44dc336-98ee-400e-c27e-08dced618df8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 4wbuStg0/upskgQTR146uDdCjtJr2Kvhu8zUTbcDevyldwDabHSsRmBz2UFYC0mc5nxkSjDpFWol8iB5qBb5ksG1iojtCQGv4QvssOr2rLglrJYTVKGfPX3Z3tPtwHidWR5QIa/d8zruot3GxPLReiRpDBcdt0uEnYBHAGXOPHkKrz4fKjYXrPnzLG+DnSV+/R4WXpyi94+YQjVRMBRLTrV5/sUjsHMen+d6mReMQOrcl38nHcN+q+99DZFE6KFcLo55+FTcQ+PPlaHpEjrVAp60/6+qzhQcPMNSrlBlAfLiKCF3pNWOkh243pO3baWRBYlKr0a1+pAJYP3zGjJ4rBrFJB2Rt3fHXK5UFEpoDxWGPbTwuALSRKsqF+yIBAeaRMXLQP7rx96z/MnfVE+FV5cTIrltVRSic5GpAEeLsxSh70g3pbhIXL/5d9YJfaEomEzEF4zp7ioL33j7x/UV0CQK/BhfQl611xNfOWxjGC6wjjgNgMGctzZtF/4GDlZxLlcUwi/ILhdwOp8M1RTLcomZvBZ4dWX+FEcqWB8ojQ3cP0qoPvDfS/tleXvJ/iI1wqYppXsKehpg0SkqsOOOBJeoo/t705cQI75mH5/qreB1eFqxU1RCXoFU/6gsl7mA69o0Qi1yWMieRY54/KHyYpEgGS0m6pCFLKv5jiNTdBFgZ0ViyOly7pOs9kcvCVZboncugTY/stMH1ZGO2KuLzwyHMrwKQjvVX3YSpYpm/hADjqcPDIrrr+Rvb1fvSRLB0dtFUQnKWaIKgviM2YASjTksHzmIgPAWrOG0JXSzcJc/vtLzrBxoXWR1TeYvk9xQQ4yWYV2Bk+/lLoHQWg08GG0WpB/VDjzzCZdIMIcY1aFDRsVyj0n8SKMhBQkVBB+vx9yBOd1cPF5EM3m3GeNXAXS8RAtVJxGyUMgVrzJbtWvC4wDwxOLgPmMLo4YeS5HRLThjfYFW/jhCVBTTf5fD9jyTsV/M3x3uOAe2h2mGvQmDGKOVzLdBumL8d8/kw6ModG9P9VK7FKtDgBOiv5y8tkIhVj+Hq5af8aITn/zUvDS+oXSscGm+OvBvBCOEQNgBmLMu4vXFkXHlpnAtrpLJezyqVvdu+57VKvtV078JXPsqSoe6uThlZJpldp2klQ3QRY/QA1uwp1cfeDs6OI6gxESIpZ/goh26JioVSJU2gjWdvgrZXKb/5ulqWun2gut0bYBfDc6jpYHu3zq5AhGPIpb+DKeqlJxmXlDWD6gDwXxHFyJkDPt/cCZPAd3KfyI5yLJdZWFAVNGp+xsU31zkG7Wqyz+n+u3HJa4zkjbU8tt9NsJEazrCxXRdarfHm3HjaVJg4AXXB4vxdD81aaZM0GdUpBu56V/DjZP/uGP9QQiJ+OJQaO1n3tfjGbls6pOk X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:22.8487 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e44dc336-98ee-400e-c27e-08dced618df8 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: MN1PEPF0000F0E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8048 From: Perry Yuan Introduce a new documentation file, `amd_hfi.rst`, which delves into the implementation details of the AMD Hardware Feedback Interface and its associated driver, `amd_hfi`. This documentation describes how the driver provides hint to the OS scheduling which depends on the capability of core performance and efficiency ranking data. This documentation describes * The design of the driver * How the driver provides hints to the OS scheduling * How the driver interfaces with the kernel for efficiency ranking data. Signed-off-by: Perry Yuan Reviewed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2->v3: * Rewording (Bagas) * Fix toctree entry name (Bagas) --- Documentation/arch/x86/amd-hfi.rst | 115 +++++++++++++++++++++++++++++ Documentation/arch/x86/index.rst | 1 + 2 files changed, 116 insertions(+) create mode 100644 Documentation/arch/x86/amd-hfi.rst diff --git a/Documentation/arch/x86/amd-hfi.rst b/Documentation/arch/x86/amd-hfi.rst new file mode 100644 index 000000000000..2f0d493135c1 --- /dev/null +++ b/Documentation/arch/x86/amd-hfi.rst @@ -0,0 +1,115 @@ +.. SPDX-License-Identifier: GPL-2.0 + +====================================================================== +Hardware Feedback Interface For Hetero Core Scheduling On AMD Platform +====================================================================== + +:Copyright: 2024 Advanced Micro Devices, Inc. All Rights Reserved. + +:Author: Perry Yuan + +Overview +-------- + +AMD Heterogeneous Core implementations are comprised of more than one +architectural class and CPUs are comprised of cores of various efficiency and +power capabilities: performance-oriented *classic cores* and power-efficient +*dense cores*. As such, power management strategies must be designed to +accommodate the complexities introduced by incorporating different core types. +Heterogeneous systems can also extend to more than two architectural classes as +well. The purpose of the scheduling feedback mechanism is to provide +information to the operating system scheduler in real time such that the +scheduler can direct threads to the optimal core. + +The goal of AMD's heterogeneous architecture is to attain power benefit by sending +background thread to the dense cores while sending high priority threads to the classic +cores. From a performance perspective, sending background threads to dense cores can free +up power headroom and allow the classic cores to optimally service demanding threads. +Furthermore, the area optimized nature of the dense cores allows for an increasing +number of physical cores. This improved core density will have positive multithreaded +performance impact. + +AMD Heterogeneous Core Driver +----------------------------- + +The ``amd_hfi`` driver delivers the operating system a performance and energy efficiency +capability data for each CPU in the system. The scheduler can use the ranking data +from the HFI driver to make task placement decisions. + +Thread Classification and Ranking Table Interaction +---------------------------------------------------- + +The thread classification is used to select into a ranking table that describes +an efficiency and performance ranking for each classification. + +Threads are classified during runtime into enumerated classes. The classes represent +thread performance/power characteristics that may benefit from special scheduling behaviors. +The below table depicts an example of thread classification and a preference where a given thread +should be scheduled based on its thread class. The real time thread classification is consumed +by the operating system and is used to inform the scheduler of where the thread should be placed. + +Thread Classification Example Table +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++----------+----------------+-------------------------------+---------------------+---------+ +| class ID | Classification | Preferred scheduling behavior | Preemption priority | Counter | ++----------+----------------+-------------------------------+---------------------+---------+ +| 0 | Default | Performant | Highest | | ++----------+----------------+-------------------------------+---------------------+---------+ +| 1 | Non-scalable | Efficient | Lowest | PMCx1A1 | ++----------+----------------+-------------------------------+---------------------+---------+ +| 2 | I/O bound | Efficient | Lowest | PMCx044 | ++----------+----------------+-------------------------------+---------------------+---------+ + + +AMD Hardware Feedback Interface +-------------------------------- + +The Hardware Feedback Interface provides to the operating system information +about the performance and energy efficiency of each CPU in the system. Each +capability is given as a unit-less quantity in the range [0-255]. A higher +performance value indicates higher performance capability, and a higher +efficiency value indicates more efficiency. Energy efficiency and performance +are reported in separate capabilities in the shared memory based ranking table. + +These capabilities may change at runtime as a result of changes in the +operating conditions of the system or the action of external factors. +Power Management FW is responsible for detecting events that would require +a reordering of the performance and efficiency ranking. Table updates would +happen relatively infrequently and occur on the time scale of seconds or more. + +The following events trigger a table update: + * Thermal Stress Events + * Silent Compute + * Extreme Low Battery Scenarios + +The kernel or a userspace policy daemon can use these capabilities to modify +task placement decisions. For instance, if either the performance or energy +capabilities of a given logical processor becomes zero, it is an indication that +the hardware recommends to the operating system to not schedule any tasks on +that processor for performance or energy efficiency reasons, respectively. + +Implementation details for Linux +-------------------------------- + +The implementation of threads scheduling consists of the following steps: + +1. A thread is spawned and scheduled to the ideal core using the default + heterogeneous scheduling policy. +2. The processor profiles thread execution and assigns an enumerated classification ID. + This classification is communicated to the OS via logical processor scope MSR. +3. During the thread context switch out the operating system consumes the workload(WL) + classification which resides in a logical processor scope MSR. +4. The OS triggers the hardware to clear its history by writing to an MSR, + after consuming the WL classification and before switching in the new thread. +5. If due to the classification, ranking table, and processor availability, + the thread is not on its ideal processor, the OS will then consider scheduling + the thread on its ideal processor (if available). + +Ranking Table update +--------------------------- +The power management firmware issues an platform interrupt after updating the ranking +table and is ready for the operating system to consume it. CPUs receive such interrupt +and read new ranking table from shared memory which PCCT table has provided, then +``amd_hfi`` driver parse the new table to provide new consume data for scheduling decisions. + + diff --git a/Documentation/arch/x86/index.rst b/Documentation/arch/x86/index.rst index 8ac64d7de4dc..56f2923f5259 100644 --- a/Documentation/arch/x86/index.rst +++ b/Documentation/arch/x86/index.rst @@ -43,3 +43,4 @@ x86-specific Documentation features elf_auxvec xstate + amd-hfi From patchwork Tue Oct 15 21:36:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 835685 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2066.outbound.protection.outlook.com [40.107.237.66]) (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 630D718B48D; Tue, 15 Oct 2024 21:37:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028250; cv=fail; b=fH33udT/sW5SSQYbeQEOkMvQj8ZXVy+kQ48PtNp8ATS9oR92LLut73aQ1yondBO3l1GjmK0Qtybn6O7U5ZKDZOKGj1fYoac77E7gEK5srjwMCJYJ0XoDj4fd95/HyUkioL8y7MsdLJAP0+EMwJkMtOTTXS5ISOBbUCwWIEjD8Hw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028250; c=relaxed/simple; bh=YtPkiuEk9ICcjWJZhranlmsUCr+5Cz4Ujkfu8CcT/FU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lS0dxE99Dxf8e+o2CmT7ILIeddWR0Igp005YXEch2eO8fyxKExnpHNi7SUPkjXU87g0EcoTux6iS4b/2jerJXmNYlKDkB8dgTUK5m2lPVxvhoUiKulSkSQ3jc0GftX9mjj+R6b80GM0l6EwalfOfPDNP46SXBn9MUYG17f3mrsk= 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=Mrxv6UYj; arc=fail smtp.client-ip=40.107.237.66 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="Mrxv6UYj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uqM5DbRpgRg2A2uZHlM9C2rPkDARehu1qifWMMC9pw75MCulxmf1iPw0lotMcVvCuGX9dDuVnA1iIdOTk4Q+LzNRoDzVX/HtOYKvqDpWDIPphJa1N7fynm4agPcIbqfj4pgEZMjz1wh3euB5X0iIAZFvYmU8Tx1CkyslwxWKbCfz6Rkx929ib2CoEGxbOZxLUHV8g8Ls7KLX+sDKyC0qlKwZGd94PD/4Y/SiApmjxtvDJw4rrHONd/1Jy1XbENKXeKQaycBp29vzNHC5yNPjKRFr1pHV1en/2hmGQAI7dyJ7ORVl6ug91cfzlb96UXWQvoJCyje8VnpQI7LY6uQ4GQ== 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=8A4fXpLOiLhKDt1Wm4z4lPpMrc+C7HWy2pJbouxQ6qE=; b=M8bp0S+dX2mKir0diy5Yhtv2zQP+j3OMtuzbRziRn9oaKLiZhlFyWqTd+27AIsUm9KWMEqxmrPDlNbFOhKpVANiMBL78dEnA4pGpSoUvOUwpV3qGzr/krZ4anUV2ocDt1ZW8B/57sHdNcOL4qsl89uLwyoiu0uBFZdBx9e65I5XpfKhXJSlkYNaLyePNfgLGMDBIMMN6nzIdqJwqfUWW4Lcn3W0UBj7LNxf7ZWklB2S9CLWDbddydoTzfUv9NKpQwPqoFtxNLI8T70A51pdtcTijfWfjqczOeEw76CWRBEBb4kLyyxHhRnuPfAdTiutcy/JiFidizZPys3EfIfxo7g== 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=8A4fXpLOiLhKDt1Wm4z4lPpMrc+C7HWy2pJbouxQ6qE=; b=Mrxv6UYjXFrG2iUOPMadHcrXfGk0p4+ThdUOhmxkKki3CSR5W8fT9/3p//PDmUMSXa9KTkCdl5c/8rWQ06z8CkhOdfOnDid5a+BDk5am5m04M/ahYVCMorMtTLjy+wGUtUeK2OP7f79d7rBadJBnlfv91KoQVWpBiITsE14t/io= Received: from MN2PR02CA0007.namprd02.prod.outlook.com (2603:10b6:208:fc::20) by SJ2PR12MB8980.namprd12.prod.outlook.com (2603:10b6:a03:542::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Tue, 15 Oct 2024 21:37:24 +0000 Received: from MN1PEPF0000F0E0.namprd04.prod.outlook.com (2603:10b6:208:fc:cafe::53) by MN2PR02CA0007.outlook.office365.com (2603:10b6:208:fc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.29 via Frontend Transport; Tue, 15 Oct 2024 21:37:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000F0E0.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:23 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 15 Oct 2024 16:37:22 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 02/14] MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver Date: Tue, 15 Oct 2024 16:36:33 -0500 Message-ID: <20241015213645.1476-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E0:EE_|SJ2PR12MB8980:EE_ X-MS-Office365-Filtering-Correlation-Id: 405087c7-f23a-4120-d0ee-08dced618ea2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: li++vZk+hVLdiAgHYVQjv3I9VtspLBzIRAmwziQOUZEBGLzVvr3RlATXjojLhB9QtcWFLcnYI4TmKhOFmT8/gdGTD6sL+ccJdPZaXM7l1+rdTWYdUPkntcZJB5xjLEDpEjrfudcwJRKF3nkQXGAiNyWGYmLuiLKce6Zi+TaH2ozG4tOMZYysEzywRLbVFetVPjWfULPd/WGFyzBC9EEownXfiih4N3MYk3SPIiIBxwHeFXj5j812ZXom8iSY7FoDZ+NJHAha6gq5GyBZV6ENlA6ZVtk6CaIYqSPxrHPbINXRs7KzKSe6Q6ezEYb8H+VZurJQLANWJUiUKrlVk65nmaCS35EhnORneaBdS1ufGHdwUT64e+g+C63+TfkCc361orNyMbJAC0TppGamdyVcMFp3u4IEvUd2GxCIVHQHKWjSF0QyiMZqmytaiyBGqwH1sScoz7Wt+ru4w1Pl5Jjh6qB9E/sRVHOtyrmtkIH38hjn+jvIicuu6/4ITFN4kZ1zV1Hk+w5u6dkqOI3eeqkcePR5y5EQiIEiSdqfmnFS3S2CQaF5xxrPIyY3ox7TOPUpI/vvcLQxwmSSwPMghbXcHqeP5GnRptDBIu7Pj+viJ1PxaymDnDsr/cHYFUeW2lbdWXdE8ROAQcKCKYx1/J8xBGk3vMHMg8rfCyPDv4ozu+GbiN1+bDKjoEq1JU63xfKqZkLpq2K2BjEiRudxUnNDi9oMFLpPBj5TZYAMuCmc5c0/E7I4jqAhM0qgd1Pf9P9RSIgVvs5lHCpRTuQo+/2aUEkQMsN6W7BMDN53RvLtQYlC3asidg6zUMVLzXPqnu6amzd4UqRMb103XP7s5Nb8qaEApUvkawkUEz+nQgPzuyQwotvAbnqNj251+nWRj4JDOgGCG/7uGYTfBWfLSURk/orZaPLMOXBV/Ma1JL5qYsdWswiIO86Klfp+Zb154tVzMKC8ZinBwgjobRuYTULqrPmS2PpLFmVaU6hbFiMgDc3tB6btpKCaqLSToPT4TKucS7bW53NHa0hQjQ5TeOf2nOTyGdvbBZrvyZJ0ip1sDIX8GnPSBXn4+18CNEdAEmhK3YNJaNpT3l8xm0uH438BgMxyivYNA6q0uoSivPFIvnQRlwdyNZAbBt/0OyEOgHXzwXagfd9mvr0JdSvd0xbk5445lRKmtIZHxEiE3VDGKDJHMqIBUcIABRrllImWt2iNNDGoVjEiZraAQytncAP3xex3/UeDGS/fekodZ+KPcr8OY0G4WjfMitvcqlq99ohUL9DZtJcWcDWCEEzowzM8ACJiPXuT2fLXbtLDXqowb/kDxNi6LQEOUXCjtnAMhNjX X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:23.9788 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 405087c7-f23a-4120-d0ee-08dced618ea2 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: MN1PEPF0000F0E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8980 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 a097afd76ded..90094e064d94 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1083,6 +1083,15 @@ F: arch/x86/include/asm/amd_hsmp.h F: arch/x86/include/uapi/asm/amd_hsmp.h F: drivers/platform/x86/amd/hsmp.c +AMD HETERO CORE HARDWARE FEEDBACK DRIVER +M: Mario Limonciello +R: Perry Yuan +L: platform-driver-x86@vger.kernel.org +S: Supported +B: https://gitlab.freedesktop.org/drm/amd/-/issues +F: Documentation/arch/x86/amd-hfi.rst +F: drivers/platform/x86/amd/hfi/ + AMD IOMMU (AMD-VI) M: Joerg Roedel R: Suravee Suthikulpanit From patchwork Tue Oct 15 21:36:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 835684 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2042.outbound.protection.outlook.com [40.107.94.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54DBB1F818E; Tue, 15 Oct 2024 21:37:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028253; cv=fail; b=SW9fT1c7W8yYjUy3lynIhjAdoDcnC49no/oPJH2Khr6Snt2npd7vLD2IOqXScmjVwimY9Eu5N2xkC4qaGZLXPs73NHFLnVC4NKA5y99VhM9q+2kZDFd5cLyl63e5hhwGtIouD4nrLAzbGi0oLDMIbog83qsojeLsEn0gaQKAMDg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028253; c=relaxed/simple; bh=cc4FYa/Vuesa/XyVg3MKYbcElbdt0wJAvPFjdD24OWE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A+PMnFdcirRk85BPJm982gu7HAAqIUXgEXw6CEDzO614EJz2+usJ+Dx3z5YQ8zJBaZfr5NHYlG45+7mE8adMABJgM/PmVR5dnAIkwNhVt9bs0oAe/fnPx/aW85fWwEHyYzJNzXqpCfn2wqAyahH2REiREsOgIjmvLnJv5YDMaIU= 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=cgUvaqPd; arc=fail smtp.client-ip=40.107.94.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="cgUvaqPd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iVqCKnd/09jMQzHMGilF4IfaFhqvGZnyhdr3x12B8657V7pl1LvPcxaQNR6nhQtlZxkyjOpuAXKOJGGYsTnOWocgRJcF5xR7qbt8601URmNg0Tuyc3DHAfOdB2SIcKT1KGaw8NbU4et9L2fLa52ajLrRYrJK7gmYWDxbU+t/SX5RtEtdDwlbXx1Q0QGlP/RhVV3S1K4mdeXqr87unUE1qFN7xyVmstC+DKoInoeRY56A+QkI7Ed35JIU6gpVbf7suyDbAZdd22KG868vCdjkKgXPC2jJypukLkOdimSeYGE64B6cXe6hKIhzJk3djd0ClPeJkdRb1+poQsv78RiVCg== 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=sfg4dBKIC3Zfil42gpuoofN+BPB+hdfEIuvwNTO4J74=; b=d0cq3dnG3KYBvDzoM61d9Y0Dtc0PszMjE1fP/oI1w7UHaoB97lnx0CdGqUbpkShT/IdvxdRbGCcTf+WBTiuufUm/cX9Je3McW0rSTTg+CecNNLNcDCfTdf7zy/Nky9bwkYCVW+N8hHNgGiQCZt5eZYB/BRdI4K98gFGxKEINnb7kTFCQ8bh5SSv/676RVq/N2QSXQwkK7sIWPiVpE4ds04pGfsV24C3vGbojtLexuGn+YMGNycGbvlHDB1YA8Jkos0qwHULlfrcvKFLELdDNR7Zz92Re9gU8hSJqCYTuuhZrqwAolF8Wau8a0QwBglXi7i6mZzfnajuCZ+hDH7kQeg== 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=sfg4dBKIC3Zfil42gpuoofN+BPB+hdfEIuvwNTO4J74=; b=cgUvaqPdutV2ezbhc9P49nIs3Rx0BDz7p/gM9vQaCZRQy1Fl9I0rgE7TNjndDtSHFg0WgfiWVPVh8+B+rXTTqYMN7hxcI7r9QIlZku6MNINy7KtZlGrISGNrgUk89fboqoMbus2vSKFAsK8bxbCAlAGq1mA+RpKjXWFCHYIYaUg= Received: from MN2PR02CA0030.namprd02.prod.outlook.com (2603:10b6:208:fc::43) by PH8PR12MB7232.namprd12.prod.outlook.com (2603:10b6:510:224::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 21:37:25 +0000 Received: from MN1PEPF0000F0E0.namprd04.prod.outlook.com (2603:10b6:208:fc:cafe::71) by MN2PR02CA0030.outlook.office365.com (2603:10b6:208:fc::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26 via Frontend Transport; Tue, 15 Oct 2024 21:37:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000F0E0.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:24 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 15 Oct 2024 16:37:23 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 03/14] x86/cpufeatures: add X86_FEATURE_WORKLOAD_CLASS feature bit Date: Tue, 15 Oct 2024 16:36:34 -0500 Message-ID: <20241015213645.1476-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E0:EE_|PH8PR12MB7232:EE_ X-MS-Office365-Filtering-Correlation-Id: 367a10e8-e3eb-4a19-a36c-08dced618f36 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: jYuDu1lqsDUp6CNz61WDL0HNiRz2lQDo4YPxdTTyGtFYYCJ8dzaFlNYiOR1fskSXYEu6I8ud5ZpqLf07vl1J/+Nyq5KI0jeE9Vz+VEEWN8xUscBCffXWn3juYeRke00HnBEzYf9bsGhdQORxwRGVxKqoIgVHELEV6p88sMDeWG5oV1hfhLnxGu5cYVBPBPEcWjSPXIVU+Q65uVQHnSZLvEiVlLO/AL9v/Ex/jchKJmq5WHC1dziAKKVGgodRffd9jsczqPDSRrqrfedW5rIN30Ic7u82a8N08H/x6BKD6e27IB2AMxmnrXkoDW6lqdQsHyAk0xWj2tboFUzUkzLAb3Jr1sVCAqUCB7CU1hBZTo4Yv+Y5N3INQtLKpUo0T3RcxmPcAwTZ2YanZL0C4Muj27w3ZYKb7gbfXxGYH7eIfr9WT79HFT2xV7/XNgtfbsCuWzOTpLUZY+5FDY0ecRPyFEWjTJRU39Fv5YTiLkEahWnf9dIkPPHyMzCMRrrs/O0AuiYZ/wbHfWhjpguat14iKTh+VXybvcdTMXcVI2RQlvqytzouu7rLZhTDBs/zabYw+0fkdlI95xbufAnO4xEdxwxZI7+fHsj9VvYizicqNFoS7B+1gZfpD7ebWuupa9M7ewg50TwOC+tcbaGhH9NZbssmWTPIlo/462peDFjg2MW/ln+UmXfzmZhdFnR8BO5WbhaMiMpKVBOtrUNfNFAfrvy/08mYyk+w6Ef+j+8un3o3v0vREd899IKCUkaDuevtddkaE1e8TZaqTWhsiXPCw0FhW7AmycJZ19B+zYZzcNK4zktyjSkrJ/GhymgClHPC0bN+KL/SHiMPpCt9t+OFb/SznsXXq/P9wkTEjn9GHsGsSilmMRKR7O2knQpsOiUQpQiyTlce8jrSD4o253ZIpMnqsJo2btuJLcb56jqIpirlcNam8oEvbJ0yuKqRbi+n9yMNQe86okKFOj5qWa4WyUnaoP2iUhWvh1nRdYnYzJk5+7ZrMOT603zldoXr4Xvm9fuYiBmVedx55vLnmZU2tXKBDVK51TklD6o8uUCtqRI2HIcURCcTlpd6j2KpwRjra+AGnZbPMpEGA7gSPtfmh86KJZkyl23KY86oHlb1wnnxLioMvliOrBWFvRZW1F3qNsaf1rOS/Yv0AE+hMYLgIcdBvPXHBxix9u4UyP8Qgms1JH7GFhC1oKaJvBLLY33z0wOgHocVodRVtyow9ipcBdY1wByKJ3D7wiv5GbKcdVMoyTE+aOYhKU7umZMQ8E+V3LLnGMj1quEtZvezed3pxgNZNKN7b3MNpBS0SzNyUy62/wobagFjW7ps+g6BN2+auMQH7n+c6Rw7w+ab9zthS1T7askOIy0XGAIBjkmaGC1mVk5a0CVQbPkqJP5WebIA 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: 15 Oct 2024 21:37:24.9476 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 367a10e8-e3eb-4a19-a36c-08dced618f36 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: MN1PEPF0000F0E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7232 From: Perry Yuan Add new feature bit that indicates support for workload based heuristic feedback to OS for scheduling decisions. When the bit set, threads are classified during runtime into enumerated classes. The classes represent thread performance/power characteristics that may benefit from special scheduling behaviors. Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index cea1ed82aeb4..3e8e67b8ec7a 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -474,6 +474,7 @@ #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */ #define X86_FEATURE_FAST_CPPC (21*32 + 5) /* AMD Fast CPPC */ #define X86_FEATURE_HETERO_CORE_TOPOLOGY (21*32 + 6) /* Heterogeneous Core Topology */ +#define X86_FEATURE_WORKLOAD_CLASS (21*32 + 7) /* Workload Classification */ /* * BUG word(s) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 3bba55323163..b6547bab9e23 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -49,6 +49,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, + { X86_FEATURE_WORKLOAD_CLASS, CPUID_EAX, 22, 0x80000021, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 }, { X86_FEATURE_AMD_LBR_PMC_FREEZE, CPUID_EAX, 2, 0x80000022, 0 }, From patchwork Tue Oct 15 21:36:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 836066 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2068.outbound.protection.outlook.com [40.107.237.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 2194B205142; Tue, 15 Oct 2024 21:37:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028255; cv=fail; b=KXXr8FDGQ0rBQ5/cwsgTaYnIDIUXNGHRPL+e3uXZ5FG0j3EXKsVMwE/2SEIgcGijzpybyL09fIViejwmTWSeZmS2zyANrVdrExFt6tLS2feiCBDdre+1KTG/wpEaODNNee54roV+2f2HXYEDoha4nEkG+Ucr4YiQAgUwnAfYUTs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028255; c=relaxed/simple; bh=ofBvHPgVw5oIr8IlpOP7+JqexZC7i3ifWbwlvmZ6jFw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KlIwWJVfDzmEJUdcSoSUd+FhH8HQ5n4QrIsgTRFYmX4fqaBkfmaT8ugjeA/2pMDqUy8jx0jDxVboHhdVsw8T9ZI/YuU+DZE33TCX81yB9jyAGBzwLgWYRpArcKi9qQcdRCoNxRX9bcr96o2R8wJCYcBcwNo2LxqJNyAiMMqN75k= 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=44aw5fxn; arc=fail smtp.client-ip=40.107.237.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="44aw5fxn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lDwrmRjNRy/E4ptoAEi8QQzr3h8olXF2fdYRpv0FW+JUwhJGAnviDBXpURNT0LF8Mho8FmUFeVHMAtU81EWGU1NoVrZhQVOEIpHq7LFkJH4sU0Bn6dZQXdBFZz0I7mDgVIbi+2GgnMe17/zXfp1xYidjQCcM5TsdeGHnceX15d8k9ToQbrSH3cbkQ+pPKFzCxp1qIXuwJ1wKz7YxQZ5x51oo/caKPPg9wJKKFwPm/xrjCLkwNLMaFWf5dlZbc8hJTZYjCXakyK1uPISXmnHuWmHoMF2OF07G3XyyGFWz23xsrKexULbRMjpbJGmCmODRQOvllficqyeEsMTIToBOnw== 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=0Wpo1JAzLUn85517a0rtcIQKRr3tku7gUFu4sVqSGzw=; b=lM6T5JkabGM3J0jFAEFlRYCiAwliW+hgUNB4ADTEmv6tVELntmDDy2jdgLdssTYpqd1p2e/FZM8JKaz8Zjyry0/gkTPy/HO9CUsmIJZP6FHtLUYT9n7P7O0St2ggPAu5XX2gpsWBhwEQVYGh86sjterAOxO3+0g2GETDwJCxBGFGawNn4Env0VTPQQ8B2uwUYuwou1mN4JD+CTHziTXwCQaODLguPuPhTIs3s9SJ14VDvCB5r8tymwYC9SNQUPD4m3h8a599fQi2WqRfCm+lV2tij1KTvc3sCF/cxU+ezds1xJ4GxVE4yiQzQw9QNCOd0oy6XFRuP4SWfqJOkSHETg== 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=0Wpo1JAzLUn85517a0rtcIQKRr3tku7gUFu4sVqSGzw=; b=44aw5fxnHBiwO6mUA1VegjtQdRJmdWWWqUsOEcnZ4tXupGy/azto5QRJaQBBK8rLNql77VdpoAG/fafgji1zxRGs7fsdDBMKOz8nLJWyz5DojsFEn2Rh9PBgp+7oGmLGy/8SkAO7B6bHVEz+zzhWfs+hPe1gaxYwSprD7qUUVMg= Received: from MN2PR02CA0028.namprd02.prod.outlook.com (2603:10b6:208:fc::41) by DS0PR12MB7746.namprd12.prod.outlook.com (2603:10b6:8:135::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.25; Tue, 15 Oct 2024 21:37:26 +0000 Received: from MN1PEPF0000F0E0.namprd04.prod.outlook.com (2603:10b6:208:fc:cafe::39) by MN2PR02CA0028.outlook.office365.com (2603:10b6:208:fc::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000F0E0.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:25 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 15 Oct 2024 16:37:24 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 04/14] x86/msr-index: define AMD heterogeneous CPU related MSR Date: Tue, 15 Oct 2024 16:36:35 -0500 Message-ID: <20241015213645.1476-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E0:EE_|DS0PR12MB7746:EE_ X-MS-Office365-Filtering-Correlation-Id: b70d3ea3-9922-4308-eca7-08dced618fc0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: JS9GLUP885qtJnoCmY6BNmmyyHCUs2KgYWsGjpXGhClAfRySkzJp36GpQITztX9Z43mNmSkSJoQWFYfMoXODmv0TfLJQOY1ekulUB4wp3bYW4ZK06wH1SRJKa8JSo0DsVp25rU2BLDpcuokZa32rwsLF31wp4aAXLvtLEsYxZV/CTUe01bORhsVemN0MmLwQWtGDMcxN5rAzh0t1HWCC+vr/ed9M61Y8Nk3b/dhLypDvZNetZzGELBZaQc32Bnkk52vdJZ0RXzAOH11RS9fHBk/3dT58JscPgrslzrkeyRVrdn+BfZd6IfaYcQti3+1MlklItHYUxD8uthiojb3tRmo93jbPG/SvQsS+JPUe/6rWTxR07mrZsjXHAvEDFZEVpsmBo4zXe8pxN5CWdqvFBITVnLeUXB7SHajxxkMBINhE41WrLQGEkwCX0r83/laiHayScVSrs/8D1sx19rme0sxtD4gGgzbjHx9+diENICkuQZAxAcIXd5SW+dFjc26U+5tDiI53TOWPdU9X2hKf7livUSuOGt7JrCvdtKsMlt7SfAHxt2Rg7G46GKZ3Sb/d224smcmVShVxBdJpEEmaU5KwvWe0dZWmGGRaCTZ8hkwBMW/a6ecLjtA7qSGLndLtQqfyN0i9MXLDM20THaQ7DtoOHX0ECctAq24MpBUovqEvhPw1JD6DXzQrNG3gBm33AhWZ2SQlfFzTgUAj34FYV+v6Foswz9PuqkwK7rE1OQOwPDKNdaKhkv3TkdXnfPcmihbpFBB3M8iY9rOnxT24TL3LjjcaLN5J9uD5ouz8kQpwTPsU7nVK7MAhe8qJpBy7nA4XBwUCBve33ebZAjwcp1qXZiAiMFBOsG7LPer01bOeSYoBdyHMel3/KKr6hCvY0bsJF581zybc2IWe/dreTdml5jc/bz3O8BBMiX1LfvQ54r3Q8VxuuDin3yIRhTLmNUhg8wJ6eEm31W0TL1XlwewLUqndMwrTCE8+IRHWkJlhW+C0+ethTrF8K1/8vMPRLTW4W4j/iqb8XVtQsqGOSbPsPO/5/QknvZgP/Lnrk8N1XRw77tWKcEMBQ/4eHgVwxDYBJE3dkjpJ2jixqPVQ79MFzdXyfHf1YNs7YuybgAZv4fPjvoEEdlxo6ml4xUP0izsqNFNkPl2HZsVob3/B2XuqHbYWTo/AZZ6YtLTHsur3bAzcAIn5RfQMUG+h5cnHayAkpFCq3fx9NR+p+x58Ij/WhZTufpixO+qpSapgAJ+m1//5IWYFEgmt6R6znYLJwMDWtodU8VYUEVN+qxybz9QoTVUEjJpeEy4Yhff5/0ndjKK1cpBjFAj6qfHJQaYNDrw0a+/R+WCcCK/J1Isu2osFfz9vkAo3+3e4qihILbSpa13pQj1stQb/GsWnTNWl X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:25.8382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b70d3ea3-9922-4308-eca7-08dced618fc0 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: MN1PEPF0000F0E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7746 From: Perry Yuan Introduces new MSR registers for AMD hardware feedback support. These registers enable the system to provide workload classification and configuration capabilities. Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- arch/x86/include/asm/msr-index.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 3ae84c3b8e6d..0cd5ffe50f4a 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -712,6 +712,11 @@ #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302 +/* AMD Hardware Feedback Support MSRs */ +#define AMD_WORKLOAD_CLASS_CONFIG 0xc0000500 +#define AMD_WORKLOAD_CLASS_ID 0xc0000501 +#define AMD_WORKLOAD_HRST 0xc0000502 + /* AMD Last Branch Record MSRs */ #define MSR_AMD64_LBR_SELECT 0xc000010e From patchwork Tue Oct 15 21:36:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 836067 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2048.outbound.protection.outlook.com [40.107.220.48]) (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 972DD1FF020; Tue, 15 Oct 2024 21:37:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028253; cv=fail; b=PNeIEvxQygVvFcKhQsl2TulXymCTWTO8qdZ0x4K3hu4pBSOZ5+BIqfWfsXAQ4GAcUphvMZEmkYRcEfeA/CoYs2GEdZKLFnYY63l6ACOtZg8pJpJJt0U20SGp6XNlf82npxS5piY4cP0+WecHkFgZIP43YHNq1HyzMoxc1CHeXrI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028253; c=relaxed/simple; bh=mHDytz31pt5jqGHh5UzTvJkn02Ia2BdJqM4d0D72KEs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jgyk5NzSSW8H6MCOxyMbl74EIuI4I3Ta4U38yqeu98grxCgw5RspPSt7fSnh/IBVwjSD9C57uyO5cY3F1p5awVNqZICwnW6QoyMeg/SdwSosAfkdfuLxOesdc+MJdY08fDBLW68b7bRjbmmg+yKglOHqv1Yb04fZs+kU13V+sgg= 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=sNLmy7EL; arc=fail smtp.client-ip=40.107.220.48 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="sNLmy7EL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KWfLdO+Qx+8ypz3Pifc889rmzP26jr7/keW38ynW4c2nYCkTAurHi7SaMrMtyAHbWqbEsh6SFdLY1YfVRk4daihz8wV7dWNpL/IYek5msGALzuq8e8+TNnbW7iJLD4UWj7ilm4CL9t6SVKrWA2yeBsq4JQXF/agVnNiBugYe7Nyd2/jK/7Hx/i0S55/eVV6suW7GePMFi44/Cde8iKjbeBP4JzdokVXulXzu/vCJ0IiefCQZSCzH6r4jOyBMegRpq5EnHh8REKQbd67MbC/bc+QTY3VmvZk7kUtscHBR4/XASqIzrRzQpsvc7Acqa4ElImR7j6e5GZ/j8gf71+c/CA== 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=JmskUWuvDdElHkKzBiWw/i1hq5DD0P14JWFtBhtrBO4=; b=xyiMEaCCYXEtc5e6pVk//Eyi4M64q/CTvY5ZlrM0sWsp2+T1lR9S6zYeEzUWas2a5r+p1M2plB/E9NwI8YVtK3mLJ5wO0VdXRoNO7sBZjrVTsjytBZlm8wPIuJ2rnC/PPGserkF648wlBgZM+zfI9jMOMcRNTQQuKbVRAJ8t8LrBOWsSQGdnUZLXa5gswekePvWnfuQbiPX9EDxu8DoqTbbSGSblF6WxmpSkgnR4dIshDaCiebRgqVIHU+jgTenUjVOudW/3wk3wB6hZjg5cH1TtBrWpikxTEHkSx24kTpkoRyol1xTiR704A6KmjM/uP313GTd7t1aiLFYus/aL2A== 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=JmskUWuvDdElHkKzBiWw/i1hq5DD0P14JWFtBhtrBO4=; b=sNLmy7ELxosSh8Wm3R+T2l29klNIYb9NcievyruSMxlFoUJFmqvnNfcfDATOZbVUbRh2pWWstdQevtOO+Ix2K0V+6EL3gyiplN87AdF9OV92pmQoudSPxP1KOFYmFMPRY8IyZo+YpX1mYmPKkC9Cp31WY5WzkgR5G5HpKQdZP0Q= Received: from BN9P222CA0014.NAMP222.PROD.OUTLOOK.COM (2603:10b6:408:10c::19) by SA1PR12MB8641.namprd12.prod.outlook.com (2603:10b6:806:388::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 21:37:27 +0000 Received: from MN1PEPF0000F0E2.namprd04.prod.outlook.com (2603:10b6:408:10c:cafe::ba) by BN9P222CA0014.outlook.office365.com (2603:10b6:408:10c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000F0E2.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:27 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 15 Oct 2024 16:37:25 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v3 05/14] platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver Date: Tue, 15 Oct 2024 16:36:36 -0500 Message-ID: <20241015213645.1476-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E2:EE_|SA1PR12MB8641:EE_ X-MS-Office365-Filtering-Correlation-Id: 99439761-8e36-4a76-1e8a-08dced61907c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: avZrBirUz3n43eZ4Ea/LAM+F/C1gNh+4YJM00uNxp/+sy3cIPObEwWdnKTy79e7haJ+s3Nwrk1Mi3uSSjQBSSkU83Kvd/cah9vA/bDwCUbpAveZM6Tj4UBOik4CrzCQns89qynAVbgdaFHXG14ZotU9IOUgrQcrSCoBfqigh2deekPl+1LS/tNY0PT1l9nTcL2l1pZSJm3rEtvjtSJfcP6qGc82hB/gVlKi61toDfBBOAUBIBDK/yd/z7dokwcttJmkCPFDeFdlS7kdJR+6UNPlqSHV6dHhvDmCzww1TCpmFMruc7Dta0Y5UaVcXDoXkf8HsP9Wf1odywD1mN2qx+KxTnF73k8OfM23AxmCv+1+KXX+bZ+Giz2j69SO/ZTVWob9Z0AtMwx46RpHDaK5ljA6SJXPHVXXb4GP8KutXAUxItqUWN7Lp4ACo/eXgzANxo/+DzMxWr3cBy1HDanDZstNVX8skhVDvSMggrid2/GaepVQoZBHKNOYdWoKz8qVFTrebx0v7YZZ4jpM7ibV0Gq4fpc10YotUKaBFLZIA5LLTlDb86tq0ca4mc1VU1lzZxwXs3yasUS8ry+XV9JdXIAvuJSBpoAnI/XZkqZ2CX416MEKUJ3YECPx1cO4BVBPjeq0/qUMsb7O9dM0m3H0uXf40CZiC9fPs21RE0Q9nfeHjzuqgmPuPGlZ4pMmBBiiin/F44gXR1hVmeYjaUjnh6fwNo2sdm9ZWPJfHSqGdbGTZFXToqoivB3zsdB1wnNvemHX9cZbuz8EM3rPXIg8ugBhhNUm3BTidkTd5mO3zYUC6qk0C7Za9qu7uJrxu/uXhP1DBobsGdohFf+vye06GS/IPNHhXdcucUkWcUHhpi3UHvdJi7lYZER49jj3EdoJaj3cQ2e2fq6J8c4aqi6HyPhKuaAEWkr3525IXiy7buITFRQCHwmZ3kOVetCw2OZgblAh3hjI6sk4cKctpsbMgY8NjlyFQpr8pudIgUAlwy6RQk7MjsyzjUK40yEjPnlSsyt+Q6p9qWKGLQdFFwMWzuK/CdUW+9dYmHBz7gLqOBbpVOImpXn4a2ndibGO0V0TdQ41/7Xfjvg85r6PMuCDRwO9oP4snhxwmiFHVxWg0DbaiAZBzzSM7YdV8eikvrqzdPYmDk+F+gHHYCywiJSiaK+PteWQOEMzuFQb2vqjk1i+AX3Q48cyX90Ld+vwrPo4cgyZrVWr3fy8+pXWD3Q0IB8nmjmwcnuRzxoOI5OTAKcgd/U1OkLM3PWwvIi2E9CDp0vagNnSusNatNVOd3GhrwULeVk/tZBP3eVzDrygPevehOs/MpuSLP1pZI94tClynij7ofu6u30AEJl6JWGJGBBFhSfW/Ig2e9ji2nKmDGJCCi8p3sGbHzrcP8f0VSp/e X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:27.0806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99439761-8e36-4a76-1e8a-08dced61907c 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: MN1PEPF0000F0E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8641 From: Perry Yuan The AMD Heterogeneous core design and Hardware Feedback Interface (HFI) provide behavioral classification and a dynamically updated ranking table for the scheduler to use when choosing cores for tasks. There are two CPU core types defined: `Classic Core` and `Dense Core`. "Classic" cores are the standard performance cores, while "Dense" cores are optimized for area and efficiency. Heterogeneous compute refers to CPU implementations that are comprised of more than one architectural class, each with two capabilities. This means each CPU reports two separate capabilities: "perf" and "eff". Each capability lists all core ranking numbers between 0 and 255, where a higher number represents a higher capability. Heterogeneous systems can also extend to more than two architectural classes. The purpose of the scheduling feedback mechanism is to provide information to the operating system scheduler in real time, allowing the scheduler to direct threads to the optimal core during task scheduling. All core ranking data are provided by the BIOS via a shared memory ranking table, which the driver reads and uses to update core capabilities to the scheduler. When the hardware updates the table, it generates a platform interrupt to notify the OS to read the new ranking table. Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- v2->v3: * Whitespace (Ilpo) * kmalloc -> kzalloc (Ilpo) * Drop needless include (Ilpo) * Capitalization (Ilpo) * Drop needless comment (Ilpo) --- drivers/platform/x86/amd/Kconfig | 1 + drivers/platform/x86/amd/Makefile | 1 + drivers/platform/x86/amd/hfi/Kconfig | 20 +++ drivers/platform/x86/amd/hfi/Makefile | 7 ++ drivers/platform/x86/amd/hfi/hfi.c | 168 ++++++++++++++++++++++++++ 5 files changed, 197 insertions(+) create mode 100644 drivers/platform/x86/amd/hfi/Kconfig create mode 100644 drivers/platform/x86/amd/hfi/Makefile create mode 100644 drivers/platform/x86/amd/hfi/hfi.c diff --git a/drivers/platform/x86/amd/Kconfig b/drivers/platform/x86/amd/Kconfig index f88682d36447..c3f69dbe3037 100644 --- a/drivers/platform/x86/amd/Kconfig +++ b/drivers/platform/x86/amd/Kconfig @@ -5,6 +5,7 @@ source "drivers/platform/x86/amd/pmf/Kconfig" source "drivers/platform/x86/amd/pmc/Kconfig" +source "drivers/platform/x86/amd/hfi/Kconfig" config AMD_HSMP tristate "AMD HSMP Driver" diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/Makefile index dcec0a46f8af..2676fc81fee5 100644 --- a/drivers/platform/x86/amd/Makefile +++ b/drivers/platform/x86/amd/Makefile @@ -9,3 +9,4 @@ amd_hsmp-y := hsmp.o obj-$(CONFIG_AMD_HSMP) += amd_hsmp.o obj-$(CONFIG_AMD_PMF) += pmf/ obj-$(CONFIG_AMD_WBRF) += wbrf.o +obj-$(CONFIG_AMD_HFI) += hfi/ diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/amd/hfi/Kconfig new file mode 100644 index 000000000000..08051cd4f74d --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# AMD Hardware Feedback Interface Driver +# + +config AMD_HFI + bool "AMD Hetero Core Hardware Feedback Driver" + depends on ACPI + depends on CPU_SUP_AMD + help + Select this option to enable the AMD Heterogeneous Core Hardware Feedback Interface. If + selected, hardware provides runtime thread classification guidance to the operating system + on the performance and energy efficiency capabilities of each heterogeneous CPU core. + These capabilities may vary due to the inherent differences in the core types and can + also change as a result of variations in the operating conditions of the system such + as power and thermal limits. If selected, the kernel relays updates in heterogeneous + CPUs' capabilities to userspace, allowing for more optimal task scheduling and + resource allocation, leveraging the diverse set of cores available. + + diff --git a/drivers/platform/x86/amd/hfi/Makefile b/drivers/platform/x86/amd/hfi/Makefile new file mode 100644 index 000000000000..672c6ac106e9 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# AMD Hardware Feedback Interface Driver +# + +obj-$(CONFIG_AMD_HFI) += amd_hfi.o +amd_hfi-objs := hfi.o diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c new file mode 100644 index 000000000000..fbbc2c119a64 --- /dev/null +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD Hardware Feedback Interface Driver + * + * Copyright (C) 2024 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Authors: Perry Yuan + * Mario Limonciello + */ + +#define pr_fmt(fmt) "amd-hfi: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HETERO_CPUID_27 0x80000027 +static struct platform_device *device; + +struct amd_hfi_data { + const char *name; + struct device *dev; + struct mutex lock; +}; + +struct amd_hfi_classes { + u32 perf; + u32 eff; +}; + +/** + * struct amd_hfi_cpuinfo - HFI workload class info per CPU + * @cpu: cpu index + * @cpus: mask of cpus associated with amd_hfi_cpuinfo + * @class_index: workload class ID index + * @nr_class: max number of workload class supported + * @amd_hfi_classes: current cpu workload class ranking data + * + * Parameters of a logical processor linked with hardware feedback class + */ +struct amd_hfi_cpuinfo { + int cpu; + cpumask_var_t cpus; + s16 class_index; + u8 nr_class; + struct amd_hfi_classes *amd_hfi_classes; +}; + +static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.class_index = -1}; + +static int amd_hfi_alloc_class_data(struct platform_device *pdev) +{ + struct amd_hfi_cpuinfo *hfi_cpuinfo; + struct device *dev = &pdev->dev; + int idx; + int nr_class_id; + + nr_class_id = cpuid_eax(AMD_HETERO_CPUID_27); + if (nr_class_id < 0 || nr_class_id > 255) { + dev_err(dev, "failed to get number of supported classes: %d\n", + nr_class_id); + return -EINVAL; + } + + for_each_present_cpu(idx) { + struct amd_hfi_classes *classes; + + classes = devm_kzalloc(dev, + nr_class_id * sizeof(struct amd_hfi_classes), + GFP_KERNEL); + if (!classes) + return -ENOMEM; + hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, idx); + hfi_cpuinfo->amd_hfi_classes = classes; + hfi_cpuinfo->nr_class = nr_class_id; + } + + return 0; +} + +static void amd_hfi_remove(struct platform_device *pdev) +{ + struct amd_hfi_data *dev = platform_get_drvdata(pdev); + + mutex_destroy(&dev->lock); +} + +static const struct acpi_device_id amd_hfi_platform_match[] = { + { "AMDI0104", 0}, + { } +}; +MODULE_DEVICE_TABLE(acpi, amd_hfi_platform_match); + +static int amd_hfi_probe(struct platform_device *pdev) +{ + struct amd_hfi_data *amd_hfi_data; + int ret; + + if (!acpi_match_device(amd_hfi_platform_match, &pdev->dev)) + return -ENODEV; + + amd_hfi_data = devm_kzalloc(&pdev->dev, sizeof(*amd_hfi_data), GFP_KERNEL); + if (!amd_hfi_data) + return -ENOMEM; + + amd_hfi_data->dev = &pdev->dev; + mutex_init(&amd_hfi_data->lock); + platform_set_drvdata(pdev, amd_hfi_data); + + ret = amd_hfi_alloc_class_data(pdev); + if (ret) + return ret; + + return 0; +} + +static struct platform_driver amd_hfi_driver = { + .driver = { + .name = AMD_HFI_DRIVER, + .owner = THIS_MODULE, + .acpi_match_table = ACPI_PTR(amd_hfi_platform_match), + }, + .probe = amd_hfi_probe, + .remove_new = amd_hfi_remove, +}; + +static int __init amd_hfi_init(void) +{ + int ret; + + if (acpi_disabled || + !boot_cpu_has(X86_FEATURE_HETERO_CORE_TOPOLOGY) || + !boot_cpu_has(X86_FEATURE_WORKLOAD_CLASS)) + return -ENODEV; + + device = platform_device_register_simple(AMD_HFI_DRIVER, -1, NULL, 0); + if (IS_ERR(device)) { + pr_err("unable to register HFI platform device\n"); + return PTR_ERR(device); + } + + ret = platform_driver_register(&amd_hfi_driver); + if (ret) + pr_err("failed to register HFI driver\n"); + + return ret; +} + +static __exit void amd_hfi_exit(void) +{ + platform_device_unregister(device); + platform_driver_unregister(&amd_hfi_driver); +} +module_init(amd_hfi_init); +module_exit(amd_hfi_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AMD Hardware Feedback Interface Driver"); From patchwork Tue Oct 15 21:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 835683 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2068.outbound.protection.outlook.com [40.107.101.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 F2A1C20402D; Tue, 15 Oct 2024 21:37:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028255; cv=fail; b=sp9VACiNJH/VWl9Q8hyRZll+daNPVw3WAsHgT2ujaz+dYGsAhILTAL7fWPGFJGlRuUOVy6ks1DMdmD2etLXgrWq7nfqqPOAJcME2oAznClJHfICKaa0NsZSxnlpFhh28eyyuExMhR+4rPZNxm9OpQpSOYKPcSPRqYttcqHoPG00= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028255; c=relaxed/simple; bh=UrgtfIdVbFM8uz5IOSlgGJaGtWtLGgox3PhNHUJDhw8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mN9RXPt4qvKWasDX37kENhyWYHtBI0UNCYdn/DvR5nTBAhdmf6Ti6uOE0l0++FceXQ2YZJ/x1I0tMl3IGT+maqyGai7iGdMIhrC+dsa3y1VOu7IaMqOaPjLZmr7FRQCAehSBGSCOX/vk+7FtljVbW6X4rOk5nYjgk7TSC4AwV60= 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=PDBtuUux; arc=fail smtp.client-ip=40.107.101.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="PDBtuUux" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jExpJzvdmTtmuMsclIrCRvjN64zUtNSriemESypgBJtLtgmAPJSkxCfrAT7vmQcNlpZFeJopEomU7K4w5OqgMzYerEIdp9l3eUDOGw/MRBjDxyR830dGurjCPUOfh16tG7ZDPhXomJc7lu5QREe+oM7kn2L9HCn/aUKRuc+vJTWiPVjFvf+2T5/02dSsUOz9TLOKrYAgJ52Kg9kJ87xFqniVHMqlet8VLogxCdikBKbbfqb4lgYi2UEMNTSB+QLoKeN075cxBw7stRfUwJ8w8qQYsQ5afBgjWl07A5mkH0d6hu+wedQMF6j9MzM3oGZYwZ8Hm/CF9n7x+y76gt3Nfw== 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=NwRSD35aTJG3zkIYypM58gfK/fEQGtNQDDngqqoFgTo=; b=XbD0iA+N6nk1Ix6w4g7wFe7VKipomqmfiN9dZhSjpIqtHW5X96GGpLUo31KpgKwQGwAQUfPv1N592YwLcLEsWDsEgc6sFo4rxEf7xAm4QNwClzEw6iPop9lVQysqthdParLsWtPLpyMj6T/ozZ1TkYxutz0ACxetwvlwa3kxIilE02Q2p05lFBPwqubQVYRRl9P2vGyZdHJx1W35IgxvJ6zv/UzjgajmWNri8WAiMrWfh6M6kZv1ZikABv6pw7qVTEOc2I827UuZWVJDuFTtUa9BFec5iZ7/pvFqcGp1s4rdY+HPUROK/WjN453al3uIk+Dt4ZwEmrSC1FqLCj1wgQ== 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=NwRSD35aTJG3zkIYypM58gfK/fEQGtNQDDngqqoFgTo=; b=PDBtuUuxa+hOCA4pdmKMazc2FyCOyA16zh66bWUs7yZlEJIdtyYJRQ9Dwh7xY6VbysipL+EzvxmWZZD6Z5YClfi1/WbjwCwUTZOzIfV0zqQ1fisM6ICvfVr9c0bkSaDy7PxaXY11Oxp27bWHTG72kE7PptqM+Fs1gJnVYkmIjso= Received: from MN2PR02CA0028.namprd02.prod.outlook.com (2603:10b6:208:fc::41) by IA1PR12MB8079.namprd12.prod.outlook.com (2603:10b6:208:3fb::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Tue, 15 Oct 2024 21:37:28 +0000 Received: from MN1PEPF0000F0E0.namprd04.prod.outlook.com (2603:10b6:208:fc:cafe::ca) by MN2PR02CA0028.outlook.office365.com (2603:10b6:208:fc::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:28 +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 MN1PEPF0000F0E0.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:28 +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; Tue, 15 Oct 2024 16:37:26 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v3 06/14] platform/x86: hfi: parse CPU core ranking data from shared memory Date: Tue, 15 Oct 2024 16:36:37 -0500 Message-ID: <20241015213645.1476-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E0:EE_|IA1PR12MB8079:EE_ X-MS-Office365-Filtering-Correlation-Id: e10edbb2-48ef-4bb2-2be9-08dced619124 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: x/YujijG0VHBeIcSJtR8d+7ZfNhbN3PV+oBnlhfpwmds/tZL0Ov4WMvmnJ/q6hpBwV2fLsSdOo3gCuGUFLP4FCBbSRXqaRRWWzHeupstYKK7FYJC/WbLvYsP8zUQvhPfXK7J+abvKEZGNHosIQImRPfD1gpF6KRAAZVXIQwj0YZzKa6GeA9TIABgnpbFAyyvRXZ7dgGs5fadM2T2hBbOEfthw/GQNfy5DI8Q28qx4daJ2se8xcOy6XiPC/vG4fCcT1iibejF9kpbMVE6QzBWyDQKWX5e0vauKj/r1ZEtIslIZpABls+rWc4IelKGyk2Xek+bPaCKwiPcvfakd6rRCF4RnHFXZy2cb8WGW39okoSrgm7fyxSwPpnFgw/3LCXrUGrzysckObFrNMmrgF+iJ6gG2t+Go/M61X4WahAfUYnvL+jyb2ao9S1t5x3viYin00q5MrM9i3mjDNkEvEUJ4K1GP70NWH2gVj2OjpO8IEF1GLeOl6ItgGBQQVsxqknv40sr3KeLFyEMWmdbVp27tss4aWXA7N/Q69tgiruIkejq5ekQFsIkgAtlv/6oOxPeWy+n4T5dZpUNhQGr6g8GnHREtyhbNEIJNk1rhu+Z3e5QUHFZmB47TR0CoYSjJF0wS9nTGqvldg+Zv1r9Hp84mUbmGBUidjQRkOZ7kcTbnVNT3dwlxqxsTSI9JitEprfU0FmBYgOhSJdqd3xe9WfEcPMkmhuOC1NpnWvdUDsC20/lTHI7MlvUU97DubJOIioDOj/aqBZo9RxewukceJ0wFfzs8ksVbhhD/msIkX72eP/oAcArx3ZUSlpLq5lrlEGXPfeTUPjvTOEhD/yj4o3F+ETRpCyEWyu+pVNts9IfSPHN4xc++Ofk8cs88OH9o5G5WL0t+/bdzbdSYwE/lDnlLafzxzjN5GNfyKk9Nc+WhvEVPe375IMKtjVSYNRNoOi6CsRp2pIdO3ursDJcXBu5i/nhbLvTilaB4p/2EtwquySGdBBSqcf24ZS921KgIMcQ8Ci9+LkCQAGrbH3LUIT2wKbTmzVvZFO6DRkBVgaCxHXwmJ40EWbQoHFd0w75NQEz/9x675vn0KtTbwwrEycwnCoEr4ln0b/z3i0tQ1uJsuG3H1soqjCEBieMxszumEiQSJdczY20QY2Du8wXPnHdQlXpUwAycwJHldaEXc5cG69EEBjYqeLBi9GqbEtstPEkoOncoWuVln2fDQmKTE6a0d7A/lL7nL1FokGDcbvPAdyAJI0Fjwd4e86z8ZxusqzTqffzy6Tfcw22Yb0MXInst0cgTE/DK4q4M3O1kOC0fPxWZWhNri/GaXozOj3/r89OZcKFsgTHKAUM5OCbBeCc1H6FwRweYvmNKjxYmq1QUm0+1NSCvTMZJd9OrMCu8z3l X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:28.1820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e10edbb2-48ef-4bb2-2be9-08dced619124 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: MN1PEPF0000F0E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8079 From: Perry Yuan When `amd_hfi` driver is loaded, it will use PCCT subspace type 4 table to retrieve the shared memory address which contains the CPU core ranking table. This table includes a header that specifies the number of ranking data entries to be parsed and rank each CPU core with the Performance and Energy Efficiency capability as implemented by the CPU power management firmware. Once the table has been parsed, each CPU is assigned a ranking score within its class. Subsequently, when the scheduler selects cores, it chooses from the ranking list based on the assigned scores in each class, thereby ensuring the optimal selection of CPU cores according to their predefined classifications and priorities. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/hfi.c | 200 +++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index fbbc2c119a64..d2952233442b 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -18,21 +18,77 @@ #include #include #include +#include #include +#include #include #include #include +#include +#include + +#include + +#include +#include #define AMD_HFI_DRIVER "amd_hfi" +#define AMD_HFI_MAILBOX_COUNT 1 +#define AMD_HETERO_RANKING_TABLE_VER 2 + #define AMD_HETERO_CPUID_27 0x80000027 + static struct platform_device *device; +/** + * struct amd_shmem_info - Shared memory table for AMD HFI + * + * @signature: The PCC signature. The signature of a subspace is computed by + * a bitwise of the value 0x50434300 with the subspace ID. + * @flags: Notify on completion + * @length: Length of payload being transmitted including command field + * @command: Command being sent over the subspace + * @version_number: Version number of the table + * @n_logical_processors: Number of logical processors + * @n_capabilities: Number of ranking dimensions (performance, efficiency, etc) + * @table_update_context: Command being sent over the subspace + * @n_bitmaps: Number of 32-bit bitmaps to enumerate all the APIC IDs + * This is based on the maximum APIC ID enumerated in the system + * @reserved: 24 bit spare + * @table_data: Bit Map(s) of enabled logical processors + * Followed by the ranking data for each logical processor + */ +struct amd_shmem_info { + struct acpi_pcct_ext_pcc_shared_memory header; + u32 version_number :8, + n_logical_processors :8, + n_capabilities :8, + table_update_context :8; + u32 n_bitmaps :8, + reserved :24; + u32 table_data[]; +} __packed; + struct amd_hfi_data { const char *name; struct device *dev; struct mutex lock; + + /* PCCT table related*/ + struct pcc_mbox_chan *pcc_chan; + void __iomem *pcc_comm_addr; + struct acpi_subtable_header *pcct_entry; + struct amd_shmem_info *shmem; }; +/** + * struct amd_hfi_classes - HFI class capabilities per CPU + * @perf: Performance capability + * @eff: Power efficiency capability + * + * Capabilities of a logical processor in the ranking table. These capabilities + * are unitless and specific to each HFI class. + */ struct amd_hfi_classes { u32 perf; u32 eff; @@ -41,23 +97,105 @@ struct amd_hfi_classes { /** * struct amd_hfi_cpuinfo - HFI workload class info per CPU * @cpu: cpu index + * @apic_id: apic id of the current cpu * @cpus: mask of cpus associated with amd_hfi_cpuinfo * @class_index: workload class ID index * @nr_class: max number of workload class supported + * @ipcc_scores: ipcc scores for each class * @amd_hfi_classes: current cpu workload class ranking data * * Parameters of a logical processor linked with hardware feedback class */ struct amd_hfi_cpuinfo { int cpu; + u32 apic_id; cpumask_var_t cpus; s16 class_index; u8 nr_class; + int *ipcc_scores; struct amd_hfi_classes *amd_hfi_classes; }; static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.class_index = -1}; +static int find_cpu_index_by_apicid(unsigned int target_apicid) +{ + int cpu_index; + + for_each_present_cpu(cpu_index) { + struct cpuinfo_x86 *info = &cpu_data(cpu_index); + + if (info->topo.apicid == target_apicid) { + pr_debug("match APIC id %d for CPU index: %d\n", + info->topo.apicid, cpu_index); + return cpu_index; + } + } + + return -ENODEV; +} + +static int amd_hfi_fill_metadata(struct amd_hfi_data *amd_hfi_data) +{ + struct acpi_pcct_ext_pcc_slave *pcct_ext = + (struct acpi_pcct_ext_pcc_slave *)amd_hfi_data->pcct_entry; + void __iomem *pcc_comm_addr; + + pcc_comm_addr = acpi_os_ioremap(amd_hfi_data->pcc_chan->shmem_base_addr, + amd_hfi_data->pcc_chan->shmem_size); + if (!pcc_comm_addr) { + pr_err("failed to ioremap PCC common region mem\n"); + return -ENOMEM; + } + + memcpy_fromio(amd_hfi_data->shmem, pcc_comm_addr, pcct_ext->length); + iounmap(pcc_comm_addr); + + if (amd_hfi_data->shmem->header.signature != PCC_SIGNATURE) { + pr_err("invalid signature in shared memory\n"); + return -EINVAL; + } + if (amd_hfi_data->shmem->version_number != AMD_HETERO_RANKING_TABLE_VER) { + pr_err("invalid version %d\n", amd_hfi_data->shmem->version_number); + return -EINVAL; + } + + for (unsigned int i = 0; i < amd_hfi_data->shmem->n_bitmaps; i++) { + u32 bitmap = amd_hfi_data->shmem->table_data[i]; + + for (unsigned int j = 0; j < BITS_PER_TYPE(u32); j++) { + struct amd_hfi_cpuinfo *info; + int apic_id = i * BITS_PER_TYPE(u32) + j; + int cpu_index; + + if (!(bitmap & BIT(j))) + continue; + + cpu_index = find_cpu_index_by_apicid(apic_id); + if (cpu_index < 0) { + pr_warn("APIC ID %d not found\n", apic_id); + continue; + } + + info = per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + info->apic_id = apic_id; + + /* Fill the ranking data for each logical processor */ + info = per_cpu_ptr(&amd_hfi_cpuinfo, cpu_index); + for (unsigned int k = 0; k < info->nr_class; k++) { + u32 *table = amd_hfi_data->shmem->table_data + + amd_hfi_data->shmem->n_bitmaps + + i * info->nr_class; + + info->amd_hfi_classes[k].eff = table[apic_id + 2 * k]; + info->amd_hfi_classes[k].perf = table[apic_id + 2 * k + 1]; + } + } + } + + return 0; +} + static int amd_hfi_alloc_class_data(struct platform_device *pdev) { struct amd_hfi_cpuinfo *hfi_cpuinfo; @@ -74,14 +212,19 @@ static int amd_hfi_alloc_class_data(struct platform_device *pdev) for_each_present_cpu(idx) { struct amd_hfi_classes *classes; + int *ipcc_scores; classes = devm_kzalloc(dev, nr_class_id * sizeof(struct amd_hfi_classes), GFP_KERNEL); if (!classes) return -ENOMEM; + ipcc_scores = devm_kcalloc(dev, nr_class_id, sizeof(int), GFP_KERNEL); + if (!ipcc_scores) + return -ENOMEM; hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, idx); hfi_cpuinfo->amd_hfi_classes = classes; + hfi_cpuinfo->ipcc_scores = ipcc_scores; hfi_cpuinfo->nr_class = nr_class_id; } @@ -95,6 +238,59 @@ static void amd_hfi_remove(struct platform_device *pdev) mutex_destroy(&dev->lock); } +static int amd_hfi_metadata_parser(struct platform_device *pdev, + struct amd_hfi_data *amd_hfi_data) +{ + struct acpi_pcct_ext_pcc_slave *pcct_ext; + struct acpi_subtable_header *pcct_entry; + struct mbox_chan *pcc_mbox_channels; + struct acpi_table_header *pcct_tbl; + struct pcc_mbox_chan *pcc_chan; + acpi_status status; + int ret; + + pcc_mbox_channels = devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_mbox_channels), GFP_KERNEL); + if (!pcc_mbox_channels) + return -ENOMEM; + + pcc_chan = devm_kcalloc(&pdev->dev, AMD_HFI_MAILBOX_COUNT, + sizeof(*pcc_chan), GFP_KERNEL); + if (!pcc_chan) + return -ENOMEM; + + status = acpi_get_table(ACPI_SIG_PCCT, 0, &pcct_tbl); + if (ACPI_FAILURE(status) || !pcct_tbl) + return -ENODEV; + + /* get pointer to the first PCC subspace entry */ + pcct_entry = (struct acpi_subtable_header *) ( + (unsigned long)pcct_tbl + sizeof(struct acpi_table_pcct)); + + pcc_chan->mchan = &pcc_mbox_channels[0]; + + amd_hfi_data->pcc_chan = pcc_chan; + amd_hfi_data->pcct_entry = pcct_entry; + pcct_ext = (struct acpi_pcct_ext_pcc_slave *)pcct_entry; + + if (pcct_ext->length <= 0) + return -EINVAL; + + amd_hfi_data->shmem = devm_kzalloc(amd_hfi_data->dev, pcct_ext->length, GFP_KERNEL); + if (!amd_hfi_data->shmem) + return -ENOMEM; + + pcc_chan->shmem_base_addr = pcct_ext->base_address; + pcc_chan->shmem_size = pcct_ext->length; + + /* parse the shared memory info from the pcct table */ + ret = amd_hfi_fill_metadata(amd_hfi_data); + + acpi_put_table(pcct_tbl); + + return ret; +} + static const struct acpi_device_id amd_hfi_platform_match[] = { { "AMDI0104", 0}, { } @@ -121,6 +317,10 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; + ret = amd_hfi_metadata_parser(pdev, amd_hfi_data); + if (ret) + return ret; + return 0; } From patchwork Tue Oct 15 21:36:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 835681 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2068.outbound.protection.outlook.com [40.107.236.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 08EE82076C6; Tue, 15 Oct 2024 21:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028259; cv=fail; b=t1LQpPdaACHd31RQvCfYfTuY9w/UKLbqgH1rjY+kcuMgqPH7g4TB/8yTRBqjK3oMEPAeIuO5aJZ2qFFg6ie84kBUvfMFMM9knusXuxgYoleM64RJ2qYm4QD7PnXlo8891nPi96k9UsxeTaKUUv+kfR3JAn12bKGz2tUrlk1T1fI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028259; c=relaxed/simple; bh=UdOW4Xv9ck1ciZLr3sl0n8S6T96DVmCSHnMPmzsMg6U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TORL+AGuh/egIV1AYfcPnAasCo6BQ9+Uk4gEqQXqAwt3hYtEqlpZ65mC5J4FRlwdqSGuDNurBqLfzTydU3EOHe7GXu1D6tpJUrvQ2hOh0YEqRUf5NtqJVCt/HL0QEPTRAazT5KCAB1in4aWNrOnPPd7s4bCMbRQJ+vmQxVQihcY= 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=AhGA8/wn; arc=fail smtp.client-ip=40.107.236.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="AhGA8/wn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qESlj4L/gFFZal0aPzQKqMmASnFcKXz7POuxYo1sn1+mJQSd2zsr+BGuLcQt7PqC7E7EoCbdDR79dhEt32HLUQISAsTQvyQhNxQPQBi477Q3pyKKX5gcyD4KYuRWIbMOaPZr4g9l7Wlme0MSxg7EPUEZmoT0gFcpFAkloIb1jrM/tdBOv36bgTeZIFIgZP/6bxGLW3EOrR8tD7IlGmMH9x522Dd0EQQSKQihhQ7mvwrtFmnd1mcQ6CEMTXA18yMdllpjmUcNjOK41uPe1O0hq1vNJyWaQvfmr0vVPgMU07tQwflUUtn+gsiRM3Hl3wDjkZolO4WgO4A4cbHdhUwiww== 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=SZfSkrHvi1ViZyJT1KnIxWHHVP4d88vzNaqipoDWFJ8=; b=vHCKkEuOoN1wD0Pz0oyJ5XDiDTSVfdes1m8XOFyKAbCKdUeToum2prGJdYlPqPL4D5wkoiSW5o7xZ6ifJiXu3xbhIIBrfqh2rgLEupXA1cxv5HJ5M7iSk1vy0NctVhQglplYqY4q1owpyJBLruNP3Y7wFcxhu9BaTC32rfbooj+EBnakvgsoEQeGazj1KkuKqQItO1iLXACwf0q+RWAI4WAg6olPm+DNBGj2w2E+6twg8xXAmgzrqYzXA0pQwhs2s7GngEmj6zuAzc0Y8C6RxPH9b4YK4RdNz1qvGYIOuo9eN7exla6kDuVnkDDDL6CPrsjXezkoEWngHYGSj3ByFg== 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=SZfSkrHvi1ViZyJT1KnIxWHHVP4d88vzNaqipoDWFJ8=; b=AhGA8/wn/9P+K9ymv1tBjyKWLtgqfo2xcnnQTXLVHtiSreH4JmtyiyztMjQbaHyMUqch92WKBoZbD7LD0h6LqO3b9ZJTUULkx3pKqFf0TjXklyvmxqgzGUOH8SxgJg8nqQYE1og6NRIKMsI7T0Fc3cpkDpOhl2dliuI8UoZmEqs= Received: from BN9PR03CA0657.namprd03.prod.outlook.com (2603:10b6:408:13b::32) by PH7PR12MB6836.namprd12.prod.outlook.com (2603:10b6:510:1b6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 21:37:30 +0000 Received: from MN1PEPF0000F0DE.namprd04.prod.outlook.com (2603:10b6:408:13b:cafe::4a) by BN9PR03CA0657.outlook.office365.com (2603:10b6:408:13b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:29 +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 MN1PEPF0000F0DE.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:29 +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; Tue, 15 Oct 2024 16:37:27 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v3 07/14] platform/x86: hfi: init per-cpu scores for each class Date: Tue, 15 Oct 2024 16:36:38 -0500 Message-ID: <20241015213645.1476-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DE:EE_|PH7PR12MB6836:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b058f2b-c499-4f6f-2524-08dced6191c4 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: yVbRAeqZrKZUG2DISDLiCRx/RTU/QGZmBwzxtWW1jmR9WenxcKWg+ELKsSskWRe8g95pKlSbnCtV0Al8CcNDzclQfgX0FnK5GJ8x8JeRw1JTwvbmofirCKRDqtQCt8TKBbWSGcNnX/hCUZ83uHkj9BvtzLsXpJcSlmuGke8N1IDscug7ZkYZ6s9vcGEBQmuJiZ96PAgseJIt5I1z5H2CAAf0wN11arzOT4urJ1Qv+RUgB861eOX2GEoCAygyiEtsKOUZXx69jgU4bI1s+CDJnG7JJvLRqKoZwyz66pKn1AFgN3J1lnmDUhTMID6wTlgaBLc1IZ+wLsK7uku0Ygsqp3lyywIG831eQrTJB+yI6/k6qWOylmEHrjQaBcnYBkyN2WFAtLPw+C8HydQyQqjGGxfl5pjmJ+Y4pbpdK7IL3KSFe7htJVNZ/Tc6aD3fNIoj8iuJY793fyxv1nf6nQ+TlqGLpeE/NNUyUzYn5CBwPalZmxwNkqdDAxqNI4rYCxtkwkm6zi1BD/QVJMU1Q6EIWtzRhfFJfm4gEqqewLIFvPETF8bc7UfhZc1tHrqZ+igCCUCeRjgwGWkc/OiKzLHKqxgYt8lI3a8llbp7nybCdCm8vVciLR3//Kvp7VQ46Ey6fthzNHQJRj818XTEiS9SrcpcEC3rdspr354pWU6LgYiZxyla68MdNbtGA+Xwf1gWmEcT2mEhh6ZznBqvT8YPCE+w9xoijmkbf1H+CtukqDN2BWX8UowodfLuDFmR245XqB66ggSbNVKPOFQMrOpaEq6RftUWfy0jTecBlFgp6vb44CWTcUqjp4n0ex5x+R+wlhlICiA9hcqWiAETa1/S3yMuo108B/HhTBcVmXX9CwgH48Ps7sn4VPh5IViX4eStmmX44mq6rl00QDJmsb3cj0Ra/SHB9V4G8YyTcZdCEucvQRMyrOBTwVpF7qKEDb8auF9KHqkCDkv+suIOItTrzxstYcFARQr4VZYofOIJbUrSqXsax1umx+HQx+PhdmWf6w7JHUhVtubUFwzA4x758ZiCal2O4gD91SvXGQXqClbIR4o4R2EMBx4OdOrgR92DpF/eFCjR/M2eTKqf1VnzV4ybiRfnz3mLUEMGXBshGKYWewRkzw1HXj9qjJXJIzavkmRZobn8U+nW6BYZ8Yb5dbpXdQl57laFIvGyxvgSeaUxYm4o1TEHh4zVSiCzqXDUQYWPKsAuzaPJazrZN2u7/3pbYJbcBUgQHpn78lDGKhulCaMu9BWy79E7hE8P2mLnuYIR4NMeAadtGQ4tsmWYCDmGOzwLpddCd+0FH/QZAM9b/yDYYfOdAHg79r0LtBqq7H4lv6oca6xqQ5fd3y5X0qcarkX0i/8w6p71nJ6c0Hs= 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: 15 Oct 2024 21:37:29.2304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b058f2b-c499-4f6f-2524-08dced6191c4 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: MN1PEPF0000F0DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6836 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. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- v2->v3: * Drop jump label (Ilpo) --- drivers/platform/x86/amd/hfi/hfi.c | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index d2952233442b..63e66ab60655 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -118,6 +118,8 @@ struct amd_hfi_cpuinfo { static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.class_index = -1}; +static DEFINE_MUTEX(hfi_cpuinfo_lock); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -238,6 +240,31 @@ static void amd_hfi_remove(struct platform_device *pdev) mutex_destroy(&dev->lock); } +static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu) +{ + for (int i = 0; i < hfi_cpuinfo->nr_class; i++) + WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], + hfi_cpuinfo->amd_hfi_classes[i].perf); + + return 0; +} + +static int update_hfi_ipcc_scores(void) +{ + int cpu; + int ret; + + for_each_present_cpu(cpu) { + struct amd_hfi_cpuinfo *hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, cpu); + + ret = amd_set_hfi_ipcc_score(hfi_cpuinfo, cpu); + if (ret) + return ret; + } + + return 0; +} + static int amd_hfi_metadata_parser(struct platform_device *pdev, struct amd_hfi_data *amd_hfi_data) { @@ -321,6 +348,10 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; + ret = update_hfi_ipcc_scores(); + if (ret) + return ret; + return 0; } From patchwork Tue Oct 15 21:36:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 835682 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2087.outbound.protection.outlook.com [40.107.237.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 658A92076AD; Tue, 15 Oct 2024 21:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028257; cv=fail; b=ElMWI+GfE82QNs2zQbxuDJF9Kcr7zuzx8J8GzSUk/fVX/wNUw+zHztypqMC0qaQ3JWZcF9XJ4TlQRzeid/9OB+nJ9oOvsLNmcoDFEw3qjfyv66hB1m/IzmWBWo8ElY15lzIboW+gI47LwxeAm1lBtlv8Op0un/of3q8empDiNVs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028257; c=relaxed/simple; bh=U1kUTPbBjOg7McrhqZd45OWpUCR57dTNt+kQOkAb5EU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B029X+KhXQX4BQjo/ptRBs6xTw//dOkXaq0d8ItNLtfS0vJwVVqHUMOsTa//yzIm6x+GyDgAmwsc4fqe6sH/41XisWu2Gvm7BKQIyJMVF/D8ftDM9IioPQg/V5IbtDbcJbZPX9aCummHwNfuTgpGlzKS4zabxdmzzp+37tOJ3UY= 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=fZVOtabw; arc=fail smtp.client-ip=40.107.237.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="fZVOtabw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pZkKr2L/cXLYgPkUZW2hSrRtWc5lJqOFToDFJ0Xir5hQkvEFOzg73pB5CTR+SKXjQxgRrULJuRJusK2tBrVU2F1YysdtVLnf1/yV4a/6qx8RjS+pa6bw/3aBGbm5ETVH5uT/47tVYPjqHSE54ez02rr46xmK2FKePYm8thMt1Vo07UyCQsU7mVW907aqt5J8wwX6GQDY19yPWrrbhaw/Xsd1zuDUCjKF7m/hArAokG9n2OT3uLA0H3pgVVkCzU7od7PPHuzI3768kvZxRi55wmoPRb7e2JZdHHeuWAom6kNNH3ih7bCvKE3n7TKNiWW/P6yK/dzS0eGM3Q/pdCHZgw== 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=9kvrTBfrCjQ8v9W6zk9aj4e7A1J0E44xYIShffNHcZE=; b=R63ZMXqYIN+4fcL2DSZkQ7ceVYcZeSgnlBANHRsBnBiSPfSeazCSgVyPvfL2rcrZiJ1/+ipo7HMoNPdarDaVusv+FUOn80UO0PDPULGYmQDnTAb4JMjlom4osZtknkX4jLBAHVHgiVGhXOVnvtlFVk9GskJtcifjjpjCnyhj4QsZMQVFvd3lQfeGJrKe++D5IqLrto3ovbb95CZZ/qqa1at7PGmEiMzOl71XhVdiJgrEKzioMBPO7V2kSzl7C3CO3rEQ6aHvd41xEAC+Na+bc0/Zf9ql5pAPM1Vm0FVYhuAcfEG3Zmv70H1H/8CI/IoYIIHVuBvYn1EL8o92tWofxg== 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=9kvrTBfrCjQ8v9W6zk9aj4e7A1J0E44xYIShffNHcZE=; b=fZVOtabwyU/4HBIH0bluIAlIEk6LgEY9/AmtsUiQkyQ+7PxEIUD6d98/is89im7TQRq+imUkE/Miss+9qcpRNez0V5Maa0Mn7Z6aAxrLazgonx3aUpW5Mm5IinemKyy7+ryX8+yASLO6MPLLDi3lxAMxg0dktYxvYdfciRMf+pQ= Received: from BN9PR03CA0649.namprd03.prod.outlook.com (2603:10b6:408:13b::24) by SJ0PR12MB6688.namprd12.prod.outlook.com (2603:10b6:a03:47d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 21:37:30 +0000 Received: from MN1PEPF0000F0DE.namprd04.prod.outlook.com (2603:10b6:408:13b:cafe::ef) by BN9PR03CA0649.outlook.office365.com (2603:10b6:408:13b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:30 +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 MN1PEPF0000F0DE.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:30 +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; Tue, 15 Oct 2024 16:37:28 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v3 08/14] platform/x86: hfi: add online and offline callback support Date: Tue, 15 Oct 2024 16:36:39 -0500 Message-ID: <20241015213645.1476-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DE:EE_|SJ0PR12MB6688:EE_ X-MS-Office365-Filtering-Correlation-Id: fe439f1e-f01c-4f98-56bb-08dced619298 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: AHLmwZDPDkOgS2h8OZiMmaTYVm9+2RgT8tIVtqDJ3f/lZ7lfMnUn/9Zqy0FfHGvxBn46xYCES4MAElZ2SDJYVBnJa0qidBr7Jpffs3oJxKnHSBuZXtDSGrMnvSlLa/QX5KwKlpSQ/bAs2FhrXVHV3b2AIBZV/1ZxwWKd3RwJgwI/i8CO7FxwB0iEuZFiOIXD+ScikFCz8g/73KxTaaVsdKlAug23IEjeT1eVYEsaqUYI1BHwk99nJPPNMGC4wFxjIlzn+gfYIF3cPnVxmHyMyljgvijJsjI5Vf/D5wS01YnHznCWJA+VL15kCbbccS5oTeSWHrrGMWYZr2WzHJQIsmhLAga+owZZUhJy59E3tEWfvI68+rwfuyhWC1UcA6iE4WJOdtTAZ1f8uEjI3atnwHSHACY7OQbV1yC44VXYmkV0AOYbv+/s73gdvOUEthSq0aitLJJbqiUGDLa7bx+MOH5BjsP03LpyYivq2rDd2AqKjRjqGX+JjUNe5p1AWY/ANqcQuLXQ4MV9ZBpoEj7LC7fARtQNp2oLQnqQvVWxLrbtVR5BCEarBzer4RxTiJs3khO+0blE7Hwc2Cc1cJ21VavkDZS4qG5OqA4LoBx9iScD3whlW1DtfGLnSL3mlU2ZwAn134NwoiS4VtXN9JlTL8r0zV9yXFPSup5eI2OymI3A23E2hJD+gNBEJwBfa7odqOpZD/ZpRN7jOr1kSDZFA+ktvesV0/D374qT6242Aw02c3uAInrDjeNPw+rnMA0AC4hukxbslIuSg0Rtvf0kmLnitofiUipHIqwHmcbrBPmwCSQLCGYI/bGr4VAEBqG3mTtRygL7dHLojktB0+KOOciTBBnA+p2Gva3pds40ORjMJrgdGESIS/5/nSK8W/RCNcXbt4C77sw7IOUKZyc02Ri1LJTfVev/5fmFLf5JHHAuxuHFaXhWsRhHlztU3POLHDOaGkQS/QKrZvjaEDKZjJ+0RCXQHU7g7HR0ODcP5U+zJ8OqY9/E8k52wxBqzXKaDK5W0GFYPUVEJpbH2zMuqg7ybsHDa1mcCtqoaItlPzJGoeUUYhAP7pIIbKa4wgF/Z+t2Vx8djMMB+xvdkrgJhrfdOdisRv14k522XHbIn9cPtGYiGO/4gWAbE74XWIo9KG1D1FkuxXIcY+o+SiTKgaBh1DOjLW4XB3V7DsF47i28zKqsC9XhCafRzia8EKV68K5aKLQtnffAqKsZ8VREMlLM9usSlGL9hWHUSmtj2SPM4V7qj5fnUQ/wFX0aEpOGoRXCSBkiSwTCxrbi/23xiYuPGZW8WCrWIZUwwGav2D9a5OI9GSTswjqQYzPdbPBDNaq+QENIevPJBb+Gs2RyK7/kjO7RGwXLKs50f36FitGO8TkzPTriEiUeA/aLOh3D 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: 15 Oct 2024 21:37:30.6210 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe439f1e-f01c-4f98-56bb-08dced619298 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: MN1PEPF0000F0DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6688 From: Perry Yuan There are some firmware parameters that need to be configured when a CPU core is brought online or offline. when CPU is online, it will initialize the workload classification parameters to CPU firmware which will trigger the workload class ID updating function. Once the CPU is going to offline, it will need to disable the workload classification function and clear the history. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2->v3: * Use guard() (Ilpo) * Whitespace changes (Ilpo) * Remove labels for unwind (Ilpo) --- drivers/platform/x86/amd/hfi/hfi.c | 79 ++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 63e66ab60655..d971ec1124af 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -249,6 +249,80 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu) return 0; } +static int amd_hfi_set_state(unsigned int cpu, bool state) +{ + int ret; + + ret = wrmsrl_on_cpu(cpu, AMD_WORKLOAD_CLASS_CONFIG, state); + if (ret) + return ret; + + return wrmsrl_on_cpu(cpu, AMD_WORKLOAD_HRST, 0x1); +} + +/** + * amd_hfi_online() - Enable workload classification on @cpu + * @cpu: CPU in which the workload classification will be enabled + * + * Return: 0 on success, negative error code on failure + */ +static int amd_hfi_online(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info = per_cpu_ptr(&amd_hfi_cpuinfo, cpu); + struct amd_hfi_classes *hfi_classes; + int ret; + + if (WARN_ON_ONCE(!hfi_info)) + return -EINVAL; + + /* + * Check if @cpu as an associated, initialized and ranking data must be filled + */ + hfi_classes = hfi_info->amd_hfi_classes; + if (!hfi_classes) + return -EINVAL; + + guard(mutex)(&hfi_cpuinfo_lock); + + if (!zalloc_cpumask_var(&hfi_info->cpus, GFP_KERNEL)) + return -ENOMEM; + + cpumask_set_cpu(cpu, hfi_info->cpus); + + ret = amd_hfi_set_state(cpu, true); + if (ret) + pr_err("WCT enable failed for cpu %d\n", cpu); + + return ret; +} + +/** + * amd_hfi_offline() - Disable workload classification on @cpu + * @cpu: CPU in which the workload classification will be disabled + * + * Remove @cpu from those covered by its HFI instance. + * + * Return: 0 on success, negative error code on failure + */ +static int amd_hfi_offline(unsigned int cpu) +{ + struct amd_hfi_cpuinfo *hfi_info = &per_cpu(amd_hfi_cpuinfo, cpu); + int ret; + + if (WARN_ON_ONCE(!hfi_info)) + return -EINVAL; + + guard(mutex)(&hfi_cpuinfo_lock); + + ret = amd_hfi_set_state(cpu, false); + if (ret) + pr_err("WCT disable failed for CPU %d\n", cpu); + + free_cpumask_var(hfi_info->cpus); + + return ret; +} + static int update_hfi_ipcc_scores(void) { int cpu; @@ -352,6 +426,11 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret) return ret; + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/amd_hfi:online", + amd_hfi_online, amd_hfi_offline); + if (ret < 0) + return ret; + return 0; } From patchwork Tue Oct 15 21:36:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 835680 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2089.outbound.protection.outlook.com [40.107.102.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 A6CF2208D75; Tue, 15 Oct 2024 21:37:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028259; cv=fail; b=CFtP8yDVceCyh9gb39utk3ZtAW490kXgBZyfpeTRh8l0daA21x3JUOm8ijwESSzYo2+9EkeC2tIzE+5WSHffOT8NJvDC21HFhwJJfO4gSN5SXyqRmJOc2TQ1HsGyLD32IDUnwk8TW1e8pbpInkteh3ZeyD/YmTbBEqLnYBGqQ8o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028259; c=relaxed/simple; bh=mOGd7s2YUbghZd2Dxn3QUgfPmXQIdu6h9VT3ARaHLrA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VtbDPjjdFKiJXmOT9Xp7fD+2ZJ1+L/KOC8tOL4eIPuc+q0oCsrgVXLfohUr96j9GLSd0ekf1a9jB0vlwU1fM3z8DPgB5Td4dSbcpA+UDUi7LUgIAkwCIHWPnTBKMAtM3C/qfy98KEzdw8s3fcJdtVWxAdzXgScHhExSq+Kh1sV8= 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=5fWxpc7D; arc=fail smtp.client-ip=40.107.102.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="5fWxpc7D" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C//oKykut+mFDgqNQB+DzRvetrtz6QXbTPvaYJgnCGnWgeRWkhoQoOyZYqapECMu78xRKd2zLp0PduLa7RdrN75CMlMI6OjxE77egN49lymDNDnFM5A/3nGVE+05aAaJoAcB+zCzsU3WlL6E+Y5C9EuzSRrdCVFwUoTc9J31yyV3GW5iGoiv82tz9wY+PdJwPWSNMXHMXXjqlK/QaAZ1g6B58zwT/68N/PSP+GdbNT5ECjUZfY8K65qk5z1zpNTsElbIc6R4nBXEHAWCt8pPIsCoRFbU/OSKFV3aBZ/uLf7Z/IKQveROjSKBN5CO91TQndGihiSgzsiS8RjFCej01w== 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=tORVxfEFTV3CnIWBkOSUc1UbnaD502E2dRLezlyLwrA=; b=pMcq6mumdwXUkg3fdHaFdmBUeJcWsVzYwIl/nGhma075WmR8YNf3VA5Kbg9cJZy6KxWUZeszDBlOntLeWaw0FHQ64m/q7jpglblnhUtxnaqzpO4Dny/wn3ywwkBG3fBqpHaDHefWDGrMfCrUDRuJlDN5EEIv4dhpFQ/QydxW2pOJDzcsGeceQkclGM+dCqR98YIgimDZPB90h6X1pRbYJwhnXUKRWbI7XZOkFskwZify1Ju3lTNnFLqAXC0jAayXcFB5UxV8wckZcn2UNiIiI/1YAYrKhE1qJVCdm+/xNxQP502w26IB/w2ZM9uY+yxDA8G5ro/CE+RvNKqoc4LxJw== 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=tORVxfEFTV3CnIWBkOSUc1UbnaD502E2dRLezlyLwrA=; b=5fWxpc7DDh1q/x3pVBHJNTmjmod/pM+30OFrIpZkcyRm+LR2tc2GykCE6Ii4kJakA6GG8xpO9cCW0o9dsnBlGMa+y+yU03gSyJVliNhlLOb2XOq3h1jV+d+mfVrL9EZqqYBMjIwUdmOasnXKlntMbLO0KWAgtYk8Oyn+jztYzCA= Received: from MN2PR20CA0045.namprd20.prod.outlook.com (2603:10b6:208:235::14) by PH8PR12MB7327.namprd12.prod.outlook.com (2603:10b6:510:215::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 21:37:32 +0000 Received: from MN1PEPF0000F0DF.namprd04.prod.outlook.com (2603:10b6:208:235:cafe::1d) by MN2PR20CA0045.outlook.office365.com (2603:10b6:208:235::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.28 via Frontend Transport; Tue, 15 Oct 2024 21:37:32 +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 MN1PEPF0000F0DF.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:31 +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; Tue, 15 Oct 2024 16:37:30 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" , Perry Yuan Subject: [PATCH v3 09/14] platform/x86: hfi: add power management callback Date: Tue, 15 Oct 2024 16:36:40 -0500 Message-ID: <20241015213645.1476-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DF:EE_|PH8PR12MB7327:EE_ X-MS-Office365-Filtering-Correlation-Id: e0ef91e0-d948-4efb-de97-08dced619343 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: nsSFifQyVxU3MZRx0Z5cnAUHa8GC/yNs2n81l5majBQahzK1qSoh/1aVK6gCgAoYTtO5gli9Nkcw3PYqgzOme7llFryEqbn0W6XibOQSTksoskOn817GeA/NBc5tl0xsU+kk4H0xR1b/0EIAEYg6C0RHB30pvl2yomkoNmH8IEq5To4bOKQ35XUo0om6Nmp+rtCy7I7SWHbhyIVmYLrVKGmnL8UOHV9IAJLQQeKS1qyG2o/YMcPyzBCkAJJcbuJhIX19YCu/OOLf/MNS4J8Vpscq1aAQllQmTNfQBUkcA0a2p9JcgwCFki+xMqAmPYpiFP6BTPXOLoeNx5uCw5z/AtOvzIhx8wwDUZk94mpAM8UUccC+cDhEHtW03pxgx2jTl+tKzmbHQ6jHTEH5pjAamdxWx/YdR9riyoc2a4FhzqamYcawH1j9AFyFgCShwjd55J3IpiOFlID7HOWR6gEGmUKFO5JlonQS9VB9XouDfw+V733om9JXPFtQpAUwR+q4nbu4H6GUfNv0kmrIhubOBetJ3Uvrf/LlF/UbqOSIRmpzWgn0UFIXZ+fQWS3ZEVOH1wpHXvHr+r0NNMznwATx8Ya7jsrVSoLfR0LPZ6H23uaa7PKCB7LFaXKPv87ak8ReTpQtQ2YDfU0vlGaOrgHc+TbII+BwNaNY2JS+E3/4W0Y34NIo5awNVApywJhSmoEPggKN/z4hPqQIAqF5xLrkzwxJipVdu0/b2C7Ao4CYqBk3KhxkOU5HlU5r/M2SE6p7AalEMkjNhK0a6Md74U6a0FlhDbBkC3HAjbh26/DO+abvFrSMEfYUR8EAgnHETYRlAl0AOu9QGH3FsQD3ADKr/UR4ys6yLSygpgnTQkvBxGiCqNkXAu97/hFP/Xy5iCQUK40VThfLtxNkhm3ijBf0YSKSj7/9sUboUtxgHEkLBMw0DebMz8RA0bfYdp6lVXDwvooRKh1cTFL51hz9ijreHa5ryXtuYy9UyFPSPaoU78mtcBvrCn00lvlC0KvgG5FLdCYNKa25lnwvE2vuI2NBK1KDQZAEdkmOKpBG48xj/Xi91CRllARoWv49FfgaGoZ5LaLevgE9e4zEKYlc81gkpgFygwAxtIZ+yW1aVudyjHya41jdHrONsFEabMvY5awoalkaTTtHbQLFRr4dSMB3xFVgHT5KjWHl8F7jADZerft+xn1N5uMp/7hSdjVGrnLZul3DUdq37ZFGDYL5Z9Rt9K9HqNZ+4Dwid3uuCOBnnxTgdBF992Uc2D0kc9MiD4Ppb2z1alhbmixz7XzPIpe20AP0f8F9mR3+OUehmKjV6nnqfYLzoiiLWN4A36HzaO4v9Ez7ZdRmzG3HVQbJ6jCymCcxPryqEWxaFddt0/VzwotNtgtlgeuYiy97X2aE44n0 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:31.7452 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0ef91e0-d948-4efb-de97-08dced619343 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: MN1PEPF0000F0DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7327 From: Perry Yuan Introduces power management callbacks for the `amd_hfi` driver. Specifically, the `suspend` and `resume` callbacks have been added to handle the necessary operations during system low power states and wake-up. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- v2->v3: * Whitespace (Ilpo) --- drivers/platform/x86/amd/hfi/hfi.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index d971ec1124af..79963c423d35 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -392,6 +392,38 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev, return ret; } +static int amd_hfi_pm_resume(struct device *dev) +{ + int ret, cpu; + + for_each_present_cpu(cpu) { + ret = amd_hfi_set_state(cpu, true); + if (ret < 0) { + dev_err(dev, "failed to enable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static int amd_hfi_pm_suspend(struct device *dev) +{ + int ret, cpu; + + for_each_present_cpu(cpu) { + ret = amd_hfi_set_state(cpu, false); + if (ret < 0) { + dev_err(dev, "failed to disable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, amd_hfi_pm_suspend, amd_hfi_pm_resume); + static const struct acpi_device_id amd_hfi_platform_match[] = { { "AMDI0104", 0}, { } @@ -438,6 +470,7 @@ static struct platform_driver amd_hfi_driver = { .driver = { .name = AMD_HFI_DRIVER, .owner = THIS_MODULE, + .pm = &amd_hfi_pm_ops, .acpi_match_table = ACPI_PTR(amd_hfi_platform_match), }, .probe = amd_hfi_probe, From patchwork Tue Oct 15 21:36:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 836065 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2080.outbound.protection.outlook.com [40.107.236.80]) (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 1A71A208D62; Tue, 15 Oct 2024 21:37:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028258; cv=fail; b=ZfSbLytuK87TjHuMW2z4TlpVbfTzK+LzrkKMmG3RvCuZy5vnvS3AuIcsp2xbXAPkSachEtyqYVP/ryJ0LkzwjeraPrkfCyLfktS6Qh/UexMUG+Cx7AMK5lV4aHulDbUZV6AZr+3EZFl66tv923T01PaVBA3weUy57rB6fluWcp8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028258; c=relaxed/simple; bh=bk1pXc5w/Z6XCOmUNn3AFkqPn7BS+gU7wAS0Jdem5xo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BgCTVab38XOHsUsFbv8sAgCI5fZjET/gpmdUAZmchDzBKZyi+v3EtShE298k1nHDcJFho5/CuXqMVDvuYXAb387p3nPloTeOO1GUfIAKfnwBGBdgZMLpHNn65t+xWF7fg5NzftjkAcKp84/1mkVso1+jOcRPtZH3aJ8Z/xk8lx8= 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=QQpkS8Ow; arc=fail smtp.client-ip=40.107.236.80 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="QQpkS8Ow" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F+bM51KgR9+2cYzAVXAgvbb+prfeJikMuCWUHJwUx32wEilSsVmcy5HfPSbs8PwOQKbCnf91D7ftVkdntSFVLaoqcmFPkc3OYygCfnA+9fMhdIp+sNplM7mRB4Hdcnqe8Y8KyciEgZzHHCFBeXjLVwR7/XZcTU27ycUBHW//1ATRBK/akc3ixKk/i8YvWY5lJD/vKRy0rmG4lY3gbBktDv2l1QOg2LmIbkPUwNh5uT/jIKR0hsT8KqxEqXMGdeddVihFyX4kknvUq4h3BydFD0nktTsdk2hUAjR+SJahAWwxCQnajaDutPB4WP3+3D0E1wwM/p/LABmLuKkmZFDRrw== 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=myNXrZpiled+NLs5v9muNSNgBrdbZeZ0A1AUa5emUD4=; b=I73MpgvgqHN+Qr0FQFeyAQkeZS22RqMd9Pe6cFiDdd+ylXmDq4U55Q6Wu8htiiQyXL7t2ypB24IddoI+j1hVDSgyNbyoeGRiLFO3Hws+fEcYsXrJMHMNQBdt06cAYoDOy64+LvmZlrE5TqHrxvvCbAhJsKfdNMxY3AdGki0Vd3cWiTwr6fYHjgWmHCVWEM0svYZeRrObu9p5nrk7X7T9WFIEGb5QRt47AxuR0cOKCrGxE5U04Qb7Jwb1xPSAIPqlnpTfsWSOvpEQBcM+5sptmXbenZ4vlTWcs7wF8E1X0slwz30ybRzHMZGHKyb5gIzweeuZTf1Tc7uuG1r3RQ1FYA== 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=myNXrZpiled+NLs5v9muNSNgBrdbZeZ0A1AUa5emUD4=; b=QQpkS8OwcSJegnHkVwg5n78IH5Gqyrvd4F+SE6M7N1Mpva/yeBfQbCifhEwb/+vARxGE3BvnUMOeukKzEgh7spmNMobF95MFIfkQGXzx3EcKgwqsyefisP07LZp8GgrurmxyKcLcUQQM+yFPb7CmeejnJ7UWV4N49/17TXi3FsQ= Received: from MN2PR20CA0064.namprd20.prod.outlook.com (2603:10b6:208:235::33) by SJ2PR12MB8009.namprd12.prod.outlook.com (2603:10b6:a03:4c7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 15 Oct 2024 21:37:33 +0000 Received: from MN1PEPF0000F0DF.namprd04.prod.outlook.com (2603:10b6:208:235:cafe::a6) by MN2PR20CA0064.outlook.office365.com (2603:10b6:208:235::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Tue, 15 Oct 2024 21:37:33 +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 MN1PEPF0000F0DF.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:33 +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; Tue, 15 Oct 2024 16:37:31 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 10/14] x86/cpu: Enable SD_ASYM_PACKING for DIE Domain on AMD Processors Date: Tue, 15 Oct 2024 16:36:41 -0500 Message-ID: <20241015213645.1476-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DF:EE_|SJ2PR12MB8009:EE_ X-MS-Office365-Filtering-Correlation-Id: b10e290c-36d3-43d2-72fb-08dced61941a 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: k20T/E790ErMiOSNYuA3bM4JhcyCfQL7ks996Q+pz+YinZaepy1xdoH7z/v2CQmhadE6+asb0rxfYeI4IlrCh4jRqMPKov9XphKVZSgbxfba4urvConqM/lIjwwqXO8tSoNf4IIuHuqzA5cVNPsEqbDgtKx+d5LmMEr7mEBlcmtoHJUs00wpJtyPZQS+bHzx60YHtbs27zEA98OHYSan+S2HU8JpIf/JEQ3z54Na6zocJjo4+AYajZJiFr9F4FDf4JU2dewTl4CW3tTl5EHW/NKcQcQa+8rST6C1JQ0aG7z1hN7UT2ReqPix/HpVTgJQiJA3Ts9P0ddceoauv0prIrB4vfgoNQndJd7vz7J03Z8ne4N0W/odZgCPk/44BpSrrYPRZfrgTRG20C/+SEU2UJZLpVCeTQnL3SHh5cll324+jUSS+rlO1G1Nndx3PPqLLJDy4HVmLs2y3ownrpf0EHH5rfLj2EqN71YqJLSzK+eQNYrKfCH15/qL1N092hFnq6hFbvklL3X3Y2UaII4V72col907t62L3uzpD+j0RfDCSZ3jfMVSrw/IF9a6yIz4qzGXz3lqHGxswbzE17BD8386RGXNN7kY0tDIpdyfsVOZQCtx5Q7euHr9o3ULjAA7BmoNhK3sjAKojhcIby/pMiILMQAt8QQ+95Lx0YM9MVZpkyVPeQSULYVTgzMCtL7N7VmzO2yatODw4drzKUT700uZDDuefCgc1LtN0ZS6rzQfPwiQyBWLbCVxMqYQwUbcIPFmQt12d3OBInx9b5hWLLPyyRdAcnkXRQOxCKEaXcBdf0lTyKCHQz1NmQMbd+P/jzCdCkE2DzY5hXz57ide+yWIZBIki4lD923eb3SRt/L+rjOtOgnOBKj1fxBdMfhiO7iWvaNSSosjjpVI0zrnsfCZrv4zW+Dw8uvm9WRNNvOzgjQ19c1p7zGVcl8wZcO6kC/Sb/CrLxnPZdabBzEZldfzDLrP2XOBQQEqQprpChLNFXrBmLOroBLjGHSulUoagP+tv8y1LumveyyYlB//21oexMhM9/QKIJdlWnTa/4I05aJYaPvDiUd+qbGEHQl3MFdMIhk54JU4xEGLw2gx0FGRvVl7AIDL7+QGcVbuVMceYLrtDajyRBO2XGQyuwBrb/9T+bCTXnaluX0X0MULR9NJL0xqboHkY2CRhd6aoJ7/9p7j8U+9h2HEW4tpDgFHS8sxKrmXx9fstSQwAO+YpMogF4vt+PDeo/XRCmav14tfpUHTRzk0K38VQlW2X7AV5ewy9kmbDdE7AlymlHnbbw2MqjmDn4afs12lZ4Mav9UM7h3w9wGLE3QlA9sR2AnPDDnIa4E18XfLV4JX+SIPx/WeFLzaaOBx2ghRckVM7H2iB46WXe3RNWd7MSzf8hHh 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: 15 Oct 2024 21:37:33.1514 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b10e290c-36d3-43d2-72fb-08dced61941a 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: MN1PEPF0000F0DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8009 From: Perry Yuan Enable the SD_ASYM_PACKING domain flag for the DIE domain on AMD heterogeneous processors. This flag is beneficial for processors with one or more CCDs and relies on x86_sched_itmt_flags(). Signed-off-by: Perry Yuan Signed-off-by: Mario Limonciello Reviewed-by: Gautham R. Shenoy --- arch/x86/kernel/smpboot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 766f092dab80..c01bb75d0375 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -497,8 +497,9 @@ static int x86_cluster_flags(void) static int x86_die_flags(void) { - if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) - return x86_sched_itmt_flags(); + if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU) || + cpu_feature_enabled(X86_FEATURE_HETERO_CORE_TOPOLOGY)) + return x86_sched_itmt_flags(); return 0; } From patchwork Tue Oct 15 21:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 836064 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2089.outbound.protection.outlook.com [40.107.244.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 42BF21B6D05; Tue, 15 Oct 2024 21:37:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028259; cv=fail; b=mIVuzwnTQ4xtL6y0AarIAX/vdZHi5RjqDES1dl8CVOuYGTssrpJ8A9M2EpjS7/qhozVJ+YODUdMnI0ousdu9FmEIbhxIp+/ThkzmDvluSZW9gpykMlmKCjxsCPICxehVmTLFWVnXXPxfyK5rYzPD9T/q2hFn8sisnKRfItJri9E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028259; c=relaxed/simple; bh=FfGOHXrQV+BzQyx87XFc12uuuHxIR2WSrbDfsjivgGc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uuMdlDeXU7+zI8h4cWBREVPSaJdEMNOJaSn7/SibHXh8RCvKjbGooyDlvv1FRa8ZNh63OVkF6Ekct6LzY5gSY19W2aajCMMtIpkw2BTulf4x7/is1+DzE0GupKFgbmFAfjhpVkg82VxDCozxYamf237AavsQ9TS1RPW9EPaAsiY= 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=JX9nSd/k; arc=fail smtp.client-ip=40.107.244.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="JX9nSd/k" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xxrn43GpKUul5OmpNG+a0KNkjDlNr3YL4gRnfTZ/X+T0VxPsdAqqRbiX/OCrXmzI/EBSBPWwe0qZ/wegV1z6wjtnxeBoZQXJ+hfX3ByYuBt7pAHWtHqKDidY5qNstyx3LVOfNlHXDFDn2bj5USLKr4xAxkPHuSis6NBPZDw6sqoqpICDhI6Eyv8n65q0g8AnTu2ln5u7aQasXqmGRF2ibGqak1e+jJl/sMyaAtG+Kr9n8EVdC7DxFveOtmuIO6G6rmzEwSPCU5jZVRuvNbnwz/ct+S9xrsxlio2QxviXdA2mprM4uIq7NQFm65L7+jq/XicWMmp54yM2j0VlkU7zPQ== 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=c7mhArcDsvz28ClQomHYADi+/W+d0cYhOTgJBatda4M=; b=TLfxFxab2YSSl0vr7HXEcPB79ftkTea3Wl2zfEAUOEjNYL4/KkWWrse1czY9k/Lf3gGR631exTZzh+LP4/CPu8qb/noPQIvVu0K7w2BlYSOQGQp0qaYjDfr7K6doZWokinT+oL4/7eL/4A1nJWWP3m5+B3hNJdxBLRV51C24rUxcqWjqX9bet1Il5EHOKwEiHdAzA2HXiZBrUKX9bh1UrTKPE3NtyKzlMpPJl52QNMl9kQ5SYFCWzcg+MMsbNmI/EMT/EUbw3wP836L+BO28HwfEzj0odYhTB757iexBbl52R+ADIS/UPDWwiraLBT3EHZTor9d+mPzdVCiVzlxHbw== 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=c7mhArcDsvz28ClQomHYADi+/W+d0cYhOTgJBatda4M=; b=JX9nSd/k2gzPqgWx2xU/yrtZ4ynkxetUO5ilZhR6+KqG6lCgKb887M62zdhpsx8X/RHqHbCDPGE4ss9yDme0HSbkFQtAaSduWrSF8TODamOyB9ZM/EUW1yhgFIuLZihASRVQVyfRI7wdJjLT4XKnXggytUn+eJtbyAs9+jSnKYM= Received: from MN2PR20CA0055.namprd20.prod.outlook.com (2603:10b6:208:235::24) by IA1PR12MB6579.namprd12.prod.outlook.com (2603:10b6:208:3a1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 21:37:34 +0000 Received: from MN1PEPF0000F0DF.namprd04.prod.outlook.com (2603:10b6:208:235:cafe::f9) by MN2PR20CA0055.outlook.office365.com (2603:10b6:208:235::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Tue, 15 Oct 2024 21:37:33 +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 MN1PEPF0000F0DF.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:33 +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; Tue, 15 Oct 2024 16:37:32 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 11/14] x86/process: Clear hardware feedback history for AMD processors Date: Tue, 15 Oct 2024 16:36:42 -0500 Message-ID: <20241015213645.1476-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DF:EE_|IA1PR12MB6579:EE_ X-MS-Office365-Filtering-Correlation-Id: e50e561b-8a1e-4360-bd0d-08dced619485 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: dDc8jkKEIoU6pw+1v17N0rN8+7NxDWoJHK6rDRql90mST0L1QWF1bZz8M/UhPtjn8jhlYrvs/vpYQxgCV/I1XTq/arC6IkG8d5p7bA7KJXUVr/sTAQ0K4nhVvmusJNweaQ2cwKmHMYe7S29lnmutb1W5ELsu5yS8d67kDm0jO+cqF/nFLMC5xqFaPg9RhKPaTDF9dDRP8x82QLDYmU60HI8LrH9ywj50xupJm1ofbcfxb+eP3MFhiqTdgoHd+cUW6szL3f+wRRADu87Dr2vIMqcT/PgizLyRRx8YvBBwwl8Ecrr8HoUl7fa+zhmKUt1OaJmu5LEIegLI38cJp3eacy4NL+ayoWjiO/cf/rzF2Qsv7fGKDEg8u/kB7Cpl1256wdN8b5uyTb7kH139+mNqit6X2yQ+0/JVsgevZgj1lxRlmKyrZTYn3IvmhsibDZPx5i3iQ2dnIaYqcVZv1QiB7YNHw1yATD85ltwVaRiZkEPJK0kIZY3jm1/mo3i+EJ8Js/kUB+ScPP1ydh6fVmFvueW+oqIl1c97RYY4Nub+nzpU3FdjDD2XXgxg36qACEyHWVCGe4O7K1IToUpcQRbn5rOtGfXzp8r6/XmF1gZqpFr/Z9Q2Ki1iTWObYk8iIv1EaYtkNUmBzEnsFHn2QtlNV1sIMgqqgefmVrx4/aL1eTtOt6ocFISB0HSS1K2xbZRNIgPrP4m4+LXhFiAX7zFnLwhZ0xuxeiPW9eiIW7me4idfXSYirB0eFQKj3ZaLc91Y/RbP88K/xr1+R/6uTAm2K6FYE794Ll+b9YRz2c/rGhGJB4zU+ecPpdKynKP+8ixSqSY7V9mtJm/ho0VSvKgjLjVswCmIu05636fHmT3dHf1nK8/MyUncQkoPK9yopblSHAmXJViirwBxP3b/hBBgAxYo8oik6FmYAZmzdksOFJce00zyYFtCowLQ58CitdgkxvqiHzr6yo90o4BXaqu9XqEvw3LuNOo4sVkfmHTB03Upm6NTFf4SahMzyNN6GNPkeTI006/c7qD0V5w8cjn2l7AIuzk0c/t8+9iGmNgNtj1BBQ32dUuc1ACtZg10Dc0XVsM2ycSm6l4INXtoSEtDQmBs9bH2m6G/mhjPCKbS899qPHwzBpLBIsxcuoBU6zfKyaL81s2Z4x8af3jb6BgWHAEPwZF4fVi1EAn7+ANaqReXrQ2UuOOT+meAGk5FlvvN1yK87t+zaZyZA2Xpr+lf1925DaezzhAwF6KW+QKxySz8s3MJeJbQ8pto5tSQqplBWwYTjctaHTe/sdsz61TIzrAISR7TRzYlZCh4waBrkKajPKeY71OwKwKbokI6hetjHqq1TI3y6fr6w6oWAaXCF+LyV/FOTd25mY/pRZu0rb7ixb9Ua7MWGm2vQAe4JYRv X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:33.8546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e50e561b-8a1e-4360-bd0d-08dced619485 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: MN1PEPF0000F0DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6579 From: Perry Yuan Incorporate a mechanism within the context switching code to reset the hardware history for AMD processors. Specifically, when a task is switched in, the class ID was read and reset the hardware workload classification history of CPU firmware and then it start to trigger workload classification for the next running thread. Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- arch/x86/include/asm/hreset.h | 6 ++++++ arch/x86/kernel/cpu/common.c | 15 +++++++++++++++ arch/x86/kernel/process_32.c | 3 +++ arch/x86/kernel/process_64.c | 3 +++ 4 files changed, 27 insertions(+) create mode 100644 arch/x86/include/asm/hreset.h diff --git a/arch/x86/include/asm/hreset.h b/arch/x86/include/asm/hreset.h new file mode 100644 index 000000000000..ae1f72602bbd --- /dev/null +++ b/arch/x86/include/asm/hreset.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_HRESET_H + +void reset_hardware_history_hetero(void); + +#endif /* _ASM_X86_HRESET_H */ diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 07a34d723505..887821e97e54 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -403,6 +404,7 @@ static const unsigned long cr4_pinned_mask = X86_CR4_SMEP | X86_CR4_SMAP | X86_C X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED; static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); static unsigned long cr4_pinned_bits __ro_after_init; +static DEFINE_STATIC_KEY_FALSE_RO(hardware_history_features); void native_write_cr0(unsigned long val) { @@ -481,6 +483,12 @@ void cr4_init(void) this_cpu_write(cpu_tlbstate.cr4, cr4); } +static void __init setup_hreset(struct cpuinfo_x86 *c) +{ + if (cpu_feature_enabled(X86_FEATURE_WORKLOAD_CLASS)) + static_key_enable_cpuslocked(&hardware_history_features.key); +} + /* * Once CPU feature detection is finished (and boot params have been * parsed), record any of the sensitive CR bits that are set, and @@ -1844,6 +1852,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) setup_smep(c); setup_smap(c); setup_umip(c); + setup_hreset(c); /* Enable FSGSBASE instructions if available. */ if (cpu_has(c, X86_FEATURE_FSGSBASE)) { @@ -2410,3 +2419,9 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +__always_inline void reset_hardware_history_hetero(void) +{ + if (static_branch_unlikely(&hardware_history_features)) + wrmsrl(AMD_WORKLOAD_HRST, 0x1); +} diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 0917c7f25720..6a3a1339f7a7 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include "process.h" @@ -213,6 +214,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); + reset_hardware_history_hetero(); + return prev_p; } diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 226472332a70..ea7f765c6262 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -709,6 +710,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) /* Load the Intel cache allocation PQR MSR. */ resctrl_sched_in(next_p); + reset_hardware_history_hetero(); + return prev_p; } From patchwork Tue Oct 15 21:36:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 835679 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2046.outbound.protection.outlook.com [40.107.92.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 002312101A7; Tue, 15 Oct 2024 21:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028265; cv=fail; b=K8svhQ2vyVMiNFJ7Ej4uVKQu60adbuzTED4NDi1AId+XnBHyAM1dKW2zXfAMyb1L+2tyLKVhFx1iNVEtk/UiCbKK4LM1sIs+SUt9ipuyK+jzkNH890ep8SgBlQvOUu2VjdBqlBCcweFzvHcDPiGId63fs80guTPJ+5xZLoYL+0s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028265; c=relaxed/simple; bh=HJoYs8CM3OsvXicgnR/fNtM4qyoWAOL1j7CKQTEskzM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bH8KD1nEbKp3jacaJc0i1MaAvr3txsz21cnY01xgFadaDzEVUykipBcmePXxDsu2ITf2aBvSi5F8jHuN7qkRtlNPWi33Z+ZcgRBm1+FTlcaAZbl2RTa9+IZ/4XJ1lTTkZk5yDI9efjiVYf0/01OLbHu6jWfTy9vVWfWNy5+GKns= 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=Ww3pyaY1; arc=fail smtp.client-ip=40.107.92.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="Ww3pyaY1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rFiVKSj2VBnG4j3BKD6d0yhLxqhInj/hHzCXu7TQ+WVDEkbd/j/K+DYOb1iZWINKvZgSC5Mssgs/mZ/tmmTG+QpwVGpE7ZVYIOSceOoyluGxSWkrhAXuNTinpZI81NKAU19kbG8+tL8Bvd60QtrK1qhWK/RfYPFqDh/UtJuCr1gmt3YjCTDM8+KZtADpfPsIHFAqpvoI2nG2zmoGwTs0Si7vZHbH7FrXEoRYwP1E86H0h3JYIJTgPFq+spraFnmp8WTM7tebnz1A1tgtJIgmcFSL9mmoDsALVsQamUQVTmu177oztgu7lhY+lVQIvp8P6TxI5+Z1ppe2RGS6T5ovlg== 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=WMGZUYuqdzZETPuMmjwyoi+jH9poFcLM92dMo/5sI74=; b=YoOXbLIlWhUKO4LionLSjS25RcbAcTQCCZRDQzG8pq9lra6KOH4NZ27dDgVXNT0pFlJ3Z2aF58J3Kqagj6n4UrGS9AbGKBGSNehGll0UcBq16Te8npGdgAlY+aHvH/U7waOVZP9aQSY/dwroUIArJq9e/tWqn8oxfy7andB8kyrGulYatTLb8G13NnpaAzOoLDnmnvfaQ2J7hcULyGK4TIIoHLK9cZkMY+HKtY0lAWTH4U+YAlALBh5VMdiQblnEcd6OJ3rzPqUmZNhGuCgUyxbhxLGgMHzWvzsVVa4Nv3SgUydixCpD2MHGgrZjroPNtLwROQCJ1ht4ZmPl4aD2yw== 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=WMGZUYuqdzZETPuMmjwyoi+jH9poFcLM92dMo/5sI74=; b=Ww3pyaY1QD2H05+LGW7QM8OOkxsrghVGKd/eWM8mm9sr8HM5jFzaVZq0Jy+bfC4PKpschUIOUCcOmkW9mvN+Qwrs6mHAfOHwmbVYUvhTHzeSzpPBoksJMmUWaSbh/txia6/R3LglnpjjDCIiDhwZ6aTt2vaxSGy1jMCpYF+lz4E= Received: from MN2PR20CA0064.namprd20.prod.outlook.com (2603:10b6:208:235::33) by PH8PR12MB6820.namprd12.prod.outlook.com (2603:10b6:510:1cb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Tue, 15 Oct 2024 21:37:35 +0000 Received: from MN1PEPF0000F0DF.namprd04.prod.outlook.com (2603:10b6:208:235:cafe::d8) by MN2PR20CA0064.outlook.office365.com (2603:10b6:208:235::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Tue, 15 Oct 2024 21:37:34 +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 MN1PEPF0000F0DF.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:34 +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; Tue, 15 Oct 2024 16:37:33 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 12/14] cpufreq/amd-pstate: Disable preferred cores on designs with workload classification Date: Tue, 15 Oct 2024 16:36:43 -0500 Message-ID: <20241015213645.1476-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DF:EE_|PH8PR12MB6820:EE_ X-MS-Office365-Filtering-Correlation-Id: ac4940cb-656f-435b-541d-08dced61951e 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: VMP+vSYLnaDf3+M02yCb6jQKVE591xA07Oio0xtKruNp/2EM3wqlqtBALNZTJEcQKeZm6B5uyV6Siag/0nEZNLR0wYHbZ6mZdwOVFs7y2jjnrP5zjB3wB6lY6QgXjTlA0QB5kSReM+oiYINVBFF3z2qk/f8Ly8R+a+I0prIPC5K6DRDfA7TOvfqkeRwJUtNgbWGxeo9dM0r9KYjrLb4+62j8EowWoco+60Garl9BBMQuWvmAz8D5UCu69qfEqk3492RdzXroqIkVsuwIzSfWIBs1OOu9VTmdp1hiqPudjV3/x0rslplsfGdIOOAUFDBAu/ZVZBnPOOfF8zWRgy9mrTgnbAN3LD+nuhFC8x3R+t79cmZ25fbhXeRktf7s7DpBnJvrczu7/BBOmIK3NVXCitx7tQO/4vuTLbmTXJe6eKzWT5I3Dmwj8vtZHOc+CqHvWae+TPjILZwwSHtAlV/5uQkhNYEcW1Z//BB1oMx7XLkpP594heGNC7q/r6HXz7SiG7hw5hE7hsBjt6+wzd82hzlk9XV/zpF1zvtigm4+6tSHJQ+Aw8dNEHqEETSzKT9D40gPvD6glWTwwD60KxaXAhOc/vi0wJ9TLMgHf8KcSCb22Vv9w5MAojpNSB92EL8QqPU9wTbIH3h1D34RpKKlw2UwHpVF0Cm6qPB1mT8sc7tFj0bxthrCW/hxvo9u2JKEYPmCjxPt2k7T1UoQaPbD9e67ld0un3cxLbaEzQcY0UKiPNhH4XbTc5mQay8G9QBV7O9GuoX5CjPM851ugXcoU8bxU/E4+I3t844fbOYQJv0K/FqYdGMABDVfy5sOKzMwck8a8sSxzQn6q8h8xNCZCMxtpk+itzyJiDwKMg60cVuA/R5je9XzwuzfETkkVAboTTFh8nl0PJ6b/JauEKta1FKvNce9Zo7cg9qdFzXifa61MhtZTfO+YH9Tq0iMlX/B7sn603NXlSqgn/ao1w8WY+SyJxTwWM3xwyI388mVQlH2zfWY01B6pgukQdq59AazWac3LLY9W9UlZqi/6or0X7tG8WqCP6Ppcv7x49OcecFiHKmLx1WR/YBcarHSiCVtUHiU4uXfQiHTQ3jXs7FQvXLu7dnxUtDq+A/uCjeNEi+bGJbPJEtSU+aepfvc9TR5SpjepPxYCDJFLWFWVUlHD22ca2uJqztXzXawoRPXGnWusc4XXqjcFyl8edB4N43OlomBE1KMu7JRX478r/FUL/ig/YzTuVqziQiqzsG1tcnaLBuOYerrIQxKMpfBSeEC7sE1IjVBklCus1IDEKxy6oi4HNmHvBKWqj3VgSlCIxXHWdrDnVJkj1lBJx2o3lwFBKfiKUHSO08HmXqKOTFqeikOw610y+kL0bHq2n3WD+pnVE4SH8W3NVSHAs91ebl6 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: 15 Oct 2024 21:37:34.8546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac4940cb-656f-435b-541d-08dced61951e 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: MN1PEPF0000F0DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6820 On designs that have workload classification, it's preferred that the amd-hfi driver is used to provide hints to the scheduler of which cores to use instead of the amd-pstate driver. Signed-off-by: Mario Limonciello --- v2->v3: * Disable prefcore sysfs file too --- drivers/cpufreq/amd-pstate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 90868c8b214e..f2a23f622843 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -763,6 +763,12 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) /* user disabled or not detected */ if (!amd_pstate_prefcore) return; + /* should use amd-hfi instead */ + if (boot_cpu_has(X86_FEATURE_WORKLOAD_CLASS) && + IS_ENABLED(CONFIG_AMD_HFI)) { + amd_pstate_prefcore = false; + return; + } cpudata->hw_prefcore = true; From patchwork Tue Oct 15 21:36:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 836063 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2053.outbound.protection.outlook.com [40.107.236.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D76C620F5DD; Tue, 15 Oct 2024 21:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028264; cv=fail; b=G63nPZQwPv0glRFZx4v4V6v+aNhNiI9oAxUGQzhu1t/2DYhp5H82oRX3c5WFkZzJjYd4598cKn1W9NMwcuPJWfFnRPjNB1nbR5E4dpFRHCBXaLrhiupRFyGmajHDflecLqu4oAOSG+OAtGZzktyo0NOUc+3XMMSkeXpODmsig0c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028264; c=relaxed/simple; bh=JP5X2xo4Su4P1di2bUgZ+XhkwholwKaopEROJGUOybc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=abw+/MKEbb1B1JLGSTIGgiOT1pBFRVW0YjdR07J+C6OtEvJIXbaSFH+fU0NVqupwO3qjGbpTlgBYETDrcDt0DIRJSyyDER4W1bI1Txj9bDh+JYyxziy0T9IDDxQcaU8HF4kot4WU+c9pMCfprw2YbTbwNz2tP68Uq55ud11McFU= 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=X9txct9X; arc=fail smtp.client-ip=40.107.236.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="X9txct9X" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ANfABdIwhExVpKNRYSi9nYD/B3St5btxvh0YjFLpmdHqOrVAlLB+lmtk36z/NGVmgAo6s0jYc6uwjEOEweBQXDcaT77O1GJppMl2OQx0ntZKukORjYYcMkaNFO07ZgxJQQmKoi+jkMalP8E/x2v2FswzPTx2Y6RM1pOabBKY+3vWRtDC6I1SUpFM2aXe+njrhC+HdCaAl6frVZyHXbNrZI17D5mewlhzQbLiDXvKIdvwid8nNwVhNx+vo1iyKXKUfxinaaqWA4w5/QkPiVKHk/MhT9EY8MEaKVgUGhuBKb7h+wSYNtuSSaQuUu5pYOgcb3y1yBnrFhgnGfr6U67qrQ== 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=KkqveYXjXyxYdU6a6l3F0J+BwlcZAc4ibqC1XF2+X4I=; b=OH73tzXzpPQVwSWtk/LDWuYv7X5bnWo/EMBxzxCh6vLeu8kBCjatQ+l2/aXyOR4WvTTgJqCURxWyK6VfAylqo60lC6dLwLDQPBojf3gxMZLzCOjxQwv/z8IjMvjnqhzXsxpYXzqBnTspFza47DmRpjoYtFFP2AdT3ibrFQ/Siq30PfamZuIEYmTauF43cLnggnntq5VH1R/nKpQZRZcyEQfglWM7auOjQ8IbaAmmzvVIvcx9qoX8hRiqtcVmDwb4fXBkMsVVAXYtgqg7+hrlL9LEC4y7Da3H3v4btc+l2zdPv+Q6lmSvmEcekes8F/Tkyrx3vPfwILm7T1kA2xmtnQ== 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=KkqveYXjXyxYdU6a6l3F0J+BwlcZAc4ibqC1XF2+X4I=; b=X9txct9XXAiUQEPF8h7ZWMxqAC4QPk5spFtfPn0jPUf9m0fBX8lFScINIsKohbnBCj96Dgb1Uzfpu5J26ywnzKzBsqqKB/9CWYKxpF55oFrUzULk+3wyvKBqjBSUWXxfhmZ6Dq2HmJKI3YtlQssCkiIBlUHrprvqn39f9y/7siQ= Received: from MN2PR20CA0047.namprd20.prod.outlook.com (2603:10b6:208:235::16) by PH7PR12MB7210.namprd12.prod.outlook.com (2603:10b6:510:205::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 21:37:36 +0000 Received: from MN1PEPF0000F0DF.namprd04.prod.outlook.com (2603:10b6:208:235:cafe::82) by MN2PR20CA0047.outlook.office365.com (2603:10b6:208:235::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:35 +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 MN1PEPF0000F0DF.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:35 +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; Tue, 15 Oct 2024 16:37:34 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 13/14] platform/x86/amd: hfi: Set ITMT priority from ranking data Date: Tue, 15 Oct 2024 16:36:44 -0500 Message-ID: <20241015213645.1476-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DF:EE_|PH7PR12MB7210:EE_ X-MS-Office365-Filtering-Correlation-Id: 2df18b1f-593f-496b-d80b-08dced6195a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: bh3/MIqLOqNPTcF8pHZd/YgRT7S3opvUhZ41f/TrzvOzaXWOSazjHnWx810vqx2VgOQEpnSD1SCBw9LjeXQKLpR3WzFP6JNrlIVD+bSRsANp32Q1HV5OLZsj/QnOCEvrG26i4VSR+BE3Ehh78TZTELtFm3MTWzgi1Lfn83Mo3nzqfcYv+3TFTO4TuHnYs0BePHcGXQulqx1q7VYGcrlMK8tkejMW2gHTp2WuWocozLImPJzfRwLIdTzEGNHYB6qDBVJQaAiIXX+/zE4wS/VXq/MRXpcIfGQed0vR8KptmU4Z5AkCv8hOQ9Mg6nf9x0kC+b1YD+utz67oOBQVKA1zHhImuoZbFz+BWnd0CKnNcJvdz4wv3zOZFwubu3ec1aZNRXevXZ5bghS63O9TEMZxs/B4YM8vE3JttIFa7wHYpiUOgMe+cTnw5h1hE51Mo0yrn1VA9XVCRseFIOUnS3+3Eh2qvpGcSmqAbwS0gn30lRL0wIHrxGZwyMgpMSHHgoHp8Eg8GKJw2jqtEueOCRxGm3vNxjv8f1nCIgJJe/DdarL28edWq2SWyhT7SG9SgyZ5waTa1y+XNtutS3/fPalOkRfEWQ9OGZ7+BgmGB0z9FIDvyoHV21/wPtnbqm9ptvUNWzqtmJdJP/01MjYWFAS/5C4WWSFXIh5Y0uwWWUipEx1q862YFztklqKOsPQ4Yn4UZYLvmZ2PcB60XnE8LHAjFFsZOQNhy5aal/7WGIL3S+GSAJdVZCNwvmvrjB3AGV4Bu1Td0B7EOtOGs/MFB3rtBRBCLHHrRsIz/Av9THdo24CLhw20GV55J2tQJA4J9zI6nVcG9buKTYj17MPJ1Djn2REMmHSbHPx2vQoari9F7nfOl1lVf8G7MdM2nYRYIsVLlztZosEzx8ggfK8to9lGxQnxzzeP1Xj8nTBn0e37ACTDYBkcmJ3KK1/tcx39d4COGnheSJVt+/d25ZhbUy6/AugCGQPp1FUsroTan46RIHnv06cw6VAy1GBSQeTEFySkMO4UzqsXZO6FxfzIhYi5S16hNv3yu79NSz9R2hYcloyiaFO+nc9NmGW5bF3J4wHt7p5TRX/U4eErR4YutSVhZ+QogZTGVPXQlehXMPbmpkXwOwdFCW8+iShNF0fBjfP8cRJ8q44FxC5IhU8+hEMZcd5b9Zdgq+4VKUDwHQkCz0FaTFgOaRF2NIH/xIUEwZJ2u9bl7ICJ7ayM4oc1FA+GZsjyyq7Cnyv/Zi+dEey/4SqFOQd/IfqA68/hN0Mj5dg2uevvUqn6PLpxwdb0kzOB20Z8hT2tnsdT8W8Vzp7KZue4/zs1fP4UBpV91krgzdpNGtEmfcmeUQ6SqO+Vl1+/bgoDChqElcOlfY2eyNjOwaQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:35.7296 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2df18b1f-593f-496b-d80b-08dced6195a3 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: MN1PEPF0000F0DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7210 The static ranking data that is read at module load should be used to set up the priorities for the cores relative to the performance values. Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/Kconfig | 1 + drivers/platform/x86/amd/hfi/hfi.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/Kconfig b/drivers/platform/x86/amd/hfi/Kconfig index 08051cd4f74d..4dfa7641b35b 100644 --- a/drivers/platform/x86/amd/hfi/Kconfig +++ b/drivers/platform/x86/amd/hfi/Kconfig @@ -7,6 +7,7 @@ config AMD_HFI bool "AMD Hetero Core Hardware Feedback Driver" depends on ACPI depends on CPU_SUP_AMD + depends on SCHED_MC_PRIO help Select this option to enable the AMD Heterogeneous Core Hardware Feedback Interface. If selected, hardware provides runtime thread classification guidance to the operating system diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 79963c423d35..6c90b50f0a40 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -120,6 +120,12 @@ static DEFINE_PER_CPU(struct amd_hfi_cpuinfo, amd_hfi_cpuinfo) = {.class_index = static DEFINE_MUTEX(hfi_cpuinfo_lock); +static void amd_hfi_sched_itmt_work(struct work_struct *work) +{ + sched_set_itmt_support(); +} +static DECLARE_WORK(sched_amd_hfi_itmt_work, amd_hfi_sched_itmt_work); + static int find_cpu_index_by_apicid(unsigned int target_apicid) { int cpu_index; @@ -246,6 +252,8 @@ static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu) WRITE_ONCE(hfi_cpuinfo->ipcc_scores[i], hfi_cpuinfo->amd_hfi_classes[i].perf); + sched_set_itmt_core_prio(hfi_cpuinfo->ipcc_scores[0], cpu); + return 0; } @@ -463,6 +471,8 @@ static int amd_hfi_probe(struct platform_device *pdev) if (ret < 0) return ret; + schedule_work(&sched_amd_hfi_itmt_work); + return 0; } From patchwork Tue Oct 15 21:36:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 836062 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2073.outbound.protection.outlook.com [40.107.236.73]) (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 6F0B7227394; Tue, 15 Oct 2024 21:37:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028265; cv=fail; b=hFaYlvcnzefEH6uBGAhLYyUPbWELVz1n0WJZS6Kf8QEejnDJz/GFWLA65BJvTP1wz8cPoFJ5XZMalp6WR2I8Q+F7YAQsaIOCkObP9EiXAbEH+z48P5hOLtUbKd7aCg8JbUtvTDK7I44iub85FgvYvpWt2amR11McBO3DTm8Ts/Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729028265; c=relaxed/simple; bh=/QoTUS+pqdujq/XVYeoY3WE4U2hs/Jg3l1Tc+a4DkpQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FWzSFF3G9Ok8DegshqMjcgrb8QSHQji6FFMhAyFwuAs7LGqEOnfyJ0SUi8EcnFFjchx8I4Oawqe30JHqrKII4CuAXn2G5VBvAXYRcCTgVs7J1QHB8i4lpsQbeNebovWnFCvh8Wb7PQa09PJBTmTpnRPTEFBiw07LsV6Cu6cOnLM= 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=QmPsUAdi; arc=fail smtp.client-ip=40.107.236.73 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="QmPsUAdi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NgkO/7f+E8RYYSBaAqE0wv/aGzVfglobTt2/cC6zA3kGgx4SBB32i3pr8eqF6VkLvKrLotFUnOJYkMDnZG0JMQ9TSJPfKNZNgVEWBZBfBl8vtL154eA4lW+r6QGrK9pGpFLPIcskm7hDvopvN4qvJSqjjgzi8VIrCbBvYZAlff0iCmIrdq6zL5HJl4aRn9gYDJwvSTloFuw9AuHVIB+nwEz/bxhHNMP8SohrzgYzex2+z7Fh7nfuPPrK645GOddLPibKadXG4SucqRyoTyDcH+m2V/rlLDJ5LTn+1CS4ABObbabGWlLlVZmPFSamB9FhgtquMncv/Ti3Eqgs7rAG7A== 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=XfpZgescQjpWXN1v9vPph7nPAsr/SHJOxlJjO7c06HM=; b=PJDXGCm5GrJ+LRZ2TSFsDlbWhtYPOAdvgM/fhAG+HOl6F1alH689K4G7mOLJZQ/OiZe38jL/K5N6WyRasfSpZTLqgIJKo1fGQqcbS8MDJ2qUakSmyAbijXSznT5HlbQeRoh7uRDrthVQZr2po3dLnJOU8kbnZprhqBl6WS+vZEN5LvmROVnMWdEzlkKhLHWU1eq3ZpTqWfENqIJ9BxDkf2904iU43w/09C4LGEhsVcmXmVwrwagZq77QNwUGOX+JQnyxUivEwV5cY+PyTaFmVhlOalSfFtWQGuTC59bkL5NZDhMb8tzINGkul8bdKzPnTxLmdlQjRed7bbhLH3wghQ== 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=XfpZgescQjpWXN1v9vPph7nPAsr/SHJOxlJjO7c06HM=; b=QmPsUAditrJEZg1Yqnp3h8OiNmGWVkcKDMyPfZuw6iVrlosvELueQAjy6GiU3UGUrLniXlKAoATLKGu7nmN/cYlSOp5nmEyqeXY0PzZ5NQR2ddtRkZZ955lje/+L8qxAz5UCpDlcCoUWYRifZBIAsW34NYKKLAEdst+JRxsnDHY= Received: from MN2PR20CA0046.namprd20.prod.outlook.com (2603:10b6:208:235::15) by MN0PR12MB5785.namprd12.prod.outlook.com (2603:10b6:208:374::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 21:37:38 +0000 Received: from MN1PEPF0000F0DF.namprd04.prod.outlook.com (2603:10b6:208:235:cafe::a4) by MN2PR20CA0046.outlook.office365.com (2603:10b6:208:235::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Tue, 15 Oct 2024 21:37:38 +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 MN1PEPF0000F0DF.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 21:37:38 +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; Tue, 15 Oct 2024 16:37:35 -0500 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v3 14/14] platform/x86: hfi: Add debugfs support Date: Tue, 15 Oct 2024 16:36:45 -0500 Message-ID: <20241015213645.1476-15-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015213645.1476-1-mario.limonciello@amd.com> References: <20241015213645.1476-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DF:EE_|MN0PR12MB5785:EE_ X-MS-Office365-Filtering-Correlation-Id: 81a34033-d854-411a-c804-08dced619717 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: KLnWZYZDa04Wl6e867JEBmKwqocMGK90WiwUKonporyDvqEYsUd9tLxIp6774DC3Q4sKRo2OC3DusNF6n4zDM4mCAN7TXVPuADdBA1Ws1ppTlldbtrSj9uuj1DUKOD2mCoxHOMlF+8PIEJRyk7ONho70lSllF+RnGFT3oa+AkDT1AiR42J+t8TgLlvKLevHcGzvjNLoCTkZTwlKDg6KYaaej0336kpCH+hcLHbiUMjxJ8VnGjW0bjeCHe89AVeeXTMLAxPQhyFEKW9a6lx6ZYgWT7JCgUYvqSXfb7FwNEi+YSmfI7dc94QJywLWF0ARuUXSsRKPT0buhvZR38uTYDr3WhHQn5+IJaprKSfxGX2k6iyqDZt5t6t+OjU/FKRXxq3efItf5Hy6KWpX4/ffmyOfj1JY/Lqm3dxFrR962jHr/1awecAmlfC2wg9d3bsD99CQw3CQQEPib8e7YvFQ2YvqiHg0+QZPeUjXoMC1fgy8fRQd6Umd+8fb7V8yaidLozd2UjHzNS6WRoIQ4KoxrZLmw2s2ptrYAhsX+naBug2G4JThjSctdv+T+AE1MhoUvUCL+lXCi4om1hPJ18q2pCz8DkHpGkWoGFhSETdlKmERuF+CbjVdh7fZjKF4Qx8tWHXYMQfgZX73j+lcnar/p11+J+kb8W4Bdajp5L7VqynuxxuNE3tfkcUgE2bSsyTLWBeL853Cb0qbqKGcFmZaHx9bjptak9xANiHDVJaukb2fCwTjaaSUYKzrvA/tqF23dYR/bN204Ugp4oSINttm3m9sVnKrDWMzsUecQhqViP1OeGdcNkij5jz0eENVgC2PRVrPoEv4JtwZ/wGoTZTxk9MMZNg7TSuRIu28uHQuQIOfRm6Zp9pMl8YxmjAGtBsRfpnV6PenaCsfxEMxIZ6dyh5EzpUX7Zhw7Gwrw6olT+Bl4Ym+uKDIwY98JKT2cImPl5MZOd3Rc+0/6uyHD7BhHUsCLKEH8+X/AkcgwAbD1TU4tjTB1FNvqSJLb5I88KS25U15qY/mQNCeOnJwA/4LN6DWR+mhOsbE9dD1aGV8E0E6sagp4kNljtSvw33fNVNrn4bsiZ56DUvlIm04S70vIBsSaeKhBqm/T+F5iR1Xf6Wh8+Ubtbt9Z7LfmYGWgiSfZww/04rSmMkWfVRTuX0Wr7aV53phHXuSdRl6xMZDjTyJVi598NeWszXAB1b9NddRYUVyl9NZ+yFno9yP4w80O00/7Ux5fR6+k9eAjdRnNgrZ+GzOZb/tkYHvweFIbdPV2wa+p/jMxwK4Zr4qVmexrnOYge+heKEJF+HyeTOlwM7QR1Vk01g2sNjurDxN9Wonh6AQaWy4JmxdyAqr190H4zvjXQxbwKqZ9pbDeEKxBIz/BNh1jIl2gS1U76R6YkgRk X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 21:37:38.1671 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81a34033-d854-411a-c804-08dced619717 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: MN1PEPF0000F0DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5785 Add a dump of the class and capabilities table to debugfs to assist with debugging scheduler issues. Signed-off-by: Mario Limonciello --- v2->v3: * New patch --- 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 6c90b50f0a40..6df80f6ac73c 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 @@ -79,6 +80,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; }; /** @@ -243,6 +246,8 @@ static void amd_hfi_remove(struct platform_device *pdev) { struct amd_hfi_data *dev = platform_get_drvdata(pdev); + debugfs_remove_recursive(dev->dbgfs_dir); + mutex_destroy(&dev->lock); } @@ -400,6 +405,28 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev, return ret; } +static int class_capabilities_show(struct seq_file *s, void *unused) +{ + int cpu, idx; + + seq_puts(s, "CPU #\tWLC\tPerf\tEff\n"); + for_each_present_cpu(cpu) { + struct amd_hfi_cpuinfo *hfi_cpuinfo = per_cpu_ptr(&amd_hfi_cpuinfo, cpu); + + seq_printf(s, "%d\t", cpu); + for (idx = 0; idx < hfi_cpuinfo->nr_class; idx++) { + seq_printf(s, "%s%d\t%d\t%d\n", + idx == 0 ? "" : "\t", + 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; @@ -473,6 +500,10 @@ static int amd_hfi_probe(struct platform_device *pdev) schedule_work(&sched_amd_hfi_itmt_work); + amd_hfi_data->dbgfs_dir = debugfs_create_dir("amd_hfi", arch_debugfs_dir); + debugfs_create_file("class_capabilities", 0644, amd_hfi_data->dbgfs_dir, pdev, + &class_capabilities_fops); + return 0; }