From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from PH8PR06CU001.outbound.protection.outlook.com (mail-westus3azon11012030.outbound.protection.outlook.com [40.107.209.30]) (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 D3E7A28FFFB; Thu, 13 Nov 2025 16:07:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.209.30 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763050025; cv=fail; b=YT6Ame0MtiJYslM0TVro0rRxwElnziku50TuuUioDE+ig/SWgu/P4Pc0F9fRIaMKkolR89ExO7EVEu/9VK1WalBN/uciyR3Ryryq2jDlVtQSONFqfBX6mHt5g1LTBF7DBCiMSqyNVvzlNeVYGZ9Ro22WyHi4aigLytJf3IuXXuw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763050025; c=relaxed/simple; bh=hun3AzX2l7V77WHtGf9mQyylf6IUPBqxT5BAlggbskQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=k6oYKcrJg0u+nwFgW1IyBbEBNoiEe53axzlNPxma26//OIrG1xZg3Pg+NtxMl4JNI4EBOKFXHiir1FpYL+lgJBq87Yx3po9c6fiyqQeJO0tITTL52MZypt8RK7S8SrSr0TEd4YQG8cqrK5uC/t+4wu2OiuXSErohiIbmserQiEI= 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=zWj1sQM8; arc=fail smtp.client-ip=40.107.209.30 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="zWj1sQM8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wyd9KVpqu8QT9CBYIG/jECIv7WJLsrdZPQ9FKdEV/o8y9tM1Cn72WYD8gMKh+n26rbhEl4X6Cx7OBLUU2bW2WssfVYg1QHJeLdlHmVA019FJFVEyH+5dNYZad/AJAKXuibIchstxfTJfl15u+YqBIR7pU9EbDNwktshD0Lf8uBAP/fN7xSrf0bl6j9QvOzM3Ej01lUQbDwxIfcNaH4DA+NiNqRjMaTv+99gYRuLpGu/CWZjqxWSq53qu4rntKbKx5fOnPI6uTKkX5tuUnt0YdubhxuaE3Id3G42oSv4EceDgLEhDXhsIvZsgw87yBwYeJdKKiKe6QbX5KSMgMErvsg== 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=5T6C+2maAlhls6pQTQ+2SN2EX1bfix86R8KOznZlkHg=; b=VyIcHlF6ISnjEsd06fhxPMMoflqxTOZ0tZxTk4wZ2qmU5hRRCw+zdQod1UVxTEwAV8K4Xt205hXIZsGrUs4G6wGDro1B7OemFiLtgyXZ5ROmQzaVtgNPKCBAhbmO9DXLwxYfaeMKPQ9gZf8juM+fl2dFZBhC6yE6JIzXcOlQF6qNhvxX0adyqRlsbxr1c9fWA18onj2P970wDWB8x6aAIj0uuSV/No0mRe8dNWfqgNsBQzHwlpAL6pIaTbVPDcqp3WaBGJK4l23kl90WRrxdkcDqxCK2XbYc7FiZt7VsgcfXHZWIMxEUkOEOr7L6d/D9A4/FVVYY33A0vCQW1BftNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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=5T6C+2maAlhls6pQTQ+2SN2EX1bfix86R8KOznZlkHg=; b=zWj1sQM89KFYBYhP1C+2epVEv4LUOdVwx9k6h9oUdxXl0enxnmfIlONEjlbtuEVeLeEFnUUKXqnKp3vckESRgi51FchbzwXUNtdY6zvCYMGjwViAFWT/nl6L/8OVQIVY8OT7Cyzo6zxnQP3bitTldI5KNICxBHqInsjOa6Vue2U= Received: from CH0P220CA0026.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::22) by LV8PR12MB9134.namprd12.prod.outlook.com (2603:10b6:408:180::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.17; Thu, 13 Nov 2025 16:07:01 +0000 Received: from CH1PEPF0000A346.namprd04.prod.outlook.com (2603:10b6:610:ef:cafe::7f) by CH0P220CA0026.outlook.office365.com (2603:10b6:610:ef::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9320.17 via Frontend Transport; Thu, 13 Nov 2025 16:07:01 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH1PEPF0000A346.mail.protection.outlook.com (10.167.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.13 via Frontend Transport; Thu, 13 Nov 2025 16:07:00 +0000 Received: from FRAPPELLOUX01-WSLPUB.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.17; Thu, 13 Nov 2025 08:06:56 -0800 From: Pierre-Eric Pelloux-Prayer To: CC: Pierre-Eric Pelloux-Prayer , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , David Airlie , Felix Kuehling , Harry Wentland , Huang Rui , Leo Li , Maarten Lankhorst , Maxime Ripard , Simona Vetter , Sumit Semwal , Thomas Zimmermann , , , , , Subject: [PATCH v2 00/20] drm/amdgpu: use all SDMA instances for TTM clears and moves Date: Thu, 13 Nov 2025 17:05:41 +0100 Message-ID: <20251113160632.5889-1-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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: CH1PEPF0000A346:EE_|LV8PR12MB9134:EE_ X-MS-Office365-Filtering-Correlation-Id: c543ec43-7803-41dd-5bd2-08de22ceadf4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?WWU0SytQeDRsWUdMSGttbFBKWEpxUHR3eDhuYnZRWE4zZEU3WnZiUEtla05F?= =?utf-8?B?cnpCMjRMSzljWEJObzdocHNsKzRZMDJiYWxYYW5rNzZWMFhlVmdaLzhoWE9y?= =?utf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rdDI4YjY4TDdxVzhBS2ZLVFVkM2E0TmlP?= =?utf-8?B?UHdBNXJka0pqd0NqcCtZL0RzKzFoSDk5Q1hCdTg5OURDZWJIeWdYODMvNHFQ?= =?utf-8?B?cEh0NEZRU29RNndURW82TFp1S1QyNnZnR0NOSHNvL0VDMFdKTUI4UEFvNlQ2?= =?utf-8?Q?fNtxpJ?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2025 16:07:00.9733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c543ec43-7803-41dd-5bd2-08de22ceadf4 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: CH1PEPF0000A346.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9134 The drm/ttm patch modifies TTM to support multiple contexts for the pipelined moves. Then amdgpu/ttm is updated to express dependencies between jobs explicitely, instead of relying on the ordering of execution guaranteed by the use of a single instance. With all of this in place, we can use multiple entities, with each having access to the available SDMA instances. This rework also gives the opportunity to merge the clear functions into a single one and to optimize a bit GART usage. (The first patch of the series has already been merged through drm-misc but I'm including it here to reduce conflicts) v2: - addressed comments from Christian - dropped "drm/amdgpu: prepare amdgpu_fill_buffer to use N entities" and "drm/amdgpu: use multiple entities in amdgpu_fill_buffer" - added "drm/admgpu: handle resv dependencies in amdgpu_ttm_map_buffer", "drm/amdgpu: round robin through clear_entities in amdgpu_fill_buffer" - reworked how sdma rings/scheds are passed to amdgpu_ttm v1: https://lists.freedesktop.org/archives/dri-devel/2025-November/534517.html Pierre-Eric Pelloux-Prayer (20): drm/amdgpu: give each kernel job a unique id drm/ttm: rework pipelined eviction fence handling drm/amdgpu: remove direct_submit arg from amdgpu_copy_buffer drm/amdgpu: introduce amdgpu_ttm_buffer_entity drm/amdgpu: pass the entity to use to ttm functions drm/amdgpu: statically assign gart windows to ttm entities drm/amdgpu: allocate multiple clear entities drm/amdgpu: allocate multiple move entities drm/amdgpu: pass optional dependency to amdgpu_fill_buffer drm/admgpu: handle resv dependencies in amdgpu_ttm_map_buffer drm/amdgpu: round robin through clear_entities in amdgpu_fill_buffer drm/amdgpu: use TTM_NUM_MOVE_FENCES when reserving fences drm/amdgpu: use multiple entities in amdgpu_move_blit drm/amdgpu: introduce amdgpu_sdma_set_vm_pte_scheds drm/amdgpu: pass all the sdma scheds to amdgpu_mman drm/amdgpu: give ttm entities access to all the sdma scheds drm/amdgpu: get rid of amdgpu_ttm_clear_buffer drm/amdgpu: rename amdgpu_fill_buffer as amdgpu_ttm_clear_buffer drm/amdgpu: use larger gart window when possible drm/amdgpu: double AMDGPU_GTT_MAX_TRANSFER_SIZE drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 25 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 19 +- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 435 +++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 50 +- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 26 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 12 +- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 12 +- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 12 +- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 12 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 19 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 19 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 18 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 18 +- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 12 +- drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 12 +- drivers/gpu/drm/amd/amdgpu/si_dma.c | 12 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 +- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 32 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 6 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c | 6 +- .../gpu/drm/ttm/tests/ttm_bo_validate_test.c | 11 +- drivers/gpu/drm/ttm/tests/ttm_resource_test.c | 5 +- drivers/gpu/drm/ttm/ttm_bo.c | 47 +- drivers/gpu/drm/ttm/ttm_bo_util.c | 38 +- drivers/gpu/drm/ttm/ttm_resource.c | 31 +- include/drm/ttm/ttm_resource.h | 29 +- 45 files changed, 588 insertions(+), 436 deletions(-) -- 2.43.0