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: 13155582 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 2D3BCC7EE23 for ; Wed, 1 Mar 2023 03:44:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C486A6B0082; Tue, 28 Feb 2023 22:44:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BF9786B008A; Tue, 28 Feb 2023 22:44:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC1C86B008C; Tue, 28 Feb 2023 22:44:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9D14C6B0082 for ; Tue, 28 Feb 2023 22:44:47 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6FE7A1A1057 for ; Wed, 1 Mar 2023 03:44:47 +0000 (UTC) X-FDA: 80518937814.21.6D86393 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf26.hostedemail.com (Postfix) with ESMTP id A34CD140006 for ; Wed, 1 Mar 2023 03:44:45 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Y4/kjR8b"; spf=pass (imf26.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=1677642285; 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=C0imqrk1PbsNJjpK8uE3mThxpzCeMekX1fy8wvbYCaE=; b=a5/nDOrc5bGbXlxiBFF+g7XtOWJI3D8cUjfB0iWStDazfatoHwVSKHH4jRin607tfGKCCZ pQByS3RqUDxwgUtfHBsmPiRnMMwNciczx7aU89rx/ZC36+2mp98XfhyWMXpDM00oBLv9z0 qMZzAfL3IdZ/r1dlcrY3qpqCxIeijLM= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Y4/kjR8b"; spf=pass (imf26.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=1677642285; a=rsa-sha256; cv=none; b=KHI0w/9gACbpSQ9oXHJMjrR5hn69xqxNhN/VM/0JafkyJ/RpFY/7EV5roZSvUO905ZuRVj mlvdi6X56qvt48m9Ioku2gDMf61uncG1y5NyBql0Ew4pMtG68GsP5srYvtLsaYrPUI5kBq emByKjivHsAZEXTw+YNnQOsOLzy+rlM= 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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A34CD140006 X-Rspam-User: X-Stat-Signature: 6gm1zpn4c3xsgyxr39ucjkkr7uhy9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H24NL0HSgOYpWJwlYvwd+t3pWqdls7Ue+aouyLFrDsbnAvLk/cKiAhNe54pxbk6MnJ7oNMt94aAOX2L84hezJU0wNewoZLHxWwjdgJMyhF17ykIJGgo2BxCx8G8rqkSf3L7t3f7xKsuYw45iKIhAx4MT8RNHfIf/y8kW+n61IaLxs/rgj9TzYonpVQ= 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: 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