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 01843606A32D for ; Thu, 3 Dec 2026 17:42:45 +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=Td3einyG Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8AE8310E4D6; Thu, 3 Dec 2026 17:42:39 +0000 (UTC) Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013021.outbound.protection.outlook.com [40.107.201.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id 582B810E4D6 for ; Thu, 3 Dec 2026 17:42:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Zniiv8cDTLNfqfaXGpNOhMwOUknLEbVuAcwPsS3dnssvEK7g5WpcMJOfJBnTwh8rUsJ9qFUXZ5GCbNxWiGwehfdZSaEpQVYHc3heDREpYiNez32Qz947GPvvmK11hC524gHkfCK0pgf98rHxJLuPkJRI7G3A9K68Gf1xKDXKjnB1Dr9BdYp98xuea4/QJqWsO5C2z0H77I/0f8NTSdKNeyCeAC88rMEaB5GCk8oae1SEWWhFdr8UKnXKnF7yGWU8WBCyBpNbTm8+XyUS77raAt07b6Z08EXuoN2YTLELJNYExPjUedHqEte34Q2QLWHG00O/3am8XtkEGYDEuEo4Og== 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=vcMeEdtpG64Trv+sQX8mlBiNXqDUVlUt1KrPc1DtCi79LF4T4FsyaSmaOX83b0vBmOaGxXQxaZovKg5oBrYiaqe0hEIXUMC5+sXgelF4tVe7KBFdCzWGYw5pV4lou4UpRxxK8hFsReU1fnPlyPKFMwrVnTbtGHdf7RRk9hYy8WQ6oUHrXxjXlSBaIZK0ZKv2cn+LlH8wuN7/7mjplX7HLhZSFJsoeZuN8Qr01ECqyQ4jgbqPfKc9OlxwO9Kvyjx1+iKdCIiKTuu/P5uRBcReALz43cSQEs9vRwK340wSngdisdTbGcxtKfpT7kBf15Y50SDBlYB5kMdvvqLOUj0saw== 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=Td3einyGCGMHb4/O1nZgp4n8eLn2TudpgLHVGoHyZbG2MjKWYOAlG4l9z9J8aXWmP4eXiDQ3l5k4krGih5Riuk9wNzgKieDZ5nw5uTdIKfsjHe0k0o/MqMZuVGl/GyKb/rvIS1aKN6xeHlYcTaL6fEyMSIa1yi0/Io7hygLNvr8= Received: from MW4PR03CA0333.namprd03.prod.outlook.com (2603:10b6:303:dc::8) by IA0PR12MB7749.namprd12.prod.outlook.com (2603:10b6:208:432::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Thu, 3 Dec 2026 17:42:25 +0000 Received: from MW1PEPF00018894.namprd03.prod.outlook.com (2603:10b6:303:dc:cafe::81) by MW4PR03CA0333.outlook.office365.com (2603:10b6:303:dc::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.12 via Frontend Transport; Thu, 3 Dec 2026 17:42:25 +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 MW1PEPF00018894.mail.protection.outlook.com (10.167.249.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Thu, 3 Dec 2026 17:42:24 +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 11:42:23 -0600 From: Mukul Joshi To: CC: , , , Mukul Joshi Subject: [PATCH 1/2] drm/amdgpu: add remove all process queues support for MES v12.1 Date: Thu, 3 Dec 2026 12:41:35 -0500 Message-ID: <20261203174136.865568-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: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW1PEPF00018894:EE_|IA0PR12MB7749:EE_ X-MS-Office365-Filtering-Correlation-Id: bbdea002-283d-459f-c3f5-08df5164cab4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700016|1800799024|23010399003|11063799006|261009223027099003|18002099003|56012099006|10067099003|261022075727099003|261022105027099003|261102123227099003|261028144727099003|261021121427099003|261021123027099003|261026140227099003|261026121527099003; X-Microsoft-Antispam-Message-Info: HG1ec2M2kz5NaG5LhpEk4g7ElXy3opBHTGvuRNUlxtDn+JNBOE5Z/paNZkCEICTrdR2w2AgJjTlY7Oxj/sBC2c8EtSaBW7S7TrJeZm8ioY7dDmme84ynkf/y2Bw+2VAYE4hA3oWLharVX7gCRutSEyqBEsDoZS/vuvc8KQ1m2BghhwiWwTlbZw9eHCGC5+3dB0VUVMyePvitLkQJRZ7m0KFBFp7u7HNRyh2r+FJxMAZl1ax2AcQ1YfjpqBKHYmgYjERz8tlke9qIYrwTIrtCPlVRFluqWtE7qfW/LQ9jaUeKhFhm9vjWNpRzOR2eYDG1ecQH0s0LG5sV1Num2aNk0aagEH0oOnXQ3XeVrDoUwmk5lljNhxPoTyfal8n/8TaK+3+UlOpg2JkgmdVKPENGFew2akwarJUakGb6JEarV49TZ+4up2lJDCyODtqQnvCFUXSpUcdKRL4eRv1qquUyMR6QaEpsV8PRip7fPOJBX3lm0qFyhFf2qiJDcADnFhjslhgaVPTSUMy63q4XESz1ukZjzqca2nFkUWnMdQFDEpi3AWm6WdiZo72uI9iFPZnXWJf8zqKzTJhjSQ75aQ7JKWt23ACeR30Oq+ZCaTJvGDtYC/qLBh4YSuOWRtVN8hhcxYay88CxT+o1ofr+AujEq/kg0Sa5ok4+urHy16qWroZmsVcboe+NKAznteZtdH6nuP3X1d2Oe3wbZebwCSv0VA== 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)(376014)(82310400026)(36860700016)(1800799024)(23010399003)(11063799006)(261009223027099003)(18002099003)(56012099006)(10067099003)(261022075727099003)(261022105027099003)(261102123227099003)(261028144727099003)(261021121427099003)(261021123027099003)(261026140227099003)(261026121527099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rm7sL/wleFpoFULtq4taxbkcA03Ri2Cwg4zOJ/LcDXXsM11CnJXAMJbbmdyx2jHZsBGFsQBrVYn8xAYnYUkdU6/C+RVX+WdnN0SqTvUP1wJpKXAhZQvvSTv7NTiHQKl/Xh0xloevZHo6XEN4Z3/UIDUZ/10BAd15YCW1Y5Zv3yatIaoVz1mWD5bJM5tIl1k1XEWFNJbMQ3dZrt616zgV9Z68RV4xZawGwMU16xxkG1Ua8QXg9by6REs6YtqCXSf5qLVjjAxLj+DTlZdLZVclETqhTe1CD7DwsF7PKJt8Rn7YLLmetNTa+J0IdncE8rnMNDiOiS6O4GNWB/V8HdYExO2GAiVjKc8B5WDUtOmvQSErirER+tixbQIGR/+ElBbs/CCV3yOkUTQzD9z2jsd2sVPKsw4eoZ3WBih9Wve0Tssvk3+dfDqt7o5R7Eif/mCg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 17:42:24.7977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bbdea002-283d-459f-c3f5-08df5164cab4 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: MW1PEPF00018894.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7749 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=-18.8 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