All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
@ 2022-06-07 12:50 ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

1. Enhance generic ioremap to make it more useful.
2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
3. Support HAVE_IOREMAP_PROT on arm64, which enable generic_access_phys(),
   it is useful when debug(eg, gdb) via access_process_vm device memory
   infrastructure.

v5:
- break long lines(> 80 cols), per Christoph Hellwig
- move is_vmalloc_addr() check from arm64 into generic ioremap, per
  Christoph Hellwig
- make arm64's ioremap_cache as an inline function, per Christoph
- keep changes simple, make ioremap/iounmap_allowed return bool, per
  Baoquan He
- simplify use 'void *' instead of 'void __iomem *' in iounmap, then
  drop __force annotation

v4:
- update based on v5.19-rc1
- add generic arch_ioremap/arch_iounmap define, per Andrew Monrton
- simply return an int for arch_ioremap and rename arch_ioremap/arch_iounmap
  to a better name, ioremap_allowed/iounmap_allowed, per Arnd Bergmann
- add __force annotation to slince sparse warning in vunmap() 

Note, 
1) after the renaming, the arm's change(patch1) is not the necessary
   dependence for the following changes, but as a cleanup, still post
   it here, hope it go in via the arm64 tree with reset of the series
   directly if no object.
2) the changes in this version only influence on patch4/5, so retain
   the ack/review.

v3:
- add cleanup patch to kill ARM's unused arch_iounmap(the naming will be
  used in GENERIC_IOREMAP) and add comments for arch_ioremap/arch_iounmap
  hooks, per Anshuman Khandual
- collect ack/review 

v2:
- s/addr/phys_addr in ioremap_prot, suggested by Andrew Morton 
- rename arch_ioremap/iounmap_check to arch_ioremap/iounmap
  and change return value, per Christoph Hellwig and Andrew Morton
- and use 'ifndef arch_ioremap' instead of weak function, per Arnd Bergmann
- collect ack/review

Kefeng Wang (6):
  ARM: mm: kill unused runtime hook arch_iounmap()
  mm: ioremap: Use more sensibly name in ioremap_prot()
  mm: ioremap: Setup phys_addr of struct vm_struct
  mm: ioremap: Add ioremap/iounmap_allowed()
  arm64: mm: Convert to GENERIC_IOREMAP
  arm64: Add HAVE_IOREMAP_PROT support

 .../features/vm/ioremap_prot/arch-support.txt |  2 +-
 arch/arm/include/asm/io.h                     |  4 +-
 arch/arm/mm/ioremap.c                         |  9 +-
 arch/arm/mm/nommu.c                           |  9 +-
 arch/arm64/Kconfig                            |  2 +
 arch/arm64/include/asm/io.h                   | 24 +++--
 arch/arm64/include/asm/pgtable.h              | 10 +++
 arch/arm64/kernel/acpi.c                      |  2 +-
 arch/arm64/mm/hugetlbpage.c                   | 10 ---
 arch/arm64/mm/ioremap.c                       | 90 ++-----------------
 include/asm-generic/io.h                      | 29 +++++-
 mm/ioremap.c                                  | 26 ++++--
 12 files changed, 90 insertions(+), 127 deletions(-)

-- 
2.35.3


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

* [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
@ 2022-06-07 12:50 ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

1. Enhance generic ioremap to make it more useful.
2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
3. Support HAVE_IOREMAP_PROT on arm64, which enable generic_access_phys(),
   it is useful when debug(eg, gdb) via access_process_vm device memory
   infrastructure.

v5:
- break long lines(> 80 cols), per Christoph Hellwig
- move is_vmalloc_addr() check from arm64 into generic ioremap, per
  Christoph Hellwig
- make arm64's ioremap_cache as an inline function, per Christoph
- keep changes simple, make ioremap/iounmap_allowed return bool, per
  Baoquan He
- simplify use 'void *' instead of 'void __iomem *' in iounmap, then
  drop __force annotation

v4:
- update based on v5.19-rc1
- add generic arch_ioremap/arch_iounmap define, per Andrew Monrton
- simply return an int for arch_ioremap and rename arch_ioremap/arch_iounmap
  to a better name, ioremap_allowed/iounmap_allowed, per Arnd Bergmann
- add __force annotation to slince sparse warning in vunmap() 

Note, 
1) after the renaming, the arm's change(patch1) is not the necessary
   dependence for the following changes, but as a cleanup, still post
   it here, hope it go in via the arm64 tree with reset of the series
   directly if no object.
2) the changes in this version only influence on patch4/5, so retain
   the ack/review.

v3:
- add cleanup patch to kill ARM's unused arch_iounmap(the naming will be
  used in GENERIC_IOREMAP) and add comments for arch_ioremap/arch_iounmap
  hooks, per Anshuman Khandual
- collect ack/review 

v2:
- s/addr/phys_addr in ioremap_prot, suggested by Andrew Morton 
- rename arch_ioremap/iounmap_check to arch_ioremap/iounmap
  and change return value, per Christoph Hellwig and Andrew Morton
- and use 'ifndef arch_ioremap' instead of weak function, per Arnd Bergmann
- collect ack/review

Kefeng Wang (6):
  ARM: mm: kill unused runtime hook arch_iounmap()
  mm: ioremap: Use more sensibly name in ioremap_prot()
  mm: ioremap: Setup phys_addr of struct vm_struct
  mm: ioremap: Add ioremap/iounmap_allowed()
  arm64: mm: Convert to GENERIC_IOREMAP
  arm64: Add HAVE_IOREMAP_PROT support

 .../features/vm/ioremap_prot/arch-support.txt |  2 +-
 arch/arm/include/asm/io.h                     |  4 +-
 arch/arm/mm/ioremap.c                         |  9 +-
 arch/arm/mm/nommu.c                           |  9 +-
 arch/arm64/Kconfig                            |  2 +
 arch/arm64/include/asm/io.h                   | 24 +++--
 arch/arm64/include/asm/pgtable.h              | 10 +++
 arch/arm64/kernel/acpi.c                      |  2 +-
 arch/arm64/mm/hugetlbpage.c                   | 10 ---
 arch/arm64/mm/ioremap.c                       | 90 ++-----------------
 include/asm-generic/io.h                      | 29 +++++-
 mm/ioremap.c                                  | 26 ++++--
 12 files changed, 90 insertions(+), 127 deletions(-)

-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-07 12:50   ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang,
	Russell King, Christoph Hellwig

Since the following commits,

v5.4
  commit 59d3ae9a5bf6 ("ARM: remove Intel iop33x and iop13xx support")
v5.11
  commit 3e3f354bc383 ("ARM: remove ebsa110 platform")

The runtime hook arch_iounmap() on ARM is useless, kill arch_iounmap()
and __iounmap().

Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm/include/asm/io.h | 4 +---
 arch/arm/mm/ioremap.c     | 9 +--------
 arch/arm/mm/nommu.c       | 9 +--------
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index eba7cbc93b86..7fcdc785366c 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -139,11 +139,9 @@ extern void __iomem *__arm_ioremap_caller(phys_addr_t, size_t, unsigned int,
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap_exec(phys_addr_t, size_t, bool cached);
 void __arm_iomem_set_ro(void __iomem *ptr, size_t size);
-extern void __iounmap(volatile void __iomem *addr);
 
 extern void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t,
 	unsigned int, void *);
-extern void (*arch_iounmap)(volatile void __iomem *);
 
 /*
  * Bad read/write accesses...
@@ -380,7 +378,7 @@ void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size);
 #define ioremap_wc ioremap_wc
 #define ioremap_wt ioremap_wc
 
-void iounmap(volatile void __iomem *iomem_cookie);
+void iounmap(volatile void __iomem *io_addr);
 #define iounmap iounmap
 
 void *arch_memremap_wb(phys_addr_t phys_addr, size_t size);
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 576c0e6c92fc..2129070065c3 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -418,7 +418,7 @@ void *arch_memremap_wb(phys_addr_t phys_addr, size_t size)
 						   __builtin_return_address(0));
 }
 
-void __iounmap(volatile void __iomem *io_addr)
+void iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
 	struct static_vm *svm;
@@ -446,13 +446,6 @@ void __iounmap(volatile void __iomem *io_addr)
 
 	vunmap(addr);
 }
-
-void (*arch_iounmap)(volatile void __iomem *) = __iounmap;
-
-void iounmap(volatile void __iomem *cookie)
-{
-	arch_iounmap(cookie);
-}
 EXPORT_SYMBOL(iounmap);
 
 #if defined(CONFIG_PCI) || IS_ENABLED(CONFIG_PCMCIA)
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 2658f52903da..c42debaded95 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -230,14 +230,7 @@ void *arch_memremap_wb(phys_addr_t phys_addr, size_t size)
 	return (void *)phys_addr;
 }
 
-void __iounmap(volatile void __iomem *addr)
-{
-}
-EXPORT_SYMBOL(__iounmap);
-
-void (*arch_iounmap)(volatile void __iomem *);
-
-void iounmap(volatile void __iomem *addr)
+void iounmap(volatile void __iomem *io_addr)
 {
 }
 EXPORT_SYMBOL(iounmap);
-- 
2.35.3


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

* [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
@ 2022-06-07 12:50   ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang,
	Russell King, Christoph Hellwig

Since the following commits,

v5.4
  commit 59d3ae9a5bf6 ("ARM: remove Intel iop33x and iop13xx support")
v5.11
  commit 3e3f354bc383 ("ARM: remove ebsa110 platform")

The runtime hook arch_iounmap() on ARM is useless, kill arch_iounmap()
and __iounmap().

Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm/include/asm/io.h | 4 +---
 arch/arm/mm/ioremap.c     | 9 +--------
 arch/arm/mm/nommu.c       | 9 +--------
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index eba7cbc93b86..7fcdc785366c 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -139,11 +139,9 @@ extern void __iomem *__arm_ioremap_caller(phys_addr_t, size_t, unsigned int,
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap_exec(phys_addr_t, size_t, bool cached);
 void __arm_iomem_set_ro(void __iomem *ptr, size_t size);
-extern void __iounmap(volatile void __iomem *addr);
 
 extern void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t,
 	unsigned int, void *);
-extern void (*arch_iounmap)(volatile void __iomem *);
 
 /*
  * Bad read/write accesses...
@@ -380,7 +378,7 @@ void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size);
 #define ioremap_wc ioremap_wc
 #define ioremap_wt ioremap_wc
 
-void iounmap(volatile void __iomem *iomem_cookie);
+void iounmap(volatile void __iomem *io_addr);
 #define iounmap iounmap
 
 void *arch_memremap_wb(phys_addr_t phys_addr, size_t size);
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 576c0e6c92fc..2129070065c3 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -418,7 +418,7 @@ void *arch_memremap_wb(phys_addr_t phys_addr, size_t size)
 						   __builtin_return_address(0));
 }
 
-void __iounmap(volatile void __iomem *io_addr)
+void iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
 	struct static_vm *svm;
@@ -446,13 +446,6 @@ void __iounmap(volatile void __iomem *io_addr)
 
 	vunmap(addr);
 }
-
-void (*arch_iounmap)(volatile void __iomem *) = __iounmap;
-
-void iounmap(volatile void __iomem *cookie)
-{
-	arch_iounmap(cookie);
-}
 EXPORT_SYMBOL(iounmap);
 
 #if defined(CONFIG_PCI) || IS_ENABLED(CONFIG_PCMCIA)
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 2658f52903da..c42debaded95 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -230,14 +230,7 @@ void *arch_memremap_wb(phys_addr_t phys_addr, size_t size)
 	return (void *)phys_addr;
 }
 
-void __iounmap(volatile void __iomem *addr)
-{
-}
-EXPORT_SYMBOL(__iounmap);
-
-void (*arch_iounmap)(volatile void __iomem *);
-
-void iounmap(volatile void __iomem *addr)
+void iounmap(volatile void __iomem *io_addr)
 {
 }
 EXPORT_SYMBOL(iounmap);
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-07 12:50   ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

Use more meaningful and sensibly naming phys_addr
instead addr in ioremap_prot().

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 include/asm-generic/io.h |  3 ++-
 mm/ioremap.c             | 14 ++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..b76379628a02 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
 #elif defined(CONFIG_GENERIC_IOREMAP)
 #include <linux/pgtable.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot);
 void iounmap(volatile void __iomem *addr);
 
 static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 5fe598ecd9b7..2d754b48d230 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -11,20 +11,21 @@
 #include <linux/io.h>
 #include <linux/export.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot)
 {
 	unsigned long offset, vaddr;
 	phys_addr_t last_addr;
 	struct vm_struct *area;
 
 	/* Disallow wrap-around or zero size */
