From patchwork Fri Jun 24 04:43:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 12893720 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 6DD81C43334 for ; Fri, 24 Jun 2022 04:44:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2A0D8E01C9; Fri, 24 Jun 2022 00:44:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD9248E01BF; Fri, 24 Jun 2022 00:44:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC9458E01C9; Fri, 24 Jun 2022 00:44:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BD93F8E01BF for ; Fri, 24 Jun 2022 00:44:04 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 8F741120B73 for ; Fri, 24 Jun 2022 04:44:04 +0000 (UTC) X-FDA: 79611887208.27.3050F75 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 0FD6E80029 for ; Fri, 24 Jun 2022 04:44:03 +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 7563413D5; Thu, 23 Jun 2022 21:44:03 -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 AC2FD3F66F; Thu, 23 Jun 2022 21:43:55 -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 01/26] mm/mmap: Build protect protection_map[] with __P000 Date: Fri, 24 Jun 2022 10:13:14 +0530 Message-Id: <20220624044339.1533882-2-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-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656045844; 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=L/aTKeyagd+6c3+AUPwir29JGT+JMm6sQfr/o+vk4VI=; b=eyy8BfXHf8Y0zSdiDzuYRkHMnlUqWFzwdHDUMJ5QQ/OPTvyFnvYcCfH1YNuXGwBapu0vYt 6x6fgnVPa4wFSSlb9sZl9VNKivEufAIP3Jm6KTiaVEv1GxIorHVwY6ce1Yu9rRIdPgZ/nx vdmwQrftrKxNds3Jxw5EX+0Eul4Dllg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656045844; a=rsa-sha256; cv=none; b=PGJoC7b5sOVXBnYnOGdhoihyJYgYftoHSzOan97FJPIogs9hGYFIB6oFbEmNpau+1av+WE CodlJdXaljFr5jrxYFOJ2vOfAeAyDZGUpFmOfZEQQEv75wGaG4NapCeImtUIXzpU/ibU9j aJUHtK5e/SdlDGqlyKB1Fp4quZG+9dU= X-Stat-Signature: mkd7q7c3eybz37n9f6jd5n6imx5uyji8 X-Rspamd-Queue-Id: 0FD6E80029 X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam02 X-HE-Tag: 1656045843-818651 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: Build protect generic protection_map[] array with __P000, so that it can be moved inside all the platforms one after the other. Otherwise there will be build failures during this process. CONFIG_ARCH_HAS_VM_GET_PAGE_PROT cannot be used for this purpose as only certain platforms enable this config now. Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Suggested-by: Christophe Leroy Signed-off-by: Anshuman Khandual Reviewed-by: Christoph Hellwig Reviewed-by: Christophe Leroy --- include/linux/mm.h | 2 ++ mm/mmap.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index bc8f326be0ce..47bfe038d46e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -424,7 +424,9 @@ extern unsigned int kobjsize(const void *objp); * mapping from the currently active vm_flags protection bits (the * low four bits) to a page protection mask.. */ +#ifdef __P000 extern pgprot_t protection_map[16]; +#endif /* * The default fault flags that should be used by most of the diff --git a/mm/mmap.c b/mm/mmap.c index 61e6135c54ef..b01f0280bda2 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -101,6 +101,7 @@ static void unmap_region(struct mm_struct *mm, * w: (no) no * x: (yes) yes */ +#ifdef __P000 pgprot_t protection_map[16] __ro_after_init = { [VM_NONE] = __P000, [VM_READ] = __P001, @@ -119,6 +120,7 @@ pgprot_t protection_map[16] __ro_after_init = { [VM_SHARED | VM_EXEC | VM_WRITE] = __S110, [VM_SHARED | VM_EXEC | VM_WRITE | VM_READ] = __S111 }; +#endif #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT pgprot_t vm_get_page_prot(unsigned long vm_flags)