Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
On 2023/11/20 14:40, Arnd Bergmann wrote: On Mon, Nov 20, 2023, at 01:39, Kefeng Wang wrote: On 2023/11/20 3:34, Geert Uytterhoeven wrote: On Sat, Nov 18, 2023 at 11:09 AM Kefeng Wang wrote: -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) -#define unxlate_dev_mem_ptr(p, v) do { } while (0) - void __ioread64_copy(void *to, const void __iomem *from, size_t count); Missing #include , according to the build bot report. Will check the bot report. I had planned to pick up the series from https://lore.kernel.org/lkml/20230921110424.215592-3-...@redhat.com/ Good to see it. for v6.7 but didn't make it in the end. I'll try to do it now for v6.8 and apply your v1 patch with the Acks on top. Thanks. Arnd
Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
On Mon, Nov 20, 2023, at 01:39, Kefeng Wang wrote: > On 2023/11/20 3:34, Geert Uytterhoeven wrote: >> On Sat, Nov 18, 2023 at 11:09 AM Kefeng Wang >> wrote: >>> >>> -/* >>> - * Convert a physical pointer to a virtual kernel pointer for /dev/mem >>> - * access >>> - */ >>> -#define xlate_dev_mem_ptr(p) __va(p) >>> -#define unxlate_dev_mem_ptr(p, v) do { } while (0) >>> - >>> void __ioread64_copy(void *to, const void __iomem *from, size_t count); >> >> Missing #include , according to the build bot report. > > Will check the bot report. I had planned to pick up the series from https://lore.kernel.org/lkml/20230921110424.215592-3-...@redhat.com/ for v6.7 but didn't make it in the end. I'll try to do it now for v6.8 and apply your v1 patch with the Acks on top. Arnd
Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
On 2023/11/20 3:34, Geert Uytterhoeven wrote: On Sat, Nov 18, 2023 at 11:09 AM Kefeng Wang wrote: The asm-generic/io.h already has default definition, remove unnecessary arch's defination. Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Russell King Cc: Brian Cain Cc: "James E.J. Bottomley" Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Yoshinori Sato Cc: Rich Felker Cc: "David S. Miller" Cc: Stanislav Kinsburskii Signed-off-by: Kefeng Wang arch/m68k/include/asm/io_mm.h | 6 -- Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven arch/sh/include/asm/io.h | 7 --- Reviewed-by: Geert Uytterhoeven Thanks, --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -548,13 +548,6 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size); #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v)) #define csr_in32(a)(*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST)) -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) -#define unxlate_dev_mem_ptr(p, v) do { } while (0) - void __ioread64_copy(void *to, const void __iomem *from, size_t count); Missing #include , according to the build bot report. Will check the bot report. #endif /* _ASM_IO_H */ Gr{oetje,eeting}s, Geert
Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
On Sat, Nov 18, 2023 at 11:09 AM Kefeng Wang wrote: > The asm-generic/io.h already has default definition, remove unnecessary > arch's defination. > > Cc: Richard Henderson > Cc: Ivan Kokshaysky > Cc: Russell King > Cc: Brian Cain > Cc: "James E.J. Bottomley" > Cc: Nicholas Piggin > Cc: Christophe Leroy > Cc: Yoshinori Sato > Cc: Rich Felker > Cc: "David S. Miller" > Cc: Stanislav Kinsburskii > Signed-off-by: Kefeng Wang > arch/m68k/include/asm/io_mm.h | 6 -- Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven > arch/sh/include/asm/io.h | 7 --- Reviewed-by: Geert Uytterhoeven > --- a/arch/mips/include/asm/io.h > +++ b/arch/mips/include/asm/io.h > @@ -548,13 +548,6 @@ extern void (*_dma_cache_inv)(unsigned long start, > unsigned long size); > #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + > __CSR_32_ADJUST) = (v)) > #define csr_in32(a)(*(volatile u32 *)((unsigned long)(a) + > __CSR_32_ADJUST)) > > -/* > - * Convert a physical pointer to a virtual kernel pointer for /dev/mem > - * access > - */ > -#define xlate_dev_mem_ptr(p) __va(p) > -#define unxlate_dev_mem_ptr(p, v) do { } while (0) > - > void __ioread64_copy(void *to, const void __iomem *from, size_t count); Missing #include , according to the build bot report. > #endif /* _ASM_IO_H */ Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
Hi Kefeng, kernel test robot noticed the following build errors: [auto build test ERROR on soc/for-next] [also build test ERROR on geert-m68k/for-next geert-m68k/for-linus deller-parisc/for-next powerpc/next powerpc/fixes linus/master v6.7-rc1 next-20231117] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/asm-io-remove-unnecessary-xlate_dev_mem_ptr-and-unxlate_dev_mem_ptr/20231118-183038 base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next patch link: https://lore.kernel.org/r/20231118100827.1599422-1-wangkefeng.wang%40huawei.com patch subject: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr() config: mips-mtx1_defconfig (https://download.01.org/0day-ci/archive/20231119/202311191145.pppexjs6-...@intel.com/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311191145.pppexjs6-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202311191145.pppexjs6-...@intel.com/ All errors (new ones prefixed by >>): >> drivers/char/mem.c:159:10: error: call to undeclared function >> 'xlate_dev_mem_ptr'; ISO C99 and later do not support implicit function >> declarations [-Wimplicit-function-declaration] ptr = xlate_dev_mem_ptr(p); ^ >> drivers/char/mem.c:159:8: error: incompatible integer to pointer conversion >> assigning to 'void *' from 'int' [-Wint-conversion] ptr = xlate_dev_mem_ptr(p); ^ >> drivers/char/mem.c:164:4: error: call to undeclared function >> 'unxlate_dev_mem_ptr'; ISO C99 and later do not support implicit function >> declarations [-Wimplicit-function-declaration] unxlate_dev_mem_ptr(p, ptr); ^ drivers/char/mem.c:235:10: error: call to undeclared function 'xlate_dev_mem_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] ptr = xlate_dev_mem_ptr(p); ^ drivers/char/mem.c:235:8: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion] ptr = xlate_dev_mem_ptr(p); ^ drivers/char/mem.c:243:4: error: call to undeclared function 'unxlate_dev_mem_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] unxlate_dev_mem_ptr(p, ptr); ^ 6 errors generated. vim +/xlate_dev_mem_ptr +159 drivers/char/mem.c ^1da177e4c3f41 Linus Torvalds2005-04-16 133 22ec1a2aea73b9 Kees Cook 2017-12-01 134bounce = kmalloc(PAGE_SIZE, GFP_KERNEL); 22ec1a2aea73b9 Kees Cook 2017-12-01 135if (!bounce) 22ec1a2aea73b9 Kees Cook 2017-12-01 136return -ENOMEM; 22ec1a2aea73b9 Kees Cook 2017-12-01 137 ^1da177e4c3f41 Linus Torvalds2005-04-16 138while (count > 0) { fa29e97bb8c70f Wu Fengguang 2009-12-14 139 unsigned long remaining; b5b38200ebe548 Kees Cook 2018-03-27 140int allowed, probe; fa29e97bb8c70f Wu Fengguang 2009-12-14 141 f222318e9c3a31 Wu Fengguang 2009-12-14 142sz = size_inside_page(p, count); ^1da177e4c3f41 Linus Torvalds2005-04-16 143 22ec1a2aea73b9 Kees Cook 2017-12-01 144err = -EPERM; a4866aa812518e Kees Cook 2017-04-05 145allowed = page_is_allowed(p >> PAGE_SHIFT); a4866aa812518e Kees Cook 2017-04-05 146if (!allowed) 22ec1a2aea73b9 Kees Cook 2017-12-01 147 goto failed; 22ec1a2aea73b9 Kees Cook 2017-12-01 148 22ec1a2aea73b9 Kees Cook 2017-12-01 149err = -EFAULT; a4866aa812518e Kees Cook 2017-04-05 150if (allowed == 2) { a4866aa812518e Kees Cook 2017-04-05 151 /* Show zeros for restricted memory. */ a4866aa812518e Kees Cook 201
Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
Hi Kefeng, kernel test robot noticed the following build errors: [auto build test ERROR on soc/for-next] [also build test ERROR on geert-m68k/for-next geert-m68k/for-linus deller-parisc/for-next powerpc/next powerpc/fixes linus/master v6.7-rc1 next-20231117] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/asm-io-remove-unnecessary-xlate_dev_mem_ptr-and-unxlate_dev_mem_ptr/20231118-183038 base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next patch link: https://lore.kernel.org/r/20231118100827.1599422-1-wangkefeng.wang%40huawei.com patch subject: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr() config: mips-db1xxx_defconfig (https://download.01.org/0day-ci/archive/20231119/202311190352.yqcpbjin-...@intel.com/config) compiler: mipsel-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311190352.yqcpbjin-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202311190352.yqcpbjin-...@intel.com/ All error/warnings (new ones prefixed by >>): drivers/char/mem.c: In function 'read_mem': >> drivers/char/mem.c:159:31: error: implicit declaration of function >> 'xlate_dev_mem_ptr' [-Werror=implicit-function-declaration] 159 | ptr = xlate_dev_mem_ptr(p); | ^ >> drivers/char/mem.c:159:29: warning: assignment to 'void *' from 'int' makes >> pointer from integer without a cast [-Wint-conversion] 159 | ptr = xlate_dev_mem_ptr(p); | ^ >> drivers/char/mem.c:164:25: error: implicit declaration of function >> 'unxlate_dev_mem_ptr' [-Werror=implicit-function-declaration] 164 | unxlate_dev_mem_ptr(p, ptr); | ^~~ drivers/char/mem.c: In function 'write_mem': drivers/char/mem.c:235:29: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 235 | ptr = xlate_dev_mem_ptr(p); | ^ cc1: some warnings being treated as errors vim +/xlate_dev_mem_ptr +159 drivers/char/mem.c ^1da177e4c3f41 Linus Torvalds2005-04-16 133 22ec1a2aea73b9 Kees Cook 2017-12-01 134bounce = kmalloc(PAGE_SIZE, GFP_KERNEL); 22ec1a2aea73b9 Kees Cook 2017-12-01 135if (!bounce) 22ec1a2aea73b9 Kees Cook 2017-12-01 136return -ENOMEM; 22ec1a2aea73b9 Kees Cook 2017-12-01 137 ^1da177e4c3f41 Linus Torvalds2005-04-16 138while (count > 0) { fa29e97bb8c70f Wu Fengguang 2009-12-14 139 unsigned long remaining; b5b38200ebe548 Kees Cook 2018-03-27 140int allowed, probe; fa29e97bb8c70f Wu Fengguang 2009-12-14 141 f222318e9c3a31 Wu Fengguang 2009-12-14 142sz = size_inside_page(p, count); ^1da177e4c3f41 Linus Torvalds2005-04-16 143 22ec1a2aea73b9 Kees Cook 2017-12-01 144err = -EPERM; a4866aa812518e Kees Cook 2017-04-05 145allowed = page_is_allowed(p >> PAGE_SHIFT); a4866aa812518e Kees Cook 2017-04-05 146if (!allowed) 22ec1a2aea73b9 Kees Cook 2017-12-01 147 goto failed; 22ec1a2aea73b9 Kees Cook 2017-12-01 148 22ec1a2aea73b9 Kees Cook 2017-12-01 149err = -EFAULT; a4866aa812518e Kees Cook 2017-04-05 150if (allowed == 2) { a4866aa812518e Kees Cook 2017-04-05 151 /* Show zeros for restricted memory. */ a4866aa812518e Kees Cook 2017-04-05 152 remaining = clear_user(buf, sz); a4866aa812518e Kees Cook 2017-04-05 153} else { ^1da177e4c3f41 Linus Torvalds2005-04-16 154 /* a4866aa812518e Kees Cook 2017-04-05 155 * On ia64 if a page has been mapped somewhere as a4866aa812518e Kees Cook 2017-04-05 156 * uncached, then it must also be accessed uncached a4866aa812518e Kees Cook 2017-04-05 157
[PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
The asm-generic/io.h already has default definition, remove unnecessary arch's defination. Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Russell King Cc: Brian Cain Cc: "James E.J. Bottomley" Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Yoshinori Sato Cc: Rich Felker Cc: "David S. Miller" Cc: Stanislav Kinsburskii Signed-off-by: Kefeng Wang --- arch/alpha/include/asm/io.h| 6 -- arch/arm/include/asm/io.h | 6 -- arch/hexagon/include/asm/io.h | 6 -- arch/m68k/include/asm/io_mm.h | 6 -- arch/mips/include/asm/io.h | 7 --- arch/parisc/include/asm/io.h | 6 -- arch/powerpc/include/asm/io.h | 6 -- arch/sh/include/asm/io.h | 7 --- arch/sparc/include/asm/io_64.h | 6 -- 9 files changed, 56 deletions(-) diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h index 7aeaf7c30a6f..5e5d21ebc584 100644 --- a/arch/alpha/include/asm/io.h +++ b/arch/alpha/include/asm/io.h @@ -651,12 +651,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count); #endif #define RTC_ALWAYS_BCD 0 -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) - /* * These get provided from since alpha does not * select GENERIC_IOMAP. diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 56b08ed6cc3b..1815748f5d2a 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -407,12 +407,6 @@ struct pci_dev; #define pci_iounmap pci_iounmap extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) - #include #ifdef CONFIG_MMU diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h index e2b308e32a37..97d57751ce3b 100644 --- a/arch/hexagon/include/asm/io.h +++ b/arch/hexagon/include/asm/io.h @@ -58,12 +58,6 @@ static inline void *phys_to_virt(unsigned long address) return __va(address); } -/* - * convert a physical pointer to a virtual kernel pointer for - * /dev/mem access. - */ -#define xlate_dev_mem_ptr(p)__va(p) - /* * IO port access primitives. Hexagon doesn't have special IO access * instructions; all I/O is memory mapped. diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h index 47525f2a57e1..090aec54b8fa 100644 --- a/arch/m68k/include/asm/io_mm.h +++ b/arch/m68k/include/asm/io_mm.h @@ -389,12 +389,6 @@ static inline void isa_delay(void) #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) - #define readb_relaxed(addr)readb(addr) #define readw_relaxed(addr)readw(addr) #define readl_relaxed(addr)readl(addr) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 062dd4e6b954..2158ff302430 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -548,13 +548,6 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size); #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v)) #define csr_in32(a)(*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST)) -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) -#define unxlate_dev_mem_ptr(p, v) do { } while (0) - void __ioread64_copy(void *to, const void __iomem *from, size_t count); #endif /* _ASM_IO_H */ diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h index 366537042465..9c06cafb0e70 100644 --- a/arch/parisc/include/asm/io.h +++ b/arch/parisc/include/asm/io.h @@ -267,12 +267,6 @@ extern void iowrite64be(u64 val, void __iomem *addr); #define iowrite16_rep iowrite16_rep #define iowrite32_rep iowrite32_rep -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) - extern int devmem_is_allowed(unsigned long pfn); #include diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index 5220274a6277..79421c285066 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -709,12 +709,6 @@ static inline void name at \ #define memcpy_fromio memcpy_fromio #define memcpy_toio memcpy_toio -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#define xlate_dev_mem_ptr(p) __va(p) - /* * We don't do relaxed operations yet, at least not with this semantic */ diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index ac521f287fa5..be7ac06423a9 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -304,13 +304,6 @@ unsigned long long poke_real_address_q(unsigned long long addr, #define ioremap_uc