-	last_addr = addr + size - 1;
-	if (!size || last_addr < addr)
+	last_addr = phys_addr + size - 1;
+	if (!size || last_addr < phys_addr)
 		return NULL;
 
 	/* Page-align mappings */
-	offset = addr & (~PAGE_MASK);
-	addr -= offset;
+	offset = phys_addr & (~PAGE_MASK);
+	phys_addr -= offset;
 	size = PAGE_ALIGN(size + offset);
 
 	area = get_vm_area_caller(size, VM_IOREMAP,
@@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
 		return NULL;
 	vaddr = (unsigned long)area->addr;
 
-	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
+	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
+			       __pgprot(prot))) {
 		free_vm_area(area);
 		return NULL;
 	}
-- 
2.35.3


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

* [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
@ 2022-06-07 12:50   ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

Use more meaningful and sensibly naming phys_addr
instead addr in ioremap_prot().

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 include/asm-generic/io.h |  3 ++-
 mm/ioremap.c             | 14 ++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..b76379628a02 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
 #elif defined(CONFIG_GENERIC_IOREMAP)
 #include <linux/pgtable.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot);
 void iounmap(volatile void __iomem *addr);
 
 static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 5fe598ecd9b7..2d754b48d230 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -11,20 +11,21 @@
 #include <linux/io.h>
 #include <linux/export.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot)
 {
 	unsigned long offset, vaddr;
 	phys_addr_t last_addr;
 	struct vm_struct *area;
 
 	/* Disallow wrap-around or zero size */
-	last_addr = addr + size - 1;
-	if (!size || last_addr < addr)
+	last_addr = phys_addr + size - 1;
+	if (!size || last_addr < phys_addr)
 		return NULL;
 
 	/* Page-align mappings */
-	offset = addr & (~PAGE_MASK);
-	addr -= offset;
+	offset = phys_addr & (~PAGE_MASK);
+	phys_addr -= offset;
 	size = PAGE_ALIGN(size + offset);
 
 	area = get_vm_area_caller(size, VM_IOREMAP,
@@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
 		return NULL;
 	vaddr = (unsigned long)area->addr;
 
-	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
+	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
+			       __pgprot(prot))) {
 		free_vm_area(area);
 		return NULL;
 	}
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 3/6] mm: ioremap: Setup phys_addr of struct vm_struct
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-07 12:50   ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang, Christoph Hellwig

Show physical address of each ioremap in /proc/vmallocinfo.

Acked-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/ioremap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/ioremap.c b/mm/ioremap.c
index 2d754b48d230..e1d008e8f87f 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -33,6 +33,7 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
 	if (!area)
 		return NULL;
 	vaddr = (unsigned long)area->addr;
+	area->phys_addr = phys_addr;
 
 	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
 			       __pgprot(prot))) {
-- 
2.35.3


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

* [PATCH v5 3/6] mm: ioremap: Setup phys_addr of struct vm_struct
@ 2022-06-07 12:50   ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang, Christoph Hellwig

Show physical address of each ioremap in /proc/vmallocinfo.

Acked-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/ioremap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/ioremap.c b/mm/ioremap.c
index 2d754b48d230..e1d008e8f87f 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -33,6 +33,7 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
 	if (!area)
 		return NULL;
 	vaddr = (unsigned long)area->addr;
+	area->phys_addr = phys_addr;
 
 	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
 			       __pgprot(prot))) {
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 4/6] mm: ioremap: Add ioremap/iounmap_allowed()
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-07 12:50   ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

Add special hook for architecture to verify addr, size or prot
when ioremap() or iounmap(), which will make the generic ioremap
more useful.

  ioremap_allowed() return a bool,
    - true means continue to remap
    - false means skip remap and return directly
  iounmap_allowed() return a bool,
    - true means continue to vunmap
    - false code means skip vunmap and return directly

Meanwhile, only vunmap the address when it is in vmalloc area
as the generic ioremap only returns vmalloc addresses.

Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 include/asm-generic/io.h | 26 ++++++++++++++++++++++++++
 mm/ioremap.c             | 11 ++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index b76379628a02..db5b890eaff7 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -964,6 +964,32 @@ static inline void iounmap(volatile void __iomem *addr)
 #elif defined(CONFIG_GENERIC_IOREMAP)
 #include <linux/pgtable.h>
 
+/*
+ * Arch code can implement the following two hooks when using GENERIC_IOREMAP
+ * ioremap_allowed() return a bool,
+ *   - true means continue to remap
+ *   - false means skip remap and return directly
+ * iounmap_allowed() return a bool,
+ *   - true means continue to vunmap
+ *   - false means skip vunmap and return directly
+ */
+#ifndef ioremap_allowed
+#define ioremap_allowed ioremap_allowed
+static inline bool ioremap_allowed(phys_addr_t phys_addr, size_t size,
+				   unsigned long prot)
+{
+	return true;
+}
+#endif
+
+#ifndef iounmap_allowed
+#define iounmap_allowed iounmap_allowed
+static inline bool iounmap_allowed(void *addr)
+{
+	return true;
+}
+#endif
+
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
 			   unsigned long prot);
 void iounmap(volatile void __iomem *addr);
diff --git a/mm/ioremap.c b/mm/ioremap.c
index e1d008e8f87f..8652426282cc 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -28,6 +28,9 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
 	phys_addr -= offset;
 	size = PAGE_ALIGN(size + offset);
 
+	if (!ioremap_allowed(phys_addr, size, prot))
+		return NULL;
+
 	area = get_vm_area_caller(size, VM_IOREMAP,
 			__builtin_return_address(0));
 	if (!area)
@@ -47,6 +50,12 @@ EXPORT_SYMBOL(ioremap_prot);
 
 void iounmap(volatile void __iomem *addr)
 {
-	vunmap((void *)((unsigned long)addr & PAGE_MASK));
+	void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
+
+	if (!iounmap_allowed(vaddr))
+		return;
+
+	if (is_vmalloc_addr(vaddr))
+		vunmap(vaddr);
 }
 EXPORT_SYMBOL(iounmap);
-- 
2.35.3


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

* [PATCH v5 4/6] mm: ioremap: Add ioremap/iounmap_allowed()
@ 2022-06-07 12:50   ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

Add special hook for architecture to verify addr, size or prot
when ioremap() or iounmap(), which will make the generic ioremap
more useful.

  ioremap_allowed() return a bool,
    - true means continue to remap
    - false means skip remap and return directly
  iounmap_allowed() return a bool,
    - true means continue to vunmap
    - false code means skip vunmap and return directly

Meanwhile, only vunmap the address when it is in vmalloc area
as the generic ioremap only returns vmalloc addresses.

Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 include/asm-generic/io.h | 26 ++++++++++++++++++++++++++
 mm/ioremap.c             | 11 ++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index b76379628a02..db5b890eaff7 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -964,6 +964,32 @@ static inline void iounmap(volatile void __iomem *addr)
 #elif defined(CONFIG_GENERIC_IOREMAP)
 #include <linux/pgtable.h>
 
+/*
+ * Arch code can implement the following two hooks when using GENERIC_IOREMAP
+ * ioremap_allowed() return a bool,
+ *   - true means continue to remap
+ *   - false means skip remap and return directly
+ * iounmap_allowed() return a bool,
+ *   - true means continue to vunmap
+ *   - false means skip vunmap and return directly
+ */
+#ifndef ioremap_allowed
+#define ioremap_allowed ioremap_allowed
+static inline bool ioremap_allowed(phys_addr_t phys_addr, size_t size,
+				   unsigned long prot)
+{
+	return true;
+}
+#endif
+
+#ifndef iounmap_allowed
+#define iounmap_allowed iounmap_allowed
+static inline bool iounmap_allowed(void *addr)
+{
+	return true;
+}
+#endif
+
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
 			   unsigned long prot);
 void iounmap(volatile void __iomem *addr);
diff --git a/mm/ioremap.c b/mm/ioremap.c
index e1d008e8f87f..8652426282cc 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -28,6 +28,9 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
 	phys_addr -= offset;
 	size = PAGE_ALIGN(size + offset);
 
+	if (!ioremap_allowed(phys_addr, size, prot))
+		return NULL;
+
 	area = get_vm_area_caller(size, VM_IOREMAP,
 			__builtin_return_address(0));
 	if (!area)
@@ -47,6 +50,12 @@ EXPORT_SYMBOL(ioremap_prot);
 
 void iounmap(volatile void __iomem *addr)
 {
-	vunmap((void *)((unsigned long)addr & PAGE_MASK));
+	void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
+
+	if (!iounmap_allowed(vaddr))
+		return;
+
+	if (is_vmalloc_addr(vaddr))
+		vunmap(vaddr);
 }
 EXPORT_SYMBOL(iounmap);
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 5/6] arm64: mm: Convert to GENERIC_IOREMAP
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-07 12:50   ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

Add hook for arm64's special operation when ioremap(), then
ioremap_wc/np/cache is converted to use ioremap_prot() from
GENERIC_IOREMAP, update the Copyright and kill the unused
inclusions.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/Kconfig          |  1 +
 arch/arm64/include/asm/io.h | 24 +++++++---
 arch/arm64/kernel/acpi.c    |  2 +-
 arch/arm64/mm/ioremap.c     | 90 ++++---------------------------------
 4 files changed, 28 insertions(+), 89 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1652a9800ebe..ac160aa26126 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -126,6 +126,7 @@ config ARM64
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_IDLE_POLL_SETUP
+	select GENERIC_IOREMAP
 	select GENERIC_IRQ_IPI
 	select GENERIC_IRQ_PROBE
 	select GENERIC_IRQ_SHOW
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 3995652daf81..87dd42d74afe 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -163,13 +163,16 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
 /*
  * I/O memory mapping functions.
  */
-extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot);
-extern void iounmap(volatile void __iomem *addr);
-extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
 
-#define ioremap(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
-#define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
-#define ioremap_np(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRnE))
+bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot);
+#define ioremap_allowed ioremap_allowed
+
+#define _PAGE_IOREMAP PROT_DEVICE_nGnRE
+
+#define ioremap_wc(addr, size)	\
+	ioremap_prot((addr), (size), PROT_NORMAL_NC)
+#define ioremap_np(addr, size)	\
+	ioremap_prot((addr), (size), PROT_DEVICE_nGnRnE)
 
 /*
  * io{read,write}{16,32,64}be() macros
@@ -184,6 +187,15 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
 
 #include <asm-generic/io.h>
 
+#define ioremap_cache ioremap_cache
+static inline void __iomem *ioremap_cache(phys_addr_t addr, size_t size)
+{
+	if (pfn_is_map_memory(__phys_to_pfn(addr)))
+		return (void __iomem *)__phys_to_virt(addr);
+
+	return ioremap_prot(addr, size, PROT_NORMAL);
+}
+
 /*
  * More restrictive address range checking than the default implementation
  * (PHYS_OFFSET and PHYS_MASK taken into account).
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index e4dea8db6924..a5a256e3f9fe 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -351,7 +351,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
 				prot = __acpi_get_writethrough_mem_attribute();
 		}
 	}
-	return __ioremap(phys, size, prot);
+	return ioremap_prot(phys, size, pgprot_val(prot));
 }
 
 /*
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index b21f91cd830d..c5af103d4ad4 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -1,96 +1,22 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/*
- * Based on arch/arm/mm/ioremap.c
- *
- * (C) Copyright 1995 1996 Linus Torvalds
- * Hacked for ARM by Phil Blundell <philb@gnu.org>
- * Hacked to allow all architectures to build, and various cleanups
- * by Russell King
- * Copyright (C) 2012 ARM Ltd.
- */
 
-#include <linux/export.h>
 #include <linux/mm.h>
-#include <linux/vmalloc.h>
 #include <linux/io.h>
 
-#include <asm/fixmap.h>
-#include <asm/tlbflush.h>
-
-static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size,
-				      pgprot_t prot, void *caller)
+bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot)
 {
-	unsigned long last_addr;
-	unsigned long offset = phys_addr & ~PAGE_MASK;
-	int err;
-	unsigned long addr;
-	struct vm_struct *area;
+	unsigned long last_addr = phys_addr + size - 1;
 
-	/*
-	 * Page align the mapping address and size, taking account of any
-	 * offset.
-	 */
-	phys_addr &= PAGE_MASK;
-	size = PAGE_ALIGN(size + offset);
+	/* Don't allow outside PHYS_MASK */
+	if (last_addr & ~PHYS_MASK)
+		return false;
 
-	/*
-	 * Don't allow wraparound, zero size or outside PHYS_MASK.
-	 */
-	last_addr = phys_addr + size - 1;
-	if (!size || last_addr < phys_addr || (last_addr & ~PHYS_MASK))
-		return NULL;
-
-	/*
-	 * Don't allow RAM to be mapped.
-	 */
+	/* Don't allow RAM to be mapped. */
 	if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr))))
