From patchwork Mon May 15 09:08:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13240995 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 C540AC77B75 for ; Mon, 15 May 2023 09:10:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 616AD900007; Mon, 15 May 2023 05:10:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C718900002; Mon, 15 May 2023 05:10:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48F8C900007; Mon, 15 May 2023 05:10:56 -0400 (EDT) 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 31BD0900002 for ; Mon, 15 May 2023 05:10:56 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 03FF6AF4D1 for ; Mon, 15 May 2023 09:10:56 +0000 (UTC) X-FDA: 80791919712.10.07B21EE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 3FEDF14000A for ; Mon, 15 May 2023 09:10:54 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="hLVtTz/W"; spf=pass (imf09.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=1684141854; 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=P8rUQ2QBA4BXL7bFWdnhPSSD3VWX0+CcYCn6zv3mMWdXezLcQ7AW4LgrUgJO7+KVU87i5/ Zo9+Rl6MARDLifqlZ28RU/LynBVsqeAl5aorQuV7bQmvQQLhmKy5VyVHTpnIogJOtg8Ejk 4792k0BrYl106uZSnXD4A/uhLNlmGeY= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="hLVtTz/W"; spf=pass (imf09.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=1684141854; a=rsa-sha256; cv=none; b=NPKuefMfENZWbycMBbzKz2FOjR9Xwkpp9T9Thgcl2WcAYzk6LHuUdkV3vQRpobdyB/71hP UPF3c3yGDEksKo1DMkLdBQDWB1W7EvJiRf8lUi1ANJvWIXfK0U/oXEUM5aIanS6eggb9Os ase03zbu/0d2d9+lCs7/7dkD7g8Ufdg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684141853; 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=hLVtTz/WvCwJgMNr78AO2M+yQj8iy7TzeGb4GBePRbSeCXcRrhCQJflHexF17iMuRJYJNr F78NI5sw+2Sx/AuWUc1BXlMuSa0LGNBAvEbFGNpkFO56SBp+qZySqdJ1SBTElb5qGC5EMw HIcVCCB3+kREV6TsGi26utEQCzirYIw= 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-507-ER6juC3BMNSvQDD-_oKHbw-1; Mon, 15 May 2023 05:10:50 -0400 X-MC-Unique: ER6juC3BMNSvQDD-_oKHbw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A324585A588; Mon, 15 May 2023 09:10:49 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-32.pek2.redhat.com [10.72.12.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3611340C2070; Mon, 15 May 2023 09:10:42 +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, deller@gmx.de, Baoquan He Subject: [PATCH v5 RESEND 14/17] mm/ioremap: Consider IOREMAP space in generic ioremap Date: Mon, 15 May 2023 17:08:45 +0800 Message-Id: <20230515090848.833045-15-bhe@redhat.com> In-Reply-To: <20230515090848.833045-1-bhe@redhat.com> References: <20230515090848.833045-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Stat-Signature: 7xm1wnsnw9wefcp1y1fs8kx9q941o7m5 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3FEDF14000A X-Rspam-User: X-HE-Tag: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KVqdjoRg9XGWf86QtvjlpW+Ft44XUCTCHwAqBfdjK0lbmxHVYoDDXGnJouUBTK4/X49QZ7F4Dj+TFMUnBJwqKU4/ot8mJ/EQdOvt3pGuyKmWaTIPiOB6zLCYUMkmsTu+rrmRuIvITbBF6KprrniybdL5F0sNONIIiTzXaPeutqqlyigM= 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 Reviewed-by: Mike Rapoport (IBM) --- 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); }