Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: ioremap: allow ARCH to have its own ioremap method definition

Architectures can be converted to GENERIC_IOREMAP, to take standard
ioremap_xxx() and iounmap() way. But some ARCH-es could have specific
handling for ioremap_prot(), ioremap() and iounmap(), than standard
methods.

In oder to convert these ARCH-es to take GENERIC_IOREMAP method, allow
these architecutres to have their own ioremap_prot(), ioremap() and
iounmap() definitions.

Link: https://lkml.kernel.org/r/20230706154520.11257-6-bhe@redhat.com
Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Brian Cain <bcain@quicinc.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Chris Zankel <chris@zankel.net>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Rich Felker <dalias@libc.org>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Baoquan He and committed by
Andrew Morton
dfdc6ba9 7613366a

+7
+3
include/asm-generic/io.h
··· 1081 1081 void iounmap(volatile void __iomem *addr); 1082 1082 void generic_iounmap(volatile void __iomem *addr); 1083 1083 1084 + #ifndef ioremap 1085 + #define ioremap ioremap 1084 1086 static inline void __iomem *ioremap(phys_addr_t addr, size_t size) 1085 1087 { 1086 1088 /* _PAGE_IOREMAP needs to be supplied by the architecture */ 1087 1089 return ioremap_prot(addr, size, _PAGE_IOREMAP); 1088 1090 } 1091 + #endif 1089 1092 #endif /* !CONFIG_MMU || CONFIG_GENERIC_IOREMAP */ 1090 1093 1091 1094 #ifndef ioremap_wc
+4
mm/ioremap.c
··· 46 46 return (void __iomem *)(vaddr + offset); 47 47 } 48 48 49 + #ifndef ioremap_prot 49 50 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, 50 51 unsigned long prot) 51 52 { 52 53 return generic_ioremap_prot(phys_addr, size, __pgprot(prot)); 53 54 } 54 55 EXPORT_SYMBOL(ioremap_prot); 56 + #endif 55 57 56 58 void generic_iounmap(volatile void __iomem *addr) 57 59 { ··· 66 64 vunmap(vaddr); 67 65 } 68 66 67 + #ifndef iounmap 69 68 void iounmap(volatile void __iomem *addr) 70 69 { 71 70 generic_iounmap(addr); 72 71 } 73 72 EXPORT_SYMBOL(iounmap); 73 + #endif