-		return NULL;
-
-	area = get_vm_area_caller(size, VM_IOREMAP, caller);
-	if (!area)
-		return NULL;
-	addr = (unsigned long)area->addr;
-	area->phys_addr = phys_addr;
-
-	err = ioremap_page_range(addr, addr + size, phys_addr, prot);
-	if (err) {
-		vunmap((void *)addr);
-		return NULL;
-	}
-
-	return (void __iomem *)(offset + addr);
-}
-
-void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot)
-{
-	return __ioremap_caller(phys_addr, size, prot,
-				__builtin_return_address(0));
-}
-EXPORT_SYMBOL(__ioremap);
-
-void iounmap(volatile void __iomem *io_addr)
-{
-	unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
-
-	/*
-	 * We could get an address outside vmalloc range in case
-	 * of ioremap_cache() reusing a RAM mapping.
-	 */
-	if (is_vmalloc_addr((void *)addr))
-		vunmap((void *)addr);
-}
-EXPORT_SYMBOL(iounmap);
-
-void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
-{
-	/* For normal memory we already have a cacheable mapping. */
-	if (pfn_is_map_memory(__phys_to_pfn(phys_addr)))
-		return (void __iomem *)__phys_to_virt(phys_addr);
+		return false;
 
-	return __ioremap_caller(phys_addr, size, __pgprot(PROT_NORMAL),
-				__builtin_return_address(0));
+	return true;
 }
-EXPORT_SYMBOL(ioremap_cache);
 
 /*
  * Must be called after early_fixmap_init
-- 
2.35.3


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

* [PATCH v5 5/6] arm64: mm: Convert to GENERIC_IOREMAP
@ 2022-06-07 12:50   ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

Add hook for arm64's special operation when ioremap(), then
ioremap_wc/np/cache is converted to use ioremap_prot() from
GENERIC_IOREMAP, update the Copyright and kill the unused
inclusions.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/Kconfig          |  1 +
 arch/arm64/include/asm/io.h | 24 +++++++---
 arch/arm64/kernel/acpi.c    |  2 +-
 arch/arm64/mm/ioremap.c     | 90 ++++---------------------------------
 4 files changed, 28 insertions(+), 89 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1652a9800ebe..ac160aa26126 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -126,6 +126,7 @@ config ARM64
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_IDLE_POLL_SETUP
+	select GENERIC_IOREMAP
 	select GENERIC_IRQ_IPI
 	select GENERIC_IRQ_PROBE
 	select GENERIC_IRQ_SHOW
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 3995652daf81..87dd42d74afe 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -163,13 +163,16 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
 /*
  * I/O memory mapping functions.
  */
-extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot);
-extern void iounmap(volatile void __iomem *addr);
-extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
 
-#define ioremap(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
-#define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
-#define ioremap_np(addr, size)		__ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRnE))
+bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot);
+#define ioremap_allowed ioremap_allowed
+
+#define _PAGE_IOREMAP PROT_DEVICE_nGnRE
+
+#define ioremap_wc(addr, size)	\
+	ioremap_prot((addr), (size), PROT_NORMAL_NC)
+#define ioremap_np(addr, size)	\
+	ioremap_prot((addr), (size), PROT_DEVICE_nGnRnE)
 
 /*
  * io{read,write}{16,32,64}be() macros
@@ -184,6 +187,15 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
 
 #include <asm-generic/io.h>
 
+#define ioremap_cache ioremap_cache
+static inline void __iomem *ioremap_cache(phys_addr_t addr, size_t size)
+{
+	if (pfn_is_map_memory(__phys_to_pfn(addr)))
+		return (void __iomem *)__phys_to_virt(addr);
+
+	return ioremap_prot(addr, size, PROT_NORMAL);
+}
+
 /*
  * More restrictive address range checking than the default implementation
  * (PHYS_OFFSET and PHYS_MASK taken into account).
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index e4dea8db6924..a5a256e3f9fe 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -351,7 +351,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
 				prot = __acpi_get_writethrough_mem_attribute();
 		}
 	}
-	return __ioremap(phys, size, prot);
+	return ioremap_prot(phys, size, pgprot_val(prot));
 }
 
 /*
diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c
index b21f91cd830d..c5af103d4ad4 100644
--- a/arch/arm64/mm/ioremap.c
+++ b/arch/arm64/mm/ioremap.c
@@ -1,96 +1,22 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/*
- * Based on arch/arm/mm/ioremap.c
- *
- * (C) Copyright 1995 1996 Linus Torvalds
- * Hacked for ARM by Phil Blundell <philb@gnu.org>
- * Hacked to allow all architectures to build, and various cleanups
- * by Russell King
- * Copyright (C) 2012 ARM Ltd.
- */
 
-#include <linux/export.h>
 #include <linux/mm.h>
-#include <linux/vmalloc.h>
 #include <linux/io.h>
 
-#include <asm/fixmap.h>
-#include <asm/tlbflush.h>
-
-static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size,
-				      pgprot_t prot, void *caller)
+bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot)
 {
-	unsigned long last_addr;
-	unsigned long offset = phys_addr & ~PAGE_MASK;
-	int err;
-	unsigned long addr;
-	struct vm_struct *area;
+	unsigned long last_addr = phys_addr + size - 1;
 
-	/*
-	 * Page align the mapping address and size, taking account of any
-	 * offset.
-	 */
-	phys_addr &= PAGE_MASK;
-	size = PAGE_ALIGN(size + offset);
+	/* Don't allow outside PHYS_MASK */
+	if (last_addr & ~PHYS_MASK)
+		return false;
 
-	/*
-	 * Don't allow wraparound, zero size or outside PHYS_MASK.
-	 */
-	last_addr = phys_addr + size - 1;
-	if (!size || last_addr < phys_addr || (last_addr & ~PHYS_MASK))
-		return NULL;
-
-	/*
-	 * Don't allow RAM to be mapped.
-	 */
+	/* Don't allow RAM to be mapped. */
 	if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr))))
-		return NULL;
-
-	area = get_vm_area_caller(size, VM_IOREMAP, caller);
-	if (!area)
-		return NULL;
-	addr = (unsigned long)area->addr;
-	area->phys_addr = phys_addr;
-
-	err = ioremap_page_range(addr, addr + size, phys_addr, prot);
-	if (err) {
-		vunmap((void *)addr);
-		return NULL;
-	}
-
-	return (void __iomem *)(offset + addr);
-}
-
-void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot)
-{
-	return __ioremap_caller(phys_addr, size, prot,
-				__builtin_return_address(0));
-}
-EXPORT_SYMBOL(__ioremap);
-
-void iounmap(volatile void __iomem *io_addr)
-{
-	unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
-
-	/*
-	 * We could get an address outside vmalloc range in case
-	 * of ioremap_cache() reusing a RAM mapping.
-	 */
-	if (is_vmalloc_addr((void *)addr))
-		vunmap((void *)addr);
-}
-EXPORT_SYMBOL(iounmap);
-
-void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size)
-{
-	/* For normal memory we already have a cacheable mapping. */
-	if (pfn_is_map_memory(__phys_to_pfn(phys_addr)))
-		return (void __iomem *)__phys_to_virt(phys_addr);
+		return false;
 
-	return __ioremap_caller(phys_addr, size, __pgprot(PROT_NORMAL),
-				__builtin_return_address(0));
+	return true;
 }
-EXPORT_SYMBOL(ioremap_cache);
 
 /*
  * Must be called after early_fixmap_init
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 6/6] arm64: Add HAVE_IOREMAP_PROT support
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-07 12:50   ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

With ioremap_prot() definition from generic ioremap, also move
pte_pgprot() from hugetlbpage.c into pgtable.h, then arm64 could
have HAVE_IOREMAP_PROT, which will enable generic_access_phys()
code, it is useful for debug, eg, gdb.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 .../features/vm/ioremap_prot/arch-support.txt          |  2 +-
 arch/arm64/Kconfig                                     |  1 +
 arch/arm64/include/asm/pgtable.h                       | 10 ++++++++++
 arch/arm64/mm/hugetlbpage.c                            | 10 ----------
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/Documentation/features/vm/ioremap_prot/arch-support.txt b/Documentation/features/vm/ioremap_prot/arch-support.txt
index 205a90e82050..a710bd99c32e 100644
--- a/Documentation/features/vm/ioremap_prot/arch-support.txt
+++ b/Documentation/features/vm/ioremap_prot/arch-support.txt
@@ -9,7 +9,7 @@
     |       alpha: | TODO |
     |         arc: |  ok  |
     |         arm: | TODO |
-    |       arm64: | TODO |
+    |       arm64: |  ok  |
     |        csky: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index ac160aa26126..1267f325d32b 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -189,6 +189,7 @@ config ARM64
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS
+	select HAVE_IOREMAP_PROT
 	select HAVE_IRQ_TIME_ACCOUNTING
 	select HAVE_KVM
 	select HAVE_NMI
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 0b6632f18364..5a2eb6232e69 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -427,6 +427,16 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte)
 	return clear_pte_bit(pte, __pgprot(PTE_SWP_EXCLUSIVE));
 }
 
+/*
+ * Select all bits except the pfn
+ */
+static inline pgprot_t pte_pgprot(pte_t pte)
+{
+	unsigned long pfn = pte_pfn(pte);
+
+	return __pgprot(pte_val(pfn_pte(pfn, __pgprot(0))) ^ pte_val(pte));
+}
+
 #ifdef CONFIG_NUMA_BALANCING
 /*
  * See the comment in include/linux/pgtable.h
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index e2a5ec9fdc0d..8eab05367549 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -100,16 +100,6 @@ int pud_huge(pud_t pud)
 #endif
 }
 
-/*
- * Select all bits except the pfn
- */
-static inline pgprot_t pte_pgprot(pte_t pte)
-{
-	unsigned long pfn = pte_pfn(pte);
-
-	return __pgprot(pte_val(pfn_pte(pfn, __pgprot(0))) ^ pte_val(pte));
-}
-
 static int find_num_contig(struct mm_struct *mm, unsigned long addr,
 			   pte_t *ptep, size_t *pgsize)
 {
-- 
2.35.3


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

* [PATCH v5 6/6] arm64: Add HAVE_IOREMAP_PROT support
@ 2022-06-07 12:50   ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-07 12:50 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang

With ioremap_prot() definition from generic ioremap, also move
pte_pgprot() from hugetlbpage.c into pgtable.h, then arm64 could
have HAVE_IOREMAP_PROT, which will enable generic_access_phys()
code, it is useful for debug, eg, gdb.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 .../features/vm/ioremap_prot/arch-support.txt          |  2 +-
 arch/arm64/Kconfig                                     |  1 +
 arch/arm64/include/asm/pgtable.h                       | 10 ++++++++++
 arch/arm64/mm/hugetlbpage.c                            | 10 ----------
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/Documentation/features/vm/ioremap_prot/arch-support.txt b/Documentation/features/vm/ioremap_prot/arch-support.txt
index 205a90e82050..a710bd99c32e 100644
--- a/Documentation/features/vm/ioremap_prot/arch-support.txt
+++ b/Documentation/features/vm/ioremap_prot/arch-support.txt
@@ -9,7 +9,7 @@
     |       alpha: | TODO |
     |         arc: |  ok  |
     |         arm: | TODO |
-    |       arm64: | TODO |
+    |       arm64: |  ok  |
     |        csky: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index ac160aa26126..1267f325d32b 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -189,6 +189,7 @@ config ARM64
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS
+	select HAVE_IOREMAP_PROT
 	select HAVE_IRQ_TIME_ACCOUNTING
 	select HAVE_KVM
 	select HAVE_NMI
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 0b6632f18364..5a2eb6232e69 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -427,6 +427,16 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte)
 	return clear_pte_bit(pte, __pgprot(PTE_SWP_EXCLUSIVE));
 }
 
