linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Nuke PAGE_KERNEL_IO
@ 2021-10-21 18:15 Lucas De Marchi
  2021-10-21 18:15 ` [PATCH 1/2] drm/i915/gem: stop using PAGE_KERNEL_IO Lucas De Marchi
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Lucas De Marchi @ 2021-10-21 18:15 UTC (permalink / raw)
  To: intel-gfx, dri-devel, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Peter Zijlstra, Boris Ostrovsky, linux-kernel, linux-arch,
	xen-devel, Daniel Vetter

Last user of PAGE_KERNEL_IO is the i915 driver. While removing it from
there as we seek to bring the driver to other architectures, Daniel
suggested that we could finish the cleanup and remove it altogether,
through the tip tree. So here I'm sending both commits needed for that.

Lucas De Marchi (2):
  drm/i915/gem: stop using PAGE_KERNEL_IO
  x86/mm: nuke PAGE_KERNEL_IO

 arch/x86/include/asm/fixmap.h             | 2 +-
 arch/x86/include/asm/pgtable_types.h      | 7 -------
 arch/x86/mm/ioremap.c                     | 2 +-
 arch/x86/xen/setup.c                      | 2 +-
 drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
 include/asm-generic/fixmap.h              | 2 +-
 6 files changed, 6 insertions(+), 13 deletions(-)

-- 
2.33.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] drm/i915/gem: stop using PAGE_KERNEL_IO
  2021-10-21 18:15 [PATCH 0/2] Nuke PAGE_KERNEL_IO Lucas De Marchi
@ 2021-10-21 18:15 ` Lucas De Marchi
  2021-10-21 18:15 ` [PATCH 2/2] x86/mm: nuke PAGE_KERNEL_IO Lucas De Marchi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Lucas De Marchi @ 2021-10-21 18:15 UTC (permalink / raw)
  To: intel-gfx, dri-devel, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Peter Zijlstra, Boris Ostrovsky, linux-kernel, linux-arch,
	xen-devel, Daniel Vetter

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

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020090625.1037517-1-lucas.demarchi@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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] x86/mm: nuke PAGE_KERNEL_IO
  2021-10-21 18:15 [PATCH 0/2] Nuke PAGE_KERNEL_IO Lucas De Marchi
  2021-10-21 18:15 ` [PATCH 1/2] drm/i915/gem: stop using PAGE_KERNEL_IO Lucas De Marchi
