Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30686754rwd; Thu, 6 Jul 2023 09:14:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlEtKrrziH7emI/ecqMvBJF2rJrf7Q4ya9iCah3rVIGloqhIKR/1UiciwhaTmb7npn1g+ffe X-Received: by 2002:a05:6a20:430f:b0:12e:4174:6a4d with SMTP id h15-20020a056a20430f00b0012e41746a4dmr8509238pzk.10.1688660097025; Thu, 06 Jul 2023 09:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688660097; cv=none; d=google.com; s=arc-20160816; b=G1pEm8EBGILy+y+iM2SDcvPvilFk0SzDRkQZmDn9QY85ZQ994Dy4sXDjihs9LNHNjN O77oa9OXbUo2WVo5/lI8l9/nceIROCG+wjoaMZrw8I55A1uEll1yWBVo7q+D3NLurQIY 11D11J0u5F3H1k6WbuSv1tecDLY1mM1R5Uzu60CDc/PCH8g1By2I9maRrnKwClEiwB6o hf9eNmssRYTpvfyT7BIE8O+vy+jCdDIO0mcrZqEH0Zs2ii0tkz4Lw4Tf/RSM2HlsbN8J oQ+T1sXmmSibF9VI3KphntcSpRSeag8YXmFj1aoMZ3f2Yky8oQXZXR/p0Ly3np54XK4w m1Cg== 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=SboB+Gem+bQaB39EZZBPE5ZHPttNaa4nwbopj4kdit4=; fh=MRqAqm0/X6LLHlLdJym4NBXwcTEGRfSmsWs7mgX78Dg=; b=qDTCzutsQgujgjgt10FkV97/OnA6c3olMlTPzZiaI0YVUAvnCkjIrZ8uuEthGLFUqx LyGOR3gixQZlv/x4CqorZK+eGtEp5/npnN+i9bITQpOk7/nA0NIxxYrow3XUe7uD6EZ4 kmdCkgrW/zhytO8s2/q6bx/l9NpniucoIiNP81lwHAd7zEV1S2nwihYtOOPbNvEkDH1v 0NsueZkjNTI+xAG6515iOoMwX+56Z3BcFFluKfYAwy+G9rmgmxi8bKYUxYt8+bMZPdUS QCAL+4JSX4WBoVbgk1Wxs+4oPOieXiXoY6LQXNSRexKOxnx5mrG4p+fiIgSe50fo480n EVPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IQidm1EC; 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 a8-20020a631a08000000b0055b1a2f6d2bsi1736418pga.76.2023.07.06.09.14.42; Thu, 06 Jul 2023 09:14:56 -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=IQidm1EC; 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 S232273AbjGFPtg (ORCPT + 99 others); Thu, 6 Jul 2023 11:49:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232879AbjGFPtF (ORCPT ); Thu, 6 Jul 2023 11:49:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2782D1BF8 for ; Thu, 6 Jul 2023 08:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688658482; 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=SboB+Gem+bQaB39EZZBPE5ZHPttNaa4nwbopj4kdit4=; b=IQidm1EC58/vjDq6gQE+xUk7FunNqDhtYSJvhh4A3TjvCB/QeDtpdKGtArpqCuha6UPnFz N0vGco5yBHhv5yIAWvEuiggPXz7OuCYkxfafs5vsCbfH8T8ukZUHQ0E/1E1zR3F99nR7vz xUnbwtiJWaLD3DwG8yzas8cdvgwAX2I= 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-102-Zgylzl54Oz6H0HNz3490IA-1; Thu, 06 Jul 2023 11:47:57 -0400 X-MC-Unique: Zgylzl54Oz6H0HNz3490IA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 318981044591; Thu, 6 Jul 2023 15:47:56 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-39.pek2.redhat.com [10.72.12.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id C303DF5CF0; Thu, 6 Jul 2023 15:47:48 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, arnd@arndb.de, hch@lst.de, christophe.leroy@csgroup.eu, rppt@kernel.org, willy@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, shorne@gmail.com, David.Laight@ACULAB.COM, deller@gmx.de, nathan@kernel.org, glaubitz@physik.fu-berlin.de, Baoquan He Subject: [PATCH v8 15/19] mm/ioremap: Consider IOREMAP space in generic ioremap Date: Thu, 6 Jul 2023 23:45:16 +0800 Message-Id: <20230706154520.11257-16-bhe@redhat.com> In-Reply-To: <20230706154520.11257-1-bhe@redhat.com> References: <20230706154520.11257-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.5 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, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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_prot(). Signed-off-by: Christophe Leroy Signed-off-by: Baoquan He Reviewed-by: Christoph Hellwig --- mm/ioremap.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mm/ioremap.c b/mm/ioremap.c index 86b82ec27d2b..68d9895144ad 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -11,6 +11,15 @@ #include #include +/* + * Ioremap often, but not always uses the generic vmalloc area. E.g on + * Power ARCH, it could have different ioremap space. + */ +#ifndef IOREMAP_START +#define IOREMAP_START VMALLOC_START +#define IOREMAP_END VMALLOC_END +#endif + void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, pgprot_t prot) { @@ -35,8 +44,8 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, if (!ioremap_allowed(phys_addr, size, pgprot_val(prot))) return NULL; - area = get_vm_area_caller(size, VM_IOREMAP, - __builtin_return_address(0)); + area = __get_vm_area_caller(size, VM_IOREMAP, IOREMAP_START, + IOREMAP_END, __builtin_return_address(0)); if (!area) return NULL; vaddr = (unsigned long)area->addr; @@ -66,7 +75,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