+/*
+ * Select all bits except the pfn
+ */
+static inline pgprot_t pte_pgprot(pte_t pte)
+{
+	unsigned long pfn = pte_pfn(pte);
+
+	return __pgprot(pte_val(pfn_pte(pfn, __pgprot(0))) ^ pte_val(pte));
+}
+
 #ifdef CONFIG_NUMA_BALANCING
 /*
  * See the comment in include/linux/pgtable.h
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index e2a5ec9fdc0d..8eab05367549 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -100,16 +100,6 @@ int pud_huge(pud_t pud)
 #endif
 }
 
-/*
- * Select all bits except the pfn
- */
-static inline pgprot_t pte_pgprot(pte_t pte)
-{
-	unsigned long pfn = pte_pfn(pte);
-
-	return __pgprot(pte_val(pfn_pte(pfn, __pgprot(0))) ^ pte_val(pte));
-}
-
 static int find_num_contig(struct mm_struct *mm, unsigned long addr,
 			   pte_t *ptep, size_t *pgsize)
 {
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-07 15:40     ` Russell King (Oracle)
  -1 siblings, 0 replies; 45+ messages in thread
From: Russell King (Oracle) @ 2022-06-07 15:40 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual, Christoph Hellwig

On Tue, Jun 07, 2022 at 08:50:22PM +0800, Kefeng Wang wrote:
> Since the following commits,
> 
> v5.4
>   commit 59d3ae9a5bf6 ("ARM: remove Intel iop33x and iop13xx support")
> v5.11
>   commit 3e3f354bc383 ("ARM: remove ebsa110 platform")
> 
> The runtime hook arch_iounmap() on ARM is useless, kill arch_iounmap()
> and __iounmap().
> 
> Cc: Russell King <linux@armlinux.org.uk>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
@ 2022-06-07 15:40     ` Russell King (Oracle)
  0 siblings, 0 replies; 45+ messages in thread
From: Russell King (Oracle) @ 2022-06-07 15:40 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual, Christoph Hellwig

On Tue, Jun 07, 2022 at 08:50:22PM +0800, Kefeng Wang wrote:
> Since the following commits,
> 
> v5.4
>   commit 59d3ae9a5bf6 ("ARM: remove Intel iop33x and iop13xx support")
> v5.11
>   commit 3e3f354bc383 ("ARM: remove ebsa110 platform")
> 
> The runtime hook arch_iounmap() on ARM is useless, kill arch_iounmap()
> and __iounmap().
> 
> Cc: Russell King <linux@armlinux.org.uk>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-08  4:16     ` Baoquan He
  -1 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  4:16 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> Use more meaningful and sensibly naming phys_addr
> instead addr in ioremap_prot().
> 
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/asm-generic/io.h |  3 ++-
>  mm/ioremap.c             | 14 ++++++++------
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 7ce93aaf69f8..b76379628a02 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
>  #elif defined(CONFIG_GENERIC_IOREMAP)
>  #include <linux/pgtable.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot);
>  void iounmap(volatile void __iomem *addr);
>  
>  static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
> diff --git a/mm/ioremap.c b/mm/ioremap.c
> index 5fe598ecd9b7..2d754b48d230 100644
> --- a/mm/ioremap.c
> +++ b/mm/ioremap.c
> @@ -11,20 +11,21 @@
>  #include <linux/io.h>
>  #include <linux/export.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot)
>  {
>  	unsigned long offset, vaddr;
>  	phys_addr_t last_addr;
>  	struct vm_struct *area;
>  
>  	/* Disallow wrap-around or zero size */
> -	last_addr = addr + size - 1;
> -	if (!size || last_addr < addr)
> +	last_addr = phys_addr + size - 1;
> +	if (!size || last_addr < phys_addr)
>  		return NULL;
>  
>  	/* Page-align mappings */
> -	offset = addr & (~PAGE_MASK);
> -	addr -= offset;
> +	offset = phys_addr & (~PAGE_MASK);
                 ~~~ use offset_in_page() instead?

Other than this nitpick, this looks good to me.

Reviewed-by: Baoquan He <bhe@redhat.com>

> +	phys_addr -= offset;
>  	size = PAGE_ALIGN(size + offset);
>  
>  	area = get_vm_area_caller(size, VM_IOREMAP,
> @@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
>  		return NULL;
>  	vaddr = (unsigned long)area->addr;
>  
> -	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
> +	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
> +			       __pgprot(prot))) {
>  		free_vm_area(area);
>  		return NULL;
>  	}
> -- 
> 2.35.3
> 
> 


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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
@ 2022-06-08  4:16     ` Baoquan He
  0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  4:16 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> Use more meaningful and sensibly naming phys_addr
> instead addr in ioremap_prot().
> 
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/asm-generic/io.h |  3 ++-
>  mm/ioremap.c             | 14 ++++++++------
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 7ce93aaf69f8..b76379628a02 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
>  #elif defined(CONFIG_GENERIC_IOREMAP)
>  #include <linux/pgtable.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot);
>  void iounmap(volatile void __iomem *addr);
>  
>  static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
> diff --git a/mm/ioremap.c b/mm/ioremap.c
> index 5fe598ecd9b7..2d754b48d230 100644
> --- a/mm/ioremap.c
> +++ b/mm/ioremap.c
> @@ -11,20 +11,21 @@
>  #include <linux/io.h>
>  #include <linux/export.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot)
>  {
>  	unsigned long offset, vaddr;
>  	phys_addr_t last_addr;
>  	struct vm_struct *area;
>  
>  	/* Disallow wrap-around or zero size */
> -	last_addr = addr + size - 1;
> -	if (!size || last_addr < addr)
> +	last_addr = phys_addr + size - 1;
> +	if (!size || last_addr < phys_addr)
>  		return NULL;
>  
>  	/* Page-align mappings */
> -	offset = addr & (~PAGE_MASK);
> -	addr -= offset;
> +	offset = phys_addr & (~PAGE_MASK);
                 ~~~ use offset_in_page() instead?

Other than this nitpick, this looks good to me.

Reviewed-by: Baoquan He <bhe@redhat.com>

> +	phys_addr -= offset;
>  	size = PAGE_ALIGN(size + offset);
>  
>  	area = get_vm_area_caller(size, VM_IOREMAP,
> @@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
>  		return NULL;
>  	vaddr = (unsigned long)area->addr;
>  
> -	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
> +	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
> +			       __pgprot(prot))) {
>  		free_vm_area(area);
>  		return NULL;
>  	}
> -- 
> 2.35.3
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 4/6] mm: ioremap: Add ioremap/iounmap_allowed()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-08  4:18     ` Baoquan He
  -1 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  4:18 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> Add special hook for architecture to verify addr, size or prot
> when ioremap() or iounmap(), which will make the generic ioremap
> more useful.
> 
>   ioremap_allowed() return a bool,
>     - true means continue to remap
>     - false means skip remap and return directly
>   iounmap_allowed() return a bool,
>     - true means continue to vunmap
>     - false code means skip vunmap and return directly
> 
> Meanwhile, only vunmap the address when it is in vmalloc area
> as the generic ioremap only returns vmalloc addresses.

LGTM,

Reviewed-by: Baoquan He <bhe@redhat.com>

> 
> Acked-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/asm-generic/io.h | 26 ++++++++++++++++++++++++++
>  mm/ioremap.c             | 11 ++++++++++-
>  2 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index b76379628a02..db5b890eaff7 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -964,6 +964,32 @@ static inline void iounmap(volatile void __iomem *addr)
>  #elif defined(CONFIG_GENERIC_IOREMAP)
>  #include <linux/pgtable.h>
>  
> +/*
> + * Arch code can implement the following two hooks when using GENERIC_IOREMAP
> + * ioremap_allowed() return a bool,
> + *   - true means continue to remap
> + *   - false means skip remap and return directly
> + * iounmap_allowed() return a bool,
> + *   - true means continue to vunmap
> + *   - false means skip vunmap and return directly
> + */
> +#ifndef ioremap_allowed
> +#define ioremap_allowed ioremap_allowed
> +static inline bool ioremap_allowed(phys_addr_t phys_addr, size_t size,
> +				   unsigned long prot)
> +{
> +	return true;
> +}
> +#endif
> +
> +#ifndef iounmap_allowed
> +#define iounmap_allowed iounmap_allowed
> +static inline bool iounmap_allowed(void *addr)
> +{
> +	return true;
> +}
> +#endif
> +
>  void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
>  			   unsigned long prot);
>  void iounmap(volatile void __iomem *addr);
> diff --git a/mm/ioremap.c b/mm/ioremap.c
> index e1d008e8f87f..8652426282cc 100644
> --- a/mm/ioremap.c
> +++ b/mm/ioremap.c
> @@ -28,6 +28,9 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
>  	phys_addr -= offset;
>  	size = PAGE_ALIGN(size + offset);
>  
> +	if (!ioremap_allowed(phys_addr, size, prot))
> +		return NULL;
> +
>  	area = get_vm_area_caller(size, VM_IOREMAP,
>  			__builtin_return_address(0));
>  	if (!area)
> @@ -47,6 +50,12 @@ EXPORT_SYMBOL(ioremap_prot);
>  
>  void iounmap(volatile void __iomem *addr)
>  {
> -	vunmap((void *)((unsigned long)addr & PAGE_MASK));
> +	void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
> +
> +	if (!iounmap_allowed(vaddr))
> +		return;
> +
> +	if (is_vmalloc_addr(vaddr))
> +		vunmap(vaddr);
>  }
>  EXPORT_SYMBOL(iounmap);
> -- 
> 2.35.3
> 
> 


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

* Re: [PATCH v5 4/6] mm: ioremap: Add ioremap/iounmap_allowed()
@ 2022-06-08  4:18     ` Baoquan He
  0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  4:18 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> Add special hook for architecture to verify addr, size or prot
> when ioremap() or iounmap(), which will make the generic ioremap
> more useful.
> 
>   ioremap_allowed() return a bool,
>     - true means continue to remap
>     - false means skip remap and return directly
>   iounmap_allowed() return a bool,
>     - true means continue to vunmap
>     - false code means skip vunmap and return directly
> 
> Meanwhile, only vunmap the address when it is in vmalloc area
> as the generic ioremap only returns vmalloc addresses.

LGTM,

Reviewed-by: Baoquan He <bhe@redhat.com>

> 
> Acked-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/asm-generic/io.h | 26 ++++++++++++++++++++++++++
>  mm/ioremap.c             | 11 ++++++++++-
>  2 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index b76379628a02..db5b890eaff7 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -964,6 +964,32 @@ static inline void iounmap(volatile void __iomem *addr)
>  #elif defined(CONFIG_GENERIC_IOREMAP)
>  #include <linux/pgtable.h>
>  
> +/*
> + * Arch code can implement the following two hooks when using GENERIC_IOREMAP
> + * ioremap_allowed() return a bool,
> + *   - true means continue to remap
> + *   - false means skip remap and return directly
> + * iounmap_allowed() return a bool,
> + *   - true means continue to vunmap
> + *   - false means skip vunmap and return directly
> + */
> +#ifndef ioremap_allowed
> +#define ioremap_allowed ioremap_allowed
> +static inline bool ioremap_allowed(phys_addr_t phys_addr, size_t size,
> +				   unsigned long prot)
> +{
> +	return true;
> +}
> +#endif
> +
> +#ifndef iounmap_allowed
> +#define iounmap_allowed iounmap_allowed
> +static inline bool iounmap_allowed(void *addr)
> +{
> +	return true;
> +}
> +#endif
> +
>  void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
>  			   unsigned long prot);
>  void iounmap(volatile void __iomem *addr);
> diff --git a/mm/ioremap.c b/mm/ioremap.c
> index e1d008e8f87f..8652426282cc 100644
> --- a/mm/ioremap.c
> +++ b/mm/ioremap.c
> @@ -28,6 +28,9 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
>  	phys_addr -= offset;
>  	size = PAGE_ALIGN(size + offset);
>  
> +	if (!ioremap_allowed(phys_addr, size, prot))
> +		return NULL;
> +
>  	area = get_vm_area_caller(size, VM_IOREMAP,
>  			__builtin_return_address(0));
>  	if (!area)
> @@ -47,6 +50,12 @@ EXPORT_SYMBOL(ioremap_prot);
>  
>  void iounmap(volatile void __iomem *addr)
>  {
> -	vunmap((void *)((unsigned long)addr & PAGE_MASK));
> +	void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
> +
> +	if (!iounmap_allowed(vaddr))
> +		return;
> +
> +	if (is_vmalloc_addr(vaddr))
> +		vunmap(vaddr);
>  }
>  EXPORT_SYMBOL(iounmap);
> -- 
> 2.35.3
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-08  6:09     ` Christoph Hellwig
  -1 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2022-06-08  6:09 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
@ 2022-06-08  6:09     ` Christoph Hellwig
  0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2022-06-08  6:09 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 4/6] mm: ioremap: Add ioremap/iounmap_allowed()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-08  6:10     ` Christoph Hellwig
  -1 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2022-06-08  6:10 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v5 4/6] mm: ioremap: Add ioremap/iounmap_allowed()
@ 2022-06-08  6:10     ` Christoph Hellwig
  0 siblings, 0 replies; 45+ messages in thread
