From patchwork Tue Jun 20 13:13:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13285846 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 ED85AEB64D8 for ; Tue, 20 Jun 2023 13:18:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94A0D8D0005; Tue, 20 Jun 2023 09:18:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F9BE8D0003; Tue, 20 Jun 2023 09:18:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C21C8D0005; Tue, 20 Jun 2023 09:18:29 -0400 (EDT) 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 6D5138D0003 for ; Tue, 20 Jun 2023 09:18:29 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1DA3440F88 for ; Tue, 20 Jun 2023 13:18:29 +0000 (UTC) X-FDA: 80923180338.03.0D85C4C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 549CFA001F for ; Tue, 20 Jun 2023 13:18:26 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=U63JWqWq; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.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=1687267107; 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=72w03eJEhQqo4F/RBmYdJ2/NuxxsDP8AZF6XbBTG/zk=; b=49ksuRGxmh4P6p1a0yAMAZK3tpLsoXQEbO92LYxubKqGT/7Jefne2/iJYyn4k8Y7XQhtc0 qSWtWpVc6Jx00dRnt4e9ytQ1mnAOY/xM5kcDjUwgJ6eh2XIHnwKdEEqfCeuxkivCpC/XIn pqXTz8DJd0RCwECwdJTXBMhm2Raw41M= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687267107; a=rsa-sha256; cv=none; b=e2WI1HuQweFbuXwaB01BVacKi81mi36Px2LJr1uA0O68LLlBvFFBs5mksVwx2fFB2/6X4R WOIsckoqWncwqCFq37zRcGNCB7S/ezq6X1wDAVxkOIcHkMRsiCFsb74p0S9oX2UlRBSj9a PL+dW/Q3P5Bwy7PM2heaK4xRtNOeKgY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=U63JWqWq; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687267106; 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=72w03eJEhQqo4F/RBmYdJ2/NuxxsDP8AZF6XbBTG/zk=; b=U63JWqWqzp+HCHKw6GoSZnSadTvotcDRklom0xm0wy4MylbeV/Zq5c8v7VCe0ja+LJBEL5 rrkIsS10sSLBuzD+3UInBdmzs0qqJtIRCZoLn7mQwwbZi+ttvZT3SFOE5k6B/lq+glc4u6 1BsogvMmOMilH7Q3jSCG6swZ/yf/UDc= 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-494-IvFW2tAHNyCwbGqZN7_6DA-1; Tue, 20 Jun 2023 09:18:22 -0400 X-MC-Unique: IvFW2tAHNyCwbGqZN7_6DA-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 F3289185A795; Tue, 20 Jun 2023 13:17:01 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-166.pek2.redhat.com [10.72.12.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9852C1ED96; Tue, 20 Jun 2023 13:16:52 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.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, David.Laight@ACULAB.COM, shorne@gmail.com, deller@gmx.de, nathan@kernel.org, glaubitz@physik.fu-berlin.de, Baoquan He , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH v7 18/19] arm64 : mm: add wrapper function ioremap_prot() Date: Tue, 20 Jun 2023 21:13:55 +0800 Message-Id: <20230620131356.25440-19-bhe@redhat.com> In-Reply-To: <20230620131356.25440-1-bhe@redhat.com> References: <20230620131356.25440-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-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DRP1Y1RnXU9vw MYE+CxUc koeKjN/WhMY4nGGP08prqg0B+AAFnnopY6Ofu5m0ZVLfxkivNJgFU8RvtuZOm9Q6KCexGtqM3DE1AW/74GDcA9FieZ7EzNwnoq+eF08K/FRos+ak6N+VtrkQqOYZ2LYbAqfkDlWPAfCzKFNxsL+5T8IQNBOE3MRBi4Qsyz0H6Uw7hMxY1zr0BwVC6fnJDYhh3u83fbcyGANesdzl7HLTSWXYeUwR3QmANCoFP5bxPh7k/DLj3chpJPfJpEHxnmSxHxb8N0TlwWaSqBT/R0+unY4nP1by7vx9LeAiJq/7EkYVmm4+93iND5giv9AWVseE9rz660XoNHn56v+HtSTwfucX0OnyHKwl9UPD4GHW1rqsEtZ87kCcbLAxYmMxwMzm1TKfvxMXxUHu/myWNemANAChJo0iw3qRjyDX8oKsJe/EgTgM= 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 Reviewed-by: Christoph Hellwig Reviewed-by: Kefeng Wang Reviewed-by: Mike Rapoport (IBM) Acked-by: Catalin Marinas Cc: Catalin Marinas Cc: Will Deacon 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