Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp302858ybl; Sat, 17 Aug 2019 00:50:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk5LXOxKSwAn81rAI1RTXenk32/QxvCQgZxPbMynsP/hppYpLg6rpaGKkq1v1Ud3zdH2xa X-Received: by 2002:a63:7a06:: with SMTP id v6mr11169127pgc.115.1566028236691; Sat, 17 Aug 2019 00:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566028236; cv=none; d=google.com; s=arc-20160816; b=vMeitM5JfFVLx2XlYT44C4N5zdT6tNBvM4jCakylvUCk7D8Fbb7vprt3v0jdNx0HuW gDFAG6cMsvWm2qZVmKFw5s7XrAHYTmx+9qSlOYijLIpq9VwMXpGgC09g4evWng3/AotC 8Mty6iw5AHPbvEznJkwmS3J46DZXXWFxecGDKqaxayI8lQNYS7LGo+ncxaZHKhFXZivF K0lrpn57RFh/tR6Oi9PcDwr/eoxyg/InHOXjG6kIleBP06Fo2k2J3Oec2JvafGm/VVWn ZL2QC5ORF64PdB/5zIInE2KG5sZLc0cdh5KrXoHJyRhCmE+CQYZKLC+BFoS7Hts1WO72 EaOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gSXK72L3945Be32U1mETDhkMRH47vVT41OGNUHBlxH8=; b=N3c7vmb3N3kUXmAvDL1/iaGadxqA22318fnGjoCpr584yFnKTBNAkjQJ8VCiovrB7O HCtfT+g+EVIQYMnDKluaa55GQhqFzsfuI/UfLy090hXOKqb82rDt/wW3Kup3ITDhvwtZ 1rLASgODEel4T6yJJ2OyZ/51k2BTiuI4cpO/a8XebSOk9hHFyZEx9vrwMVaOC6llEbTi 6n3tG13i/carmms103n1FWQ5MIebl0BqCQ7cpuYlRgTbgRPQelO6hojNSs7mB7lM01yl YoZDVDk2S4mD1arzpIKPFtnxo7tau3nmWTNH6CV1bE+R4J3Iddw9Jc5mtvSWor/xJDgR vYzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ir+7dvjJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si5423298pgn.77.2019.08.17.00.50.22; Sat, 17 Aug 2019 00:50:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Ir+7dvjJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbfHQHtH (ORCPT + 99 others); Sat, 17 Aug 2019 03:49:07 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37368 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726087AbfHQHtG (ORCPT ); Sat, 17 Aug 2019 03:49:06 -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:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gSXK72L3945Be32U1mETDhkMRH47vVT41OGNUHBlxH8=; b=Ir+7dvjJ0n19ReL7GE5byR1L5s RYLw9sbqCI/zu7wHP1Iv9zKFGapgO3o1RbAJ9FFm7eI/oxTVoLVkX66xz0/YEwyneuiq8M/u6pzh0 SgVoXFAmsBUYFf63pntZfH8NJPrUinhX9+zXN1SlkfnVjLe8bsTifKf09Y90ACOd9sg4zKy2y2vKm Q/OBS1nE4OWQccKddysmnSkqxRiv9IqbCinrnjb1MWKb3vt1zCEtdfdVtVbncW6xtdd79XdW5ljxw SL/WiqRAw8uP8TgYnfp0Sg7mA7tohMlaMEwakmMWhj34u8RT3Ax1+zH2baeE8ic/nfsi5m/z4y6Oq xxA/JqOw==; Received: from [2001:4bb8:18c:28b5:44f9:d544:957f:32cb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hytSN-0005GA-NB; Sat, 17 Aug 2019 07:49:00 +0000 From: Christoph Hellwig To: Arnd Bergmann , Guo Ren , Michal Simek , Greentime Hu , Vincent Chen , Guan Xuetao , x86@kernel.org Cc: linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-mtd@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/26] asm-generic: don't provide ioremap for CONFIG_MMU Date: Sat, 17 Aug 2019 09:32:43 +0200 Message-Id: <20190817073253.27819-17-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190817073253.27819-1-hch@lst.de> References: <20190817073253.27819-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All MMU-enabled ports have a non-trivial ioremap and should thus provide the prototype for their implementation instead of providing a generic one unless a different symbol is not defined. Note that this only affects sparc32 nds32 as all others do provide their own version. Also update the kerneldoc comments in asm-generic/io.h to explain the situation around the default ioremap* implementations correctly. Signed-off-by: Christoph Hellwig --- arch/nds32/include/asm/io.h | 2 ++ arch/sparc/include/asm/io_32.h | 1 + include/asm-generic/io.h | 29 ++++++++--------------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h index 16f262322b8f..fb0e8a24c7af 100644 --- a/arch/nds32/include/asm/io.h +++ b/arch/nds32/include/asm/io.h @@ -6,6 +6,7 @@ #include +void __iomem *ioremap(phys_addr_t phys_addr, size_t size); extern void iounmap(volatile void __iomem *addr); #define __raw_writeb __raw_writeb static inline void __raw_writeb(u8 val, volatile void __iomem *addr) @@ -80,4 +81,5 @@ static inline u32 __raw_readl(const volatile void __iomem *addr) #define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); }) #define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); }) #include + #endif /* __ASM_NDS32_IO_H */ diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h index df2dc1784673..9a52d9506f80 100644 --- a/arch/sparc/include/asm/io_32.h +++ b/arch/sparc/include/asm/io_32.h @@ -127,6 +127,7 @@ static inline void sbus_memcpy_toio(volatile void __iomem *dst, * Bus number may be embedded in the higher bits of the physical address. * This is why we have no bus number argument to ioremap(). */ +void __iomem *ioremap(phys_addr_t offset, size_t size); void iounmap(volatile void __iomem *addr); /* Create a virtual mapping cookie for an IO port range */ void __iomem *ioport_map(unsigned long port, unsigned int nr); diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index a98ed6325727..6a5edc23afe2 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -922,28 +922,16 @@ static inline void *phys_to_virt(unsigned long address) /** * DOC: ioremap() and ioremap_*() variants * - * If you have an IOMMU your architecture is expected to have both ioremap() - * and iounmap() implemented otherwise the asm-generic helpers will provide a - * direct mapping. + * Architectures with an MMU are expected to provide ioremap() and iounmap() + * themselves. For NOMMU architectures we provide a default nop-op + * implementation that expect that the physical address used for MMIO are + * already marked as uncached, and can be used as kernel virtual addresses. * - * There are ioremap_*() call variants, if you have no IOMMU we naturally will - * default to direct mapping for all of them, you can override these defaults. - * If you have an IOMMU you are highly encouraged to provide your own - * ioremap variant implementation as there currently is no safe architecture - * agnostic default. To avoid possible improper behaviour default asm-generic - * ioremap_*() variants all return NULL when an IOMMU is available. If you've - * defined your own ioremap_*() variant you must then declare your own - * ioremap_*() variant as defined to itself to avoid the default NULL return. + * ioremap_wc() and ioremap_wt() can provide more relaxed caching attributes + * for specific drivers if the architecture choses to implement them. If they + * are not implemented we fall back to plain ioremap. */ #ifndef CONFIG_MMU - -/* - * Change "struct page" to physical address. - * - * This implementation is for the no-MMU case only... if you have an MMU - * you'll need to provide your own definitions. - */ - #ifndef ioremap #define ioremap ioremap static inline void __iomem *ioremap(phys_addr_t offset, size_t size) @@ -954,14 +942,13 @@ static inline void __iomem *ioremap(phys_addr_t offset, size_t size) #ifndef iounmap #define iounmap iounmap - static inline void iounmap(void __iomem *addr) { } #endif #endif /* CONFIG_MMU */ + #ifndef ioremap_nocache -void __iomem *ioremap(phys_addr_t phys_addr, size_t size); #define ioremap_nocache ioremap_nocache static inline void __iomem *ioremap_nocache(phys_addr_t offset, size_t size) { -- 2.20.1