@ 2021-10-21 18:15 ` Lucas De Marchi
  2021-11-05 15:29   ` Lucas De Marchi
  2021-11-15 20:09   ` [tip: x86/mm] x86/mm: Nuke PAGE_KERNEL_IO tip-bot2 for Lucas De Marchi
  2021-11-12 19:04 ` [PATCH 0/2] " Peter Zijlstra
  2021-11-12 21:04 ` Andy Lutomirski
  3 siblings, 2 replies; 9+ messages in thread
From: Lucas De Marchi @ 2021-10-21 18:15 UTC (permalink / raw)
  To: intel-gfx, dri-devel, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Peter Zijlstra, Boris Ostrovsky, linux-kernel, linux-arch,
	xen-devel, Daniel Vetter

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.

With the last users outside arch/x86 being remove we can now remove
PAGE_KERNEL_IO.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 arch/x86/include/asm/fixmap.h        | 2 +-
 arch/x86/include/asm/pgtable_types.h | 7 -------
 arch/x86/mm/ioremap.c                | 2 +-
 arch/x86/xen/setup.c                 | 2 +-
 include/asm-generic/fixmap.h         | 2 +-
 5 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index d0dcefb5cc59..5e186a69db10 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -173,7 +173,7 @@ static inline void __set_fixmap(enum fixed_addresses idx,
  * supported for MMIO addresses, so make sure that the memory encryption
  * mask is not part of the page attributes.
  */
-#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_IO_NOCACHE
+#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
 
 /*
  * Early memremap routines used for in-place encryption. The mappings created
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 40497a9020c6..a87224767ff3 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -199,10 +199,6 @@ enum page_cache_mode {
 #define __PAGE_KERNEL_WP	 (__PP|__RW|   0|___A|__NX|___D|   0|___G| __WP)
 
 
-#define __PAGE_KERNEL_IO		__PAGE_KERNEL
-#define __PAGE_KERNEL_IO_NOCACHE	__PAGE_KERNEL_NOCACHE
-
-
 #ifndef __ASSEMBLY__
 
 #define __PAGE_KERNEL_ENC	(__PAGE_KERNEL    | _ENC)
@@ -223,9 +219,6 @@ enum page_cache_mode {
 #define PAGE_KERNEL_LARGE_EXEC	__pgprot_mask(__PAGE_KERNEL_LARGE_EXEC | _ENC)
 #define PAGE_KERNEL_VVAR	__pgprot_mask(__PAGE_KERNEL_VVAR       | _ENC)
 
-#define PAGE_KERNEL_IO		__pgprot_mask(__PAGE_KERNEL_IO)
-#define PAGE_KERNEL_IO_NOCACHE	__pgprot_mask(__PAGE_KERNEL_IO_NOCACHE)
-
 #endif	/* __ASSEMBLY__ */
 
 /*         xwr */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 026031b3b782..3102dda4b152 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -243,7 +243,7 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
 	 * make sure the memory encryption attribute is enabled in the
 	 * resulting mapping.
 	 */
-	prot = PAGE_KERNEL_IO;
+	prot = PAGE_KERNEL;
 	if ((io_desc.flags & IORES_MAP_ENCRYPTED) || encrypted)
 		prot = pgprot_encrypted(prot);
 
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 8bfc10330107..5dc0771a50f3 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -435,7 +435,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
 	for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++)
 		(void)HYPERVISOR_update_va_mapping(
 			(unsigned long)__va(pfn << PAGE_SHIFT),
-			mfn_pte(pfn, PAGE_KERNEL_IO), 0);
+			mfn_pte(pfn, PAGE_KERNEL), 0);
 
 	return remap_pfn;
 }
diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
index 8cc7b09c1bc7..f1b0c6f3d0be 100644
--- a/include/asm-generic/fixmap.h
+++ b/include/asm-generic/fixmap.h
@@ -54,7 +54,7 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
 #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
 #endif
 #ifndef FIXMAP_PAGE_IO
-#define FIXMAP_PAGE_IO PAGE_KERNEL_IO
+#define FIXMAP_PAGE_IO PAGE_KERNEL
 #endif
 #ifndef FIXMAP_PAGE_CLEAR
 #define FIXMAP_PAGE_CLEAR __pgprot(0)
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] x86/mm: nuke PAGE_KERNEL_IO
  2021-10-21 18:15 ` [PATCH 2/2] x86/mm: nuke PAGE_KERNEL_IO Lucas De Marchi
@ 2021-11-05 15:29   ` Lucas De Marchi
  2021-11-15 20:09   ` [tip: x86/mm] x86/mm: Nuke PAGE_KERNEL_IO tip-bot2 for Lucas De Marchi
  1 sibling, 0 replies; 9+ messages in thread
From: Lucas De Marchi @ 2021-11-05 15:29 UTC (permalink / raw)
  To: intel-gfx, dri-devel, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Peter Zijlstra, Boris Ostrovsky, linux-kernel, linux-arch,
	xen-devel, Daniel Vetter

Hi, gentle ping on this. Is it something that could go through the tip
tree?

thanks
Lucas De Marchi