From: Christoph Hellwig @ 2022-06-08  6:10 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-08  7:04     ` Baoquan He
  -1 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  7:04 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> Use more meaningful and sensibly naming phys_addr
                          ~~ sensible, typo
                          and please fix the subject too.
> instead addr in ioremap_prot().
> 
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/asm-generic/io.h |  3 ++-
>  mm/ioremap.c             | 14 ++++++++------
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 7ce93aaf69f8..b76379628a02 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
>  #elif defined(CONFIG_GENERIC_IOREMAP)
>  #include <linux/pgtable.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot);
>  void iounmap(volatile void __iomem *addr);
>  
>  static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
> diff --git a/mm/ioremap.c b/mm/ioremap.c
> index 5fe598ecd9b7..2d754b48d230 100644
> --- a/mm/ioremap.c
> +++ b/mm/ioremap.c
> @@ -11,20 +11,21 @@
>  #include <linux/io.h>
>  #include <linux/export.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot)
>  {
>  	unsigned long offset, vaddr;
>  	phys_addr_t last_addr;
>  	struct vm_struct *area;
>  
>  	/* Disallow wrap-around or zero size */
> -	last_addr = addr + size - 1;
> -	if (!size || last_addr < addr)
> +	last_addr = phys_addr + size - 1;
> +	if (!size || last_addr < phys_addr)
>  		return NULL;
>  
>  	/* Page-align mappings */
> -	offset = addr & (~PAGE_MASK);
> -	addr -= offset;
> +	offset = phys_addr & (~PAGE_MASK);
> +	phys_addr -= offset;
>  	size = PAGE_ALIGN(size + offset);
>  
>  	area = get_vm_area_caller(size, VM_IOREMAP,
> @@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
>  		return NULL;
>  	vaddr = (unsigned long)area->addr;
>  
> -	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
> +	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
> +			       __pgprot(prot))) {
>  		free_vm_area(area);
>  		return NULL;
>  	}
> -- 
> 2.35.3
> 
> 


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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
@ 2022-06-08  7:04     ` Baoquan He
  0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  7:04 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> Use more meaningful and sensibly naming phys_addr
                          ~~ sensible, typo
                          and please fix the subject too.
> instead addr in ioremap_prot().
> 
> Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/asm-generic/io.h |  3 ++-
>  mm/ioremap.c             | 14 ++++++++------
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 7ce93aaf69f8..b76379628a02 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
>  #elif defined(CONFIG_GENERIC_IOREMAP)
>  #include <linux/pgtable.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot);
>  void iounmap(volatile void __iomem *addr);
>  
>  static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
> diff --git a/mm/ioremap.c b/mm/ioremap.c
> index 5fe598ecd9b7..2d754b48d230 100644
> --- a/mm/ioremap.c
> +++ b/mm/ioremap.c
> @@ -11,20 +11,21 @@
>  #include <linux/io.h>
>  #include <linux/export.h>
>  
> -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> +			   unsigned long prot)
>  {
>  	unsigned long offset, vaddr;
>  	phys_addr_t last_addr;
>  	struct vm_struct *area;
>  
>  	/* Disallow wrap-around or zero size */
> -	last_addr = addr + size - 1;
> -	if (!size || last_addr < addr)
> +	last_addr = phys_addr + size - 1;
> +	if (!size || last_addr < phys_addr)
>  		return NULL;
>  
>  	/* Page-align mappings */
> -	offset = addr & (~PAGE_MASK);
> -	addr -= offset;
> +	offset = phys_addr & (~PAGE_MASK);
> +	phys_addr -= offset;
>  	size = PAGE_ALIGN(size + offset);
>  
>  	area = get_vm_area_caller(size, VM_IOREMAP,
> @@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
>  		return NULL;
>  	vaddr = (unsigned long)area->addr;
>  
> -	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
> +	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
> +			       __pgprot(prot))) {
>  		free_vm_area(area);
>  		return NULL;
>  	}
> -- 
> 2.35.3
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
  2022-06-08  4:16     ` Baoquan He
@ 2022-06-08  7:22       ` Baoquan He
  -1 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  7:22 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/08/22 at 12:16pm, Baoquan He wrote:
> On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> > Use more meaningful and sensibly naming phys_addr
> > instead addr in ioremap_prot().
> > 
> > Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> > ---
> >  include/asm-generic/io.h |  3 ++-
> >  mm/ioremap.c             | 14 ++++++++------
> >  2 files changed, 10 insertions(+), 7 deletions(-)
> > 
> > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> > index 7ce93aaf69f8..b76379628a02 100644
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
> >  #elif defined(CONFIG_GENERIC_IOREMAP)
> >  #include <linux/pgtable.h>
> >  
> > -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
> > +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> > +			   unsigned long prot);
> >  void iounmap(volatile void __iomem *addr);
> >  
> >  static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
> > diff --git a/mm/ioremap.c b/mm/ioremap.c
> > index 5fe598ecd9b7..2d754b48d230 100644
> > --- a/mm/ioremap.c
> > +++ b/mm/ioremap.c
> > @@ -11,20 +11,21 @@
> >  #include <linux/io.h>
> >  #include <linux/export.h>
> >  
> > -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> > +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> > +			   unsigned long prot)
> >  {
> >  	unsigned long offset, vaddr;
> >  	phys_addr_t last_addr;
> >  	struct vm_struct *area;
> >  
> >  	/* Disallow wrap-around or zero size */
> > -	last_addr = addr + size - 1;
> > -	if (!size || last_addr < addr)
> > +	last_addr = phys_addr + size - 1;
> > +	if (!size || last_addr < phys_addr)
> >  		return NULL;
> >  
> >  	/* Page-align mappings */
> > -	offset = addr & (~PAGE_MASK);
> > -	addr -= offset;
> > +	offset = phys_addr & (~PAGE_MASK);
>                  ~~~ use offset_in_page() instead?

Sorry, this patch only does s/addr/phys_addr/, please ignore this comment.

> 
> Other than this nitpick, this looks good to me.
> 
> Reviewed-by: Baoquan He <bhe@redhat.com>
> 
> > +	phys_addr -= offset;
> >  	size = PAGE_ALIGN(size + offset);
> >  
> >  	area = get_vm_area_caller(size, VM_IOREMAP,
> > @@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> >  		return NULL;
> >  	vaddr = (unsigned long)area->addr;
> >  
> > -	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
> > +	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
> > +			       __pgprot(prot))) {
> >  		free_vm_area(area);
> >  		return NULL;
> >  	}
> > -- 
> > 2.35.3
> > 
> > 
> 


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

* Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
@ 2022-06-08  7:22       ` Baoquan He
  0 siblings, 0 replies; 45+ messages in thread
From: Baoquan He @ 2022-06-08  7:22 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel,
	linux-mm, hch, arnd, anshuman.khandual

On 06/08/22 at 12:16pm, Baoquan He wrote:
> On 06/07/22 at 08:50pm, Kefeng Wang wrote:
> > Use more meaningful and sensibly naming phys_addr
> > instead addr in ioremap_prot().
> > 
> > Suggested-by: Andrew Morton <akpm@linux-foundation.org>
> > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> > ---
> >  include/asm-generic/io.h |  3 ++-
> >  mm/ioremap.c             | 14 ++++++++------
> >  2 files changed, 10 insertions(+), 7 deletions(-)
> > 
> > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> > index 7ce93aaf69f8..b76379628a02 100644
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
> >  #elif defined(CONFIG_GENERIC_IOREMAP)
> >  #include <linux/pgtable.h>
> >  
> > -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
> > +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> > +			   unsigned long prot);
> >  void iounmap(volatile void __iomem *addr);
> >  
> >  static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
> > diff --git a/mm/ioremap.c b/mm/ioremap.c
> > index 5fe598ecd9b7..2d754b48d230 100644
> > --- a/mm/ioremap.c
> > +++ b/mm/ioremap.c
> > @@ -11,20 +11,21 @@
> >  #include <linux/io.h>
> >  #include <linux/export.h>
> >  
> > -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> > +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> > +			   unsigned long prot)
> >  {
> >  	unsigned long offset, vaddr;
> >  	phys_addr_t last_addr;
> >  	struct vm_struct *area;
> >  
> >  	/* Disallow wrap-around or zero size */
> > -	last_addr = addr + size - 1;
> > -	if (!size || last_addr < addr)
> > +	last_addr = phys_addr + size - 1;
> > +	if (!size || last_addr < phys_addr)
> >  		return NULL;
> >  
> >  	/* Page-align mappings */
> > -	offset = addr & (~PAGE_MASK);
> > -	addr -= offset;
> > +	offset = phys_addr & (~PAGE_MASK);
>                  ~~~ use offset_in_page() instead?

Sorry, this patch only does s/addr/phys_addr/, please ignore this comment.

> 
> Other than this nitpick, this looks good to me.
> 
> Reviewed-by: Baoquan He <bhe@redhat.com>
> 
> > +	phys_addr -= offset;
> >  	size = PAGE_ALIGN(size + offset);
> >  
> >  	area = get_vm_area_caller(size, VM_IOREMAP,
> > @@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
> >  		return NULL;
> >  	vaddr = (unsigned long)area->addr;
> >  
> > -	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
> > +	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
> > +			       __pgprot(prot))) {
> >  		free_vm_area(area);
> >  		return NULL;
> >  	}
> > -- 
> > 2.35.3
> > 
> > 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 resend 2/6] mm: ioremap: Use more sensible name in ioremap_prot()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-10  9:22     ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-10  9:22 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, Baoquan He, Kefeng Wang, Christoph Hellwig,
	Anshuman Khandual

Use more meaningful and sensible naming phys_addr
instead of addr in ioremap_prot().

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
v5 resend:
- use sensible and add RB
 include/asm-generic/io.h |  3 ++-
 mm/ioremap.c             | 14 ++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..b76379628a02 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
 #elif defined(CONFIG_GENERIC_IOREMAP)
 #include <linux/pgtable.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot);
 void iounmap(volatile void __iomem *addr);
 
 static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 5fe598ecd9b7..2d754b48d230 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -11,20 +11,21 @@
 #include <linux/io.h>
 #include <linux/export.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot)
 {
 	unsigned long offset, vaddr;
 	phys_addr_t last_addr;
 	struct vm_struct *area;
 
 	/* Disallow wrap-around or zero size */
-	last_addr = addr + size - 1;
-	if (!size || last_addr < addr)
+	last_addr = phys_addr + size - 1;
+	if (!size || last_addr < phys_addr)
 		return NULL;
 
 	/* Page-align mappings */
-	offset = addr & (~PAGE_MASK);
-	addr -= offset;
+	offset = phys_addr & (~PAGE_MASK);
+	phys_addr -= offset;
 	size = PAGE_ALIGN(size + offset);
 
 	area = get_vm_area_caller(size, VM_IOREMAP,
@@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
 		return NULL;
 	vaddr = (unsigned long)area->addr;
 
-	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
+	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
+			       __pgprot(prot))) {
 		free_vm_area(area);
 		return NULL;
 	}
-- 
2.35.3


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

* [PATCH v5 resend 2/6] mm: ioremap: Use more sensible name in ioremap_prot()
@ 2022-06-10  9:22     ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-10  9:22 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, Baoquan He, Kefeng Wang, Christoph Hellwig,
	Anshuman Khandual

Use more meaningful and sensible naming phys_addr
instead of addr in ioremap_prot().

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
v5 resend:
- use sensible and add RB
 include/asm-generic/io.h |  3 ++-
 mm/ioremap.c             | 14 ++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..b76379628a02 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -964,7 +964,8 @@ static inline void iounmap(volatile void __iomem *addr)
 #elif defined(CONFIG_GENERIC_IOREMAP)
 #include <linux/pgtable.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot);
 void iounmap(volatile void __iomem *addr);
 
 static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
diff --git a/mm/ioremap.c b/mm/ioremap.c
index 5fe598ecd9b7..2d754b48d230 100644
--- a/mm/ioremap.c
+++ b/mm/ioremap.c
@@ -11,20 +11,21 @@
 #include <linux/io.h>
 #include <linux/export.h>
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
+void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
+			   unsigned long prot)
 {
 	unsigned long offset, vaddr;
 	phys_addr_t last_addr;
 	struct vm_struct *area;
 
 	/* Disallow wrap-around or zero size */
-	last_addr = addr + size - 1;
-	if (!size || last_addr < addr)
+	last_addr = phys_addr + size - 1;
+	if (!size || last_addr < phys_addr)
 		return NULL;
 
 	/* Page-align mappings */
-	offset = addr & (~PAGE_MASK);
-	addr -= offset;
+	offset = phys_addr & (~PAGE_MASK);
+	phys_addr -= offset;
 	size = PAGE_ALIGN(size + offset);
 
 	area = get_vm_area_caller(size, VM_IOREMAP,
@@ -33,7 +34,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot)
 		return NULL;
 	vaddr = (unsigned long)area->addr;
 
-	if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) {
+	if (ioremap_page_range(vaddr, vaddr + size, phys_addr,
+			       __pgprot(prot))) {
 		free_vm_area(area);
 		return NULL;
 	}
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-14  3:21   ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-14  3:21 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual

Hi Catalin, could you help to pick up it, thanks.

On 2022/6/7 20:50, Kefeng Wang wrote:
> 1. Enhance generic ioremap to make it more useful.
> 2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
> 3. Support HAVE_IOREMAP_PROT on arm64, which enable generic_access_phys(),
>     it is useful when debug(eg, gdb) via access_process_vm device memory
>     infrastructure.
>
> v5:
> - break long lines(> 80 cols), per Christoph Hellwig
> - move is_vmalloc_addr() check from arm64 into generic ioremap, per
>    Christoph Hellwig
> - make arm64's ioremap_cache as an inline function, per Christoph
> - keep changes simple, make ioremap/iounmap_allowed return bool, per
>    Baoquan He
> - simplify use 'void *' instead of 'void __iomem *' in iounmap, then
>    drop __force annotation
>
> v4:
> - update based on v5.19-rc1
> - add generic arch_ioremap/arch_iounmap define, per Andrew Monrton
> - simply return an int for arch_ioremap and rename arch_ioremap/arch_iounmap
>    to a better name, ioremap_allowed/iounmap_allowed, per Arnd Bergmann
> - add __force annotation to slince sparse warning in vunmap()
>
> Note,
> 1) after the renaming, the arm's change(patch1) is not the necessary
>     dependence for the following changes, but as a cleanup, still post
>     it here, hope it go in via the arm64 tree with reset of the series
>     directly if no object.
> 2) the changes in this version only influence on patch4/5, so retain
>     the ack/review.
>
> v3:
> - add cleanup patch to kill ARM's unused arch_iounmap(the naming will be
>    used in GENERIC_IOREMAP) and add comments for arch_ioremap/arch_iounmap
>    hooks, per Anshuman Khandual
> - collect ack/review
>
> v2:
> - s/addr/phys_addr in ioremap_prot, suggested by Andrew Morton
> - rename arch_ioremap/iounmap_check to arch_ioremap/iounmap
>    and change return value, per Christoph Hellwig and Andrew Morton
> - and use 'ifndef arch_ioremap' instead of weak function, per Arnd Bergmann
> - collect ack/review
>
> Kefeng Wang (6):
>    ARM: mm: kill unused runtime hook arch_iounmap()
>    mm: ioremap: Use more sensibly name in ioremap_prot()
>    mm: ioremap: Setup phys_addr of struct vm_struct
>    mm: ioremap: Add ioremap/iounmap_allowed()
>    arm64: mm: Convert to GENERIC_IOREMAP
>    arm64: Add HAVE_IOREMAP_PROT support
>
>   .../features/vm/ioremap_prot/arch-support.txt |  2 +-
>   arch/arm/include/asm/io.h                     |  4 +-
>   arch/arm/mm/ioremap.c                         |  9 +-
>   arch/arm/mm/nommu.c                           |  9 +-
>   arch/arm64/Kconfig                            |  2 +
>   arch/arm64/include/asm/io.h                   | 24 +++--
>   arch/arm64/include/asm/pgtable.h              | 10 +++
>   arch/arm64/kernel/acpi.c                      |  2 +-
>   arch/arm64/mm/hugetlbpage.c                   | 10 ---
>   arch/arm64/mm/ioremap.c                       | 90 ++-----------------
>   include/asm-generic/io.h                      | 29 +++++-
>   mm/ioremap.c                                  | 26 ++++--
>   12 files changed, 90 insertions(+), 127 deletions(-)
>

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
@ 2022-06-14  3:21   ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-14  3:21 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual

Hi Catalin, could you help to pick up it, thanks.

On 2022/6/7 20:50, Kefeng Wang wrote:
> 1. Enhance generic ioremap to make it more useful.
> 2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
> 3. Support HAVE_IOREMAP_PROT on arm64, which enable generic_access_phys(),
>     it is useful when debug(eg, gdb) via access_process_vm device memory
>     infrastructure.
>
> v5:
> - break long lines(> 80 cols), per Christoph Hellwig
> - move is_vmalloc_addr() check from arm64 into generic ioremap, per
>    Christoph Hellwig
> - make arm64's ioremap_cache as an inline function, per Christoph
> - keep changes simple, make ioremap/iounmap_allowed return bool, per
>    Baoquan He
> - simplify use 'void *' instead of 'void __iomem *' in iounmap, then
>    drop __force annotation
>
> v4:
> - update based on v5.19-rc1
> - add generic arch_ioremap/arch_iounmap define, per Andrew Monrton
> - simply return an int for arch_ioremap and rename arch_ioremap/arch_iounmap
>    to a better name, ioremap_allowed/iounmap_allowed, per Arnd Bergmann
> - add __force annotation to slince sparse warning in vunmap()
>
> Note,
> 1) after the renaming, the arm's change(patch1) is not the necessary
>     dependence for the following changes, but as a cleanup, still post
>     it here, hope it go in via the arm64 tree with reset of the series
>     directly if no object.
> 2) the changes in this version only influence on patch4/5, so retain
>     the ack/review.
>
> v3:
> - add cleanup patch to kill ARM's unused arch_iounmap(the naming will be
>    used in GENERIC_IOREMAP) and add comments for arch_ioremap/arch_iounmap
>    hooks, per Anshuman Khandual
> - collect ack/review
>
> v2:
> - s/addr/phys_addr in ioremap_prot, suggested by Andrew Morton
> - rename arch_ioremap/iounmap_check to arch_ioremap/iounmap
>    and change return value, per Christoph Hellwig and Andrew Morton
> - and use 'ifndef arch_ioremap' instead of weak function, per Arnd Bergmann
> - collect ack/review
>
> Kefeng Wang (6):
>    ARM: mm: kill unused runtime hook arch_iounmap()
>    mm: ioremap: Use more sensibly name in ioremap_prot()
>    mm: ioremap: Setup phys_addr of struct vm_struct
>    mm: ioremap: Add ioremap/iounmap_allowed()
>    arm64: mm: Convert to GENERIC_IOREMAP
>    arm64: Add HAVE_IOREMAP_PROT support
>
>   .../features/vm/ioremap_prot/arch-support.txt |  2 +-
>   arch/arm/include/asm/io.h                     |  4 +-
>   arch/arm/mm/ioremap.c                         |  9 +-
>   arch/arm/mm/nommu.c                           |  9 +-
>   arch/arm64/Kconfig                            |  2 +
>   arch/arm64/include/asm/io.h                   | 24 +++--
>   arch/arm64/include/asm/pgtable.h              | 10 +++
>   arch/arm64/kernel/acpi.c                      |  2 +-
>   arch/arm64/mm/hugetlbpage.c                   | 10 ---
>   arch/arm64/mm/ioremap.c                       | 90 ++-----------------
>   include/asm-generic/io.h                      | 29 +++++-
>   mm/ioremap.c                                  | 26 ++++--
>   12 files changed, 90 insertions(+), 127 deletions(-)
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
  2022-06-07 12:50   ` Kefeng Wang
@ 2022-06-14  5:47     ` kernel test robot
  -1 siblings, 0 replies; 45+ messages in thread
From: kernel test robot @ 2022-06-14  5:47 UTC (permalink / raw)
  To: Kefeng Wang, catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: kbuild-all, linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang,
	Russell King, Christoph Hellwig

Hi Kefeng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.19-rc2 next-20220610]
[cannot apply to arm64/for-next/core arnd-asm-generic/master akpm-mm/mm-everything]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e71e60cd74df9386c3f684c54888f2367050b831
config: arm-randconfig-s031-20220613 (https://download.01.org/0day-ci/archive/20220614/202206141355.p1aTShLo-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-30-g92122700-dirty
        # https://github.com/intel-lab-lkp/linux/commit/5a6f8121572d1f82b599d118e9070ef4ba16183b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
        git checkout 5a6f8121572d1f82b599d118e9070ef4ba16183b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash fs/pstore/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   fs/pstore/ram_core.c:278:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *to @@     got unsigned char * @@
   fs/pstore/ram_core.c:278:9: sparse:     expected void volatile [noderef] __iomem *to
   fs/pstore/ram_core.c:278:9: sparse:     got unsigned char *
   fs/pstore/ram_core.c:311:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
   fs/pstore/ram_core.c:311:9: sparse:     expected void const volatile [noderef] __iomem *from
   fs/pstore/ram_core.c:311:9: sparse:     got unsigned char *
   fs/pstore/ram_core.c:312:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
   fs/pstore/ram_core.c:312:9: sparse:     expected void const volatile [noderef] __iomem *from
   fs/pstore/ram_core.c:312:9: sparse:     got unsigned char *
   fs/pstore/ram_core.c:466:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
   fs/pstore/ram_core.c:466:20: sparse:     expected void *va
   fs/pstore/ram_core.c:466:20: sparse:     got void [noderef] __iomem *
   fs/pstore/ram_core.c:468:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
   fs/pstore/ram_core.c:468:20: sparse:     expected void *va
   fs/pstore/ram_core.c:468:20: sparse:     got void [noderef] __iomem *
>> fs/pstore/ram_core.c:556:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *vaddr @@
   fs/pstore/ram_core.c:556:36: sparse:     expected void volatile [noderef] __iomem *io_addr
   fs/pstore/ram_core.c:556:36: sparse:     got void *vaddr
   fs/pstore/ram_core.c:69:17: sparse: sparse: context imbalance in 'buffer_start_add' - unexpected unlock
   fs/pstore/ram_core.c:95:17: sparse: sparse: context imbalance in 'buffer_size_add' - unexpected unlock

vim +556 fs/pstore/ram_core.c

bb4206f2042d95 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  545  
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  546  void persistent_ram_free(struct persistent_ram_zone *prz)
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  547  {
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  548  	if (!prz)
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  549  		return;
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  550  
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  551  	if (prz->vaddr) {
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  552  		if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  553  			/* We must vunmap() at page-granularity. */
831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  554  			vunmap(prz->vaddr - offset_in_page(prz->paddr));
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  555  		} else {
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 @556  			iounmap(prz->vaddr);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  557  			release_mem_region(prz->paddr, prz->size);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  558  		}
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  559  		prz->vaddr = NULL;
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  560  	}
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  561  	if (prz->rs_decoder) {
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  562  		free_rs(prz->rs_decoder);
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  563  		prz->rs_decoder = NULL;
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  564  	}
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  565  	kfree(prz->ecc_info.par);
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  566  	prz->ecc_info.par = NULL;
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  567  
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  568  	persistent_ram_free_old(prz);
1227daa43bce13 fs/pstore/ram_core.c                     Kees Cook       2018-10-17  569  	kfree(prz->label);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  570  	kfree(prz);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  571  }
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  572  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
@ 2022-06-14  5:47     ` kernel test robot
  0 siblings, 0 replies; 45+ messages in thread
From: kernel test robot @ 2022-06-14  5:47 UTC (permalink / raw)
  To: Kefeng Wang, catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: kbuild-all, linux-mm, hch, arnd, anshuman.khandual, Kefeng Wang,
	Russell King, Christoph Hellwig

