linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ioremap and dma cleanups and fixes for superh
@ 2020-03-24 16:26 Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
                   ` (11 more replies)
  0 siblings, 12 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Hi Yoshinori and Rich,

can you take a look and possibly pick up the series below that untangles
and sorts out minor issues with the sh ioremap and dma code?

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

* [PATCH 01/10] sh: remove -Werror from Makefiles
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

The sh build is full of warnings when building with gcc 9.2.1.  While
fixing those would be great, at least avoid failing the build.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/kernel/Makefile | 2 --
 arch/sh/lib/Makefile    | 2 --
 arch/sh/mm/Makefile     | 2 --
 3 files changed, 6 deletions(-)

diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 59673f8a3379..ef65f0625c6c 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -47,5 +47,3 @@ obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
 obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-coherent.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
-
-ccflags-y := -Werror
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index d0abbe5e38b0..eb473d373ca4 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -30,5 +30,3 @@ memset-$(CONFIG_CPU_SH4)	:= memset-sh4.o
 lib-$(CONFIG_MMU)		+= copy_page.o __clear_user.o
 lib-$(CONFIG_MCOUNT)		+= mcount.o
 lib-y				+= $(memcpy-y) $(memset-y) $(udivsi3-y)
-
-ccflags-y := -Werror
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index 5051b38fd5b6..b461310965b8 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -70,5 +70,3 @@ CFLAGS_tlbex_64.o += -ffixed-r7 \
 	-ffixed-r41 -ffixed-r42 -ffixed-r43  \
 	-ffixed-r60 -ffixed-r61 -ffixed-r62 \
 	-fomit-frame-pointer
-
-ccflags-y := -Werror
-- 
2.25.1

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

* [PATCH 02/10] sh: sort the selects for SUPERH alphabetically
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Ensure there is an order for the selects of the main SUPERH symbol,
as well as the SUPERH32 and SUPER64 ones.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig | 87 ++++++++++++++++++++++++-------------------------
 1 file changed, 43 insertions(+), 44 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9ece111b0254..808b638b11f3 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -2,59 +2,58 @@
 config SUPERH
 	def_bool y
 	select ARCH_HAS_BINFMT_FLAT if !MMU
+	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+	select ARCH_HAVE_CUSTOM_GPIO_H
+	select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
 	select ARCH_MIGHT_HAVE_PC_PARPORT
-	select HAVE_PATA_PLATFORM
+	select ARCH_WANT_IPC_PARSE_VERSION
 	select CLKDEV_LOOKUP
+	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
-	select HAVE_IDE if HAS_IOPORT_MAP
-	select HAVE_MEMBLOCK_NODE_MAP
-	select HAVE_OPROFILE
+	select GENERIC_ATOMIC64
+	select GENERIC_CLOCKEVENTS
+	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
+	select GENERIC_IDLE_POLL_SETUP
+	select GENERIC_IRQ_SHOW
+	select GENERIC_PCI_IOMAP if PCI
+	select GENERIC_SCHED_CLOCK
+	select GENERIC_SMP_IDLE_THREAD
+	select GENERIC_STRNCPY_FROM_USER
+	select GENERIC_STRNLEN_USER
+	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_TRACEHOOK
-	select HAVE_PERF_EVENTS
 	select HAVE_DEBUG_BUGVERBOSE
-	select HAVE_FAST_GUP if MMU
-	select ARCH_HAVE_CUSTOM_GPIO_H
-	select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
-	select ARCH_HAS_GCOV_PROFILE_ALL
-	select PERF_USE_VMALLOC
 	select HAVE_DEBUG_KMEMLEAK
-	select HAVE_KERNEL_GZIP
-	select CPU_NO_EFFICIENT_FFS
+	select HAVE_FAST_GUP if MMU
+	select HAVE_FUTEX_CMPXCHG if FUTEX
+	select HAVE_IDE if HAS_IOPORT_MAP
 	select HAVE_KERNEL_BZIP2
+	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZMA
-	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_LZO
+	select HAVE_KERNEL_XZ
+	select HAVE_MEMBLOCK_NODE_MAP
+	select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
+	select HAVE_NMI
+	select HAVE_OPROFILE
+	select HAVE_PATA_PLATFORM
+	select HAVE_PERF_EVENTS
+	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_UID16
-	select ARCH_WANT_IPC_PARSE_VERSION
 	select HAVE_SYSCALL_TRACEPOINTS
-	select HAVE_REGS_AND_STACK_ACCESS_API
-	select MAY_HAVE_SPARSE_IRQ
 	select IRQ_FORCED_THREADING
-	select RTC_LIB
-	select GENERIC_ATOMIC64
-	select GENERIC_IRQ_SHOW
-	select GENERIC_SMP_IDLE_THREAD
-	select GENERIC_IDLE_POLL_SETUP
-	select GENERIC_CLOCKEVENTS
-	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
-	select GENERIC_PCI_IOMAP if PCI
-	select GENERIC_SCHED_CLOCK
-	select GENERIC_STRNCPY_FROM_USER
-	select GENERIC_STRNLEN_USER
-	select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
+	select MAY_HAVE_SPARSE_IRQ
 	select MODULES_USE_ELF_RELA
+	select NEED_SG_DMA_LENGTH
 	select NO_GENERIC_PCI_IOPORT_MAP if PCI
-	select OLD_SIGSUSPEND
 	select OLD_SIGACTION
+	select OLD_SIGSUSPEND
 	select PCI_DOMAINS if PCI
-	select HAVE_ARCH_AUDITSYSCALL
-	select HAVE_FUTEX_CMPXCHG if FUTEX
-	select HAVE_NMI
-	select NEED_SG_DMA_LENGTH
-	select ARCH_HAS_GIGANTIC_PAGE
-
+	select PERF_USE_VMALLOC
+	select RTC_LIB
 	help
 	  The SuperH is a RISC processor targeted for use in embedded systems
 	  and consumer electronics; it was also used in the Sega Dreamcast
@@ -64,23 +63,23 @@ config SUPERH
 config SUPERH32
 	def_bool "$(ARCH)" = "sh"
 	select ARCH_32BIT_OFF_T
+	select ARCH_HIBERNATION_POSSIBLE if MMU
+	select ARCH_WANT_IPC_PARSE_VERSION
 	select GUP_GET_PTE_LOW_HIGH if X2TLB
-	select HAVE_KPROBES
-	select HAVE_KRETPROBES
-	select HAVE_IOREMAP_PROT if MMU && !X2TLB
+	select HAVE_ARCH_KGDB
+	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FUNCTION_TRACER
+	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_FTRACE_MCOUNT_RECORD
-	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
-	select ARCH_WANT_IPC_PARSE_VERSION
-	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_ARCH_KGDB
 	select HAVE_HW_BREAKPOINT
+	select HAVE_IOREMAP_PROT if MMU && !X2TLB
+	select HAVE_KPROBES
+	select HAVE_KRETPROBES
 	select HAVE_MIXED_BREAKPOINTS_REGS
+	select HAVE_STACKPROTECTOR
 	select PERF_EVENTS
-	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select SPARSE_IRQ
-	select HAVE_STACKPROTECTOR
 
 config SUPERH64
 	def_bool "$(ARCH)" = "sh64"
-- 
2.25.1

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

* [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

There is no point in having __KERNEL__ ifdefs in headers not exported to
userspace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/adc.h          | 2 --
 arch/sh/include/asm/addrspace.h    | 3 ---
 arch/sh/include/asm/bitops.h       | 4 ----
 arch/sh/include/asm/cache.h        | 2 --
 arch/sh/include/asm/cacheflush.h   | 3 ---
 arch/sh/include/asm/dma.h          | 2 --
 arch/sh/include/asm/elf.h          | 2 --
 arch/sh/include/asm/freq.h         | 2 --
 arch/sh/include/asm/futex.h        | 3 ---
 arch/sh/include/asm/io.h           | 3 ---
 arch/sh/include/asm/mmu_context.h  | 2 --
 arch/sh/include/asm/mmzone.h       | 3 ---
 arch/sh/include/asm/pci.h          | 4 ----
 arch/sh/include/asm/processor_32.h | 2 --
 arch/sh/include/asm/sparsemem.h    | 3 ---
 arch/sh/include/asm/string_32.h    | 4 ----
 arch/sh/include/asm/string_64.h    | 4 ----
 arch/sh/include/asm/syscalls.h     | 3 ---
 arch/sh/include/asm/syscalls_32.h  | 3 ---
 arch/sh/include/asm/syscalls_64.h  | 3 ---
 arch/sh/include/asm/thread_info.h  | 5 -----
 arch/sh/include/asm/watchdog.h     | 2 --
 22 files changed, 64 deletions(-)

diff --git a/arch/sh/include/asm/adc.h b/arch/sh/include/asm/adc.h
index 99ec66849559..feccfe639e38 100644
--- a/arch/sh/include/asm/adc.h
+++ b/arch/sh/include/asm/adc.h
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __ASM_ADC_H
 #define __ASM_ADC_H
-#ifdef __KERNEL__
 /*
  * Copyright (C) 2004  Andriy Skulysh
  */
@@ -10,5 +9,4 @@
 
 int adc_single(unsigned int channel);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_ADC_H */
diff --git a/arch/sh/include/asm/addrspace.h b/arch/sh/include/asm/addrspace.h
index 34bfbcddcce0..468fba333e89 100644
--- a/arch/sh/include/asm/addrspace.h
+++ b/arch/sh/include/asm/addrspace.h
@@ -7,8 +7,6 @@
 #ifndef __ASM_SH_ADDRSPACE_H
 #define __ASM_SH_ADDRSPACE_H
 
-#ifdef __KERNEL__
-
 #include <cpu/addrspace.h>
 
 /* If this CPU supports segmentation, hook up the helpers */
@@ -62,5 +60,4 @@
 #define P3_ADDR_MAX		P4SEG
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h
index 8c3578288db5..0e7a1d9616ab 100644
--- a/arch/sh/include/asm/bitops.h
+++ b/arch/sh/include/asm/bitops.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_BITOPS_H
 #define __ASM_SH_BITOPS_H
 
-#ifdef __KERNEL__
-
 #ifndef _LINUX_BITOPS_H
 #error only <linux/bitops.h> can be included directly
 #endif
@@ -97,6 +95,4 @@ static inline unsigned long ffz(unsigned long word)
 #include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls64.h>
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_BITOPS_H */
diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
index 2408ac4873aa..a293343456af 100644
--- a/arch/sh/include/asm/cache.h
+++ b/arch/sh/include/asm/cache.h
@@ -8,7 +8,6 @@
  */
 #ifndef __ASM_SH_CACHE_H
 #define __ASM_SH_CACHE_H
-#ifdef __KERNEL__
 
 #include <linux/init.h>
 #include <cpu/cache.h>
@@ -44,5 +43,4 @@ struct cache_info {
 	unsigned long flags;
 };
 #endif /* __ASSEMBLY__ */
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHE_H */
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index b932e42ef028..f509d3ede39c 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_CACHEFLUSH_H
 #define __ASM_SH_CACHEFLUSH_H
 
-#ifdef __KERNEL__
-
 #include <linux/mm.h>
 
 /*
@@ -108,5 +106,4 @@ static inline void *sh_cacheop_vaddr(void *vaddr)
 	return vaddr;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
index 4d5a21a891c0..17d23ae98c77 100644
--- a/arch/sh/include/asm/dma.h
+++ b/arch/sh/include/asm/dma.h
@@ -6,7 +6,6 @@
  */
 #ifndef __ASM_SH_DMA_H
 #define __ASM_SH_DMA_H
-#ifdef __KERNEL__
 
 #include <linux/spinlock.h>
 #include <linux/wait.h>
@@ -144,5 +143,4 @@ extern int isa_dma_bridge_buggy;
 #define isa_dma_bridge_buggy	(0)
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_DMA_H */
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index 5ec8db1ddc20..a033f0c32c91 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -90,7 +90,6 @@ typedef struct user_fpu_struct elf_fpregset_t;
 #endif
 #define ELF_ARCH	EM_SH
 
-#ifdef __KERNEL__
 /*
  * This is used to ensure we don't load something for the wrong architecture.
  */
@@ -232,5 +231,4 @@ do {								\
 	NEW_AUX_ENT(AT_L2_CACHESHAPE, l2_cache_shape);		\
 } while (0)
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_ELF_H */
diff --git a/arch/sh/include/asm/freq.h b/arch/sh/include/asm/freq.h
index 18133bf83738..87c23621b7ae 100644
--- a/arch/sh/include/asm/freq.h
+++ b/arch/sh/include/asm/freq.h
@@ -6,9 +6,7 @@
  */
 #ifndef __ASM_SH_FREQ_H
 #define __ASM_SH_FREQ_H
-#ifdef __KERNEL__
 
 #include <cpu/freq.h>
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_FREQ_H */
diff --git a/arch/sh/include/asm/futex.h b/arch/sh/include/asm/futex.h
index 3190ec89df81..9fb58252d915 100644
--- a/arch/sh/include/asm/futex.h
+++ b/arch/sh/include/asm/futex.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_FUTEX_H
 #define __ASM_SH_FUTEX_H
 
-#ifdef __KERNEL__
-
 #include <linux/futex.h>
 #include <linux/uaccess.h>
 #include <asm/errno.h>
@@ -75,5 +73,4 @@ static inline int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval,
 	return ret;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_FUTEX_H */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 39c9ead489e5..5154c6b8c618 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -20,7 +20,6 @@
 #include <asm/pgtable.h>
 #include <asm-generic/iomap.h>
 
-#ifdef __KERNEL__
 #define __IO_PREFIX     generic
 #include <asm/io_generic.h>
 #include <asm/io_trapped.h>
@@ -384,6 +383,4 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
 int valid_phys_addr_range(phys_addr_t addr, size_t size);
 int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_IO_H */
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
index 2d09650093c7..070f5a42dd00 100644
--- a/arch/sh/include/asm/mmu_context.h
+++ b/arch/sh/include/asm/mmu_context.h
@@ -8,7 +8,6 @@
 #ifndef __ASM_SH_MMU_CONTEXT_H
 #define __ASM_SH_MMU_CONTEXT_H
 
-#ifdef __KERNEL__
 #include <cpu/mmu_context.h>
 #include <asm/tlbflush.h>
 #include <linux/uaccess.h>
@@ -189,5 +188,4 @@ static inline void disable_mmu(void)
 #define disable_mmu()	do { } while (0)
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_MMU_CONTEXT_H */
diff --git a/arch/sh/include/asm/mmzone.h b/arch/sh/include/asm/mmzone.h
index cbaee1d1b673..6552a088dc97 100644
--- a/arch/sh/include/asm/mmzone.h
+++ b/arch/sh/include/asm/mmzone.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_MMZONE_H
 #define __ASM_SH_MMZONE_H
 
-#ifdef __KERNEL__
-
 #ifdef CONFIG_NEED_MULTIPLE_NODES
 #include <linux/numa.h>
 
@@ -44,5 +42,4 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
 /* arch/sh/mm/init.c */
 void __init allocate_pgdat(unsigned int nid);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_MMZONE_H */
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 10a36b1cf2ea..ad22e88c6657 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_PCI_H
 #define __ASM_SH_PCI_H
 
-#ifdef __KERNEL__
-
 /* Can be used to override the logic in pci_scan_bus for skipping
    already-configured bus numbers - to be used for buggy BIOSes
    or architectures with incomplete PCI setup by the loader */
@@ -96,6 +94,4 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_PCI_H */
-
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index 0e0ecc0132e3..fa9e1a67dadf 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -8,7 +8,6 @@
 
 #ifndef __ASM_SH_PROCESSOR_32_H
 #define __ASM_SH_PROCESSOR_32_H
-#ifdef __KERNEL__
 
 #include <linux/compiler.h>
 #include <linux/linkage.h>
@@ -203,5 +202,4 @@ static inline void prefetchw(const void *x)
 }
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_PROCESSOR_32_H */
diff --git a/arch/sh/include/asm/sparsemem.h b/arch/sh/include/asm/sparsemem.h
index 4eb899751e45..ed287c4980bc 100644
--- a/arch/sh/include/asm/sparsemem.h
+++ b/arch/sh/include/asm/sparsemem.h
@@ -2,7 +2,6 @@
 #ifndef __ASM_SH_SPARSEMEM_H
 #define __ASM_SH_SPARSEMEM_H
 
-#ifdef __KERNEL__
 /*
  * SECTION_SIZE_BITS		2^N: how big each section will be
  * MAX_PHYSADDR_BITS		2^N: how much physical address space we have
@@ -12,6 +11,4 @@
 #define MAX_PHYSADDR_BITS	32
 #define MAX_PHYSMEM_BITS	32
 
-#endif
-
 #endif /* __ASM_SH_SPARSEMEM_H */
diff --git a/arch/sh/include/asm/string_32.h b/arch/sh/include/asm/string_32.h
index 3558b1d7123e..778589e4a99d 100644
--- a/arch/sh/include/asm/string_32.h
+++ b/arch/sh/include/asm/string_32.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_STRING_H
 #define __ASM_SH_STRING_H
 
-#ifdef __KERNEL__
-
 /*
  * Copyright (C) 1999 Niibe Yutaka
  * But consider these trivial functions to be public domain.
@@ -127,6 +125,4 @@ extern void *memchr(const void *__s, int __c, size_t __n);
 #define __HAVE_ARCH_STRLEN
 extern size_t strlen(const char *);
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_STRING_H */
diff --git a/arch/sh/include/asm/string_64.h b/arch/sh/include/asm/string_64.h
index d51d6150a4e2..3746f46633ca 100644
--- a/arch/sh/include/asm/string_64.h
+++ b/arch/sh/include/asm/string_64.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_STRING_64_H
 #define __ASM_SH_STRING_64_H
 
-#ifdef __KERNEL__
-
 #define __HAVE_ARCH_MEMSET
 extern void *memset(void *__s, int __c, size_t __count);
 
@@ -16,6 +14,4 @@ extern size_t strlen(const char *);
 #define __HAVE_ARCH_STRCPY
 extern char *strcpy(char *__dest, const char *__src);
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_STRING_64_H */
diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h
index 995ef046232c..74f9de3f9ba3 100644
--- a/arch/sh/include/asm/syscalls.h
+++ b/arch/sh/include/asm/syscalls.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_SYSCALLS_H
 #define __ASM_SH_SYSCALLS_H
 
-#ifdef __KERNEL__
-
 asmlinkage int old_mmap(unsigned long addr, unsigned long len,
 			unsigned long prot, unsigned long flags,
 			int fd, unsigned long off);
@@ -17,5 +15,4 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 # include <asm/syscalls_64.h>
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_SYSCALLS_H */
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index 9f9faf63b48c..5c555b864fe0 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_SYSCALLS_32_H
 #define __ASM_SH_SYSCALLS_32_H
 
-#ifdef __KERNEL__
-
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <linux/types.h>
@@ -26,5 +24,4 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
 asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
 				 unsigned long thread_info_flags);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_SYSCALLS_32_H */
diff --git a/arch/sh/include/asm/syscalls_64.h b/arch/sh/include/asm/syscalls_64.h
index df42656cebea..2e65fad46dc9 100644
--- a/arch/sh/include/asm/syscalls_64.h
+++ b/arch/sh/include/asm/syscalls_64.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_SYSCALLS_64_H
 #define __ASM_SH_SYSCALLS_64_H
 
-#ifdef __KERNEL__
-
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <linux/types.h>
@@ -14,5 +12,4 @@ struct pt_regs;
 asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs);
 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_SYSCALLS_64_H */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index cf5c792bf70b..82b2e3d779b7 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -10,8 +10,6 @@
  *  Copyright (C) 2002  David Howells (dhowells@redhat.com)
  *  - Incorporating suggestions made by Linus Torvalds and Dave Miller
  */
-#ifdef __KERNEL__
-
 #include <asm/page.h>
 
 /*
@@ -172,7 +170,4 @@ static inline unsigned int get_thread_fault_code(void)
 }
 
 #endif	/* !__ASSEMBLY__ */
-
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_THREAD_INFO_H */
diff --git a/arch/sh/include/asm/watchdog.h b/arch/sh/include/asm/watchdog.h
index cecd0fc507f9..b9ca4c99f046 100644
--- a/arch/sh/include/asm/watchdog.h
+++ b/arch/sh/include/asm/watchdog.h
@@ -8,7 +8,6 @@
  */
 #ifndef __ASM_SH_WATCHDOG_H
 #define __ASM_SH_WATCHDOG_H
-#ifdef __KERNEL__
 
 #include <linux/types.h>
 #include <linux/io.h>
@@ -157,5 +156,4 @@ static inline void sh_wdt_write_csr(__u8 val)
 	__raw_writew((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
 }
 #endif /* CONFIG_CPU_SUBTYPE_SH7785 || CONFIG_CPU_SUBTYPE_SH7780 */
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_WATCHDOG_H */
-- 
2.25.1

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

* [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h>
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (2 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

ioremap_fixed is an internal implementation detail and should not be
exposed to drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h   | 16 ----------------
 arch/sh/mm/init.c          |  1 +
 arch/sh/mm/ioremap.c       |  1 +
 arch/sh/mm/ioremap.h       | 23 +++++++++++++++++++++++
 arch/sh/mm/ioremap_fixed.c |  1 +
 5 files changed, 26 insertions(+), 16 deletions(-)
 create mode 100644 arch/sh/mm/ioremap.h

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 5154c6b8c618..59d53b06d461 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -350,22 +350,6 @@ ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
 }
 #endif
 
-#ifdef CONFIG_IOREMAP_FIXED
-extern void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t);
-extern int iounmap_fixed(void __iomem *);
-extern void ioremap_fixed_init(void);
-#else
-static inline void __iomem *
-ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
-{
-	BUG();
-	return NULL;
-}
-
-static inline void ioremap_fixed_init(void) { }
-static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
-#endif
-
 #define ioremap_uc	ioremap
 
 /*
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index d1b1ff2be17a..cf40b1ad4422 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -28,6 +28,7 @@
 #include <asm/setup.h>
 #include <asm/cache.h>
 #include <linux/sizes.h>
+#include "ioremap.h"
 
 pgd_t swapper_pg_dir[PTRS_PER_PGD];
 
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index f6d02246d665..d9ec85b6bb21 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -24,6 +24,7 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu.h>
+#include "ioremap.h"
 
 /*
  * Remap an arbitrary physical address space into the kernel virtual
diff --git a/arch/sh/mm/ioremap.h b/arch/sh/mm/ioremap.h
new file mode 100644
index 000000000000..f2544e721a35
--- /dev/null
+++ b/arch/sh/mm/ioremap.h
@@ -0,0 +1,23 @@
+#ifndef _SH_MM_IORMEMAP_H
+#define _SH_MM_IORMEMAP_H 1
+
+#ifdef CONFIG_IOREMAP_FIXED
+void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t);
+int iounmap_fixed(void __iomem *);
+void ioremap_fixed_init(void);
+#else
+static inline void __iomem *
+ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
+{
+	BUG();
+	return NULL;
+}
+static inline void ioremap_fixed_init(void)
+{
+}
+static inline int iounmap_fixed(void __iomem *addr)
+{
+	return -EINVAL;
+}
+#endif /* CONFIG_IOREMAP_FIXED */
+#endif /* _SH_MM_IORMEMAP_H */
diff --git a/arch/sh/mm/ioremap_fixed.c b/arch/sh/mm/ioremap_fixed.c
index 07e744d75fa0..1914b79d1c53 100644
--- a/arch/sh/mm/ioremap_fixed.c
+++ b/arch/sh/mm/ioremap_fixed.c
@@ -24,6 +24,7 @@
 #include <asm/tlbflush.h>
 #include <asm/mmu.h>
 #include <asm/mmu_context.h>
+#include "ioremap.h"
 
 struct ioremap_map {
 	void __iomem *addr;
-- 
2.25.1

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

* [PATCH 05/10] sh: move the ioremap implementation out of line
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (3 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Move the internal implementation details of ioremap out of line, no need
to expose any of this to drivers for a slow path API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h | 101 ++++++---------------------------------
 arch/sh/mm/ioremap.c     |  57 ++++++++++++++++++++++
 2 files changed, 72 insertions(+), 86 deletions(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 59d53b06d461..282ec476c06e 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -246,109 +246,38 @@ unsigned long long poke_real_address_q(unsigned long long addr,
 #define phys_to_virt(address)	(__va(address))
 #endif
 
-/*
- * On 32-bit SH, we traditionally have the whole physical address space
- * mapped at all times (as MIPS does), so "ioremap()" and "iounmap()" do
- * not need to do anything but place the address in the proper segment.
- * This is true for P1 and P2 addresses, as well as some P3 ones.
- * However, most of the P3 addresses and newer cores using extended
- * addressing need to map through page tables, so the ioremap()
- * implementation becomes a bit more complicated.
- *
- * See arch/sh/mm/ioremap.c for additional notes on this.
- *
- * We cheat a bit and always return uncachable areas until we've fixed
- * the drivers to handle caching properly.
- *
- * On the SH-5 the concept of segmentation in the 1:1 PXSEG sense simply
- * doesn't exist, so everything must go through page tables.
- */
 #ifdef CONFIG_MMU
+void iounmap(void __iomem *addr);
 void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size,
 			       pgprot_t prot, void *caller);
-void iounmap(void __iomem *addr);
-
-static inline void __iomem *
-__ioremap(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-	return __ioremap_caller(offset, size, prot, __builtin_return_address(0));
-}
-
-static inline void __iomem *
-__ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-#ifdef CONFIG_29BIT
-	phys_addr_t last_addr = offset + size - 1;
-
-	/*
-	 * For P1 and P2 space this is trivial, as everything is already
-	 * mapped. Uncached access for P1 addresses are done through P2.
-	 * In the P3 case or for addresses outside of the 29-bit space,
-	 * mapping must be done by the PMB or by using page tables.
-	 */
-	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
-		u64 flags = pgprot_val(prot);
-
-		/*
-		 * Anything using the legacy PTEA space attributes needs
-		 * to be kicked down to page table mappings.
-		 */
-		if (unlikely(flags & _PAGE_PCC_MASK))
-			return NULL;
-		if (unlikely(flags & _PAGE_CACHABLE))
-			return (void __iomem *)P1SEGADDR(offset);
-
-		return (void __iomem *)P2SEGADDR(offset);
-	}
-
-	/* P4 above the store queues are always mapped. */
-	if (unlikely(offset >= P3_ADDR_MAX))
-		return (void __iomem *)P4SEGADDR(offset);
-#endif
-
-	return NULL;
-}
-
-static inline void __iomem *
-__ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-	void __iomem *ret;
-
-	ret = __ioremap_trapped(offset, size);
-	if (ret)
-		return ret;
-
-	ret = __ioremap_29bit(offset, size, prot);
-	if (ret)
-		return ret;
-
-	return __ioremap(offset, size, prot);
-}
-#else
-#define __ioremap(offset, size, prot)		((void __iomem *)(offset))
-#define __ioremap_mode(offset, size, prot)	((void __iomem *)(offset))
-#define iounmap(addr)				do { } while (0)
-#endif /* CONFIG_MMU */
 
 static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
 {
-	return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE);
+	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_mode(offset, size, PAGE_KERNEL);
+	return __ioremap_caller(offset, size, PAGE_KERNEL,
+			__builtin_return_address(0));
 }
 #define ioremap_cache ioremap_cache
 
 #ifdef CONFIG_HAVE_IOREMAP_PROT
-static inline void __iomem *
-ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
+static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
+		unsigned long flags)
 {
-	return __ioremap_mode(offset, size, __pgprot(flags));
+	return __ioremap_caller(offset, size, __pgprot(flags),
+			__builtin_return_address(0));
 }
-#endif
+#endif /* CONFIG_HAVE_IOREMAP_PROT */
+
+#else /* CONFIG_MMU */
+#define iounmap(addr)		do { } while (0)
+#define ioremap(offset, size)	((void __iomem *)(unsigned long)(offset))
+#endif /* CONFIG_MMU */
 
 #define ioremap_uc	ioremap
 
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index d9ec85b6bb21..a8170fa07bc1 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -26,6 +26,55 @@
 #include <asm/mmu.h>
 #include "ioremap.h"
 
+/*
+ * On 32-bit SH, we traditionally have the whole physical address space mapped
+ * at all times (as MIPS does), so "ioremap()" and "iounmap()" do not need to do
+ * anything but place the address in the proper segment.  This is true for P1
+ * and P2 addresses, as well as some P3 ones.  However, most of the P3 addresses
+ * and newer cores using extended addressing need to map through page tables, so
+ * the ioremap() implementation becomes a bit more complicated.
+ *
+ * On the SH-5 the concept of segmentation in the 1:1 PXSEG sense simply doesn't
+ * exist, so everything must go through page tables.
+ */
+
+#ifdef CONFIG_29BIT
+static void __iomem *
+__ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
+{
+	phys_addr_t last_addr = offset + size - 1;
+
+	/*
+	 * For P1 and P2 space this is trivial, as everything is already
+	 * mapped. Uncached access for P1 addresses are done through P2.
+	 * In the P3 case or for addresses outside of the 29-bit space,
+	 * mapping must be done by the PMB or by using page tables.
+	 */
+	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
+		u64 flags = pgprot_val(prot);
+
+		/*
+		 * Anything using the legacy PTEA space attributes needs
+		 * to be kicked down to page table mappings.
+		 */
+		if (unlikely(flags & _PAGE_PCC_MASK))
+			return NULL;
+		if (unlikely(flags & _PAGE_CACHABLE))
+			return (void __iomem *)P1SEGADDR(offset);
+
+		return (void __iomem *)P2SEGADDR(offset);
+	}
+
+	/* P4 above the store queues are always mapped. */
+	if (unlikely(offset >= P3_ADDR_MAX))
+		return (void __iomem *)P4SEGADDR(offset);
+
+	return NULL;
+}
+#else
+#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
@@ -43,6 +92,14 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
 	unsigned long offset, last_addr, addr, orig_addr;
 	void __iomem *mapped;
 
+	mapped = __ioremap_trapped(phys_addr, size);
+	if (mapped)
+		return mapped;
+
+	mapped = __ioremap_29bit(phys_addr, size, pgprot);
+	if (mapped)
+		return mapped;
+
 	/* Don't allow wraparound or zero size */
 	last_addr = phys_addr + size - 1;
 	if (!size || last_addr < phys_addr)
-- 
2.25.1

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

* [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h>
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (4 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

No need to expose the details of trapped I/O to drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h | 1 -
 arch/sh/kernel/ioport.c  | 1 +
 arch/sh/mm/ioremap.c     | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 282ec476c06e..6beb55cadc21 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -22,7 +22,6 @@
 
 #define __IO_PREFIX     generic
 #include <asm/io_generic.h>
-#include <asm/io_trapped.h>
 #include <asm-generic/pci_iomap.h>
 #include <mach/mangle-port.h>
 
diff --git a/arch/sh/kernel/ioport.c b/arch/sh/kernel/ioport.c
index 34f8cdbbcf0b..f39446a658bd 100644
--- a/arch/sh/kernel/ioport.c
+++ b/arch/sh/kernel/ioport.c
@@ -7,6 +7,7 @@
  */
 #include <linux/module.h>
 #include <linux/io.h>
+#include <asm/io_trapped.h>
 
 unsigned long sh_io_port_base __read_mostly = -1;
 EXPORT_SYMBOL(sh_io_port_base);
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index a8170fa07bc1..3a13c1d3aa54 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -18,6 +18,7 @@
 #include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/io.h>
+#include <asm/io_trapped.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/addrspace.h>
-- 
2.25.1

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

* [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (5 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Both functions are only used by compiled in core code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/kernel/io_trapped.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 60c828a2b8a2..92a512e442b0 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -102,7 +102,6 @@ int register_trapped_io(struct trapped_io *tiop)
 	pr_warn("unable to install trapped io filter\n");
 	return -1;
 }
-EXPORT_SYMBOL_GPL(register_trapped_io);
 
 void __iomem *match_trapped_io_handler(struct list_head *list,
 				       unsigned long offset,
@@ -131,7 +130,6 @@ void __iomem *match_trapped_io_handler(struct list_head *list,
 	spin_unlock_irqrestore(&trapped_lock, flags);
 	return NULL;
 }
-EXPORT_SYMBOL_GPL(match_trapped_io_handler);
 
 static struct trapped_io *lookup_tiop(unsigned long address)
 {
-- 
2.25.1

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

* [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (6 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Have a single definition that architetures can select.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig         | 4 +---
 arch/m68k/Kconfig.machine | 1 +
 arch/um/Kconfig           | 4 +---
 kernel/dma/Kconfig        | 3 +++
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 6ad6cdac74b3..8e488369a7e5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -17,6 +17,7 @@ config M68K
 	select HAVE_COPY_THREAD_TLS
 	select GENERIC_IRQ_SHOW
 	select GENERIC_ATOMIC64
+	select NO_DMA if !MMU && !COLDFIRE
 	select HAVE_UID16
 	select VIRT_TO_BUS
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
@@ -60,9 +61,6 @@ config TIME_LOW_RES
 config NO_IOPORT_MAP
 	def_bool y
 
-config NO_DMA
-	def_bool (MMU && SUN3) || (!MMU && !COLDFIRE)
-
 config ZONE_DMA
 	bool
 	default y
diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index c01e103492fd..0b95bc980070 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -126,6 +126,7 @@ config SUN3
 	depends on MMU
 	depends on !MMU_MOTOROLA
 	select MMU_SUN3 if MMU
+	select NO_DMA
 	select M68020
 	help
 	  This option enables support for the Sun 3 series of workstations
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 0917f8443c28..4e92502407df 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -15,6 +15,7 @@ config UML
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DEBUG_BUGVERBOSE
 	select HAVE_COPY_THREAD_TLS
+	select NO_DMA
 	select GENERIC_IRQ_SHOW
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
@@ -162,9 +163,6 @@ config MMAPPER
 	  This driver allows a host file to be used as emulated IO memory inside
 	  UML.
 
-config NO_DMA
-	def_bool y
-
 config PGTABLE_LEVELS
 	int
 	default 3 if 3_LEVEL_PGTABLES
diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
index 4c103a24e380..3df749b1fd23 100644
--- a/kernel/dma/Kconfig
+++ b/kernel/dma/Kconfig
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+config NO_DMA
+	bool
+
 config HAS_DMA
 	bool
 	depends on !NO_DMA
-- 
2.25.1

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

* [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (7 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-03-24 16:26 ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

The code handling non-coherent DMA depends on being able to remap code
as non-cached.  But that can't be done without an MMU, so using this
option on NOMMU builds is broken.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 808b638b11f3..b97d9712c252 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -48,6 +48,7 @@ config SUPERH
 	select MAY_HAVE_SPARSE_IRQ
 	select MODULES_USE_ELF_RELA
 	select NEED_SG_DMA_LENGTH
+	select NO_DMA if !MMU && !DMA_COHERENT
 	select NO_GENERIC_PCI_IOPORT_MAP if PCI
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND
@@ -155,7 +156,7 @@ config DMA_COHERENT
 	bool
 
 config DMA_NONCOHERENT
-	def_bool !DMA_COHERENT
+	def_bool !NO_DMA && !DMA_COHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 
 config PGTABLE_LEVELS
-- 
2.25.1

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

* [PATCH 10/10] sh: use the generic dma coherent remap allocator
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (8 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
@ 2020-03-24 16:26 ` Christoph Hellwig
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
  11 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-03-24 16:26 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