On Thu, Oct 21, 2021 at 11:15:11AM -0700, Lucas De Marchi wrote:
>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.
>
>With the last users outside arch/x86 being remove we can now remove
>PAGE_KERNEL_IO.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>---
> arch/x86/include/asm/fixmap.h        | 2 +-
> arch/x86/include/asm/pgtable_types.h | 7 -------
> arch/x86/mm/ioremap.c                | 2 +-
> arch/x86/xen/setup.c                 | 2 +-
> include/asm-generic/fixmap.h         | 2 +-
> 5 files changed, 4 insertions(+), 11 deletions(-)
>
>diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
>index d0dcefb5cc59..5e186a69db10 100644
>--- a/arch/x86/include/asm/fixmap.h
>+++ b/arch/x86/include/asm/fixmap.h
>@@ -173,7 +173,7 @@ static inline void __set_fixmap(enum fixed_addresses idx,
>  * supported for MMIO addresses, so make sure that the memory encryption
>  * mask is not part of the page attributes.
>  */
>-#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_IO_NOCACHE
>+#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
>
> /*
>  * Early memremap routines used for in-place encryption. The mappings created
>diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
>index 40497a9020c6..a87224767ff3 100644
>--- a/arch/x86/include/asm/pgtable_types.h
>+++ b/arch/x86/include/asm/pgtable_types.h
>@@ -199,10 +199,6 @@ enum page_cache_mode {
> #define __PAGE_KERNEL_WP	 (__PP|__RW|   0|___A|__NX|___D|   0|___G| __WP)
>
>
>-#define __PAGE_KERNEL_IO		__PAGE_KERNEL
>-#define __PAGE_KERNEL_IO_NOCACHE	__PAGE_KERNEL_NOCACHE
>-
>-
> #ifndef __ASSEMBLY__
>
> #define __PAGE_KERNEL_ENC	(__PAGE_KERNEL    | _ENC)
>@@ -223,9 +219,6 @@ enum page_cache_mode {
> #define PAGE_KERNEL_LARGE_EXEC	__pgprot_mask(__PAGE_KERNEL_LARGE_EXEC | _ENC)
> #define PAGE_KERNEL_VVAR	__pgprot_mask(__PAGE_KERNEL_VVAR       | _ENC)
>
>-#define PAGE_KERNEL_IO		__pgprot_mask(__PAGE_KERNEL_IO)
>-#define PAGE_KERNEL_IO_NOCACHE	__pgprot_mask(__PAGE_KERNEL_IO_NOCACHE)
>-
> #endif	/* __ASSEMBLY__ */
>
> /*         xwr */
>diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
>index 026031b3b782..3102dda4b152 100644
>--- a/arch/x86/mm/ioremap.c
>+++ b/arch/x86/mm/ioremap.c
>@@ -243,7 +243,7 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
> 	 * make sure the memory encryption attribute is enabled in the
> 	 * resulting mapping.
> 	 */
>-	prot = PAGE_KERNEL_IO;
>+	prot = PAGE_KERNEL;
> 	if ((io_desc.flags & IORES_MAP_ENCRYPTED) || encrypted)
> 		prot = pgprot_encrypted(prot);
>
>diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
>index 8bfc10330107..5dc0771a50f3 100644
>--- a/arch/x86/xen/setup.c
>+++ b/arch/x86/xen/setup.c
>@@ -435,7 +435,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
> 	for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++)
> 		(void)HYPERVISOR_update_va_mapping(
> 			(unsigned long)__va(pfn << PAGE_SHIFT),
>-			mfn_pte(pfn, PAGE_KERNEL_IO), 0);
>+			mfn_pte(pfn, PAGE_KERNEL), 0);
>
> 	return remap_pfn;
> }
>diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
>index 8cc7b09c1bc7..f1b0c6f3d0be 100644
>--- a/include/asm-generic/fixmap.h
>+++ b/include/asm-generic/fixmap.h
>@@ -54,7 +54,7 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
> #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
> #endif
> #ifndef FIXMAP_PAGE_IO
>-#define FIXMAP_PAGE_IO PAGE_KERNEL_IO
>+#define FIXMAP_PAGE_IO PAGE_KERNEL
> #endif
> #ifndef FIXMAP_PAGE_CLEAR
> #define FIXMAP_PAGE_CLEAR __pgprot(0)
>-- 
>2.33.1
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Nuke PAGE_KERNEL_IO
  2021-10-21 18:15 [PATCH 0/2] Nuke PAGE_KERNEL_IO Lucas De Marchi
  2021-10-21 18:15 ` [PATCH 1/2] drm/i915/gem: stop using PAGE_KERNEL_IO Lucas De Marchi
  2021-10-21 18:15 ` [PATCH 2/2] x86/mm: nuke PAGE_KERNEL_IO Lucas De Marchi
