From patchwork Fri Jun 9 07:55:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 105367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp787897vqr; Fri, 9 Jun 2023 01:12:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ699INGE5k0yAP/ofE196/nC+c5AQqgqwd+mDG+Tz7yIj9shTzMmbMSDRTTek98F1ygwpHy X-Received: by 2002:a17:90a:688d:b0:259:17c9:fda7 with SMTP id a13-20020a17090a688d00b0025917c9fda7mr377363pjd.4.1686298357746; Fri, 09 Jun 2023 01:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686298357; cv=none; d=google.com; s=arc-20160816; b=ZPpfZTMXmdwED0H4kVWXKqfWmlUzKS5bcEsqkdFVHxJWV/Z0jLMldsnIFN/5IcRWFO c1Mox1Lw1CqfBpLn6es3UXRvoC3ZHlmD5X0PNI9tKBXan8Z/8WVSJN+ELrIj1/9t5LmE m/QqUrIa3jmVEwEQzgnxVOeFb0SwL1XbwFqHOVzczqPNizbUlQ/cp2G38WWW4WTl9Fz2 S8dfMg3DN9eAvjUVK48NG0qAXne0HlZiNNZxJ4sGxUUT0UeZKXhJNK+U6y6ULZAa2EyY Vr4KML6aDU254ZS3fv4q5RkVE9K0KBEw+3JmrXEZGYjamSUHqgWxGS7pJpVQBpNzsg9d cE7w== 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=81nV18C3v1lk6vsTsYHvlL2VrwGGV2i7WxKaTwXwgOE=; b=0nfzYYdX5NWO0j+XKokPYyD0UBgaKeRQDaYtChIom5u9aGHX+MjjBP+CLLvfJDpGTI 8+8Ri9HhqZqD66kTsuw1oo25IqNK3o3wxIqIZq0FYi4KsgYn7mXSw9cFSWuQ9gA7eIF6 mEqW56WNld/8HhusgbjYfIJ1bOzrMEYXHsWQEMErtl07tr2bPMOSY0S5lo75+2eEKxwz bzbWFvuU0qOIyS8brnpXlGfebB2jo/OINm3dFltNhC2ZF4Qfj1MsWL5PzN7pnOWKyCrH YYsLyyHxdepZIsBIkpOCOqe8PPHsv4MZXTPEWzFEumqFPfmOweEOjfdhePMGyfHLfCFl guwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QYbn12ur; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a636d06000000b0052cba2d0187si2358834pgc.704.2023.06.09.01.12.22; Fri, 09 Jun 2023 01:12:37 -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=QYbn12ur; 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 S236407AbjFIIBE (ORCPT + 99 others); Fri, 9 Jun 2023 04:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239655AbjFIIAT (ORCPT ); Fri, 9 Jun 2023 04:00:19 -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 5B8AB46B6 for ; Fri, 9 Jun 2023 00:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686297474; 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=81nV18C3v1lk6vsTsYHvlL2VrwGGV2i7WxKaTwXwgOE=; b=QYbn12urwrYDvLlrgdjoCyjR7ChtZURo6ihuP9Ev/NVjzTZjk2Q458xfsfBah2C462DFOR VsiMneVuS9Hxpl4Z54Ls9Z4pVzpQXSryOllkOWsHN+/LRDVgEPwkDI+XbPGANVHYXE8/Yb 621j+5KDaTWdkwhu3iKbNY18k9lf7Us= 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-147-ka62SOjHPdCC3QS6MTgItw-1; Fri, 09 Jun 2023 03:57:45 -0400 X-MC-Unique: ka62SOjHPdCC3QS6MTgItw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A34AD3C0CEF9; Fri, 9 Jun 2023 07:57:44 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-92.pek2.redhat.com [10.72.12.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B08E20268C7; Fri, 9 Jun 2023 07:57:37 +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@lst.de, rppt@kernel.org, willy@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@ACULAB.COM, shorne@gmail.com, deller@gmx.de, Baoquan He , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 18/19] arm64 : mm: add wrapper function ioremap_prot() Date: Fri, 9 Jun 2023 15:55:27 +0800 Message-Id: <20230609075528.9390-19-bhe@redhat.com> In-Reply-To: <20230609075528.9390-1-bhe@redhat.com> References: <20230609075528.9390-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768211986480549500?= X-GMAIL-MSGID: =?utf-8?q?1768211986480549500?= Since hook functions ioremap_allowed() and iounmap_allowed() will be obsoleted, add wrapper function ioremap_prot() to contain the specific handling in addition to generic_ioremap_prot() invocation. Signed-off-by: Baoquan He Reviewed-by: Christoph Hellwig Reviewed-by: Kefeng Wang Reviewed-by: Mike Rapoport (IBM) Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Acked-by: Catalin Marinas --- arch/arm64/include/asm/io.h | 3 +-- arch/arm64/mm/ioremap.c | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 877495a0fd0c..97dd4ff1253b 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -139,8 +139,7 @@ extern void __memset_io(volatile void __iomem *, int, size_t); * I/O memory mapping functions. */ -bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot); -#define ioremap_allowed ioremap_allowed +#define ioremap_prot ioremap_prot #define _PAGE_IOREMAP PROT_DEVICE_nGnRE diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c index c5af103d4ad4..269f2f63ab7d 100644 --- a/arch/arm64/mm/ioremap.c +++ b/arch/arm64/mm/ioremap.c @@ -3,20 +3,22 @@ #include #include -bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot) +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, + unsigned long prot) { unsigned long last_addr = phys_addr + size - 1; /* Don't allow outside PHYS_MASK */ if (last_addr & ~PHYS_MASK) - return false; + return NULL; /* Don't allow RAM to be mapped. */ if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr)))) - return false; + return NULL; - return true; + return generic_ioremap_prot(phys_addr, size, __pgprot(prot)); } +EXPORT_SYMBOL(ioremap_prot); /* * Must be called after early_fixmap_init