Hi Kefeng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.19-rc2 next-20220610]
[cannot apply to arm64/for-next/core arnd-asm-generic/master akpm-mm/mm-everything]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e71e60cd74df9386c3f684c54888f2367050b831
config: arm-randconfig-s031-20220613 (https://download.01.org/0day-ci/archive/20220614/202206141355.p1aTShLo-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-30-g92122700-dirty
        # https://github.com/intel-lab-lkp/linux/commit/5a6f8121572d1f82b599d118e9070ef4ba16183b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
        git checkout 5a6f8121572d1f82b599d118e9070ef4ba16183b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash fs/pstore/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   fs/pstore/ram_core.c:278:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *to @@     got unsigned char * @@
   fs/pstore/ram_core.c:278:9: sparse:     expected void volatile [noderef] __iomem *to
   fs/pstore/ram_core.c:278:9: sparse:     got unsigned char *
   fs/pstore/ram_core.c:311:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
   fs/pstore/ram_core.c:311:9: sparse:     expected void const volatile [noderef] __iomem *from
   fs/pstore/ram_core.c:311:9: sparse:     got unsigned char *
   fs/pstore/ram_core.c:312:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
   fs/pstore/ram_core.c:312:9: sparse:     expected void const volatile [noderef] __iomem *from
   fs/pstore/ram_core.c:312:9: sparse:     got unsigned char *
   fs/pstore/ram_core.c:466:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
   fs/pstore/ram_core.c:466:20: sparse:     expected void *va
   fs/pstore/ram_core.c:466:20: sparse:     got void [noderef] __iomem *
   fs/pstore/ram_core.c:468:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
   fs/pstore/ram_core.c:468:20: sparse:     expected void *va
   fs/pstore/ram_core.c:468:20: sparse:     got void [noderef] __iomem *
>> fs/pstore/ram_core.c:556:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *vaddr @@
   fs/pstore/ram_core.c:556:36: sparse:     expected void volatile [noderef] __iomem *io_addr
   fs/pstore/ram_core.c:556:36: sparse:     got void *vaddr
   fs/pstore/ram_core.c:69:17: sparse: sparse: context imbalance in 'buffer_start_add' - unexpected unlock
   fs/pstore/ram_core.c:95:17: sparse: sparse: context imbalance in 'buffer_size_add' - unexpected unlock

vim +556 fs/pstore/ram_core.c

bb4206f2042d95 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  545  
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  546  void persistent_ram_free(struct persistent_ram_zone *prz)
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  547  {
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  548  	if (!prz)
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  549  		return;
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  550  
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  551  	if (prz->vaddr) {
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  552  		if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  553  			/* We must vunmap() at page-granularity. */
831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  554  			vunmap(prz->vaddr - offset_in_page(prz->paddr));
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  555  		} else {
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 @556  			iounmap(prz->vaddr);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  557  			release_mem_region(prz->paddr, prz->size);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  558  		}
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  559  		prz->vaddr = NULL;
beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  560  	}
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  561  	if (prz->rs_decoder) {
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  562  		free_rs(prz->rs_decoder);
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  563  		prz->rs_decoder = NULL;
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  564  	}
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  565  	kfree(prz->ecc_info.par);
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  566  	prz->ecc_info.par = NULL;
f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  567  
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  568  	persistent_ram_free_old(prz);
1227daa43bce13 fs/pstore/ram_core.c                     Kees Cook       2018-10-17  569  	kfree(prz->label);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  570  	kfree(prz);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  571  }
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  572  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
  2022-06-14  5:47     ` kernel test robot
  (?)
@ 2022-06-14  6:12       ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-14  6:12 UTC (permalink / raw)
  To: kernel test robot, catalin.marinas, will, akpm, linux-arm-kernel,
	linux-kernel
  Cc: kbuild-all, linux-mm, hch, arnd, anshuman.khandual, Russell King,
	Christoph Hellwig


On 2022/6/14 13:47, kernel test robot wrote:
> Hi Kefeng,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.19-rc2 next-20220610]
> [cannot apply to arm64/for-next/core arnd-asm-generic/master akpm-mm/mm-everything]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e71e60cd74df9386c3f684c54888f2367050b831
> config: arm-randconfig-s031-20220613 (https://download.01.org/0day-ci/archive/20220614/202206141355.p1aTShLo-lkp@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
> reproduce:
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # apt-get install sparse
>          # sparse version: v0.6.4-30-g92122700-dirty
>          # https://github.com/intel-lab-lkp/linux/commit/5a6f8121572d1f82b599d118e9070ef4ba16183b
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
>          git checkout 5a6f8121572d1f82b599d118e9070ef4ba16183b
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash fs/pstore/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
>     fs/pstore/ram_core.c:278:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *to @@     got unsigned char * @@
>     fs/pstore/ram_core.c:278:9: sparse:     expected void volatile [noderef] __iomem *to
>     fs/pstore/ram_core.c:278:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:311:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
>     fs/pstore/ram_core.c:311:9: sparse:     expected void const volatile [noderef] __iomem *from
>     fs/pstore/ram_core.c:311:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:312:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
>     fs/pstore/ram_core.c:312:9: sparse:     expected void const volatile [noderef] __iomem *from
>     fs/pstore/ram_core.c:312:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:466:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
>     fs/pstore/ram_core.c:466:20: sparse:     expected void *va
>     fs/pstore/ram_core.c:466:20: sparse:     got void [noderef] __iomem *
>     fs/pstore/ram_core.c:468:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
>     fs/pstore/ram_core.c:468:20: sparse:     expected void *va
>     fs/pstore/ram_core.c:468:20: sparse:     got void [noderef] __iomem *
>>> fs/pstore/ram_core.c:556:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *vaddr @@
>     fs/pstore/ram_core.c:556:36: sparse:     expected void volatile [noderef] __iomem *io_addr
>     fs/pstore/ram_core.c:556:36: sparse:     got void *vaddr
>     fs/pstore/ram_core.c:69:17: sparse: sparse: context imbalance in 'buffer_start_add' - unexpected unlock
>     fs/pstore/ram_core.c:95:17: sparse: sparse: context imbalance in 'buffer_size_add' - unexpected unlock
>
> vim +556 fs/pstore/ram_core.c
>
> bb4206f2042d95 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  545
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  546  void persistent_ram_free(struct persistent_ram_zone *prz)
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  547  {
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  548  	if (!prz)
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  549  		return;
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  550
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  551  	if (prz->vaddr) {
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  552  		if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
> 831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  553  			/* We must vunmap() at page-granularity. */
> 831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  554  			vunmap(prz->vaddr - offset_in_page(prz->paddr));
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  555  		} else {
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 @556  			iounmap(prz->vaddr);

The pstore should be fixed, not this patch,

     iounmap((void __iomem *)prz->vaddr);


> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  557  			release_mem_region(prz->paddr, prz->size);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  558  		}
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  559  		prz->vaddr = NULL;
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  560  	}
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  561  	if (prz->rs_decoder) {
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  562  		free_rs(prz->rs_decoder);
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  563  		prz->rs_decoder = NULL;
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  564  	}
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  565  	kfree(prz->ecc_info.par);
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  566  	prz->ecc_info.par = NULL;
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  567
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  568  	persistent_ram_free_old(prz);
> 1227daa43bce13 fs/pstore/ram_core.c                     Kees Cook       2018-10-17  569  	kfree(prz->label);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  570  	kfree(prz);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  571  }
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  572
>

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

* Re: [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
@ 2022-06-14  6:12       ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-14  6:12 UTC (permalink / raw)
  To: kernel test robot, catalin.marinas, will, akpm, linux-arm-kernel,
	linux-kernel
  Cc: kbuild-all, linux-mm, hch, arnd, anshuman.khandual, Russell King,
	Christoph Hellwig


On 2022/6/14 13:47, kernel test robot wrote:
> Hi Kefeng,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.19-rc2 next-20220610]
> [cannot apply to arm64/for-next/core arnd-asm-generic/master akpm-mm/mm-everything]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e71e60cd74df9386c3f684c54888f2367050b831
> config: arm-randconfig-s031-20220613 (https://download.01.org/0day-ci/archive/20220614/202206141355.p1aTShLo-lkp@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
> reproduce:
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # apt-get install sparse
>          # sparse version: v0.6.4-30-g92122700-dirty
>          # https://github.com/intel-lab-lkp/linux/commit/5a6f8121572d1f82b599d118e9070ef4ba16183b
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
>          git checkout 5a6f8121572d1f82b599d118e9070ef4ba16183b
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash fs/pstore/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
>     fs/pstore/ram_core.c:278:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *to @@     got unsigned char * @@
>     fs/pstore/ram_core.c:278:9: sparse:     expected void volatile [noderef] __iomem *to
>     fs/pstore/ram_core.c:278:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:311:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
>     fs/pstore/ram_core.c:311:9: sparse:     expected void const volatile [noderef] __iomem *from
>     fs/pstore/ram_core.c:311:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:312:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
>     fs/pstore/ram_core.c:312:9: sparse:     expected void const volatile [noderef] __iomem *from
>     fs/pstore/ram_core.c:312:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:466:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
>     fs/pstore/ram_core.c:466:20: sparse:     expected void *va
>     fs/pstore/ram_core.c:466:20: sparse:     got void [noderef] __iomem *
>     fs/pstore/ram_core.c:468:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
>     fs/pstore/ram_core.c:468:20: sparse:     expected void *va
>     fs/pstore/ram_core.c:468:20: sparse:     got void [noderef] __iomem *
>>> fs/pstore/ram_core.c:556:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *vaddr @@
>     fs/pstore/ram_core.c:556:36: sparse:     expected void volatile [noderef] __iomem *io_addr
>     fs/pstore/ram_core.c:556:36: sparse:     got void *vaddr
>     fs/pstore/ram_core.c:69:17: sparse: sparse: context imbalance in 'buffer_start_add' - unexpected unlock
>     fs/pstore/ram_core.c:95:17: sparse: sparse: context imbalance in 'buffer_size_add' - unexpected unlock
>
> vim +556 fs/pstore/ram_core.c
>
> bb4206f2042d95 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  545
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  546  void persistent_ram_free(struct persistent_ram_zone *prz)
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  547  {
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  548  	if (!prz)
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  549  		return;
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  550
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  551  	if (prz->vaddr) {
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  552  		if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
> 831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  553  			/* We must vunmap() at page-granularity. */
> 831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  554  			vunmap(prz->vaddr - offset_in_page(prz->paddr));
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  555  		} else {
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 @556  			iounmap(prz->vaddr);

The pstore should be fixed, not this patch,

     iounmap((void __iomem *)prz->vaddr);


> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  557  			release_mem_region(prz->paddr, prz->size);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  558  		}
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  559  		prz->vaddr = NULL;
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  560  	}
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  561  	if (prz->rs_decoder) {
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  562  		free_rs(prz->rs_decoder);
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  563  		prz->rs_decoder = NULL;
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  564  	}
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  565  	kfree(prz->ecc_info.par);
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  566  	prz->ecc_info.par = NULL;
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  567
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  568  	persistent_ram_free_old(prz);
> 1227daa43bce13 fs/pstore/ram_core.c                     Kees Cook       2018-10-17  569  	kfree(prz->label);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  570  	kfree(prz);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  571  }
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  572
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap()
@ 2022-06-14  6:12       ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-14  6:12 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7550 bytes --]


On 2022/6/14 13:47, kernel test robot wrote:
> Hi Kefeng,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.19-rc2 next-20220610]
> [cannot apply to arm64/for-next/core arnd-asm-generic/master akpm-mm/mm-everything]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e71e60cd74df9386c3f684c54888f2367050b831
> config: arm-randconfig-s031-20220613 (https://download.01.org/0day-ci/archive/20220614/202206141355.p1aTShLo-lkp(a)intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
> reproduce:
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # apt-get install sparse
>          # sparse version: v0.6.4-30-g92122700-dirty
>          # https://github.com/intel-lab-lkp/linux/commit/5a6f8121572d1f82b599d118e9070ef4ba16183b
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Kefeng-Wang/arm64-Cleanup-ioremap-and-support-ioremap_prot/20220607-204345
>          git checkout 5a6f8121572d1f82b599d118e9070ef4ba16183b
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash fs/pstore/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
>     fs/pstore/ram_core.c:278:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *to @@     got unsigned char * @@
>     fs/pstore/ram_core.c:278:9: sparse:     expected void volatile [noderef] __iomem *to
>     fs/pstore/ram_core.c:278:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:311:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
>     fs/pstore/ram_core.c:311:9: sparse:     expected void const volatile [noderef] __iomem *from
>     fs/pstore/ram_core.c:311:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:312:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got unsigned char * @@
>     fs/pstore/ram_core.c:312:9: sparse:     expected void const volatile [noderef] __iomem *from
>     fs/pstore/ram_core.c:312:9: sparse:     got unsigned char *
>     fs/pstore/ram_core.c:466:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
>     fs/pstore/ram_core.c:466:20: sparse:     expected void *va
>     fs/pstore/ram_core.c:466:20: sparse:     got void [noderef] __iomem *
>     fs/pstore/ram_core.c:468:20: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
>     fs/pstore/ram_core.c:468:20: sparse:     expected void *va
>     fs/pstore/ram_core.c:468:20: sparse:     got void [noderef] __iomem *
>>> fs/pstore/ram_core.c:556:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *vaddr @@
>     fs/pstore/ram_core.c:556:36: sparse:     expected void volatile [noderef] __iomem *io_addr
>     fs/pstore/ram_core.c:556:36: sparse:     got void *vaddr
>     fs/pstore/ram_core.c:69:17: sparse: sparse: context imbalance in 'buffer_start_add' - unexpected unlock
>     fs/pstore/ram_core.c:95:17: sparse: sparse: context imbalance in 'buffer_size_add' - unexpected unlock
>
> vim +556 fs/pstore/ram_core.c
>
> bb4206f2042d95 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  545
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  546  void persistent_ram_free(struct persistent_ram_zone *prz)
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  547  {
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  548  	if (!prz)
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  549  		return;
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  550
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  551  	if (prz->vaddr) {
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  552  		if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
> 831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  553  			/* We must vunmap() at page-granularity. */
> 831b624df1b420 fs/pstore/ram_core.c                     Bin Yang        2018-09-12  554  			vunmap(prz->vaddr - offset_in_page(prz->paddr));
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  555  		} else {
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 @556  			iounmap(prz->vaddr);

The pstore should be fixed, not this patch,

     iounmap((void __iomem *)prz->vaddr);


> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  557  			release_mem_region(prz->paddr, prz->size);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  558  		}
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  559  		prz->vaddr = NULL;
> beeb94321a7a6d fs/pstore/ram_core.c                     Anton Vorontsov 2012-06-18  560  	}
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  561  	if (prz->rs_decoder) {
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  562  		free_rs(prz->rs_decoder);
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  563  		prz->rs_decoder = NULL;
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  564  	}
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  565  	kfree(prz->ecc_info.par);
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  566  	prz->ecc_info.par = NULL;
> f2531f1976d98a fs/pstore/ram_core.c                     Kees Cook       2018-03-07  567
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  568  	persistent_ram_free_old(prz);
> 1227daa43bce13 fs/pstore/ram_core.c                     Kees Cook       2018-10-17  569  	kfree(prz->label);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  570  	kfree(prz);
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  571  }
> d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11  572
>

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
  2022-06-14  3:21   ` Kefeng Wang