This switches to using common code for the DMA allocations, including
potential use of the CMA allocator if configured.

Switching to the generic code enables DMA allocations from atomic
context, which is required by the DMA API documentation, and also
adds various other minor features drivers start relying upon.  It
also makes sure we have on tested code base for all architectures
that require uncached pte bits for coherent DMA allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig               |  2 ++
 arch/sh/kernel/dma-coherent.c | 51 ++---------------------------------
 2 files changed, 4 insertions(+), 49 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index b97d9712c252..57cf54e29684 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -157,7 +157,9 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !NO_DMA && !DMA_COHERENT
+	select ARCH_HAS_DMA_PREP_COHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_DIRECT_REMAP
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/kernel/dma-coherent.c b/arch/sh/kernel/dma-coherent.c
index d4811691b93c..cd46a9825e3c 100644
--- a/arch/sh/kernel/dma-coherent.c
+++ b/arch/sh/kernel/dma-coherent.c
@@ -3,60 +3,13 @@
  * Copyright (C) 2004 - 2007  Paul Mundt
  */
 #include <linux/mm.h>
-#include <linux/init.h>
 #include <linux/dma-noncoherent.h>
-#include <linux/module.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
-		gfp_t gfp, unsigned long attrs)
+void arch_dma_prep_coherent(struct page *page, size_t size)
 {
-	void *ret, *ret_nocache;
-	int order = get_order(size);
-
-	gfp |= __GFP_ZERO;
-
-	ret = (void *)__get_free_pages(gfp, order);
-	if (!ret)
-		return NULL;
-
-	/*
-	 * Pages from the page allocator may have data present in
-	 * cache. So flush the cache before using uncached memory.
-	 */
-	arch_sync_dma_for_device(virt_to_phys(ret), size,
-			DMA_BIDIRECTIONAL);
-
-	ret_nocache = (void __force *)ioremap(virt_to_phys(ret), size);
-	if (!ret_nocache) {
-		free_pages((unsigned long)ret, order);
-		return NULL;
-	}
-
-	split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order);
-
-	*dma_handle = virt_to_phys(ret);
-	if (!WARN_ON(!dev))
-		*dma_handle -= PFN_PHYS(dev->dma_pfn_offset);
-
-	return ret_nocache;
-}
-
-void arch_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs)
-{
-	int order = get_order(size);
-	unsigned long pfn = (dma_handle >> PAGE_SHIFT);
-	int k;
-
-	if (!WARN_ON(!dev))
-		pfn += dev->dma_pfn_offset;
-
-	for (k = 0; k < (1 << order); k++)
-		__free_pages(pfn_to_page(pfn + k), 0);
-
-	iounmap(vaddr);
+	__flush_purge_region(page_address(page), size);
 }
 
 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
-- 
2.25.1

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

* ioremap and dma cleanups and fixes for superh (resend)
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (9 preceding siblings ...)
  2020-03-24 16:26 ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
@ 2020-06-26  8:07 ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
                     ` (9 more replies)
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
  11 siblings, 10 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Hi Yoshinori and Rich,

can you take a look and possibly pick up the series below that untangles
and sorts out minor issues with the sh ioremap and dma code?

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

* [PATCH 01/10] sh: remove -Werror from Makefiles
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

The sh build is full of warnings when building with gcc 9.2.1.  While
fixing those would be great, at least avoid failing the build.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/kernel/Makefile | 2 --
 arch/sh/lib/Makefile    | 2 --
 arch/sh/mm/Makefile     | 2 --
 3 files changed, 6 deletions(-)

diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index b0f5574b6228b3..aa0fbc9202b14e 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -47,5 +47,3 @@ obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
 obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-coherent.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
-
-ccflags-y := -Werror
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index d0abbe5e38b0f3..eb473d373ca43a 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -30,5 +30,3 @@ memset-$(CONFIG_CPU_SH4)	:= memset-sh4.o
 lib-$(CONFIG_MMU)		+= copy_page.o __clear_user.o
 lib-$(CONFIG_MCOUNT)		+= mcount.o
 lib-y				+= $(memcpy-y) $(memset-y) $(udivsi3-y)
-
-ccflags-y := -Werror
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index 487da0ff03b3a7..f69ddc70b14658 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -43,5 +43,3 @@ obj-$(CONFIG_UNCACHED_MAPPING)	+= uncached.o
 obj-$(CONFIG_HAVE_SRAM_POOL)	+= sram.o
 
 GCOV_PROFILE_pmb.o := n
-
-ccflags-y := -Werror
-- 
2.26.2

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

* [PATCH 02/10] sh: sort the selects for SUPERH alphabetically
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Ensure there is an order for the selects.  Also remove a duplicate
one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig | 95 ++++++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 48 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9fc2b010e938c9..f8027eee08edae 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -1,75 +1,74 @@
 # SPDX-License-Identifier: GPL-2.0
 config SUPERH
 	def_bool y
+	select ARCH_32BIT_OFF_T
+	select ARCH_HAVE_CUSTOM_GPIO_H
+	select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
 	select ARCH_HAS_BINFMT_FLAT if !MMU
+	select ARCH_HAS_GIGANTIC_PAGE
+	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
-	select HAVE_PATA_PLATFORM
+	select ARCH_WANT_IPC_PARSE_VERSION
 	select CLKDEV_LOOKUP
+	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
-	select HAVE_IDE if HAS_IOPORT_MAP
-	select HAVE_OPROFILE
+	select GENERIC_ATOMIC64
+	select GENERIC_CLOCKEVENTS
+	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
+	select GENERIC_IDLE_POLL_SETUP
+	select GENERIC_IRQ_SHOW
+	select GENERIC_PCI_IOMAP if PCI
+	select GENERIC_SCHED_CLOCK
+	select GENERIC_STRNCPY_FROM_USER
+	select GENERIC_STRNLEN_USER
+	select GENERIC_SMP_IDLE_THREAD
+	select GUP_GET_PTE_LOW_HIGH if X2TLB
+	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_TRACEHOOK
-	select HAVE_PERF_EVENTS
 	select HAVE_DEBUG_BUGVERBOSE
-	select HAVE_FAST_GUP if MMU
-	select ARCH_HAVE_CUSTOM_GPIO_H
-	select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
-	select ARCH_HAS_GCOV_PROFILE_ALL
-	select PERF_USE_VMALLOC
 	select HAVE_DEBUG_KMEMLEAK
-	select HAVE_KERNEL_GZIP
-	select CPU_NO_EFFICIENT_FFS
+	select HAVE_DYNAMIC_FTRACE
+	select HAVE_FAST_GUP if MMU
+	select HAVE_FUNCTION_GRAPH_TRACER
+	select HAVE_FUNCTION_TRACER
+	select HAVE_FUTEX_CMPXCHG if FUTEX
+	select HAVE_FTRACE_MCOUNT_RECORD
+	select HAVE_HW_BREAKPOINT
+	select HAVE_IDE if HAS_IOPORT_MAP
+	select HAVE_IOREMAP_PROT if MMU && !X2TLB
 	select HAVE_KERNEL_BZIP2
+	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZMA
-	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_LZO
+	select HAVE_KERNEL_XZ
+	select HAVE_KPROBES
+	select HAVE_KRETPROBES
+	select HAVE_MIXED_BREAKPOINTS_REGS
+	select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
+	select HAVE_NMI
+	select HAVE_OPROFILE
+	select HAVE_PATA_PLATFORM
+	select HAVE_PERF_EVENTS
+	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_UID16
-	select ARCH_WANT_IPC_PARSE_VERSION
+	select HAVE_STACKPROTECTOR
 	select HAVE_SYSCALL_TRACEPOINTS
-	select HAVE_REGS_AND_STACK_ACCESS_API
-	select MAY_HAVE_SPARSE_IRQ
 	select IRQ_FORCED_THREADING
-	select RTC_LIB
-	select GENERIC_ATOMIC64
-	select GENERIC_IRQ_SHOW
-	select GENERIC_SMP_IDLE_THREAD
-	select GENERIC_IDLE_POLL_SETUP
-	select GENERIC_CLOCKEVENTS
-	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
-	select GENERIC_PCI_IOMAP if PCI
-	select GENERIC_SCHED_CLOCK
-	select GENERIC_STRNCPY_FROM_USER
-	select GENERIC_STRNLEN_USER
-	select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
+	select MAY_HAVE_SPARSE_IRQ
 	select MODULES_USE_ELF_RELA
+	select NEED_SG_DMA_LENGTH
 	select NO_GENERIC_PCI_IOPORT_MAP if PCI
-	select OLD_SIGSUSPEND
 	select OLD_SIGACTION
+	select OLD_SIGSUSPEND
 	select PCI_DOMAINS if PCI
-	select HAVE_ARCH_AUDITSYSCALL
-	select HAVE_FUTEX_CMPXCHG if FUTEX
-	select HAVE_NMI
-	select NEED_SG_DMA_LENGTH
-	select ARCH_HAS_GIGANTIC_PAGE
-	select ARCH_32BIT_OFF_T
-	select GUP_GET_PTE_LOW_HIGH if X2TLB
-	select HAVE_KPROBES
-	select HAVE_KRETPROBES
-	select HAVE_IOREMAP_PROT if MMU && !X2TLB
-	select HAVE_FUNCTION_TRACER
-	select HAVE_FTRACE_MCOUNT_RECORD
-	select HAVE_DYNAMIC_FTRACE
-	select ARCH_WANT_IPC_PARSE_VERSION
-	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_ARCH_KGDB
-	select HAVE_HW_BREAKPOINT
-	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
-	select ARCH_HIBERNATION_POSSIBLE if MMU
+	select PERF_USE_VMALLOC
+	select RTC_LIB
 	select SPARSE_IRQ
-	select HAVE_STACKPROTECTOR
 	help
 	  The SuperH is a RISC processor targeted for use in embedded systems
 	  and consumer electronics; it was also used in the Sega Dreamcast
-- 
2.26.2

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

* [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

There is no point in having __KERNEL__ ifdefs in headers not exported to
userspace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/adc.h          | 2 --
 arch/sh/include/asm/addrspace.h    | 3 ---
 arch/sh/include/asm/bitops.h       | 4 ----
 arch/sh/include/asm/cache.h        | 2 --
 arch/sh/include/asm/cacheflush.h   | 3 ---
 arch/sh/include/asm/dma.h          | 2 --
 arch/sh/include/asm/elf.h          | 2 --
 arch/sh/include/asm/freq.h         | 2 --
 arch/sh/include/asm/futex.h        | 3 ---
 arch/sh/include/asm/io.h           | 3 ---
 arch/sh/include/asm/mmu_context.h  | 2 --
 arch/sh/include/asm/mmzone.h       | 3 ---
 arch/sh/include/asm/pci.h          | 4 ----
 arch/sh/include/asm/processor_32.h | 2 --
 arch/sh/include/asm/sparsemem.h    | 3 ---
 arch/sh/include/asm/string_32.h    | 4 ----
 arch/sh/include/asm/syscalls_32.h  | 3 ---
 arch/sh/include/asm/thread_info.h  | 5 -----
 arch/sh/include/asm/watchdog.h     | 2 --
 19 files changed, 54 deletions(-)

diff --git a/arch/sh/include/asm/adc.h b/arch/sh/include/asm/adc.h
index 99ec668495594c..feccfe639e3896 100644
--- a/arch/sh/include/asm/adc.h
+++ b/arch/sh/include/asm/adc.h
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __ASM_ADC_H
 #define __ASM_ADC_H
-#ifdef __KERNEL__
 /*
  * Copyright (C) 2004  Andriy Skulysh
  */
@@ -10,5 +9,4 @@
 
 int adc_single(unsigned int channel);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_ADC_H */
diff --git a/arch/sh/include/asm/addrspace.h b/arch/sh/include/asm/addrspace.h
index 34bfbcddcce027..468fba333e896b 100644
--- a/arch/sh/include/asm/addrspace.h
+++ b/arch/sh/include/asm/addrspace.h
@@ -7,8 +7,6 @@
 #ifndef __ASM_SH_ADDRSPACE_H
 #define __ASM_SH_ADDRSPACE_H
 
-#ifdef __KERNEL__
-
 #include <cpu/addrspace.h>
 
 /* If this CPU supports segmentation, hook up the helpers */
@@ -62,5 +60,4 @@
 #define P3_ADDR_MAX		P4SEG
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h
index 445dd14c448a67..450b5854d7c67b 100644
--- a/arch/sh/include/asm/bitops.h
+++ b/arch/sh/include/asm/bitops.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_BITOPS_H
 #define __ASM_SH_BITOPS_H
 
-#ifdef __KERNEL__
-
 #ifndef _LINUX_BITOPS_H
 #error only <linux/bitops.h> can be included directly
 #endif
@@ -71,6 +69,4 @@ static inline unsigned long __ffs(unsigned long word)
 #include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls64.h>
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_BITOPS_H */
diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
index 2408ac4873aa00..a293343456affe 100644
--- a/arch/sh/include/asm/cache.h
+++ b/arch/sh/include/asm/cache.h
@@ -8,7 +8,6 @@
  */
 #ifndef __ASM_SH_CACHE_H
 #define __ASM_SH_CACHE_H
-#ifdef __KERNEL__
 
 #include <linux/init.h>
 #include <cpu/cache.h>
@@ -44,5 +43,4 @@ struct cache_info {
 	unsigned long flags;
 };
 #endif /* __ASSEMBLY__ */
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHE_H */
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index fe7400079b97b0..4486a865ff62f6 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_CACHEFLUSH_H
 #define __ASM_SH_CACHEFLUSH_H
 
-#ifdef __KERNEL__
-
 #include <linux/mm.h>
 
 /*
@@ -109,5 +107,4 @@ static inline void *sh_cacheop_vaddr(void *vaddr)
 	return vaddr;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
index 4d5a21a891c078..17d23ae98c77a4 100644
--- a/arch/sh/include/asm/dma.h
+++ b/arch/sh/include/asm/dma.h
@@ -6,7 +6,6 @@
  */
 #ifndef __ASM_SH_DMA_H
 #define __ASM_SH_DMA_H
-#ifdef __KERNEL__
 
 #include <linux/spinlock.h>
 #include <linux/wait.h>
@@ -144,5 +143,4 @@ extern int isa_dma_bridge_buggy;
 #define isa_dma_bridge_buggy	(0)
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_DMA_H */
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index 7661fb5d548a08..2862d6d1cb64f1 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -90,7 +90,6 @@ typedef struct user_fpu_struct elf_fpregset_t;
 #endif
 #define ELF_ARCH	EM_SH
 
-#ifdef __KERNEL__
 /*
  * This is used to ensure we don't load something for the wrong architecture.
  */
@@ -209,5 +208,4 @@ do {								\
 	NEW_AUX_ENT(AT_L2_CACHESHAPE, l2_cache_shape);		\
 } while (0)
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_ELF_H */
diff --git a/arch/sh/include/asm/freq.h b/arch/sh/include/asm/freq.h
index 18133bf837386b..87c23621b7ae81 100644
--- a/arch/sh/include/asm/freq.h
+++ b/arch/sh/include/asm/freq.h
@@ -6,9 +6,7 @@
  */
 #ifndef __ASM_SH_FREQ_H
 #define __ASM_SH_FREQ_H
-#ifdef __KERNEL__
 
 #include <cpu/freq.h>
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_FREQ_H */
diff --git a/arch/sh/include/asm/futex.h b/arch/sh/include/asm/futex.h
index b39cda09fb95cc..b70f3fce6ed77a 100644
--- a/arch/sh/include/asm/futex.h
+++ b/arch/sh/include/asm/futex.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_FUTEX_H
 #define __ASM_SH_FUTEX_H
 
-#ifdef __KERNEL__
-
 #include <linux/futex.h>
 #include <linux/uaccess.h>
 #include <asm/errno.h>
@@ -71,5 +69,4 @@ static inline int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval,
 	return ret;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_FUTEX_H */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 26f0f9b4658b20..1fd06ef6a19454 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -20,7 +20,6 @@
 #include <linux/pgtable.h>
 #include <asm-generic/iomap.h>
 
-#ifdef __KERNEL__
 #define __IO_PREFIX     generic
 #include <asm/io_generic.h>
 #include <asm/io_trapped.h>
@@ -380,6 +379,4 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
 int valid_phys_addr_range(phys_addr_t addr, size_t size);
 int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_IO_H */
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
index 48e67d544d53cf..f664e51e8a15e5 100644
--- a/arch/sh/include/asm/mmu_context.h
+++ b/arch/sh/include/asm/mmu_context.h
@@ -8,7 +8,6 @@
 #ifndef __ASM_SH_MMU_CONTEXT_H
 #define __ASM_SH_MMU_CONTEXT_H
 
-#ifdef __KERNEL__
 #include <cpu/mmu_context.h>
 #include <asm/tlbflush.h>
 #include <linux/uaccess.h>
@@ -177,5 +176,4 @@ static inline void disable_mmu(void)
 #define disable_mmu()	do { } while (0)
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_MMU_CONTEXT_H */
diff --git a/arch/sh/include/asm/mmzone.h b/arch/sh/include/asm/mmzone.h
index cbaee1d1b67320..6552a088dc97ae 100644
--- a/arch/sh/include/asm/mmzone.h
+++ b/arch/sh/include/asm/mmzone.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_MMZONE_H
 #define __ASM_SH_MMZONE_H
 
-#ifdef __KERNEL__
-
 #ifdef CONFIG_NEED_MULTIPLE_NODES
 #include <linux/numa.h>
 
@@ -44,5 +42,4 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
 /* arch/sh/mm/init.c */
 void __init allocate_pgdat(unsigned int nid);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_MMZONE_H */
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 10a36b1cf2eab1..ad22e88c6657dc 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_PCI_H
 #define __ASM_SH_PCI_H
 
-#ifdef __KERNEL__
-
 /* Can be used to override the logic in pci_scan_bus for skipping
    already-configured bus numbers - to be used for buggy BIOSes
    or architectures with incomplete PCI setup by the loader */
@@ -96,6 +94,4 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_PCI_H */
-
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index d44409413418a5..aa92cc933889df 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -8,7 +8,6 @@
 
 #ifndef __ASM_SH_PROCESSOR_32_H
 #define __ASM_SH_PROCESSOR_32_H
-#ifdef __KERNEL__
 
 #include <linux/compiler.h>
 #include <linux/linkage.h>
@@ -203,5 +202,4 @@ static inline void prefetchw(const void *x)
 }
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_PROCESSOR_32_H */
diff --git a/arch/sh/include/asm/sparsemem.h b/arch/sh/include/asm/sparsemem.h
index 4eb899751e4590..ed287c4980bcab 100644
--- a/arch/sh/include/asm/sparsemem.h
+++ b/arch/sh/include/asm/sparsemem.h
@@ -2,7 +2,6 @@
 #ifndef __ASM_SH_SPARSEMEM_H
 #define __ASM_SH_SPARSEMEM_H
 
-#ifdef __KERNEL__
 /*
  * SECTION_SIZE_BITS		2^N: how big each section will be
  * MAX_PHYSADDR_BITS		2^N: how much physical address space we have
@@ -12,6 +11,4 @@
 #define MAX_PHYSADDR_BITS	32
 #define MAX_PHYSMEM_BITS	32
 
-#endif
-
 #endif /* __ASM_SH_SPARSEMEM_H */
diff --git a/arch/sh/include/asm/string_32.h b/arch/sh/include/asm/string_32.h
index 3558b1d7123e9c..778589e4a99dbb 100644
--- a/arch/sh/include/asm/string_32.h
+++ b/arch/sh/include/asm/string_32.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_STRING_H
 #define __ASM_SH_STRING_H
 
-#ifdef __KERNEL__
-
 /*
  * Copyright (C) 1999 Niibe Yutaka
  * But consider these trivial functions to be public domain.
@@ -127,6 +125,4 @@ extern void *memchr(const void *__s, int __c, size_t __n);
 #define __HAVE_ARCH_STRLEN
 extern size_t strlen(const char *);
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_STRING_H */
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index 9f9faf63b48c2e..5c555b864fe092 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_SYSCALLS_32_H
 #define __ASM_SH_SYSCALLS_32_H
 
-#ifdef __KERNEL__
-
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <linux/types.h>
@@ -26,5 +24,4 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
 asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
 				 unsigned long thread_info_flags);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_SYSCALLS_32_H */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 6404be69d5fa6b..243ea5150aa00b 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -10,8 +10,6 @@
  *  Copyright (C) 2002  David Howells (dhowells@redhat.com)
  *  - Incorporating suggestions made by Linus Torvalds and Dave Miller
  */
-#ifdef __KERNEL__
-
 #include <asm/page.h>
 
 /*
@@ -170,7 +168,4 @@ static inline unsigned int get_thread_fault_code(void)
 }
 
 #endif	/* !__ASSEMBLY__ */
-
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_THREAD_INFO_H */
diff --git a/arch/sh/include/asm/watchdog.h b/arch/sh/include/asm/watchdog.h
index cecd0fc507f938..b9ca4c99f046a6 100644
--- a/arch/sh/include/asm/watchdog.h
+++ b/arch/sh/include/asm/watchdog.h
@@ -8,7 +8,6 @@
  */
 #ifndef __ASM_SH_WATCHDOG_H
 #define __ASM_SH_WATCHDOG_H
-#ifdef __KERNEL__
 
 #include <linux/types.h>
 #include <linux/io.h>
@@ -157,5 +156,4 @@ static inline void sh_wdt_write_csr(__u8 val)
 	__raw_writew((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
 }
 #endif /* CONFIG_CPU_SUBTYPE_SH7785 || CONFIG_CPU_SUBTYPE_SH7780 */
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_WATCHDOG_H */
-- 
2.26.2

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

* [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h>
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
                     ` (2 preceding siblings ...)
  2020-06-26  8:07   ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

ioremap_fixed is an internal implementation detail and should not be
exposed to drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h   | 16 ----------------
 arch/sh/mm/init.c          |  1 +
 arch/sh/mm/ioremap.c       |  1 +
 arch/sh/mm/ioremap.h       | 23 +++++++++++++++++++++++
 arch/sh/mm/ioremap_fixed.c |  1 +
 5 files changed, 26 insertions(+), 16 deletions(-)
 create mode 100644 arch/sh/mm/ioremap.h

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 1fd06ef6a19454..357a7e0c86d682 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -346,22 +346,6 @@ ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
 }
 #endif
 
-#ifdef CONFIG_IOREMAP_FIXED
-extern void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t);
-extern int iounmap_fixed(void __iomem *);
-extern void ioremap_fixed_init(void);
-#else
-static inline void __iomem *
-ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
-{
-	BUG();
-	return NULL;
-}
-
-static inline void ioremap_fixed_init(void) { }
-static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
-#endif
-
 #define ioremap_uc	ioremap
 
 /*
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index a70ba0fdd0b382..da7ea48f9439e2 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -28,6 +28,7 @@
 #include <asm/setup.h>
 #include <asm/cache.h>
 #include <linux/sizes.h>
+#include "ioremap.h"
 
 pgd_t swapper_pg_dir[PTRS_PER_PGD];
 
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index f6d02246d665bd..d9ec85b6bb2130 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -24,6 +24,7 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu.h>
+#include "ioremap.h"
 
 /*
  * Remap an arbitrary physical address space into the kernel virtual
diff --git a/arch/sh/mm/ioremap.h b/arch/sh/mm/ioremap.h
new file mode 100644
index 00000000000000..f2544e721a3526
--- /dev/null
+++ b/arch/sh/mm/ioremap.h
@@ -0,0 +1,23 @@
+#ifndef _SH_MM_IORMEMAP_H
+#define _SH_MM_IORMEMAP_H 1
+
+#ifdef CONFIG_IOREMAP_FIXED
+void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t);
+int iounmap_fixed(void __iomem *);
+void ioremap_fixed_init(void);
+#else
+static inline void __iomem *
+ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
+{
+	BUG();
+	return NULL;
+}
+static inline void ioremap_fixed_init(void)
+{
+}
+static inline int iounmap_fixed(void __iomem *addr)
+{
+	return -EINVAL;
+}
+#endif /* CONFIG_IOREMAP_FIXED */
+#endif /* _SH_MM_IORMEMAP_H */
diff --git a/arch/sh/mm/ioremap_fixed.c b/arch/sh/mm/ioremap_fixed.c
index 07e744d75fa01b..1914b79d1c530b 100644
--- a/arch/sh/mm/ioremap_fixed.c
+++ b/arch/sh/mm/ioremap_fixed.c
@@ -24,6 +24,7 @@
 #include <asm/tlbflush.h>
 #include <asm/mmu.h>
 #include <asm/mmu_context.h>
