Skip to contentSkip to conversation

drm/i915/gem: stop using PAGE_KERNEL_IO

PATCH Applied Lucas De Marchi 4 participants 5 messages Oct 20, 2021 – Nov 16, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/gem: stop using PAGE_KERNEL_IO

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().

---
 drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_pages.c +2 -2
index 8eb1c3a6fc9c..68fe1837ef54 100644
@@ -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);
 
Signature · 1 line
2.33.1
#1 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: stop using PAGE_KERNEL_IO

== Series Details ==

== Series Details ==

Series: drm/i915/gem: stop using PAGE_KERNEL_IO
URL : https://patchwork.freedesktop.org/series/96045/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
419b331a6c11 drm/i915/gem: stop using PAGE_KERNEL_IO
-:10: WARNING:REPEATED_WORD: Possible repeated word: 'done'
#10: 
This is the same that was done done in commit 80c33624e472 ("io-mapping:

-:18: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 97ccedd793ac ("microblaze: Provide pgprot_device/writecombine macros for nommu")' #18:
same definition for pgprot_writecombine() since commit

-:21: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #21:
for pgprot_writecombine() and pgprot_noncached_wc(). From the commit message

total: 1 errors, 2 warnings, 0 checks, 16 lines checked

#2 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gem: stop using PAGE_KERNEL_IO

In reply to Lucas De Marchi
== Series Details ==

== Series Details ==

Series: drm/i915/gem: stop using PAGE_KERNEL_IO
URL : https://patchwork.freedesktop.org/series/96045/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10763 -> Patchwork_21387
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/index.html

Known issues
------------

Here are the changes found in Patchwork_21387 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_basic@query-info:
- fi-tgl-1115g4: NOTRUN -> [SKIP][1] ([fdo#109315])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@amdgpu/[email protected]
- fi-kbl-soraka: NOTRUN -> [SKIP][2] ([fdo#109271])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-kbl-soraka/igt@amdgpu/[email protected]

* igt@amdgpu/amd_cs_nop@nop-gfx0:
- fi-tgl-1115g4: NOTRUN -> [SKIP][3] ([fdo#109315] / [i915#2575]) +16 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@amdgpu/[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-tgl-1115g4: NOTRUN -> [SKIP][4] ([i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- fi-tgl-1115g4: NOTRUN -> [SKIP][5] ([i915#1155])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- fi-icl-y: [PASS][6] -> [INCOMPLETE][7] ([i915#3965])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10763/fi-icl-y/igt@i915_selftest@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-icl-y/igt@i915_selftest@[email protected]

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-tgl-1115g4: NOTRUN -> [SKIP][8] ([fdo#111827]) +8 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-tgl-1115g4: NOTRUN -> [SKIP][9] ([i915#4103]) +1 similar issue
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- fi-tgl-1115g4: NOTRUN -> [SKIP][10] ([fdo#109285])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@[email protected]

* igt@kms_psr@primary_mmap_gtt:
- fi-tgl-1115g4: NOTRUN -> [SKIP][11] ([i915#1072]) +3 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@kms_psr@primary_mmap_gtt.html

* igt@prime_vgem@basic-userptr:
- fi-tgl-1115g4: NOTRUN -> [SKIP][12] ([i915#3301])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-tgl-1115g4/igt@[email protected]

* igt@runner@aborted:
- fi-icl-y: NOTRUN -> [FAIL][13] ([i915#4006] / [i915#4312])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-icl-y/igt@[email protected]

#### Possible fixes ####

* igt@kms_flip@basic-flip-vs-modeset@c-dp1:
- fi-cfl-8109u: [FAIL][14] ([i915#4165]) -> [PASS][15] +1 similar issue
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10763/fi-cfl-8109u/igt@kms_flip@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-cfl-8109u/igt@kms_flip@[email protected]

* igt@kms_flip@basic-plain-flip@c-dp2:
- fi-cfl-8109u: [DMESG-WARN][16] ([i915#295]) -> [PASS][17] +2 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10763/fi-cfl-8109u/igt@kms_flip@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-cfl-8109u/igt@kms_flip@[email protected]

#### Warnings ####

* igt@kms_flip@basic-plain-flip@c-dp1:
- fi-cfl-8109u: [DMESG-WARN][18] ([i915#295]) -> [FAIL][19] ([i915#4165])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10763/fi-cfl-8109u/igt@kms_flip@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/fi-cfl-8109u/igt@kms_flip@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#295]: https://gitlab.freedesktop.org/drm/intel/issues/295
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#3965]: https://gitlab.freedesktop.org/drm/intel/issues/3965
[i915#4006]: https://gitlab.freedesktop.org/drm/intel/issues/4006
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4165]: https://gitlab.freedesktop.org/drm/intel/issues/4165
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312

Participating hosts (37 -> 36)
------------------------------

Additional (1): fi-tgl-1115g4
Missing (2): fi-bsw-cyan bat-dg1-6

Build changes
-------------

* Linux: CI_DRM_10763 -> Patchwork_21387

CI-20190529: 20190529
CI_DRM_10763: 4ee44225b0be875097a80b06ed976f27c87b1368 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6257: 5e32858ad62342f9ae5207e0432bf6f4c896d165 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21387: 419b331a6c1143b5fde2be706deb647ab67800ce @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

419b331a6c11 drm/i915/gem: stop using PAGE_KERNEL_IO

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21387/index.html

#3 lore raw
In reply to Lucas De Marchi
Quoted 19 lines · Lucas De Marchi

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().

Quoted 3 lines

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

I think a bit more history on PAGE_KERNEL_IO is useful to add. It was added in be43d72835ba ("x86: add _PAGE_IOMAP pte flag for IO mappings"). The one and only user was lost in f955371ca9d3 ("x86: remove the Xen-specific _PAGE_IOMAP PTE flag"), therefore it's safe to do this.

With that added Reviewed-by: Daniel Vetter <[email protected]>

Also if you're motivated, maybe delete PAGE_KERNEL_IO across the tree and get x86 maintainers to merge the entire series?
-Daniel

Quoted 29 lines
---
 drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_pages.c +2 -2
index 8eb1c3a6fc9c..68fe1837ef54 100644
@@ -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);
 
Signature · 1 line
2.33.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#4 lore raw

[tip: x86/mm] drm/i915/gem: Stop using PAGE_KERNEL_IO

In reply to Lucas De Marchi
The following commit has been merged into the x86/mm branch of tip:

The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     6b2a2138cf36e67783884058c772bfeb63a999ad
Gitweb:        https://git.kernel.org/tip/6b2a2138cf36e67783884058c772bfeb63a999ad
Author:        Lucas De Marchi <[email protected]>
AuthorDate:    Thu, 21 Oct 2021 11:15:10 -07:00
Committer:     Dave Hansen <[email protected]>
CommitterDate: Mon, 15 Nov 2021 10:31:49 -08:00

drm/i915/gem: Stop using PAGE_KERNEL_IO

PAGE_KERNEL_IO is only defined for x86 and nowadays is the same as PAGE_KERNEL. It was different for some time, OR'ing a _PAGE_IOMAP flag in commit be43d72835ba ("x86: add _PAGE_IOMAP pte flag for IO mappings"). This got removed in commit f955371ca9d3 ("x86: remove the Xen-specific _PAGE_IOMAP PTE flag"), so today they are just the same.

This is the same that was done in commit ac96b5566926 ("io-mapping.h:
s/PAGE_KERNEL_IO/PAGE_KERNEL/").

There is a subsequent commit with
'Fixes: ac96b5566926 ("io-mapping.h: s/PAGE_KERNEL_IO/PAGE_KERNEL/")' - but that is not relevant here since is it's actually fixing the different names for pgprot_writecombine(), which we also don't have today since all archs expose pgprot_writecombine(). Microblaze, mentioned in that discussion, gained pgprot_writecombine() in
commit 97ccedd793ac ("microblaze: Provide pgprot_device/writecombine macros for nommu").

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

---
 drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_pages.c +2 -2
index 8eb1c3a..68fe183 100644
@@ -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);