@ 2021-11-12 19:04 ` Peter Zijlstra
  2021-11-12 20:09   ` Lucas De Marchi
  2021-11-12 21:04 ` Andy Lutomirski
  3 siblings, 1 reply; 9+ messages in thread
From: Peter Zijlstra @ 2021-11-12 19:04 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: intel-gfx, dri-devel, x86, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, Boris Ostrovsky, linux-kernel,
	linux-arch, xen-devel, Daniel Vetter

On Thu, Oct 21, 2021 at 11:15:09AM -0700, Lucas De Marchi wrote:
> Last user of PAGE_KERNEL_IO is the i915 driver. While removing it from
> there as we seek to bring the driver to other architectures, Daniel
> suggested that we could finish the cleanup and remove it altogether,
> through the tip tree. So here I'm sending both commits needed for that.
> 
> Lucas De Marchi (2):
>   drm/i915/gem: stop using PAGE_KERNEL_IO
>   x86/mm: nuke PAGE_KERNEL_IO
> 
>  arch/x86/include/asm/fixmap.h             | 2 +-
>  arch/x86/include/asm/pgtable_types.h      | 7 -------
>  arch/x86/mm/ioremap.c                     | 2 +-
>  arch/x86/xen/setup.c                      | 2 +-
>  drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
>  include/asm-generic/fixmap.h              | 2 +-
>  6 files changed, 6 insertions(+), 13 deletions(-)

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Nuke PAGE_KERNEL_IO
  2021-11-12 19:04 ` [PATCH 0/2] " Peter Zijlstra
@ 2021-11-12 20:09   ` Lucas De Marchi
  2021-11-12 20:18     ` Dave Hansen
  0 siblings, 1 reply; 9+ messages in thread
From: Lucas De Marchi @ 2021-11-12 20:09 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: intel-gfx, dri-devel, x86, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, Boris Ostrovsky, linux-kernel,
	linux-arch, xen-devel, Daniel Vetter

On Fri, Nov 12, 2021 at 08:04:03PM +0100, Peter Zijlstra wrote:
>On Thu, Oct 21, 2021 at 11:15:09AM -0700, Lucas De Marchi wrote:
>> Last user of PAGE_KERNEL_IO is the i915 driver. While removing it from
>> there as we seek to bring the driver to other architectures, Daniel
>> suggested that we could finish the cleanup and remove it altogether,
>> through the tip tree. So here I'm sending both commits needed for that.
>>
>> Lucas De Marchi (2):
>>   drm/i915/gem: stop using PAGE_KERNEL_IO
>>   x86/mm: nuke PAGE_KERNEL_IO
>>
>>  arch/x86/include/asm/fixmap.h             | 2 +-
>>  arch/x86/include/asm/pgtable_types.h      | 7 -------
>>  arch/x86/mm/ioremap.c                     | 2 +-
>>  arch/x86/xen/setup.c                      | 2 +-
>>  drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
>>  include/asm-generic/fixmap.h              | 2 +-
>>  6 files changed, 6 insertions(+), 13 deletions(-)
>
>Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

thanks, Peter.

The intention was to merge this through the tip tree. Although now I'm
not sure. Options:

	1) take the first patch through the drm-intel tree and apply the
	   second patch later
	2) take everything through the drm tree
	3) take everything through the tip tree

What's your preference here?

