From patchwork Thu Jul 6 15:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13303977 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 376C3EB64DD for ; Thu, 6 Jul 2023 15:48:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EF918D0003; Thu, 6 Jul 2023 11:48:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29FCB8D0009; Thu, 6 Jul 2023 11:48:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F1B08D0003; Thu, 6 Jul 2023 11:48:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E9D158D0009 for ; Thu, 6 Jul 2023 11:48:40 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A2ED180715 for ; Thu, 6 Jul 2023 15:48:40 +0000 (UTC) X-FDA: 80981619600.09.5704AD0 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 187C4A0017 for ; Thu, 6 Jul 2023 15:48:36 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Sx4fWw8I; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688658517; 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=ufnbHw3CFVXR+TCLfdbzkgDAqTOwnZtETnnpIP+Ntq0=; b=nyN6ZlZ/6RuXfLpn6AwsT1bhV+k2njasaz4scxvHyNHyxzSx2Dk2x+1kHnfUPiShZ0pKxX ViTXJAhndz54ZeIy3T6MkosPvHi2MsLy2+M/sZ6Le8itTjMV25azoWHn5AH7k+Tgvq0p2c Fh5MUagjY0gkcwtz8bXWSoHdveEumgo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Sx4fWw8I; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688658517; a=rsa-sha256; cv=none; b=EKys2bXbIhGMyQZnnR4URSALe2KzClHoyKcfbokQzDa1noj0aSs6FrwXCB77gFpI/m7N1i SMmbliW75YkK2q1kerq5RJggmXRLVWLq3x7CVC4Lfauk186TzBuBwiRZ6PKl66V4wBcWUL 0ctnevdtMGEo7sKxw3uaTlTp0+gA2dg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688658516; 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=ufnbHw3CFVXR+TCLfdbzkgDAqTOwnZtETnnpIP+Ntq0=; b=Sx4fWw8InogqgIrPHmgml8GbaD5Sqki9xDAko3wm+eZ+1WmHUs8J5lZPaw4uF0IgdpBlSW pXBeLVTNEaimSnEygH4MY/68o/eNyJQR+q/QkbcmDPLUeAAqM9WbRWOEZ6tSVy0o9JEoaq nTHgbo8v/NcMTcDRr/iYMfqQXDNwajY= 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-466--F65NclnMjCNxuCBTdT-Kg-1; Thu, 06 Jul 2023 11:48:25 -0400 X-MC-Unique: -F65NclnMjCNxuCBTdT-Kg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 723012815E3A; Thu, 6 Jul 2023 15:48:24 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-39.pek2.redhat.com [10.72.12.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99A41F5CF0; Thu, 6 Jul 2023 15:48:15 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.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, shorne@gmail.com, David.Laight@ACULAB.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 v8 18/19] arm64 : mm: add wrapper function ioremap_prot() Date: Thu, 6 Jul 2023 23:45:19 +0800 Message-Id: <20230706154520.11257-19-bhe@redhat.com> In-Reply-To: <20230706154520.11257-1-bhe@redhat.com> References: <20230706154520.11257-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspam-User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vRZdM3L8AmiKNdfgL0SJ A4sOM3Fg pMUKXzRXy9knBDsRjYnMxME42P5OijPxTJCPZ75Vnv9AGCp6RKXZTx8C9x8ZQA/bZ7PeCDmUBlUvl4fAH3a/ov4Z2UQQtoR/1jK5EQJdjYqE3Uj4z7yJKULsrWyo36ODTIdakEeikVfBRN9J6UyK44jZdGLguGtdZd0JiwFyiTeilMM0Au6XyKFhp62zbI7yF3C4pQCtgon21Ou0NZUorqtNj56ExbuisEgvpel6/ZLHI0a+4ln5hlHFw5hid0O5LGw9vsxvZqykpgj3XPPtnWY7lO3WFXmOL/pIoXHIeWoPb7WvX2UTUgF4EvNkjb6mwDKbnX/97Vqe/Q7yB/QbGEwNW2Ec6kBeAuO6tDG12464lKUnWJCvDde3DkBEOgOSF8Q/jhYK2tq2psReiJhgH2h5OKyPrUSd1EEYn4forwoc0LFM= 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 51d92abf945e..3b694511b98f 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