From patchwork Mon May 15 09:08:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13240997 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 DDFB3C7EE22 for ; Mon, 15 May 2023 09:11:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83A04900009; Mon, 15 May 2023 05:11:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E9CA900002; Mon, 15 May 2023 05:11:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B12C900009; Mon, 15 May 2023 05:11:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5E6B6900002 for ; Mon, 15 May 2023 05:11:18 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 15BEA1C8ACB for ; Mon, 15 May 2023 09:11:18 +0000 (UTC) X-FDA: 80791920636.22.420C998 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 4D6184000D for ; Mon, 15 May 2023 09:11:16 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EITqmBVa; spf=pass (imf12.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=1684141876; 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=qE+zf2yG3U5XZ1GPvj+t+kX2BtRW0PoSBcAy/uzHAnk=; b=qC8k8VTlzdJrsIoEqqUm5y6xO3mFozAkgo4dbiGLNqhR2wmbxZyR2G2lo5+i6J48jrSDl0 +sGqDWQohw8tJccYWmzh89G0ta2ba/s1NGewOhnETiWKo753uaEQsOOTgjKbMoCod6RzCQ flbQyI2+VG+bhC/Lc4pUZ2E0+G8c4Uw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684141876; a=rsa-sha256; cv=none; b=KOjeLvU3x5HsPJHZH9wpGlh5hsBu/5iQ7JuZdbR8HRyiQagoVwpyct2t7MIvzshwy1RoTF zC8JFJMvkYXnVTjYg/Hyrb3hX+V/0foj9SKVUwgUL/moEt3dFsQT9SQmddrQf9/ffEp/VY ZPXSWgjdEXhkHVZ/CeHS5oW6UCutkRU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EITqmBVa; spf=pass (imf12.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=1684141875; 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=qE+zf2yG3U5XZ1GPvj+t+kX2BtRW0PoSBcAy/uzHAnk=; b=EITqmBVaVbsbkY6hSJ8SEgcDs44S6vQk+u3vS+uidu/j5P2OOcAP1fzmwlcuneMl57qERu KyIC/YxpokxGs6khKrv7eMlIkt5oF9clilU1fdAaZhI+cQVnLRt1iP++BK+v7HRlqIh3KQ jf8rfLLttdcaTMM9itJ/VvURez6Ptfg= 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-418-L1t4JuW8MGOUd0mmDgUAjg-1; Mon, 15 May 2023 05:11:07 -0400 X-MC-Unique: L1t4JuW8MGOUd0mmDgUAjg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 224B73814945; Mon, 15 May 2023 09:11:06 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-32.pek2.redhat.com [10.72.12.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D2D840C2063; Mon, 15 May 2023 09:10:58 +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, deller@gmx.de, Baoquan He , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 RESEND 16/17] arm64 : mm: add wrapper function ioremap_prot() Date: Mon, 15 May 2023 17:08:47 +0800 Message-Id: <20230515090848.833045-17-bhe@redhat.com> In-Reply-To: <20230515090848.833045-1-bhe@redhat.com> References: <20230515090848.833045-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: 4D6184000D X-Stat-Signature: 9rxx6i4oujkqbiygpwtan17zdor8ytb4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vRne7VrtjiNz95Vm3IUIjENBfSOawkPAsdGzpRSDHUHhdYrWJsmQwSb0iAPehdy+ijhDepfqfAeT08PbDoDwzbyZ5nQVaeDn4iwW0J/bTN6QvIAgSdigYbMvo+MQf9k0zGz+B138nbu1h3ihQNXtlptBVFpBjlL2QaHa2pEmQ/bBfSKbs72Ubcq/RGKUhRiSaRyeoJhp66b+ZIkmMhrCJyIhIu6IxAmR4T3wtFqVVvdkFS+308+UmdpGa6Ipa6I4/gO6Ar01z16a/f7gZkBiXlOCnaBDTg+y6Do1fw+8bz00/dKxfad0+PGzIo/wb2ttg018hV7u+varPx/7HJstXFeX3wyOIeKTvkz8= 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: linux-arm-kernel@lists.infradead.org Reviewed-by: Mike Rapoport (IBM) Reviewed-by: Christoph Hellwig Reviewed-by: Kefeng Wang --- 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