From patchwork Tue Mar 24 16:26:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5355914B4 for ; Tue, 24 Mar 2020 16:27:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2604E20788 for ; Tue, 24 Mar 2020 16:27:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mTGvM8hC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728358AbgCXQ0n (ORCPT ); Tue, 24 Mar 2020 12:26:43 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59550 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728520AbgCXQ0l (ORCPT ); Tue, 24 Mar 2020 12:26:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=tNTshsqUMDvShy2poJR/dA/f+Op0Ioq8L8ZpxTGQOL4=; b=mTGvM8hCGMLtDP8hFus8HXx84O CjTZH5PTrpwJm8EMKLbUhQuuHTKv79XnIIgyWOgrKU8oJbrdtHJcNfgL9GfycJqOn8xXLCbQEvgGf M3SIWccIlRrzfW1WaUfKCxqETjuIMukYRDFU0WIpy6yrNOoXSGx1KPJ2p2gkabEe+j4XUwJQM6DVU 5XmDrJTLN8d/SJPdStHS4C+1Td8tpowmn5+fvCmru+PwQJy0Sb+1LQ3RekACffKpco7MipX5/bXGw +v2qExcIl29p+vyucTuUg6v8NhEwV/M5Zy17yQdPCZshZwU0K9PfR4vWS51ifSYtxlbSN5kYoBWm4 v3EcaViQ==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmNx-0007c1-9i; Tue, 24 Mar 2020 16:26:37 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/10] sh: remove -Werror from Makefiles Date: Tue, 24 Mar 2020 17:26:24 +0100 Message-Id: <20200324162633.754714-2-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- 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 From patchwork Tue Mar 24 16:26:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455983 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A98B17D4 for ; Tue, 24 Mar 2020 16:27:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C856208CA for ; Tue, 24 Mar 2020 16:27:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="DFwVmlyN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728695AbgCXQ0o (ORCPT ); Tue, 24 Mar 2020 12:26:44 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59558 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728637AbgCXQ0o (ORCPT ); Tue, 24 Mar 2020 12:26:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=fTzmx+3y0abwCmtc5yMkI3NKOSqJHJ1zF1HY0E+MrKQ=; b=DFwVmlyNxFqu46pre485nI1Uno HU04h/zblFYZWlqFX7olTaXYe2IGA8QOMcT22YuEqBBPFCra1Dv8k0PGKITVoN/JTbTgNqfr5/pyY 0EuwlOdKO0VxBbsfg8p5CmRvdMLUn/J269EURETmU4iLDYnUWBzz9v5tFOOfNwdQPQpPFRO3lvDji x879EI+q2BnIfifYGVeBO5B/K9vwc9Fu3NjXLA7io/m+10djLjzmhGsN7pj5fOwzxJLatVN8ACMQp mhOdY8fWtjv+uFOSyoWxozYE6aV3lr+i3ZmVPftNp/Vymt2GHXjs9Uwq7w3ExrrKFUxSlfsJRqV+k fd/rkQWA==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmNz-0007cA-Mb; Tue, 24 Mar 2020 16:26:40 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/10] sh: sort the selects for SUPERH alphabetically Date: Tue, 24 Mar 2020 17:26:25 +0100 Message-Id: <20200324162633.754714-3-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- 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" From patchwork Tue Mar 24 16:26:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 047FC15AB for ; Tue, 24 Mar 2020 16:27:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C92C0208CA for ; Tue, 24 Mar 2020 16:27:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iW209ec4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728637AbgCXQ0r (ORCPT ); Tue, 24 Mar 2020 12:26:47 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59570 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728766AbgCXQ0r (ORCPT ); Tue, 24 Mar 2020 12:26:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Ih4/ByJTX4E+YrWPhWRj3NvIC+f0+8UmAcjGFn1gi/g=; b=iW209ec4r1EqIMkauz+vJv8W1F t9tna/045RSvo6Erv52W85Ywouotk13yvP6q0f1AVPNdEil+8YHf5WeKwaMLUWlO6+41ocsXPm7QE jQ37oNJB6GyeHga9XuBqUHVLWCZDXoBZw5rNzNu3hwwDdn8ZlpxynVPYC18KHSka6EAKHEV4AYwmP QP9N/4k/tWIoG/6q7I3C0TMbKSZIAfbA8IfMthdzqBzLU3NVQzDnvkLBNz6qOrLr+cReYgOSYfBH0 7P9yl0vnnAEDZnxScr+13xeziZasAM6pLJ17WvxjgF1eJEBR+DOc59x/SG6ArjJxHytlIU8+bUndW hkMsIVhA==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmO2-0007cc-2j; Tue, 24 Mar 2020 16:26:42 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/10] sh: remove __KERNEL__ ifdefs from non-UAPI headers Date: Tue, 24 Mar 2020 17:26:26 +0100 Message-Id: <20200324162633.754714-4-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org There is no point in having __KERNEL__ ifdefs in headers not exported to userspace. Signed-off-by: Christoph Hellwig --- 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 /* 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 can be included directly #endif @@ -97,6 +95,4 @@ static inline unsigned long ffz(unsigned long word) #include #include -#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 #include @@ -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 /* @@ -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 #include @@ -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 -#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 #include #include @@ -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 #include -#ifdef __KERNEL__ #define __IO_PREFIX generic #include #include @@ -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 #include #include @@ -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 @@ -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 #include @@ -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 #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 #include #include @@ -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 #include #include @@ -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 /* @@ -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 #include @@ -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 */ From patchwork Tue Mar 24 16:26:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56BA514B4 for ; Tue, 24 Mar 2020 16:26:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38C8420789 for ; Tue, 24 Mar 2020 16:26:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ahvYmZY7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728766AbgCXQ0t (ORCPT ); Tue, 24 Mar 2020 12:26:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59580 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728796AbgCXQ0s (ORCPT ); Tue, 24 Mar 2020 12:26:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=qIMWWQxcrMWzB33HEWsXx7X1zLiHCX65+Voa6N/CTeQ=; b=ahvYmZY7eKCvuIr6FrSo4uN1L9 +zswzeDbzJIpnBtNKaD9FguQqdGgiBgO7iS/oO8kT3pJLDiPZSCPim+J9ARkqQQ5vtK5rigfVQSVK 9QzQ8EMDniIr9O3C1wEtSKYEwX+tHXy3gAugW/aZoOHWoDLNVS0t36Vl0YY38D1f+4XF63RubaimR zInaEA3FMG3d4t7ML92gmswX1SBpg8mpO/p4bgISmNfE+Rz0f+F9HlPOe6MJmxnTv3tPAeE1gchIU 2Lg5TvS81ExU1/1IwVGx4J0ROkOhsvw9Kbqoz2qQjNmtu91DxlxAxF2R1cDDpoAtANajg5GDe1UcY 0piSaW2Q==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmO4-0007cq-H5; Tue, 24 Mar 2020 16:26:44 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/10] sh: move ioremap_fixed details out of Date: Tue, 24 Mar 2020 17:26:27 +0100 Message-Id: <20200324162633.754714-5-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org ioremap_fixed is an internal implementation detail and should not be exposed to drivers. Signed-off-by: Christoph Hellwig --- 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 #include #include +#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 #include #include +#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 #include #include +#include "ioremap.h" struct ioremap_map { void __iomem *addr; From patchwork Tue Mar 24 16:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2173814B4 for ; Tue, 24 Mar 2020 16:27:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF956208CA for ; Tue, 24 Mar 2020 16:27:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hpaT850G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728808AbgCXQ0x (ORCPT ); Tue, 24 Mar 2020 12:26:53 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59590 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728828AbgCXQ0v (ORCPT ); Tue, 24 Mar 2020 12:26:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ZSOxULp6rN3Ek/pMkQPmBnZMmTgaV4cAB/Fo8LlrpAA=; b=hpaT850GdvtzmQvlhvbG7OE7ya Cnb45z4ZfNGyq8fbCHytPD40p7v0SCia+iqLVEVjbLTCCoJkr81ZF0melGtzLs9Irwy951jps89pt vf8asNgM0BquD3ry4pvOvOTOWtpzvQJRgkrxl1rGUlW5wvO5J287F/VyHK8aX+c7L1ZoTfC/mbs7k BHrbpF5wXYd+Auy+XJzLF3HFfo6H/zp0Hqh4VfxpVyCUD96V5o2j7Q2m+ym8wpV2BzFlTobkEd36n c2Fq06eRSHWaMuJDiFwHyOdbyQz02BcJa6nW1XZgarmhOV32YCi17Ii8c2Hd9ToTWvnJUi1SS94yL pb76HCdw==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmO6-0007di-TQ; Tue, 24 Mar 2020 16:26:47 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/10] sh: move the ioremap implementation out of line Date: Tue, 24 Mar 2020 17:26:28 +0100 Message-Id: <20200324162633.754714-6-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- 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 #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) From patchwork Tue Mar 24 16:26:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC23D14B4 for ; Tue, 24 Mar 2020 16:27:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC30F20BED for ; Tue, 24 Mar 2020 16:27:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="gSjUcJf+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727999AbgCXQ1X (ORCPT ); Tue, 24 Mar 2020 12:27:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59600 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728769AbgCXQ0x (ORCPT ); Tue, 24 Mar 2020 12:26:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=m7GIWdVj/NEvdV02hRT9I7IOblpBtVvEgifUUc4ndo4=; b=gSjUcJf+2VKpCazqHLWR5+MARi UC5TsGNQ32+S7Yquf4FDVc8aDgiQvIqe5ArSSv8YexjObQPj6rkMkb36xy5adiui79fsDX1rrhLLT Cpv4oHJcdDWshfFxfIm2FYnTwZkvbXno90sn2Ob09sEXGHVrpISgc6UD+R77aFak80iPh8LpqNFwQ L77cZqOyL1Rd3+HTwYYghA+nqSThCZHUsYt8BdyUfIw0KZ3jZTTu3prygZYGIWQCnSZMKn/olHJ6D d/NWnUFmnREbGWpqXoE09FmbNR9jZ34b2XgloUNPzA7j+wTSYegv83CydmCY3mwsD5wO6jMVahZaw HYWWSKxg==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmO9-0007eF-9U; Tue, 24 Mar 2020 16:26:49 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/10] sh: don't include in Date: Tue, 24 Mar 2020 17:26:29 +0100 Message-Id: <20200324162633.754714-7-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org No need to expose the details of trapped I/O to drivers. Signed-off-by: Christoph Hellwig --- 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 -#include #include #include 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 #include +#include 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 #include #include +#include #include #include #include From patchwork Tue Mar 24 16:26:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 527BC14B4 for ; Tue, 24 Mar 2020 16:27:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B45A20788 for ; Tue, 24 Mar 2020 16:27:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="AbBG958l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728705AbgCXQ04 (ORCPT ); Tue, 24 Mar 2020 12:26:56 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59610 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728828AbgCXQ04 (ORCPT ); Tue, 24 Mar 2020 12:26:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=h2EwIaOH/anLec0JD5F6Hx0W2recRoJEZf2x7dpcnFY=; b=AbBG958lXvVsasnxD64D1yRZjI uc3/OblwmG4sRujdUnOKo6FKqq7pCfRj+K5rR7dc70eHa+Qx50nPNyeZXfRD7KmyOuKvILG8RZJZV 0R/kBiYWZnUXvaKxuxpAhwHnjIU+M4Up6JPzfdFXBq/x6JTcaErosZNgbAzlsKnynH8p6xkbkWvHm ta9sYxt+yUbZOfSG7pvwQcsg/Q9GUwQy7VwsFrn1aHo6sggXL2YloCR3mpg1gKhHOyd8I47yHv5ic jPKhADzF5BQQP/HpsK9pIdffcrIjmaVSiOjdVXWNKD4H0u7ZQx2YihG5MrPueKi5psY7jK2ye2rz0 lrJWM8Ww==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmOB-0007eN-MR; Tue, 24 Mar 2020 16:26:52 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/10] sh: unexport register_trapped_io and match_trapped_io_handler Date: Tue, 24 Mar 2020 17:26:30 +0100 Message-Id: <20200324162633.754714-8-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Both functions are only used by compiled in core code. Signed-off-by: Christoph Hellwig --- 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) { From patchwork Tue Mar 24 16:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C92715AB for ; Tue, 24 Mar 2020 16:27:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F297F20788 for ; Tue, 24 Mar 2020 16:26:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="D0/givOK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728802AbgCXQ07 (ORCPT ); Tue, 24 Mar 2020 12:26:59 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59616 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728828AbgCXQ06 (ORCPT ); Tue, 24 Mar 2020 12:26:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=uC6WZyO2p9fwKKTh7GcMXam2Sn8LrXKsW96hpBKhuNg=; b=D0/givOKXpxiK8ja3UhZTu+rNa VcJKY6TLoU8CM0vk3kbgNLrmE/ipNYM6IxGJOsim5tJCmChRTTEDl9pRGVMPYVpbxz7y9+fP5UQqf p+aYz8YEWkOpe+B0n80N9AWtvAshc2+7DWrCyxr7zfgkwzOvuZE9jwKDzADIGiBdt3rgSN69/7ptb 9WC9if0QNNgWSDb8nTgQCjfjp5EH0e2Ow1V6KEuL1tLNlD2T4eFxz5Hcf7cnjEUlcmpIlz1wHZ+sy YNu+yHYD819QK6P0xxFlD51vWUhQHhnyQqUOi/564Ljw51FhJaUV/whvFDmRUrAV0V73KUlp19Ljt +GRgBk0g==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmOE-0007en-2m; Tue, 24 Mar 2020 16:26:54 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/10] dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig Date: Tue, 24 Mar 2020 17:26:31 +0100 Message-Id: <20200324162633.754714-9-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Have a single definition that architetures can select. Signed-off-by: Christoph Hellwig --- 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 From patchwork Tue Mar 24 16:26:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75D2915AB for ; Tue, 24 Mar 2020 16:27:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5810920774 for ; Tue, 24 Mar 2020 16:27:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="NbZfUIk/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728934AbgCXQ1B (ORCPT ); Tue, 24 Mar 2020 12:27:01 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59626 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728928AbgCXQ1A (ORCPT ); Tue, 24 Mar 2020 12:27:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=5ajJapMqVXyIc6ffXxblxvPy8Gskb0uqSs/rjbljrR4=; b=NbZfUIk/mtXukMCVJAfwI/Ot8N bVp670xO3ZZQK4E9C9peZlNCwMYA+gnXjz4bnCwOXX5qarmhS909IRd4SPVzAyOLqaeovM8agISNY 5Ma5+tjQLudsd/zdkj2I19zELpNTusOooSChdvZlZSLHvaJoiyZW+CfFTnIPKYysNfJWgPtDQagGd Ctez/FmhnCkt8qvC6UcLwJgXuGdRYz5hR3j4duHhtJnHfAKL6wJA7im6wcxhR/7FYknIjAEi+IjHK FD3HxfJhsGQpyErAnRP6RDorocS5QiL7Ad9J9J4ufb7UNeCb9WWCrunJpoj4wlxDwRIMrrQZytRcB IxuqQq1Q==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmOG-0007fH-Fj; Tue, 24 Mar 2020 16:26:56 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Date: Tue, 24 Mar 2020 17:26:32 +0100 Message-Id: <20200324162633.754714-10-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- 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 From patchwork Tue Mar 24 16:26:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11455971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4321914B4 for ; Tue, 24 Mar 2020 16:27:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 246FA20788 for ; Tue, 24 Mar 2020 16:27:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="L//iPNPE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728955AbgCXQ1E (ORCPT ); Tue, 24 Mar 2020 12:27:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59632 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728943AbgCXQ1D (ORCPT ); Tue, 24 Mar 2020 12:27:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=QOhFdVghmzzWBFVIiktpLtHySxmXru0IZ3ItHpXYenQ=; b=L//iPNPELyfOf0VDWA5mQyD/aY IEy8hwAzXXvWMKLdRF2IAn7xWfqOyskU3rSmm6MjYPwY2kALV7hKtNhiB66TO8U1Ix73cAtOUWhqY ow1XH2L7lrRL5hbJebQlx4IIna90a35d0bTlkzeOVwVBIkBxnoxwRS+cIjh11HVHPQhpaXVXiUbcX gOocYbSLBXTXBJvOrIrN+xt2ArGxibCXKTjFH4Yo7D9bsctObJkMVaazQtYsk3S/IafluQR8Sw0xy U7CnynU+plFi6dzqqt5YpefHeQOxnqxTOdklmIQJ4DJOwom5B8f0g2ZEOvr6fI2wmT/YrTzIMkFOx 0CPngV6w==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmOI-0007fl-S2; Tue, 24 Mar 2020 16:26:59 +0000 From: Christoph Hellwig To: Yoshinori Sato , Rich Felker Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/10] sh: use the generic dma coherent remap allocator Date: Tue, 24 Mar 2020 17:26:33 +0100 Message-Id: <20200324162633.754714-11-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200324162633.754714-1-hch@lst.de> References: <20200324162633.754714-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- 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 -#include #include -#include #include #include -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,