Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFB59606A32C for ; Fri, 4 Dec 2026 03:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=r3htG+H2 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A90410E450; Fri, 4 Dec 2026 03:34:58 +0000 (UTC) Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazon11011015.outbound.protection.outlook.com [52.101.52.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9B91F10E436 for ; Fri, 4 Dec 2026 03:34:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ai/A2uxc2pSRmjlyjMjCFOpVlEpl1+D6D5mHbqcrjAnC+/odRFlsU2wUGSDyjFsYgFY79twAj7JxnGAsENYQCj8WmGblx1vsO/ngpL7CMi8VERu5lFUgaeRlROuL3/y+IXpQpC5uWsyu3wQ66Rjpy7kecNlCvegeKnsmjRTEuCQZu6kNKSdc371I5bC4tGvJ6ZCxL12Kk6vof3WSqyaVrZfhUkkBKsI54QFTi7EmliUH7HP3GK2DzOBzc+a571zo5clRJla5YChBKla+MhDETDNIsp8EBA2yIJ3+IW3AhS0cZl12AkeZeZ5grh+BlCU3M2eBzpaKM52GOMzh6AZdrg== 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=IEZJ1/uz+CBvM1gxtfN0BA8zs9fxvYXn4iqwvYd9Y1c=; b=RATrc3QXJU5vv5fWInMdnIpehcV7UMNcNlhVDXSnFIzNITNC56Ihptp8a7vnt6lximix80nyviLhxN0umHss0APUx1OLd6zKv8rx0lqIkcThFirAaV8WrLqo2Y1xHM9X6YyCTHNpljc7GGx8Yy8fa8FzoxfJzypgAJjS3zVtMGSDCNzXIO4ah2DCE047EWEMcwDAmj1cNO9ScCuAwU8qPFVPF2izXiH8pSvwO0x/qZqJT69V8Z/5auFlaVJ8Q1eWkdVa2Ov0lXzZGPQD9rGjZCLFuCDGUwdx4MXkH4oUdQaXkFYfH5oqk+7v4S/3zKp4wFqeGFCr5T0WMtDkpkE8xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org 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=IEZJ1/uz+CBvM1gxtfN0BA8zs9fxvYXn4iqwvYd9Y1c=; b=r3htG+H2m9SF8bigkaHZ+XrO+qfrk24eXnPzR0y5zE5F6yq2to3SbRlKiZvrv5bcsJJk1qrGYA8woGaGiTKbaSxF/9etlJjyXBwAVcjcVxBSAAjvLaCgF/pAFkQoFWdnXpg1Qnvp/EsKxhaL7YYrt+XLJSPS3wxP97IotCCPLJo= Received: from CH0PR03CA0410.namprd03.prod.outlook.com (2603:10b6:610:11b::22) by PH7PR12MB9128.namprd12.prod.outlook.com (2603:10b6:510:2f7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Fri, 4 Dec 2026 03:34:47 +0000 Received: from BN3PEPF0000B374.namprd21.prod.outlook.com (2603:10b6:610:11b:cafe::4d) by CH0PR03CA0410.outlook.office365.com (2603:10b6:610:11b::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.13 via Frontend Transport; Fri, 4 Dec 2026 03:34:47 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BN3PEPF0000B374.mail.protection.outlook.com (10.167.243.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.0 via Frontend Transport; Fri, 4 Dec 2026 03:34:46 +0000 Received: from mukjoshi-dev.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 21:34:45 -0600 From: Mukul Joshi To: CC: , , , Mukul Joshi Subject: [PATCHv2 1/2] drm/amdgpu: add remove all process queues support for MES v12.1 Date: Thu, 3 Dec 2026 22:33:57 -0500 Message-ID: <20261204033433.939162-1-mukul.joshi@amd.com> X-Mailer: git-send-email 2.56.0 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B374:EE_|PH7PR12MB9128:EE_ X-MS-Office365-Filtering-Correlation-Id: 47832fb0-099b-4b3a-c680-08df51b78b41 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700016|23010399003|82310400026|261028144727099003|56012099006|10067099003|261021123027099003|261026140227099003|261022075727099003|261021121427099003|261022105027099003|261026121527099003|261009223027099003|261102123227099003|18002099003|11063799006; X-Microsoft-Antispam-Message-Info: CFA8NP1k2jj+3EDKVhn++/tGP1ScUsPZuvZAaiYhErvjwfAd9uZWzmhvoJick8HHFJdWGLz91zyUHBsbEvvUvunhcmDpiZkU9HfeiBQqe/Fi7VG0IarrZcmEdCb5r+8gbg3xM2rIA4HOUWZmLaAxrZR06A4nMSeepG4fp90m+vijucnoTNvqyuGnHR42Jx03xFWctnwiu8+V0VaJAKfQQwhNjjSdej7j2sg5fuMNNvhIcGROVAgBqDQLYcYtdr0dQvplIyooq8RPMcuC4DmL/S8sibLP9qa8wAk99++KoD9HUlwbDb1awtqJ8CLwipDI0h1/jF6c0dE91oVjteuwqp5+adTGMffStzZvV58Hl5jj4IjfBH8s0M5TB3cnLI/WVcXAtcF3xJ1hXktcs6V8aeoFCAssY71XnfkdflTsNwoDNxHtQ9M+JGsQ7F8Xo0mTDmWc8V0Ep8DMDvWzOIQB3cc4/SLQqVfVZH4CELb/uZI2UUgq70vdnDMSb8Kxz5C0PfDNe+Ui69vBdSd0l4O68i1eJFH5QO4NZY9CLzLHtwFB36posq9wMCVDoCB3yNNw9ZpTa5BP90IIHtgIDnsSVIPg602epGzWzHnhEwqwBJGfMVN/mK+7KHQihlBNEO1oQwGmP4dSjPWu5LdxatiJLVr3JNnnufOnEtQ/8VSIU896qBId39EUVHSFFb6YYiusL/gHv/Swbg+AIs6O1Mdx7w== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700016)(23010399003)(82310400026)(261028144727099003)(56012099006)(10067099003)(261021123027099003)(261026140227099003)(261022075727099003)(261021121427099003)(261022105027099003)(261026121527099003)(261009223027099003)(261102123227099003)(18002099003)(11063799006); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AxXXXt1+2CHsGfESY0K8V3CISeWE0Noi1sWvov7IvtGvhZZXcBBRd3camqOh6Vavv3qSs5gIPvyJliQWncm7bQ+VOMFUbRyOl6w9T6pInLYOU6oOhWhK5bw9Ua71j0U1LXTwaVyyrciKB6LSrN6JFbjcrChWul2TctXUOdv9w+yETphwhGUeXs25yVxyGIDwNtcnzrWtwxVt+hzaHkJ2qqYpyPtsQiN3gRwFB16V03+SnIGPBzb6mld++oiDRKvt8VufUpcyijRvPEXzxCj3hlc1sQYZAF524QZXgo7hzH40XoDpRM6yg7DPi5HWHiv2E/jSid+GKzboeoD2y7fUT/lm0HstwfHsvKDvqZ6Rj1mGqyjVM33WD2zgQhIZj+56Giy3pvgz9Zo7SqjmzsWHa69R3OYfT8Cjqywbih57Ks/iiZxW0U6JGvDYYo+0lQuq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 03:34:46.6713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47832fb0-099b-4b3a-c680-08df51b78b41 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B374.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9128 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "amd-gfx" X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 MES recently added support to remove all queues of a process with a single REMOVE_QUEUE request. Use it to optimize queue removal during process eviction and termination. Add the new fields to the MES v12 REMOVE_QUEUE packet definition and to struct mes_remove_queue_input, program them in mes_v12_1_remove_hw_queue(), and add amdgpu_mes_remove_all_process_queues_supported() so callers can check whether the running MES firmware supports it. It is supported on GC 12.1 with MES scheduler firmware version 0x87 or newer. Signed-off-by: Mukul Joshi --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 3 +++ drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 13 +++++++++---- drivers/gpu/drm/amd/include/mes_v12_api_def.h | 10 +++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index 27d6371d8d79..9ff3c1dd4842 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -966,6 +966,15 @@ bool amdgpu_mes_queue_reset_by_mes_supported(struct amdgpu_device *adev) ((ip_maj == 12 && ip_min == 1) && mes_sched >= 0x7b); } +bool amdgpu_mes_remove_all_process_queues_supported(struct amdgpu_device *adev) +{ + u32 ip_maj = IP_VERSION_MAJ(amdgpu_ip_version(adev, GC_HWIP, 0)); + u32 ip_min = IP_VERSION_MIN(amdgpu_ip_version(adev, GC_HWIP, 0)); + u32 mes_sched = adev->mes.sched_version & AMDGPU_MES_VERSION_MASK; + + return ip_maj == 12 && ip_min == 1 && mes_sched >= 0x87; +} + /* Fix me -- node_id is used to identify the correct MES instances in the future */ static int amdgpu_mes_set_enforce_isolation(struct amdgpu_device *adev, uint32_t node_id, bool enable) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h index 89051073321d..b29633ede051 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h @@ -333,6 +333,8 @@ struct mes_remove_queue_input { uint32_t queue_type; bool remove_queue_after_reset; uint32_t gang_context_array_index; + bool remove_all_process_queues; + uint32_t pasid; }; struct mes_map_legacy_queue_input { @@ -738,6 +740,7 @@ static inline void amdgpu_mes_unlock(struct amdgpu_mes *mes) bool amdgpu_mes_suspend_resume_all_supported(struct amdgpu_device *adev); bool amdgpu_mes_queue_reset_by_mes_supported(struct amdgpu_device *adev); +bool amdgpu_mes_remove_all_process_queues_supported(struct amdgpu_device *adev); int amdgpu_mes_update_enforce_isolation(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c index 84a3693db6ad..378d4278377c 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c @@ -363,10 +363,15 @@ static int mes_v12_1_remove_hw_queue(struct amdgpu_mes *mes, mes_remove_queue_pkt.header.opcode = MES_SCH_API_REMOVE_QUEUE; mes_remove_queue_pkt.header.dwsize = API_FRAME_SIZE_IN_DWORDS; - mes_remove_queue_pkt.doorbell_offset = input->doorbell_offset; - mes_remove_queue_pkt.gang_context_addr = input->gang_context_addr; - mes_remove_queue_pkt.queue_type = - convert_to_mes_queue_type(input->queue_type); + if (input->remove_all_process_queues) { + mes_remove_queue_pkt.remove_all_process_queues = 1; + mes_remove_queue_pkt.pasid = input->pasid; + } else { + mes_remove_queue_pkt.doorbell_offset = input->doorbell_offset; + mes_remove_queue_pkt.gang_context_addr = input->gang_context_addr; + mes_remove_queue_pkt.queue_type = + convert_to_mes_queue_type(input->queue_type); + } return mes_v12_1_submit_pkt_and_poll_completion(mes, xcc_id, AMDGPU_MES_SCHED_PIPE, diff --git a/drivers/gpu/drm/amd/include/mes_v12_api_def.h b/drivers/gpu/drm/amd/include/mes_v12_api_def.h index 090c9142674e..01d07b942347 100644 --- a/drivers/gpu/drm/amd/include/mes_v12_api_def.h +++ b/drivers/gpu/drm/amd/include/mes_v12_api_def.h @@ -411,7 +411,13 @@ union MESAPI__REMOVE_QUEUE { uint32_t preempt_legacy_gfx_queue : 1; uint32_t unmap_legacy_queue : 1; uint32_t remove_queue_after_reset : 1; - uint32_t reserved : 27; + /* + * Remove all queues of the process identified by pasid, + * doorbell_offset/gang_context_addr/gang_context_array_index + * are ignored + */ + uint32_t remove_all_process_queues : 1; + uint32_t reserved : 26; }; struct MES_API_STATUS api_status; @@ -424,6 +430,8 @@ union MESAPI__REMOVE_QUEUE { enum MES_QUEUE_TYPE queue_type; uint64_t timestamp; uint32_t gang_context_array_index; + /* Only valid when remove_all_process_queues is set */ + uint32_t pasid; }; uint32_t max_dwords_in_api[API_FRAME_SIZE_IN_DWORDS]; -- 2.56.0