Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm/amdgpu: fix prime teardown order" failed to apply to 4.16-stable tree

PATCH [email protected] 1 participant 1 message Apr 22, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.16-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 7f8fb919655ef3011b01bb114fef42107957860a Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Christian=20K=C3=B6nig?= <[email protected]>
Date: Fri, 9 Mar 2018 14:42:54 +0100
Subject: [PATCH] drm/amdgpu: fix prime teardown order
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We unmapped imported DMA-bufs when the GEM handle was dropped, not when the hardware was done with the buffere.

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
index bb9b21266b67..46b9ea4e6103 100644
@@ -36,8 +36,6 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
 	struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj);
 
 	if (robj) {
-		if (robj->gem_base.import_attach)
-			drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
 		amdgpu_mn_unregister(robj);
 		amdgpu_bo_unref(&robj);
 	}
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
index ec6ec1f8a085..fc720603b970 100644
@@ -60,6 +60,8 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
 
 	amdgpu_bo_kunmap(bo);
 
+	if (bo->gem_base.import_attach)
+		drm_prime_gem_destroy(&bo->gem_base, bo->tbo.sg);
 	drm_gem_object_release(&bo->gem_base);
 	amdgpu_bo_unref(&bo->parent);
 	if (!list_empty(&bo->shadow_list)) {