Lucas De Marchi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Nuke PAGE_KERNEL_IO
  2021-11-12 20:09   ` Lucas De Marchi
@ 2021-11-12 20:18     ` Dave Hansen
  0 siblings, 0 replies; 9+ messages in thread
From: Dave Hansen @ 2021-11-12 20:18 UTC (permalink / raw)
  To: Lucas De Marchi, Peter Zijlstra
  Cc: intel-gfx, dri-devel, x86, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, Boris Ostrovsky, linux-kernel,
	linux-arch, xen-devel, Daniel Vetter

On 11/12/21 12:09 PM, Lucas De Marchi wrote:
> The intention was to merge this through the tip tree. Although now I'm
> not sure. Options:
> 
>     1) take the first patch through the drm-intel tree and apply the
>        second patch later
>     2) take everything through the drm tree
>     3) take everything through the tip tree
> 
> What's your preference here?

It's fine with me to take it through tip unless that causes a problem
for anyone.  I was planning on doing queuing it after -rc1.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Nuke PAGE_KERNEL_IO
  2021-10-21 18:15 [PATCH 0/2] Nuke PAGE_KERNEL_IO Lucas De Marchi
                   ` (2 preceding siblings ...)
  2021-11-12 19:04 ` [PATCH 0/2] " Peter Zijlstra
@ 2021-11-12 21:04 ` Andy Lutomirski
  3 siblings, 0 replies; 9+ messages in thread
From: Andy Lutomirski @ 2021-11-12 21:04 UTC (permalink / raw)
  To: Lucas De Marchi, intel-gfx, dri-devel, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Peter Zijlstra, Boris Ostrovsky, linux-kernel, linux-arch,
	xen-devel, Daniel Vetter

On 10/21/21 11:15, Lucas De Marchi wrote:
> Last user of PAGE_KERNEL_IO is the i915 driver. While removing it from
> there as we seek to bring the driver to other architectures, Daniel
> suggested that we could finish the cleanup and remove it altogether,
> through the tip tree. So here I'm sending both commits needed for that.
> 
> Lucas De Marchi (2):
>    drm/i915/gem: stop using PAGE_KERNEL_IO
>    x86/mm: nuke PAGE_KERNEL_IO
> 
>   arch/x86/include/asm/fixmap.h             | 2 +-
>   arch/x86/include/asm/pgtable_types.h      | 7 -------
>   arch/x86/mm/ioremap.c                     | 2 +-
>   arch/x86/xen/setup.c                      | 2 +-
>   drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 ++--
>   include/asm-generic/fixmap.h              | 2 +-
>   6 files changed, 6 insertions(+), 13 deletions(-)
> 

Acked-by: Andy Lutomirski <luto@kernel.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [tip: x86/mm] x86/mm: Nuke PAGE_KERNEL_IO
  2021-10-21 18:15 ` [PATCH 2/2] x86/mm: nuke PAGE_KERNEL_IO Lucas De Marchi
  2021-11-05 15:29   ` Lucas De Marchi
@ 2021-11-15 20:09   ` tip-bot2 for Lucas De Marchi
  1 sibling, 0 replies; 9+ messages in thread
From: tip-bot2 for Lucas De Marchi @ 2021-11-15 20:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Lucas De Marchi, Dave Hansen, Peter Zijlstra (Intel),
	Andy Lutomirski, x86, linux-kernel

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

Commit-ID:     27dff0f58bdef4bcafdad8a8c2217d561bcf9506
Gitweb:        https://git.kernel.org/tip/27dff0f58bdef4bcafdad8a8c2217d561bcf9506
Author:        Lucas De Marchi <lucas.demarchi@intel.com>
AuthorDate:    Thu, 21 Oct 2021 11:15:11 -07:00
Committer:     Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Mon, 15 Nov 2021 10:57:55 -08:00

x86/mm: Nuke 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.

With the last users outside arch/x86 being remove we can now remove
PAGE_KERNEL_IO.