@ 2022-06-27 11:06     ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-27 11:06 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual


On 2022/6/14 11:21, Kefeng Wang wrote:
> Hi Catalin, could you help to pick up it, thanks.
Kindly ping...
>
> On 2022/6/7 20:50, Kefeng Wang wrote:
>> 1. Enhance generic ioremap to make it more useful.
>> 2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
>> 3. Support HAVE_IOREMAP_PROT on arm64, which enable 
>> generic_access_phys(),
>>     it is useful when debug(eg, gdb) via access_process_vm device memory
>>     infrastructure.

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
@ 2022-06-27 11:06     ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-27 11:06 UTC (permalink / raw)
  To: catalin.marinas, will, akpm, linux-arm-kernel, linux-kernel
  Cc: linux-mm, hch, arnd, anshuman.khandual


On 2022/6/14 11:21, Kefeng Wang wrote:
> Hi Catalin, could you help to pick up it, thanks.
Kindly ping...
>
> On 2022/6/7 20:50, Kefeng Wang wrote:
>> 1. Enhance generic ioremap to make it more useful.
>> 2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
>> 3. Support HAVE_IOREMAP_PROT on arm64, which enable 
>> generic_access_phys(),
>>     it is useful when debug(eg, gdb) via access_process_vm device memory
>>     infrastructure.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
  2022-06-27 11:06     ` Kefeng Wang
@ 2022-06-27 11:14       ` Will Deacon
  -1 siblings, 0 replies; 45+ messages in thread
From: Will Deacon @ 2022-06-27 11:14 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, akpm, linux-arm-kernel, linux-kernel, linux-mm,
	hch, arnd, anshuman.khandual

On Mon, Jun 27, 2022 at 07:06:41PM +0800, Kefeng Wang wrote:
> 
> On 2022/6/14 11:21, Kefeng Wang wrote:
> > Hi Catalin, could you help to pick up it, thanks.
> Kindly ping...

Sorry, this is on my plate for 5.20. I'll try to get to it today.

Will

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
@ 2022-06-27 11:14       ` Will Deacon
  0 siblings, 0 replies; 45+ messages in thread
From: Will Deacon @ 2022-06-27 11:14 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: catalin.marinas, akpm, linux-arm-kernel, linux-kernel, linux-mm,
	hch, arnd, anshuman.khandual

On Mon, Jun 27, 2022 at 07:06:41PM +0800, Kefeng Wang wrote:
> 
> On 2022/6/14 11:21, Kefeng Wang wrote:
> > Hi Catalin, could you help to pick up it, thanks.
> Kindly ping...

Sorry, this is on my plate for 5.20. I'll try to get to it today.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
  2022-06-27 11:14       ` Will Deacon
@ 2022-06-27 11:19         ` Kefeng Wang
  -1 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-27 11:19 UTC (permalink / raw)
  To: Will Deacon
  Cc: catalin.marinas, akpm, linux-arm-kernel, linux-kernel, linux-mm,
	hch, arnd, anshuman.khandual


On 2022/6/27 19:14, Will Deacon wrote:
> On Mon, Jun 27, 2022 at 07:06:41PM +0800, Kefeng Wang wrote:
>> On 2022/6/14 11:21, Kefeng Wang wrote:
>>> Hi Catalin, could you help to pick up it, thanks.
>> Kindly ping...
> Sorry, this is on my plate for 5.20. I'll try to get to it today.
Good to know it, thank you.
>
> Will
> .

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
@ 2022-06-27 11:19         ` Kefeng Wang
  0 siblings, 0 replies; 45+ messages in thread
From: Kefeng Wang @ 2022-06-27 11:19 UTC (permalink / raw)
  To: Will Deacon
  Cc: catalin.marinas, akpm, linux-arm-kernel, linux-kernel, linux-mm,
	hch, arnd, anshuman.khandual


On 2022/6/27 19:14, Will Deacon wrote:
> On Mon, Jun 27, 2022 at 07:06:41PM +0800, Kefeng Wang wrote:
>> On 2022/6/14 11:21, Kefeng Wang wrote:
>>> Hi Catalin, could you help to pick up it, thanks.
>> Kindly ping...
> Sorry, this is on my plate for 5.20. I'll try to get to it today.
Good to know it, thank you.
>
> Will
> .

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
  2022-06-07 12:50 ` Kefeng Wang
@ 2022-06-27 13:00   ` Will Deacon
  -1 siblings, 0 replies; 45+ messages in thread
From: Will Deacon @ 2022-06-27 13:00 UTC (permalink / raw)
  To: Kefeng Wang, linux-kernel, linux-arm-kernel, akpm, catalin.marinas
  Cc: kernel-team, Will Deacon, hch, arnd, linux-mm, anshuman.khandual

On Tue, 7 Jun 2022 20:50:21 +0800, Kefeng Wang wrote:
> 1. Enhance generic ioremap to make it more useful.
> 2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
> 3. Support HAVE_IOREMAP_PROT on arm64, which enable generic_access_phys(),
>    it is useful when debug(eg, gdb) via access_process_vm device memory
>    infrastructure.
> 
> v5:
> - break long lines(> 80 cols), per Christoph Hellwig
> - move is_vmalloc_addr() check from arm64 into generic ioremap, per
>   Christoph Hellwig
> - make arm64's ioremap_cache as an inline function, per Christoph
> - keep changes simple, make ioremap/iounmap_allowed return bool, per
>   Baoquan He
> - simplify use 'void *' instead of 'void __iomem *' in iounmap, then
>   drop __force annotation
> 
> [...]

Applied to arm64 (for-next/ioremap), thanks!

[1/6] ARM: mm: kill unused runtime hook arch_iounmap()
      https://git.kernel.org/arm64/c/d803336abdbc
[2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
      https://git.kernel.org/arm64/c/abc5992b9dd0
[3/6] mm: ioremap: Setup phys_addr of struct vm_struct
      https://git.kernel.org/arm64/c/a14fff1c0379
[4/6] mm: ioremap: Add ioremap/iounmap_allowed()
      https://git.kernel.org/arm64/c/18e780b4e6ab
[5/6] arm64: mm: Convert to GENERIC_IOREMAP
      https://git.kernel.org/arm64/c/f23eab0bfaef
[6/6] arm64: Add HAVE_IOREMAP_PROT support
      https://git.kernel.org/arm64/c/893dea9ccd08

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

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

* Re: [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot()
@ 2022-06-27 13:00   ` Will Deacon
  0 siblings, 0 replies; 45+ messages in thread
From: Will Deacon @ 2022-06-27 13:00 UTC (permalink / raw)
  To: Kefeng Wang, linux-kernel, linux-arm-kernel, akpm, catalin.marinas
  Cc: kernel-team, Will Deacon, hch, arnd, linux-mm, anshuman.khandual

On Tue, 7 Jun 2022 20:50:21 +0800, Kefeng Wang wrote:
> 1. Enhance generic ioremap to make it more useful.
> 2. Let's arm64 use GENERIC_IOREMAP to cleanup code.
> 3. Support HAVE_IOREMAP_PROT on arm64, which enable generic_access_phys(),
>    it is useful when debug(eg, gdb) via access_process_vm device memory
>    infrastructure.
> 
> v5:
> - break long lines(> 80 cols), per Christoph Hellwig
> - move is_vmalloc_addr() check from arm64 into generic ioremap, per
>   Christoph Hellwig
> - make arm64's ioremap_cache as an inline function, per Christoph
> - keep changes simple, make ioremap/iounmap_allowed return bool, per
>   Baoquan He
> - simplify use 'void *' instead of 'void __iomem *' in iounmap, then
>   drop __force annotation
> 
> [...]

Applied to arm64 (for-next/ioremap), thanks!

[1/6] ARM: mm: kill unused runtime hook arch_iounmap()
      https://git.kernel.org/arm64/c/d803336abdbc
[2/6] mm: ioremap: Use more sensibly name in ioremap_prot()
      https://git.kernel.org/arm64/c/abc5992b9dd0
[3/6] mm: ioremap: Setup phys_addr of struct vm_struct
      https://git.kernel.org/arm64/c/a14fff1c0379
[4/6] mm: ioremap: Add ioremap/iounmap_allowed()
      https://git.kernel.org/arm64/c/18e780b4e6ab
[5/6] arm64: mm: Convert to GENERIC_IOREMAP
      https://git.kernel.org/arm64/c/f23eab0bfaef
[6/6] arm64: Add HAVE_IOREMAP_PROT support
      https://git.kernel.org/arm64/c/893dea9ccd08

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-06-27 13:02 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 12:50 [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot() Kefeng Wang
2022-06-07 12:50 ` Kefeng Wang
2022-06-07 12:50 ` [PATCH v5 1/6] ARM: mm: kill unused runtime hook arch_iounmap() Kefeng Wang
2022-06-07 12:50   ` Kefeng Wang
2022-06-07 15:40   ` Russell King (Oracle)
2022-06-07 15:40     ` Russell King (Oracle)
2022-06-14  5:47   ` kernel test robot
2022-06-14  5:47     ` kernel test robot
2022-06-14  6:12     ` Kefeng Wang
2022-06-14  6:12       ` Kefeng Wang
2022-06-14  6:12       ` Kefeng Wang
2022-06-07 12:50 ` [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot() Kefeng Wang
2022-06-07 12:50   ` Kefeng Wang
2022-06-08  4:16   ` Baoquan He
2022-06-08  4:16     ` Baoquan He
2022-06-08  7:22     ` Baoquan He
2022-06-08  7:22       ` Baoquan He
2022-06-08  6:09   ` Christoph Hellwig
2022-06-08  6:09     ` Christoph Hellwig
2022-06-08  7:04   ` Baoquan He
2022-06-08  7:04     ` Baoquan He
2022-06-10  9:22   ` [PATCH v5 resend 2/6] mm: ioremap: Use more sensible " Kefeng Wang
2022-06-10  9:22     ` Kefeng Wang
2022-06-07 12:50 ` [PATCH v5 3/6] mm: ioremap: Setup phys_addr of struct vm_struct Kefeng Wang
2022-06-07 12:50   ` Kefeng Wang
2022-06-07 12:50 ` [PATCH v5 4/6] mm: ioremap: Add ioremap/iounmap_allowed() Kefeng Wang
2022-06-07 12:50   ` Kefeng Wang
2022-06-08  4:18   ` Baoquan He
2022-06-08  4:18     ` Baoquan He
2022-06-08  6:10   ` Christoph Hellwig
2022-06-08  6:10     ` Christoph Hellwig
2022-06-07 12:50 ` [PATCH v5 5/6] arm64: mm: Convert to GENERIC_IOREMAP Kefeng Wang
2022-06-07 12:50   ` Kefeng Wang
2022-06-07 12:50 ` [PATCH v5 6/6] arm64: Add HAVE_IOREMAP_PROT support Kefeng Wang
2022-06-07 12:50   ` Kefeng Wang
2022-06-14  3:21 ` [PATCH v5 0/6] arm64: Cleanup ioremap() and support ioremap_prot() Kefeng Wang
2022-06-14  3:21   ` Kefeng Wang
2022-06-27 11:06   ` Kefeng Wang
2022-06-27 11:06     ` Kefeng Wang
2022-06-27 11:14     ` Will Deacon
2022-06-27 11:14       ` Will Deacon
2022-06-27 11:19       ` Kefeng Wang
2022-06-27 11:19         ` Kefeng Wang
2022-06-27 13:00 ` Will Deacon
2022-06-27 13:00   ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.