Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1747408rwd; Mon, 15 May 2023 02:24:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7rTAjbw3tk8gJb1k10RHeW5fR1nHsQRVAIwHwLu2ZTD6WIktKGn+o/TvJ9Ul+mRhRGyAH6 X-Received: by 2002:a05:6a00:1820:b0:64a:ea46:3b7d with SMTP id y32-20020a056a00182000b0064aea463b7dmr14462391pfa.23.1684142670777; Mon, 15 May 2023 02:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684142670; cv=none; d=google.com; s=arc-20160816; b=KwyW7y6T8l31Zr62Pk/TCRmXD1FeAhbR23VL+HWZVR6xhWfqTajhNpC8jeRE1EzneU tei/T0FBTjR15nzvpOYZi4c3mpqKZ8zRZv/BW740gjTkD6mOjtBUKrbZ+E2wdmGKWwLb 5jnyo+ehigO/nTWRuFJ6oP3VdDCe2yZl+HhGGUdMjTRKVaLNr75koeBVZuTvXhVbrp8o CiR/KPymPBhZfwbhxD6dGd0Oi4WURweN/JQhcPr+W0B7k8dLRpeGDdD/8xlJNxHd5Qhl uKHNfqNKleIaWj8d/SuBIa39i71+zc0VLM7owdnOSrQ0Q0Dtl8y6zKFVwBrnb3A8Bgcg iPaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Uaseq8uUQQ6QMQSRfFux0A76lTwwiGZ3GmLj5/5Y0lk=; b=g1aC23tXMD2Khu5pNeXdw53Q7z2JpeFauVNQgHn2iy9ZgC01+tMx42GG7BkndCh3Cp GgjTbhE/PZJ787NVgDhwrfuaXRGiGyUCkZLyx+zxtJZatr8JSlqLIWC++C7Cj6ZyIIKp 0x26FmWYuq+6FMincaD5lZTN/bvneHjVI2KpW383ReRdXg2JJtQjDvzuigS2As9BT+eQ B7QcVqQEtc4en9N7ie6llCzvIM26UVKQWP5xYZfdKhvD751RpwO0V2VJMRuEBsR4TKxf UP8+uFN+lnYpnEZQqkctCFZ+KhiFM3jm663r0dVcjHccxrmidKQKb9Viptqo2tYStl06 4fcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="hLVtTz/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a63aa05000000b0051aeaf666dfsi15251595pgf.668.2023.05.15.02.24.19; Mon, 15 May 2023 02:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="hLVtTz/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239874AbjEOJOQ (ORCPT + 99 others); Mon, 15 May 2023 05:14:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbjEOJN0 (ORCPT ); Mon, 15 May 2023 05:13:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FA49212E for ; Mon, 15 May 2023 02:10:54 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.34.1