From patchwork Sat Mar 15 10:59:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14017964 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D37301DFED; Sat, 15 Mar 2025 10:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036363; cv=none; b=IbwxCvCeGmFC7SncOhsRCbLx/g9wEduSqQkVSpZ2b+8wXA+xZN3dvckhRs/HrYOaFCNrzrLieP7QeCUkf9H2qXdkZ1x4KhpTW9lBBJtBSv+V5yAwYzn7fietBrWQaY2BpyzfQEQVvav16pfiFTggxPBz60PszjVr6ReV+YFVmFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036363; c=relaxed/simple; bh=XXA0f10ge76JURf0KA9hKmmXZONM5AkZ6ZqHtAnEIXc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=foDw6bFkweIKWVT2M9FDOJeXLDuDPk/mi03dkxgLd+tm+q+RWGEpBg0Qsjg7MHB7feS2yJyTYOKzngQ+EUyWnHdG/H89gao6bqkY/w4vG/IdcH1W4GP9k9ctq8ZFBbXbjKwHtcT8Too1bEFPKSuYg6j6JO45kTcx9hF7OKmF2dk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q4hScGqi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q4hScGqi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94EACC4CEED; Sat, 15 Mar 2025 10:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742036362; bh=XXA0f10ge76JURf0KA9hKmmXZONM5AkZ6ZqHtAnEIXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4hScGqiOZR2G7+YZ+XeHtUATN3Mm6OjWKl7pPELBMWcUOaE7swU5/tXQXCtYrXgJ SPn6NIohA89E6WxLd4/4EO0PHl9zWKf0cYcPnPtM9euQEITLvQJY/l3Z6HMkfQ21kY peVZIewC2M2sq5nTydsNySsFoSWFAEU9A8haa53ye/om1SVbnSU9xmf1KmvRvkOXHc /lctotQq0rUR//VHF5ceYPM7gWypeEy7pueirktZ8wIvWBfKkm+w6ebJIp6scRyM7+ AX/jfDmcpNQctPeQnPz5wN6oLaWuHKAAe4zqT7h6pZKObc96WoBAOr4+Q2Xof5tAPo AJ4N2+LBEjFYQ== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Arnd Bergmann , Richard Henderson , Matt Turner , Geert Uytterhoeven , Greg Ungerer , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Julian Vetter , Bjorn Helgaas , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org Subject: [PATCH 1/6] alpha: stop using asm-generic/iomap.h Date: Sat, 15 Mar 2025 11:59:02 +0100 Message-Id: <20250315105907.1275012-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250315105907.1275012-1-arnd@kernel.org> References: <20250315105907.1275012-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann Alpha has custom definitions for ioread64()/iowrite64(), which now don't exist in the lib/iomap.c variant. This is an endless source of build failures, since alpha tries to share a couple of function declarations. Change alpha to have its own prototypes that match the definitions in arch/alpha/kerne/io.c instead. Signed-off-by: Arnd Bergmann --- arch/alpha/include/asm/io.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h index 65fe1e54c6da..fa3e4c246cda 100644 --- a/arch/alpha/include/asm/io.h +++ b/arch/alpha/include/asm/io.h @@ -10,10 +10,6 @@ #include #include -/* The generic header contains only prototypes. Including it ensures that - the implementation we have here matches that interface. */ -#include - /* * Virtual -> physical identity mapping starts at this offset */ @@ -276,13 +272,24 @@ extern void __raw_writeq(u64 b, volatile void __iomem *addr); #define __raw_writel __raw_writel #define __raw_writeq __raw_writeq -/* - * Mapping from port numbers to __iomem space is pretty easy. - */ +extern unsigned int ioread8(const void __iomem *); +extern unsigned int ioread16(const void __iomem *); +extern unsigned int ioread32(const void __iomem *); +extern u64 ioread64(const void __iomem *); + +extern void iowrite8(u8, void __iomem *); +extern void iowrite16(u16, void __iomem *); +extern void iowrite32(u32, void __iomem *); +extern void iowrite64(u64, void __iomem *); + +extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); +extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); +extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); + +extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); +extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); +extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); -/* These two have to be extern inline because of the extern prototype from - . It is not legal to mix "extern" and "static" for - the same declaration. */ extern inline void __iomem *ioport_map(unsigned long port, unsigned int size) { return IO_CONCAT(__IO_PREFIX,ioportmap) (port); @@ -629,10 +636,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count); #define RTC_PORT(x) (0x70 + (x)) #define RTC_ALWAYS_BCD 0 -/* - * These get provided from since alpha does not - * select GENERIC_IOMAP. - */ #define ioread64 ioread64 #define iowrite64 iowrite64 #define ioread8_rep ioread8_rep From patchwork Sat Mar 15 10:59:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14017965 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E9A01DFED; Sat, 15 Mar 2025 10:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036368; cv=none; b=YwYEIIoddCBPQ6YrKEP9XjjK6aIRK4DN6Q658hEk/WjSE0VkmxSl0GRDsuI8WmysdtQpHkinQSkilqcY7WmUKfZsHp3vnev5DN6JJd+JzZUp/RFbzvmyA5A/O/wD3yPZjJ/OXQX7tKRNea2i94qK9uAkZE4qyLDKcXgdk1U1mXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036368; c=relaxed/simple; bh=ifm6+RNn7W+4D9iZBd9DXE2mvpD9E69YYaSTABFkwMw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CcEha8iHfpbWQkJ8pF2SJvss5ZAisDk0ELUHMLofmpevged8Y5K4HEulrtrTRGYkoBrqviWgw5KCSzjBsozZSG02UBvtYjCL7A4vtTJy4YhcotElaWGa/2lhoj6sOXLVxy77X9MUDe139VGeQWBvz/pY8wT+90SKGe8/0pAw7rE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XLAs0s17; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XLAs0s17" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C33C2C4CEE9; Sat, 15 Mar 2025 10:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742036367; bh=ifm6+RNn7W+4D9iZBd9DXE2mvpD9E69YYaSTABFkwMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XLAs0s17y4TlJdo1dj8CRoFIbCgt8ordw0TgHG/VvNSocGisqa7LAU6K10B8AsI0w Khn8ABI6KU0a3m/BkEFcO70ou6Wu8vLHIqLUM/JXV4Jiysyx7inju1ovYrHO3iEK9S h5zu1Yq5AwePf0Q6hPWy2A3LL1W5eUQkbL/JwOr7EMZK+awdBBGl9dAzwnw3HXGdRt jTqkAid0yIIKlIDO0h84d6Gp6ZTcNaK1r1UuSbDwIuNXuHgaKGAkCskivbXA/8PLOX tPKrdogC4rwrmwkYvsKL5vu6hQzN2cTCwnZuaVxdH95yrNAmKJbgxprIbfxpaCrR3p mT76EiNpgsZtg== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Arnd Bergmann , Richard Henderson , Matt Turner , Geert Uytterhoeven , Greg Ungerer , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Julian Vetter , Bjorn Helgaas , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org Subject: [PATCH 2/6] sh: remove duplicate ioread/iowrite helpers Date: Sat, 15 Mar 2025 11:59:03 +0100 Message-Id: <20250315105907.1275012-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250315105907.1275012-1-arnd@kernel.org> References: <20250315105907.1275012-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann The ioread/iowrite functions on sh only do memory mapped I/O like the generic verion, and never map onto non-MMIO inb/outb variants, so they just add complexity. In particular, the use of asm-generic/iomap.h ties the declaration to the x86 implementation. Remove the custom versions and use the architecture-independent fallback code instead. Some of the calling conventions on sh are different here, so fix that by adding 'volatile' keywords where required by the generic implementation and change the cpg clock driver to no longer depend on the interesting choice of return types for ioread8/ioread16/ioread32. Signed-off-by: Arnd Bergmann --- arch/sh/include/asm/io.h | 30 ++------ arch/sh/kernel/Makefile | 3 - arch/sh/kernel/iomap.c | 162 --------------------------------------- arch/sh/kernel/ioport.c | 5 -- arch/sh/lib/io.c | 4 +- drivers/sh/clk/cpg.c | 25 +++--- 6 files changed, 21 insertions(+), 208 deletions(-) delete mode 100644 arch/sh/kernel/iomap.c diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index cf5eab840d57..0f663ebec700 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -19,7 +19,6 @@ #include #include #include -#include #define __IO_PREFIX generic #include @@ -100,7 +99,7 @@ pfx##writes##bwlq(volatile void __iomem *mem, const void *addr, \ } \ } \ \ -static inline void pfx##reads##bwlq(volatile void __iomem *mem, \ +static inline void pfx##reads##bwlq(const volatile void __iomem *mem, \ void *addr, unsigned int count) \ { \ volatile type *__addr = addr; \ @@ -114,37 +113,18 @@ static inline void pfx##reads##bwlq(volatile void __iomem *mem, \ __BUILD_MEMORY_STRING(__raw_, b, u8) __BUILD_MEMORY_STRING(__raw_, w, u16) -void __raw_writesl(void __iomem *addr, const void *data, int longlen); -void __raw_readsl(const void __iomem *addr, void *data, int longlen); +void __raw_writesl(void volatile __iomem *addr, const void *data, int longlen); +void __raw_readsl(const volatile void __iomem *addr, void *data, int longlen); __BUILD_MEMORY_STRING(__raw_, q, u64) #define ioport_map ioport_map -#define ioport_unmap ioport_unmap #define pci_iounmap pci_iounmap -#define ioread8 ioread8 -#define ioread16 ioread16 -#define ioread16be ioread16be -#define ioread32 ioread32 -#define ioread32be ioread32be - -#define iowrite8 iowrite8 -#define iowrite16 iowrite16 -#define iowrite16be iowrite16be -#define iowrite32 iowrite32 -#define iowrite32be iowrite32be - -#define ioread8_rep ioread8_rep -#define ioread16_rep ioread16_rep -#define ioread32_rep ioread32_rep - -#define iowrite8_rep iowrite8_rep -#define iowrite16_rep iowrite16_rep -#define iowrite32_rep iowrite32_rep - #ifdef CONFIG_HAS_IOPORT_MAP +extern void __iomem *ioport_map(unsigned long port, unsigned int nr); + /* * Slowdown I/O port space accesses for antique hardware. */ diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile index ba917008d63e..7b453592adaf 100644 --- a/arch/sh/kernel/Makefile +++ b/arch/sh/kernel/Makefile @@ -21,10 +21,7 @@ obj-y := head_32.o debugtraps.o dumpstack.o \ syscalls_32.o time.o topology.o traps.o \ traps_32.o unwinder.o -ifndef CONFIG_GENERIC_IOMAP -obj-y += iomap.o obj-$(CONFIG_HAS_IOPORT_MAP) += ioport.o -endif obj-y += sys_sh32.o obj-y += cpu/ diff --git a/arch/sh/kernel/iomap.c b/arch/sh/kernel/iomap.c deleted file mode 100644 index 0a0dff4e66de..000000000000 --- a/arch/sh/kernel/iomap.c +++ /dev/null @@ -1,162 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * arch/sh/kernel/iomap.c - * - * Copyright (C) 2000 Niibe Yutaka - * Copyright (C) 2005 - 2007 Paul Mundt - */ -#include -#include - -unsigned int ioread8(const void __iomem *addr) -{ - return readb(addr); -} -EXPORT_SYMBOL(ioread8); - -unsigned int ioread16(const void __iomem *addr) -{ - return readw(addr); -} -EXPORT_SYMBOL(ioread16); - -unsigned int ioread16be(const void __iomem *addr) -{ - return be16_to_cpu(__raw_readw(addr)); -} -EXPORT_SYMBOL(ioread16be); - -unsigned int ioread32(const void __iomem *addr) -{ - return readl(addr); -} -EXPORT_SYMBOL(ioread32); - -unsigned int ioread32be(const void __iomem *addr) -{ - return be32_to_cpu(__raw_readl(addr)); -} -EXPORT_SYMBOL(ioread32be); - -void iowrite8(u8 val, void __iomem *addr) -{ - writeb(val, addr); -} -EXPORT_SYMBOL(iowrite8); - -void iowrite16(u16 val, void __iomem *addr) -{ - writew(val, addr); -} -EXPORT_SYMBOL(iowrite16); - -void iowrite16be(u16 val, void __iomem *addr) -{ - __raw_writew(cpu_to_be16(val), addr); -} -EXPORT_SYMBOL(iowrite16be); - -void iowrite32(u32 val, void __iomem *addr) -{ - writel(val, addr); -} -EXPORT_SYMBOL(iowrite32); - -void iowrite32be(u32 val, void __iomem *addr) -{ - __raw_writel(cpu_to_be32(val), addr); -} -EXPORT_SYMBOL(iowrite32be); - -/* - * These are the "repeat MMIO read/write" functions. - * Note the "__raw" accesses, since we don't want to - * convert to CPU byte order. We write in "IO byte - * order" (we also don't have IO barriers). - */ -static inline void mmio_insb(const void __iomem *addr, u8 *dst, int count) -{ - while (--count >= 0) { - u8 data = __raw_readb(addr); - *dst = data; - dst++; - } -} - -static inline void mmio_insw(const void __iomem *addr, u16 *dst, int count) -{ - while (--count >= 0) { - u16 data = __raw_readw(addr); - *dst = data; - dst++; - } -} - -static inline void mmio_insl(const void __iomem *addr, u32 *dst, int count) -{ - while (--count >= 0) { - u32 data = __raw_readl(addr); - *dst = data; - dst++; - } -} - -static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count) -{ - while (--count >= 0) { - __raw_writeb(*src, addr); - src++; - } -} - -static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count) -{ - while (--count >= 0) { - __raw_writew(*src, addr); - src++; - } -} - -static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) -{ - while (--count >= 0) { - __raw_writel(*src, addr); - src++; - } -} - -void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count) -{ - mmio_insb(addr, dst, count); -} -EXPORT_SYMBOL(ioread8_rep); - -void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count) -{ - mmio_insw(addr, dst, count); -} -EXPORT_SYMBOL(ioread16_rep); - -void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count) -{ - mmio_insl(addr, dst, count); -} -EXPORT_SYMBOL(ioread32_rep); - -void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) -{ - mmio_outsb(addr, src, count); -} -EXPORT_SYMBOL(iowrite8_rep); - -void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) -{ - mmio_outsw(addr, src, count); -} -EXPORT_SYMBOL(iowrite16_rep); - -void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) -{ - mmio_outsl(addr, src, count); -} -EXPORT_SYMBOL(iowrite32_rep); diff --git a/arch/sh/kernel/ioport.c b/arch/sh/kernel/ioport.c index c8aff8a20164..915a3dfd9f02 100644 --- a/arch/sh/kernel/ioport.c +++ b/arch/sh/kernel/ioport.c @@ -23,8 +23,3 @@ void __iomem *ioport_map(unsigned long port, unsigned int nr) return (void __iomem *)(port + sh_io_port_base); } EXPORT_SYMBOL(ioport_map); - -void ioport_unmap(void __iomem *addr) -{ -} -EXPORT_SYMBOL(ioport_unmap); diff --git a/arch/sh/lib/io.c b/arch/sh/lib/io.c index ebcf7c0a7335..dc6345e4c53b 100644 --- a/arch/sh/lib/io.c +++ b/arch/sh/lib/io.c @@ -11,7 +11,7 @@ #include #include -void __raw_readsl(const void __iomem *addr, void *datap, int len) +void __raw_readsl(const volatile void __iomem *addr, void *datap, int len) { u32 *data; @@ -60,7 +60,7 @@ void __raw_readsl(const void __iomem *addr, void *datap, int len) } EXPORT_SYMBOL(__raw_readsl); -void __raw_writesl(void __iomem *addr, const void *data, int len) +void __raw_writesl(volatile void __iomem *addr, const void *data, int len) { if (likely(len != 0)) { int tmp1; diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c index fd72d9088bdc..64ed7d64458a 100644 --- a/drivers/sh/clk/cpg.c +++ b/drivers/sh/clk/cpg.c @@ -26,6 +26,19 @@ static unsigned int sh_clk_read(struct clk *clk) return ioread32(clk->mapped_reg); } +static unsigned int sh_clk_read_status(struct clk *clk) +{ + void __iomem *mapped_status = (phys_addr_t)clk->status_reg - + (phys_addr_t)clk->enable_reg + clk->mapped_reg; + + if (clk->flags & CLK_ENABLE_REG_8BIT) + return ioread8(mapped_status); + else if (clk->flags & CLK_ENABLE_REG_16BIT) + return ioread16(mapped_status); + + return ioread32(mapped_status); +} + static void sh_clk_write(int value, struct clk *clk) { if (clk->flags & CLK_ENABLE_REG_8BIT) @@ -40,20 +53,10 @@ static int sh_clk_mstp_enable(struct clk *clk) { sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk); if (clk->status_reg) { - unsigned int (*read)(const void __iomem *addr); int i; - void __iomem *mapped_status = (phys_addr_t)clk->status_reg - - (phys_addr_t)clk->enable_reg + clk->mapped_reg; - - if (clk->flags & CLK_ENABLE_REG_8BIT) - read = ioread8; - else if (clk->flags & CLK_ENABLE_REG_16BIT) - read = ioread16; - else - read = ioread32; for (i = 1000; - (read(mapped_status) & (1 << clk->enable_bit)) && i; + (sh_clk_read_status(clk) & (1 << clk->enable_bit)) && i; i--) cpu_relax(); if (!i) { From patchwork Sat Mar 15 10:59:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14017966 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18F221F8EEC; Sat, 15 Mar 2025 10:59:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036373; cv=none; b=rKNkLbrARSjJLqPo3YtB2FAf7+vYyaGKVl3zYj2pHr2UakACnPxo2fZ23xDPFY75ZBw/dYHGyYP9WDRu4pqwtyv8+TODDz2n1JUgsKecbeN7rBj5lJYpyYS+hcQuqkONi0hnEgM2d+2IyjF9MOIYOBwYrvexbAPcZSFqvieV4vw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036373; c=relaxed/simple; bh=/gsyKJhuoIen+vHsBslWnn/2C+BZeE5kQsZ8QckJoRI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YI7/t6AIHPqHFIA6s58JE8XM75eF0XLJT2QzCLfrIKlz1AMiNRc0I28KUDxBrcNyS9AV7tguLf4RlTrn+19ifrv/cqRCWZhkIqCnSOBUkur8o7Nqk9+DAd2A1A36zSLCmKjGjetQ+NhDqIBxEJgLMtxk6+RxE/ykKfKEGeBQS7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V+bdiqGN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="V+bdiqGN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E94C1C4CEED; Sat, 15 Mar 2025 10:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742036372; bh=/gsyKJhuoIen+vHsBslWnn/2C+BZeE5kQsZ8QckJoRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+bdiqGN8Z8XOKssQQKhRShJZpgdJU/nDmTn2ED0MtuKUnS5le08t96rPYxjBIW3W EEjWDsWMb/VL49fo30BlNQ9aW1IqRkBdQPXhsa7JCcSJ1za3w9XXCKFqjVipuCYzSA QLgWrS+9HVDy5DynWbyMvCZD/o2pd8i++ywdtQGNubkvh+FjQqVI8ogvKUmXVh8UIm j5GRzafGvHy8Z9mU22LR87OV28V/hM7swqiMFSP+nmGB/4fJfA3M/nWf/b1J6du1xR PTMFl0VGtXo0jf4htyqvc7URq4YGmmI/oIvLIHhSVmacjGt5VEU2RtCM8nbfnFi8Fx tHb2HdNFzItjg== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Arnd Bergmann , Richard Henderson , Matt Turner , Geert Uytterhoeven , Greg Ungerer , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Julian Vetter , Bjorn Helgaas , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org Subject: [PATCH 3/6] parisc: stop using asm-generic/iomap.h Date: Sat, 15 Mar 2025 11:59:04 +0100 Message-Id: <20250315105907.1275012-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250315105907.1275012-1-arnd@kernel.org> References: <20250315105907.1275012-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann parisc uses custom iomap helpers to map bus specific function calls into a linear __iomem token, but it tries to use the declarations from the x86 "generic iomap" code. Untangle the two by duplicating the required declations and dropping the #include that pulls in more stuff that is not needed here, to allow simplify the generic version later. Signed-off-by: Arnd Bergmann --- arch/parisc/include/asm/io.h | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h index 3143cf29ce27..59d85d2386bb 100644 --- a/arch/parisc/include/asm/io.h +++ b/arch/parisc/include/asm/io.h @@ -227,36 +227,54 @@ extern void outsl (unsigned long port, const void *src, unsigned long count); #define F_EXTEND(x) ((unsigned long)((x) | (0xffffffff00000000ULL))) #ifdef CONFIG_64BIT -#define ioread64 ioread64 -#define ioread64be ioread64be -#define iowrite64 iowrite64 -#define iowrite64be iowrite64be extern u64 ioread64(const void __iomem *addr); extern u64 ioread64be(const void __iomem *addr); +#define ioread64 ioread64 +#define ioread64be ioread64be + extern void iowrite64(u64 val, void __iomem *addr); extern void iowrite64be(u64 val, void __iomem *addr); +#define iowrite64 iowrite64 +#define iowrite64be iowrite64be #endif -#include -/* - * These get provided from since parisc does not - * select GENERIC_IOMAP. - */ +extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +extern void ioport_unmap(void __iomem *); #define ioport_map ioport_map #define ioport_unmap ioport_unmap + +extern unsigned int ioread8(const void __iomem *); +extern unsigned int ioread16(const void __iomem *); +extern unsigned int ioread16be(const void __iomem *); +extern unsigned int ioread32(const void __iomem *); +extern unsigned int ioread32be(const void __iomem *); #define ioread8 ioread8 #define ioread16 ioread16 #define ioread32 ioread32 #define ioread16be ioread16be #define ioread32be ioread32be + +extern void iowrite8(u8, void __iomem *); +extern void iowrite16(u16, void __iomem *); +extern void iowrite16be(u16, void __iomem *); +extern void iowrite32(u32, void __iomem *); +extern void iowrite32be(u32, void __iomem *); #define iowrite8 iowrite8 #define iowrite16 iowrite16 #define iowrite32 iowrite32 #define iowrite16be iowrite16be #define iowrite32be iowrite32be + +extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); +extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); +extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); #define ioread8_rep ioread8_rep #define ioread16_rep ioread16_rep #define ioread32_rep ioread32_rep + +extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); +extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); +extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); #define iowrite8_rep iowrite8_rep #define iowrite16_rep iowrite16_rep #define iowrite32_rep iowrite32_rep From patchwork Sat Mar 15 10:59:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14017967 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4813F1F7098; Sat, 15 Mar 2025 10:59:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036378; cv=none; b=bnzgyr2L/cD4eH7N5nBcihPMXev+0LksNQF+I4BohNL66GCFPFkDkaF/YyOQpfL2JFe5vUBW7sedBUK7w6C7bp9QCnN/DCtualZpcf6WmANBRgPOeB2L+380TC6gy4/QSjnnntu2+SjF85SuxTksUHzp/ZssK0fsujISToLeK3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036378; c=relaxed/simple; bh=A5i5/N269tmlctuJx50AMW6UOHChrJm88b2b4zSeyoA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O2uwLxFqj4KLq7lVTThC8d8xjFbagSmtSjSFYWH1n4qfdK/2lPUNSU6qrKqzj5HWBXefwzBGD5fsZYsrmSs3/AMTJueDmdhBfG46zpBqniRcI3ieDpEdCJ+G/8LC92bCrt+fh2xzudiKDARUtRGfQR0ujkdvKGfGghth2U4A5DA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=diX0xfqF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="diX0xfqF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19449C4CEE9; Sat, 15 Mar 2025 10:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742036377; bh=A5i5/N269tmlctuJx50AMW6UOHChrJm88b2b4zSeyoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=diX0xfqF9v6ZGZRle7yS797sxjadb3E94MlDDS4u2Ag47HK7jKFgrf0+lFKqJyd4Z 9zI1O0TL4ydGgnrIeulnAzEMTAwCyHN4aaYIjOJk4KG9iQ9AUEgXcaqj1ZPma2QWCj 7R4G/nVWt1vuxaxJKUIQRdYxGdOY+kQSZryHNxz+vVP+V61ore9HhuE0ButGW2mWzR bZv7UuwIJNTuGwzwOmv42rKJQ/X2fJFY4DLlYwRmOt8Uuk/ln2ZGVjY/dlC/AIRZQf xIBQPHVRG8UBgapcN+S6EKST97e/EqLy5aOB9pu3G9miFJF68PdnfRDwdShSTHnAR1 0xk0SMnqOCSoA== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Arnd Bergmann , Richard Henderson , Matt Turner , Geert Uytterhoeven , Greg Ungerer , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Julian Vetter , Bjorn Helgaas , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org Subject: [PATCH 4/6] powerpc: asm/io.h: remove split ioread64/iowrite64 helpers Date: Sat, 15 Mar 2025 11:59:05 +0100 Message-Id: <20250315105907.1275012-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250315105907.1275012-1-arnd@kernel.org> References: <20250315105907.1275012-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann In previous kernels, there were conflicting definitions for what ioread64_lo_hi() and similar functions were supposed to do on architectures with native 64-bit MMIO. Based on the actual usage in drivers, they are in fact expected to be a pair of 32-bit accesses on all architectures, which makes the powerpc64 definition wrong. Remove it and use the generic implementation instead. Drivers that want to have split lo/hi or hi/lo accesses on 32-bit architectures but can use 64-bit accesses where supported should instead use ioread64()/iowrite64() after including the corresponding header file. Signed-off-by: Arnd Bergmann Acked-by: Michael Ellerman (powerpc) --- arch/powerpc/include/asm/io.h | 48 ----------------------------------- 1 file changed, 48 deletions(-) diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index fd92ac450169..d36c4ccaca08 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -738,35 +738,11 @@ static inline unsigned int ioread32be(const void __iomem *addr) #define ioread32be ioread32be #ifdef __powerpc64__ -static inline u64 ioread64_lo_hi(const void __iomem *addr) -{ - return readq(addr); -} -#define ioread64_lo_hi ioread64_lo_hi - -static inline u64 ioread64_hi_lo(const void __iomem *addr) -{ - return readq(addr); -} -#define ioread64_hi_lo ioread64_hi_lo - static inline u64 ioread64be(const void __iomem *addr) { return readq_be(addr); } #define ioread64be ioread64be - -static inline u64 ioread64be_lo_hi(const void __iomem *addr) -{ - return readq_be(addr); -} -#define ioread64be_lo_hi ioread64be_lo_hi - -static inline u64 ioread64be_hi_lo(const void __iomem *addr) -{ - return readq_be(addr); -} -#define ioread64be_hi_lo ioread64be_hi_lo #endif /* __powerpc64__ */ static inline void iowrite16be(u16 val, void __iomem *addr) @@ -782,35 +758,11 @@ static inline void iowrite32be(u32 val, void __iomem *addr) #define iowrite32be iowrite32be #ifdef __powerpc64__ -static inline void iowrite64_lo_hi(u64 val, void __iomem *addr) -{ - writeq(val, addr); -} -#define iowrite64_lo_hi iowrite64_lo_hi - -static inline void iowrite64_hi_lo(u64 val, void __iomem *addr) -{ - writeq(val, addr); -} -#define iowrite64_hi_lo iowrite64_hi_lo - static inline void iowrite64be(u64 val, void __iomem *addr) { writeq_be(val, addr); } #define iowrite64be iowrite64be - -static inline void iowrite64be_lo_hi(u64 val, void __iomem *addr) -{ - writeq_be(val, addr); -} -#define iowrite64be_lo_hi iowrite64be_lo_hi - -static inline void iowrite64be_hi_lo(u64 val, void __iomem *addr) -{ - writeq_be(val, addr); -} -#define iowrite64be_hi_lo iowrite64be_hi_lo #endif /* __powerpc64__ */ struct pci_dev; From patchwork Sat Mar 15 10:59:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14017968 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 792D61F8736; Sat, 15 Mar 2025 10:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036383; cv=none; b=ACj1C+Qb5MQsDLzRwSmbsXLN5iM45ZzBJEMpRBj4a/RymGIxYaPOGVnoZ3z1zJQKPch4CpplqU2qlJSbuBwLbAC/hzS/tQsrogZ6K/h/3TFo43Ep1kYjV9NOFm5Tcr6ah08vwPsSAJiKSW4+qrXwh3zjUByCJ4aXrpgw1oTLmGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036383; c=relaxed/simple; bh=Ocgkmwh32rBMKgy+zdGqEw65Xp0hQcjH99SnZLPTggw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OcJtRwbolp+g6onnbd46ph6ort0ZV65J+yvcCsdWGsVos+CrmBlNaSHzz82C6fBiW7G1biDM5rkFCMSeT9OiAfKYKLOHqKwbfjOjliWJs36yzOADmjKxtO9xNV8KfFKnJkHWfA2ephvoKl/sntw/Z4qbXUdKWMbFnlGr1GOKDkk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AUVpQhYu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AUVpQhYu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30993C4CEEE; Sat, 15 Mar 2025 10:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742036382; bh=Ocgkmwh32rBMKgy+zdGqEw65Xp0hQcjH99SnZLPTggw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUVpQhYuj8R5lbEwOh0aZKM4Y8Acv7xnv2sqN2YDbmHsBGQIRnSAadSmccWuUhLGT B2zQQZNue12j7UVtiRIi3lBxv1XbGOrom+jZtkUzpJ2+deEiBODnn7W3QWKla3ceU1 GYV2/Na069BoOyrGstiOuC3wdYv0xUlIrPMg4kxEmnsRbUgLtVYe48rag7mxP2M5eB axYdBBMZ0oVU9NtoXi+62zLwYFuKGxqZImpznW8I8d5jaTR1tEElytVzvke4ayUNlA 9dx74E971/xKPOLa+6rI3klRMrHQPi5ClKFesOM0BwTJhHjvhdSfgE8FtssAe++72I tgEKi0ZB6SDtQ== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Arnd Bergmann , Richard Henderson , Matt Turner , Geert Uytterhoeven , Greg Ungerer , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Julian Vetter , Bjorn Helgaas , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org Subject: [PATCH 5/6] mips: drop GENERIC_IOMAP wrapper Date: Sat, 15 Mar 2025 11:59:06 +0100 Message-Id: <20250315105907.1275012-6-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250315105907.1275012-1-arnd@kernel.org> References: <20250315105907.1275012-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann All PIO on MIPS platforms is memory mapped, so there is no benefit in the lib/iomap.c wrappers that switch between inb/outb and readb/writeb style accessses. In fact, the '#define PIO_RESERVED 0' setting completely disables the GENERIC_IOMAP functionality, and the '#define PIO_OFFSET mips_io_port_base' setting is based on a misunderstanding of what the offset is meant to do. MIPS started using GENERIC_IOMAP in 2018 with commit b962aeb02205 ("MIPS: Use GENERIC_IOMAP") replacing a simple custom implementation of the same interfaces, but at the time the asm-generic/io.h version was not usable yet. Since the header is now always included, it's now possible to go back to the even simpler version. Use the normal GENERIC_PCI_IOMAP functionality for all mips platforms without the hacky GENERIC_IOMAP, and provide a custom pci_iounmap() for the CONFIG_PCI_DRIVERS_LEGACY case to ensure the I/O port base never gets unmapped. The readsl() prototype needs an extra 'const' keyword to make it compatible with the generic ioread32_rep() alias. Signed-off-by: Arnd Bergmann --- arch/mips/Kconfig | 2 +- arch/mips/include/asm/io.h | 21 ++++++++------------- arch/mips/lib/iomap-pci.c | 9 +++++++++ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 1924f2d83932..2a2120a6d852 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -38,7 +38,6 @@ config MIPS select GENERIC_CMOS_UPDATE select GENERIC_CPU_AUTOPROBE select GENERIC_GETTIMEOFDAY - select GENERIC_IOMAP select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW select GENERIC_ISA_DMA if EISA @@ -47,6 +46,7 @@ config MIPS select GENERIC_LIB_CMPDI2 select GENERIC_LIB_LSHRDI3 select GENERIC_LIB_UCMPDI2 + select GENERIC_PCI_IOMAP select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC select GENERIC_SMP_IDLE_THREAD select GENERIC_IDLE_POLL_SETUP diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 0bddb568af7c..1fe56d1870a6 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -66,17 +66,6 @@ static inline void set_io_port_base(unsigned long base) mips_io_port_base = base; } -/* - * Provide the necessary definitions for generic iomap. We make use of - * mips_io_port_base for iomap(), but we don't reserve any low addresses for - * use with I/O ports. - */ - -#define HAVE_ARCH_PIO_SIZE -#define PIO_OFFSET mips_io_port_base -#define PIO_MASK IO_SPACE_LIMIT -#define PIO_RESERVED 0x0UL - /* * Enforce in-order execution of data I/O. In the MIPS architecture * these are equivalent to corresponding platform-specific memory @@ -397,8 +386,8 @@ static inline void writes##bwlq(volatile void __iomem *mem, \ } \ } \ \ -static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \ - unsigned int count) \ +static inline void reads##bwlq(const volatile void __iomem *mem, \ + void *addr, unsigned int count) \ { \ volatile type *__addr = addr; \ \ @@ -555,6 +544,12 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size); void __ioread64_copy(void *to, const void __iomem *from, size_t count); +#ifdef CONFIG_PCI_DRIVERS_LEGACY +struct pci_dev; +void pci_iounmap(struct pci_dev *dev, void __iomem *addr); +#define pci_iounmap pci_iounmap +#endif + #include static inline void *isa_bus_to_virt(unsigned long address) diff --git a/arch/mips/lib/iomap-pci.c b/arch/mips/lib/iomap-pci.c index a9cb28813f0b..2f82c776c6d0 100644 --- a/arch/mips/lib/iomap-pci.c +++ b/arch/mips/lib/iomap-pci.c @@ -43,4 +43,13 @@ void __iomem *__pci_ioport_map(struct pci_dev *dev, return (void __iomem *) (ctrl->io_map_base + port); } +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + struct pci_controller *ctrl = dev->bus->sysdata; + void __iomem *base = (void __iomem *)ctrl->io_map_base; + + if (addr < base || addr > (base + resource_size(ctrl->io_resource))) + iounmap(addr); +} + #endif /* CONFIG_PCI_DRIVERS_LEGACY */ From patchwork Sat Mar 15 10:59:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 14017969 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8692F1F8AE5; Sat, 15 Mar 2025 10:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036388; cv=none; b=SwlXx3MUiAn+2OaPXAVGuDtT8r7i4VPHCgoSa7rCJvb6hxaLfu21Isv5Bo1u88/yfkNyVcJZv2cH8m5wdiN3pN/vPxGBF3VvDAfvCXXv8yWgp6LU8Y796GlzanOQcDTSeS2bLiMY6VJH9KmxlAtGzLb/7RLA5UP9MUgdEZ8qV7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742036388; c=relaxed/simple; bh=D1ohrsimuAws13B6dSJm4c6y+zLXLpUyAoEhItGWqLk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I6DBSVg5kDh5wyZOdGvTIitcz3DXyNxAvR7yQZnu2/wqGaG70vqbnlwRATvsGeugJNyQxkGb14HACFSiOmheLlxo06fLBacLYGFAMuw3lzYZ731iQU/I+VeEUeVUEIpeCYpJ4gPZjETr5e5usUIFrNgeCbaCoFukjr/nlbXAPtg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DNNhAbIc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DNNhAbIc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D88DC4CEEB; Sat, 15 Mar 2025 10:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742036388; bh=D1ohrsimuAws13B6dSJm4c6y+zLXLpUyAoEhItGWqLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNNhAbIcf8rr4eGgVdyHX/E4D7k+KscqVldr3+lldQwAq/jdglR4SphehjOkkIAfo 9MTwIzw6Z7O68YzXNinfAPSEpQJZ9wzcMof+k1SPnJ/7hFw6HtRWFJi1uTRy96dElT Yrn3toSD3j2xehdk6dinEZuvTCExMzPnp+nP9BfsYnK13ARddI0p7dvolMIAOxtoRp c3qisYBppYDADHR7fvA8+qJpI2/iweFvf6USys3kpwbK40VECL1kXsmdz6LVpJecQ5 JJy8sF2gcnadf9t6j3+n8Bo9nIq6Lmmec6msUk1Pt+0xre7BMklDXjYqi4id+5RyP6 qG4v1Q27bB3Og== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Arnd Bergmann , Richard Henderson , Matt Turner , Geert Uytterhoeven , Greg Ungerer , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Julian Vetter , Bjorn Helgaas , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org Subject: [PATCH 6/6] m68k/nommu: stop using GENERIC_IOMAP Date: Sat, 15 Mar 2025 11:59:07 +0100 Message-Id: <20250315105907.1275012-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250315105907.1275012-1-arnd@kernel.org> References: <20250315105907.1275012-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann There is no need to go through the GENERIC_IOMAP wrapper for PIO on nommu platforms, since these always come from PCI I/O space that is itself memory mapped. Instead, the generic ioport_map() can just return the MMIO location of the ports directly by applying the PCI_IO_PA offset, while ioread32/iowrite32 trivially turn into readl/writel as they do on most other architectures. Signed-off-by: Arnd Bergmann Reported-by: Greg Ungerer Signed-off-by: Arnd Bergmann Acked-by: Greg Ungerer --- arch/m68k/Kconfig | 2 +- arch/m68k/include/asm/io_no.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index b2ed0308c0ea..b50c275fa94d 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -18,7 +18,7 @@ config M68K select DMA_DIRECT_REMAP if M68K_NONCOHERENT_DMA && !COLDFIRE select GENERIC_ATOMIC64 select GENERIC_CPU_DEVICES - select GENERIC_IOMAP if HAS_IOPORT + select GENERIC_IOMAP if HAS_IOPORT && MMU select GENERIC_IRQ_SHOW select GENERIC_LIB_ASHLDI3 select GENERIC_LIB_ASHRDI3 diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h index 2c96e8480173..516371d5587a 100644 --- a/arch/m68k/include/asm/io_no.h +++ b/arch/m68k/include/asm/io_no.h @@ -123,10 +123,6 @@ static inline void writel(u32 value, volatile void __iomem *addr) #define PCI_IO_SIZE 0x00010000 /* 64k */ #define PCI_IO_MASK (PCI_IO_SIZE - 1) -#define HAVE_ARCH_PIO_SIZE -#define PIO_OFFSET 0 -#define PIO_MASK 0xffff -#define PIO_RESERVED 0x10000 #define PCI_IOBASE ((void __iomem *) PCI_IO_PA) #define PCI_SPACE_LIMIT PCI_IO_MASK #endif /* CONFIG_PCI */