From patchwork Wed Mar 1 03:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 62755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3420425wrd; Tue, 28 Feb 2023 20:13:32 -0800 (PST) X-Google-Smtp-Source: AK7set81qn+CVkZUswjfbXjX2zS9XFtq/cieq8QHjdt9e1HmsswSDBZ3c84G2q2Usc11HGpCsnnF X-Received: by 2002:a17:902:be02:b0:19c:e14e:cc71 with SMTP id r2-20020a170902be0200b0019ce14ecc71mr4616160pls.23.1677644012114; Tue, 28 Feb 2023 20:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677644012; cv=none; d=google.com; s=arc-20160816; b=IQqvXFl2IMJ556noago51XqLPySR+/zkO4sFh2Mj9au0OagqheNImAOB/2lm6nGP8l lVAOKSuamTDK37gS8oOPj6aJLbfjZoCLFVRepSBwMDcSZEAhUCyGZ2ia9B0hdkKU1qKu S9E0h6tEfrHRXcF89JHhKnHdpayWgNw6S4PP3Rd0SXFhAw17AapOSu3Z+MriwL69lz5a 89MVxJ4ZVhpzlD2dIMAnAcogZwf/Ud9vI8KOb/+DPz4c7Y1ctM5gty7m/wSb0L9vMCrf LKmIWMZQPLHYEQV5hfS7IF/2/BZr4/IM8/NIwL09NXUIi8qbpzXefD0TwPTelbyPuWEA 5mng== 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=C0imqrk1PbsNJjpK8uE3mThxpzCeMekX1fy8wvbYCaE=; b=o9ipfhKc7uzMYD6yNV3pQ+cRG/s5hWFIZSFEMudojqg4TJTy07o6t7pIl5UvvNOZ4e tjSeU5GR8iBjvu8LV5eXRIgi2nHg+a4SF8TcPi86YtB4lQ1bmpJ3wf+EZ4Vsl8nCaquJ gVCtb+roQYBCcWNseSJrmOWI3cjHTRd2rwPtLzSwNv2psimXp91V2Iws8Qk0jfk392F0 1Qz0N0zBYRhprfCrCW2sWrzp2Ne4gn64S2qkt0Tmy1tNpACjEvHMMX7vXMPTye+JBwRW xXr5MI3x4VdSLbN+B3biYzlTbywMuMemzy141U5l9hfPzHiQCl12jpDFb3dk+9vZh36n 4OCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Y4/kjR8b"; 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 x19-20020a170902ea9300b001998389e0e6si11320722plb.379.2023.02.28.20.13.18; Tue, 28 Feb 2023 20:13:32 -0800 (PST) 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="Y4/kjR8b"; 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 S230037AbjCADqy (ORCPT + 99 others); Tue, 28 Feb 2023 22:46:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbjCADq3 (ORCPT ); Tue, 28 Feb 2023 22:46:29 -0500 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 BCF32392B8 for ; Tue, 28 Feb 2023 19:45:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677642285; 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=C0imqrk1PbsNJjpK8uE3mThxpzCeMekX1fy8wvbYCaE=; b=Y4/kjR8bXhLlHtjaaZENWjR9P+IoT++Ie0mSn7uSb/EtV6XZSiN2mAfyFz/d9f5/Qrjowt P3NB4PxtXHGKX9RzDD66x0x9ONN+R6CZwQsOOkGJ0kOsp9vs5u6qDMIghp6g4KGE5e8CRo hDEgnMkTmdmgo2zcT864Djoy/NhQwVE= 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-659-JOcyBac7NuC_mde3DG7Gxg-1; Tue, 28 Feb 2023 22:44:38 -0500 X-MC-Unique: JOcyBac7NuC_mde3DG7Gxg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0ECDE3C0DDB2; Wed, 1 Mar 2023 03:44:38 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-13-180.pek2.redhat.com [10.72.13.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83B9EC15BAD; Wed, 1 Mar 2023 03:44:33 +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, Baoquan He Subject: [PATCH v5 16/17] arm64 : mm: add wrapper function ioremap_prot() Date: Wed, 1 Mar 2023 11:42:46 +0800 Message-Id: <20230301034247.136007-17-bhe@redhat.com> In-Reply-To: <20230301034247.136007-1-bhe@redhat.com> References: <20230301034247.136007-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1759137247945041174?= X-GMAIL-MSGID: =?utf-8?q?1759137247945041174?= Since hook functions ioremap_allowed() and iounmap_allowed() will be obsoleted, add wrapper function ioremap_prot() to contain the the specific handling in addition to generic_ioremap_prot() invocation. Signed-off-by: Baoquan He --- 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