From patchwork Thu Feb 16 12:34:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13143041 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 9644EC61DA4 for ; Thu, 16 Feb 2023 12:36:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 356C96B0087; Thu, 16 Feb 2023 07:36:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2DED16B0088; Thu, 16 Feb 2023 07:36:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10B186B0089; Thu, 16 Feb 2023 07:36:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F2B5B6B0087 for ; Thu, 16 Feb 2023 07:36:30 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AFDE2160FBB for ; Thu, 16 Feb 2023 12:36:30 +0000 (UTC) X-FDA: 80473103340.14.73E31AC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id B01BB4001A for ; Thu, 16 Feb 2023 12:36:27 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="TWq2MTT/"; spf=pass (imf11.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=1676550987; 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=RNdh/TySVIGgVhyjk9AByHNitK75WMNttk6DS+DsVe0=; b=TOBj67WY+hCN+u9r9ZNFtOork32Mkz8iP5KgOAgRhvlItdK7ShrtOX1Gv56wNctLIchVUP a0B2qd9QI5kT3k+DdHsFb6rZNTZJk48pBceWkeISfSG3ooq83qJe7fnXmtt6bN54mvvWx+ TrW0JYaC+UFN5UBOQkX/sU4BTX0gv/w= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="TWq2MTT/"; spf=pass (imf11.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=1676550987; a=rsa-sha256; cv=none; b=F7r6/cnsWslGgLuvOXoVMODnMngVFFW2qi5hY2ZgvAnJQFvHD1S3SzDhgyFdcoE27nPMgL fufdQUZ3aWU7Bc67UaaVkliLk3EvWbxDzXfZHdab1lCpZ2W06tAnLZiFRGrybskz/SoiKl sgPOQdiAEVaLTRxIyWzly7QSI2z/GYk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676550987; 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=RNdh/TySVIGgVhyjk9AByHNitK75WMNttk6DS+DsVe0=; b=TWq2MTT/9FhKsG3DA0PNJkMVZCZoZHdKiwM00TXEWt2KrW5Z5uBgpBWpFY638hUW+07dH2 znOSS+8U/8O26oeZPvdfLSFMgyUJKeM+pcAQk9SH4WUGI/QXjWQ/V+4kSkmj/OvWWDZ0ja DIKwTNQsE1fCOShdAe/t4FytzDoQLoM= 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-227-T-H0c8N2PTeRxvwb_7vp5w-1; Thu, 16 Feb 2023 07:36:23 -0500 X-MC-Unique: T-H0c8N2PTeRxvwb_7vp5w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6051D1C189B5; Thu, 16 Feb 2023 12:36:22 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-99.pek2.redhat.com [10.72.12.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDAC3492C3C; Thu, 16 Feb 2023 12:36:13 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, 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, arnd@arndb.de, Baoquan He , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 15/16] arm64 : mm: add wrapper function ioremap_prot() Date: Thu, 16 Feb 2023 20:34:18 +0800 Message-Id: <20230216123419.461016-16-bhe@redhat.com> In-Reply-To: <20230216123419.461016-1-bhe@redhat.com> References: <20230216123419.461016-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B01BB4001A X-Rspam-User: X-Stat-Signature: 45j51e6n449r79fh9x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oZ03l2CqYLSfuWRNzK2YiNQbTMOgmVm957RJboKXC09LK5igrXvEB2NbEdl9LBR99N3ECrLD5zy6IRUA4MvXbBKgNKGJ6y82dwRPoW2clb6/SyGr9OaE2hVtGPgUhAu5y1mhKn0ectBOGkRUuSytH2layIWWEK9pVRkRmP5W6QpoAo7ErQjK8j61qVf8VxkDO6BUhnlxAe8iXemh5xygORSBmdeNf5U6IexuipqOJDQYZT2H9JDix2XM1Neae4j5VsT6/herOsztSxd0sVGW09BdGwY8jAXbpckSfIFU6/ScttMwf8hllWkbkp1hgRh2KER0ScupB1KjJSS2Og7zr9+Q5zWPCDhmhC57NODQ6eMRXyhPbXTsxR 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 Cc: Catalin Marinas Cc: Will Deacon Cc: Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org --- 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