From patchwork Wed Nov 24 15:41:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693548 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD6E3C433EF for ; Wed, 24 Nov 2021 15:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xLlvuHDOdqBae+aDOqqBzXzFAdYEtwtVIgArAj4KRcs=; b=yr+5QLa1xJn6gi iPxuDCcOOrl/D4XhDAufwJgues7RaT9w8rS4CBbQYW80WkFUHt7DliGp2xIjywnLyohVeLVn2spDP 1jNPBuvFM7c+qrE0yqkOwqY9X0B1+nS1eyGv85R8t9J69I3DgNtnA5UcAXEpLoA3HwD68C0ihnGnt y6lQACrc8R56XM8j5KD3ydJ5r5gZKNah3AvZwvJSdj8HTP74fKUigmByROZeMF6GRTb8CImG/HrVY 7lIK/FDpqNOOixDcRhALb8Qf98iKJM9kkgnO122A5Ts0hfILpO4cjgmXQ21iQMkVnmg1OY3Xg93HU RCp0atK7LXel7VjAHAng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuPK-0057EV-18; Wed, 24 Nov 2021 15:42:02 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuP5-00578m-8J for linux-arm-kernel@lists.infradead.org; Wed, 24 Nov 2021 15:41:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6EDF60FD9; Wed, 24 Nov 2021 15:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637768506; bh=dWjAjYTv1UJNuz4DlD4z4Q3QWuFZ2bz6r9JNBl8Oe8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CJEc/g9s3M1t31hg6BTMpM9Qih98I29UPN+TCro87IWeQRjQHPkQatmiMwEk52okt QzBxwgD2jpwaDrH1I31gmMkKhRVi0dOO8aXbWFCxLPcTto9Q7LyOxj/lqJwNbtEdLp m/ftjBpEWPyXbwKv3u3OA25epyy/ULuTzgTRy22NlNKLh+LCAuh+LRb85llZWy72Pe u2pWSfGw5PBM6wzyuXXj1A5uLR9nzezKBIgYuhvRKyYntur0abMORJFaOnHRv3iluy uCfcUDi2KBKNLim/6zQ4OMxCS43jo0BUH+m+PPRBOMX5cGrkFO08Scp1TGo5lK5lKv H2Ha90ndMggEw== Received: by pali.im (Postfix) id EB6E5AFB; Wed, 24 Nov 2021 16:41:44 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Dominik Brodowski , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , =?utf-8?q?Marek_Beh?= =?utf-8?q?=C3=BAn?= Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] arm: ioremap: Implement standard PCI function pci_remap_iospace() Date: Wed, 24 Nov 2021 16:41:12 +0100 Message-Id: <20211124154116.916-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211124154116.916-1-pali@kernel.org> References: <20211124154116.916-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211124_074147_357100_07A49A5E X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org pci_remap_iospace() is standard PCI core function. Architecture code can reimplement default core implementation if needs custom arch specific functionality. ARM needs custom implementation due to pci_ioremap_set_mem_type() hook which allows ARM platforms to change mem type for iospace. Implement this pci_remap_iospace() function for ARM architecture to correctly handle pci_ioremap_set_mem_type() hook, which allows usage of this standard PCI core function also for platforms which needs different mem type (e.g. Marvell Armada 375, 38x and 39x). Signed-off-by: Pali Rohár Reviewed-by: Russell King (Oracle) --- arch/arm/include/asm/io.h | 5 +++++ arch/arm/mm/ioremap.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index c576fa7d9bf8..12eca75bdee9 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -182,6 +182,11 @@ static inline void pci_ioremap_set_mem_type(int mem_type) {} extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr); +struct resource; + +#define pci_remap_iospace pci_remap_iospace +int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr); + /* * PCI configuration space mapping function. * diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index 6e830b9418c9..fa3bde48d6a7 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -459,6 +459,21 @@ void pci_ioremap_set_mem_type(int mem_type) pci_ioremap_mem_type = mem_type; } +int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr) +{ + unsigned long vaddr = (unsigned long)PCI_IOBASE + res->start; + + if (!(res->flags & IORESOURCE_IO)) + return -EINVAL; + + if (res->end > IO_SPACE_LIMIT) + return -EINVAL; + + return ioremap_page_range(vaddr, vaddr + resource_size(res), phys_addr, + __pgprot(get_mem_type(pci_ioremap_mem_type)->prot_pte)); +} +EXPORT_SYMBOL(pci_remap_iospace); + int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr) { BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT); From patchwork Wed Nov 24 15:41:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693550 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3760FC433EF for ; Wed, 24 Nov 2021 15:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GxgV2BtJonjXOvYvyzc3ri9vrX+K8uzx3hyhobPQm3E=; b=NTkHASniZ3hBBX NI6p0fUb0y+dGrfBwepWZ/l7USA2Tr4GlbPK+vMnKcICYr7U7+foSCgT+niYogvbt3stL9rO5jFAy oL52iyweSnC+VXJqYRzXsJEI8wAp6AH7cIP9K0qTic+Z5TIR2u9H0xbMga3pP6I3o2+ybTBKQpcEu n8wLkscLBx5skYSCg3hZ+o9ylzB/UrJHx0x9jfCIH+lLlPtthXlpmlEmG0BrpscdCV0RK0B8WHzzN 5G7+nl0WeXjUTUiZw2/eZ7nCbVu9gSSPMAp9gnjvkrGjDnRRY0TntoRQWtvz3xHB7o29zsSn8jV5d riQr2eXRVtpyEBGAz4Lw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuPi-0057Ko-N9; Wed, 24 Nov 2021 15:42:26 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuP6-00579M-Dd for linux-arm-kernel@lists.infradead.org; Wed, 24 Nov 2021 15:41:49 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0CBC6102A; Wed, 24 Nov 2021 15:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637768508; bh=B4KwqLhItoYGnyJ9ogfHgJBcg/G5wxI+LrCO4toFBSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=smfTHi3C0BGbB+Tqh/ucp+n9eBQJakBTr/g9WyHJT4bHTI+7e7kmHjwDrL3dkZibA kvBCQ7h/VfXzR1L/Fjlb2468A7ADDlt+xz/jAqCG39yQpcgRjJiKBlcyDh0UjjfJ7b 5NcW/WxA1AYwYrsO3rqW6OmI2Dsa2a/gVgDjK6KNl6spgubhlZP1TpbF+Ugp3tInxg Ntw+g+mzL/TD9tqwHddURa2qHoValYWcRNdInuqPKPhWt6o+6g+Z/8dJE8vnerrXXr YYrRnmdMLMOBI2bpC1Yx4fnhqoAph1qPZs9Q4qqT0t9C5GmSuVPWBAAXx2ZYY7R1g4 pt2bs24uzZmDA== Received: by pali.im (Postfix) id 177ECB01; Wed, 24 Nov 2021 16:41:46 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Dominik Brodowski , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , =?utf-8?q?Marek_Beh?= =?utf-8?q?=C3=BAn?= Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] PCI: mvebu: Replace pci_ioremap_io() usage by devm_pci_remap_iospace() Date: Wed, 24 Nov 2021 16:41:13 +0100 Message-Id: <20211124154116.916-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211124154116.916-1-pali@kernel.org> References: <20211124154116.916-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211124_074148_500618_2F7ABDA0 X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now when ARM architecture code also provides standard PCI core function pci_remap_iospace(), use its devm_pci_remap_iospace() variant in pci-mvebu.c driver instead of old ARM-specific pci_ioremap_io() function. Call devm_pci_remap_iospace() before adding IO resource to host bridge structure, at the place where it should be. Signed-off-by: Pali Rohár --- drivers/pci/controller/pci-mvebu.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index ed13e81cd691..a55b8bd5eb62 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -992,6 +992,10 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) resource_size(&pcie->io) - 1); pcie->realio.name = "PCI I/O"; + ret = devm_pci_remap_iospace(dev, &pcie->realio, pcie->io.start); + if (ret) + return ret; + pci_add_resource(&bridge->windows, &pcie->realio); ret = devm_request_resource(dev, &ioport_resource, &pcie->realio); if (ret) @@ -1010,7 +1014,6 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) */ static int mvebu_pci_host_probe(struct pci_host_bridge *bridge) { - struct mvebu_pcie *pcie; struct pci_bus *bus, *child; int ret; @@ -1020,14 +1023,6 @@ static int mvebu_pci_host_probe(struct pci_host_bridge *bridge) return ret; } - pcie = pci_host_bridge_priv(bridge); - if (resource_size(&pcie->io) != 0) { - unsigned int i; - - for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K) - pci_ioremap_io(i, pcie->io.start + i); - } - bus = bridge->bus; /* From patchwork Wed Nov 24 15:41:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693549 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C1DEC433F5 for ; Wed, 24 Nov 2021 15:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6sPuF4rkAozZTJEbycTNR2MGaXsoYun+ksnA1Ymwx2M=; b=2hWVxQp6MG4Czi l58GfdKXzDMcg/CP6aCw+UCcjsC3ER3WPKSa83lknt0wFYlwpBsllF+4FpK+ZTi65Qq2XKpU+u4/Z VT73W0w3fCnd3RCNJSD1KxvZhuWwEO1xDpkgr0jn4fgWfFhaITOpCaLzLN3/4gPvsKOccuZLvFJEM 4nliSAILCJ3BPgBUByRNIjG15OhM3oxmqAV3uNVqa/y4uMleFWIxgKYJ5ah7tPf4AWjAdpmo1o5A1 UdTA8m+MbLwMeb69aX2CteRrF2uvoKJfkokUj2YwXqj7ODDktj72ciMVbtN5J0rxUwrxDhogdZgb6 qmigSLMGwOQBlMBuN1fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuPV-0057Hd-UB; Wed, 24 Nov 2021 15:42:14 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuP5-005792-TB for linux-arm-kernel@lists.infradead.org; Wed, 24 Nov 2021 15:41:49 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6934160FE3; Wed, 24 Nov 2021 15:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637768507; bh=6tDf7XJQIJvtSbp9viQfuVz7wDd2WfE7mXusR8/VED8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pvhol1Ht81T34h17oByeGlEXxfM2tonYSzmIX43HESR6gMDHEIckCw4JaBtcvazJe elCaAg+GzntUtRo4XYbAqLgKE+rfDQWd6I7TkB1OdNM47rsIWK4Bzqr2Te5h80NtTv PN66gaFwWvKCOsWciD5cxa8asipHRnIeqco+vYaMMKo3Vr0sGiYPVWWlxYDGBK6EZx sAuS+otIAJB4VHm9bx1/gBy8z4ojFDLn84+Lfo5d/xivt8r3mkx8uGROlJHBKK7c5O 1aq292rOQYMeW7s0H0J/AlN+h9tqEtcOEhUluhti0ZcCC4PMcBFm6403VjgKQw1DLp GAf6ee1a1IooQ== Received: by pali.im (Postfix) id 28DAD56D; Wed, 24 Nov 2021 16:41:47 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Dominik Brodowski , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , =?utf-8?q?Marek_Beh?= =?utf-8?q?=C3=BAn?= Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] PCI: mvebu: Remove custom mvebu_pci_host_probe() function Date: Wed, 24 Nov 2021 16:41:14 +0100 Message-Id: <20211124154116.916-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211124154116.916-1-pali@kernel.org> References: <20211124154116.916-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211124_074148_006056_0FD62818 X-CRM114-Status: GOOD ( 15.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now after pci_ioremap_io() usage was replaced by devm_pci_remap_iospace() function, there is no need to use custom mvebu_pci_host_probe() function. Current implementation of mvebu_pci_host_probe() is same as standard PCI core functionn pci_host_probe(). So replace mvebu_pci_host_probe() call by pci_host_probe() and remove custom mvebu_pci_host_probe() function. Signed-off-by: Pali Rohár --- drivers/pci/controller/pci-mvebu.c | 41 +----------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index a55b8bd5eb62..f2180e4630a1 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -1005,45 +1005,6 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) return 0; } -/* - * This is a copy of pci_host_probe(), except that it does the I/O - * remap as the last step, once we are sure we won't fail. - * - * It should be removed once the I/O remap error handling issue has - * been sorted out. - */ -static int mvebu_pci_host_probe(struct pci_host_bridge *bridge) -{ - struct pci_bus *bus, *child; - int ret; - - ret = pci_scan_root_bus_bridge(bridge); - if (ret < 0) { - dev_err(bridge->dev.parent, "Scanning root bridge failed"); - return ret; - } - - bus = bridge->bus; - - /* - * We insert PCI resources into the iomem_resource and - * ioport_resource trees in either pci_bus_claim_resources() - * or pci_bus_assign_resources(). - */ - if (pci_has_flag(PCI_PROBE_ONLY)) { - pci_bus_claim_resources(bus); - } else { - pci_bus_size_bridges(bus); - pci_bus_assign_resources(bus); - - list_for_each_entry(child, &bus->children, node) - pcie_bus_configure_settings(child); - } - - pci_bus_add_devices(bus); - return 0; -} - static int mvebu_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1118,7 +1079,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) bridge->ops = &mvebu_pcie_ops; bridge->align_resource = mvebu_pcie_align_resource; - return mvebu_pci_host_probe(bridge); + return pci_host_probe(bridge); } static const struct of_device_id mvebu_pcie_of_match_table[] = { From patchwork Wed Nov 24 15:41:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BECBC433F5 for ; Wed, 24 Nov 2021 15:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LYOUgON0+15FvBLxRDT+/HkaiPj2avvRTIbAalhgnOA=; b=Gb1TiSjYh7USEu /VUm9DiO6PQQ3tGIRfODWZyHIAN54LUDTI+5OD1oFNXZGjLsNqow5RFw3BoGf3hixLyqFlekCzCoS dL8u61U6qco4pj6YukVbw+wtt/JaIo2Dx3qm1CT5myeO/YWep0aVr2CXg1JYw8Of0p53f3JxTblvj wiv8GQbSG/lD3Sb6xiL99hSbTbgj0p8q4Tr1rQPj6SLZ+xVADdst65qRfh4zE7mGX/IwmcydaBZ5J D/zvW6AEdQ2NXOXGMUlfVuzZ0uB94ugL/xMf/dMzhTyTqCz01y7Z58m8DHbf5X6bwKoA+7D2wMDbE oL76ZN5xEQ2yVfzBpGXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuPu-0057Os-PE; Wed, 24 Nov 2021 15:42:39 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuP7-00579l-65 for linux-arm-kernel@lists.infradead.org; Wed, 24 Nov 2021 15:41:50 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9218B60FE8; Wed, 24 Nov 2021 15:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637768508; bh=FqYmv0ijXFQECpsQq03m6A55pwsYwfkq9C+dIOKXchk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mULJUBOIDdAvOmaa9bqPdt1pFr5oSiBH2hspuCo/NP8fg/6ntosJxMIyeSO7Ziqo9 4V354m7EHrOT9/YJCeWTFfoY7xhOThKPuoz2RJ4mIsyCVYf9X3mCPNPMxb4P9idz6I 4ZmgSa4eIPYpRDj1aAh3BNz9G+OCIHWzjX3p2+8W08+Q1OCDguIamdoUiuZApPm7i7 tamQJula4Z23D8FUMFejBfz7lTCeVLYc0NO72NsLJ/rj1BCteEPpzqJDNd67m5G1D2 FEZ3z/OHBxCKgFOztyLkqTuQguTEKwK5czIFxN8lZZNRlCsg+3ojlZVWcrRO1eeTdX OYRe1Z0jyHmQw== Received: by pali.im (Postfix) id 51E4056D; Wed, 24 Nov 2021 16:41:48 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Dominik Brodowski , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , =?utf-8?q?Marek_Beh?= =?utf-8?q?=C3=BAn?= Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] arm: ioremap: Replace pci_ioremap_io() usage by pci_remap_iospace() Date: Wed, 24 Nov 2021 16:41:15 +0100 Message-Id: <20211124154116.916-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211124154116.916-1-pali@kernel.org> References: <20211124154116.916-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211124_074149_289318_98F57EF3 X-CRM114-Status: GOOD ( 17.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace all usage of ARM specific pci_ioremap_io() function by standard PCI core API function pci_remap_iospace() in all drivers and arm march code. Signed-off-by: Pali Rohár Reviewed-by: Russell King (Oracle) Reviewed-by: Alexandre Belloni --- arch/arm/mach-dove/pcie.c | 9 +++++---- arch/arm/mach-iop32x/pci.c | 5 ++++- arch/arm/mach-mv78xx0/pcie.c | 5 ++++- arch/arm/mach-orion5x/pci.c | 10 ++++++++-- drivers/pcmcia/at91_cf.c | 6 +++++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c index ee91ac6b5ebf..2a493bdfffc6 100644 --- a/arch/arm/mach-dove/pcie.c +++ b/arch/arm/mach-dove/pcie.c @@ -38,6 +38,7 @@ static int num_pcie_ports; static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) { struct pcie_port *pp; + struct resource realio; if (nr >= num_pcie_ports) return 0; @@ -53,10 +54,10 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) orion_pcie_setup(pp->base); - if (pp->index == 0) - pci_ioremap_io(sys->busnr * SZ_64K, DOVE_PCIE0_IO_PHYS_BASE); - else - pci_ioremap_io(sys->busnr * SZ_64K, DOVE_PCIE1_IO_PHYS_BASE); + realio.start = sys->busnr * SZ_64K; + realio.end = realio.start + SZ_64K - 1; + pci_remap_iospace(&realio, pp->index == 0 ? DOVE_PCIE0_IO_PHYS_BASE : + DOVE_PCIE1_IO_PHYS_BASE); /* * IORESOURCE_MEM diff --git a/arch/arm/mach-iop32x/pci.c b/arch/arm/mach-iop32x/pci.c index ab0010dc3145..7a215d2ee7e2 100644 --- a/arch/arm/mach-iop32x/pci.c +++ b/arch/arm/mach-iop32x/pci.c @@ -185,6 +185,7 @@ iop3xx_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) int iop3xx_pci_setup(int nr, struct pci_sys_data *sys) { struct resource *res; + struct resource realio; if (nr != 0) return 0; @@ -206,7 +207,9 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys) pci_add_resource_offset(&sys->resources, res, sys->mem_offset); - pci_ioremap_io(0, IOP3XX_PCI_LOWER_IO_PA); + realio.start = 0; + realio.end = realio.start + SZ_64K - 1; + pci_remap_iospace(&realio, IOP3XX_PCI_LOWER_IO_PA); return 1; } diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index 636d84b40466..e15646af7f26 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c @@ -101,6 +101,7 @@ static void __init mv78xx0_pcie_preinit(void) static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys) { struct pcie_port *pp; + struct resource realio; if (nr >= num_pcie_ports) return 0; @@ -115,7 +116,9 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys) orion_pcie_set_local_bus_nr(pp->base, sys->busnr); orion_pcie_setup(pp->base); - pci_ioremap_io(nr * SZ_64K, MV78XX0_PCIE_IO_PHYS_BASE(nr)); + realio.start = nr * SZ_64K; + realio.end = realio.start + SZ_64K - 1; + pci_remap_iospace(&realio, MV78XX0_PCIE_IO_PHYS_BASE(nr)); pci_add_resource_offset(&sys->resources, &pp->res, sys->mem_offset); diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index 76951bfbacf5..92e938bba20d 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c @@ -142,6 +142,7 @@ static struct pci_ops pcie_ops = { static int __init pcie_setup(struct pci_sys_data *sys) { struct resource *res; + struct resource realio; int dev; /* @@ -164,7 +165,9 @@ static int __init pcie_setup(struct pci_sys_data *sys) pcie_ops.read = pcie_rd_conf_wa; } - pci_ioremap_io(sys->busnr * SZ_64K, ORION5X_PCIE_IO_PHYS_BASE); + realio.start = sys->busnr * SZ_64K; + realio.end = realio.start + SZ_64K - 1; + pci_remap_iospace(&realio, ORION5X_PCIE_IO_PHYS_BASE); /* * Request resources. @@ -466,6 +469,7 @@ static void __init orion5x_setup_pci_wins(void) static int __init pci_setup(struct pci_sys_data *sys) { struct resource *res; + struct resource realio; /* * Point PCI unit MBUS decode windows to DRAM space. @@ -482,7 +486,9 @@ static int __init pci_setup(struct pci_sys_data *sys) */ orion5x_setbits(PCI_CMD, PCI_CMD_HOST_REORDER); - pci_ioremap_io(sys->busnr * SZ_64K, ORION5X_PCI_IO_PHYS_BASE); + realio.start = sys->busnr * SZ_64K; + realio.end = realio.start + SZ_64K - 1; + pci_remap_iospace(&realio, ORION5X_PCI_IO_PHYS_BASE); /* * Request resources diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 6b1edfc890a3..92df2c2c5d07 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -230,6 +231,7 @@ static int at91_cf_probe(struct platform_device *pdev) struct at91_cf_socket *cf; struct at91_cf_data *board; struct resource *io; + struct resource realio; int status; board = devm_kzalloc(&pdev->dev, sizeof(*board), GFP_KERNEL); @@ -307,7 +309,9 @@ static int at91_cf_probe(struct platform_device *pdev) * io_offset is set to 0x10000 to avoid the check in static_find_io(). * */ cf->socket.io_offset = 0x10000; - status = pci_ioremap_io(0x10000, cf->phys_baseaddr + CF_IO_PHYS); + realio.start = cf->socket.io_offset; + realio.end = realio.start + SZ_64K - 1; + status = pci_remap_iospace(&realio, cf->phys_baseaddr + CF_IO_PHYS); if (status) goto fail0a; From patchwork Wed Nov 24 15:41:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693552 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D38EC433F5 for ; Wed, 24 Nov 2021 15:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RkBhdXL/Yy1/UezVqs0swaLwLIFEiDfBYKAfMZgadcc=; b=OGNcd4kLaF9eN8 dvgTRV3DP8mts9aHsjyNyg2wfMMM1J2aJeoC4ZwKFMFkTEPvgAxsYHxrWhlOww5O1bw7jI0TEFxbC EzKpmL6n9HXCufRXkWvuNggmQJkga3DPfqS7mu1WkoCtfB9IiYKwf7KA1mqqy6akfybstdZVvqJ2o K/vVjdZnUpWKQjTYEptzD8mjOyvGPqzUR3/G4f3t6NfgefCnc1SZGyqmOMgtYDsJM3MV3xgIBUNd6 53xwam4njP0GGjRosbc0/9iAAkOqKMG53TM2zhSgxUnS2khPhmEZaMD9SHwPeHdoLtx7JZPke7nVI xloccbdS5f5fL0tCjVwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuQA-0057Vu-W5; Wed, 24 Nov 2021 15:42:55 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpuP8-00579M-0a for linux-arm-kernel@lists.infradead.org; Wed, 24 Nov 2021 15:41:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B82B76104F; Wed, 24 Nov 2021 15:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637768509; bh=WJvNY+0Pg9RFMP93Ezkwezkf68NlQN8B55mf/eDaHCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVmubVOYAgO9TjgiPbl5TGVesxZ2yZUGV3t2pespsxrGDULLKyZIWNu7TP+bSymMg 82kEugAqyeu9tWw9uWF2SOrKHWbzT8Ajy/NzHQiDvQqqbLHHzADmBFzIdmobFhOgPh J/IuY7nbruSuSZTjEjOQJ7orecTTcUi7TXW+Vy474qLNTtXYp6JNqflzE1HjM5cxAg kng+3vONiAtKQso5r/bLTk79+eWz6y8TBry8OAY0HBgDVFJpTMHAb/0TCjxM7bIIvN qcddQHNOivSpd+Cs9BVZaxD2tdiC4C8Cx5kGZQWQSW/295EUkdvqopjw9Mq0jDbBiG +U2jAshfhsbUQ== Received: by pali.im (Postfix) id 773BF56D; Wed, 24 Nov 2021 16:41:49 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Dominik Brodowski , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , =?utf-8?q?Marek_Beh?= =?utf-8?q?=C3=BAn?= Cc: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] arm: ioremap: Remove unused ARM-specific function pci_ioremap_io() Date: Wed, 24 Nov 2021 16:41:16 +0100 Message-Id: <20211124154116.916-6-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211124154116.916-1-pali@kernel.org> References: <20211124154116.916-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211124_074150_106652_3D0BBA5B X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This function is not used by any driver anymore. So completely remove it. Signed-off-by: Pali Rohár Reviewed-by: Russell King (Oracle) --- arch/arm/include/asm/io.h | 2 -- arch/arm/mm/ioremap.c | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 12eca75bdee9..0c70eb688a00 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -180,8 +180,6 @@ void pci_ioremap_set_mem_type(int mem_type); static inline void pci_ioremap_set_mem_type(int mem_type) {} #endif -extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr); - struct resource; #define pci_remap_iospace pci_remap_iospace diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index fa3bde48d6a7..197f8eb3a775 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -474,17 +474,6 @@ int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr) } EXPORT_SYMBOL(pci_remap_iospace); -int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr) -{ - BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT); - - return ioremap_page_range(PCI_IO_VIRT_BASE + offset, - PCI_IO_VIRT_BASE + offset + SZ_64K, - phys_addr, - __pgprot(get_mem_type(pci_ioremap_mem_type)->prot_pte)); -} -EXPORT_SYMBOL_GPL(pci_ioremap_io); - void __iomem *pci_remap_cfgspace(resource_size_t res_cookie, size_t size) { return arch_ioremap_caller(res_cookie, size, MT_UNCACHED,