Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm/i915: Wean off drm_pci_alloc/drm_pci_free" failed to apply to 4.19-stable tree

PATCH [email protected] 1 participant 1 message Feb 26, 2020

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-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 ------------------

From aa3146193ae25d0fe4b96d815169a135db2e8f01 Mon Sep 17 00:00:00 2001
From: Chris Wilson <[email protected]>
Date: Sun, 2 Feb 2020 15:39:34 +0000
Subject: [PATCH] drm/i915: Wean off drm_pci_alloc/drm_pci_free

drm_pci_alloc and drm_pci_free are just very thin wrappers around dma_alloc_coherent, with a note that we should be removing them. Furthermore since

commit de09d31dd38a50fdce106c15abd68432eebbd014

Author: Kirill A. Shutemov <[email protected]>
Date:   Fri Jan 15 16:51:42 2016 -0800

page-flags: define PG_reserved behavior on compound pages

As far as I can see there's no users of PG_reserved on compound pages. Let's use PF_NO_COMPOUND here.

drm_pci_alloc has been declared broken since it mixes GFP_COMP and SetPageReserved. Avoid this conflict by weaning ourselves off using the abstraction and using the dma functions directly.

Reported-by Taketo Kabe
Fixes de09d31dd38a ("page-flags: define PG_reserved behavior on compound pages")
Cc <[email protected]> # v4.5+
(cherry picked from commit c6790dc22312f592c1434577258b31c48c72d52a)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index e68ec25fc97c..aa453953908b 100644
@@ -11087,7 +11087,7 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
 	u32 base;
 
 	if (INTEL_INFO(dev_priv)->display.cursor_needs_physical)
-		base = obj->phys_handle->busaddr;
+		base = sg_dma_address(obj->mm.pages->sgl);
 	else
 		base = intel_plane_ggtt_offset(plane_state);
 
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +0 -3
index f64ad77e6b1e..c2174da35bb0 100644
@@ -285,9 +285,6 @@ struct drm_i915_gem_object {
 
 		void *gvt_info;
 	};
-
-	/** for phys allocated objects */
-	struct drm_dma_handle *phys_handle;
 };
 
 static inline struct drm_i915_gem_object *
drivers/gpu/drm/i915/gem/i915_gem_phys.c +50 -48

160 lines not on this page · raw message

drivers/gpu/drm/i915/i915_gem.c +4 -4
index c2de2f45b459..5f6e63952821 100644
@@ -180,7 +180,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
 		     struct drm_i915_gem_pwrite *args,
 		     struct drm_file *file)
 {
-	void *vaddr = obj->phys_handle->vaddr + args->offset;
+	void *vaddr = sg_page(obj->mm.pages->sgl) + args->offset;
 	char __user *user_data = u64_to_user_ptr(args->data_ptr);
 
 	/*
@@ -844,10 +844,10 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
 		ret = i915_gem_gtt_pwrite_fast(obj, args);
 
 	if (ret == -EFAULT || ret == -ENOSPC) {
-		if (obj->phys_handle)
-			ret = i915_gem_phys_pwrite(obj, args, file);
-		else
+		if (i915_gem_object_has_struct_page(obj))
 			ret = i915_gem_shmem_pwrite(obj, args);
+		else
+			ret = i915_gem_phys_pwrite(obj, args, file);
 	}
 
 	i915_gem_object_unpin_pages(obj);