Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp51138iog; Thu, 23 Jun 2022 22:09:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uFOE8aXyhpQTOzMZu2cOGhrCLgREHxCzLkbGmp1BrU8AM7m1rkrDf0ICzD/SzA2ZS6vBZY X-Received: by 2002:a05:6a00:1305:b0:512:eb1e:7921 with SMTP id j5-20020a056a00130500b00512eb1e7921mr44056923pfu.13.1656047346776; Thu, 23 Jun 2022 22:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656047346; cv=none; d=google.com; s=arc-20160816; b=nw+VU+QU99YC0ei1SAwFXgTUDcdN2JRnmckBG8Nvt8r4dvwQ3E2GMqfxGB8gT06PCG 4FBmHwHNh9Pv3uZyF4brjMMe4+bu+UZF9DWWG4jYHVy2KfDZGlEnnaEdz6ww9IDBNGgt kds1TYDjwPpkUCs2GNEjA1P1OybLrEnrENUCZVkf7ZGF15B6TskiJhE64Lg4TKo+6xHB hrX6yc15slFYZ57CUD3D4Z2KutLxG6d3KQeAod6olNzSdYPOVSM5p+aUOvo2ruVjA/gH aYOoLMTBSTjXJXHg2X6zZEJSnFJfrdkycq9t3f2UVDIdyMnRbzdBcOZVOF116bURoaoK RPCw== 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; bh=FkiyghNuBU6Vn+c6P66DwdJGr0cI9NmJh3lkHsrGRMA=; b=O0XqgR7/mZjaa+S9ik4tjlBz8bPhgwOwfABoLA9nLZvC3kLv33Cxgeoe2S7GBF6i5T wKa24rsS3YCWkUKPc7YsJnoO9uI8DBJ1TpkrT/Te18S4rZFWnFzZYYQC+7yPXX3sSBE0 8WrVaXV4GszN3GinECTIs3usMwpNRNAf9eCoi6qNlDWiDCP7MdZobeVZnprN+wb6gn0c PoFGRjWvnNAw5Nk1Booa1hqkdm5cxlSTMXLtFVw1DUEjrnAdczzlep6WH9DeSIyP5/q9 UuUvXd38KlZYGWXuINvBsF4lvLO1isRJa11Aoe0DjFdlDKtFZ7RlpeyowHQuFrJy2A3J xxfg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a170902ec8c00b0016a3d7b55dasi2303276plg.17.2022.06.23.22.08.54; Thu, 23 Jun 2022 22:09:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbiFXEo2 (ORCPT + 99 others); Fri, 24 Jun 2022 00:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbiFXEoN (ORCPT ); Fri, 24 Jun 2022 00:44:13 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0D1F53A5B; Thu, 23 Jun 2022 21:44:11 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A45AD1474; Thu, 23 Jun 2022 21:44:11 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.41.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BD4713F66F; Thu, 23 Jun 2022 21:44:03 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: hch@infradead.org, christophe.leroy@csgroup.eu, Anshuman Khandual , Andrew Morton , linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, x86@kernel.org, openrisc@lists.librecores.org, linux-xtensa@linux-xtensa.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-parisc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-um@lists.infradead.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT Date: Fri, 24 Jun 2022 10:13:15 +0530 Message-Id: <20220624044339.1533882-3-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624044339.1533882-1-anshuman.khandual@arm.com> References: <20220624044339.1533882-1-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, 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 This just converts the generic vm_get_page_prot() implementation into a new macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any functional change. Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Suggested-by: Christoph Hellwig Signed-off-by: Anshuman Khandual --- include/linux/mm.h | 8 ++++++++ mm/mmap.c | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 47bfe038d46e..237828c2bae2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -428,6 +428,14 @@ extern unsigned int kobjsize(const void *objp); extern pgprot_t protection_map[16]; #endif +#define DECLARE_VM_GET_PAGE_PROT \ +pgprot_t vm_get_page_prot(unsigned long vm_flags) \ +{ \ + return protection_map[vm_flags & \ + (VM_READ | VM_WRITE | VM_EXEC | VM_SHARED)]; \ +} \ +EXPORT_SYMBOL(vm_get_page_prot); + /* * The default fault flags that should be used by most of the * arch-specific page fault handlers. diff --git a/mm/mmap.c b/mm/mmap.c index b01f0280bda2..55c30aee3999 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -123,11 +123,7 @@ pgprot_t protection_map[16] __ro_after_init = { #endif #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT -pgprot_t vm_get_page_prot(unsigned long vm_flags) -{ - return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]; -} -EXPORT_SYMBOL(vm_get_page_prot); +DECLARE_VM_GET_PAGE_PROT #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */ static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags) -- 2.25.1