* [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP
[not found] <20220820003125.353570-1-bhe@redhat.com>
@ 2022-08-20 0:31 ` Baoquan He
2022-08-21 7:06 ` Christoph Hellwig
[not found] ` <202208201146.8VeY9pez-lkp@intel.com>
0 siblings, 2 replies; 7+ messages in thread
From: Baoquan He @ 2022-08-20 0:31 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, akpm, hch, agordeev, wangkefeng.wang, linux-arm-kernel,
Baoquan He, Yoshinori Sato, Rich Felker, linux-sh
Add hook arch_ioremap() and arch_iounmap for sh's special operation when
ioremap() and iounmap(), then ioremap_cache() is converted to use
ioremap_prot() from GENERIC_IOREMAP.
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
---
arch/sh/Kconfig | 1 +
arch/sh/include/asm/io.h | 47 +++++++++----------------------
arch/sh/mm/ioremap.c | 61 ++++++++--------------------------------
3 files changed, 26 insertions(+), 83 deletions(-)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 5f220e903e5a..b63ad4698cf8 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -25,6 +25,7 @@ config SUPERH
select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
select GUP_GET_PTE_LOW_HIGH if X2TLB
+ select GENERIC_IOREMAP if MMU
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_KGDB
select HAVE_ARCH_SECCOMP_FILTER
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index fba90e670ed4..3c5ff82a511a 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -242,45 +242,26 @@ unsigned long long poke_real_address_q(unsigned long long addr,
#define phys_to_virt(address) (__va(address))
#endif
-#ifdef CONFIG_MMU
-void iounmap(void __iomem *addr);
-void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size,
- pgprot_t prot, void *caller);
-
-static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
-{
- return __ioremap_caller(offset, size, PAGE_KERNEL_NOCACHE,
- __builtin_return_address(0));
-}
-
-static inline void __iomem *
-ioremap_cache(phys_addr_t offset, unsigned long size)
-{
- return __ioremap_caller(offset, size, PAGE_KERNEL,
- __builtin_return_address(0));
-}
-#define ioremap_cache ioremap_cache
+/*
+ * I/O memory mapping functions.
+ */
+void __iomem *
+arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val);
+#define arch_ioremap arch_ioremap
-#ifdef CONFIG_HAVE_IOREMAP_PROT
-static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
- unsigned long flags)
-{
- return __ioremap_caller(offset, size, __pgprot(flags),
- __builtin_return_address(0));
-}
-#endif /* CONFIG_HAVE_IOREMAP_PROT */
+int arch_iounmap(void __iomem *addr);
+#define arch_iounmap arch_iounmap
-#else /* CONFIG_MMU */
-static inline void __iomem *ioremap(phys_addr_t offset, size_t size)
-{
- return (void __iomem *)(unsigned long)offset;
-}
+#define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL_NOCACHE)
-static inline void iounmap(volatile void __iomem *addr) { }
-#endif /* CONFIG_MMU */
+#define ioremap_cache(addr, size) \
+ ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
+#define ioremap_cache ioremap_cache
#define ioremap_uc ioremap
+#include <asm-generic/io.h>
+
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index 21342581144d..720a9186b06b 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -72,22 +72,12 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
#define __ioremap_29bit(offset, size, prot) NULL
#endif /* CONFIG_29BIT */
-/*
- * Remap an arbitrary physical address space into the kernel virtual
- * address space. Needed when the kernel wants to access high addresses
- * directly.
- *
- * NOTE! We need to allow non-page-aligned mappings too: we will obviously
- * have to convert them into an offset in a page-aligned mapping, but the
- * caller shouldn't need to know that small detail.
- */
-void __iomem * __ref
-__ioremap_caller(phys_addr_t phys_addr, unsigned long size,
- pgprot_t pgprot, void *caller)
+void __iomem *
+arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
{
- struct vm_struct *area;
- unsigned long offset, last_addr, addr, orig_addr;
+ unsigned long last_addr, phys_addr = *paddr;
void __iomem *mapped;
+ pgprot_t pgprot = __pgprot(*prot_val);
mapped = __ioremap_trapped(phys_addr, size);
if (mapped)
@@ -100,7 +90,7 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
/* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1;
if (!size || last_addr < phys_addr)
- return NULL;
+ return IOMEM_ERR_PTR(-EINVAL);
/*
* If we can't yet use the regular approach, go the fixmap route.
@@ -116,30 +106,8 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
if (mapped && !IS_ERR(mapped))
return mapped;
- /*
- * Mappings have to be page-aligned
- */
- offset = phys_addr & ~PAGE_MASK;
- phys_addr &= PAGE_MASK;
- size = PAGE_ALIGN(last_addr+1) - phys_addr;
-
- /*
- * Ok, go for it..
- */
- area = get_vm_area_caller(size, VM_IOREMAP, caller);
- if (!area)
- return NULL;
- area->phys_addr = phys_addr;
- orig_addr = addr = (unsigned long)area->addr;
-
- if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) {
- vunmap((void *)orig_addr);
- return NULL;
- }
-
- return (void __iomem *)(offset + (char *)orig_addr);
+ return NULL;
}
-EXPORT_SYMBOL(__ioremap_caller);
/*
* Simple checks for non-translatable mappings.
@@ -158,7 +126,7 @@ static inline int iomapping_nontranslatable(unsigned long offset)
return 0;
}
-void iounmap(void __iomem *addr)
+int arch_iounmap(void __iomem *addr)
{
unsigned long vaddr = (unsigned long __force)addr;
struct vm_struct *p;
@@ -167,26 +135,19 @@ void iounmap(void __iomem *addr)
* Nothing to do if there is no translatable mapping.
*/
if (iomapping_nontranslatable(vaddr))
- return;
+ return -EINVAL;
/*
* There's no VMA if it's from an early fixed mapping.
*/
if (iounmap_fixed(addr) == 0)
- return;
+ return -EINVAL;
/*
* If the PMB handled it, there's nothing else to do.
*/
if (pmb_unmap(addr) == 0)
- return;
+ return -EINVAL;
- p = remove_vm_area((void *)(vaddr & PAGE_MASK));
- if (!p) {
- printk(KERN_ERR "%s: bad address %p\n", __func__, addr);
- return;
- }
-
- kfree(p);
+ return 0;
}
-EXPORT_SYMBOL(iounmap);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP
2022-08-20 0:31 ` [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP Baoquan He
@ 2022-08-21 7:06 ` Christoph Hellwig
2022-09-01 7:36 ` Baoquan He
[not found] ` <202208201146.8VeY9pez-lkp@intel.com>
1 sibling, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2022-08-21 7:06 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-mm, akpm, hch, agordeev, wangkefeng.wang,
linux-arm-kernel, Yoshinori Sato, Rich Felker, linux-sh
> +void __iomem *
> +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val);
> +#define arch_ioremap arch_ioremap
Shouldn't this still be under CONFIG_MMU?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP
2022-08-21 7:06 ` Christoph Hellwig
@ 2022-09-01 7:36 ` Baoquan He
0 siblings, 0 replies; 7+ messages in thread
From: Baoquan He @ 2022-09-01 7:36 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, linux-mm, akpm, agordeev, wangkefeng.wang,
linux-arm-kernel, Yoshinori Sato, Rich Felker, linux-sh
On 08/21/22 at 12:06am, Christoph Hellwig wrote:
> > +void __iomem *
> > +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val);
> > +#define arch_ioremap arch_ioremap
>
> Shouldn't this still be under CONFIG_MMU?
Yeah, you are right, will put them under CONFIG_MMU.
I thought making GENERIC_IOREMAP depend MMU in Kconfig will contain
that. But people can manually set the Kconfig item freely. Thanks for
pointing it out.
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 5f220e903e5a..b63ad4698cf8 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -25,6 +25,7 @@ config SUPERH
select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
select GUP_GET_PTE_LOW_HIGH if X2TLB
+ select GENERIC_IOREMAP if MMU
>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP
[not found] ` <202208201146.8VeY9pez-lkp@intel.com>
@ 2022-09-01 10:39 ` Baoquan He
2022-09-01 12:11 ` [kbuild-all] " Chen, Rong A
2022-09-02 9:48 ` Baoquan He
1 sibling, 1 reply; 7+ messages in thread
From: Baoquan He @ 2022-09-01 10:39 UTC (permalink / raw)
To: kernel test robot
Cc: linux-kernel, kbuild-all, linux-mm, akpm, hch, agordeev,
wangkefeng.wang, linux-arm-kernel, Yoshinori Sato, Rich Felker,
linux-sh
Hi,
On 08/20/22 at 11:41am, kernel test robot wrote:
> Hi Baoquan,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> config: sh-allmodconfig
> compiler: sh4-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/503a31451202f89e58bc5f0a49261398fafbd90e
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
> git checkout 503a31451202f89e58bc5f0a49261398fafbd90e
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare
I can only find binutils-sh-linux-gnu on fedora, but no gcc-sh-linux-gnu
for cross compiling superh kernel. So I tried above steps, but it failed
as below, any suggestion I can fix it to proceed for reproducing the
reporting issues? Thanks in advance.
[root@ampere-mtsnow-altra-09 ~]# ls
0day anaconda-ks.cfg bin config EFI_BOOT_ENTRY.TXT linux NETBOOT_METHOD.TXT original-ks.cfg RECIPE.TXT
[root@ampere-mtsnow-altra-09 ~]# ls 0day/gcc-12.1.0-nolibc/sh4-linux/bin/
sh4-linux-addr2line sh4-linux-elfedit sh4-linux-gcc-ranlib sh4-linux-ld sh4-linux-objdump sh4-linux-strip
sh4-linux-ar sh4-linux-gcc sh4-linux-gcov sh4-linux-ld.bfd sh4-linux-ranlib
sh4-linux-as sh4-linux-gcc-12.1.0 sh4-linux-gcov-dump sh4-linux-lto-dump sh4-linux-readelf
sh4-linux-c++filt sh4-linux-gcc-ar sh4-linux-gcov-tool sh4-linux-nm sh4-linux-size
sh4-linux-cpp sh4-linux-gcc-nm sh4-linux-gprof sh4-linux-objcopy sh4-linux-strings
[root@ampere-mtsnow-altra-09 ~]# ls bin
make.cross
[root@ampere-mtsnow-altra-09 ~]# cd linux/
[root@ampere-mtsnow-altra-09 linux]# ls
arch certs CREDITS drivers init Kbuild lib Makefile README security usr
block config crypto fs io_uring Kconfig LICENSES mm samples sound virt
build_dir COPYING Documentation include ipc kernel MAINTAINERS net scripts tools
[root@ampere-mtsnow-altra-09 linux]# ls build_dir/ -a
. .. arch .config .gitignore include Makefile scripts source usr
[root@ampere-mtsnow-altra-09 linux]# COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare
Compiler will be installed in /root/0day
not a dynamic executable
make --keep-going CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux- --jobs=160 W=1 O=build_dir ARCH=sh prepare
make[1]: Entering directory '/root/linux/build_dir'
/bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
/bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
/bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
SYNC include/config/auto.conf.cmd
/bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
/bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
/bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
GEN Makefile
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTLD scripts/kconfig/conf
/root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: unknown compiler
scripts/Kconfig.include:44: Sorry, this compiler is not supported.
make[3]: *** [../scripts/kconfig/Makefile:77: syncconfig] Error 1
make[2]: *** [../Makefile:632: syncconfig] Error 2
make[1]: *** [/root/linux/Makefile:734: include/config/auto.conf.cmd] Error 2
make[1]: Failed to remake makefile 'include/config/auto.conf.cmd'.
make[1]: Failed to remake makefile 'include/config/auto.conf'.
GEN Makefile
SYSHDR arch/sh/include/generated/uapi/asm/unistd_32.h
SYSTBL arch/sh/include/generated/asm/syscall_table.h
Error: kernelrelease not valid - run 'make prepare' to update it
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
LEX scripts/dtc/dtc-lexer.lex.c
YACC scripts/dtc/dtc-parser.tab.[ch]
HOSTCC scripts/dtc/libfdt/fdt_ro.o
HOSTCC scripts/dtc/libfdt/fdt.o
HOSTCC scripts/dtc/libfdt/fdt_wip.o
HOSTCC scripts/dtc/libfdt/fdt_sw.o
HOSTCC scripts/dtc/libfdt/fdt_rw.o
HOSTCC scripts/dtc/libfdt/fdt_strerror.o
HOSTCC scripts/dtc/libfdt/fdt_empty_tree.o
HOSTCC scripts/dtc/libfdt/fdt_addresses.o
HOSTCC scripts/dtc/libfdt/fdt_overlay.o
HOSTCC scripts/dtc/fdtoverlay.o
HOSTCC scripts/dtc/dtc-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/fdtoverlay
HOSTLD scripts/dtc/dtc
make[1]: Target 'prepare' not remade because of errors.
make[1]: Leaving directory '/root/linux/build_dir'
make: *** [Makefile:222: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [kbuild-all] Re: [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP
2022-09-01 10:39 ` Baoquan He
@ 2022-09-01 12:11 ` Chen, Rong A
2022-09-01 12:31 ` Baoquan He
0 siblings, 1 reply; 7+ messages in thread
From: Chen, Rong A @ 2022-09-01 12:11 UTC (permalink / raw)
To: Baoquan He, kernel test robot
Cc: linux-kernel, kbuild-all, linux-mm, akpm, hch, agordeev,
wangkefeng.wang, linux-arm-kernel, Yoshinori Sato, Rich Felker,
linux-sh
On 9/1/2022 6:39 PM, Baoquan He wrote:
> Hi,
>
> On 08/20/22 at 11:41am, kernel test robot wrote:
>> Hi Baoquan,
>>
>> I love your patch! Yet something to improve:
>>
>> [auto build test ERROR on akpm-mm/mm-everything]
>>
>> url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
>> config: sh-allmodconfig
>> compiler: sh4-linux-gcc (GCC) 12.1.0
>> reproduce (this is a W=1 build):
>> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> # https://github.com/intel-lab-lkp/linux/commit/503a31451202f89e58bc5f0a49261398fafbd90e
>> git remote add linux-review https://github.com/intel-lab-lkp/linux
>> git fetch --no-tags linux-review Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
>> git checkout 503a31451202f89e58bc5f0a49261398fafbd90e
>> # save the config file
>> mkdir build_dir && cp config build_dir/.config
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare
>
> I can only find binutils-sh-linux-gnu on fedora, but no gcc-sh-linux-gnu
> for cross compiling superh kernel. So I tried above steps, but it failed
> as below, any suggestion I can fix it to proceed for reproducing the
> reporting issues? Thanks in advance.
Hi Baoquan,
Sorry for the inconvenience, /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin
/sh4-linux-gcc is for x86_64 machine, as the name "ampere-mtsnow-altra",
is it a arm server?
the tool for arm64 can be downloaded from
https://cdn.kernel.org/pub/tools/crosstool/files/bin/arm64/12.1.0/
Best Regards,
Rong Chen
>
> [root@ampere-mtsnow-altra-09 ~]# ls
> 0day anaconda-ks.cfg bin config EFI_BOOT_ENTRY.TXT linux NETBOOT_METHOD.TXT original-ks.cfg RECIPE.TXT
> [root@ampere-mtsnow-altra-09 ~]# ls 0day/gcc-12.1.0-nolibc/sh4-linux/bin/
> sh4-linux-addr2line sh4-linux-elfedit sh4-linux-gcc-ranlib sh4-linux-ld sh4-linux-objdump sh4-linux-strip
> sh4-linux-ar sh4-linux-gcc sh4-linux-gcov sh4-linux-ld.bfd sh4-linux-ranlib
> sh4-linux-as sh4-linux-gcc-12.1.0 sh4-linux-gcov-dump sh4-linux-lto-dump sh4-linux-readelf
> sh4-linux-c++filt sh4-linux-gcc-ar sh4-linux-gcov-tool sh4-linux-nm sh4-linux-size
> sh4-linux-cpp sh4-linux-gcc-nm sh4-linux-gprof sh4-linux-objcopy sh4-linux-strings
> [root@ampere-mtsnow-altra-09 ~]# ls bin
> make.cross
> [root@ampere-mtsnow-altra-09 ~]# cd linux/
> [root@ampere-mtsnow-altra-09 linux]# ls
> arch certs CREDITS drivers init Kbuild lib Makefile README security usr
> block config crypto fs io_uring Kconfig LICENSES mm samples sound virt
> build_dir COPYING Documentation include ipc kernel MAINTAINERS net scripts tools
> [root@ampere-mtsnow-altra-09 linux]# ls build_dir/ -a
> . .. arch .config .gitignore include Makefile scripts source usr
>
> [root@ampere-mtsnow-altra-09 linux]# COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare
> Compiler will be installed in /root/0day
> not a dynamic executable
> make --keep-going CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux- --jobs=160 W=1 O=build_dir ARCH=sh prepare
> make[1]: Entering directory '/root/linux/build_dir'
> /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> SYNC include/config/auto.conf.cmd
> /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> GEN Makefile
> HOSTCC scripts/basic/fixdep
> HOSTCC scripts/kconfig/conf.o
> HOSTCC scripts/kconfig/confdata.o
> HOSTCC scripts/kconfig/expr.o
> LEX scripts/kconfig/lexer.lex.c
> YACC scripts/kconfig/parser.tab.[ch]
> HOSTCC scripts/kconfig/menu.o
> HOSTCC scripts/kconfig/preprocess.o
> HOSTCC scripts/kconfig/symbol.o
> HOSTCC scripts/kconfig/util.o
> HOSTCC scripts/kconfig/lexer.lex.o
> HOSTCC scripts/kconfig/parser.tab.o
> HOSTLD scripts/kconfig/conf
> /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: unknown compiler
> scripts/Kconfig.include:44: Sorry, this compiler is not supported.
> make[3]: *** [../scripts/kconfig/Makefile:77: syncconfig] Error 1
> make[2]: *** [../Makefile:632: syncconfig] Error 2
> make[1]: *** [/root/linux/Makefile:734: include/config/auto.conf.cmd] Error 2
> make[1]: Failed to remake makefile 'include/config/auto.conf.cmd'.
> make[1]: Failed to remake makefile 'include/config/auto.conf'.
> GEN Makefile
> SYSHDR arch/sh/include/generated/uapi/asm/unistd_32.h
> SYSTBL arch/sh/include/generated/asm/syscall_table.h
> Error: kernelrelease not valid - run 'make prepare' to update it
> HOSTCC scripts/dtc/dtc.o
> HOSTCC scripts/dtc/flattree.o
> HOSTCC scripts/dtc/fstree.o
> HOSTCC scripts/dtc/data.o
> HOSTCC scripts/dtc/livetree.o
> HOSTCC scripts/dtc/treesource.o
> HOSTCC scripts/dtc/srcpos.o
> HOSTCC scripts/dtc/checks.o
> HOSTCC scripts/dtc/util.o
> LEX scripts/dtc/dtc-lexer.lex.c
> YACC scripts/dtc/dtc-parser.tab.[ch]
> HOSTCC scripts/dtc/libfdt/fdt_ro.o
> HOSTCC scripts/dtc/libfdt/fdt.o
> HOSTCC scripts/dtc/libfdt/fdt_wip.o
> HOSTCC scripts/dtc/libfdt/fdt_sw.o
> HOSTCC scripts/dtc/libfdt/fdt_rw.o
> HOSTCC scripts/dtc/libfdt/fdt_strerror.o
> HOSTCC scripts/dtc/libfdt/fdt_empty_tree.o
> HOSTCC scripts/dtc/libfdt/fdt_addresses.o
> HOSTCC scripts/dtc/libfdt/fdt_overlay.o
> HOSTCC scripts/dtc/fdtoverlay.o
> HOSTCC scripts/dtc/dtc-lexer.lex.o
> HOSTCC scripts/dtc/dtc-parser.tab.o
> HOSTLD scripts/dtc/fdtoverlay
> HOSTLD scripts/dtc/dtc
> make[1]: Target 'prepare' not remade because of errors.
> make[1]: Leaving directory '/root/linux/build_dir'
> make: *** [Makefile:222: __sub-make] Error 2
> make: Target 'prepare' not remade because of errors.
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [kbuild-all] Re: [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP
2022-09-01 12:11 ` [kbuild-all] " Chen, Rong A
@ 2022-09-01 12:31 ` Baoquan He
0 siblings, 0 replies; 7+ messages in thread
From: Baoquan He @ 2022-09-01 12:31 UTC (permalink / raw)
To: Chen, Rong A
Cc: kernel test robot, linux-kernel, kbuild-all, linux-mm, akpm, hch,
agordeev, wangkefeng.wang, linux-arm-kernel, Yoshinori Sato,
Rich Felker, linux-sh
On 09/01/22 at 08:11pm, Chen, Rong A wrote:
>
>
> On 9/1/2022 6:39 PM, Baoquan He wrote:
> > Hi,
> >
> > On 08/20/22 at 11:41am, kernel test robot wrote:
> > > Hi Baoquan,
> > >
> > > I love your patch! Yet something to improve:
> > >
> > > [auto build test ERROR on akpm-mm/mm-everything]
> > >
> > > url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
> > > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> > > config: sh-allmodconfig
> > > compiler: sh4-linux-gcc (GCC) 12.1.0
> > > reproduce (this is a W=1 build):
> > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > chmod +x ~/bin/make.cross
> > > # https://github.com/intel-lab-lkp/linux/commit/503a31451202f89e58bc5f0a49261398fafbd90e
> > > git remote add linux-review https://github.com/intel-lab-lkp/linux
> > > git fetch --no-tags linux-review Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
> > > git checkout 503a31451202f89e58bc5f0a49261398fafbd90e
> > > # save the config file
> > > mkdir build_dir && cp config build_dir/.config
> > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare
> >
> > I can only find binutils-sh-linux-gnu on fedora, but no gcc-sh-linux-gnu
> > for cross compiling superh kernel. So I tried above steps, but it failed
> > as below, any suggestion I can fix it to proceed for reproducing the
> > reporting issues? Thanks in advance.
>
> Hi Baoquan,
>
> Sorry for the inconvenience, /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin
> /sh4-linux-gcc is for x86_64 machine, as the name "ampere-mtsnow-altra",
> is it a arm server?
Oops, I thought the cross compilig can be done on any platform. Since
I need test arm64 patch in this patchset, so didn't get x86 system to
reproduce. Didn't realize lkp has an assumption. I will get a x86 system
to test this.
Thanks for your help!
>
> the tool for arm64 can be downloaded from
> https://cdn.kernel.org/pub/tools/crosstool/files/bin/arm64/12.1.0/
>
> Best Regards,
> Rong Chen
>
> >
> > [root@ampere-mtsnow-altra-09 ~]# ls
> > 0day anaconda-ks.cfg bin config EFI_BOOT_ENTRY.TXT linux NETBOOT_METHOD.TXT original-ks.cfg RECIPE.TXT
> > [root@ampere-mtsnow-altra-09 ~]# ls 0day/gcc-12.1.0-nolibc/sh4-linux/bin/
> > sh4-linux-addr2line sh4-linux-elfedit sh4-linux-gcc-ranlib sh4-linux-ld sh4-linux-objdump sh4-linux-strip
> > sh4-linux-ar sh4-linux-gcc sh4-linux-gcov sh4-linux-ld.bfd sh4-linux-ranlib
> > sh4-linux-as sh4-linux-gcc-12.1.0 sh4-linux-gcov-dump sh4-linux-lto-dump sh4-linux-readelf
> > sh4-linux-c++filt sh4-linux-gcc-ar sh4-linux-gcov-tool sh4-linux-nm sh4-linux-size
> > sh4-linux-cpp sh4-linux-gcc-nm sh4-linux-gprof sh4-linux-objcopy sh4-linux-strings
> > [root@ampere-mtsnow-altra-09 ~]# ls bin
> > make.cross
> > [root@ampere-mtsnow-altra-09 ~]# cd linux/
> > [root@ampere-mtsnow-altra-09 linux]# ls
> > arch certs CREDITS drivers init Kbuild lib Makefile README security usr
> > block config crypto fs io_uring Kconfig LICENSES mm samples sound virt
> > build_dir COPYING Documentation include ipc kernel MAINTAINERS net scripts tools
> > [root@ampere-mtsnow-altra-09 linux]# ls build_dir/ -a
> > . .. arch .config .gitignore include Makefile scripts source usr
> >
> > [root@ampere-mtsnow-altra-09 linux]# COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare
> > Compiler will be installed in /root/0day
> > not a dynamic executable
> > make --keep-going CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux- --jobs=160 W=1 O=build_dir ARCH=sh prepare
> > make[1]: Entering directory '/root/linux/build_dir'
> > /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> > /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> > /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> > SYNC include/config/auto.conf.cmd
> > /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> > /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> > /bin/sh: line 1: /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: cannot execute binary file: Exec format error
> > GEN Makefile
> > HOSTCC scripts/basic/fixdep
> > HOSTCC scripts/kconfig/conf.o
> > HOSTCC scripts/kconfig/confdata.o
> > HOSTCC scripts/kconfig/expr.o
> > LEX scripts/kconfig/lexer.lex.c
> > YACC scripts/kconfig/parser.tab.[ch]
> > HOSTCC scripts/kconfig/menu.o
> > HOSTCC scripts/kconfig/preprocess.o
> > HOSTCC scripts/kconfig/symbol.o
> > HOSTCC scripts/kconfig/util.o
> > HOSTCC scripts/kconfig/lexer.lex.o
> > HOSTCC scripts/kconfig/parser.tab.o
> > HOSTLD scripts/kconfig/conf
> > /root/0day/gcc-12.1.0-nolibc/sh4-linux/bin/sh4-linux-gcc: unknown compiler
> > scripts/Kconfig.include:44: Sorry, this compiler is not supported.
> > make[3]: *** [../scripts/kconfig/Makefile:77: syncconfig] Error 1
> > make[2]: *** [../Makefile:632: syncconfig] Error 2
> > make[1]: *** [/root/linux/Makefile:734: include/config/auto.conf.cmd] Error 2
> > make[1]: Failed to remake makefile 'include/config/auto.conf.cmd'.
> > make[1]: Failed to remake makefile 'include/config/auto.conf'.
> > GEN Makefile
> > SYSHDR arch/sh/include/generated/uapi/asm/unistd_32.h
> > SYSTBL arch/sh/include/generated/asm/syscall_table.h
> > Error: kernelrelease not valid - run 'make prepare' to update it
> > HOSTCC scripts/dtc/dtc.o
> > HOSTCC scripts/dtc/flattree.o
> > HOSTCC scripts/dtc/fstree.o
> > HOSTCC scripts/dtc/data.o
> > HOSTCC scripts/dtc/livetree.o
> > HOSTCC scripts/dtc/treesource.o
> > HOSTCC scripts/dtc/srcpos.o
> > HOSTCC scripts/dtc/checks.o
> > HOSTCC scripts/dtc/util.o
> > LEX scripts/dtc/dtc-lexer.lex.c
> > YACC scripts/dtc/dtc-parser.tab.[ch]
> > HOSTCC scripts/dtc/libfdt/fdt_ro.o
> > HOSTCC scripts/dtc/libfdt/fdt.o
> > HOSTCC scripts/dtc/libfdt/fdt_wip.o
> > HOSTCC scripts/dtc/libfdt/fdt_sw.o
> > HOSTCC scripts/dtc/libfdt/fdt_rw.o
> > HOSTCC scripts/dtc/libfdt/fdt_strerror.o
> > HOSTCC scripts/dtc/libfdt/fdt_empty_tree.o
> > HOSTCC scripts/dtc/libfdt/fdt_addresses.o
> > HOSTCC scripts/dtc/libfdt/fdt_overlay.o
> > HOSTCC scripts/dtc/fdtoverlay.o
> > HOSTCC scripts/dtc/dtc-lexer.lex.o
> > HOSTCC scripts/dtc/dtc-parser.tab.o
> > HOSTLD scripts/dtc/fdtoverlay
> > HOSTLD scripts/dtc/dtc
> > make[1]: Target 'prepare' not remade because of errors.
> > make[1]: Leaving directory '/root/linux/build_dir'
> > make: *** [Makefile:222: __sub-make] Error 2
> > make: Target 'prepare' not remade because of errors.
> > _______________________________________________
> > kbuild-all mailing list -- kbuild-all@lists.01.org
> > To unsubscribe send an email to kbuild-all-leave@lists.01.org
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP
[not found] ` <202208201146.8VeY9pez-lkp@intel.com>
2022-09-01 10:39 ` Baoquan He
@ 2022-09-02 9:48 ` Baoquan He
1 sibling, 0 replies; 7+ messages in thread
From: Baoquan He @ 2022-09-02 9:48 UTC (permalink / raw)
To: kernel test robot
Cc: linux-kernel, kbuild-all, linux-mm, akpm, hch, agordeev,
wangkefeng.wang, linux-arm-kernel, Yoshinori Sato, Rich Felker,
linux-sh
On 08/20/22 at 11:41am, kernel test robot wrote:
> Hi Baoquan,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> config: sh-allmodconfig
> compiler: sh4-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/503a31451202f89e58bc5f0a49261398fafbd90e
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20220820-083435
> git checkout 503a31451202f89e58bc5f0a49261398fafbd90e
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare
I finally find gcc-sh-linux-gnu and its dependency on rpmfind.net, and
succeeded to reproduce the building failure.
isl-0.16.1-13
cross-gcc-common
gcc-sh-linux-gnu
Based on previous fixing patch for parisc, below draft patch can fix all
reported building issues on sh.
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 3c5ff82a511a..eb550c72922d 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -225,6 +225,9 @@ __BUILD_IOPORT_STRING(q, u64)
#define IO_SPACE_LIMIT 0xffffffff
/* We really want to try and get these to memcpy etc */
+#define memset_io memset_io
+#define memcpy_fromio memcpy_fromio
+#define memcpy_toio memcpy_toio
void memcpy_fromio(void *, const volatile void __iomem *, unsigned long);
void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
void memset_io(volatile void __iomem *, int, unsigned long);
@@ -256,18 +259,17 @@ int arch_iounmap(void __iomem *addr);
#define ioremap_cache(addr, size) \
ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
-#define ioremap_cache ioremap_cache
#define ioremap_uc ioremap
-#include <asm-generic/io.h>
-
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
#define xlate_dev_mem_ptr(p) __va(p)
+#include <asm-generic/io.h>
+
#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
int valid_phys_addr_range(phys_addr_t addr, size_t size);
int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index f7938fe0f911..5ba4116b4265 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -53,6 +53,13 @@ static inline void ioport_unmap(void __iomem *addr)
#define outw_p(x, addr) outw((x), (addr))
#define outl_p(x, addr) outl((x), (addr))
+#define insb insb
+#define insw insw
+#define insl insl
+#define outsb outsb
+#define outsw outsw
+#define outsl outsl
+
static inline void insb(unsigned long port, void *dst, unsigned long count)
{
BUG();
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index 720a9186b06b..725a1623675a 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -72,7 +72,7 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
#define __ioremap_29bit(offset, size, prot) NULL
#endif /* CONFIG_29BIT */
-void __iomem *
+void __iomem * __ref
arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
{
unsigned long last_addr, phys_addr = *paddr;
@@ -102,7 +102,8 @@ arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
* First try to remap through the PMB.
* PMB entries are all pre-faulted.
*/
- mapped = pmb_remap_caller(phys_addr, size, pgprot, caller);
+ mapped = pmb_remap_caller(phys_addr, size, pgprot,
+ __builtin_return_address(0));
if (mapped && !IS_ERR(mapped))
return mapped;
@@ -129,7 +130,6 @@ static inline int iomapping_nontranslatable(unsigned long offset)
int arch_iounmap(void __iomem *addr)
{
unsigned long vaddr = (unsigned long __force)addr;
- struct vm_struct *p;
/*
* Nothing to do if there is no translatable mapping.
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-09-02 9:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20220820003125.353570-1-bhe@redhat.com>
2022-08-20 0:31 ` [PATCH v2 10/11] sh: mm: Convert to GENERIC_IOREMAP Baoquan He
2022-08-21 7:06 ` Christoph Hellwig
2022-09-01 7:36 ` Baoquan He
[not found] ` <202208201146.8VeY9pez-lkp@intel.com>
2022-09-01 10:39 ` Baoquan He
2022-09-01 12:11 ` [kbuild-all] " Chen, Rong A
2022-09-01 12:31 ` Baoquan He
2022-09-02 9:48 ` Baoquan He
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).