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: 94007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6787161vqo; Mon, 15 May 2023 02:35:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42PX8h03ja3ga3pDJQe4yM8krVyPieLFpH2hkPsSlBCj2Ni9dEniHV0rsEqFuRZKDbj2A8 X-Received: by 2002:a05:6a20:7355:b0:104:1155:10ee with SMTP id v21-20020a056a20735500b00104115510eemr7401084pzc.58.1684143341552; Mon, 15 May 2023 02:35:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684143341; cv=none; d=google.com; s=arc-20160816; b=aDPvxVx33w+0SB7U/WQzZNrqXreOQhAHZmRw5Mbq6uIE7VhHOs8ogEPN9Ow7rBtEWw 8RxOZngZJrNdtraMsSU4qoqTTr5ximELHxKr2APJtlsJZ2p27ar2tq4LVhuTbQIcdd59 S9BH5Q178lixkrINNujcUBxQ2rfgyvzotvGTDEPzZxNurFcdcGpzD/PSmn7l/8zssPqA Dcw40ZkKTYnJwbHYhQhWuS4Y18upNUAx82uQ35aj8M3/qE/BapkcFxyOY/Iy3auIKlxF IpQpas03PF+MSdeDUTIbiv9UsKUv5fo87RfOnNA2NnMgYfMOY6heWTuhxGoDARkUxiGe 23tw== 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=qE+zf2yG3U5XZ1GPvj+t+kX2BtRW0PoSBcAy/uzHAnk=; b=DF/tM2ydDLR2syIAXmLrHHwJ2UNLxcfRPDZfq8r77++9CqL7gf+JCcLihs7I6Th8Im IwE1yB84I2LjcpGiNRZKqCu3RpB9xnNmJ+0+hVqEd5hjO+jBnE1trkHs5Fnmz+YMg8oO 1vPx4KN1EV1rh4unBD0JPz9vGvi5JmW1vIIFhUAipqI6ghqbnJcbxmc3kQ7+6Xw8ksfq 8ZyadJSWkqNKeNvYRjeNRDBy0hkjQ5Qq1p6VAYAA/31b8HNVoL9NSSt7OiorlGHXlDmg PB+oHxbYmMjt4PltREPBkCpCO6kUCSCUoNHQZDX/JXo4HUMV3nz4Sc+naYM2qN2Zq63H q+hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="IPT7s/Tf"; 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 f20-20020a63f114000000b005309f24f93esi6781954pgi.587.2023.05.15.02.35.28; Mon, 15 May 2023 02:35:41 -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="IPT7s/Tf"; 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 S233430AbjEOJP5 (ORCPT + 99 others); Mon, 15 May 2023 05:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbjEOJPD (ORCPT ); Mon, 15 May 2023 05:15:03 -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 68BF91BE3 for ; Mon, 15 May 2023 02:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684141883; 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=IPT7s/TfYNBAe/j0DZbNm1fr6oDgxyvXifNPCyqHkrGAnWcBfdY5JMHAhIBqERkMWO0DyR fJtBADPW8w5S5q+o3jP2Lg/2lEmZdGVKIHL7YF/pxIkJVYeawl641mbWM7TioGoNPTGsIu 3RcxAb/JFtdmNji4O4Uv+udIqb9I1pI= 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-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_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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?1765952288281463188?= X-GMAIL-MSGID: =?utf-8?q?1765952288281463188?= 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 --- 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