Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp533094ybb; Wed, 8 Apr 2020 05:02:54 -0700 (PDT) X-Google-Smtp-Source: APiQypInkNi42ZmF7k/DF0+lNQRp9ts65lM6Cno8kfmsLC7TW7FuW/6adyFqJwUIfBbXvxIQ3hgT X-Received: by 2002:aca:bec1:: with SMTP id o184mr2063779oif.37.1586347374318; Wed, 08 Apr 2020 05:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586347374; cv=none; d=google.com; s=arc-20160816; b=N0eUqsr9MaR8re2V6w1qrc6S9MvUIkevmSJo0wtS6GGdAskbKj8+EqA4kgczzna5+G rM2TyoJkar3BV1vSZLBgaYmnB9wl/WVsckeYFeAMr5S0uhOOUPFxzjQedo1QfDd7iIuT s0FxayDUsBTqdDD2yHQAfIv47lMFi6WX1dclz/2EreTsopIAAaRQ1rTWVwNV+/fkCuyL mEKGEcNYYt50NesspLbNnCKElGwneaAOkYAxDqfzpBC6/jrTokm+tEaYSCZukrvgSBlC fGBW5YtMkhM2XHrZLEKZPTxXShMOybtr91fBU7EWr/dvgGpB/3ADS1fgHsUio9rpPhkl EFCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=otUadJ/9rL6aYPVuoUV0sPFutoeCBs/4mPZmKKBwvU8=; b=e3GKTSuDh+w51IbO0S85PYEjKe1HZ2s8vbXawnWjaij4a1Ue9DjfOnaJn04uaQ7Lsn N4OkaJtzrl/1opUkXWNv2CqNzW1wC315oL9jxVuNBWn6KDx4nOnbGRN19r8Y5xQfSGx8 RztUwGpIzkvtR6iK40HIYU/z8CPMNGt7ViX3zVX2vy9cehF6HmKV5Au9hisQ+4h5gSbX jMmqI6QJs9BX6YgFT2el8llhka7HzLeoiLMu/0ewAZHCY9uBlmgCZrykqgIFGRNA4BsV 5DghwI8y6Wmnhc3zc7WpBSeeWPLbjD9+HMpFX7hpljrUZfcTwZpoX3Ns/mqqNwgKU5Lf GXnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=cE87E28x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si2075408oih.267.2020.04.08.05.02.33; Wed, 08 Apr 2020 05:02:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=cE87E28x; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728829AbgDHMAN (ORCPT + 99 others); Wed, 8 Apr 2020 08:00:13 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47146 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728187AbgDHMAM (ORCPT ); Wed, 8 Apr 2020 08:00:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=otUadJ/9rL6aYPVuoUV0sPFutoeCBs/4mPZmKKBwvU8=; b=cE87E28xw1VZmqGi/8uV9lZ4gZ 8m2WMEdYnen6/11ACKb9ocqaLlAu0SETiydeCxqWgX0d4eS9+Gsc81PE+r593JfF5TNN3JX8S8zDD acvrqEpr4Tc4bcguGc++Mc2y6WjAV02zTlw1YSrM7gI4c8dED+plaO3O6PdBxZHrsyVLJJftC6FCI ScUU1hRyogYzzIxFTBY2MFeIIQvr+jKEeom96Cf/+r/vEqXYtiCw0nJAGns7cWVrr3UEbZfNXjG3T mMepp1wVEGJsvISHmFgrK5SJc39wh6OjhR2+5AV8w8r3Kv5NwJZ4wxcfWwokzduJrXQ9DwPsrDh9t k5XJjZrg==; Received: from [2001:4bb8:180:5765:65b6:f11e:f109:b151] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jM9My-0001wY-DB; Wed, 08 Apr 2020 11:59:49 +0000 From: Christoph Hellwig To: Andrew Morton , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , x86@kernel.org, David Airlie , Daniel Vetter , Laura Abbott , Sumit Semwal , Sakari Ailus , Minchan Kim , Nitin Gupta Cc: Robin Murphy , Christophe Leroy , Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/28] powerpc: remove __ioremap_at and __iounmap_at Date: Wed, 8 Apr 2020 13:59:04 +0200 Message-Id: <20200408115926.1467567-7-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200408115926.1467567-1-hch@lst.de> References: <20200408115926.1467567-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These helpers are only used for remapping the ISA I/O base. Replace the mapping side with a remap_isa_range helper in isa-bridge.c that hard codes all the known arguments, and just remove __iounmap_at in favour of open coding it in the only caller. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/io.h | 8 ----- arch/powerpc/kernel/isa-bridge.c | 28 +++++++++++++----- arch/powerpc/mm/ioremap_64.c | 50 -------------------------------- 3 files changed, 21 insertions(+), 65 deletions(-) diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index 71f1c5d69839..4fdbb9e45dd7 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -699,10 +699,6 @@ static inline void iosync(void) * * * iounmap undoes such a mapping and can be hooked * - * * __ioremap_at (and the pending __iounmap_at) are low level functions to - * create hand-made mappings for use only by the PCI code and cannot - * currently be hooked. Must be page aligned. - * * * __ioremap_caller is the same as above but takes an explicit caller * reference rather than using __builtin_return_address(0) * @@ -729,10 +725,6 @@ void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size, extern void __iomem *__ioremap_caller(phys_addr_t, unsigned long size, pgprot_t prot, void *caller); -extern void __iomem * __ioremap_at(phys_addr_t pa, void *ea, - unsigned long size, pgprot_t prot); -extern void __iounmap_at(void *ea, unsigned long size); - /* * When CONFIG_PPC_INDIRECT_PIO is set, we use the generic iomap implementation * which needs some additional definitions here. They basically allow PIO diff --git a/arch/powerpc/kernel/isa-bridge.c b/arch/powerpc/kernel/isa-bridge.c index 773671b512df..2257d24e6a26 100644 --- a/arch/powerpc/kernel/isa-bridge.c +++ b/arch/powerpc/kernel/isa-bridge.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,22 @@ EXPORT_SYMBOL_GPL(isa_bridge_pcidev); #define ISA_SPACE_MASK 0x1 #define ISA_SPACE_IO 0x1 +static void remap_isa_base(phys_addr_t pa, unsigned long size) +{ + WARN_ON_ONCE(ISA_IO_BASE & ~PAGE_MASK); + WARN_ON_ONCE(pa & ~PAGE_MASK); + WARN_ON_ONCE(size & ~PAGE_MASK); + + if (slab_is_available()) { + if (ioremap_page_range(ISA_IO_BASE, ISA_IO_BASE + size, pa, + pgprot_noncached(PAGE_KERNEL))) + unmap_kernel_range(ISA_IO_BASE, size); + } else { + early_ioremap_range(ISA_IO_BASE, pa, size, + pgprot_noncached(PAGE_KERNEL)); + } +} + static void pci_process_ISA_OF_ranges(struct device_node *isa_node, unsigned long phb_io_base_phys) { @@ -105,15 +122,13 @@ static void pci_process_ISA_OF_ranges(struct device_node *isa_node, if (size > 0x10000) size = 0x10000; - __ioremap_at(phb_io_base_phys, (void *)ISA_IO_BASE, - size, pgprot_noncached(PAGE_KERNEL)); + remap_isa_base(phb_io_base_phys, size); return; inval_range: printk(KERN_ERR "no ISA IO ranges or unexpected isa range, " "mapping 64k\n"); - __ioremap_at(phb_io_base_phys, (void *)ISA_IO_BASE, - 0x10000, pgprot_noncached(PAGE_KERNEL)); + remap_isa_base(phb_io_base_phys, 0x10000); } @@ -248,8 +263,7 @@ void __init isa_bridge_init_non_pci(struct device_node *np) * and map it */ isa_io_base = ISA_IO_BASE; - __ioremap_at(pbase, (void *)ISA_IO_BASE, - size, pgprot_noncached(PAGE_KERNEL)); + remap_isa_base(pbase, size); pr_debug("ISA: Non-PCI bridge is %pOF\n", np); } @@ -297,7 +311,7 @@ static void isa_bridge_remove(void) isa_bridge_pcidev = NULL; /* Unmap the ISA area */ - __iounmap_at((void *)ISA_IO_BASE, 0x10000); + unmap_kernel_range(ISA_IO_BASE, 0x10000); } /** diff --git a/arch/powerpc/mm/ioremap_64.c b/arch/powerpc/mm/ioremap_64.c index 50a99d9684f7..ba5cbb0d66bd 100644 --- a/arch/powerpc/mm/ioremap_64.c +++ b/arch/powerpc/mm/ioremap_64.c @@ -4,56 +4,6 @@ #include #include -/** - * Low level function to establish the page tables for an IO mapping - */ -void __iomem *__ioremap_at(phys_addr_t pa, void *ea, unsigned long size, pgprot_t prot) -{ - int ret; - unsigned long va = (unsigned long)ea; - - /* We don't support the 4K PFN hack with ioremap */ - if (pgprot_val(prot) & H_PAGE_4K_PFN) - return NULL; - - if ((ea + size) >= (void *)IOREMAP_END) { - pr_warn("Outside the supported range\n"); - return NULL; - } - - WARN_ON(pa & ~PAGE_MASK); - WARN_ON(((unsigned long)ea) & ~PAGE_MASK); - WARN_ON(size & ~PAGE_MASK); - - if (slab_is_available()) { - ret = ioremap_page_range(va, va + size, pa, prot); - if (ret) - unmap_kernel_range(va, size); - } else { - ret = early_ioremap_range(va, pa, size, prot); - } - - if (ret) - return NULL; - - return (void __iomem *)ea; -} -EXPORT_SYMBOL(__ioremap_at); - -/** - * Low level function to tear down the page tables for an IO mapping. This is - * used for mappings that are manipulated manually, like partial unmapping of - * PCI IOs or ISA space. - */ -void __iounmap_at(void *ea, unsigned long size) -{ - WARN_ON(((unsigned long)ea) & ~PAGE_MASK); - WARN_ON(size & ~PAGE_MASK); - - unmap_kernel_range((unsigned long)ea, size); -} -EXPORT_SYMBOL(__iounmap_at); - void __iomem *__ioremap_caller(phys_addr_t addr, unsigned long size, pgprot_t prot, void *caller) { -- 2.25.1