From patchwork Sun Feb 24 07:13:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Xuerui X-Patchwork-Id: 10827739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B641A922 for ; Sun, 24 Feb 2019 07:15:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F58A2BC62 for ; Sun, 24 Feb 2019 07:15:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92CBA2BC70; Sun, 24 Feb 2019 07:15:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C72042BC62 for ; Sun, 24 Feb 2019 07:15:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbfBXHPF (ORCPT ); Sun, 24 Feb 2019 02:15:05 -0500 Received: from smtpbguseast2.qq.com ([54.204.34.130]:59989 "EHLO smtpbguseast2.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbfBXHPF (ORCPT ); Sun, 24 Feb 2019 02:15:05 -0500 X-QQ-mid: bizesmtp3t1550992497tulpody1y Received: from localhost.localdomain (unknown [116.236.177.50]) by esmtp4.qq.com (ESMTP) with id ; Sun, 24 Feb 2019 15:14:48 +0800 (CST) X-QQ-SSF: 01400000002000C0EF62B00A0000000 X-QQ-FEAT: DfYGKmo6ysRdarnruOfn1Ek+fdyG8muqnNh6eBhHnMwdWzfPYZTpNbm3Zpbb/ Nc9BJIOBO3Yq1xKQw8drMuLAzatnKgzzv/qBgUHCT8IbU8OmLLGw7LLqqtc3QkKrFstjRAf HEod/nINiKUWZHknEYGmT98mx597St57WmHao+7G3t6do7ReKRIoCAPbz1YoZ1Rmlc01E4D q4+8qnZ4urjKMqhaOCVBMz71gwBbXRN38Ow3SrU5+sbLs7DkYWRnoObVlBEUZ1iOemBhXv2 BllVae3Q5m63duL2sf7BWw71PkhLPUWcYc9Q== X-QQ-GoodBg: 2 From: Wang Xuerui To: linux-mips@vger.kernel.org Cc: Wang Xuerui , Huacai Chen , Jiaxun Yang , Alex Belits , James Hogan , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH 1/4] MIPS: simplify definition of TASK_SIZE64 Date: Sun, 24 Feb 2019 15:13:52 +0800 Message-Id: <20190224071355.14488-2-wangxuerui@qiniu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20190224071355.14488-1-wangxuerui@qiniu.com> References: <20190224071355.14488-1-wangxuerui@qiniu.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:qiniu.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a "min" macro in linux/kernel.h, so use it. Signed-off-by: Wang Xuerui Cc: Huacai Chen Cc: Jiaxun Yang Cc: Alex Belits Cc: James Hogan Cc: Ralf Baechle Cc: linux-mips@linux-mips.org --- arch/mips/include/asm/processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index aca909bd7841..c50cba85d145 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -62,7 +63,7 @@ extern unsigned int vced_count, vcei_count; */ #define TASK_SIZE32 0x7fff8000UL #ifdef CONFIG_MIPS_VA_BITS_48 -#define TASK_SIZE64 (0x1UL << ((cpu_data[0].vmbits>48)?48:cpu_data[0].vmbits)) +#define TASK_SIZE64 (0x1UL << min(cpu_data[0].vmbits, 48)) #else #define TASK_SIZE64 0x10000000000UL #endif From patchwork Sun Feb 24 07:13:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Xuerui X-Patchwork-Id: 10827743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E7BB1823 for ; Sun, 24 Feb 2019 07:15:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76EB92BC62 for ; Sun, 24 Feb 2019 07:15:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B9512BC7A; Sun, 24 Feb 2019 07:15:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD5442BC6B for ; Sun, 24 Feb 2019 07:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726459AbfBXHPL (ORCPT ); Sun, 24 Feb 2019 02:15:11 -0500 Received: from smtpbgau1.qq.com ([54.206.16.166]:36456 "EHLO smtpbgau1.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbfBXHPL (ORCPT ); Sun, 24 Feb 2019 02:15:11 -0500 X-QQ-mid: bizesmtp3t1550992504t428kckql Received: from localhost.localdomain (unknown [116.236.177.50]) by esmtp4.qq.com (ESMTP) with id ; Sun, 24 Feb 2019 15:14:58 +0800 (CST) X-QQ-SSF: 01400000002000C0EF72B00A0000000 X-QQ-FEAT: LuumuPbnbyBJ06WUMXmgQOrl6VoQW1uEQvsGo6tg4N0U3CI2ms78M3nxYMnlC kH9dxEjcgONdFJ4uUiBBdSYeKSPFS7UbhQ494BcAOHTybwmvjvUW/HdUlYiJm+G/+7KuONw hDb38GufFkY8ezHmY3sMYFxqyz3Mq/Anq05STjjZ5DqmbJN3RQBAh6+/0qL0P5+eEcqVztf tN7/1OaOfE97mSab7huqVpadat9xEAjCjSMaz2ZttAiBf5qsHq2dp1rCcEMU85uBzhyHpry X+lLQz78jbEnZZKjR+acDVQL4SxBMQNYYQoQ== X-QQ-GoodBg: 2 From: Wang Xuerui To: linux-mips@vger.kernel.org Cc: Wang Xuerui , Huacai Chen , Jiaxun Yang , Alex Belits , James Hogan , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH 2/4] MIPS: refactor virtual address size selection Date: Sun, 24 Feb 2019 15:13:53 +0800 Message-Id: <20190224071355.14488-3-wangxuerui@qiniu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20190224071355.14488-1-wangxuerui@qiniu.com> References: <20190224071355.14488-1-wangxuerui@qiniu.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:qiniu.com:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To facilitate future extensions of VA space, put all VA size selection under a choice section, and add an entry corresponding to previous default behavior. Also, for sharing the implementation, rename the former MIPS_VA_BITS_48 symbol to MIPS_LARGE_VA, but re-use the name in the choice section for config file compatibility. Signed-off-by: Wang Xuerui Cc: Huacai Chen Cc: Jiaxun Yang Cc: Alex Belits Cc: James Hogan Cc: Ralf Baechle Cc: linux-mips@linux-mips.org --- arch/mips/Kconfig | 28 ++++++++++++++++++++++++---- arch/mips/include/asm/pgtable-64.h | 10 +++++----- arch/mips/include/asm/processor.h | 2 +- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index a84c24d894aa..b0068a1e1e33 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2158,12 +2158,27 @@ config KVM_GUEST_TIMER_FREQ emulation when determining guest CPU Frequency. Instead, the guest's timer frequency is specified directly. +choice + prompt "Virtual address size" + default MIPS_VA_BITS_DEFAULT + +config MIPS_VA_BITS_DEFAULT + bool "40 bits or less virtual memory" + help + This is the default setting on MIPS platforms since antiquity, + which gives 40 bits or less of virtual address space, depending on + the CPU. + + If unsure, say Y. + config MIPS_VA_BITS_48 bool "48 bits virtual memory" depends on 64BIT + select MIPS_LARGE_VA help Support a maximum at least 48 bits of application virtual - memory. Default is 40 bits or less, depending on the CPU. + memory. + For page sizes 16k and above, this option results in a small memory overhead for page tables. For 4k page size, a fourth level of page tables is added which imposes both a memory @@ -2171,6 +2186,11 @@ config MIPS_VA_BITS_48 If unsure, say N. +endchoice + +config MIPS_LARGE_VA + bool + choice prompt "Kernel page size" default PAGE_SIZE_4KB @@ -2187,7 +2207,7 @@ config PAGE_SIZE_4KB config PAGE_SIZE_8KB bool "8kB" depends on CPU_R8000 || CPU_CAVIUM_OCTEON - depends on !MIPS_VA_BITS_48 + depends on !MIPS_LARGE_VA help Using 8kB page size will result in higher performance kernel at the price of higher memory consumption. This option is available @@ -2206,7 +2226,7 @@ config PAGE_SIZE_16KB config PAGE_SIZE_32KB bool "32kB" depends on CPU_CAVIUM_OCTEON - depends on !MIPS_VA_BITS_48 + depends on !MIPS_LARGE_VA help Using 32kB page size will result in higher performance kernel at the price of higher memory consumption. This option is available @@ -3070,7 +3090,7 @@ config HAVE_LATENCYTOP_SUPPORT config PGTABLE_LEVELS int - default 4 if PAGE_SIZE_4KB && MIPS_VA_BITS_48 + default 4 if PAGE_SIZE_4KB && MIPS_LARGE_VA default 3 if 64BIT && !PAGE_SIZE_64KB default 2 diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 93a9dce31f25..77a71be71b51 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -18,9 +18,9 @@ #include #define __ARCH_USE_5LEVEL_HACK -#if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_VA_BITS_48) +#if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_LARGE_VA) #include -#elif !(defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS_VA_BITS_48)) +#elif !(defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS_LARGE_VA)) #include #endif @@ -83,7 +83,7 @@ * of virtual address space. */ #ifdef CONFIG_PAGE_SIZE_4KB -# ifdef CONFIG_MIPS_VA_BITS_48 +# ifdef CONFIG_MIPS_LARGE_VA # define PGD_ORDER 0 # define PUD_ORDER 0 # else @@ -100,7 +100,7 @@ #define PTE_ORDER 0 #endif #ifdef CONFIG_PAGE_SIZE_16KB -#ifdef CONFIG_MIPS_VA_BITS_48 +#ifdef CONFIG_MIPS_LARGE_VA #define PGD_ORDER 1 #else #define PGD_ORDER 0 @@ -118,7 +118,7 @@ #ifdef CONFIG_PAGE_SIZE_64KB #define PGD_ORDER 0 #define PUD_ORDER aieeee_attempt_to_allocate_pud -#ifdef CONFIG_MIPS_VA_BITS_48 +#ifdef CONFIG_MIPS_LARGE_VA #define PMD_ORDER 0 #else #define PMD_ORDER aieeee_attempt_to_allocate_pmd diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index c50cba85d145..226cf46cc89c 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -62,7 +62,7 @@ extern unsigned int vced_count, vcei_count; * 8192EB ... */ #define TASK_SIZE32 0x7fff8000UL -#ifdef CONFIG_MIPS_VA_BITS_48 +#ifdef CONFIG_MIPS_LARGE_VA #define TASK_SIZE64 (0x1UL << min(cpu_data[0].vmbits, 48)) #else #define TASK_SIZE64 0x10000000000UL From patchwork Sun Feb 24 07:13:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Xuerui X-Patchwork-Id: 10827741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E50217E9 for ; Sun, 24 Feb 2019 07:15:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55D572BC62 for ; Sun, 24 Feb 2019 07:15:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A4B72BC7A; Sun, 24 Feb 2019 07:15:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BF962BC62 for ; Sun, 24 Feb 2019 07:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfBXHPL (ORCPT ); Sun, 24 Feb 2019 02:15:11 -0500 Received: from smtpbg202.qq.com ([184.105.206.29]:60537 "EHLO smtpbg202.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726459AbfBXHPK (ORCPT ); Sun, 24 Feb 2019 02:15:10 -0500 X-QQ-mid: bizesmtp3t1550992507txx3g4rbu Received: from localhost.localdomain (unknown [116.236.177.50]) by esmtp4.qq.com (ESMTP) with id ; Sun, 24 Feb 2019 15:15:05 +0800 (CST) X-QQ-SSF: 01400000002000C0EG82B00A0000000 X-QQ-FEAT: 92FxZ2TPvnd29DML+O608EXmytofcWCyLdLE6qSbHeMaU8KYSnEZcvEJlaizi lqUA2OCAqkND+tB6NrCjo5ZnKyzeG7TcYLNzoxn3hgWPUREacru/bN9yFSAhhjjWLtLnCDr Ji6Btf6mk+C7RexpFVOHh19aNA3fKKQCjOJnfVpCet0ieYLMdXWADUX/B5Cd7gu1ZRFZwzd nWLBVAT7JpkCvXRZ9K/H3JXjCqFu2X32AW8l3KAu3HHAt3L3QeOHuesKfY6s/wLdDg9UnPn G3kiRkwyYc7borL0Ukz70JqCw= X-QQ-GoodBg: 2 From: Wang Xuerui To: linux-mips@vger.kernel.org Cc: Wang Xuerui , Huacai Chen , Jiaxun Yang , Alex Belits , James Hogan , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH 3/4] MIPS: define virtual address size in Kconfig Date: Sun, 24 Feb 2019 15:13:54 +0800 Message-Id: <20190224071355.14488-4-wangxuerui@qiniu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20190224071355.14488-1-wangxuerui@qiniu.com> References: <20190224071355.14488-1-wangxuerui@qiniu.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:qiniu.com:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To ease addition of new VA sizes, punt the constant in processor.h to Kconfig. Signed-off-by: Wang Xuerui Cc: Huacai Chen Cc: Jiaxun Yang Cc: Alex Belits Cc: James Hogan Cc: Ralf Baechle Cc: linux-mips@linux-mips.org --- arch/mips/Kconfig | 5 +++++ arch/mips/include/asm/processor.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index b0068a1e1e33..a1ab9e7924a0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2191,6 +2191,11 @@ endchoice config MIPS_LARGE_VA bool +config MIPS_VA_BITS + int + default 48 if MIPS_VA_BITS_48 + default 40 + choice prompt "Kernel page size" default PAGE_SIZE_4KB diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index 226cf46cc89c..9119e9a44d9c 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -63,7 +63,7 @@ extern unsigned int vced_count, vcei_count; */ #define TASK_SIZE32 0x7fff8000UL #ifdef CONFIG_MIPS_LARGE_VA -#define TASK_SIZE64 (0x1UL << min(cpu_data[0].vmbits, 48)) +#define TASK_SIZE64 (0x1UL << min(cpu_data[0].vmbits, CONFIG_MIPS_VA_BITS)) #else #define TASK_SIZE64 0x10000000000UL #endif From patchwork Sun Feb 24 07:13:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Xuerui X-Patchwork-Id: 10827745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D52E4922 for ; Sun, 24 Feb 2019 07:15:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C04572BC62 for ; Sun, 24 Feb 2019 07:15:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B481B2BC70; Sun, 24 Feb 2019 07:15:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5AC42BC62 for ; Sun, 24 Feb 2019 07:15:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726424AbfBXHPR (ORCPT ); Sun, 24 Feb 2019 02:15:17 -0500 Received: from smtpbgbr2.qq.com ([54.207.22.56]:42384 "EHLO smtpbgbr2.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbfBXHPR (ORCPT ); Sun, 24 Feb 2019 02:15:17 -0500 X-QQ-mid: bizesmtp3t1550992510tkbwgufxk Received: from localhost.localdomain (unknown [116.236.177.50]) by esmtp4.qq.com (ESMTP) with id ; Sun, 24 Feb 2019 15:15:08 +0800 (CST) X-QQ-SSF: 01400000002000C0EG82B00A0000000 X-QQ-FEAT: JeZkV8SsDPkiP1CqcxwKdSj1fH9ZSMJaS53/BboKXhwgZYcCnIIhf2iAp1/r3 J9kxYmFT7bVMGobnAOtIxxFDH3s893nJOmbQvCLG31Dkg3d7997UCys+x83c101W4Mf31BW HNHpWotdY6yGDBeSXD0H5/WG9ycfr4/C3kb3rvdGDzZxMSmmBBMALNbFhyOHW4ny9x+4+4M rffWlAh5GG7muz7B+uoxOWm9kydGHljo2cXFwkml3dexe55zvJpzugODcyqMj8gMgoiZPTK 5BP8jkJiHju8w8cs/yrOUGPEnX6ATC4/2LDQ== X-QQ-GoodBg: 2 From: Wang Xuerui To: linux-mips@vger.kernel.org Cc: Wang Xuerui , Huacai Chen , Jiaxun Yang , Alex Belits , James Hogan , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH 4/4] MIPS: support 47-bit userland VM space Date: Sun, 24 Feb 2019 15:13:55 +0800 Message-Id: <20190224071355.14488-5-wangxuerui@qiniu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20190224071355.14488-1-wangxuerui@qiniu.com> References: <20190224071355.14488-1-wangxuerui@qiniu.com> X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:qiniu.com:qybgforeign:qybgforeign4 X-QQ-Bgrelay: 1 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The infrastructure is now ready, so just add the necessary Kconfig logic. The equivalent logic has been tested on Loongson 3A2000 and 3A3000 for more than 2 years, no breakage so far. Signed-off-by: Wang Xuerui Tested-by: Wang Xuerui Cc: Huacai Chen Cc: Jiaxun Yang Cc: Alex Belits Cc: James Hogan Cc: Ralf Baechle Cc: linux-mips@linux-mips.org --- arch/mips/Kconfig | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index a1ab9e7924a0..104de85ef6ed 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2171,6 +2171,31 @@ config MIPS_VA_BITS_DEFAULT If unsure, say Y. +config MIPS_VA_BITS_47 + bool "47 bits virtual memory" + depends on 64BIT + select MIPS_LARGE_VA + help + This is a temporary option to support 47 bits of application virtual + memory, as is the case with x86_64. + + Some applications and libraries assume the userland address space is + 47-bit or less, due to the prevalence of x86_64 platforms where this + restriction is present. Hence, turning on 48-bit userland addresses + may cause these applications to stop working. For example, + SpiderMonkey re-uses the higher 17 bits of pointers as tags, which + breaks GJS and thus whole GNOME if 48-bit is enabled. This option + retains compatibility with those (broken for now) apps, while + providing larger address space to userland. + + However, the option is only here as a stop-gap measure; the + applications should be fixed to not depend on unused bits in + pointers, as those bits will eventually become unavailable. Also + note that the caveats of 48-bit virtual memory also apply, because + the implementation is shared. + + If unsure, say N. + config MIPS_VA_BITS_48 bool "48 bits virtual memory" depends on 64BIT @@ -2193,6 +2218,7 @@ config MIPS_LARGE_VA config MIPS_VA_BITS int + default 47 if MIPS_VA_BITS_47 default 48 if MIPS_VA_BITS_48 default 40