+#include "ioremap.h"
 
 struct ioremap_map {
 	void __iomem *addr;
-- 
2.26.2

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

* [PATCH 05/10] sh: move the ioremap implementation out of line
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
                     ` (3 preceding siblings ...)
  2020-06-26  8:07   ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Move the internal implementation details of ioremap out of line, no need
to expose any of this to drivers for a slow path API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h | 101 ++++++---------------------------------
 arch/sh/mm/ioremap.c     |  53 ++++++++++++++++++++
 2 files changed, 68 insertions(+), 86 deletions(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 357a7e0c86d682..da08a61a2f7dae 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -242,109 +242,38 @@ unsigned long long poke_real_address_q(unsigned long long addr,
 #define phys_to_virt(address)	(__va(address))
 #endif
 
-/*
- * On 32-bit SH, we traditionally have the whole physical address space
- * mapped at all times (as MIPS does), so "ioremap()" and "iounmap()" do
- * not need to do anything but place the address in the proper segment.
- * This is true for P1 and P2 addresses, as well as some P3 ones.
- * However, most of the P3 addresses and newer cores using extended
- * addressing need to map through page tables, so the ioremap()
- * implementation becomes a bit more complicated.
- *
- * See arch/sh/mm/ioremap.c for additional notes on this.
- *
- * We cheat a bit and always return uncachable areas until we've fixed
- * the drivers to handle caching properly.
- *
- * On the SH-5 the concept of segmentation in the 1:1 PXSEG sense simply
- * doesn't exist, so everything must go through page tables.
- */
 #ifdef CONFIG_MMU
+void iounmap(void __iomem *addr);
 void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size,
 			       pgprot_t prot, void *caller);
-void iounmap(void __iomem *addr);
-
-static inline void __iomem *
-__ioremap(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-	return __ioremap_caller(offset, size, prot, __builtin_return_address(0));
-}
-
-static inline void __iomem *
-__ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-#ifdef CONFIG_29BIT
-	phys_addr_t last_addr = offset + size - 1;
-
-	/*
-	 * For P1 and P2 space this is trivial, as everything is already
-	 * mapped. Uncached access for P1 addresses are done through P2.
-	 * In the P3 case or for addresses outside of the 29-bit space,
-	 * mapping must be done by the PMB or by using page tables.
-	 */
-	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
-		u64 flags = pgprot_val(prot);
-
-		/*
-		 * Anything using the legacy PTEA space attributes needs
-		 * to be kicked down to page table mappings.
-		 */
-		if (unlikely(flags & _PAGE_PCC_MASK))
-			return NULL;
-		if (unlikely(flags & _PAGE_CACHABLE))
-			return (void __iomem *)P1SEGADDR(offset);
-
-		return (void __iomem *)P2SEGADDR(offset);
-	}
-
-	/* P4 above the store queues are always mapped. */
-	if (unlikely(offset >= P3_ADDR_MAX))
-		return (void __iomem *)P4SEGADDR(offset);
-#endif
-
-	return NULL;
-}
-
-static inline void __iomem *
-__ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-	void __iomem *ret;
-
-	ret = __ioremap_trapped(offset, size);
-	if (ret)
-		return ret;
-
-	ret = __ioremap_29bit(offset, size, prot);
-	if (ret)
-		return ret;
-
-	return __ioremap(offset, size, prot);
-}
-#else
-#define __ioremap(offset, size, prot)		((void __iomem *)(offset))
-#define __ioremap_mode(offset, size, prot)	((void __iomem *)(offset))
-static inline void iounmap(void __iomem *addr) {}
-#endif /* CONFIG_MMU */
 
 static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
 {
-	return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE);
+	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_mode(offset, size, PAGE_KERNEL);
+	return __ioremap_caller(offset, size, PAGE_KERNEL,
+			__builtin_return_address(0));
 }
 #define ioremap_cache ioremap_cache
 
 #ifdef CONFIG_HAVE_IOREMAP_PROT
-static inline void __iomem *
-ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
+static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
+		unsigned long flags)
 {
-	return __ioremap_mode(offset, size, __pgprot(flags));
+	return __ioremap_caller(offset, size, __pgprot(flags),
+			__builtin_return_address(0));
 }
-#endif
+#endif /* CONFIG_HAVE_IOREMAP_PROT */
+
+#else /* CONFIG_MMU */
+#define iounmap(addr)		do { } while (0)
+#define ioremap(offset, size)	((void __iomem *)(unsigned long)(offset))
+#endif /* CONFIG_MMU */
 
 #define ioremap_uc	ioremap
 
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index d9ec85b6bb2130..69e55939e48a6f 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -26,6 +26,51 @@
 #include <asm/mmu.h>
 #include "ioremap.h"
 
+/*
+ * On 32-bit SH, we traditionally have the whole physical address space mapped
+ * at all times (as MIPS does), so "ioremap()" and "iounmap()" do not need to do
+ * anything but place the address in the proper segment.  This is true for P1
+ * and P2 addresses, as well as some P3 ones.  However, most of the P3 addresses
+ * and newer cores using extended addressing need to map through page tables, so
+ * the ioremap() implementation becomes a bit more complicated.
+ */
+#ifdef CONFIG_29BIT
+static void __iomem *
+__ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
+{
+	phys_addr_t last_addr = offset + size - 1;
+
+	/*
+	 * For P1 and P2 space this is trivial, as everything is already
+	 * mapped. Uncached access for P1 addresses are done through P2.
+	 * In the P3 case or for addresses outside of the 29-bit space,
+	 * mapping must be done by the PMB or by using page tables.
+	 */
+	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
+		u64 flags = pgprot_val(prot);
+
+		/*
+		 * Anything using the legacy PTEA space attributes needs
+		 * to be kicked down to page table mappings.
+		 */
+		if (unlikely(flags & _PAGE_PCC_MASK))
+			return NULL;
+		if (unlikely(flags & _PAGE_CACHABLE))
+			return (void __iomem *)P1SEGADDR(offset);
+
+		return (void __iomem *)P2SEGADDR(offset);
+	}
+
+	/* P4 above the store queues are always mapped. */
+	if (unlikely(offset >= P3_ADDR_MAX))
+		return (void __iomem *)P4SEGADDR(offset);
+
+	return NULL;
+}
+#else
+#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
@@ -43,6 +88,14 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
 	unsigned long offset, last_addr, addr, orig_addr;
 	void __iomem *mapped;
 
+	mapped = __ioremap_trapped(phys_addr, size);
+	if (mapped)
+		return mapped;
+
+	mapped = __ioremap_29bit(phys_addr, size, pgprot);
+	if (mapped)
+		return mapped;
+
 	/* Don't allow wraparound or zero size */
 	last_addr = phys_addr + size - 1;
 	if (!size || last_addr < phys_addr)
-- 
2.26.2

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

* [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h>
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
                     ` (4 preceding siblings ...)
  2020-06-26  8:07   ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

No need to expose the details of trapped I/O to drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h | 1 -
 arch/sh/kernel/ioport.c  | 1 +
 arch/sh/mm/ioremap.c     | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index da08a61a2f7dae..873f1399fa5962 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -22,7 +22,6 @@
 
 #define __IO_PREFIX     generic
 #include <asm/io_generic.h>
-#include <asm/io_trapped.h>
 #include <asm-generic/pci_iomap.h>
 #include <mach/mangle-port.h>
 
diff --git a/arch/sh/kernel/ioport.c b/arch/sh/kernel/ioport.c
index 34f8cdbbcf0bee..f39446a658bdb8 100644
--- a/arch/sh/kernel/ioport.c
+++ b/arch/sh/kernel/ioport.c
@@ -7,6 +7,7 @@
  */
 #include <linux/module.h>
 #include <linux/io.h>
+#include <asm/io_trapped.h>
 
 unsigned long sh_io_port_base __read_mostly = -1;
 EXPORT_SYMBOL(sh_io_port_base);
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index 69e55939e48a6f..21342581144dee 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -18,6 +18,7 @@
 #include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/io.h>
+#include <asm/io_trapped.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/addrspace.h>
-- 
2.26.2

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

* [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
                     ` (5 preceding siblings ...)
  2020-06-26  8:07   ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Both functions are only used by compiled in core code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/kernel/io_trapped.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 037aab2708b7ac..004ad0130b1038 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -102,7 +102,6 @@ int register_trapped_io(struct trapped_io *tiop)
 	pr_warn("unable to install trapped io filter\n");
 	return -1;
 }
-EXPORT_SYMBOL_GPL(register_trapped_io);
 
 void __iomem *match_trapped_io_handler(struct list_head *list,
 				       unsigned long offset,
@@ -131,7 +130,6 @@ void __iomem *match_trapped_io_handler(struct list_head *list,
 	spin_unlock_irqrestore(&trapped_lock, flags);
 	return NULL;
 }
-EXPORT_SYMBOL_GPL(match_trapped_io_handler);
 
 static struct trapped_io *lookup_tiop(unsigned long address)
 {
-- 
2.26.2

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

* [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
                     ` (6 preceding siblings ...)
  2020-06-26  8:07   ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
  2020-06-26  8:07   ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Have a single definition that architetures can select.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig         | 4 +---
 arch/m68k/Kconfig.machine | 1 +
 arch/um/Kconfig           | 4 +---
 kernel/dma/Kconfig        | 3 +++
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 6ad6cdac74b3dc..8e488369a7e55a 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -17,6 +17,7 @@ config M68K
 	select HAVE_COPY_THREAD_TLS
 	select GENERIC_IRQ_SHOW
 	select GENERIC_ATOMIC64
+	select NO_DMA if !MMU && !COLDFIRE
 	select HAVE_UID16
 	select VIRT_TO_BUS
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
@@ -60,9 +61,6 @@ config TIME_LOW_RES
 config NO_IOPORT_MAP
 	def_bool y
 
-config NO_DMA
-	def_bool (MMU && SUN3) || (!MMU && !COLDFIRE)
-
 config ZONE_DMA
 	bool
 	default y
diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index a82651d58af483..17e8c3a292d770 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -126,6 +126,7 @@ config SUN3
 	depends on MMU
 	depends on !MMU_MOTOROLA
 	select MMU_SUN3 if MMU
+	select NO_DMA
 	select M68020
 	help
 	  This option enables support for the Sun 3 series of workstations
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 9318dc6d1a0cee..32c1d1945033ec 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -15,6 +15,7 @@ config UML
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DEBUG_BUGVERBOSE
 	select HAVE_COPY_THREAD_TLS
+	select NO_DMA
 	select GENERIC_IRQ_SHOW
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
@@ -168,9 +169,6 @@ config MMAPPER
 	  This driver allows a host file to be used as emulated IO memory inside
 	  UML.
 
-config NO_DMA
-	def_bool y
-
 config PGTABLE_LEVELS
 	int
 	default 3 if 3_LEVEL_PGTABLES
diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
index a0ce3c1494fdd2..cb05247804d9f3 100644
--- a/kernel/dma/Kconfig
+++ b/kernel/dma/Kconfig
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+config NO_DMA
+	bool
+
 config HAS_DMA
 	bool
 	depends on !NO_DMA
-- 
2.26.2

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

* [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
                     ` (7 preceding siblings ...)
  2020-06-26  8:07   ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  2020-06-28  0:53     ` Rob Landley
  2020-06-26  8:07   ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
  9 siblings, 1 reply; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

The code handling non-coherent DMA depends on being able to remap code
as non-cached.  But that can't be done without an MMU, so using this
option on NOMMU builds is broken.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index f8027eee08edae..337eb496c45a0a 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -61,6 +61,7 @@ config SUPERH
 	select MAY_HAVE_SPARSE_IRQ
 	select MODULES_USE_ELF_RELA
 	select NEED_SG_DMA_LENGTH
+	select NO_DMA if !MMU && !DMA_COHERENT
 	select NO_GENERIC_PCI_IOPORT_MAP if PCI
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND
@@ -135,7 +136,7 @@ config DMA_COHERENT
 	bool
 
 config DMA_NONCOHERENT
-	def_bool !DMA_COHERENT
+	def_bool !NO_DMA && !DMA_COHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 
 config PGTABLE_LEVELS
-- 
2.26.2

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

* [PATCH 10/10] sh: use the generic dma coherent remap allocator
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
                     ` (8 preceding siblings ...)
  2020-06-26  8:07   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
@ 2020-06-26  8:07   ` Christoph Hellwig
  9 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-26  8:07 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

This switches to using common code for the DMA allocations, including
potential use of the CMA allocator if configured.

Switching to the generic code enables DMA allocations from atomic
context, which is required by the DMA API documentation, and also
adds various other minor features drivers start relying upon.  It
also makes sure we have on tested code base for all architectures
that require uncached pte bits for coherent DMA allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig               |  2 ++
 arch/sh/kernel/dma-coherent.c | 51 ++---------------------------------
 2 files changed, 4 insertions(+), 49 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 337eb496c45a0a..32d959849df9bc 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -137,7 +137,9 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !NO_DMA && !DMA_COHERENT
+	select ARCH_HAS_DMA_PREP_COHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_DIRECT_REMAP
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/kernel/dma-coherent.c b/arch/sh/kernel/dma-coherent.c
index d4811691b93cc1..cd46a9825e3c59 100644
--- a/arch/sh/kernel/dma-coherent.c
+++ b/arch/sh/kernel/dma-coherent.c
@@ -3,60 +3,13 @@
  * Copyright (C) 2004 - 2007  Paul Mundt
  */
 #include <linux/mm.h>
-#include <linux/init.h>
 #include <linux/dma-noncoherent.h>
-#include <linux/module.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
-		gfp_t gfp, unsigned long attrs)
+void arch_dma_prep_coherent(struct page *page, size_t size)
 {
-	void *ret, *ret_nocache;
-	int order = get_order(size);
-
-	gfp |= __GFP_ZERO;
-
-	ret = (void *)__get_free_pages(gfp, order);
-	if (!ret)
-		return NULL;
-
-	/*
-	 * Pages from the page allocator may have data present in
-	 * cache. So flush the cache before using uncached memory.
-	 */
-	arch_sync_dma_for_device(virt_to_phys(ret), size,
-			DMA_BIDIRECTIONAL);
-
-	ret_nocache = (void __force *)ioremap(virt_to_phys(ret), size);
-	if (!ret_nocache) {
-		free_pages((unsigned long)ret, order);
-		return NULL;
-	}
-
-	split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order);
-
-	*dma_handle = virt_to_phys(ret);
-	if (!WARN_ON(!dev))
-		*dma_handle -= PFN_PHYS(dev->dma_pfn_offset);
-
-	return ret_nocache;
-}
-
-void arch_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs)
-{
-	int order = get_order(size);
-	unsigned long pfn = (dma_handle >> PAGE_SHIFT);
-	int k;
-
-	if (!WARN_ON(!dev))
-		pfn += dev->dma_pfn_offset;
-
-	for (k = 0; k < (1 << order); k++)
-		__free_pages(pfn_to_page(pfn + k), 0);
-
-	iounmap(vaddr);
+	__flush_purge_region(page_address(page), size);
 }
 
 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
-- 
2.26.2

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-06-26  8:07   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
@ 2020-06-28  0:53     ` Rob Landley
  2020-06-28  7:24       ` Christoph Hellwig
  0 siblings, 1 reply; 81+ messages in thread
From: Rob Landley @ 2020-06-28  0:53 UTC (permalink / raw)
  To: Christoph Hellwig, Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

On 6/26/20 3:07 AM, Christoph Hellwig wrote:
> The code handling non-coherent DMA depends on being able to remap code
> as non-cached.  But that can't be done without an MMU, so using this
> option on NOMMU builds is broken.

I'm working on a nommu j-core board that's doing DMA behind the OS's back at the
moment, which I have a todo item to teach the kernel about. The DMA does not go
through the cache, there's currently a cache flush before looking at the result
instead.

How should this be wired up after your patch?

Rob

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-06-28  0:53     ` Rob Landley
@ 2020-06-28  7:24       ` Christoph Hellwig
  0 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-06-28  7:24 UTC (permalink / raw)
  To: Rob Landley
  Cc: Christoph Hellwig, Yoshinori Sato, Rich Felker, linux-sh, linux-kernel

On Sat, Jun 27, 2020 at 08:01:17PM -0500, Rob Landley wrote:
> On 6/26/20 3:07 AM, Christoph Hellwig wrote:
> > The code handling non-coherent DMA depends on being able to remap code
> > as non-cached.  But that can't be done without an MMU, so using this
> > option on NOMMU builds is broken.
> 
> I'm working on a nommu j-core board that's doing DMA behind the OS's back at the
> moment, which I have a todo item to teach the kernel about. The DMA does not go
> through the cache, there's currently a cache flush before looking at the result
> instead.
> 
> How should this be wired up after your patch?

The problem with nommu and non-coherent dma is the dma_alloc_coherent
calls.  Most platforms with an mmu set a nocache bit through the page
tables (including sh), but that option obviously doesn't exist for
nommu.  Some hardware has an uncached window where access is uncached
automatically if access through specific kernel virtual addresses,
for that the architecture needs to impement the arch_dma_set_uncached
helper and select CONFIG_ARCH_HAS_DMA_SET_UNCACHED.  If that also
doesn't exist you'll need some sort of pool of always uncached
memory (set by the firmware or early startup code).  That currently
doesn't exist in generic code, but we have a bunch of architectures
implementing that in arch_dma_alloc.  I plan to have a common
implementation of the pool soon hopefully.

Streaming DMA just works if you reuse the existing
arch_sync_dma_for_device implementation.

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

* ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
                   ` (10 preceding siblings ...)
  2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
@ 2020-07-14 12:18 ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
                     ` (10 more replies)
  11 siblings, 11 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Hi Yoshinori and Rich,

can you take a look and possibly pick up the series below that untangles
and sorts out minor issues with the sh ioremap and dma code?

I sent this out a few times, but never got an answer.  If you don't
want to pick up the series I can also take it through one of my trees
if I get ACKs.

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

* [PATCH 01/10] sh: remove -Werror from Makefiles
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

The sh build is full of warnings when building with gcc 9.2.1.  While
fixing those would be great, at least avoid failing the build.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/kernel/Makefile | 2 --
 arch/sh/lib/Makefile    | 2 --
 arch/sh/mm/Makefile     | 2 --
 3 files changed, 6 deletions(-)

diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index b0f5574b6228b3..aa0fbc9202b14e 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -47,5 +47,3 @@ obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
 obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-coherent.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
-
-ccflags-y := -Werror
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index d0abbe5e38b0f3..eb473d373ca43a 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -30,5 +30,3 @@ memset-$(CONFIG_CPU_SH4)	:= memset-sh4.o
 lib-$(CONFIG_MMU)		+= copy_page.o __clear_user.o
 lib-$(CONFIG_MCOUNT)		+= mcount.o
 lib-y				+= $(memcpy-y) $(memset-y) $(udivsi3-y)
-
-ccflags-y := -Werror
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index 487da0ff03b3a7..f69ddc70b14658 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -43,5 +43,3 @@ obj-$(CONFIG_UNCACHED_MAPPING)	+= uncached.o
 obj-$(CONFIG_HAVE_SRAM_POOL)	+= sram.o
 
 GCOV_PROFILE_pmb.o := n
-
-ccflags-y := -Werror
-- 
2.26.2

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

* [PATCH 02/10] sh: sort the selects for SUPERH alphabetically
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Ensure there is an order for the selects.  Also remove a duplicate
one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig | 95 ++++++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 48 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9fc2b010e938c9..f8027eee08edae 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -1,75 +1,74 @@
 # SPDX-License-Identifier: GPL-2.0
 config SUPERH
 	def_bool y
+	select ARCH_32BIT_OFF_T
+	select ARCH_HAVE_CUSTOM_GPIO_H
+	select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
 	select ARCH_HAS_BINFMT_FLAT if !MMU
+	select ARCH_HAS_GIGANTIC_PAGE
+	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
-	select HAVE_PATA_PLATFORM
+	select ARCH_WANT_IPC_PARSE_VERSION
 	select CLKDEV_LOOKUP
+	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
-	select HAVE_IDE if HAS_IOPORT_MAP
-	select HAVE_OPROFILE
+	select GENERIC_ATOMIC64
+	select GENERIC_CLOCKEVENTS
+	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
+	select GENERIC_IDLE_POLL_SETUP
+	select GENERIC_IRQ_SHOW
+	select GENERIC_PCI_IOMAP if PCI
+	select GENERIC_SCHED_CLOCK
+	select GENERIC_STRNCPY_FROM_USER
+	select GENERIC_STRNLEN_USER
+	select GENERIC_SMP_IDLE_THREAD
+	select GUP_GET_PTE_LOW_HIGH if X2TLB
+	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_TRACEHOOK
-	select HAVE_PERF_EVENTS
 	select HAVE_DEBUG_BUGVERBOSE
-	select HAVE_FAST_GUP if MMU
-	select ARCH_HAVE_CUSTOM_GPIO_H
-	select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
-	select ARCH_HAS_GCOV_PROFILE_ALL
-	select PERF_USE_VMALLOC
 	select HAVE_DEBUG_KMEMLEAK
-	select HAVE_KERNEL_GZIP
-	select CPU_NO_EFFICIENT_FFS
+	select HAVE_DYNAMIC_FTRACE
+	select HAVE_FAST_GUP if MMU
+	select HAVE_FUNCTION_GRAPH_TRACER
+	select HAVE_FUNCTION_TRACER
+	select HAVE_FUTEX_CMPXCHG if FUTEX
+	select HAVE_FTRACE_MCOUNT_RECORD
+	select HAVE_HW_BREAKPOINT
+	select HAVE_IDE if HAS_IOPORT_MAP
+	select HAVE_IOREMAP_PROT if MMU && !X2TLB
 	select HAVE_KERNEL_BZIP2
+	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZMA
-	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_LZO
+	select HAVE_KERNEL_XZ
+	select HAVE_KPROBES
+	select HAVE_KRETPROBES
+	select HAVE_MIXED_BREAKPOINTS_REGS
+	select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
+	select HAVE_NMI
+	select HAVE_OPROFILE
+	select HAVE_PATA_PLATFORM
+	select HAVE_PERF_EVENTS
+	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_UID16
-	select ARCH_WANT_IPC_PARSE_VERSION
+	select HAVE_STACKPROTECTOR
 	select HAVE_SYSCALL_TRACEPOINTS
-	select HAVE_REGS_AND_STACK_ACCESS_API
-	select MAY_HAVE_SPARSE_IRQ
 	select IRQ_FORCED_THREADING
-	select RTC_LIB
-	select GENERIC_ATOMIC64
-	select GENERIC_IRQ_SHOW
-	select GENERIC_SMP_IDLE_THREAD
-	select GENERIC_IDLE_POLL_SETUP
-	select GENERIC_CLOCKEVENTS
-	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
-	select GENERIC_PCI_IOMAP if PCI
-	select GENERIC_SCHED_CLOCK
-	select GENERIC_STRNCPY_FROM_USER
-	select GENERIC_STRNLEN_USER
-	select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
+	select MAY_HAVE_SPARSE_IRQ
 	select MODULES_USE_ELF_RELA
+	select NEED_SG_DMA_LENGTH
 	select NO_GENERIC_PCI_IOPORT_MAP if PCI
-	select OLD_SIGSUSPEND
 	select OLD_SIGACTION
+	select OLD_SIGSUSPEND
 	select PCI_DOMAINS if PCI
-	select HAVE_ARCH_AUDITSYSCALL
-	select HAVE_FUTEX_CMPXCHG if FUTEX
-	select HAVE_NMI
-	select NEED_SG_DMA_LENGTH
-	select ARCH_HAS_GIGANTIC_PAGE
-	select ARCH_32BIT_OFF_T
-	select GUP_GET_PTE_LOW_HIGH if X2TLB
-	select HAVE_KPROBES
-	select HAVE_KRETPROBES
-	select HAVE_IOREMAP_PROT if MMU && !X2TLB
-	select HAVE_FUNCTION_TRACER
-	select HAVE_FTRACE_MCOUNT_RECORD
-	select HAVE_DYNAMIC_FTRACE
-	select ARCH_WANT_IPC_PARSE_VERSION
-	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_ARCH_KGDB
-	select HAVE_HW_BREAKPOINT
-	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
-	select ARCH_HIBERNATION_POSSIBLE if MMU
+	select PERF_USE_VMALLOC
+	select RTC_LIB
 	select SPARSE_IRQ
-	select HAVE_STACKPROTECTOR
 	help
 	  The SuperH is a RISC processor targeted for use in embedded systems
 	  and consumer electronics; it was also used in the Sega Dreamcast
-- 
2.26.2

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

* [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

There is no point in having __KERNEL__ ifdefs in headers not exported to
userspace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/adc.h          | 2 --
 arch/sh/include/asm/addrspace.h    | 3 ---
 arch/sh/include/asm/bitops.h       | 4 ----
 arch/sh/include/asm/cache.h        | 2 --
 arch/sh/include/asm/cacheflush.h   | 3 ---
 arch/sh/include/asm/dma.h          | 2 --
 arch/sh/include/asm/elf.h          | 2 --
 arch/sh/include/asm/freq.h         | 2 --
 arch/sh/include/asm/futex.h        | 3 ---
 arch/sh/include/asm/io.h           | 3 ---
 arch/sh/include/asm/mmu_context.h  | 2 --
 arch/sh/include/asm/mmzone.h       | 3 ---
 arch/sh/include/asm/pci.h          | 4 ----
 arch/sh/include/asm/processor_32.h | 2 --
 arch/sh/include/asm/sparsemem.h    | 3 ---
 arch/sh/include/asm/string_32.h    | 4 ----
 arch/sh/include/asm/syscalls_32.h  | 3 ---
 arch/sh/include/asm/thread_info.h  | 5 -----
 arch/sh/include/asm/watchdog.h     | 2 --
 19 files changed, 54 deletions(-)

diff --git a/arch/sh/include/asm/adc.h b/arch/sh/include/asm/adc.h
index 99ec668495594c..feccfe639e3896 100644
--- a/arch/sh/include/asm/adc.h
+++ b/arch/sh/include/asm/adc.h
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __ASM_ADC_H
 #define __ASM_ADC_H
-#ifdef __KERNEL__
 /*
  * Copyright (C) 2004  Andriy Skulysh
  */
@@ -10,5 +9,4 @@
 
 int adc_single(unsigned int channel);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_ADC_H */
diff --git a/arch/sh/include/asm/addrspace.h b/arch/sh/include/asm/addrspace.h
index 34bfbcddcce027..468fba333e896b 100644
--- a/arch/sh/include/asm/addrspace.h
+++ b/arch/sh/include/asm/addrspace.h
@@ -7,8 +7,6 @@
 #ifndef __ASM_SH_ADDRSPACE_H
 #define __ASM_SH_ADDRSPACE_H
 
-#ifdef __KERNEL__
-
 #include <cpu/addrspace.h>
 
 /* If this CPU supports segmentation, hook up the helpers */
@@ -62,5 +60,4 @@
 #define P3_ADDR_MAX		P4SEG
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h
index 445dd14c448a67..450b5854d7c67b 100644
--- a/arch/sh/include/asm/bitops.h
+++ b/arch/sh/include/asm/bitops.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_BITOPS_H
 #define __ASM_SH_BITOPS_H
 
-#ifdef __KERNEL__
-
 #ifndef _LINUX_BITOPS_H
 #error only <linux/bitops.h> can be included directly
 #endif
@@ -71,6 +69,4 @@ static inline unsigned long __ffs(unsigned long word)
 #include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls64.h>
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_BITOPS_H */
diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
index 2408ac4873aa00..a293343456affe 100644
--- a/arch/sh/include/asm/cache.h
+++ b/arch/sh/include/asm/cache.h
@@ -8,7 +8,6 @@
  */
 #ifndef __ASM_SH_CACHE_H
 #define __ASM_SH_CACHE_H
-#ifdef __KERNEL__
 
 #include <linux/init.h>
 #include <cpu/cache.h>
@@ -44,5 +43,4 @@ struct cache_info {
 	unsigned long flags;
 };
 #endif /* __ASSEMBLY__ */
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHE_H */
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index fe7400079b97b0..4486a865ff62f6 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_CACHEFLUSH_H
 #define __ASM_SH_CACHEFLUSH_H
 
-#ifdef __KERNEL__
-
 #include <linux/mm.h>
 
 /*
@@ -109,5 +107,4 @@ static inline void *sh_cacheop_vaddr(void *vaddr)
 	return vaddr;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
index 4d5a21a891c078..17d23ae98c77a4 100644
--- a/arch/sh/include/asm/dma.h
+++ b/arch/sh/include/asm/dma.h
@@ -6,7 +6,6 @@
  */
 #ifndef __ASM_SH_DMA_H
 #define __ASM_SH_DMA_H
-#ifdef __KERNEL__
 
 #include <linux/spinlock.h>
 #include <linux/wait.h>
@@ -144,5 +143,4 @@ extern int isa_dma_bridge_buggy;
 #define isa_dma_bridge_buggy	(0)
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_DMA_H */
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index 7661fb5d548a08..2862d6d1cb64f1 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -90,7 +90,6 @@ typedef struct user_fpu_struct elf_fpregset_t;
 #endif
 #define ELF_ARCH	EM_SH
 
-#ifdef __KERNEL__
 /*
  * This is used to ensure we don't load something for the wrong architecture.
  */
@@ -209,5 +208,4 @@ do {								\
 	NEW_AUX_ENT(AT_L2_CACHESHAPE, l2_cache_shape);		\
 } while (0)
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_ELF_H */
diff --git a/arch/sh/include/asm/freq.h b/arch/sh/include/asm/freq.h
index 18133bf837386b..87c23621b7ae81 100644
--- a/arch/sh/include/asm/freq.h
+++ b/arch/sh/include/asm/freq.h
@@ -6,9 +6,7 @@
  */
 #ifndef __ASM_SH_FREQ_H
 #define __ASM_SH_FREQ_H
-#ifdef __KERNEL__
 
 #include <cpu/freq.h>
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_FREQ_H */
diff --git a/arch/sh/include/asm/futex.h b/arch/sh/include/asm/futex.h
index b39cda09fb95cc..b70f3fce6ed77a 100644
--- a/arch/sh/include/asm/futex.h
+++ b/arch/sh/include/asm/futex.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_FUTEX_H
 #define __ASM_SH_FUTEX_H
 
-#ifdef __KERNEL__
-
 #include <linux/futex.h>
 #include <linux/uaccess.h>
 #include <asm/errno.h>
@@ -71,5 +69,4 @@ static inline int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval,
 	return ret;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_FUTEX_H */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 26f0f9b4658b20..1fd06ef6a19454 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -20,7 +20,6 @@
 #include <linux/pgtable.h>
 #include <asm-generic/iomap.h>
 
-#ifdef __KERNEL__
 #define __IO_PREFIX     generic
 #include <asm/io_generic.h>
 #include <asm/io_trapped.h>
@@ -380,6 +379,4 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
 int valid_phys_addr_range(phys_addr_t addr, size_t size);
 int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_IO_H */
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
index 48e67d544d53cf..f664e51e8a15e5 100644
--- a/arch/sh/include/asm/mmu_context.h
+++ b/arch/sh/include/asm/mmu_context.h
@@ -8,7 +8,6 @@
 #ifndef __ASM_SH_MMU_CONTEXT_H
 #define __ASM_SH_MMU_CONTEXT_H
 
-#ifdef __KERNEL__
 #include <cpu/mmu_context.h>
 #include <asm/tlbflush.h>
 #include <linux/uaccess.h>
@@ -177,5 +176,4 @@ static inline void disable_mmu(void)
 #define disable_mmu()	do { } while (0)
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_MMU_CONTEXT_H */
diff --git a/arch/sh/include/asm/mmzone.h b/arch/sh/include/asm/mmzone.h
index cbaee1d1b67320..6552a088dc97ae 100644
--- a/arch/sh/include/asm/mmzone.h
+++ b/arch/sh/include/asm/mmzone.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_MMZONE_H
 #define __ASM_SH_MMZONE_H
 
-#ifdef __KERNEL__
-
 #ifdef CONFIG_NEED_MULTIPLE_NODES
 #include <linux/numa.h>
 
@@ -44,5 +42,4 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
 /* arch/sh/mm/init.c */
 void __init allocate_pgdat(unsigned int nid);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_MMZONE_H */
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 10a36b1cf2eab1..ad22e88c6657dc 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_PCI_H
 #define __ASM_SH_PCI_H
 
-#ifdef __KERNEL__
-
 /* Can be used to override the logic in pci_scan_bus for skipping
    already-configured bus numbers - to be used for buggy BIOSes
    or architectures with incomplete PCI setup by the loader */
@@ -96,6 +94,4 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 	return channel ? 15 : 14;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_PCI_H */
-
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index d44409413418a5..aa92cc933889df 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -8,7 +8,6 @@
 
 #ifndef __ASM_SH_PROCESSOR_32_H
 #define __ASM_SH_PROCESSOR_32_H
-#ifdef __KERNEL__
 
 #include <linux/compiler.h>
 #include <linux/linkage.h>
@@ -203,5 +202,4 @@ static inline void prefetchw(const void *x)
 }
 #endif
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_PROCESSOR_32_H */
diff --git a/arch/sh/include/asm/sparsemem.h b/arch/sh/include/asm/sparsemem.h
index 4eb899751e4590..ed287c4980bcab 100644
--- a/arch/sh/include/asm/sparsemem.h
+++ b/arch/sh/include/asm/sparsemem.h
@@ -2,7 +2,6 @@
 #ifndef __ASM_SH_SPARSEMEM_H
 #define __ASM_SH_SPARSEMEM_H
 
