[Intel-gfx] [PATCH] drm/i915/gem: stop using PAGE_KERNEL_IO

Lucas De Marchi lucas.demarchi at intel.com
Wed Oct 20 09:06:25 UTC 2021


PAGE_KERNEL_IO is only defined for x86 and is the same as PAGE_KERNEL.
Use the latter since that is also available on other archs, which should
help us getting i915 there.

This is the same that was done done in commit 80c33624e472 ("io-mapping:
Fixup for different names of writecombine"). Later the commit
80c33624e472 ("io-mapping: Fixup for different names of writecombine")
added a "Fixes" tag to the first one, but that is actually fixing a
separate issue:  the different names for pgprot_writecombine().

Fast-forward today, it seems the only 2 archs that define
pgprot_noncached_wc() are microblaze and powerpc. Microblaze has the
same definition for pgprot_writecombine() since commit
97ccedd793ac ("microblaze: Provide pgprot_device/writecombine macros for
nommu"). Powerpc has 3 variants and all of them have the same behavior
for pgprot_writecombine() and pgprot_noncached_wc(). From the commit message
and linked issue, the fallback was needed for arm, but apparently today
all the variants there also have pgprot_writecombine().

So, just use PAGE_KERNEL, and just use pgprot_writecombine().

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index 8eb1c3a6fc9c..68fe1837ef54 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -289,7 +289,7 @@ static void *i915_gem_object_map_page(struct drm_i915_gem_object *obj,
 		pgprot = PAGE_KERNEL;
 		break;
 	case I915_MAP_WC:
-		pgprot = pgprot_writecombine(PAGE_KERNEL_IO);
+		pgprot = pgprot_writecombine(PAGE_KERNEL);
 		break;
 	}
 
@@ -333,7 +333,7 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
 	i = 0;
 	for_each_sgt_daddr(addr, iter, obj->mm.pages)
 		pfns[i++] = (iomap + addr) >> PAGE_SHIFT;
-	vaddr = vmap_pfn(pfns, n_pfn, pgprot_writecombine(PAGE_KERNEL_IO));
+	vaddr = vmap_pfn(pfns, n_pfn, pgprot_writecombine(PAGE_KERNEL));
 	if (pfns != stack)
 		kvfree(pfns);
 
-- 
2.33.1



More information about the Intel-gfx mailing list