From patchwork Wed Mar 1 03:42:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13155580 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D43F9C64EC7 for ; Wed, 1 Mar 2023 03:44:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 718CB6B0087; Tue, 28 Feb 2023 22:44:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C8D66B0088; Tue, 28 Feb 2023 22:44:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 591D96B0089; Tue, 28 Feb 2023 22:44:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 483246B0087 for ; Tue, 28 Feb 2023 22:44:34 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2A58780FE1 for ; Wed, 1 Mar 2023 03:44:34 +0000 (UTC) X-FDA: 80518937268.20.D3F7A65 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 69ECF160003 for ; Wed, 1 Mar 2023 03:44:32 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=auYpdm4U; spf=pass (imf08.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677642272; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Uaseq8uUQQ6QMQSRfFux0A76lTwwiGZ3GmLj5/5Y0lk=; b=ReeVEa/NbE9BvCgsgvVUJ33WgpiDhWZ+yMAS+JcBLlUPogHeJ0AvdtSRN9AvtO65aI/xKb vmcoGjr+OJrXleQ6HdV5Dhwf1NPg9Zt9XzYL8H8UtGRVhgeRf5avuurRTDEG6rgQi3zJ9y HuQ8oygB4nahGUrwg3JZvuWCG2rZgGs= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=auYpdm4U; spf=pass (imf08.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677642272; a=rsa-sha256; cv=none; b=55PdN3h9N34CoVkcL2ZPS/dDuZRLqmR4dvgt2iA60Jd2tS75nX3yzNgkZhmQp9RP5sg11r r5JwFi2Z6c8r43HFEU+Jb9YfkHfMQlIdCqcNCLQ/+twYOxAcYOPF6v0Tl4xDY7k7OiCL6c gVLFRN2q1hJjd0DPVeqwJHq1HL0Cwpo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677642271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Uaseq8uUQQ6QMQSRfFux0A76lTwwiGZ3GmLj5/5Y0lk=; b=auYpdm4UMZe/BA+PT7/0aA1FAxcDeVb4tINrgO6AccM2vsDvygI/ts1yvduYBr7I0LWlfz VtFav56VP8okbxepkdfMVg5dod7JnvDgk/udmu5/H8j2iWsQiOK8vY1lF/CXa/LmoSRrdY OjnyKyDRaFe8PX379SsL6ejXTVFgh6o= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-361-Nku5RR7JO3SsoRvpup12WQ-1; Tue, 28 Feb 2023 22:44:28 -0500 X-MC-Unique: Nku5RR7JO3SsoRvpup12WQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C97973C0DDB2; Wed, 1 Mar 2023 03:44:27 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-13-180.pek2.redhat.com [10.72.13.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6933CC15BAE; Wed, 1 Mar 2023 03:44:21 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, christophe.leroy@csgroup.eu, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@ACULAB.COM, shorne@gmail.com, willy@infradead.org, Baoquan He Subject: [PATCH v5 14/17] mm/ioremap: Consider IOREMAP space in generic ioremap Date: Wed, 1 Mar 2023 11:42:44 +0800 Message-Id: <20230301034247.136007-15-bhe@redhat.com> In-Reply-To: <20230301034247.136007-1-bhe@redhat.com> References: <20230301034247.136007-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 69ECF160003 X-Stat-Signature: tptc3ndsn7wpgax3pd6783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SiOGns9nnvX4aMtsq7Shi8RrEwcvymmoVG2QFf496I3ZwIrgdh0iwf0uU2DRr8M2TwmBhgM3bgc/SGX+9u1t5GNUMJne8k2/NSSjm+2C+WHZIcJsLygeIwJ8/z752qXCLK4xN3hFsthOi23fsrauCrQ6ShTKtgwklQKNEfUwpyGDThMetX9farHGoFwiC3+43kHejpw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Christophe Leroy Architectures like powerpc have a dedicated space for IOREMAP mappings. If so, use it in generic_ioremap_pro(). Signed-off-by: Christophe Leroy Signed-off-by: Baoquan He --- mm/ioremap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/ioremap.c b/mm/ioremap.c index 2fbe6b9bc50e..4a7749d85044 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -35,8 +35,13 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, if (!ioremap_allowed(phys_addr, size, pgprot_val(prot))) return NULL; +#ifdef IOREMAP_START + area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START, + IOREMAP_END, __builtin_return_address(0)); +#else area = get_vm_area_caller(size, VM_IOREMAP, __builtin_return_address(0)); +#endif if (!area) return NULL; vaddr = (unsigned long)area->addr; @@ -66,7 +71,7 @@ void generic_iounmap(volatile void __iomem *addr) if (!iounmap_allowed(vaddr)) return; - if (is_vmalloc_addr(vaddr)) + if (is_ioremap_addr(vaddr)) vunmap(vaddr); }