[ dhansen: dropped arch/x86/xen/setup.c hunk.  This
	   9a58b352e9e8 ("xen/x86: restrict PV Dom0 identity mapping")
	   already axed its use of PAGE_KERNEL_IO ]

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20211021181511.1533377-3-lucas.demarchi@intel.com
---
 arch/x86/include/asm/fixmap.h        | 2 +-
 arch/x86/include/asm/pgtable_types.h | 7 -------
 arch/x86/mm/ioremap.c                | 2 +-
 include/asm-generic/fixmap.h         | 2 +-
 4 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index d0dcefb..5e186a6 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -173,7 +173,7 @@ static inline void __set_fixmap(enum fixed_addresses idx,
  * supported for MMIO addresses, so make sure that the memory encryption
  * mask is not part of the page attributes.
  */
-#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_IO_NOCACHE
+#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
 
 /*
  * Early memremap routines used for in-place encryption. The mappings created
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 40497a9..a872247 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -199,10 +199,6 @@ enum page_cache_mode {
 #define __PAGE_KERNEL_WP	 (__PP|__RW|   0|___A|__NX|___D|   0|___G| __WP)
 
 
-#define __PAGE_KERNEL_IO		__PAGE_KERNEL
-#define __PAGE_KERNEL_IO_NOCACHE	__PAGE_KERNEL_NOCACHE
-
-
 #ifndef __ASSEMBLY__
 
 #define __PAGE_KERNEL_ENC	(__PAGE_KERNEL    | _ENC)
@@ -223,9 +219,6 @@ enum page_cache_mode {
 #define PAGE_KERNEL_LARGE_EXEC	__pgprot_mask(__PAGE_KERNEL_LARGE_EXEC | _ENC)
 #define PAGE_KERNEL_VVAR	__pgprot_mask(__PAGE_KERNEL_VVAR       | _ENC)
 
-#define PAGE_KERNEL_IO		__pgprot_mask(__PAGE_KERNEL_IO)
-#define PAGE_KERNEL_IO_NOCACHE	__pgprot_mask(__PAGE_KERNEL_IO_NOCACHE)
-
 #endif	/* __ASSEMBLY__ */
 
 /*         xwr */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 026031b..3102dda 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -243,7 +243,7 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
 	 * make sure the memory encryption attribute is enabled in the
 	 * resulting mapping.
 	 */
-	prot = PAGE_KERNEL_IO;
+	prot = PAGE_KERNEL;
 	if ((io_desc.flags & IORES_MAP_ENCRYPTED) || encrypted)
 		prot = pgprot_encrypted(prot);
 
diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
index 8cc7b09..f1b0c6f 100644
--- a/include/asm-generic/fixmap.h
+++ b/include/asm-generic/fixmap.h
@@ -54,7 +54,7 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
 #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
 #endif
 #ifndef FIXMAP_PAGE_IO
-#define FIXMAP_PAGE_IO PAGE_KERNEL_IO
+#define FIXMAP_PAGE_IO PAGE_KERNEL
 #endif
 #ifndef FIXMAP_PAGE_CLEAR
 #define FIXMAP_PAGE_CLEAR __pgprot(0)

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-16  0:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 18:15 [PATCH 0/2] Nuke PAGE_KERNEL_IO Lucas De Marchi
2021-10-21 18:15 ` [PATCH 1/2] drm/i915/gem: stop using PAGE_KERNEL_IO Lucas De Marchi
2021-10-21 18:15 ` [PATCH 2/2] x86/mm: nuke PAGE_KERNEL_IO Lucas De Marchi
2021-11-05 15:29   ` Lucas De Marchi
2021-11-15 20:09   ` [tip: x86/mm] x86/mm: Nuke PAGE_KERNEL_IO tip-bot2 for Lucas De Marchi
2021-11-12 19:04 ` [PATCH 0/2] " Peter Zijlstra
2021-11-12 20:09   ` Lucas De Marchi
2021-11-12 20:18     ` Dave Hansen
2021-11-12 21:04 ` Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).