From patchwork Fri Jun 24 04:43:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 12893721 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 704BDC43334 for ; Fri, 24 Jun 2022 04:44:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3ABB8E01CA; Fri, 24 Jun 2022 00:44:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEA9E8E01BF; Fri, 24 Jun 2022 00:44:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD99E8E01CA; Fri, 24 Jun 2022 00:44:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CF63D8E01BF for ; Fri, 24 Jun 2022 00:44:12 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id A57F660AE7 for ; Fri, 24 Jun 2022 04:44:12 +0000 (UTC) X-FDA: 79611887544.27.CCC3518 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf27.hostedemail.com (Postfix) with ESMTP id 2FFB340015 for ; Fri, 24 Jun 2022 04:44:12 +0000 (UTC) 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656045852; a=rsa-sha256; cv=none; b=uQLRx8iHYTmZgXpsf/NyXZrLzEX4WhWUTP66EH2W8damSoJQJ67XMzlzQfaTSqHdykE0P6 NBlS3MPxpHFOv+rSjSrcqtDl9fsEVKmLX0RLrvTRXnKHwIckxZA3IfEcYI8KRa9kqrWaNK VeBQk6/3T6nvw/IIaDDSVGS9uMFv2n0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656045852; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FkiyghNuBU6Vn+c6P66DwdJGr0cI9NmJh3lkHsrGRMA=; b=CP232V8hJ02dqsTs6BQG8WzXN2aZZGSRg++pDdSnJL2qAIg/Kwx56iqcDsmfv6TGSDcT8D MceZ5e5a4uGA3OMIrmUfcpZrHVKtcGZiM/lGo/bEx/SJv94wunlN14LCG4M9w9BIU1UGVV 7cZKzWu3VSAnN2m/94m8GiiPq3po47A= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Stat-Signature: 5gtre463pwwg3du9fe3d5cezbb7iwik6 X-Rspamd-Queue-Id: 2FFB340015 Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1656045852-698183 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: 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 Reviewed-by: Christophe Leroy --- 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)