From patchwork Fri Jun 9 07:55:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13273368 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 65F62C7EE25 for ; Fri, 9 Jun 2023 07:57:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F19428E000D; Fri, 9 Jun 2023 03:57:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E54278E0005; Fri, 9 Jun 2023 03:57:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1D5A8E000D; Fri, 9 Jun 2023 03:57:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BB7A28E0005 for ; Fri, 9 Jun 2023 03:57:56 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9CED6AE912 for ; Fri, 9 Jun 2023 07:57:56 +0000 (UTC) X-FDA: 80882455752.29.A0A3931 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf03.hostedemail.com (Postfix) with ESMTP id D6E062001A for ; Fri, 9 Jun 2023 07:57:54 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QYbn12ur; spf=pass (imf03.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=1686297474; 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=81nV18C3v1lk6vsTsYHvlL2VrwGGV2i7WxKaTwXwgOE=; b=ELkVtCZjoNBMmBvAAW+WiT+I5q4BmhVtEaY3cGER5SFbi/SRdtnvCokIHI0hg4Az7pe0R3 uLWIGqw5eXnYMKJZfGPRqh4XDYFC13Rf6poNZZDhnCqOGFZp1q4rSsrNRn5XfV/NkAq48h gBZtI8fTO9Q7Zc7kQykFFN8ej+QwajU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686297474; a=rsa-sha256; cv=none; b=jag2lcCpxp4SiDyVi0DqY4n6lOAR5V0oP1Ty/wxhGOv8zQrFr+ROo2jSC1w7sajxEM5r0T EizoM3b6vrPF0GKRwUKektXJegcPZ4Eq3FMacJ0WYSMwzAWx8duMlrfkiDxvQdvrSkQKcA 31nbl3AJF8tbcixcQM73PWzLren/eYg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QYbn12ur; spf=pass (imf03.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686297474; 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=81nV18C3v1lk6vsTsYHvlL2VrwGGV2i7WxKaTwXwgOE=; b=QYbn12urwrYDvLlrgdjoCyjR7ChtZURo6ihuP9Ev/NVjzTZjk2Q458xfsfBah2C462DFOR VsiMneVuS9Hxpl4Z54Ls9Z4pVzpQXSryOllkOWsHN+/LRDVgEPwkDI+XbPGANVHYXE8/Yb 621j+5KDaTWdkwhu3iKbNY18k9lf7Us= 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-147-ka62SOjHPdCC3QS6MTgItw-1; Fri, 09 Jun 2023 03:57:45 -0400 X-MC-Unique: ka62SOjHPdCC3QS6MTgItw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A34AD3C0CEF9; Fri, 9 Jun 2023 07:57:44 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-92.pek2.redhat.com [10.72.12.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B08E20268C7; Fri, 9 Jun 2023 07:57:37 +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@lst.de, 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, Baoquan He , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 18/19] arm64 : mm: add wrapper function ioremap_prot() Date: Fri, 9 Jun 2023 15:55:27 +0800 Message-Id: <20230609075528.9390-19-bhe@redhat.com> In-Reply-To: <20230609075528.9390-1-bhe@redhat.com> References: <20230609075528.9390-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: D6E062001A X-Rspam-User: X-Rspamd-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Ssa+ElPR/wWnLxpHdlBSesSpbXPFm9CIhGL9sWU/l6TUgmk3FGEkXbePgDDUVHM9PKalBFpc7s10pSgCiW/k3zOEMKf3eQ5lxkemLHnTPy8BM6eUOmhoMwq71v91JsWdwD++XeQxsI+/TELcbbCyTLB7Hzuq70jUmGjoO5a9iQyqVszyyND+6UitHaZB/5A0UMnhJxdEqm/kH0trY5RPU1Jh2f2sv8C+1FLaylAWoCWhFz1jou6lid+nKyMOQEh0OTV9CjuY9jAxgt8erOAbzzbXQ/CDDKpT16husXAYtwE2W/JDH/pDCpgN6cFlAdlLnqTQr+aLCzzYaVbxM4NdFsaK1WRWKN6nFQPq52UeMxu9vkuLWXmH9s5/EaDENSSBzD+Zdtw2MzGPSIrzs9yalfZWeoIFAk= 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 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) Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Acked-by: Catalin Marinas --- 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