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: 116776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2656911vqx; Thu, 6 Jul 2023 08:51:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlHv5A1/bGrMhUUgJG2ePLEUOIdkj3UPrwVliBq1TAKuXK3w6K/9YvxKlE7vD1HYvLB7DIBw X-Received: by 2002:a17:902:ecc1:b0:1b6:a37a:65b7 with SMTP id a1-20020a170902ecc100b001b6a37a65b7mr9097623plh.23.1688658678666; Thu, 06 Jul 2023 08:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688658678; cv=none; d=google.com; s=arc-20160816; b=CdOpETlqjpAX+9eommJbcElUsl8hfwzxzVB5sR4LSsW3xM99NGGAl7gqGged8HFgBc b2fPOA00nxXpn9vif+tzaXKentvePqKLAN3GuSElu8IeqLPOdK5plW5mH+IQjE3Bf+7n F6ZczHVeT1aFDggHn2YRrMdjyZ9KbO9nWy5OUbmNF3PgegUvgjK12On09kHT3TVjDYSR 6v3syWdRTd8VZp3HlIKXywDx0xV75RCyLAdteK/NKPuX8tDuqyKraR4Mt6rHrF9Tnuoh Ma/NwvOFFZWh53MMFt3NXEO5OYnuYDE+FJYT87pUYlv7+2W3qRlgjWXhKWZfXSkuMFRB 3IpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ufnbHw3CFVXR+TCLfdbzkgDAqTOwnZtETnnpIP+Ntq0=; fh=thKCWSszaxV4iUnX5NXNFwuEEAZRmqK090QLhI33OJc=; b=pXcdsQWA/QomEQ9uoMXbdl066zrCo1nazDguMAIEPeD8jBIX5F9wEfrHWOjR7KQMXj 4G53kXn7l2EMtWYTkclM5khgk1F6oBgmR+CdBc+NIKSU/6XJlt50gaeZnKrr+3ojJfV/ OMfwTORq+1RcBlBriOPcv2+zt+eX8ej0Xsd8keR78k7wH+TFNlBqrCHXZJL5aOctxEFA bfEVmIFnzjNe7wDL/4ZG0JAxoUvqGgiLWQsYzpWFd3oBTXS6a6QG8KzTLJu+KQkMDGs0 EMdTxh1tdXtlE2Rl3JoUKCRISkMZEUl19ARKghvcR0uHHL4WxpvrtGR3BZq3tCfYIOCV n7VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gQ4T53wA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a1709027e8200b001b8c47563e7si1292548pla.28.2023.07.06.08.51.05; Thu, 06 Jul 2023 08:51:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gQ4T53wA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233406AbjGFPuA (ORCPT + 99 others); Thu, 6 Jul 2023 11:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232865AbjGFPt3 (ORCPT ); Thu, 6 Jul 2023 11:49:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48E2626A2 for ; Thu, 6 Jul 2023 08:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688658515; 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=gQ4T53wAhScScy+R2kitWNiUeremIyJ+YlEdm1ktq3Z2l+5ccFkoAkFjJKlTMQX44ahT8o mXaFNS1FFi5DZ3gNK6WHERin6sAyIMzngu01Pl8uKUaZgqWx54snc+isK/Qq4HdCkXIEAC 8zZ8x2NdKi376tD3l9qhdUxV9jRemSU= 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770686962594267130?= X-GMAIL-MSGID: =?utf-8?q?1770686962594267130?= 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