From patchwork Thu Oct 31 00:31:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1187119 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 473RFv0ppxz9sCJ for ; Thu, 31 Oct 2019 11:36:19 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="P8q6ecGk"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 473RFt6l97zDrQJ for ; Thu, 31 Oct 2019 11:36:18 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rasmusvillemoes.dk (client-ip=2a00:1450:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=linux@rasmusvillemoes.dk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="P8q6ecGk"; dkim-atps=neutral Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 473R924pgjzF3wC for ; Thu, 31 Oct 2019 11:32:05 +1100 (AEDT) Received: by mail-wm1-x341.google.com with SMTP id q70so4069394wme.1 for ; Wed, 30 Oct 2019 17:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nviaR21RiU1nk2LZ5kFcjxEatw3WuqbBoBTo8fSflGU=; b=P8q6ecGkOH1cz6KavvYnvhkldy2tb8GnfywHDNOSmTJurUs0VpLx+KuDDNh7MPM44L 5e0MnvX5DsJLANeS+IemAzatJQb4T0LUS6sA2On5F0pFAuLI6/uos7sX+kGwmdNe2rhz ZoQU3hea1E0m/TW45ofs64T/Ul8kX5U8MdK/s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nviaR21RiU1nk2LZ5kFcjxEatw3WuqbBoBTo8fSflGU=; b=kiNtJDtRxUQeJPCOP06EYbki8F6Ix7xM1b5GmypQ4rW5XhT/B8uaTzKrZ2GsqgugQE QFq509mcT8Q9RClpCJS9irT/mm3ds8km5P1Uy8H3L1yIks38NsSM4v7bGKuLzDzeEbOr 497HadZWb0KFmU+LaMYkmL/cR+kvXhJOhvRd69xkjvA67F4bD4cZqb0ZSBxAw+TsqlcW +gHSmcC1Yo5hdLpi/v7P+hRfKt+QQ8tN0DxnQ9XoBHSiZzz3t7uBOwYxMY0qUp6DlFOL Mwlj1FtpAFYdWfJXmFHost/Qr99MH0Q5+68dbUHYEURgTZ2z6jLnQo7UQihNyVkijdrZ rZQg== X-Gm-Message-State: APjAAAWVB//PKBl0yXJA3i+5SS3hoB8upiAu/QOAtbUFGGguaBpva4LD 6HSbv4SLLeDgvKZ+nUJzRwoOYw== X-Google-Smtp-Source: APXvYqw3+GGNKPWfeYgL+Q1AJ6aouq9nqy+A5TiFT/Z3iyOgjPBzEBNst1ROKUpNxsiK1ff/4oXKsA== X-Received: by 2002:a1c:558a:: with SMTP id j132mr2103148wmb.21.1572481921871; Wed, 30 Oct 2019 17:32:01 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-115-54.cgn.fibianet.dk. [5.186.115.54]) by smtp.gmail.com with ESMTPSA id r13sm2357111wra.74.2019.10.30.17.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 17:32:01 -0700 (PDT) From: Rasmus Villemoes To: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 1/5] asm-generic: move pcu_iounmap from iomap.h to pci_iomap.h Date: Thu, 31 Oct 2019 01:31:50 +0100 Message-Id: <20191031003154.21969-2-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191031003154.21969-1-linux@rasmusvillemoes.dk> References: <20191031003154.21969-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Rasmus Villemoes , linux-kernel@vger.kernel.org, Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" pci_iounmap seems misplaced in iomap.h. Move it to where its cousins live. Since iomap.h includes pci_iomap.h, anybody relying on getting the declaration through iomap.h will still get it. It would be natural to put the static inline version inside the #elif defined(CONFIG_GENERIC_PCI_IOMAP) Since GENERIC_IOMAP selects GENERIC_PCI_IOMAP, that would be ok for those who select GENERIC_IOMAP. However, I fear there are some that select GENERIC_PCI_IOMAP without GENERIC_IOMAP, and which perhaps have their own pci_iounmap stub definition somewhere. So for now at least, define the static inline version under the same conditions as it were in iomap.h. Signed-off-by: Rasmus Villemoes --- include/asm-generic/iomap.h | 10 ---------- include/asm-generic/pci_iomap.h | 7 +++++++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index a008f504a2d0..5f8321e8fea9 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h @@ -101,16 +101,6 @@ extern void ioport_unmap(void __iomem *); #define ioremap_wt ioremap_nocache #endif -#ifdef CONFIG_PCI -/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ -struct pci_dev; -extern void pci_iounmap(struct pci_dev *dev, void __iomem *); -#elif defined(CONFIG_GENERIC_IOMAP) -struct pci_dev; -static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) -{ } -#endif - #include #endif diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h index d4f16dcc2ed7..c2f78db2420e 100644 --- a/include/asm-generic/pci_iomap.h +++ b/include/asm-generic/pci_iomap.h @@ -18,6 +18,8 @@ extern void __iomem *pci_iomap_range(struct pci_dev *dev, int bar, extern void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar, unsigned long offset, unsigned long maxlen); +/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ +extern void pci_iounmap(struct pci_dev *dev, void __iomem *); /* Create a virtual mapping cookie for a port on a given PCI device. * Do not call this directly, it exists to make it easier for architectures * to override */ @@ -52,4 +54,9 @@ static inline void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar, } #endif +#if !defined(CONFIG_PCI) && defined(CONFIG_GENERIC_IOMAP) +static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ } +#endif + #endif /* __ASM_GENERIC_IO_H */ From patchwork Thu Oct 31 00:31:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1187120 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 473RJM50nRz9sPj for ; Thu, 31 Oct 2019 11:38:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="NR2y36ZZ"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 473RJM24P1zF5FK for ; Thu, 31 Oct 2019 11:38:27 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rasmusvillemoes.dk (client-ip=2a00:1450:4864:20::344; helo=mail-wm1-x344.google.com; envelope-from=linux@rasmusvillemoes.dk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="NR2y36ZZ"; dkim-atps=neutral Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 473R9256QCzF3wK for ; Thu, 31 Oct 2019 11:32:05 +1100 (AEDT) Received: by mail-wm1-x344.google.com with SMTP id 22so4125077wms.3 for ; Wed, 30 Oct 2019 17:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DP8EUpBnJhrMMlR35AJ4qBuW5AAWrThlGdUysZgbcoM=; b=NR2y36ZZEfoJ5Txna6kcEQ7KMDEZfJ5uEOOUqUBeEw5/YOd91gpyFb21BmcEkeTPDL VYKz4WaVu+sf+6lxOOq1rkeXeFVj2T9AQ7Ov5PCc6o318lrWSxiqeem6ihBc1IHDaVdx +gEByoBqajrE0ByG/eUxCaJt70X6wt7p89/Yo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DP8EUpBnJhrMMlR35AJ4qBuW5AAWrThlGdUysZgbcoM=; b=o3pehkysZzJcveObS52/CfL8NSxvNgk/y0HQ8nsQY25OP81NpLdu8Za0J5UMgNitqD 9ew0Bc/j2pxhXjLPNDYgq/0xhxpBYkzXhdnTaEN5l8XlrNmjhpoXliUO3MEs4ls2UGds YMRVxzeqTXzFzoChqStPE0rFFXeKSXvTdP54sR5YKi8zQgay7Z5EwET/ucgxIzMgBtdJ javRhtx3byciilbLhh7HuXZguQZnSDlN5SUERyEiJP1kTPW2SyEPUiEA5aT/c7Jk/UI5 NhP0/bktCXipgZFRXXdDlhZMOVz5nJACbh/2vBwaapxf9mAYBC6PdWcHM7gUH6DoUT1E +qvg== X-Gm-Message-State: APjAAAXFv6dZ3+2I1V/7rAoi8hXbPWRc3cr3+Uh/ykd8H7dQNaNDyH7p iyE+7NGRcSWcrFKiGQt+r7Y8eQ== X-Google-Smtp-Source: APXvYqzxz++sN38GMY6qBbfTvoPZ3oZC6iyvGo/uRS0b9BlQq1tFkpv4AxeUqwoKyzUF2DucLQzJEw== X-Received: by 2002:a1c:f317:: with SMTP id q23mr1976912wmq.74.1572481922962; Wed, 30 Oct 2019 17:32:02 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-115-54.cgn.fibianet.dk. [5.186.115.54]) by smtp.gmail.com with ESMTPSA id r13sm2357111wra.74.2019.10.30.17.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 17:32:02 -0700 (PDT) From: Rasmus Villemoes To: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 2/5] asm-generic: employ "ifndef foo; define foo foo" idiom in iomap.h Date: Thu, 31 Oct 2019 01:31:51 +0100 Message-Id: <20191031003154.21969-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191031003154.21969-1-linux@rasmusvillemoes.dk> References: <20191031003154.21969-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Rasmus Villemoes , linux-kernel@vger.kernel.org, Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Make it possible for an architecture to include asm-generic/iomap.h without necessarily getting all the external declarations for iowrite32 and friends. For example, the architecture could (maybe just in some configurations) provide static inline versions of some or all of these, but still use asm-generic/iomap.h for the ARCH_HAS_IOREMAP_WT/WC logic. This will be used on powerpc. Signed-off-by: Rasmus Villemoes --- include/asm-generic/iomap.h | 94 ++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 6 deletions(-) diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index 5f8321e8fea9..1b247d3b9fbb 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h @@ -26,47 +26,105 @@ * in the low address range. Architectures for which this is not * true can't use this generic implementation. */ +#ifndef ioread8 +#define ioread8 ioread8 extern unsigned int ioread8(void __iomem *); +#endif +#ifndef ioread16 +#define ioread16 ioread16 extern unsigned int ioread16(void __iomem *); +#endif +#ifndef ioread16be +#define ioread16be ioread16be extern unsigned int ioread16be(void __iomem *); +#endif +#ifndef ioread32 +#define ioread32 ioread32 extern unsigned int ioread32(void __iomem *); +#endif +#ifndef ioread32be +#define ioread32be ioread32be extern unsigned int ioread32be(void __iomem *); +#endif #ifdef CONFIG_64BIT +#ifndef ioread64 +#define ioread64 ioread64 extern u64 ioread64(void __iomem *); +#endif +#ifndef ioread64be +#define ioread64be ioread64be extern u64 ioread64be(void __iomem *); #endif +#endif /* CONFIG_64BIT */ #ifdef readq +#ifndef ioread64_lo_hi #define ioread64_lo_hi ioread64_lo_hi -#define ioread64_hi_lo ioread64_hi_lo -#define ioread64be_lo_hi ioread64be_lo_hi -#define ioread64be_hi_lo ioread64be_hi_lo extern u64 ioread64_lo_hi(void __iomem *addr); +#endif +#ifndef ioread64_hi_lo +#define ioread64_hi_lo ioread64_hi_lo extern u64 ioread64_hi_lo(void __iomem *addr); +#endif +#ifndef ioread64be_lo_hi +#define ioread64be_lo_hi ioread64be_lo_hi extern u64 ioread64be_lo_hi(void __iomem *addr); +#endif +#ifndef ioread64be_hi_lo +#define ioread64be_hi_lo ioread64be_hi_lo extern u64 ioread64be_hi_lo(void __iomem *addr); #endif +#endif /* readq */ +#ifndef iowrite8 +#define iowrite8 iowrite8 extern void iowrite8(u8, void __iomem *); +#endif +#ifndef iowrite16 +#define iowrite16 iowrite16 extern void iowrite16(u16, void __iomem *); +#endif +#ifndef iowrite16be +#define iowrite16be iowrite16be extern void iowrite16be(u16, void __iomem *); +#endif +#ifndef iowrite32 +#define iowrite32 iowrite32 extern void iowrite32(u32, void __iomem *); +#endif +#ifndef iowrite32be +#define iowrite32be iowrite32be extern void iowrite32be(u32, void __iomem *); +#endif #ifdef CONFIG_64BIT +#ifndef iowrite64 +#define iowrite64 iowrite64 extern void iowrite64(u64, void __iomem *); +#endif +#ifndef iowrite64be +#define iowrite64be iowrite64be extern void iowrite64be(u64, void __iomem *); #endif +#endif /* CONFIG_64BIT */ #ifdef writeq +#ifndef iowrite64_lo_hi #define iowrite64_lo_hi iowrite64_lo_hi -#define iowrite64_hi_lo iowrite64_hi_lo -#define iowrite64be_lo_hi iowrite64be_lo_hi -#define iowrite64be_hi_lo iowrite64be_hi_lo extern void iowrite64_lo_hi(u64 val, void __iomem *addr); +#endif +#ifndef iowrite64_hi_lo +#define iowrite64_hi_lo iowrite64_hi_lo extern void iowrite64_hi_lo(u64 val, void __iomem *addr); +#endif +#ifndef iowrite64be_lo_hi +#define iowrite64be_lo_hi iowrite64be_lo_hi extern void iowrite64be_lo_hi(u64 val, void __iomem *addr); +#endif +#ifndef iowrite64be_hi_lo +#define iowrite64be_hi_lo iowrite64be_hi_lo extern void iowrite64be_hi_lo(u64 val, void __iomem *addr); #endif +#endif /* writeq */ /* * "string" versions of the above. Note that they @@ -79,19 +137,43 @@ extern void iowrite64be_hi_lo(u64 val, void __iomem *addr); * memory across multiple ports, use "memcpy_toio()" * and friends. */ +#ifndef ioread8_rep +#define ioread8_rep ioread8_rep extern void ioread8_rep(void __iomem *port, void *buf, unsigned long count); +#endif +#ifndef ioread16_rep +#define ioread16_rep ioread16_rep extern void ioread16_rep(void __iomem *port, void *buf, unsigned long count); +#endif +#ifndef ioread32_rep +#define ioread32_rep ioread32_rep extern void ioread32_rep(void __iomem *port, void *buf, unsigned long count); +#endif +#ifndef iowrite8_rep +#define iowrite8_rep iowrite8_rep extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); +#endif +#ifndef iowrite16_rep +#define iowrite16_rep iowrite16_rep extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); +#endif +#ifndef iowrite32_rep +#define iowrite32_rep iowrite32_rep extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); +#endif #ifdef CONFIG_HAS_IOPORT_MAP /* Create a virtual mapping cookie for an IO port range */ +#ifndef ioport_map +#define ioport_map ioport_map extern void __iomem *ioport_map(unsigned long port, unsigned int nr); +#endif +#ifndef ioport_unmap +#define ioport_unmap ioport_unmap extern void ioport_unmap(void __iomem *); #endif +#endif /* CONFIG_HAS_IOPORT_MAP */ #ifndef ARCH_HAS_IOREMAP_WC #define ioremap_wc ioremap_nocache From patchwork Thu Oct 31 00:31:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1187118 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 473RCV2b1Tz9sPj for ; Thu, 31 Oct 2019 11:34:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="Xo2jF187"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 473RCV1NrPzF5Dp for ; Thu, 31 Oct 2019 11:34:14 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rasmusvillemoes.dk (client-ip=2a00:1450:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=linux@rasmusvillemoes.dk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="Xo2jF187"; dkim-atps=neutral Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 473R925TVhzF3wk for ; Thu, 31 Oct 2019 11:32:06 +1100 (AEDT) Received: by mail-wm1-x341.google.com with SMTP id c22so4122061wmd.1 for ; Wed, 30 Oct 2019 17:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DYhACg+zO53SUeLC5iAmeJtmmamitSVr5JjCgBatEmk=; b=Xo2jF187UE1MGGGjZ8wN0vNAH7wPPEVfI4ZvaURxYjN1pWSFx+8HdyvTcP3FzTn987 08YzzHq6OGkCXz6Im4EZfJbwBJNjKtnt3kBbs0JwsG41sI9SdnEErK9HVKIuV5ytBAAd jnU/gdaLBryLQcmiUDOmHH8SzYQxepk523nE0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DYhACg+zO53SUeLC5iAmeJtmmamitSVr5JjCgBatEmk=; b=GLcU9ezwB6WH4LTXHCERb0FjfgnfeleO563I8kGzX9QggatWs7UpxmpikuZTh702/Y Jr78uoT6hFcGwZD/u/weV/WXOLCL5hYtq+0DKT0Alcz5JRJvOQVTJzErxhDPi4SxTiR7 vy3E202KYd+hD1UZY2QzdSXDVz2rpUqAcxebfW4G07zPe5ot4MMZBftz1A7qU4GjIOkm 3qkx3FL37igm+I6Xwa6kiB7NcPI1aha1BAZKYOzohQNpaYfsXpz97rw0MRkhHEooqzLS hcekSfbSqLgJUVsEjaJHkxIFDBqJxftB5uoesYi1JuVn0RkN3OqSm7PrU66+GKAfBIah mtLg== X-Gm-Message-State: APjAAAUrXU/3hFpuVjKYVu4vthqu8Akt7c57tgtpGbSJRhP59k/ywb3/ 6VAvU6ZaipywQUGealuw2KXjYg== X-Google-Smtp-Source: APXvYqwpa/vkgm/Kk2t0MioAGkOHz3mAV7KnDHWGDzc5LpYTw6AEGiA6IRzxyLwSWzDsy21QG8gMPw== X-Received: by 2002:a05:600c:cd:: with SMTP id u13mr2099609wmm.133.1572481923964; Wed, 30 Oct 2019 17:32:03 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-115-54.cgn.fibianet.dk. [5.186.115.54]) by smtp.gmail.com with ESMTPSA id r13sm2357111wra.74.2019.10.30.17.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 17:32:03 -0700 (PDT) From: Rasmus Villemoes To: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 3/5] powerpc: move pci_iounmap() from iomap.c to pci-common.c Date: Thu, 31 Oct 2019 01:31:52 +0100 Message-Id: <20191031003154.21969-4-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191031003154.21969-1-linux@rasmusvillemoes.dk> References: <20191031003154.21969-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Rasmus Villemoes , linux-kernel@vger.kernel.org, Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" As preparation for making iowrite32 and friends static inlines, move the definition of pci_iounmap() from iomap.c to pci-common.c. This definition of pci_iounmap() is compiled in when !CONFIG_PPC_INDIRECT_PIO && CONFIG_PCI - we're just interchanging which condition is in the Kbuild logic and which is in the .c file. Signed-off-by: Rasmus Villemoes --- arch/powerpc/kernel/iomap.c | 13 ------------- arch/powerpc/kernel/pci-common.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c index 5ac84efc6ede..b22fa8db5068 100644 --- a/arch/powerpc/kernel/iomap.c +++ b/arch/powerpc/kernel/iomap.c @@ -182,16 +182,3 @@ void ioport_unmap(void __iomem *addr) } EXPORT_SYMBOL(ioport_map); EXPORT_SYMBOL(ioport_unmap); - -#ifdef CONFIG_PCI -void pci_iounmap(struct pci_dev *dev, void __iomem *addr) -{ - if (isa_vaddr_is_ioport(addr)) - return; - if (pcibios_vaddr_is_ioport(addr)) - return; - iounmap(addr); -} - -EXPORT_SYMBOL(pci_iounmap); -#endif /* CONFIG_PCI */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 1c448cf25506..d89a2426b405 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -295,6 +296,18 @@ int pcibios_vaddr_is_ioport(void __iomem *address) return ret; } +#ifndef CONFIG_PPC_INDIRECT_PIO +void pci_iounmap(struct pci_dev *dev, void __iomem *addr) +{ + if (isa_vaddr_is_ioport(addr)) + return; + if (pcibios_vaddr_is_ioport(addr)) + return; + iounmap(addr); +} +EXPORT_SYMBOL(pci_iounmap); +#endif /* CONFIG_PPC_INDIRECT_PIO */ + unsigned long pci_address_to_pio(phys_addr_t address) { struct pci_controller *hose; From patchwork Thu Oct 31 00:31:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1187122 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 473RPW4g83z9sPj for ; Thu, 31 Oct 2019 11:42:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="Dn8/QAVb"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 473RPW0VhRzF562 for ; Thu, 31 Oct 2019 11:42:55 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rasmusvillemoes.dk (client-ip=2a00:1450:4864:20::342; helo=mail-wm1-x342.google.com; envelope-from=linux@rasmusvillemoes.dk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="Dn8/QAVb"; dkim-atps=neutral Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 473R942q0YzF3xJ for ; Thu, 31 Oct 2019 11:32:08 +1100 (AEDT) Received: by mail-wm1-x342.google.com with SMTP id p21so4068462wmg.2 for ; Wed, 30 Oct 2019 17:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tDHh+OVXKEM0h+uKC7EIERstcizYBjZxP2HUDdfEVt8=; b=Dn8/QAVbq0JfM6dbr7uT/LDSjMsuYs4CxFf+CS82fAkPePNSAGzb5Y0MnIf2ipZiHx POfZhnEE3UHOkJ9d/P4volBMryXP1/aujGfSYCD7vqeNMrU++oR+psgTkC/v689cAwcu FJP2RLuVzWiYM8UlzeEvwu9SX0Et8qvWQXB88= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tDHh+OVXKEM0h+uKC7EIERstcizYBjZxP2HUDdfEVt8=; b=TnoRPSb2OIzHBJ3yw9lPNwMPQXUDyD3+6DRJu6G5qI0OUIBxOCIZ8XWGV3UcpaoTVT /D/R2Ck5lV7/hw9wbUGV9dcyEohsgpOrwNptMNV9O0lpgSpNBIEl7eaZI3lRcsbig9cr Uhiqa9fdiyw/kKS2/082NujJEn9dL4CpuBIOMkzPsHFfQqK6gMDwICB/YZuj8bcFMam+ e9GoSnxWjoFo+80tGOQLwtDmQnYqUqmWYW0gQXuQ81K16QBDQ3lEWI4tx8XqYGefmbG8 fg5RIcn4MAF2AqruSp1uDIzOJCnxEiHgs/Ku3zE6ThEhHcHK0jbTfeTjTv9B7ZU4Y8Ql 12Zg== X-Gm-Message-State: APjAAAV5/ILeqpfsKmYyrmY8e6+ZbuLVwvFAOgNg+ShpoAQJwfpNeyJ3 K51S7ssao1wXZkuLdEN0ADygiA== X-Google-Smtp-Source: APXvYqz3VwKmyFrg0snFjZE++GwOdD4oDrvjFS6yyK5iarkJGuhLRfN5MmMf7SAZIOqcSO0W8SJCNw== X-Received: by 2002:a7b:c01a:: with SMTP id c26mr2165585wmb.45.1572481924905; Wed, 30 Oct 2019 17:32:04 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-115-54.cgn.fibianet.dk. [5.186.115.54]) by smtp.gmail.com with ESMTPSA id r13sm2357111wra.74.2019.10.30.17.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 17:32:04 -0700 (PDT) From: Rasmus Villemoes To: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 4/5] powerpc: make pcibios_vaddr_is_ioport() static Date: Thu, 31 Oct 2019 01:31:53 +0100 Message-Id: <20191031003154.21969-5-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191031003154.21969-1-linux@rasmusvillemoes.dk> References: <20191031003154.21969-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Rasmus Villemoes , linux-kernel@vger.kernel.org, Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The only caller of pcibios_vaddr_is_ioport() is in pci-common.c, so we can make it static and move it into the same #ifndef block as its caller. Signed-off-by: Rasmus Villemoes --- arch/powerpc/include/asm/pci-bridge.h | 9 --------- arch/powerpc/kernel/pci-common.c | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index ea6ec65970ef..deb29a1c9708 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -283,14 +283,5 @@ extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev); extern void pcibios_free_controller(struct pci_controller *phb); extern void pcibios_free_controller_deferred(struct pci_host_bridge *bridge); -#ifdef CONFIG_PCI -extern int pcibios_vaddr_is_ioport(void __iomem *address); -#else -static inline int pcibios_vaddr_is_ioport(void __iomem *address) -{ - return 0; -} -#endif /* CONFIG_PCI */ - #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index d89a2426b405..928d7576c6c2 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -277,7 +277,8 @@ static resource_size_t pcibios_io_size(const struct pci_controller *hose) #endif } -int pcibios_vaddr_is_ioport(void __iomem *address) +#ifndef CONFIG_PPC_INDIRECT_PIO +static int pcibios_vaddr_is_ioport(void __iomem *address) { int ret = 0; struct pci_controller *hose; @@ -296,7 +297,6 @@ int pcibios_vaddr_is_ioport(void __iomem *address) return ret; } -#ifndef CONFIG_PPC_INDIRECT_PIO void pci_iounmap(struct pci_dev *dev, void __iomem *addr) { if (isa_vaddr_is_ioport(addr)) From patchwork Thu Oct 31 00:31:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1187123 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 473RRj3lHrz9sPj for ; Thu, 31 Oct 2019 11:44:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="dSAbWiy1"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 473RRj248QzF5Hh for ; Thu, 31 Oct 2019 11:44:49 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rasmusvillemoes.dk (client-ip=2a00:1450:4864:20::444; helo=mail-wr1-x444.google.com; envelope-from=linux@rasmusvillemoes.dk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="dSAbWiy1"; dkim-atps=neutral Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 473R952s8fzF3y1 for ; Thu, 31 Oct 2019 11:32:09 +1100 (AEDT) Received: by mail-wr1-x444.google.com with SMTP id e6so2503224wrw.1 for ; Wed, 30 Oct 2019 17:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YGjLcdx9KXKhg9YECWTpZ9bCIGLdak4UGDzKAXAAeDM=; b=dSAbWiy17OZMli/VazTnjYLhJ/fBH4XviqbTVhDYKWDZTRAbfb5lfbbwzHTia3qwyX SaCCsfFF5LMCBCXV1wkM4COyJ97bWFwoUrVXsDrqTPiM4PW4a4uqUepJ0JmXeJcGK4qH Ab0vWhCeoL9vXwoVAOl/ZHoSAWRg+U+jWoy5I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YGjLcdx9KXKhg9YECWTpZ9bCIGLdak4UGDzKAXAAeDM=; b=pBG0xov+Ra21l1z7cGZHIyfO0K9IOjHBpAmJvwmgYro1iJdrekW5j/9/gxT7oLGAGr Mvt93YFJQa6/z4PIy1bI3kAFkD/PKta6Q0PUlYfdTXrZ/kIiTJYyApToFUTT+uZdD4Te DOtaScx8EuiFjyUmMzTKXqQeBX8vIdMw+ZPZe1XvoohmMZx7lvYd3+9CCR/syiiiVsha iTHmJBc2izqqAHOusUTdc3AGJaUS+fvvd6gzwPmWFlDHVP17N5WJrZUoqssOYM2rCZLu qh2JRv8hqnDfYL5Ue4wI6xsLCuAPQFIAgArAhF5+vcxb5njTcFBbW04F6v+2auCWjrrO 76LQ== X-Gm-Message-State: APjAAAWF13X5yXbT2CE2egMkvIxy+liYmyS0xQ3rpYcaxzzdize7aYiZ NsfGd1MHOciabZlkqAtfHGDSCA== X-Google-Smtp-Source: APXvYqwVUehvwoFgGnD9cecxRxGad/kVRBBgTLONSUGtsGz+C8YNoj+GJyg21DvBYXFJy2LNkBhEjQ== X-Received: by 2002:adf:ea01:: with SMTP id q1mr2437079wrm.240.1572481925942; Wed, 30 Oct 2019 17:32:05 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-115-54.cgn.fibianet.dk. [5.186.115.54]) by smtp.gmail.com with ESMTPSA id r13sm2357111wra.74.2019.10.30.17.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 17:32:05 -0700 (PDT) From: Rasmus Villemoes To: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 5/5] powerpc: make iowrite32 and friends static inline when no indirection Date: Thu, 31 Oct 2019 01:31:54 +0100 Message-Id: <20191031003154.21969-6-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191031003154.21969-1-linux@rasmusvillemoes.dk> References: <20191031003154.21969-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Rasmus Villemoes , linux-kernel@vger.kernel.org, Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When porting a powerpc-only driver to work on another architecture, one has to change e.g. out_be32 to iowrite32be. Unfortunately, while the other target architecture (in my case arm) may have static inline definitions of iowrite32 and friends, this change pessimizes the existing powerpc users of that driver since out_be32() is inline while iowrite32be() is out-of-line. When neither CONFIG_PPC_INDIRECT_PIO or CONFIG_PPC_INDIRECT_MMIO are set (e.g. all of PPC32), there's no reason for those to be out-of-line as they compile to just two or three instructions. So copy the definitions from iomap.c into io.h, make them static inline, and add the self-define macro boilerplate to prevent asm-generic/iomap.h from providing extern declarations. This means that kernel/iomap.c is now only compiled when !CONFIG_PPC_INDIRECT_PIO && CONFIG_PPC_INDIRECT_MMIO - a combination I don't think currently exists. So it's possible that file could simply be deleted. Signed-off-by: Rasmus Villemoes --- arch/powerpc/include/asm/io.h | 172 ++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/Makefile | 2 +- 2 files changed, 173 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index a63ec938636d..a59310620067 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -638,6 +638,178 @@ static inline void name at \ #define writel_relaxed(v, addr) writel(v, addr) #define writeq_relaxed(v, addr) writeq(v, addr) +#if !defined(CONFIG_PPC_INDIRECT_PIO) && !defined(CONFIG_PPC_INDIRECT_MMIO) + +#define ioread8 ioread8 +static inline unsigned int ioread8(void __iomem *addr) +{ + return readb(addr); +} +#define ioread16 ioread16 +static inline unsigned int ioread16(void __iomem *addr) +{ + return readw(addr); +} +#define ioread16be ioread16be +static inline unsigned int ioread16be(void __iomem *addr) +{ + return readw_be(addr); +} +#define ioread32 ioread32 +static inline unsigned int ioread32(void __iomem *addr) +{ + return readl(addr); +} +#define ioread32be ioread32be +static inline unsigned int ioread32be(void __iomem *addr) +{ + return readl_be(addr); +} +#ifdef __powerpc64__ +#define ioread64 ioread64 +static inline u64 ioread64(void __iomem *addr) +{ + return readq(addr); +} +#define ioread64_lo_hi ioread64_lo_hi +static inline u64 ioread64_lo_hi(void __iomem *addr) +{ + return readq(addr); +} +#define ioread64_hi_lo ioread64_hi_lo +static inline u64 ioread64_hi_lo(void __iomem *addr) +{ + return readq(addr); +} +#define ioread64be ioread64be +static inline u64 ioread64be(void __iomem *addr) +{ + return readq_be(addr); +} +#define ioread64be_lo_hi ioread64be_lo_hi +static inline u64 ioread64be_lo_hi(void __iomem *addr) +{ + return readq_be(addr); +} +#define ioread64be_hi_lo ioread64be_hi_lo +static inline u64 ioread64be_hi_lo(void __iomem *addr) +{ + return readq_be(addr); +} +#endif /* __powerpc64__ */ + +#define iowrite8 iowrite8 +static inline void iowrite8(u8 val, void __iomem *addr) +{ + writeb(val, addr); +} +#define iowrite16 iowrite16 +static inline void iowrite16(u16 val, void __iomem *addr) +{ + writew(val, addr); +} +#define iowrite16be iowrite16be +static inline void iowrite16be(u16 val, void __iomem *addr) +{ + writew_be(val, addr); +} +#define iowrite32 iowrite32 +static inline void iowrite32(u32 val, void __iomem *addr) +{ + writel(val, addr); +} +#define iowrite32be iowrite32be +static inline void iowrite32be(u32 val, void __iomem *addr) +{ + writel_be(val, addr); +} +#ifdef __powerpc64__ +#define iowrite64 iowrite64 +static inline void iowrite64(u64 val, void __iomem *addr) +{ + writeq(val, addr); +} +#define iowrite64_lo_hi iowrite64_lo_hi +static inline void iowrite64_lo_hi(u64 val, void __iomem *addr) +{ + writeq(val, addr); +} +#define iowrite64_hi_lo iowrite64_hi_lo +static inline void iowrite64_hi_lo(u64 val, void __iomem *addr) +{ + writeq(val, addr); +} +#define iowrite64be iowrite64be +static inline void iowrite64be(u64 val, void __iomem *addr) +{ + writeq_be(val, addr); +} +#define iowrite64be_lo_hi iowrite64be_lo_hi +static inline void iowrite64be_lo_hi(u64 val, void __iomem *addr) +{ + writeq_be(val, addr); +} +#define iowrite64be_hi_lo iowrite64be_hi_lo +static inline void iowrite64be_hi_lo(u64 val, void __iomem *addr) +{ + writeq_be(val, addr); +} +#endif /* __powerpc64__ */ + +/* + * These are the "repeat read/write" functions. Note the + * non-CPU byte order. We do things in "IO byteorder" + * here. + * + * FIXME! We could make these do EEH handling if we really + * wanted. Not clear if we do. + */ +#define ioread8_rep ioread8_rep +static inline void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) +{ + readsb(addr, dst, count); +} +#define ioread16_rep ioread16_rep +static inline void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) +{ + readsw(addr, dst, count); +} +#define ioread32_rep ioread32_rep +static inline void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) +{ + readsl(addr, dst, count); +} + +#define iowrite8_rep iowrite8_rep +static inline void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) +{ + writesb(addr, src, count); +} +#define iowrite16_rep iowrite16_rep +static inline void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) +{ + writesw(addr, src, count); +} +#define iowrite32_rep iowrite32_rep +static inline void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) +{ + writesl(addr, src, count); +} + +#define ioport_map ioport_map +static inline void __iomem *ioport_map(unsigned long port, unsigned int len) +{ + return (void __iomem *) (port + _IO_BASE); +} + +#define ioport_unmap ioport_unmap +static inline void ioport_unmap(void __iomem *addr) +{ + /* Nothing to do */ +} + +#endif /* !defined(CONFIG_PPC_INDIRECT_PIO) && !defined(CONFIG_PPC_INDIRECT_MMIO) */ + #include static inline void iosync(void) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index a7ca8fe62368..0991b3cd007b 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -143,7 +143,7 @@ obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o obj-y += trace/ ifneq ($(CONFIG_PPC_INDIRECT_PIO),y) -obj-y += iomap.o +obj-$(CONFIG_PPC_INDIRECT_MMIO) += iomap.o endif obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o