From patchwork Thu Feb 16 12:34:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13143039 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 5B136C64ED6 for ; Thu, 16 Feb 2023 12:36:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC70D6B007E; Thu, 16 Feb 2023 07:36:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E779A6B0081; Thu, 16 Feb 2023 07:36:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF28E6B0087; Thu, 16 Feb 2023 07:36:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C0F476B007E for ; Thu, 16 Feb 2023 07:36:14 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A1359120816 for ; Thu, 16 Feb 2023 12:36:14 +0000 (UTC) X-FDA: 80473102668.06.B454223 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id E936C8000D for ; Thu, 16 Feb 2023 12:36:12 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ePYz9F0I; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676550973; 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=Sr9JKOESlhr97F/18Rehpz4wxR+h22q8ZRCQP06oNDOYBYGMmFSRud14Q7IvubVn0j+nZK xWZjG6dZ3iMZpRm8vmpzL6sqabK7oWZ1JPsFdkHz4X5yI6ieV2ulv4yxdf8Qk6mN2DS9cD ZpIUh1UxnCGxjEjdkLmCcr0WwPAGSWA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ePYz9F0I; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676550973; a=rsa-sha256; cv=none; b=KxyIgpETi1sSxXizH2T0y4Ni06hUaY++CJj9nMML32XUkU5IKyNdUz8Z//ZRl3+bXIYdk/ GivBQ6bvTsYOXwQxUIMy7Nr1AaBVQhP97JOy6gcCseE4CouzES2iMYUKdeEgWTlpJKYWKS OSeelTbPz2vuvRbwmyjH1a5Aj0+e424= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676550971; 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=ePYz9F0I/u6odg78hhQuDR6HeeVpNS3WnMqCJVFZR6oGUR08tMEvMNoUBgquzHmpb3ehNh VpVX5YOJsU/208CEcl7VuXpyo0beub0v+NIa1fkS/Cl6wgMxGv5Kx7TrhiIKUsTgljNTZu OvS3T1uGJuliNlZuXEaHNp3/JWLdtg0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-192-t5oiSJVUPBaODLgfCZy8BQ-1; Thu, 16 Feb 2023 07:36:07 -0500 X-MC-Unique: t5oiSJVUPBaODLgfCZy8BQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9CA37857F40; Thu, 16 Feb 2023 12:36:06 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-99.pek2.redhat.com [10.72.12.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A108492C3C; Thu, 16 Feb 2023 12:36:00 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, 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, arnd@arndb.de, Baoquan He Subject: [PATCH v4 13/16] mm/ioremap: Consider IOREMAP space in generic ioremap Date: Thu, 16 Feb 2023 20:34:16 +0800 Message-Id: <20230216123419.461016-14-bhe@redhat.com> In-Reply-To: <20230216123419.461016-1-bhe@redhat.com> References: <20230216123419.461016-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Queue-Id: E936C8000D X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: j6fk389xei6egqp1ocwkmgzd9kxbogex X-HE-Tag: 1676550972-863451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0Xg2BWYAoxVYN34toM+ScTr3X1ecbrRv12mLUA5rVy/5HBtBtAZvWAIz6EFs2sE+of2fNObJn0JTuvSQRIEUlWuTIqP1QOU2ZC/3DfIcpoYkKyx6THWo+CE59u10DM1mG70WhidBfE3N08e1QVLMYcKsqoLSxTxEu4qjMx8uaWGgX+A== 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); }