-#ifdef __KERNEL__
 /*
  * SECTION_SIZE_BITS		2^N: how big each section will be
  * MAX_PHYSADDR_BITS		2^N: how much physical address space we have
@@ -12,6 +11,4 @@
 #define MAX_PHYSADDR_BITS	32
 #define MAX_PHYSMEM_BITS	32
 
-#endif
-
 #endif /* __ASM_SH_SPARSEMEM_H */
diff --git a/arch/sh/include/asm/string_32.h b/arch/sh/include/asm/string_32.h
index 3558b1d7123e9c..778589e4a99dbb 100644
--- a/arch/sh/include/asm/string_32.h
+++ b/arch/sh/include/asm/string_32.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_STRING_H
 #define __ASM_SH_STRING_H
 
-#ifdef __KERNEL__
-
 /*
  * Copyright (C) 1999 Niibe Yutaka
  * But consider these trivial functions to be public domain.
@@ -127,6 +125,4 @@ extern void *memchr(const void *__s, int __c, size_t __n);
 #define __HAVE_ARCH_STRLEN
 extern size_t strlen(const char *);
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_STRING_H */
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index 9f9faf63b48c2e..5c555b864fe092 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -2,8 +2,6 @@
 #ifndef __ASM_SH_SYSCALLS_32_H
 #define __ASM_SH_SYSCALLS_32_H
 
-#ifdef __KERNEL__
-
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <linux/types.h>
@@ -26,5 +24,4 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
 asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
 				 unsigned long thread_info_flags);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_SYSCALLS_32_H */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 6404be69d5fa6b..243ea5150aa00b 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -10,8 +10,6 @@
  *  Copyright (C) 2002  David Howells (dhowells@redhat.com)
  *  - Incorporating suggestions made by Linus Torvalds and Dave Miller
  */
-#ifdef __KERNEL__
-
 #include <asm/page.h>
 
 /*
@@ -170,7 +168,4 @@ static inline unsigned int get_thread_fault_code(void)
 }
 
 #endif	/* !__ASSEMBLY__ */
-
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_SH_THREAD_INFO_H */
diff --git a/arch/sh/include/asm/watchdog.h b/arch/sh/include/asm/watchdog.h
index cecd0fc507f938..b9ca4c99f046a6 100644
--- a/arch/sh/include/asm/watchdog.h
+++ b/arch/sh/include/asm/watchdog.h
@@ -8,7 +8,6 @@
  */
 #ifndef __ASM_SH_WATCHDOG_H
 #define __ASM_SH_WATCHDOG_H
-#ifdef __KERNEL__
 
 #include <linux/types.h>
 #include <linux/io.h>
@@ -157,5 +156,4 @@ static inline void sh_wdt_write_csr(__u8 val)
 	__raw_writew((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
 }
 #endif /* CONFIG_CPU_SUBTYPE_SH7785 || CONFIG_CPU_SUBTYPE_SH7780 */
-#endif /* __KERNEL__ */
 #endif /* __ASM_SH_WATCHDOG_H */
-- 
2.26.2

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

* [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h>
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (2 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

ioremap_fixed is an internal implementation detail and should not be
exposed to drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h   | 16 ----------------
 arch/sh/mm/init.c          |  1 +
 arch/sh/mm/ioremap.c       |  1 +
 arch/sh/mm/ioremap.h       | 23 +++++++++++++++++++++++
 arch/sh/mm/ioremap_fixed.c |  1 +
 5 files changed, 26 insertions(+), 16 deletions(-)
 create mode 100644 arch/sh/mm/ioremap.h

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 1fd06ef6a19454..357a7e0c86d682 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -346,22 +346,6 @@ ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
 }
 #endif
 
-#ifdef CONFIG_IOREMAP_FIXED
-extern void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t);
-extern int iounmap_fixed(void __iomem *);
-extern void ioremap_fixed_init(void);
-#else
-static inline void __iomem *
-ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
-{
-	BUG();
-	return NULL;
-}
-
-static inline void ioremap_fixed_init(void) { }
-static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
-#endif
-
 #define ioremap_uc	ioremap
 
 /*
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index a70ba0fdd0b382..da7ea48f9439e2 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -28,6 +28,7 @@
 #include <asm/setup.h>
 #include <asm/cache.h>
 #include <linux/sizes.h>
+#include "ioremap.h"
 
 pgd_t swapper_pg_dir[PTRS_PER_PGD];
 
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index f6d02246d665bd..d9ec85b6bb2130 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -24,6 +24,7 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu.h>
+#include "ioremap.h"
 
 /*
  * Remap an arbitrary physical address space into the kernel virtual
diff --git a/arch/sh/mm/ioremap.h b/arch/sh/mm/ioremap.h
new file mode 100644
index 00000000000000..f2544e721a3526
--- /dev/null
+++ b/arch/sh/mm/ioremap.h
@@ -0,0 +1,23 @@
+#ifndef _SH_MM_IORMEMAP_H
+#define _SH_MM_IORMEMAP_H 1
+
+#ifdef CONFIG_IOREMAP_FIXED
+void __iomem *ioremap_fixed(phys_addr_t, unsigned long, pgprot_t);
+int iounmap_fixed(void __iomem *);
+void ioremap_fixed_init(void);
+#else
+static inline void __iomem *
+ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
+{
+	BUG();
+	return NULL;
+}
+static inline void ioremap_fixed_init(void)
+{
+}
+static inline int iounmap_fixed(void __iomem *addr)
+{
+	return -EINVAL;
+}
+#endif /* CONFIG_IOREMAP_FIXED */
+#endif /* _SH_MM_IORMEMAP_H */
diff --git a/arch/sh/mm/ioremap_fixed.c b/arch/sh/mm/ioremap_fixed.c
index 07e744d75fa01b..1914b79d1c530b 100644
--- a/arch/sh/mm/ioremap_fixed.c
+++ b/arch/sh/mm/ioremap_fixed.c
@@ -24,6 +24,7 @@
 #include <asm/tlbflush.h>
 #include <asm/mmu.h>
 #include <asm/mmu_context.h>
+#include "ioremap.h"
 
 struct ioremap_map {
 	void __iomem *addr;
-- 
2.26.2

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

* [PATCH 05/10] sh: move the ioremap implementation out of line
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (3 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Move the internal implementation details of ioremap out of line, no need
to expose any of this to drivers for a slow path API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h | 101 ++++++---------------------------------
 arch/sh/mm/ioremap.c     |  53 ++++++++++++++++++++
 2 files changed, 68 insertions(+), 86 deletions(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 357a7e0c86d682..da08a61a2f7dae 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -242,109 +242,38 @@ unsigned long long poke_real_address_q(unsigned long long addr,
 #define phys_to_virt(address)	(__va(address))
 #endif
 
-/*
- * On 32-bit SH, we traditionally have the whole physical address space
- * mapped at all times (as MIPS does), so "ioremap()" and "iounmap()" do
- * not need to do anything but place the address in the proper segment.
- * This is true for P1 and P2 addresses, as well as some P3 ones.
- * However, most of the P3 addresses and newer cores using extended
- * addressing need to map through page tables, so the ioremap()
- * implementation becomes a bit more complicated.
- *
- * See arch/sh/mm/ioremap.c for additional notes on this.
- *
- * We cheat a bit and always return uncachable areas until we've fixed
- * the drivers to handle caching properly.
- *
- * On the SH-5 the concept of segmentation in the 1:1 PXSEG sense simply
- * doesn't exist, so everything must go through page tables.
- */
 #ifdef CONFIG_MMU
+void iounmap(void __iomem *addr);
 void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size,
 			       pgprot_t prot, void *caller);
-void iounmap(void __iomem *addr);
-
-static inline void __iomem *
-__ioremap(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-	return __ioremap_caller(offset, size, prot, __builtin_return_address(0));
-}
-
-static inline void __iomem *
-__ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-#ifdef CONFIG_29BIT
-	phys_addr_t last_addr = offset + size - 1;
-
-	/*
-	 * For P1 and P2 space this is trivial, as everything is already
-	 * mapped. Uncached access for P1 addresses are done through P2.
-	 * In the P3 case or for addresses outside of the 29-bit space,
-	 * mapping must be done by the PMB or by using page tables.
-	 */
-	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
-		u64 flags = pgprot_val(prot);
-
-		/*
-		 * Anything using the legacy PTEA space attributes needs
-		 * to be kicked down to page table mappings.
-		 */
-		if (unlikely(flags & _PAGE_PCC_MASK))
-			return NULL;
-		if (unlikely(flags & _PAGE_CACHABLE))
-			return (void __iomem *)P1SEGADDR(offset);
-
-		return (void __iomem *)P2SEGADDR(offset);
-	}
-
-	/* P4 above the store queues are always mapped. */
-	if (unlikely(offset >= P3_ADDR_MAX))
-		return (void __iomem *)P4SEGADDR(offset);
-#endif
-
-	return NULL;
-}
-
-static inline void __iomem *
-__ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot)
-{
-	void __iomem *ret;
-
-	ret = __ioremap_trapped(offset, size);
-	if (ret)
-		return ret;
-
-	ret = __ioremap_29bit(offset, size, prot);
-	if (ret)
-		return ret;
-
-	return __ioremap(offset, size, prot);
-}
-#else
-#define __ioremap(offset, size, prot)		((void __iomem *)(offset))
-#define __ioremap_mode(offset, size, prot)	((void __iomem *)(offset))
-static inline void iounmap(void __iomem *addr) {}
-#endif /* CONFIG_MMU */
 
 static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
 {
-	return __ioremap_mode(offset, size, PAGE_KERNEL_NOCACHE);
+	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_mode(offset, size, PAGE_KERNEL);
+	return __ioremap_caller(offset, size, PAGE_KERNEL,
+			__builtin_return_address(0));
 }
 #define ioremap_cache ioremap_cache
 
 #ifdef CONFIG_HAVE_IOREMAP_PROT
-static inline void __iomem *
-ioremap_prot(phys_addr_t offset, unsigned long size, unsigned long flags)
+static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
+		unsigned long flags)
 {
-	return __ioremap_mode(offset, size, __pgprot(flags));
+	return __ioremap_caller(offset, size, __pgprot(flags),
+			__builtin_return_address(0));
 }
-#endif
+#endif /* CONFIG_HAVE_IOREMAP_PROT */
+
+#else /* CONFIG_MMU */
+#define iounmap(addr)		do { } while (0)
+#define ioremap(offset, size)	((void __iomem *)(unsigned long)(offset))
+#endif /* CONFIG_MMU */
 
 #define ioremap_uc	ioremap
 
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index d9ec85b6bb2130..69e55939e48a6f 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -26,6 +26,51 @@
 #include <asm/mmu.h>
 #include "ioremap.h"
 
+/*
+ * On 32-bit SH, we traditionally have the whole physical address space mapped
+ * at all times (as MIPS does), so "ioremap()" and "iounmap()" do not need to do
+ * anything but place the address in the proper segment.  This is true for P1
+ * and P2 addresses, as well as some P3 ones.  However, most of the P3 addresses
+ * and newer cores using extended addressing need to map through page tables, so
+ * the ioremap() implementation becomes a bit more complicated.
+ */
+#ifdef CONFIG_29BIT
+static void __iomem *
+__ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
+{
+	phys_addr_t last_addr = offset + size - 1;
+
+	/*
+	 * For P1 and P2 space this is trivial, as everything is already
+	 * mapped. Uncached access for P1 addresses are done through P2.
+	 * In the P3 case or for addresses outside of the 29-bit space,
+	 * mapping must be done by the PMB or by using page tables.
+	 */
+	if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
+		u64 flags = pgprot_val(prot);
+
+		/*
+		 * Anything using the legacy PTEA space attributes needs
+		 * to be kicked down to page table mappings.
+		 */
+		if (unlikely(flags & _PAGE_PCC_MASK))
+			return NULL;
+		if (unlikely(flags & _PAGE_CACHABLE))
+			return (void __iomem *)P1SEGADDR(offset);
+
+		return (void __iomem *)P2SEGADDR(offset);
+	}
+
+	/* P4 above the store queues are always mapped. */
+	if (unlikely(offset >= P3_ADDR_MAX))
+		return (void __iomem *)P4SEGADDR(offset);
+
+	return NULL;
+}
+#else
+#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
@@ -43,6 +88,14 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size,
 	unsigned long offset, last_addr, addr, orig_addr;
 	void __iomem *mapped;
 
+	mapped = __ioremap_trapped(phys_addr, size);
+	if (mapped)
+		return mapped;
+
+	mapped = __ioremap_29bit(phys_addr, size, pgprot);
+	if (mapped)
+		return mapped;
+
 	/* Don't allow wraparound or zero size */
 	last_addr = phys_addr + size - 1;
 	if (!size || last_addr < phys_addr)
-- 
2.26.2

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

