From mboxrd@z Thu Jan 1 00:00:00 1970 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 3A6B2C433EF for ; Tue, 28 Jun 2022 03:12:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7BC88E0002; Mon, 27 Jun 2022 23:12:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B050C8E0001; Mon, 27 Jun 2022 23:12:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A6C18E0002; Mon, 27 Jun 2022 23:12:36 -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 8B9CE8E0001 for ; Mon, 27 Jun 2022 23:12:36 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5F9DC34258 for ; Tue, 28 Jun 2022 03:12:36 +0000 (UTC) X-FDA: 79626171912.08.BD6439D Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf25.hostedemail.com (Postfix) with ESMTP id 434C1A0027 for ; Tue, 28 Jun 2022 03:12:35 +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 71983150C; Mon, 27 Jun 2022 20:12:34 -0700 (PDT) Received: from [10.162.42.7] (unknown [10.162.42.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D7AC3F792; Mon, 27 Jun 2022 20:12:26 -0700 (PDT) Message-ID: Date: Tue, 28 Jun 2022 08:42:24 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH V5 04/26] sparc/mm: Move protection_map[] inside the platform Content-Language: en-US To: Sam Ravnborg Cc: linux-mm@kvack.org, hch@infradead.org, christophe.leroy@csgroup.eu, 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, "David S. Miller" References: <20220627045833.1590055-1-anshuman.khandual@arm.com> <20220627045833.1590055-5-anshuman.khandual@arm.com> From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656385955; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FCVJDIRHE1WZhir2Yl2hUV6UihwIk7yRFkTqTP94toY=; b=Rc0H2d7OQ5eh5bRiHfJIuTDZDSCyM6D21Rh5ocJ9ZVtiRt48DrFXK11bOS5MXpjMyTq/Uk 3LGaTV6HTuesanMg32EI/kJJb6Im6WwCx6OXeHeqtQvELbHU/VD4gcawsOJYsG06F/bRqa 7UTM2imXCgzVnWDVHwhv1KaaQcSXpqg= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf25.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656385955; a=rsa-sha256; cv=none; b=jh8aQclvdZtdH7bM0bZCwZoDX3ZuH++e6h52ftJStUEhaymGniheF87xpnCepYFNoJ/6Sr kSVtuRkrdHukRdSQzRTfFq7CDuWiF0SeBGm+MM09bHrIt4hvTBSaYvhJwbW3NrnMlgaaoq peFDhT3uGbeqG+DUhO+T3JxvIe9DYro= X-Rspamd-Queue-Id: 434C1A0027 Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf25.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: rspam11 X-Stat-Signature: swdoeup148myphaym4jmj8ec6fbgdedt X-HE-Tag: 1656385955-457096 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: On 6/27/22 22:44, Sam Ravnborg wrote: > Hi Anshuman, > > On Mon, Jun 27, 2022 at 10:28:11AM +0530, Anshuman Khandual wrote: >> This moves protection_map[] inside the platform and while here, also enable >> ARCH_HAS_VM_GET_PAGE_PROT on 32 bit platforms via DECLARE_VM_GET_PAGE_PROT. >> >> Cc: "David S. Miller" >> Cc: sparclinux@vger.kernel.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> arch/sparc/Kconfig | 2 +- >> arch/sparc/include/asm/pgtable_32.h | 19 ------------------- >> arch/sparc/include/asm/pgtable_64.h | 19 ------------------- >> arch/sparc/mm/init_32.c | 20 ++++++++++++++++++++ >> arch/sparc/mm/init_64.c | 3 +++ >> 5 files changed, 24 insertions(+), 39 deletions(-) >> >> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig >> index ba449c47effd..09f868613a4d 100644 >> --- a/arch/sparc/Kconfig >> +++ b/arch/sparc/Kconfig >> @@ -13,6 +13,7 @@ config 64BIT >> config SPARC >> bool >> default y >> + select ARCH_HAS_VM_GET_PAGE_PROT >> select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI >> select ARCH_MIGHT_HAVE_PC_SERIO >> select DMA_OPS >> @@ -84,7 +85,6 @@ config SPARC64 >> select PERF_USE_VMALLOC >> select ARCH_HAVE_NMI_SAFE_CMPXCHG >> select HAVE_C_RECORDMCOUNT >> - select ARCH_HAS_VM_GET_PAGE_PROT >> select HAVE_ARCH_AUDITSYSCALL >> select ARCH_SUPPORTS_ATOMIC_RMW >> select ARCH_SUPPORTS_DEBUG_PAGEALLOC >> diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h >> index 4866625da314..8ff549004fac 100644 >> --- a/arch/sparc/include/asm/pgtable_32.h >> +++ b/arch/sparc/include/asm/pgtable_32.h >> @@ -64,25 +64,6 @@ void paging_init(void); >> >> extern unsigned long ptr_in_current_pgd; >> >> -/* xwr */ >> -#define __P000 PAGE_NONE >> -#define __P001 PAGE_READONLY >> -#define __P010 PAGE_COPY >> -#define __P011 PAGE_COPY >> -#define __P100 PAGE_READONLY >> -#define __P101 PAGE_READONLY >> -#define __P110 PAGE_COPY >> -#define __P111 PAGE_COPY >> - >> -#define __S000 PAGE_NONE >> -#define __S001 PAGE_READONLY >> -#define __S010 PAGE_SHARED >> -#define __S011 PAGE_SHARED >> -#define __S100 PAGE_READONLY >> -#define __S101 PAGE_READONLY >> -#define __S110 PAGE_SHARED >> -#define __S111 PAGE_SHARED >> - >> /* First physical page can be anywhere, the following is needed so that >> * va-->pa and vice versa conversions work properly without performance >> * hit for all __pa()/__va() operations. >> diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h >> index 4679e45c8348..a779418ceba9 100644 >> --- a/arch/sparc/include/asm/pgtable_64.h >> +++ b/arch/sparc/include/asm/pgtable_64.h >> @@ -187,25 +187,6 @@ bool kern_addr_valid(unsigned long addr); >> #define _PAGE_SZHUGE_4U _PAGE_SZ4MB_4U >> #define _PAGE_SZHUGE_4V _PAGE_SZ4MB_4V >> >> -/* These are actually filled in at boot time by sun4{u,v}_pgprot_init() */ >> -#define __P000 __pgprot(0) >> -#define __P001 __pgprot(0) >> -#define __P010 __pgprot(0) >> -#define __P011 __pgprot(0) >> -#define __P100 __pgprot(0) >> -#define __P101 __pgprot(0) >> -#define __P110 __pgprot(0) >> -#define __P111 __pgprot(0) >> - >> -#define __S000 __pgprot(0) >> -#define __S001 __pgprot(0) >> -#define __S010 __pgprot(0) >> -#define __S011 __pgprot(0) >> -#define __S100 __pgprot(0) >> -#define __S101 __pgprot(0) >> -#define __S110 __pgprot(0) >> -#define __S111 __pgprot(0) >> - >> #ifndef __ASSEMBLY__ >> >> pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); >> diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c >> index 1e9f577f084d..8693e4e28b86 100644 >> --- a/arch/sparc/mm/init_32.c >> +++ b/arch/sparc/mm/init_32.c >> @@ -302,3 +302,23 @@ void sparc_flush_page_to_ram(struct page *page) >> __flush_page_to_ram(vaddr); >> } >> EXPORT_SYMBOL(sparc_flush_page_to_ram); >> + >> +static pgprot_t protection_map[16] __ro_after_init = { > This can be const - like done for powerpc and others. > sparc32 and sparc64 uses each their own - and I do not see sparc32 do > any modifications to protection_map. Indeed protection_map[] arrays are independent both for sparc32 and spacr64. sparc32 platform never changes the protection_map[] array during boot. Sure, will make it into a const instead. Thanks for pointing this out. > > With this change: > Reviewed-by: Sam Ravnborg >