* [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h>
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (4 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

No need to expose the details of trapped I/O to drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/io.h | 1 -
 arch/sh/kernel/ioport.c  | 1 +
 arch/sh/mm/ioremap.c     | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index da08a61a2f7dae..873f1399fa5962 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -22,7 +22,6 @@
 
 #define __IO_PREFIX     generic
 #include <asm/io_generic.h>
-#include <asm/io_trapped.h>
 #include <asm-generic/pci_iomap.h>
 #include <mach/mangle-port.h>
 
diff --git a/arch/sh/kernel/ioport.c b/arch/sh/kernel/ioport.c
index 34f8cdbbcf0bee..f39446a658bdb8 100644
--- a/arch/sh/kernel/ioport.c
+++ b/arch/sh/kernel/ioport.c
@@ -7,6 +7,7 @@
  */
 #include <linux/module.h>
 #include <linux/io.h>
+#include <asm/io_trapped.h>
 
 unsigned long sh_io_port_base __read_mostly = -1;
 EXPORT_SYMBOL(sh_io_port_base);
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index 69e55939e48a6f..21342581144dee 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -18,6 +18,7 @@
 #include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/io.h>
+#include <asm/io_trapped.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/addrspace.h>
-- 
2.26.2

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

* [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (5 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:18   ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Both functions are only used by compiled in core code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/kernel/io_trapped.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 037aab2708b7ac..004ad0130b1038 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -102,7 +102,6 @@ int register_trapped_io(struct trapped_io *tiop)
 	pr_warn("unable to install trapped io filter\n");
 	return -1;
 }
-EXPORT_SYMBOL_GPL(register_trapped_io);
 
 void __iomem *match_trapped_io_handler(struct list_head *list,
 				       unsigned long offset,
@@ -131,7 +130,6 @@ void __iomem *match_trapped_io_handler(struct list_head *list,
 	spin_unlock_irqrestore(&trapped_lock, flags);
 	return NULL;
 }
-EXPORT_SYMBOL_GPL(match_trapped_io_handler);
 
 static struct trapped_io *lookup_tiop(unsigned long address)
 {
-- 
2.26.2

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

* [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (6 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-21  3:17     ` Rich Felker
  2020-07-14 12:18   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
                     ` (2 subsequent siblings)
  10 siblings, 1 reply; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Have a single definition that architetures can select.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig         | 4 +---
 arch/m68k/Kconfig.machine | 1 +
 arch/um/Kconfig           | 4 +---
 kernel/dma/Kconfig        | 3 +++
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 6ad6cdac74b3dc..8e488369a7e55a 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -17,6 +17,7 @@ config M68K
 	select HAVE_COPY_THREAD_TLS
 	select GENERIC_IRQ_SHOW
 	select GENERIC_ATOMIC64
+	select NO_DMA if !MMU && !COLDFIRE
 	select HAVE_UID16
 	select VIRT_TO_BUS
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
@@ -60,9 +61,6 @@ config TIME_LOW_RES
 config NO_IOPORT_MAP
 	def_bool y
 
-config NO_DMA
-	def_bool (MMU && SUN3) || (!MMU && !COLDFIRE)
-
 config ZONE_DMA
 	bool
 	default y
diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index a82651d58af483..17e8c3a292d770 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -126,6 +126,7 @@ config SUN3
 	depends on MMU
 	depends on !MMU_MOTOROLA
 	select MMU_SUN3 if MMU
+	select NO_DMA
 	select M68020
 	help
 	  This option enables support for the Sun 3 series of workstations
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 9318dc6d1a0cee..32c1d1945033ec 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -15,6 +15,7 @@ config UML
 	select HAVE_DEBUG_KMEMLEAK
 	select HAVE_DEBUG_BUGVERBOSE
 	select HAVE_COPY_THREAD_TLS
+	select NO_DMA
 	select GENERIC_IRQ_SHOW
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
@@ -168,9 +169,6 @@ config MMAPPER
 	  This driver allows a host file to be used as emulated IO memory inside
 	  UML.
 
-config NO_DMA
-	def_bool y
-
 config PGTABLE_LEVELS
 	int
 	default 3 if 3_LEVEL_PGTABLES
diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
index 1da3f44f2565b4..57533d07676f4a 100644
--- a/kernel/dma/Kconfig
+++ b/kernel/dma/Kconfig
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+config NO_DMA
+	bool
+
 config HAS_DMA
 	bool
 	depends on !NO_DMA
-- 
2.26.2

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

* [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (7 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-08-28  2:00     ` Rich Felker
  2020-07-14 12:18   ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
  2020-07-14 12:31   ` ioremap and dma cleanups and fixes for superh (2nd resend) John Paul Adrian Glaubitz
  10 siblings, 1 reply; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

The code handling non-coherent DMA depends on being able to remap code
as non-cached.  But that can't be done without an MMU, so using this
option on NOMMU builds is broken.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index f8027eee08edae..337eb496c45a0a 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -61,6 +61,7 @@ config SUPERH
 	select MAY_HAVE_SPARSE_IRQ
 	select MODULES_USE_ELF_RELA
 	select NEED_SG_DMA_LENGTH
+	select NO_DMA if !MMU && !DMA_COHERENT
 	select NO_GENERIC_PCI_IOPORT_MAP if PCI
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND
@@ -135,7 +136,7 @@ config DMA_COHERENT
 	bool
 
 config DMA_NONCOHERENT
-	def_bool !DMA_COHERENT
+	def_bool !NO_DMA && !DMA_COHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 
 config PGTABLE_LEVELS
-- 
2.26.2

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

* [PATCH 10/10] sh: use the generic dma coherent remap allocator
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (8 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
@ 2020-07-14 12:18   ` Christoph Hellwig
  2020-07-14 12:31   ` ioremap and dma cleanups and fixes for superh (2nd resend) John Paul Adrian Glaubitz
  10 siblings, 0 replies; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-14 12:18 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

This switches to using common code for the DMA allocations, including
potential use of the CMA allocator if configured.

Switching to the generic code enables DMA allocations from atomic
context, which is required by the DMA API documentation, and also
adds various other minor features drivers start relying upon.  It
also makes sure we have on tested code base for all architectures
that require uncached pte bits for coherent DMA allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig               |  2 ++
 arch/sh/kernel/dma-coherent.c | 51 ++---------------------------------
 2 files changed, 4 insertions(+), 49 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 337eb496c45a0a..32d959849df9bc 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -137,7 +137,9 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !NO_DMA && !DMA_COHERENT
+	select ARCH_HAS_DMA_PREP_COHERENT
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_DIRECT_REMAP
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/kernel/dma-coherent.c b/arch/sh/kernel/dma-coherent.c
index d4811691b93cc1..cd46a9825e3c59 100644
--- a/arch/sh/kernel/dma-coherent.c
+++ b/arch/sh/kernel/dma-coherent.c
@@ -3,60 +3,13 @@
  * Copyright (C) 2004 - 2007  Paul Mundt
  */
 #include <linux/mm.h>
-#include <linux/init.h>
 #include <linux/dma-noncoherent.h>
-#include <linux/module.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
-		gfp_t gfp, unsigned long attrs)
+void arch_dma_prep_coherent(struct page *page, size_t size)
 {
-	void *ret, *ret_nocache;
-	int order = get_order(size);
-
-	gfp |= __GFP_ZERO;
-
-	ret = (void *)__get_free_pages(gfp, order);
-	if (!ret)
-		return NULL;
-
-	/*
-	 * Pages from the page allocator may have data present in
-	 * cache. So flush the cache before using uncached memory.
-	 */
-	arch_sync_dma_for_device(virt_to_phys(ret), size,
-			DMA_BIDIRECTIONAL);
-
-	ret_nocache = (void __force *)ioremap(virt_to_phys(ret), size);
-	if (!ret_nocache) {
-		free_pages((unsigned long)ret, order);
-		return NULL;
-	}
-
-	split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order);
-
-	*dma_handle = virt_to_phys(ret);
-	if (!WARN_ON(!dev))
-		*dma_handle -= PFN_PHYS(dev->dma_pfn_offset);
-
-	return ret_nocache;
-}
-
-void arch_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs)
-{
-	int order = get_order(size);
-	unsigned long pfn = (dma_handle >> PAGE_SHIFT);
-	int k;
-
-	if (!WARN_ON(!dev))
-		pfn += dev->dma_pfn_offset;
-
-	for (k = 0; k < (1 << order); k++)
-		__free_pages(pfn_to_page(pfn + k), 0);
-
-	iounmap(vaddr);
+	__flush_purge_region(page_address(page), size);
 }
 
 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
-- 
2.26.2

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
                     ` (9 preceding siblings ...)
  2020-07-14 12:18   ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
@ 2020-07-14 12:31   ` John Paul Adrian Glaubitz
  2020-07-14 15:59     ` Rich Felker
  10 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-14 12:31 UTC (permalink / raw)
  To: Christoph Hellwig, Yoshinori Sato, Rich Felker; +Cc: linux-sh, linux-kernel

Hi Christoph!

On 7/14/20 2:18 PM, Christoph Hellwig wrote:
> can you take a look and possibly pick up the series below that untangles
> and sorts out minor issues with the sh ioremap and dma code?
> 
> I sent this out a few times, but never got an answer.  If you don't
> want to pick up the series I can also take it through one of my trees
> if I get ACKs.

Rich already said he is fine with most of the changes but we need to test
the DMA changes first to make sure they didn't break anything.

Thanks again for your continued efforts.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 12:31   ` ioremap and dma cleanups and fixes for superh (2nd resend) John Paul Adrian Glaubitz
@ 2020-07-14 15:59     ` Rich Felker
  2020-07-14 16:10       ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 81+ messages in thread
From: Rich Felker @ 2020-07-14 15:59 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On Tue, Jul 14, 2020 at 02:31:00PM +0200, John Paul Adrian Glaubitz wrote:
> Hi Christoph!
> 
> On 7/14/20 2:18 PM, Christoph Hellwig wrote:
> > can you take a look and possibly pick up the series below that untangles
> > and sorts out minor issues with the sh ioremap and dma code?
> > 
> > I sent this out a few times, but never got an answer.  If you don't
> > want to pick up the series I can also take it through one of my trees
> > if I get ACKs.
> 
> Rich already said he is fine with most of the changes but we need to test
> the DMA changes first to make sure they didn't break anything.
> 
> Thanks again for your continued efforts.

Yes. Sorry I didn't also reply in the original thread.

I'd like to have a way to test the DMA changes or testing feedback
from someone using an affected configuration just because they're
sufficiently nontrivial (Adrian might be able to do this? If so that'd
be great; if not let me know if it's testable in qemu), but the rest
look good to go.

Big thanks for your efforts to clean all this up!

Rich

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 15:59     ` Rich Felker
@ 2020-07-14 16:10       ` John Paul Adrian Glaubitz
  2020-07-14 23:12         ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-14 16:10 UTC (permalink / raw)
  To: Rich Felker; +Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On 7/14/20 5:59 PM, Rich Felker wrote:
> I'd like to have a way to test the DMA changes or testing feedback
> from someone using an affected configuration just because they're
> sufficiently nontrivial (Adrian might be able to do this? If so that'd
> be great; if not let me know if it's testable in qemu), but the rest
> look good to go.

I'll try to build and boot a test kernel on my SH7785LCR tonight or tomorrow (CEST).

> Big thanks for your efforts to clean all this up!

Agreed. Much appreciated.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 16:10       ` John Paul Adrian Glaubitz
@ 2020-07-14 23:12         ` John Paul Adrian Glaubitz
  2020-07-14 23:14           ` John Paul Adrian Glaubitz
                             ` (3 more replies)
  0 siblings, 4 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-14 23:12 UTC (permalink / raw)
  To: Rich Felker; +Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 32739 bytes --]

Hello!

I have applied Christoph's full series on top of Linus' tree and I can confirm that
the kernel boots fine on my SH-7785LCR board.

Thus, for the whole series of patches:

Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

However, independent of Christoph's series, the kernels throws two backtraces during
boot which I think should require a git bisect (unless I missed a configuration option
as I trimmed down the kernel a bit to make sure it's not too big).

See the traces below and let me know what you think.

Adrian

==========================================

## Booting kernel from Legacy Image at 89000000 ...
   Image Name:   Linux-5.8.0-rc5-00026-g22b7a96ec
   Image Type:   SuperH Linux Kernel Image (gzip compressed)
   Data Size:    4058011 Bytes = 3.9 MiB
   Load Address: 80001000
   Entry Point:  80002000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
[    0.000000] Linux version 5.8.0-rc5-00026-g22b7a96ece82 (glaubitz@epyc) (sh4-linux-gnu-gcc (Debian 9.3.0-13) 9.3.0, GNU ld (GNU Binutils for Debian) 2.34.90.20200706) #3 PREEMPT Wed Jul 15 01:03:46 CEST 2020
[    0.000000] Boot params:
[    0.000000] ... MOUNT_ROOT_RDONLY - 00000000
[    0.000000] ... RAMDISK_FLAGS     - 00000000
[    0.000000] ... ORIG_ROOT_DEV     - 00000000
[    0.000000] ... LOADER_TYPE       - 00000000
[    0.000000] ... INITRD_START      - 00000000
[    0.000000] ... INITRD_SIZE       - 00000000
[    0.000000] Booting machvec: SH7785LCR
[    0.000000] PMB: boot mappings:
[    0.000000]        0x00080000 -> 0x00040000 [  512MB   cached ]
[    0.000000]        0x000a0000 -> 0x00040000 [   16MB uncached ]
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000005fffffff]
[    0.000000] On node 0 totalpages: 131072
[    0.000000]   Normal zone: 1024 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 131072 pages, LIFO batch:31
[    0.000000] Renesas Technology Corp. R0P7785LC0011RL support.
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: console=ttySC1,115200 root=/dev/sda1 init=/bin/bash
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] PVR\x10300700 CVRq440211 PRR\0000250
[    0.000000] I-cache : n_ways=4 n_sets%6 way_incr92
[    0.000000] I-cache : entry_mask=0x00001fe0 alias_mask=0x00001000 n_aliases=2
[    0.000000] D-cache : n_ways=4 n_sets%6 way_incr92
[    0.000000] D-cache : entry_mask=0x00001fe0 alias_mask=0x00001000 n_aliases=2
[    0.000000] Memory: 510080K/524288K available (4601K kernel code, 276K rwdata, 1660K rodata, 156K init, 2966K bss, 14204K reserved, 0K cma-reserved)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xdffd7000 - 0xdffff000   ( 160 kB)
[    0.000000]     vmalloc : 0xc0000000 - 0xdffd5000   ( 511 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xa0000000   ( 512 MB) (cached)
[    0.000000]             : 0xa0000000 - 0xa1000000   (  16 MB) (uncached)
[    0.000000]       .init : 0x80666000 - 0x8068d000   ( 156 kB)
[    0.000000]       .data : 0x80480594 - 0x806658d0   (1940 kB)
[    0.000000]       .text : 0x80001000 - 0x80480594   (4605 kB)
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 8, nr_irqs: 8, preallocated irqs: 0
[    0.000000] intc: Registered controller 'sh7785' with 67 IRQs
[    0.000000] intc: Registered controller 'sh7785-irq4567' with 4 IRQs
[    0.000000] intc: Registered controller 'sh7785-irq0123' with 4 IRQs
[    0.000000] random: get_random_bytes called from start_kernel+0x264/0x5c2 with crng_init=0
[    0.000000] Console: colour dummy device 80x25
[    0.000000]  sh-tmu.0: ch0: used for clock events
[    0.000000]  sh-tmu.0: ch0: used for periodic clock events
[    0.000000]  sh-tmu.0: ch1: used as clock source
[    0.000000] clocksource: sh-tmu.0: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 152900847964 ns
[    0.000000]  sh-tmu.1: ch0: used for clock events
[    0.000000]  sh-tmu.1: ch1: used as clock source
[    0.000000] clocksource: sh-tmu.1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 152900847964 ns
[    0.000000] sched_clock: 32 bits at 250 Hz, resolution 4000000ns, wraps every 8589934590000000ns
[    0.000000] Calibrating delay loop (skipped)... 599.99 BogoMIPS PRESET (lpj\x1199999)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] LSM: Security Framework initializing
[    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.012000] CPU: SH7785
[    0.016000] Performance Events: sh4a support registered
[    0.020000] rcu: Hierarchical SRCU implementation.
[    0.024000] devtmpfs: initialized
[    0.044000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.044000] futex hash table entries: 256 (order: 0, 7168 bytes, linear)
[    0.048000] pinctrl core: initialized pinctrl subsystem
[    0.060000] NET: Registered protocol family 16
[    0.140000] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.144000] audit: initializing netlink subsys (disabled)
[    0.148000] audit: type 00 audit(0.144:1): state=initialized audit_enabled=0 res=1
[    0.168000] cpuidle: using governor ladder
[    0.168000] cpuidle: using governor menu
[    0.228000] sh-pfc pfc-sh7785: sh7785_pfc handling gpio 0 -> 110
[    0.232000] sh-pfc pfc-sh7785: sh7785_pfc handling gpio 111 -> 275
[    0.232000] sh-pfc pfc-sh7785: sh7785_pfc support registered
[    0.232000] HW Breakpoints: SH-4A UBC support registered
[    0.232000] PCI: Starting initialization.
[    0.484000] PCI: Found a Renesas SH7785 host controller, revision 1.
[    0.484000] PCI: Checking 66MHz capabilities...
[    0.484000] PCI: Running at 66MHz.
[    0.932000] HugeTLB registered 1.00 MiB page size, pre-allocated 0 pages
[    0.980000] SCSI subsystem initialized
[    0.988000] libata version 3.00 loaded.
[    1.004000] usbcore: registered new interface driver usbfs
[    1.004000] usbcore: registered new interface driver hub
[    1.008000] usbcore: registered new device driver usb
[    1.016000] sh_tmu sh-tmu.0: kept as earlytimer
[    1.020000] sh_tmu sh-tmu.1: kept as earlytimer
[    1.024000] random: fast init done
[    1.048000] DMA: Registering sh_dmac handler (12 channels).
[    1.096000] DMA: Registering DMA API.
[    1.100000] PCI host bridge to bus 0000:00
[    1.100000] pci_bus 0000:00: root bus resource [io  0x1000-0x3fffff]
[    1.100000] pci_bus 0000:00: root bus resource [mem 0xfd000000-0xfdffffff]
[    1.100000] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff]
[    1.100000] pci_bus 0000:00: root bus resource [mem 0xc0000000-0xdfffffff]
[    1.104000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    1.104000] pci_bus 0000:00: scanning bus
[    1.104000] pci 0000:00:00.0: [10ec:8169] type 00 class 0x020000
[    1.104000] pci 0000:00:00.0: reg 0x10: [io  0x0000-0x00ff]
[    1.104000] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x000000ff]
[    1.104000] pci 0000:00:00.0: reg 0x30: [mem 0x00000000-0x0001ffff pref]
[    1.104000] pci 0000:00:00.0: supports D1 D2
[    1.104000] pci 0000:00:00.0: PME# supported from D1 D2 D3hot
[    1.104000] pci 0000:00:00.0: PME# disabled
[    1.108000] pci 0000:00:01.0: [1095:3512] type 00 class 0x018000
[    1.108000] pci 0000:00:01.0: reg 0x10: [io  0x0000-0x0007]
[    1.108000] pci 0000:00:01.0: reg 0x14: [io  0x0000-0x0003]
[    1.108000] pci 0000:00:01.0: reg 0x18: [io  0x0000-0x0007]
[    1.108000] pci 0000:00:01.0: reg 0x1c: [io  0x0000-0x0003]
[    1.108000] pci 0000:00:01.0: reg 0x20: [io  0x0000-0x000f]
[    1.108000] pci 0000:00:01.0: reg 0x24: [mem 0x00000000-0x000001ff]
[    1.108000] pci 0000:00:01.0: reg 0x30: [mem 0x00000000-0x0007ffff pref]
[    1.108000] pci 0000:00:01.0: supports D1 D2
[    1.116000] pci_bus 0000:00: fixups for bus
[    1.116000] pci_bus 0000:00: bus scan returning with max\0
[    1.116000] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    1.116000] pci 0000:00:01.0: BAR 6: assigned [mem 0xfd000000-0xfd07ffff pref]
[    1.116000] pci 0000:00:00.0: BAR 6: assigned [mem 0xfd080000-0xfd09ffff pref]
[    1.116000] pci 0000:00:01.0: BAR 5: assigned [mem 0xfd0a0000-0xfd0a01ff]
[    1.116000] pci 0000:00:00.0: BAR 0: assigned [io  0x1000-0x10ff]
[    1.116000] pci 0000:00:00.0: BAR 1: assigned [mem 0xfd0a0200-0xfd0a02ff]
[    1.116000] pci 0000:00:01.0: BAR 4: assigned [io  0x1400-0x140f]
[    1.116000] pci 0000:00:01.0: BAR 0: assigned [io  0x1410-0x1417]
[    1.116000] pci 0000:00:01.0: BAR 2: assigned [io  0x1418-0x141f]
[    1.116000] pci 0000:00:01.0: BAR 1: assigned [io  0x1420-0x1423]
[    1.116000] pci 0000:00:01.0: BAR 3: assigned [io  0x1424-0x1427]
[    1.120000] clocksource: Switched to clocksource sh-tmu.0
[    1.124000] sh_tmu sh-tmu.0: ch0: used for oneshot clock events
[    1.456000] NET: Registered protocol family 2
[    1.464000] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 6144 bytes, linear)
[    1.464000] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    1.464000] TCP bind hash table entries: 4096 (order: 4, 81920 bytes, linear)
[    1.464000] TCP: Hash tables configured (established 4096 bind 4096)
[    1.464000] UDP hash table entries: 256 (order: 1, 12288 bytes, linear)
[    1.464000] UDP-Lite hash table entries: 256 (order: 1, 12288 bytes, linear)
[    1.468000] NET: Registered protocol family 1
[    1.468000] PCI: CLS 0 bytes, default 32
[    1.468000] sq: Registering store queue API.
[    1.512000] workingset: timestamp_bits0 max_order\x17 bucket_order=0
[    1.536000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    1.536000] io scheduler mq-deadline registered
[    1.544000] SuperH (H)SCI(F) driver initialized
[    1.544000] sh-sci.0: ttySC0 at MMIO 0xffea0000 (irq = 40, base_baud = 0) is a scif
[    1.560000] sh-sci.1: ttySC1 at MMIO 0xffeb0000 (irq = 44, base_baud = 0) is a scif
[    1.560000] BUG: spinlock bad magic on CPU#0, swapper/1
[    1.560000]  lock: sci_ports+0x1d8/0xb10, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[    1.560000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc5-00026-g22b7a96ece82 #3
[    1.560000] Stack: (0x9f445ce8 to 0x9f446000)
[    1.560000] 5ce0: 
[    1.560000]          
[    1.560000]          
[    1.560000] 80260daa 
[    1.560000] 9f445cfc 
[    1.560000] 80048fd8 
[    1.560000] 8096c158 
[    1.560000] 805ab908 
[    1.560000] 8004449c 
[    1.560000] 
[    1.560000] 5d00: 
[    1.560000] 9f445d08 
[    1.560000] 00000000 
[    1.560000] ffffffff 
[    1.560000] 00000000 
[    1.560000] 8004455e 
[    1.560000] 9f445d24 
[    1.560000] 8064b2c0 
[    1.560000] 8096c158 
[    1.560000] 
[    1.560000] 5d20: 
[    1.560000] 8096c158 
[    1.560000] 8047e57c 
[    1.560000] 9f445d30 
[    1.560000] 00000000 
[    1.560000] 802b850a 
[    1.560000] 9f445d40 
[    1.560000] 8096c158 
[    1.560000] 9f66694c 
[    1.560000] 
[    1.560000] 5d40: 
[    1.560000] 9f445d70 
[    1.560000] 0000002c 
[    1.560000] 00000000 
[    1.560000] 805cc1a0 
[    1.560000] 9f4d7660 
[    1.560000] 9f666a88 
[    1.560000] 805e101c 
[    1.560000] 0000002c 
[    1.560000] 
[    1.560000] 5d60: 
[    1.560000] 9f647d80 
[    1.560000] 9f445d70 
[    1.560000] 00000000 
[    1.560000] 9f666a48 
[    1.560000] 4f494d4d 
[    1.560000] 66783020 
[    1.560000] 30626566 
[    1.560000] 00303030 
[    1.560000] 
[    1.560000] 5d80: 
[    1.560000] 9f445d9c 
[    1.560000] 00000000 
[    1.560000] 8096bf7c 
[    1.560000] 8062deb4 
[    1.560000] 8096bf80 
[    1.560000] 8096c158 
[    1.560000] 8096c158 
[    1.560000] 8096c214 
[    1.560000] 
[    1.560000] 5da0: 
[    1.560000] 9f445db0 
[    1.560000] 805cc298 
[    1.560000] 805cc29c 
[    1.560000] 00000000 
[    1.560000] b6b1ed6c 
[    1.560000] 802bc842 
[    1.560000] 9f445dd4 
[    1.560000] 00000000 
[    1.560000] 
[    1.560000] 5dc0: 
[    1.560000] 8096bf7c 
[    1.560000] 8096c158 
[    1.560000] 8096bf80 
[    1.560000] 8096c158 
[    1.560000] 00000001 
[    1.560000] 00000000 
[    1.560000] 9f4d81c8 
[    1.560000] 805e5c0c 
[    1.560000] 
[    1.560000] 5de0: 
[    1.560000] 8062dec0 
[    1.560000] 8062e050 
[    1.560000] 802c9890 
[    1.560000] 9f445e08 
[    1.560000] 00000000 
[    1.560000] 8096cd10 
[    1.560000] 8062df3c 
[    1.560000] 8096ce20 
[    1.560000] 
[    1.560000] 5e00: 
[    1.560000] 8062dec0 
[    1.560000] 8064b1b4 
[    1.560000] 802c7cdc 
[    1.560000] 9f445e18 
[    1.560000] 8062dec0 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 8064b1b4 
[    1.560000] 
[    1.560000] 5e20: 
[    1.560000] 802c7fe6 
[    1.560000] 9f445e40 
[    1.560000] 8064b1f4 
[    1.560000] 8064bb08 
[    1.560000] 8062724c 
[    1.560000] 00000000 
[    1.560000] 8064b1b4 
[    1.560000] 8062dec0 
[    1.560000] 
[    1.560000] 5e40: 
[    1.560000] 802c81ce 
[    1.560000] 9f445e54 
[    1.560000] 00000000 
[    1.560000] 8064b1b4 
[    1.560000] 8062dec0 
[    1.560000] 802c8220 
[    1.560000] 9f445e68 
[    1.560000] 802627f4 
[    1.560000] 
[    1.560000] 5e60: 
[    1.560000] 8062dec0 
[    1.560000] 8064b1b4 
[    1.560000] 802c619a 
[    1.560000] 9f445e7c 
[    1.560000] 802627f4 
[    1.560000] 802c81e0 
[    1.560000] 8064b1b4 
[    1.560000] 8047e4e0 
[    1.560000] 
[    1.560000] 5e80: 
[    1.560000] 9f40bc70 
[    1.560000] 9f40f5c0 
[    1.560000] b6b1ed6c 
[    1.560000] 802c778a 
[    1.560000] 9f445ea4 
[    1.560000] 8064bac8 
[    1.560000] 00000000 
[    1.560000] 9f664f60 
[    1.560000] 
[    1.560000] 5ea0: 
[    1.560000] 8064b1b4 
[    1.560000] 802c71d2 
[    1.560000] 9f445eac 
[    1.560000] 805a0d88 
[    1.560000] 802c87cc 
[    1.560000] 9f445ed0 
[    1.560000] 8068d000 
[    1.560000] 00000000 
[    1.560000] 
[    1.560000] 5ec0: 
[    1.560000] 8062724c 
[    1.560000] 9f445efc 
[    1.560000] 8068d008 
[    1.560000] 8064b1b4 
[    1.560000] 802c9856 
[    1.560000] 9f445ee4 
[    1.560000] 9f445efc 
[    1.560000] 8068d008 
[    1.560000] 
[    1.560000] 5ee0: 
[    1.560000] 80678800 
[    1.560000] 80678816 
[    1.560000] 9f445eec 
[    1.560000] 80002292 
[    1.560000] 9f445ef4 
[    1.560000] 9f422dd6 
[    1.560000] 00000000 
[    1.560000] 8002d300 
[    1.560000] 
[    1.560000] 5f00: 
[    1.560000] 9f445f0c 
[    1.560000] 000000b2 
[    1.560000] 9f445f0c 
[    1.560000] 00000006 
[    1.560000] 00000006 
[    1.560000] 00000000 
[    1.560000] 805dda74 
[    1.560000] 8061f9f0 
[    1.560000] 
[    1.560000] 5f20: 
[    1.560000] 80666098 
[    1.560000] 00000000 
[    1.560000] 9f422dea 
[    1.560000] 00000000 
[    1.560000] 9f422de5 
[    1.560000] 9f422dea 
[    1.560000] b6b1ed6c 
[    1.560000] 80666c92 
[    1.560000] 
[    1.560000] 5f40: 
[    1.560000] 9f445f5c 
[    1.560000] 000000b2 
[    1.560000] 80685900 
[    1.560000] 9f422dc0 
[    1.560000] 806858e0 
[    1.560000] 8068d008 
[    1.560000] 8061f9f0 
[    1.560000] 00000006 
[    1.560000] 
[    1.560000] 5f60: 
[    1.560000] 00000006 
[    1.560000] 00000000 
[    1.560000] 80666098 
[    1.560000] 8068a6d0 
[    1.560000] 00000007 
[    1.560000] 804778b4 
[    1.560000] 9f445f94 
[    1.560000] 80636160 
[    1.560000] 
[    1.560000] 5f80: 
[    1.560000] 80477788 
[    1.560000] 8063659c 
[    1.560000] 00000000 
[    1.560000] 9f442020 
[    1.560000] 80048fd8 
[    1.560000] 80007224 
[    1.560000] 9f449f28 
[    1.560000] 9f442020 
[    1.560000] 
[    1.560000] 5fa0: 
[    1.560000] 80034b98 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 804778a4 
[    1.560000] 00000000 
[    1.560000] 
[    1.560000] 5fc0: 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 
[    1.560000] 5fe0: 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 40008000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 00000000 
[    1.560000] 
[    1.560000] 
[    1.560000] Call trace:
[    1.560000]  [<(ptrval)>] dump_stack+0x1a/0x30
[    1.560000]  [<(ptrval)>] printk+0x0/0x50
[    1.560000]  [<(ptrval)>] spin_dump+0x58/0x88
[    1.560000]  [<(ptrval)>] do_raw_spin_lock+0x4a/0x94
[    1.560000]  [<(ptrval)>] _raw_spin_lock_irqsave+0x24/0x44
[    1.560000]  [<(ptrval)>] uart_add_one_port+0x32a/0x470
[    1.560000]  [<(ptrval)>] sci_probe+0x116/0x2f4
[    1.560000]  [<(ptrval)>] platform_drv_probe+0x1c/0x60
[    1.560000]  [<(ptrval)>] really_probe+0xc0/0x2c8
[    1.560000]  [<(ptrval)>] driver_probe_device+0x26/0x6c
[    1.560000]  [<(ptrval)>] device_driver_attach+0x4a/0x5c
[    1.560000]  [<(ptrval)>] __driver_attach+0x40/0xc4
[    1.560000]  [<(ptrval)>] klist_next+0x0/0xe4
[    1.560000]  [<(ptrval)>] bus_for_each_dev+0x56/0xa8
[    1.560000]  [<(ptrval)>] klist_next+0x0/0xe4
[    1.560000]  [<(ptrval)>] __driver_attach+0x0/0xc4
[    1.560000]  [<(ptrval)>] _raw_spin_lock+0x10/0x28
[    1.560000]  [<(ptrval)>] driver_attach+0x12/0x24
[    1.560000]  [<(ptrval)>] bus_add_driver+0x13a/0x1bc
[    1.560000]  [<(ptrval)>] driver_register+0x50/0xf8
[    1.560000]  [<(ptrval)>] __platform_driver_register+0x22/0x40
[    1.560000]  [<(ptrval)>] sci_init+0x0/0x34
[    1.560000]  [<(ptrval)>] sci_init+0x16/0x34
[    1.560000]  [<(ptrval)>] do_one_initcall+0x5e/0x164
[    1.560000]  [<(ptrval)>] parse_args+0xe0/0x2b8
[    1.560000]  [<(ptrval)>] ignore_unknown_bootoption+0x0/0xc
[    1.560000]  [<(ptrval)>] kernel_init_freeable+0xf6/0x1e0
[    1.560000]  [<(ptrval)>] ignore_unknown_bootoption+0x0/0xc
[    1.560000]  [<(ptrval)>] kernel_init+0x10/0x100
[    1.560000]  [<(ptrval)>] debug_smp_processor_id+0x0/0x24
[    1.560000]  [<(ptrval)>] printk+0x0/0x50
[    1.560000]  [<(ptrval)>] ret_from_kernel_thread+0xc/0x14
[    1.560000]  [<(ptrval)>] schedule_tail+0x0/0x88
[    1.560000]  [<(ptrval)>] kernel_init+0x0/0x100
[    1.560000] 
[    3.248000] printk: console [ttySC1] enabled
[    3.264000] sh-sci.2: ttySC2 at MMIO 0xffec0000 (irq = 60, base_baud = 0) is a scif
[    3.284000] sh-sci.3: ttySC3 at MMIO 0xffed0000 (irq = 61, base_baud = 0) is a scif
[    3.304000] sh-sci.4: ttySC4 at MMIO 0xffee0000 (irq = 62, base_baud = 0) is a scif
[    3.324000] sh-sci.5: ttySC5 at MMIO 0xffef0000 (irq = 63, base_baud = 0) is a scif
[    3.628000] brd: module loaded
[    3.816000] loop: module loaded
[    3.820000] sm501 sm501: SM501 At (ptrval): Version 050100c0, 4 Mb, IRQ 10
[    3.828000] sm501 sm501: setting M1XCLK to 112000000
[    3.856000] sm501 sm501: setting MCLK to 84000000
[    3.884000] sm501-fb[0] [mem 0x13e80000-0x13e8ffff]
[    3.888000] sm501-fb[1] [mem 0x13f00000-0x13f4ffff]
[    3.892000] sm501-fb[2] [mem 0x10000000-0x103fffff]
[    3.896000] sm501-fb[3] [irq 10]
[    3.920000] sata_sil 0000:00:01.0: assign IRQ: got 66
[    3.928000] sata_sil 0000:00:01.0: version 2.4
[    3.932000] sata_sil 0000:00:01.0: enabling device (0000 -> 0003)
[    3.940000] sata_sil 0000:00:01.0: cache line size not set.  Driver may not function
[    3.948000] sata_sil 0000:00:01.0: Applying R_ERR on DMA activate FIS errata fix
[    3.956000] sata_sil 0000:00:01.0: enabling bus mastering
[    4.004000] scsi host0: sata_sil
[    4.020000] scsi host1: sata_sil
[    4.036000] ata1: SATA max UDMA/100 mmio m512@0xfd0a0000 tf 0xfd0a0080 irq 66
[    4.044000] ata2: SATA max UDMA/100 mmio m512@0xfd0a0000 tf 0xfd0a00c0 irq 66
[    4.068000] physmap-flash physmap-flash.0: physmap platform flash device: [mem 0x00000000-0x03ffffff]
[    4.076000] physmap-flash.0: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000001 Chip ID 0x002201
[    4.088000] Amd/Fujitsu Extended Query Table at 0x0040
[    4.092000]   Amd/Fujitsu Extended Query version 1.3.
[    4.100000] number of CFI chips: 1
[    4.108000] Creating 4 MTD partitions on "physmap-flash.0":
[    4.116000] 0x000000000000-0x000000080000 : "loader"
[    4.176000] 0x000000080000-0x000000100000 : "bootenv"
[    4.232000] 0x000000100000-0x000000500000 : "kernel"
[    4.288000] 0x000000500000-0x000004000000 : "data"
[    4.364000] ata1: SATA link down (SStatus 0 SControl 310)
[    4.388000] r8169 0000:00:00.0: assign IRQ: got 65
[    4.396000] r8169 0000:00:00.0: enabling device (0000 -> 0003)
[    4.404000] r8169 0000:00:00.0: enabling bus mastering
[    4.444000] libphy: r8169: probed
[    4.468000] r8169 0000:00:00.0 eth0: RTL8169sc/8110sc, 74:90:50:00:02:03, XID 180, IRQ 65
[    4.476000] r8169 0000:00:00.0 eth0: jumbo features [frames: 7146 bytes, tx checksumming: ok]
[    4.504000] r8a66597_hcd r8a66597_hcd: USB Host Controller
[    4.512000] r8a66597_hcd r8a66597_hcd: new USB bus registered, assigned bus number 1
[    4.520000] r8a66597_hcd r8a66597_hcd: irq 2, io base 0x08000000
[    4.564000] hub 1-0:1.0: USB hub found
[    4.568000] hub 1-0:1.0: 2 ports detected
[    4.600000] usbcore: registered new interface driver usb-storage
[    4.612000] mousedev: PS/2 mouse device common for all mice
[    4.624000] PCA9564/PCA9665 at 0x06000000: PCA9564 detected.
[    4.632000] PCA9564/PCA9665 at 0x06000000: Choosing the clock frequency based on index is deprecated. Use the nominal frequency.
[    4.644000]  (null): No reset-pin found. Chip may get stuck!
[    4.648000] PCA9564/PCA9665 at 0x06000000: Clock frequency is 330kHz
[    4.660000] i2c-pca-platform i2c-pca-platform: registered.
[    4.672000] cpufreq: SuperH CPU frequency driver.
[    4.680000] cpufreq: cpufreq_online: ->get() failed
[    4.696000] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[    4.716000] ata2.00: ATA-9: TOSHIBA THNSNJ128GCSU, JURA0101, max UDMA/100
[    4.724000] usbcore: registered new interface driver usbhid
[    4.728000] usbhid: USB HID core driver
[    4.732000] ata2.00: 250069680 sectors, multi 16: LBA48 NCQ (depth 0/32)
[    4.744000] NET: Registered protocol family 10
[    4.748000] ata2.00: READ LOG DMA EXT failed, trying PIO
[    4.764000] ata2.00: configured for UDMA/100
[    4.772000] Segment Routing with IPv6
[    4.776000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    4.792000] scsi 1:0:0:0: Direct-Access     ATA      TOSHIBA THNSNJ12 0101 PQ: 0 ANSI: 5
[    4.836000] NET: Registered protocol family 17
[    4.852000] sd 1:0:0:0: [sda] 250069680 512-byte logical blocks: (128 GB/119 GiB)
[    4.860000] heartbeat: version 0.1.2 loaded
[    4.868000] sd 1:0:0:0: [sda] Write Protect is off
[    4.876000] sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    4.884000] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    4.896000] kmemleak: Kernel memory leak detector initialized (mem pool available: 15858)
[    4.904000] kmemleak: Automatic memory scanning thread started
[    4.940000]  sda: sda1 sda2 sda3
[    4.976000] sd 1:0:0:0: [sda] Attached SCSI disk
[    4.988000] usb 1-1: new high-speed USB device number 2 using r8a66597_hcd
[    5.252000] usb-storage 1-1:1.0: USB Mass Storage device detected
[    5.272000] scsi host2: usb-storage 1-1:1.0
[    5.364000] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[    5.372000] VFS: Mounted root (ext4 filesystem) on device 8:1.
[    5.396000] devtmpfs: mounted
[    5.400000] Freeing unused kernel memory: 156K
[    5.404000] This architecture does not have kernel memory protection.
[    5.412000] Run /bin/bash as init process
[    5.416000]   with arguments:
[    5.420000]     /bin/bash
[    5.420000]   with environment:
[    5.424000]     HOME=/
[    5.428000]     TERM=linux
[    5.464000] ------------[ cut here ]------------
[    5.464000] WARNING: CPU: 0 PID: 1 at mm/slab.c:2589 cache_alloc_refill+0x216/0x6a0
[    5.464000] Modules linked in:
[    5.464000] 
[    5.464000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc5-00026-g22b7a96ece82 #3
[    5.464000] PC is at cache_alloc_refill+0x216/0x6a0
[    5.464000] PR is at kmem_cache_alloc+0xd6/0x128
[    5.464000] PC  : 800ec0d2 SP  : 9f445e68 SR  : 400080f0 
[    5.464000] TEA : c00c30d0
[    5.464000] R0  : 8062724c R1  : 8000fee8 R2  : 9f403540 R3  : 00000100
[    5.464000] R4  : 9f403500 R5  : 00000000 R6  : 8068d5b0 R7  : 007fffff
[    5.464000] R8  : 0000000c R9  : 9f403500 R10 : 8096fc0c R11 : 80044410
[    5.464000] R12 : 9f405060 R13 : 00000dc0 R14 : 9f445e68
[    5.464000] MACH: 10623bba MACL: 00000cc0 GBR : 2957bd58 PR  : 800ec80a
[    5.464000] 
[    5.464000] Call trace:
[    5.464000]  [<(ptrval)>] _raw_spin_unlock_irqrestore+0x0/0x54
[    5.464000]  [<(ptrval)>] _raw_spin_lock_irqsave+0x0/0x44
[    5.464000]  [<(ptrval)>] kmem_cache_alloc+0xd6/0x128
[    5.464000]  [<(ptrval)>] arch_local_irq_restore+0x0/0x2c
[    5.464000]  [<(ptrval)>] __raw_spin_lock_init+0x0/0x1c
[    5.464000]  [<(ptrval)>] pgd_alloc+0x10/0x24
[    5.464000]  [<(ptrval)>] memset+0x0/0x8c
[    5.464000]  [<(ptrval)>] __raw_spin_lock_init+0x0/0x1c
[    5.464000]  [<(ptrval)>] mm_init.isra.0+0x10e/0x194
[    5.464000]  [<(ptrval)>] mm_alloc+0x2a/0x4c
[    5.464000]  [<(ptrval)>] _raw_spin_unlock+0x0/0x44
[    5.464000]  [<(ptrval)>] __do_execve_file+0x2a6/0x97c
[    5.464000]  [<(ptrval)>] kmemleak_alloc+0x1e/0x30
[    5.464000]  [<(ptrval)>] arch_local_irq_restore+0x0/0x2c
[    5.464000]  [<(ptrval)>] getname_kernel+0x24/0xf8
[    5.464000]  [<(ptrval)>] do_execve+0x1a/0x28
[    5.464000]  [<(ptrval)>] debug_smp_processor_id+0x0/0x24
[    5.464000]  [<(ptrval)>] printk+0x0/0x50
[    5.464000]  [<(ptrval)>] run_init_process+0x5c/0x90
[    5.464000]  [<(ptrval)>] kernel_init+0x5c/0x100
[    5.464000]  [<(ptrval)>] ret_from_kernel_thread+0xc/0x14
[    5.464000]  [<(ptrval)>] schedule_tail+0x0/0x88
[    5.464000]  [<(ptrval)>] kernel_init+0x0/0x100
[    5.464000] 
[    5.464000] Code:
[    5.464000]   800ec0cc:  
[    5.464000] mov.w     
[    5.464000] 800ec222 <cache_alloc_refill+0x366/0x6a0>
[    5.464000] , 
[    5.464000] r3
[    5.464000]   ! 00000100 <0x100>
[    5.464000] 
[    5.464000]   800ec0ce:  
[    5.464000] tst       
[    5.464000] r3
[    5.464000] , 
[    5.464000] r13
[    5.464000] 
[    5.464000]   800ec0d0:  
[    5.464000] bt        
[    5.464000] 800ec0d4
[    5.464000] 
[    5.464000] ->800ec0d2:  
[    5.464000] trapa     
[    5.464000] #62
[    5.464000] 
[    5.464000]   800ec0d4:  
[    5.464000] mov.w     
[    5.464000] 800ec224 <cache_alloc_refill+0x368/0x6a0>
[    5.464000] , 
[    5.464000] r1
[    5.464000]   ! 00000400 <0x400>
[    5.464000] 
[    5.464000]   800ec0d6:  
[    5.464000] mov       
[    5.464000] r13
[    5.464000] , 
[    5.464000] r2
[    5.464000] 
[    5.464000]   800ec0d8:  
[    5.464000] mov.l     
[    5.464000] 800ec238 <cache_alloc_refill+0x37c/0x6a0>
[    5.464000] , 
[    5.464000] r12
[    5.464000]   ! 003beee0 <0x3beee0>
[    5.464000] 
[    5.464000]   800ec0da:  
[    5.464000] and       
[    5.464000] r1
[    5.464000] , 
[    5.464000] r2
[    5.464000] 
[    5.464000]   800ec0dc:  
[    5.464000] tst       
[    5.464000] r1
[    5.464000] , 
[    5.464000] r13
[    5.464000] 
[    5.464000] 
[    5.464000] ---[ end trace 8fe2f9c439309f6b ]---
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root@(none):/# [    6.340000] usb 1-1: address 2, EndpointAddress 0x02 use DMA FIFO
[    6.344000] usb 1-1: address 2, EndpointAddress 0x81 use DMA FIFO
[    6.352000] scsi 2:0:0:0: Direct-Access     Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 0 CCS
[    6.392000] sd 2:0:0:0: [sdb] 7936000 512-byte logical blocks: (4.06 GB/3.78 GiB)
[    6.404000] sd 2:0:0:0: [sdb] Write Protect is off
[    6.408000] sd 2:0:0:0: [sdb] Mode Sense: 23 00 00 00
[    6.416000] sd 2:0:0:0: [sdb] No Caching mode page found
[    6.420000] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[    6.456000]  sdb: sdb1
[    6.480000] sd 2:0:0:0: [sdb] Attached SCSI removable disk

==========================================

[    5.464000] ------------[ cut here ]------------
[    5.464000] WARNING: CPU: 0 PID: 1 at mm/slab.c:2589 cache_alloc_refill+0x216/0x6a0
[    5.464000] Modules linked in:
[    5.464000] 
[    5.464000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc5-00026-g22b7a96ece82 #3
[    5.464000] PC is at cache_alloc_refill+0x216/0x6a0
[    5.464000] PR is at kmem_cache_alloc+0xd6/0x128
[    5.464000] PC  : 800ec0d2 SP  : 9f445e68 SR  : 400080f0 
[    5.464000] TEA : c00c30d0
[    5.464000] R0  : 8062724c R1  : 8000fee8 R2  : 9f403540 R3  : 00000100
[    5.464000] R4  : 9f403500 R5  : 00000000 R6  : 8068d5b0 R7  : 007fffff
[    5.464000] R8  : 0000000c R9  : 9f403500 R10 : 8096fc0c R11 : 80044410
[    5.464000] R12 : 9f405060 R13 : 00000dc0 R14 : 9f445e68
[    5.464000] MACH: 10623bba MACL: 00000cc0 GBR : 2957bd58 PR  : 800ec80a
[    5.464000] 
[    5.464000] Call trace:
[    5.464000]  [<(ptrval)>] _raw_spin_unlock_irqrestore+0x0/0x54
[    5.464000]  [<(ptrval)>] _raw_spin_lock_irqsave+0x0/0x44
[    5.464000]  [<(ptrval)>] kmem_cache_alloc+0xd6/0x128
[    5.464000]  [<(ptrval)>] arch_local_irq_restore+0x0/0x2c
[    5.464000]  [<(ptrval)>] __raw_spin_lock_init+0x0/0x1c
[    5.464000]  [<(ptrval)>] pgd_alloc+0x10/0x24
[    5.464000]  [<(ptrval)>] memset+0x0/0x8c
[    5.464000]  [<(ptrval)>] __raw_spin_lock_init+0x0/0x1c
[    5.464000]  [<(ptrval)>] mm_init.isra.0+0x10e/0x194
[    5.464000]  [<(ptrval)>] mm_alloc+0x2a/0x4c
[    5.464000]  [<(ptrval)>] _raw_spin_unlock+0x0/0x44
[    5.464000]  [<(ptrval)>] __do_execve_file+0x2a6/0x97c
[    5.464000]  [<(ptrval)>] kmemleak_alloc+0x1e/0x30
[    5.464000]  [<(ptrval)>] arch_local_irq_restore+0x0/0x2c
[    5.464000]  [<(ptrval)>] getname_kernel+0x24/0xf8
[    5.464000]  [<(ptrval)>] do_execve+0x1a/0x28
[    5.464000]  [<(ptrval)>] debug_smp_processor_id+0x0/0x24
[    5.464000]  [<(ptrval)>] printk+0x0/0x50
[    5.464000]  [<(ptrval)>] run_init_process+0x5c/0x90
[    5.464000]  [<(ptrval)>] kernel_init+0x5c/0x100
[    5.464000]  [<(ptrval)>] ret_from_kernel_thread+0xc/0x14
[    5.464000]  [<(ptrval)>] schedule_tail+0x0/0x88
[    5.464000]  [<(ptrval)>] kernel_init+0x0/0x100
[    5.464000] 
[    5.464000] Code:
[    5.464000]   800ec0cc:  
[    5.464000] mov.w     
[    5.464000] 800ec222 <cache_alloc_refill+0x366/0x6a0>
[    5.464000] , 
[    5.464000] r3
[    5.464000]   ! 00000100 <0x100>
[    5.464000] 
[    5.464000]   800ec0ce:  
[    5.464000] tst       
[    5.464000] r3
[    5.464000] , 
[    5.464000] r13
[    5.464000] 
[    5.464000]   800ec0d0:  
[    5.464000] bt        
[    5.464000] 800ec0d4
[    5.464000] 
[    5.464000] ->800ec0d2:  
[    5.464000] trapa     
[    5.464000] #62
[    5.464000] 
[    5.464000]   800ec0d4:  
[    5.464000] mov.w     
[    5.464000] 800ec224 <cache_alloc_refill+0x368/0x6a0>
[    5.464000] , 
[    5.464000] r1
[    5.464000]   ! 00000400 <0x400>
[    5.464000] 
[    5.464000]   800ec0d6:  
[    5.464000] mov       
[    5.464000] r13
[    5.464000] , 
[    5.464000] r2
[    5.464000] 
[    5.464000]   800ec0d8:  
[    5.464000] mov.l     
[    5.464000] 800ec238 <cache_alloc_refill+0x37c/0x6a0>
[    5.464000] , 
[    5.464000] r12
[    5.464000]   ! 003beee0 <0x3beee0>
[    5.464000] 
[    5.464000]   800ec0da:  
[    5.464000] and       
[    5.464000] r1
[    5.464000] , 
[    5.464000] r2
[    5.464000] 
[    5.464000]   800ec0dc:  
[    5.464000] tst       
[    5.464000] r1
[    5.464000] , 
[    5.464000] r13
[    5.464000] 
[    5.464000] 
[    5.464000] ---[ end trace 8fe2f9c439309f6b ]---

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 23:12         ` John Paul Adrian Glaubitz
@ 2020-07-14 23:14           ` John Paul Adrian Glaubitz
  2020-07-15  3:12           ` Rich Felker
                             ` (2 subsequent siblings)
  3 siblings, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-14 23:14 UTC (permalink / raw)
  To: Rich Felker; +Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On 7/15/20 1:12 AM, John Paul Adrian Glaubitz wrote:
> See the traces below and let me know what you think.

(The second trace is redundant, I actually meant to post the two traces only
 and not the whole kernel boot sequence).

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 23:12         ` John Paul Adrian Glaubitz
  2020-07-14 23:14           ` John Paul Adrian Glaubitz
@ 2020-07-15  3:12           ` Rich Felker
  2020-07-15  6:39             ` John Paul Adrian Glaubitz
  2020-07-15  7:27           ` Geert Uytterhoeven
  2020-07-20 13:38           ` Christoph Hellwig
  3 siblings, 1 reply; 81+ messages in thread
From: Rich Felker @ 2020-07-15  3:12 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On Wed, Jul 15, 2020 at 01:12:33AM +0200, John Paul Adrian Glaubitz wrote:
> Hello!
> 
> I have applied Christoph's full series on top of Linus' tree and I can confirm that
> the kernel boots fine on my SH-7785LCR board.
> 
> Thus, for the whole series of patches:
> 
> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> 
> However, independent of Christoph's series, the kernels throws two backtraces during
> boot which I think should require a git bisect (unless I missed a configuration option
> as I trimmed down the kernel a bit to make sure it's not too big).
> 
> See the traces below and let me know what you think.

I've got a slightly earlier version (my for-next) built for qemu r2d
board, and don't get any such messages. Do you have a lock-debugging
option enabled that's catching a problem, perhaps?

Rich

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  3:12           ` Rich Felker
@ 2020-07-15  6:39             ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15  6:39 UTC (permalink / raw)
  To: Rich Felker; +Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On 7/15/20 5:12 AM, Rich Felker wrote:
>> See the traces below and let me know what you think.
> 
> I've got a slightly earlier version (my for-next) built for qemu r2d
> board, and don't get any such messages. Do you have a lock-debugging
> option enabled that's catching a problem, perhaps?

Which kernel option would be that?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 23:12         ` John Paul Adrian Glaubitz
  2020-07-14 23:14           ` John Paul Adrian Glaubitz
  2020-07-15  3:12           ` Rich Felker
@ 2020-07-15  7:27           ` Geert Uytterhoeven
  2020-07-15  7:37             ` John Paul Adrian Glaubitz
                               ` (2 more replies)
  2020-07-20 13:38           ` Christoph Hellwig
  3 siblings, 3 replies; 81+ messages in thread
From: Geert Uytterhoeven @ 2020-07-15  7:27 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Adrian,

On Wed, Jul 15, 2020 at 1:14 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> However, independent of Christoph's series, the kernels throws two backtraces during
> boot which I think should require a git bisect (unless I missed a configuration option
> as I trimmed down the kernel a bit to make sure it's not too big).
>
> See the traces below and let me know what you think.

> [    1.560000] sh-sci.1: ttySC1 at MMIO 0xffeb0000 (irq = 44, base_baud = 0) is a scif
> [    1.560000] BUG: spinlock bad magic on CPU#0, swapper/1
> [    1.560000]  lock: sci_ports+0x1d8/0xb10, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0

[PATCH v1] serial: core: Initialise spin lock before use in
uart_configure_port()
https://lore.kernel.org/r/20200706140036.75524-1-andriy.shevchenko@linux.intel.com

> [    1.560000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc5-00026-g22b7a96ece82 #3
> [    1.560000] Stack: (0x9f445ce8 to 0x9f446000)
> [    1.560000] 5ce0:
> [    1.560000]
> [    1.560000]
> [    1.560000] 80260daa
> [    1.560000] 9f445cfc
> [    1.560000] 80048fd8
> [    1.560000] 8096c158
> [    1.560000] 805ab908
> [    1.560000] 8004449c

Any plans to take "[PATCH v2 0/9] sh: Modernize printing of kernel messages"?
https://lore.kernel.org/r/20200617143639.18315-1-geert+renesas@glider.be


> [    5.464000] WARNING: CPU: 0 PID: 1 at mm/slab.c:2589 cache_alloc_refill+0x216/0x6a0
> [    5.464000] Modules linked in:
> [    5.464000]
> [    5.464000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc5-00026-g22b7a96ece82 #3
> [    5.464000] PC is at cache_alloc_refill+0x216/0x6a0
> [    5.464000] PR is at kmem_cache_alloc+0xd6/0x128
> [    5.464000] PC  : 800ec0d2 SP  : 9f445e68 SR  : 400080f0
> [    5.464000] TEA : c00c30d0
> [    5.464000] R0  : 8062724c R1  : 8000fee8 R2  : 9f403540 R3  : 00000100
> [    5.464000] R4  : 9f403500 R5  : 00000000 R6  : 8068d5b0 R7  : 007fffff
> [    5.464000] R8  : 0000000c R9  : 9f403500 R10 : 8096fc0c R11 : 80044410
> [    5.464000] R12 : 9f405060 R13 : 00000dc0 R14 : 9f445e68
> [    5.464000] MACH: 10623bba MACL: 00000cc0 GBR : 2957bd58 PR  : 800ec80a
> [    5.464000]
> [    5.464000] Call trace:
> [    5.464000]  [<(ptrval)>] _raw_spin_unlock_irqrestore+0x0/0x54
> [    5.464000]  [<(ptrval)>] _raw_spin_lock_irqsave+0x0/0x44
> [    5.464000]  [<(ptrval)>] kmem_cache_alloc+0xd6/0x128
> [    5.464000]  [<(ptrval)>] arch_local_irq_restore+0x0/0x2c
> [    5.464000]  [<(ptrval)>] __raw_spin_lock_init+0x0/0x1c
> [    5.464000]  [<(ptrval)>] pgd_alloc+0x10/0x24

Does commit 73c348f31b63d28d ("sh: Fix unneeded constructor in page
table allocation") in next-20200710 and later fix that?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  7:27           ` Geert Uytterhoeven
@ 2020-07-15  7:37             ` John Paul Adrian Glaubitz
  2020-07-15  8:06               ` Geert Uytterhoeven
  2020-07-15  7:46             ` John Paul Adrian Glaubitz
  2020-07-16 11:31             ` John Paul Adrian Glaubitz
  2 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15  7:37 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Geert!

On 7/15/20 9:27 AM, Geert Uytterhoeven wrote:
> Hi Adrian,
> 
> On Wed, Jul 15, 2020 at 1:14 AM John Paul Adrian Glaubitz
> <glaubitz@physik.fu-berlin.de> wrote:
>> However, independent of Christoph's series, the kernels throws two backtraces during
>> boot which I think should require a git bisect (unless I missed a configuration option
>> as I trimmed down the kernel a bit to make sure it's not too big).
>>
>> See the traces below and let me know what you think.
> 
>> [    1.560000] sh-sci.1: ttySC1 at MMIO 0xffeb0000 (irq = 44, base_baud = 0) is a scif
>> [    1.560000] BUG: spinlock bad magic on CPU#0, swapper/1
>> [    1.560000]  lock: sci_ports+0x1d8/0xb10, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
> 
> [PATCH v1] serial: core: Initialise spin lock before use in
> uart_configure_port()
> https://lore.kernel.org/r/20200706140036.75524-1-andriy.shevchenko@linux.intel.com
Yes, this patch fixes this particular problem.

There is just a typo in the code which causes a build problem but it's fixed by replacing
"uport" with "port":

  CC      kernel/module.o
drivers/tty/serial/serial_core.c: In function ‘uart_configure_port’:
drivers/tty/serial/serial_core.c:2385:33: error: ‘uport’ undeclared (first use in this function); did you mean ‘port’?
 2385 |    uart_any_port_spin_lock_init(uport);
      |                                 ^~~~~
      |                                 port
drivers/tty/serial/serial_core.c:2385:33: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [scripts/Makefile.build:280: drivers/tty/serial/serial_core.o] Error 1
make[2]: *** [scripts/Makefile.build:497: drivers/tty/serial] Error 2
make[1]: *** [scripts/Makefile.build:497: drivers/tty] Error 2
make[1]: *** Waiting for unfinished jobs....
  AR      drivers/base/firmware_loader/built-in.a

Will test the other changes in a minute.

Can we include the serial fix?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  7:27           ` Geert Uytterhoeven
  2020-07-15  7:37             ` John Paul Adrian Glaubitz
@ 2020-07-15  7:46             ` John Paul Adrian Glaubitz
  2020-07-15  8:07               ` Geert Uytterhoeven
       [not found]               ` <b5f1853e-031d-c09d-57d2-fb4baffa01ea@physik.fu-berlin.de>
  2020-07-16 11:31             ` John Paul Adrian Glaubitz
  2 siblings, 2 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15  7:46 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

On 7/15/20 9:27 AM, Geert Uytterhoeven wrote:
>> [    5.464000] WARNING: CPU: 0 PID: 1 at mm/slab.c:2589 cache_alloc_refill+0x216/0x6a0
>> [    5.464000] Modules linked in:
>> [    5.464000]
>> [    5.464000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc5-00026-g22b7a96ece82 #3
>> [    5.464000] PC is at cache_alloc_refill+0x216/0x6a0
>> [    5.464000] PR is at kmem_cache_alloc+0xd6/0x128
>> [    5.464000] PC  : 800ec0d2 SP  : 9f445e68 SR  : 400080f0
>> [    5.464000] TEA : c00c30d0
>> [    5.464000] R0  : 8062724c R1  : 8000fee8 R2  : 9f403540 R3  : 00000100
>> [    5.464000] R4  : 9f403500 R5  : 00000000 R6  : 8068d5b0 R7  : 007fffff
>> [    5.464000] R8  : 0000000c R9  : 9f403500 R10 : 8096fc0c R11 : 80044410
>> [    5.464000] R12 : 9f405060 R13 : 00000dc0 R14 : 9f445e68
>> [    5.464000] MACH: 10623bba MACL: 00000cc0 GBR : 2957bd58 PR  : 800ec80a
>> [    5.464000]
>> [    5.464000] Call trace:
>> [    5.464000]  [<(ptrval)>] _raw_spin_unlock_irqrestore+0x0/0x54
>> [    5.464000]  [<(ptrval)>] _raw_spin_lock_irqsave+0x0/0x44
>> [    5.464000]  [<(ptrval)>] kmem_cache_alloc+0xd6/0x128
>> [    5.464000]  [<(ptrval)>] arch_local_irq_restore+0x0/0x2c
>> [    5.464000]  [<(ptrval)>] __raw_spin_lock_init+0x0/0x1c
>> [    5.464000]  [<(ptrval)>] pgd_alloc+0x10/0x24
> 
> Does commit 73c348f31b63d28d ("sh: Fix unneeded constructor in page
> table allocation") in next-20200710 and later fix that?

Indeed, it does. This patch should be picked up as well.

Kernel boots without any errors now.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  7:37             ` John Paul Adrian Glaubitz
@ 2020-07-15  8:06               ` Geert Uytterhoeven
  0 siblings, 0 replies; 81+ messages in thread
From: Geert Uytterhoeven @ 2020-07-15  8:06 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Adrian,

On Wed, Jul 15, 2020 at 9:37 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On 7/15/20 9:27 AM, Geert Uytterhoeven wrote:
> > On Wed, Jul 15, 2020 at 1:14 AM John Paul Adrian Glaubitz
> > <glaubitz@physik.fu-berlin.de> wrote:
> >> However, independent of Christoph's series, the kernels throws two backtraces during
> >> boot which I think should require a git bisect (unless I missed a configuration option
> >> as I trimmed down the kernel a bit to make sure it's not too big).
> >>
> >> See the traces below and let me know what you think.
> >
> >> [    1.560000] sh-sci.1: ttySC1 at MMIO 0xffeb0000 (irq = 44, base_baud = 0) is a scif
> >> [    1.560000] BUG: spinlock bad magic on CPU#0, swapper/1
> >> [    1.560000]  lock: sci_ports+0x1d8/0xb10, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
> >
> > [PATCH v1] serial: core: Initialise spin lock before use in
> > uart_configure_port()
> > https://lore.kernel.org/r/20200706140036.75524-1-andriy.shevchenko@linux.intel.com
> Yes, this patch fixes this particular problem.
>
> There is just a typo in the code which causes a build problem but it's fixed by replacing
> "uport" with "port":

Oops, there's a v2 fixing that:
https://lore.kernel.org/linux-serial/20200706143548.63985-1-andriy.shevchenko@linux.intel.com/

>   CC      kernel/module.o
> drivers/tty/serial/serial_core.c: In function ‘uart_configure_port’:
> drivers/tty/serial/serial_core.c:2385:33: error: ‘uport’ undeclared (first use in this function); did you mean ‘port’?
>  2385 |    uart_any_port_spin_lock_init(uport);
>       |                                 ^~~~~
>       |                                 port
> drivers/tty/serial/serial_core.c:2385:33: note: each undeclared identifier is reported only once for each function it appears in
> make[3]: *** [scripts/Makefile.build:280: drivers/tty/serial/serial_core.o] Error 1
> make[2]: *** [scripts/Makefile.build:497: drivers/tty/serial] Error 2
> make[1]: *** [scripts/Makefile.build:497: drivers/tty] Error 2
> make[1]: *** Waiting for unfinished jobs....
>   AR      drivers/base/firmware_loader/built-in.a
>
> Will test the other changes in a minute.
>
> Can we include the serial fix?

Please be patient. I expect this to be fixed soon through the tty tree.

Note that linux-next already has an alternative fix (f38278e9b810b06a
("serial: sh-sci: Initialize spinlock for uart console")), which is
planned to be reverted once the real fix has been applied.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  7:46             ` John Paul Adrian Glaubitz
@ 2020-07-15  8:07               ` Geert Uytterhoeven
       [not found]               ` <b5f1853e-031d-c09d-57d2-fb4baffa01ea@physik.fu-berlin.de>
  1 sibling, 0 replies; 81+ messages in thread
From: Geert Uytterhoeven @ 2020-07-15  8:07 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Adrian,

On Wed, Jul 15, 2020 at 9:46 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On 7/15/20 9:27 AM, Geert Uytterhoeven wrote:
> >> [    5.464000] WARNING: CPU: 0 PID: 1 at mm/slab.c:2589 cache_alloc_refill+0x216/0x6a0
> >> [    5.464000] Modules linked in:
> >> [    5.464000]
> >> [    5.464000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc5-00026-g22b7a96ece82 #3
> >> [    5.464000] PC is at cache_alloc_refill+0x216/0x6a0
> >> [    5.464000] PR is at kmem_cache_alloc+0xd6/0x128
> >> [    5.464000] PC  : 800ec0d2 SP  : 9f445e68 SR  : 400080f0
> >> [    5.464000] TEA : c00c30d0
> >> [    5.464000] R0  : 8062724c R1  : 8000fee8 R2  : 9f403540 R3  : 00000100
> >> [    5.464000] R4  : 9f403500 R5  : 00000000 R6  : 8068d5b0 R7  : 007fffff
> >> [    5.464000] R8  : 0000000c R9  : 9f403500 R10 : 8096fc0c R11 : 80044410
> >> [    5.464000] R12 : 9f405060 R13 : 00000dc0 R14 : 9f445e68
> >> [    5.464000] MACH: 10623bba MACL: 00000cc0 GBR : 2957bd58 PR  : 800ec80a
> >> [    5.464000]
> >> [    5.464000] Call trace:
> >> [    5.464000]  [<(ptrval)>] _raw_spin_unlock_irqrestore+0x0/0x54
> >> [    5.464000]  [<(ptrval)>] _raw_spin_lock_irqsave+0x0/0x44
> >> [    5.464000]  [<(ptrval)>] kmem_cache_alloc+0xd6/0x128
> >> [    5.464000]  [<(ptrval)>] arch_local_irq_restore+0x0/0x2c
> >> [    5.464000]  [<(ptrval)>] __raw_spin_lock_init+0x0/0x1c
> >> [    5.464000]  [<(ptrval)>] pgd_alloc+0x10/0x24
> >
> > Does commit 73c348f31b63d28d ("sh: Fix unneeded constructor in page
> > table allocation") in next-20200710 and later fix that?
>
> Indeed, it does. This patch should be picked up as well.

It already has been picked up, as it is in linux-next.

> Kernel boots without any errors now.

Happy to hear that!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
       [not found]               ` <b5f1853e-031d-c09d-57d2-fb4baffa01ea@physik.fu-berlin.de>
@ 2020-07-15  8:11                 ` Geert Uytterhoeven
  2020-07-15  8:27                   ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 81+ messages in thread
From: Geert Uytterhoeven @ 2020-07-15  8:11 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Adrian,

On Wed, Jul 15, 2020 at 9:51 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On 7/15/20 9:46 AM, John Paul Adrian Glaubitz wrote:
> > Indeed, it does. This patch should be picked up as well.
> >
> > Kernel boots without any errors now.
>
> Btw, booting with systemd as init causes a lot of hickups which I didn't see with 3.16:

> [   25.184000] BUG: Bad page state in process systemd-hiberna  pfn:5d91a

Lemme gues: does commit 002ae7057069538a ("mm, dump_page(): do not crash
with invalid mapping pointer") in v5.8-rc1 help?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  8:11                 ` Geert Uytterhoeven
@ 2020-07-15  8:27                   ` John Paul Adrian Glaubitz
  2020-07-15 14:37                     ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15  8:27 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi!

On 7/15/20 10:11 AM, Geert Uytterhoeven wrote:
>> Btw, booting with systemd as init causes a lot of hickups which I didn't see with 3.16:
> 
>> [   25.184000] BUG: Bad page state in process systemd-hiberna  pfn:5d91a
> 
> Lemme gues: does commit 002ae7057069538a ("mm, dump_page(): do not crash
> with invalid mapping pointer") in v5.8-rc1 help?

Hmm, it seems I already have that patch (I'm using Linus' main tree):

commit 002ae7057069538aa3afd500f6f60a429cb948b2
Author: Vlastimil Babka <vbabka@suse.cz>
Date:   Mon Jun 1 21:46:03 2020 -0700

    mm, dump_page(): do not crash with invalid mapping pointer

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  8:27                   ` John Paul Adrian Glaubitz
@ 2020-07-15 14:37                     ` John Paul Adrian Glaubitz
  2020-07-15 15:39                       ` John Paul Adrian Glaubitz
  2020-07-15 16:18                       ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15 14:37 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Geert!

On 7/15/20 10:27 AM, John Paul Adrian Glaubitz wrote:
>> Lemme gues: does commit 002ae7057069538a ("mm, dump_page(): do not crash
>> with invalid mapping pointer") in v5.8-rc1 help?
> 
> Hmm, it seems I already have that patch (I'm using Linus' main tree):
> 
> commit 002ae7057069538aa3afd500f6f60a429cb948b2
> Author: Vlastimil Babka <vbabka@suse.cz>
> Date:   Mon Jun 1 21:46:03 2020 -0700
> 
>     mm, dump_page(): do not crash with invalid mapping pointer

Okay, kernel 5.0.0 does not suffer from this bug. So I should be able to bisect
this particular issue.

I'm glad I don't have to start bisecting with earlier kernels because these
won't build easily with my current toolchain based on gcc-9.

Will report once I found the bad commit that introduced the problem.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15 14:37                     ` John Paul Adrian Glaubitz
@ 2020-07-15 15:39                       ` John Paul Adrian Glaubitz
  2020-07-15 16:18                       ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15 15:39 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

On 7/15/20 4:37 PM, John Paul Adrian Glaubitz wrote:
> Will report once I found the bad commit that introduced the problem.

git bisect lead me to a merge commit:

glaubitz@epyc:..glaubitz/linux> git bisect log
git bisect start
# good: [1c163f4c7b3f621efff9b28a47abb36f7378d783] Linux 5.0
git bisect good 1c163f4c7b3f621efff9b28a47abb36f7378d783
# bad: [7bc20f6563b4e117d61ca575427208e0eaa945b9] sh: Fix unneeded constructor in page table allocation
git bisect bad 7bc20f6563b4e117d61ca575427208e0eaa945b9
# bad: [eeb2045bb7d20fea0a242148059377cd0cb4a499] Merge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
git bisect bad eeb2045bb7d20fea0a242148059377cd0cb4a499
# bad: [5ce40fd86cf155e0eefc73509343bb3eeaafa4bc] drm/amdgpu: add Arcturus chip_name for init sdma microcode
git bisect bad 5ce40fd86cf155e0eefc73509343bb3eeaafa4bc
# good: [8f14c99c7edaaba9c0bb1727d44db6ebf157cc61] netfilter: conntrack: limit sysctl setting for boolean options
git bisect good 8f14c99c7edaaba9c0bb1727d44db6ebf157cc61
# good: [dce45af5c2e9e85f22578f2f8065f225f5d11764] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
git bisect good dce45af5c2e9e85f22578f2f8065f225f5d11764
# bad: [60fce36afa9c77c7ccbf980c4f670f3be3651fce] mm/compaction.c: correct zone boundary handling when isolating pages from a pageblock
git bisect bad 60fce36afa9c77c7ccbf980c4f670f3be3651fce
# bad: [414147d99b928c574ed76e9374a5d2cb77866a29] Merge tag 'pci-v5.2-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
git bisect bad 414147d99b928c574ed76e9374a5d2cb77866a29
# bad: [1fb3b526df3bd7647e7854915ae6b22299408baf] Merge tag 'docs-5.2a' of git://git.lwn.net/linux
git bisect bad 1fb3b526df3bd7647e7854915ae6b22299408baf
# bad: [ea5aee6d97fd2d4499b1eebc233861c1def70f06] Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
git bisect bad ea5aee6d97fd2d4499b1eebc233861c1def70f06
# bad: [45182e4e1f8ac04708ca7508c51d9103f07d81ab] Merge branch 'i2c/for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
git bisect bad 45182e4e1f8ac04708ca7508c51d9103f07d81ab
# good: [5940d1cf9f42f67e9cc3f7df9eda39f5888d6e9e] SUNRPC: Rebalance a kref in auth_gss.c
git bisect good 5940d1cf9f42f67e9cc3f7df9eda39f5888d6e9e
# bad: [abde77eb5c66b2f98539c4644b54f34b7e179e6b] Merge branch 'for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
git bisect bad abde77eb5c66b2f98539c4644b54f34b7e179e6b
# bad: [7664cd6e3a0b2709f04c07435e96c7c85e7d7324] Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
git bisect bad 7664cd6e3a0b2709f04c07435e96c7c85e7d7324
# good: [3e9dfc6e1e8bce62a329f1452c7eeccbac230980] orangefs: move do_readv_writev to direct_IO
git bisect good 3e9dfc6e1e8bce62a329f1452c7eeccbac230980
# good: [4077a0f25b001926f86d35f6236351583bada9a4] orangefs: pass slot index back to readpage.
git bisect good 4077a0f25b001926f86d35f6236351583bada9a4
# good: [2bfebea90dd5e8c57ae1021a5d1bb6c1057eee6d] Merge branch 'next-integrity-for-james' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity into next-integrity
git bisect good 2bfebea90dd5e8c57ae1021a5d1bb6c1057eee6d
# good: [33713cd09ccdc1e01b10d0782ae60200d4989553] orangefs: truncate before updating size
git bisect good 33713cd09ccdc1e01b10d0782ae60200d4989553
# bad: [882388056194d2d4c3f589b194b6bdcc47e677e8] Merge tag 'for-linus-5.2-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux
git bisect bad 882388056194d2d4c3f589b194b6bdcc47e677e8
# first bad commit: [882388056194d2d4c3f589b194b6bdcc47e677e8] Merge tag 'for-linus-5.2-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux
glaubitz@epyc:..glaubitz/linux>

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15 14:37                     ` John Paul Adrian Glaubitz
  2020-07-15 15:39                       ` John Paul Adrian Glaubitz
@ 2020-07-15 16:18                       ` John Paul Adrian Glaubitz
  2020-07-15 18:21                         ` Geert Uytterhoeven
  2020-07-16 11:30                         ` John Paul Adrian Glaubitz
  1 sibling, 2 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15 16:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List, Peter Zijlstra

On 7/15/20 4:37 PM, John Paul Adrian Glaubitz wrote:
> Okay, kernel 5.0.0 does not suffer from this bug. So I should be able to bisect
> this particular issue.
> 
> I'm glad I don't have to start bisecting with earlier kernels because these
> won't build easily with my current toolchain based on gcc-9.
> 
> Will report once I found the bad commit that introduced the problem.

Found the culprit:

c5b27a889da92f4a969d61df77bd4f79ffce57c9 is the first bad commit
commit c5b27a889da92f4a969d61df77bd4f79ffce57c9
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Sep 4 14:45:04 2018 +0200

    sh/tlb: Convert SH to generic mmu_gather
    
    Generic mmu_gather provides everything SH needs (range tracking and
    cache coherency).
    
    No change in behavior intended.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Nick Piggin <npiggin@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rich Felker <dalias@libc.org>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

 arch/sh/include/asm/pgalloc.h |   9 +++
 arch/sh/include/asm/tlb.h     | 130 +-----------------------------------------
 2 files changed, 10 insertions(+), 129 deletions(-)

CC'ing the author (Peter Zijlstra <peterz@infradead.org>).

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15 16:18                       ` John Paul Adrian Glaubitz
@ 2020-07-15 18:21                         ` Geert Uytterhoeven
  2020-07-15 18:27                           ` John Paul Adrian Glaubitz
  2020-07-16  9:40                           ` Peter Zijlstra
  2020-07-16 11:30                         ` John Paul Adrian Glaubitz
  1 sibling, 2 replies; 81+ messages in thread
From: Geert Uytterhoeven @ 2020-07-15 18:21 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List, Peter Zijlstra

On Wed, Jul 15, 2020 at 6:18 PM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
> On 7/15/20 4:37 PM, John Paul Adrian Glaubitz wrote:
> > Okay, kernel 5.0.0 does not suffer from this bug. So I should be able to bisect
> > this particular issue.
> >
> > I'm glad I don't have to start bisecting with earlier kernels because these
> > won't build easily with my current toolchain based on gcc-9.
> >
> > Will report once I found the bad commit that introduced the problem.
>
> Found the culprit:
>
> c5b27a889da92f4a969d61df77bd4f79ffce57c9 is the first bad commit
> commit c5b27a889da92f4a969d61df77bd4f79ffce57c9
> Author: Peter Zijlstra <peterz@infradead.org>
> Date:   Tue Sep 4 14:45:04 2018 +0200
>
>     sh/tlb: Convert SH to generic mmu_gather
>
>     Generic mmu_gather provides everything SH needs (range tracking and
>     cache coherency).
>
>     No change in behavior intended.
>
>     Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>     Cc: Andrew Morton <akpm@linux-foundation.org>
>     Cc: Andy Lutomirski <luto@kernel.org>
>     Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>     Cc: Borislav Petkov <bp@alien8.de>
>     Cc: Dave Hansen <dave.hansen@linux.intel.com>
>     Cc: H. Peter Anvin <hpa@zytor.com>
>     Cc: Linus Torvalds <torvalds@linux-foundation.org>
>     Cc: Nick Piggin <npiggin@gmail.com>
>     Cc: Peter Zijlstra <peterz@infradead.org>
>     Cc: Rich Felker <dalias@libc.org>
>     Cc: Rik van Riel <riel@surriel.com>
>     Cc: Thomas Gleixner <tglx@linutronix.de>
>     Cc: Will Deacon <will.deacon@arm.com>
>     Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>     Signed-off-by: Ingo Molnar <mingo@kernel.org>
>
>  arch/sh/include/asm/pgalloc.h |   9 +++
>  arch/sh/include/asm/tlb.h     | 130 +-----------------------------------------
>  2 files changed, 10 insertions(+), 129 deletions(-)
>
> CC'ing the author (Peter Zijlstra <peterz@infradead.org>).

Oh, we actually discussed that:
https://lore.kernel.org/linux-mm/20191204133454.GW2844@hirez.programming.kicks-ass.net/
but there was no conclusion...

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15 18:21                         ` Geert Uytterhoeven
@ 2020-07-15 18:27                           ` John Paul Adrian Glaubitz
  2020-07-16  9:40                           ` Peter Zijlstra
  1 sibling, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-15 18:27 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List, Peter Zijlstra

On 7/15/20 8:21 PM, Geert Uytterhoeven wrote:
>> CC'ing the author (Peter Zijlstra <peterz@infradead.org>).
> 
> Oh, we actually discussed that:
> https://lore.kernel.org/linux-mm/20191204133454.GW2844@hirez.programming.kicks-ass.net/
> but there was no conclusion...

Aha, interesting. The question is whether someone can make use of the crash dump
in this case. I'm surprised it affects init=/bin/systemd but not init=/bin/bash
but maybe the problem with systemd here is a larger memory footprint.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15 18:21                         ` Geert Uytterhoeven
  2020-07-15 18:27                           ` John Paul Adrian Glaubitz
@ 2020-07-16  9:40                           ` Peter Zijlstra
  2020-07-16 10:05                             ` John Paul Adrian Glaubitz
  2020-07-16 10:29                             ` peterz
  1 sibling, 2 replies; 81+ messages in thread
From: Peter Zijlstra @ 2020-07-16  9:40 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Paul Adrian Glaubitz, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

On Wed, Jul 15, 2020 at 08:21:27PM +0200, Geert Uytterhoeven wrote:

> Oh, we actually discussed that:
> https://lore.kernel.org/linux-mm/20191204133454.GW2844@hirez.programming.kicks-ass.net/
> but there was no conclusion...

Urgh.. clearly that fell off the table :-(

So yes, that patch works, but as I wrote, I think it's still broken.
Then again, that particular breakage has been there for a long time.

Ooohh.. I have another whole patch-set that fixes that across
architectures which I forgot about too:

  https://lkml.kernel.org/r/20191211120713.360281197@infradead.org

that actually included the SH fix.

Then Aneesh got a bunch of those patches merged because he needed it for
Power, but the rest bitrotted again.

Let me rebase/refresh the rest of that and send it out again.

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16  9:40                           ` Peter Zijlstra
@ 2020-07-16 10:05                             ` John Paul Adrian Glaubitz
  2020-07-16 10:29                             ` peterz
  1 sibling, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-16 10:05 UTC (permalink / raw)
  To: Peter Zijlstra, Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Peter!

On 7/16/20 11:40 AM, Peter Zijlstra wrote:
> On Wed, Jul 15, 2020 at 08:21:27PM +0200, Geert Uytterhoeven wrote:
> 
>> Oh, we actually discussed that:
>> https://lore.kernel.org/linux-mm/20191204133454.GW2844@hirez.programming.kicks-ass.net/
>> but there was no conclusion...
> 
> Urgh.. clearly that fell off the table :-(
> 
> So yes, that patch works, but as I wrote, I think it's still broken.
> Then again, that particular breakage has been there for a long time.
> 
> Ooohh.. I have another whole patch-set that fixes that across
> architectures which I forgot about too:
> 
>   https://lkml.kernel.org/r/20191211120713.360281197@infradead.org
> 
> that actually included the SH fix.
> 
> Then Aneesh got a bunch of those patches merged because he needed it for
> Power, but the rest bitrotted again.
> 
> Let me rebase/refresh the rest of that and send it out again.

Sounds good. Do you think this new patch set could fix the crash of systemd
that I observed on SH that was introduced with your previous patch?

Thanks,
Adrian

> [1] https://marc.info/?l=linux-kernel&m\x159479951822677&w=2

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16  9:40                           ` Peter Zijlstra
  2020-07-16 10:05                             ` John Paul Adrian Glaubitz
@ 2020-07-16 10:29                             ` peterz
  2020-07-16 10:54                               ` John Paul Adrian Glaubitz
  1 sibling, 1 reply; 81+ messages in thread
From: peterz @ 2020-07-16 10:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Paul Adrian Glaubitz, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

On Thu, Jul 16, 2020 at 11:40:39AM +0200, Peter Zijlstra wrote:
> On Wed, Jul 15, 2020 at 08:21:27PM +0200, Geert Uytterhoeven wrote:
> 
> > Oh, we actually discussed that:
> > https://lore.kernel.org/linux-mm/20191204133454.GW2844@hirez.programming.kicks-ass.net/
> > but there was no conclusion...
> 
> Urgh.. clearly that fell off the table :-(
> 
> So yes, that patch works, but as I wrote, I think it's still broken.
> Then again, that particular breakage has been there for a long time.
> 
> Ooohh.. I have another whole patch-set that fixes that across
> architectures which I forgot about too:
> 
>   https://lkml.kernel.org/r/20191211120713.360281197@infradead.org
> 
> that actually included the SH fix.
> 
> Then Aneesh got a bunch of those patches merged because he needed it for
> Power, but the rest bitrotted again.
> 
> Let me rebase/refresh the rest of that and send it out again.

OK, latest patches here:

  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git mm/tlb

I'll post once the robot is all green.

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 10:29                             ` peterz
@ 2020-07-16 10:54                               ` John Paul Adrian Glaubitz
  2020-07-16 11:01                                 ` peterz
  0 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-16 10:54 UTC (permalink / raw)
  To: peterz, Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Peter!

On 7/16/20 12:29 PM, peterz@infradead.org wrote:
>> Then Aneesh got a bunch of those patches merged because he needed it for
>> Power, but the rest bitrotted again.
>>
>> Let me rebase/refresh the rest of that and send it out again.
> 
> OK, latest patches here:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git mm/tlb
> 
> I'll post once the robot is all green.

Thanks. I just cherry-picked the two patches for SH and applied them on top
of Linus' tree plus the patch 73c348f31b63d28d ("sh: Fix unneeded constructor
in page table allocation") from next-20200710.

The build fails with:

  CC      mm/mmu_gather.o
mm/mmu_gather.c: In function ‘tlb_table_invalidate’:
mm/mmu_gather.c:180:6: error: implicit declaration of function ‘tlb_needs_table_invalidate’; did you mean ‘tlb_table_invalidate’? [-Werror=implicit-function-declaration]
  180 |  if (tlb_needs_table_invalidate()) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |      tlb_table_invalidate
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:281: mm/mmu_gather.o] Error 1
make: *** [Makefile:1756: mm] Error 2

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 10:54                               ` John Paul Adrian Glaubitz
@ 2020-07-16 11:01                                 ` peterz
  2020-07-16 11:03                                   ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 81+ messages in thread
From: peterz @ 2020-07-16 11:01 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Geert Uytterhoeven, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

On Thu, Jul 16, 2020 at 12:54:51PM +0200, John Paul Adrian Glaubitz wrote:
> Hi Peter!
> 
> On 7/16/20 12:29 PM, peterz@infradead.org wrote:
> >> Then Aneesh got a bunch of those patches merged because he needed it for
> >> Power, but the rest bitrotted again.
> >>
> >> Let me rebase/refresh the rest of that and send it out again.
> > 
> > OK, latest patches here:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git mm/tlb
> > 
> > I'll post once the robot is all green.
> 
> Thanks. I just cherry-picked the two patches for SH and applied them on top
> of Linus' tree plus the patch 73c348f31b63d28d ("sh: Fix unneeded constructor
> in page table allocation") from next-20200710.
> 
> The build fails with:
> 
>   CC      mm/mmu_gather.o
> mm/mmu_gather.c: In function ‘tlb_table_invalidate’:
> mm/mmu_gather.c:180:6: error: implicit declaration of function ‘tlb_needs_table_invalidate’; did you mean ‘tlb_table_invalidate’? [-Werror=implicit-function-declaration]
>   180 |  if (tlb_needs_table_invalidate()) {
>       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
>       |      tlb_table_invalidate
> cc1: some warnings being treated as errors
> make[1]: *** [scripts/Makefile.build:281: mm/mmu_gather.o] Error 1
> make: *** [Makefile:1756: mm] Error 2

*sigh*, thanks, I'll go dig out the local cross compiler set then.

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 11:01                                 ` peterz
@ 2020-07-16 11:03                                   ` John Paul Adrian Glaubitz
  2020-07-16 11:37                                     ` peterz
  0 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-16 11:03 UTC (permalink / raw)
  To: peterz
  Cc: Geert Uytterhoeven, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

Hi Peter!

On 7/16/20 1:01 PM, peterz@infradead.org wrote:
>> The build fails with:
>>
>>   CC      mm/mmu_gather.o
>> mm/mmu_gather.c: In function ‘tlb_table_invalidate’:
>> mm/mmu_gather.c:180:6: error: implicit declaration of function ‘tlb_needs_table_invalidate’; did you mean ‘tlb_table_invalidate’? [-Werror=implicit-function-declaration]
>>   180 |  if (tlb_needs_table_invalidate()) {
>>       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
>>       |      tlb_table_invalidate
>> cc1: some warnings being treated as errors
>> make[1]: *** [scripts/Makefile.build:281: mm/mmu_gather.o] Error 1
>> make: *** [Makefile:1756: mm] Error 2
> 
> *sigh*, thanks, I'll go dig out the local cross compiler set then.

FWIW, I recommend keeping a Debian box at hand where installing the cross-compiler
is a matter of running "apt install gcc-sh4-linux-gnu" ;-).

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15 16:18                       ` John Paul Adrian Glaubitz
  2020-07-15 18:21                         ` Geert Uytterhoeven
@ 2020-07-16 11:30                         ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-16 11:30 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List, Peter Zijlstra

On 7/15/20 6:18 PM, John Paul Adrian Glaubitz wrote:
> Found the culprit:
> 
> c5b27a889da92f4a969d61df77bd4f79ffce57c9 is the first bad commit
> commit c5b27a889da92f4a969d61df77bd4f79ffce57c9
> Author: Peter Zijlstra <peterz@infradead.org>
> Date:   Tue Sep 4 14:45:04 2018 +0200
> 
>     sh/tlb: Convert SH to generic mmu_gather
>     
>     Generic mmu_gather provides everything SH needs (range tracking and
>     cache coherency).
>     
>     No change in behavior intended.
>     
>     Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>     Cc: Andrew Morton <akpm@linux-foundation.org>
>     Cc: Andy Lutomirski <luto@kernel.org>
>     Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>     Cc: Borislav Petkov <bp@alien8.de>
>     Cc: Dave Hansen <dave.hansen@linux.intel.com>
>     Cc: H. Peter Anvin <hpa@zytor.com>
>     Cc: Linus Torvalds <torvalds@linux-foundation.org>
>     Cc: Nick Piggin <npiggin@gmail.com>
>     Cc: Peter Zijlstra <peterz@infradead.org>
>     Cc: Rich Felker <dalias@libc.org>
>     Cc: Rik van Riel <riel@surriel.com>
>     Cc: Thomas Gleixner <tglx@linutronix.de>
>     Cc: Will Deacon <will.deacon@arm.com>
>     Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>     Signed-off-by: Ingo Molnar <mingo@kernel.org>
> 
>  arch/sh/include/asm/pgalloc.h |   9 +++
>  arch/sh/include/asm/tlb.h     | 130 +-----------------------------------------
>  2 files changed, 10 insertions(+), 129 deletions(-)
> 
> CC'ing the author (Peter Zijlstra <peterz@infradead.org>).
This is fixed by [1]:

sh/tlb: Fix PGTABLE_LEVELS > 2

Geert reported that his SH7722-based Migo-R board failed to boot after
commit:

  c5b27a889da9 ("sh/tlb: Convert SH to generic mmu_gather")

That commit fell victim to copying the wrong pattern --
__pmd_free_tlb() used to be implemented with pmd_free().

Fixes: c5b27a889da9 ("sh/tlb: Convert SH to generic mmu_gather")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

I'm now running a current kernel on my SH-7785LCR with no issues.

Adrian

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=mm/tlb&id\x1f19a4bf8dcb42efc278940fb81c288c346b3eda

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-15  7:27           ` Geert Uytterhoeven
  2020-07-15  7:37             ` John Paul Adrian Glaubitz
  2020-07-15  7:46             ` John Paul Adrian Glaubitz
@ 2020-07-16 11:31             ` John Paul Adrian Glaubitz
  2 siblings, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-16 11:31 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List

Hi Geert!

On 7/15/20 9:27 AM, Geert Uytterhoeven wrote:
> Any plans to take "[PATCH v2 0/9] sh: Modernize printing of kernel messages"?
> https://lore.kernel.org/r/20200617143639.18315-1-geert+renesas@glider.be
@Rich: Any chance we can pick this one up?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 11:03                                   ` John Paul Adrian Glaubitz
@ 2020-07-16 11:37                                     ` peterz
  2020-07-16 12:04                                       ` peterz
  0 siblings, 1 reply; 81+ messages in thread
From: peterz @ 2020-07-16 11:37 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Geert Uytterhoeven, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

On Thu, Jul 16, 2020 at 01:03:36PM +0200, John Paul Adrian Glaubitz wrote:
> Hi Peter!
> 
> On 7/16/20 1:01 PM, peterz@infradead.org wrote:
> >> The build fails with:
> >>
> >>   CC      mm/mmu_gather.o
> >> mm/mmu_gather.c: In function ‘tlb_table_invalidate’:
> >> mm/mmu_gather.c:180:6: error: implicit declaration of function ‘tlb_needs_table_invalidate’; did you mean ‘tlb_table_invalidate’? [-Werror=implicit-function-declaration]
> >>   180 |  if (tlb_needs_table_invalidate()) {
> >>       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
> >>       |      tlb_table_invalidate
> >> cc1: some warnings being treated as errors
> >> make[1]: *** [scripts/Makefile.build:281: mm/mmu_gather.o] Error 1
> >> make: *** [Makefile:1756: mm] Error 2
> > 
> > *sigh*, thanks, I'll go dig out the local cross compiler set then.
> 
> FWIW, I recommend keeping a Debian box at hand where installing the cross-compiler
> is a matter of running "apt install gcc-sh4-linux-gnu" ;-).

I happen to have Debian on most of my machines ;-) And I used to
crosstool build my own toolchains for a while, but these days I mostly
just fetch them from kernel.org, since they're being kept up-to-date
fairly often.

$ /opt/cross/bin/sh4-linux-gcc --version
sh4-linux-gcc (GCC) 10.1.0

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 11:37                                     ` peterz
@ 2020-07-16 12:04                                       ` peterz
  2020-07-16 18:14                                         ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 81+ messages in thread
From: peterz @ 2020-07-16 12:04 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Geert Uytterhoeven, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

On Thu, Jul 16, 2020 at 01:37:20PM +0200, peterz@infradead.org wrote:
> $ /opt/cross/bin/sh4-linux-gcc --version
> sh4-linux-gcc (GCC) 10.1.0

$ git checkout origin/master # linus' tree
$ mkdir sh-defconfig
$ make O=sh-defconfig/ ARCH=sh CROSS_COMPILE=/opt/cross/bin/sh4-linux- defconfig # shx3_defconfig
$ make O=sh-defconfig/ ARCH=sh CROSS_COMPILE=/opt/cross/bin/sh4-linux- -j80

insane stream of errors


Help?

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 12:04                                       ` peterz
@ 2020-07-16 18:14                                         ` John Paul Adrian Glaubitz
  2020-07-16 19:28                                           ` Peter Zijlstra
  0 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-16 18:14 UTC (permalink / raw)
  To: peterz
  Cc: Geert Uytterhoeven, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

Hi Peter!

On 7/16/20 2:04 PM, peterz@infradead.org wrote:
> On Thu, Jul 16, 2020 at 01:37:20PM +0200, peterz@infradead.org wrote:
>> $ /opt/cross/bin/sh4-linux-gcc --version
>> sh4-linux-gcc (GCC) 10.1.0
> 
> $ git checkout origin/master # linus' tree
> $ mkdir sh-defconfig
> $ make O=sh-defconfig/ ARCH=sh CROSS_COMPILE=/opt/cross/bin/sh4-linux- defconfig # shx3_defconfig
> $ make O=sh-defconfig/ ARCH=sh CROSS_COMPILE=/opt/cross/bin/sh4-linux- -j80
> 
> insane stream of errors

I assume it's a problem with your toolchain. I will try to reproduce it tonight
or tomorrow.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 18:14                                         ` John Paul Adrian Glaubitz
@ 2020-07-16 19:28                                           ` Peter Zijlstra
  2020-07-16 19:33                                             ` John Paul Adrian Glaubitz
  0 siblings, 1 reply; 81+ messages in thread
From: Peter Zijlstra @ 2020-07-16 19:28 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Geert Uytterhoeven, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

On Thu, Jul 16, 2020 at 08:14:38PM +0200, John Paul Adrian Glaubitz wrote:
> Hi Peter!
> 
> On 7/16/20 2:04 PM, peterz@infradead.org wrote:
> > On Thu, Jul 16, 2020 at 01:37:20PM +0200, peterz@infradead.org wrote:
> >> $ /opt/cross/bin/sh4-linux-gcc --version
> >> sh4-linux-gcc (GCC) 10.1.0
> > 
> > $ git checkout origin/master # linus' tree
> > $ mkdir sh-defconfig
> > $ make O=sh-defconfig/ ARCH=sh CROSS_COMPILE=/opt/cross/bin/sh4-linux- defconfig # shx3_defconfig
> > $ make O=sh-defconfig/ ARCH=sh CROSS_COMPILE=/opt/cross/bin/sh4-linux- -j80
> > 
> > insane stream of errors
> 
> I assume it's a problem with your toolchain. I will try to reproduce it tonight
> or tomorrow.

For some reason I had a whole bunch of junk left in my checkout and had
to basically: rm `git status -s | awk '{print $2}'`.

Sorry for the noise.

OK, let me go try my own patches :-)

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-16 19:28                                           ` Peter Zijlstra
@ 2020-07-16 19:33                                             ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-16 19:33 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Geert Uytterhoeven, Rich Felker, Christoph Hellwig,
	Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List

On 7/16/20 9:28 PM, Peter Zijlstra wrote:
> For some reason I had a whole bunch of junk left in my checkout and had
> to basically: rm `git status -s | awk '{print $2}'`.
> 
> Sorry for the noise.
> 
> OK, let me go try my own patches :-)

FWIW, I just successfully built the "defconfig" configuration without any problems.

Looking forward for the updated patches, although the patch to fix PGTABLE_LEVELS >2
works for me [1].

Adrian

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=mm/tlb&id\x1f19a4bf8dcb42efc278940fb81c288c346b3eda

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-14 23:12         ` John Paul Adrian Glaubitz
                             ` (2 preceding siblings ...)
  2020-07-15  7:27           ` Geert Uytterhoeven
@ 2020-07-20 13:38           ` Christoph Hellwig
  2020-07-20 13:42             ` John Paul Adrian Glaubitz
  3 siblings, 1 reply; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-20 13:38 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Rich Felker, Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On Wed, Jul 15, 2020 at 01:12:33AM +0200, John Paul Adrian Glaubitz wrote:
> Hello!
> 
> I have applied Christoph's full series on top of Linus' tree and I can confirm that
> the kernel boots fine on my SH-7785LCR board.
> 
> Thus, for the whole series of patches:
> 
> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

Any chance we get the patches queue up while you're all sorting out
totally independent issues?

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-20 13:38           ` Christoph Hellwig
@ 2020-07-20 13:42             ` John Paul Adrian Glaubitz
  2020-07-20 14:53               ` Rich Felker
  0 siblings, 1 reply; 81+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-07-20 13:42 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Rich Felker, Yoshinori Sato, linux-sh, linux-kernel

Hi Christoph!

On 7/20/20 3:38 PM, Christoph Hellwig wrote:
> On Wed, Jul 15, 2020 at 01:12:33AM +0200, John Paul Adrian Glaubitz wrote:
>> Hello!
>>
>> I have applied Christoph's full series on top of Linus' tree and I can confirm that
>> the kernel boots fine on my SH-7785LCR board.
>>
>> Thus, for the whole series of patches:
>>
>> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> 
> Any chance we get the patches queue up while you're all sorting out
> totally independent issues?

I would love to buy only Rich can do that. I'm fine with your patches
and would much appreciate if Rich could queue them up.

I'm also still waiting for my patch to be queued as well.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-20 13:42             ` John Paul Adrian Glaubitz
@ 2020-07-20 14:53               ` Rich Felker
  2020-07-21  3:20                 ` Rich Felker
  0 siblings, 1 reply; 81+ messages in thread
From: Rich Felker @ 2020-07-20 14:53 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On Mon, Jul 20, 2020 at 03:42:38PM +0200, John Paul Adrian Glaubitz wrote:
> Hi Christoph!
> 
> On 7/20/20 3:38 PM, Christoph Hellwig wrote:
> > On Wed, Jul 15, 2020 at 01:12:33AM +0200, John Paul Adrian Glaubitz wrote:
> >> Hello!
> >>
> >> I have applied Christoph's full series on top of Linus' tree and I can confirm that
> >> the kernel boots fine on my SH-7785LCR board.
> >>
> >> Thus, for the whole series of patches:
> >>
> >> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> > 
> > Any chance we get the patches queue up while you're all sorting out
> > totally independent issues?
> 
> I would love to buy only Rich can do that. I'm fine with your patches
> and would much appreciate if Rich could queue them up.
> 
> I'm also still waiting for my patch to be queued as well.

I saw it looked like this is solved and I'm going to look at it later
today. Thanks!

Rich

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

* Re: [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
  2020-07-14 12:18   ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
@ 2020-07-21  3:17     ` Rich Felker
  2020-07-21  5:11       ` Christoph Hellwig
  0 siblings, 1 reply; 81+ messages in thread
From: Rich Felker @ 2020-07-21  3:17 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Yoshinori Sato, linux-sh, linux-kernel

On Tue, Jul 14, 2020 at 02:18:54PM +0200, Christoph Hellwig wrote:
> Have a single definition that architetures can select.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/m68k/Kconfig         | 4 +---
>  arch/m68k/Kconfig.machine | 1 +
>  arch/um/Kconfig           | 4 +---
>  kernel/dma/Kconfig        | 3 +++
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index 6ad6cdac74b3dc..8e488369a7e55a 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -17,6 +17,7 @@ config M68K
>  	select HAVE_COPY_THREAD_TLS
>  	select GENERIC_IRQ_SHOW
>  	select GENERIC_ATOMIC64
> +	select NO_DMA if !MMU && !COLDFIRE
>  	select HAVE_UID16
>  	select VIRT_TO_BUS
>  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
> @@ -60,9 +61,6 @@ config TIME_LOW_RES
>  config NO_IOPORT_MAP
>  	def_bool y
>  
> -config NO_DMA
> -	def_bool (MMU && SUN3) || (!MMU && !COLDFIRE)
> -
>  config ZONE_DMA
>  	bool
>  	default y
> diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
> index a82651d58af483..17e8c3a292d770 100644
> --- a/arch/m68k/Kconfig.machine
> +++ b/arch/m68k/Kconfig.machine
> @@ -126,6 +126,7 @@ config SUN3
>  	depends on MMU
>  	depends on !MMU_MOTOROLA
>  	select MMU_SUN3 if MMU
> +	select NO_DMA
>  	select M68020
>  	help
>  	  This option enables support for the Sun 3 series of workstations
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index 9318dc6d1a0cee..32c1d1945033ec 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -15,6 +15,7 @@ config UML
>  	select HAVE_DEBUG_KMEMLEAK
>  	select HAVE_DEBUG_BUGVERBOSE
>  	select HAVE_COPY_THREAD_TLS
> +	select NO_DMA
>  	select GENERIC_IRQ_SHOW
>  	select GENERIC_CPU_DEVICES
>  	select GENERIC_CLOCKEVENTS
> @@ -168,9 +169,6 @@ config MMAPPER
>  	  This driver allows a host file to be used as emulated IO memory inside
>  	  UML.
>  
> -config NO_DMA
> -	def_bool y
> -
>  config PGTABLE_LEVELS
>  	int
>  	default 3 if 3_LEVEL_PGTABLES
> diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> index 1da3f44f2565b4..57533d07676f4a 100644
> --- a/kernel/dma/Kconfig
> +++ b/kernel/dma/Kconfig
> @@ -1,5 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  
> +config NO_DMA
> +	bool
> +
>  config HAS_DMA
>  	bool
>  	depends on !NO_DMA
> -- 
> 2.26.2

This patch is outside the scope of what I can accept in arch/sh, and
the subsequent patches in the series seem to depend on it. What would
you like to do for its path upstream?

I've now picked up everything else from this series that I can.

Rich

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

* Re: ioremap and dma cleanups and fixes for superh (2nd resend)
  2020-07-20 14:53               ` Rich Felker
@ 2020-07-21  3:20                 ` Rich Felker
  0 siblings, 0 replies; 81+ messages in thread
From: Rich Felker @ 2020-07-21  3:20 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz
  Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On Mon, Jul 20, 2020 at 10:53:26AM -0400, Rich Felker wrote:
> On Mon, Jul 20, 2020 at 03:42:38PM +0200, John Paul Adrian Glaubitz wrote:
> > Hi Christoph!
> > 
> > On 7/20/20 3:38 PM, Christoph Hellwig wrote:
> > > On Wed, Jul 15, 2020 at 01:12:33AM +0200, John Paul Adrian Glaubitz wrote:
> > >> Hello!
> > >>
> > >> I have applied Christoph's full series on top of Linus' tree and I can confirm that
> > >> the kernel boots fine on my SH-7785LCR board.
> > >>
> > >> Thus, for the whole series of patches:
> > >>
> > >> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> > > 
> > > Any chance we get the patches queue up while you're all sorting out
> > > totally independent issues?
> > 
> > I would love to buy only Rich can do that. I'm fine with your patches
> > and would much appreciate if Rich could queue them up.
> > 
> > I'm also still waiting for my patch to be queued as well.
> 
> I saw it looked like this is solved and I'm going to look at it later
> today. Thanks!

I read and replied to this from my phone this morning so I was
mistaken about the context in the above reply, but I've now queued
(push still pending after some cleanup of sequence and testing)
everything I can take from this series for linux-next. Some of the
patches seem to depend on work in other maintainers' domains that need
clarification.

Rich

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

* Re: [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
  2020-07-21  3:17     ` Rich Felker
@ 2020-07-21  5:11       ` Christoph Hellwig
  2020-07-22  0:43         ` Rich Felker
  0 siblings, 1 reply; 81+ messages in thread
From: Christoph Hellwig @ 2020-07-21  5:11 UTC (permalink / raw)
  To: Rich Felker; +Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel

On Mon, Jul 20, 2020 at 11:17:26PM -0400, Rich Felker wrote:
> On Tue, Jul 14, 2020 at 02:18:54PM +0200, Christoph Hellwig wrote:
> > Have a single definition that architetures can select.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  arch/m68k/Kconfig         | 4 +---
> >  arch/m68k/Kconfig.machine | 1 +
> >  arch/um/Kconfig           | 4 +---
> >  kernel/dma/Kconfig        | 3 +++
> >  4 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> > index 6ad6cdac74b3dc..8e488369a7e55a 100644
> > --- a/arch/m68k/Kconfig
> > +++ b/arch/m68k/Kconfig
> > @@ -17,6 +17,7 @@ config M68K
> >  	select HAVE_COPY_THREAD_TLS
> >  	select GENERIC_IRQ_SHOW
> >  	select GENERIC_ATOMIC64
> > +	select NO_DMA if !MMU && !COLDFIRE
> >  	select HAVE_UID16
> >  	select VIRT_TO_BUS
> >  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
> > @@ -60,9 +61,6 @@ config TIME_LOW_RES
> >  config NO_IOPORT_MAP
> >  	def_bool y
> >  
> > -config NO_DMA
> > -	def_bool (MMU && SUN3) || (!MMU && !COLDFIRE)
> > -
> >  config ZONE_DMA
> >  	bool
> >  	default y
> > diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
> > index a82651d58af483..17e8c3a292d770 100644
> > --- a/arch/m68k/Kconfig.machine
> > +++ b/arch/m68k/Kconfig.machine
> > @@ -126,6 +126,7 @@ config SUN3
> >  	depends on MMU
> >  	depends on !MMU_MOTOROLA
> >  	select MMU_SUN3 if MMU
> > +	select NO_DMA
> >  	select M68020
> >  	help
> >  	  This option enables support for the Sun 3 series of workstations
> > diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> > index 9318dc6d1a0cee..32c1d1945033ec 100644
> > --- a/arch/um/Kconfig
> > +++ b/arch/um/Kconfig
> > @@ -15,6 +15,7 @@ config UML
> >  	select HAVE_DEBUG_KMEMLEAK
> >  	select HAVE_DEBUG_BUGVERBOSE
> >  	select HAVE_COPY_THREAD_TLS
> > +	select NO_DMA
> >  	select GENERIC_IRQ_SHOW
> >  	select GENERIC_CPU_DEVICES
> >  	select GENERIC_CLOCKEVENTS
> > @@ -168,9 +169,6 @@ config MMAPPER
> >  	  This driver allows a host file to be used as emulated IO memory inside
> >  	  UML.
> >  
> > -config NO_DMA
> > -	def_bool y
> > -
> >  config PGTABLE_LEVELS
> >  	int
> >  	default 3 if 3_LEVEL_PGTABLES
> > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> > index 1da3f44f2565b4..57533d07676f4a 100644
> > --- a/kernel/dma/Kconfig
> > +++ b/kernel/dma/Kconfig
> > @@ -1,5 +1,8 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  
> > +config NO_DMA
> > +	bool
> > +
> >  config HAS_DMA
> >  	bool
> >  	depends on !NO_DMA
> > -- 
> > 2.26.2
> 
> This patch is outside the scope of what I can accept in arch/sh, and
> the subsequent patches in the series seem to depend on it. What would
> you like to do for its path upstream?
> 
> I've now picked up everything else from this series that I can.

As the dma-mapping maintainer:  please pick it.  I'd give you an
ACK, but that looks kinda silly if I'm the author as well :)

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

* Re: [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
  2020-07-21  5:11       ` Christoph Hellwig
@ 2020-07-22  0:43         ` Rich Felker
  0 siblings, 0 replies; 81+ messages in thread
From: Rich Felker @ 2020-07-22  0:43 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Yoshinori Sato, linux-sh, linux-kernel

On Tue, Jul 21, 2020 at 07:11:34AM +0200, Christoph Hellwig wrote:
> On Mon, Jul 20, 2020 at 11:17:26PM -0400, Rich Felker wrote:
> > On Tue, Jul 14, 2020 at 02:18:54PM +0200, Christoph Hellwig wrote:
> > > Have a single definition that architetures can select.
> > > 
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > > ---
> > >  arch/m68k/Kconfig         | 4 +---
> > >  arch/m68k/Kconfig.machine | 1 +
> > >  arch/um/Kconfig           | 4 +---
> > >  kernel/dma/Kconfig        | 3 +++
> > >  4 files changed, 6 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> > > index 6ad6cdac74b3dc..8e488369a7e55a 100644
> > > --- a/arch/m68k/Kconfig
> > > +++ b/arch/m68k/Kconfig
> > > @@ -17,6 +17,7 @@ config M68K
> > >  	select HAVE_COPY_THREAD_TLS
> > >  	select GENERIC_IRQ_SHOW
> > >  	select GENERIC_ATOMIC64
> > > +	select NO_DMA if !MMU && !COLDFIRE
> > >  	select HAVE_UID16
> > >  	select VIRT_TO_BUS
> > >  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
> > > @@ -60,9 +61,6 @@ config TIME_LOW_RES
> > >  config NO_IOPORT_MAP
> > >  	def_bool y
> > >  
> > > -config NO_DMA
> > > -	def_bool (MMU && SUN3) || (!MMU && !COLDFIRE)
> > > -
> > >  config ZONE_DMA
> > >  	bool
> > >  	default y
> > > diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
> > > index a82651d58af483..17e8c3a292d770 100644
> > > --- a/arch/m68k/Kconfig.machine
> > > +++ b/arch/m68k/Kconfig.machine
> > > @@ -126,6 +126,7 @@ config SUN3
> > >  	depends on MMU
> > >  	depends on !MMU_MOTOROLA
> > >  	select MMU_SUN3 if MMU
> > > +	select NO_DMA
> > >  	select M68020
> > >  	help
> > >  	  This option enables support for the Sun 3 series of workstations
> > > diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> > > index 9318dc6d1a0cee..32c1d1945033ec 100644
> > > --- a/arch/um/Kconfig
> > > +++ b/arch/um/Kconfig
> > > @@ -15,6 +15,7 @@ config UML
> > >  	select HAVE_DEBUG_KMEMLEAK
> > >  	select HAVE_DEBUG_BUGVERBOSE
> > >  	select HAVE_COPY_THREAD_TLS
> > > +	select NO_DMA
> > >  	select GENERIC_IRQ_SHOW
> > >  	select GENERIC_CPU_DEVICES
> > >  	select GENERIC_CLOCKEVENTS
> > > @@ -168,9 +169,6 @@ config MMAPPER
> > >  	  This driver allows a host file to be used as emulated IO memory inside
> > >  	  UML.
> > >  
> > > -config NO_DMA
> > > -	def_bool y
> > > -
> > >  config PGTABLE_LEVELS
> > >  	int
> > >  	default 3 if 3_LEVEL_PGTABLES
> > > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> > > index 1da3f44f2565b4..57533d07676f4a 100644
> > > --- a/kernel/dma/Kconfig
> > > +++ b/kernel/dma/Kconfig
> > > @@ -1,5 +1,8 @@
> > >  # SPDX-License-Identifier: GPL-2.0-only
> > >  
> > > +config NO_DMA
> > > +	bool
> > > +
> > >  config HAS_DMA
> > >  	bool
> > >  	depends on !NO_DMA
> > > -- 
> > > 2.26.2
> > 
> > This patch is outside the scope of what I can accept in arch/sh, and
> > the subsequent patches in the series seem to depend on it. What would
> > you like to do for its path upstream?
> > 
> > I've now picked up everything else from this series that I can.
> 
> As the dma-mapping maintainer:  please pick it.  I'd give you an
> ACK, but that looks kinda silly if I'm the author as well :)

Very well! It's now in my for-next branch along with the rest of the
series and a lot of other stuff.

Rich

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-07-14 12:18   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
@ 2020-08-28  2:00     ` Rich Felker
  2020-08-28  2:11       ` Rich Felker
  0 siblings, 1 reply; 81+ messages in thread
From: Rich Felker @ 2020-08-28  2:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Yoshinori Sato, linux-sh, linux-kernel

On Tue, Jul 14, 2020 at 02:18:55PM +0200, Christoph Hellwig wrote:
> The code handling non-coherent DMA depends on being able to remap code
> as non-cached.  But that can't be done without an MMU, so using this
> option on NOMMU builds is broken.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/sh/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index f8027eee08edae..337eb496c45a0a 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -61,6 +61,7 @@ config SUPERH
>  	select MAY_HAVE_SPARSE_IRQ
>  	select MODULES_USE_ELF_RELA
>  	select NEED_SG_DMA_LENGTH
> +	select NO_DMA if !MMU && !DMA_COHERENT
>  	select NO_GENERIC_PCI_IOPORT_MAP if PCI
>  	select OLD_SIGACTION
>  	select OLD_SIGSUSPEND
> @@ -135,7 +136,7 @@ config DMA_COHERENT
>  	bool

This change broke SD card support on J2 because MMC_SPI spuriously
depends on HAS_DMA. It looks like it can be fixed just by removing
that dependency from drivers/mmc/host/Kconfig.

Rich

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-08-28  2:00     ` Rich Felker
@ 2020-08-28  2:11       ` Rich Felker
  2020-08-28  4:24         ` Christoph Hellwig
  0 siblings, 1 reply; 81+ messages in thread
From: Rich Felker @ 2020-08-28  2:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Yoshinori Sato, linux-sh, linux-kernel

On Thu, Aug 27, 2020 at 10:00:48PM -0400, Rich Felker wrote:
> On Tue, Jul 14, 2020 at 02:18:55PM +0200, Christoph Hellwig wrote:
> > The code handling non-coherent DMA depends on being able to remap code
> > as non-cached.  But that can't be done without an MMU, so using this
> > option on NOMMU builds is broken.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  arch/sh/Kconfig | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> > index f8027eee08edae..337eb496c45a0a 100644
> > --- a/arch/sh/Kconfig
> > +++ b/arch/sh/Kconfig
> > @@ -61,6 +61,7 @@ config SUPERH
> >  	select MAY_HAVE_SPARSE_IRQ
> >  	select MODULES_USE_ELF_RELA
> >  	select NEED_SG_DMA_LENGTH
> > +	select NO_DMA if !MMU && !DMA_COHERENT
> >  	select NO_GENERIC_PCI_IOPORT_MAP if PCI
> >  	select OLD_SIGACTION
> >  	select OLD_SIGSUSPEND
> > @@ -135,7 +136,7 @@ config DMA_COHERENT
> >  	bool
> 
> This change broke SD card support on J2 because MMC_SPI spuriously
> depends on HAS_DMA. It looks like it can be fixed just by removing
> that dependency from drivers/mmc/host/Kconfig.

It can't. mmp_spi_probe fails with ENOMEM, probably due to trying to
do some DMA setup thing that's not going to be needed if the
underlying SPI device doesn't support/use DMA.

Rich

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-08-28  2:11       ` Rich Felker
@ 2020-08-28  4:24         ` Christoph Hellwig
  2020-08-28  9:26           ` Ulf Hansson
  0 siblings, 1 reply; 81+ messages in thread
From: Christoph Hellwig @ 2020-08-28  4:24 UTC (permalink / raw)
  To: Rich Felker
  Cc: Christoph Hellwig, Yoshinori Sato, linux-sh, linux-kernel,
	linux-mmc, linux-spi

On Thu, Aug 27, 2020 at 10:11:53PM -0400, Rich Felker wrote:
> > This change broke SD card support on J2 because MMC_SPI spuriously
> > depends on HAS_DMA. It looks like it can be fixed just by removing
> > that dependency from drivers/mmc/host/Kconfig.
> 
> It can't. mmp_spi_probe fails with ENOMEM, probably due to trying to
> do some DMA setup thing that's not going to be needed if the
> underlying SPI device doesn't support/use DMA.

Adding the linux-mmc and linux-spi lists, as that seems pretty odd.

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-08-28  4:24         ` Christoph Hellwig
@ 2020-08-28  9:26           ` Ulf Hansson
  2020-08-28 15:09             ` Rich Felker
  0 siblings, 1 reply; 81+ messages in thread
From: Ulf Hansson @ 2020-08-28  9:26 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Rich Felker, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List, linux-mmc, linux-spi

On Fri, 28 Aug 2020 at 06:24, Christoph Hellwig <hch@lst.de> wrote:
>
> On Thu, Aug 27, 2020 at 10:11:53PM -0400, Rich Felker wrote:
> > > This change broke SD card support on J2 because MMC_SPI spuriously
> > > depends on HAS_DMA. It looks like it can be fixed just by removing
> > > that dependency from drivers/mmc/host/Kconfig.
> >
> > It can't. mmp_spi_probe fails with ENOMEM, probably due to trying to
> > do some DMA setup thing that's not going to be needed if the
> > underlying SPI device doesn't support/use DMA.
>
> Adding the linux-mmc and linux-spi lists, as that seems pretty odd.

The mmc_spi driver needs modernizations, so I am not surprised to see
odd things.

My guess is that in ->probe() we check "if
(spi->master->dev.parent->dma_mask)" - > and runs dma_map*()
operations, which fails and leads to bailing out of ->probe() to
return an error code.

However, by looking at the code, one get the feeling that the DMA
support is somewhat prepared to be made optional. I guess it has never
been really tested, as the Kconfig option has "depends on HAS_DMA"  -
and it's been like that as long as I can remember.

Kind regards
Uffe

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-08-28  9:26           ` Ulf Hansson
@ 2020-08-28 15:09             ` Rich Felker
  2020-08-29  8:31               ` Christoph Hellwig
  0 siblings, 1 reply; 81+ messages in thread
From: Rich Felker @ 2020-08-28 15:09 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List, linux-mmc, linux-spi

On Fri, Aug 28, 2020 at 11:26:57AM +0200, Ulf Hansson wrote:
> On Fri, 28 Aug 2020 at 06:24, Christoph Hellwig <hch@lst.de> wrote:
> >
> > On Thu, Aug 27, 2020 at 10:11:53PM -0400, Rich Felker wrote:
> > > > This change broke SD card support on J2 because MMC_SPI spuriously
> > > > depends on HAS_DMA. It looks like it can be fixed just by removing
> > > > that dependency from drivers/mmc/host/Kconfig.
> > >
> > > It can't. mmp_spi_probe fails with ENOMEM, probably due to trying to
> > > do some DMA setup thing that's not going to be needed if the
> > > underlying SPI device doesn't support/use DMA.
> >
> > Adding the linux-mmc and linux-spi lists, as that seems pretty odd.
> 
> The mmc_spi driver needs modernizations, so I am not surprised to see
> odd things.
> 
> My guess is that in ->probe() we check "if
> (spi->master->dev.parent->dma_mask)" - > and runs dma_map*()
> operations, which fails and leads to bailing out of ->probe() to
> return an error code.
> 
> However, by looking at the code, one get the feeling that the DMA
> support is somewhat prepared to be made optional. I guess it has never
> been really tested, as the Kconfig option has "depends on HAS_DMA"  -
> and it's been like that as long as I can remember.

It always worked on our "byte-banged" SPI controller, with no DMA
controller present, before Christoph's changes in this patch series,
and seems to be working now (although I have some other, hopefully
unrelated regressions to debug) with #ifdef CONFIG_HAS_DMA around the
if (spi->master->dev.parent->dma_mask) block in mmc_spi_probe. That's
probably not the right fix though -- why isn't it checking
host->dma_dev instead and only attempting DMA setup if dma_dev is
non-null?

Rich

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-08-28 15:09             ` Rich Felker
@ 2020-08-29  8:31               ` Christoph Hellwig
  2020-08-31 11:28                 ` Ulf Hansson
  0 siblings, 1 reply; 81+ messages in thread
From: Christoph Hellwig @ 2020-08-29  8:31 UTC (permalink / raw)
  To: Rich Felker
  Cc: Ulf Hansson, Christoph Hellwig, Yoshinori Sato, Linux-sh list,
	Linux Kernel Mailing List, linux-mmc, linux-spi

On Fri, Aug 28, 2020 at 11:09:43AM -0400, Rich Felker wrote:
> > However, by looking at the code, one get the feeling that the DMA
> > support is somewhat prepared to be made optional. I guess it has never
> > been really tested, as the Kconfig option has "depends on HAS_DMA"  -
> > and it's been like that as long as I can remember.
> 
> It always worked on our "byte-banged" SPI controller, with no DMA
> controller present, before Christoph's changes in this patch series,

Before that nommu sh builds provided a DMA mapping implementation
that even worked for the streaming side (dma_map_*), but would corrupt
data if you used dma_alloc_coherent memory to communicate with the
device. 

> and seems to be working now (although I have some other, hopefully
> unrelated regressions to debug) with #ifdef CONFIG_HAS_DMA around the
> if (spi->master->dev.parent->dma_mask) block in mmc_spi_probe. That's
> probably not the right fix though -- why isn't it checking
> host->dma_dev instead and only attempting DMA setup if dma_dev is
> non-null?

I don't think dma_dev can be NULL right now.  dma_dev is assigned here:

	if (spi->master->dev.parent->dma_mask) {
		struct device   *dev = spi->master->dev.parent;

		host->dma_dev = dev;

but for any OF or real bus device dma_mask never is zero (it actually is
a pointer), and the value of it also is initialized to 32-bit by default,
making this effectively an "if (1) {".  The driver needs some way to
communicate if a given device actually is DMA capable or not. Or is that
purely a factor of the platform which would be a little strange.

In which case we should do something like:


diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 39bb1e30c2d722..3b0cc9a70e6432 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1374,7 +1374,7 @@ static int mmc_spi_probe(struct spi_device *spi)
 	if (!host->data)
 		goto fail_nobuf1;
 
-	if (spi->master->dev.parent->dma_mask) {
+	if (IS_ENABLED(CONFIG_HAS_DMA)) {
 		struct device	*dev = spi->master->dev.parent;
 
 		host->dma_dev = dev;

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

* Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU
  2020-08-29  8:31               ` Christoph Hellwig
@ 2020-08-31 11:28                 ` Ulf Hansson
  0 siblings, 0 replies; 81+ messages in thread
From: Ulf Hansson @ 2020-08-31 11:28 UTC (permalink / raw)
  To: Christoph Hellwig, Rich Felker
  Cc: Yoshinori Sato, Linux-sh list, Linux Kernel Mailing List,
	linux-mmc, linux-spi

On Sat, 29 Aug 2020 at 10:31, Christoph Hellwig <hch@lst.de> wrote:
>
> On Fri, Aug 28, 2020 at 11:09:43AM -0400, Rich Felker wrote:
> > > However, by looking at the code, one get the feeling that the DMA
> > > support is somewhat prepared to be made optional. I guess it has never
> > > been really tested, as the Kconfig option has "depends on HAS_DMA"  -
> > > and it's been like that as long as I can remember.
> >
> > It always worked on our "byte-banged" SPI controller, with no DMA
> > controller present, before Christoph's changes in this patch series,
>
> Before that nommu sh builds provided a DMA mapping implementation
> that even worked for the streaming side (dma_map_*), but would corrupt
> data if you used dma_alloc_coherent memory to communicate with the
> device.

I see.

>
> > and seems to be working now (although I have some other, hopefully
> > unrelated regressions to debug) with #ifdef CONFIG_HAS_DMA around the
> > if (spi->master->dev.parent->dma_mask) block in mmc_spi_probe. That's
> > probably not the right fix though -- why isn't it checking
> > host->dma_dev instead and only attempting DMA setup if dma_dev is
> > non-null?
>
> I don't think dma_dev can be NULL right now.  dma_dev is assigned here:
>
>         if (spi->master->dev.parent->dma_mask) {
>                 struct device   *dev = spi->master->dev.parent;
>
>                 host->dma_dev = dev;
>
> but for any OF or real bus device dma_mask never is zero (it actually is
> a pointer), and the value of it also is initialized to 32-bit by default,
> making this effectively an "if (1) {".  The driver needs some way to
> communicate if a given device actually is DMA capable or not. Or is that
> purely a factor of the platform which would be a little strange.

Okay, thanks for clarifying things.

>
> In which case we should do something like:
>
>
> diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
> index 39bb1e30c2d722..3b0cc9a70e6432 100644
> --- a/drivers/mmc/host/mmc_spi.c
> +++ b/drivers/mmc/host/mmc_spi.c
> @@ -1374,7 +1374,7 @@ static int mmc_spi_probe(struct spi_device *spi)
>         if (!host->data)
>                 goto fail_nobuf1;
>
> -       if (spi->master->dev.parent->dma_mask) {
> +       if (IS_ENABLED(CONFIG_HAS_DMA)) {

I guess "#ifdef CONFIG_HAS_DMA", would work as well as CONFIG_HAS_DMA
can't be "m".

I would also suggest moving the DMA setup things into a separate
function. Then when CONFIG_HAS_DMA is unset, we can use a stub.

>                 struct device   *dev = spi->master->dev.parent;
>
>                 host->dma_dev = dev;

Let me cook a patch that we can try.

Kind regards
Uffe

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

end of thread, other threads:[~2020-08-31 11:28 UTC | newest]

Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 16:26 ioremap and dma cleanups and fixes for superh Christoph Hellwig
2020-03-24 16:26 ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
2020-03-24 16:26 ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
2020-03-24 16:26 ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
2020-03-24 16:26 ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
2020-03-24 16:26 ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
2020-03-24 16:26 ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
2020-03-24 16:26 ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
2020-03-24 16:26 ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
2020-03-24 16:26 ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
2020-03-24 16:26 ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
2020-06-26  8:07 ` ioremap and dma cleanups and fixes for superh (resend) Christoph Hellwig
2020-06-26  8:07   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
2020-06-26  8:07   ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
2020-06-26  8:07   ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
2020-06-26  8:07   ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
2020-06-26  8:07   ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
2020-06-26  8:07   ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
2020-06-26  8:07   ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
2020-06-26  8:07   ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
2020-06-26  8:07   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
2020-06-28  0:53     ` Rob Landley
2020-06-28  7:24       ` Christoph Hellwig
2020-06-26  8:07   ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
2020-07-14 12:18 ` ioremap and dma cleanups and fixes for superh (2nd resend) Christoph Hellwig
2020-07-14 12:18   ` [PATCH 01/10] sh: remove -Werror from Makefiles Christoph Hellwig
2020-07-14 12:18   ` [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Christoph Hellwig
2020-07-14 12:18   ` [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Christoph Hellwig
2020-07-14 12:18   ` [PATCH 04/10] sh: move ioremap_fixed details out of <asm/io.h> Christoph Hellwig
2020-07-14 12:18   ` [PATCH 05/10] sh: move the ioremap implementation out of line Christoph Hellwig
2020-07-14 12:18   ` [PATCH 06/10] sh: don't include <asm/io_trapped.h> in <asm/io.h> Christoph Hellwig
2020-07-14 12:18   ` [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Christoph Hellwig
2020-07-14 12:18   ` [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Christoph Hellwig
2020-07-21  3:17     ` Rich Felker
2020-07-21  5:11       ` Christoph Hellwig
2020-07-22  0:43         ` Rich Felker
2020-07-14 12:18   ` [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Christoph Hellwig
2020-08-28  2:00     ` Rich Felker
2020-08-28  2:11       ` Rich Felker
2020-08-28  4:24         ` Christoph Hellwig
2020-08-28  9:26           ` Ulf Hansson
2020-08-28 15:09             ` Rich Felker
2020-08-29  8:31               ` Christoph Hellwig
2020-08-31 11:28                 ` Ulf Hansson
2020-07-14 12:18   ` [PATCH 10/10] sh: use the generic dma coherent remap allocator Christoph Hellwig
2020-07-14 12:31   ` ioremap and dma cleanups and fixes for superh (2nd resend) John Paul Adrian Glaubitz
2020-07-14 15:59     ` Rich Felker
2020-07-14 16:10       ` John Paul Adrian Glaubitz
2020-07-14 23:12         ` John Paul Adrian Glaubitz
2020-07-14 23:14           ` John Paul Adrian Glaubitz
2020-07-15  3:12           ` Rich Felker
2020-07-15  6:39             ` John Paul Adrian Glaubitz
2020-07-15  7:27           ` Geert Uytterhoeven
2020-07-15  7:37             ` John Paul Adrian Glaubitz
2020-07-15  8:06               ` Geert Uytterhoeven
2020-07-15  7:46             ` John Paul Adrian Glaubitz
2020-07-15  8:07               ` Geert Uytterhoeven
     [not found]               ` <b5f1853e-031d-c09d-57d2-fb4baffa01ea@physik.fu-berlin.de>
2020-07-15  8:11                 ` Geert Uytterhoeven
2020-07-15  8:27                   ` John Paul Adrian Glaubitz
2020-07-15 14:37                     ` John Paul Adrian Glaubitz
2020-07-15 15:39                       ` John Paul Adrian Glaubitz
2020-07-15 16:18                       ` John Paul Adrian Glaubitz
2020-07-15 18:21                         ` Geert Uytterhoeven
2020-07-15 18:27                           ` John Paul Adrian Glaubitz
2020-07-16  9:40                           ` Peter Zijlstra
2020-07-16 10:05                             ` John Paul Adrian Glaubitz
2020-07-16 10:29                             ` peterz
2020-07-16 10:54                               ` John Paul Adrian Glaubitz
2020-07-16 11:01                                 ` peterz
2020-07-16 11:03                                   ` John Paul Adrian Glaubitz
2020-07-16 11:37                                     ` peterz
2020-07-16 12:04                                       ` peterz
2020-07-16 18:14                                         ` John Paul Adrian Glaubitz
2020-07-16 19:28                                           ` Peter Zijlstra
2020-07-16 19:33                                             ` John Paul Adrian Glaubitz
2020-07-16 11:30                         ` John Paul Adrian Glaubitz
2020-07-16 11:31             ` John Paul Adrian Glaubitz
2020-07-20 13:38           ` Christoph Hellwig
2020-07-20 13:42             ` John Paul Adrian Glaubitz
2020-07-20 14:53               ` Rich Felker
2020-07-21  3:20                 ` Rich Felker

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