Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945963AbbEOBXV (ORCPT ); Thu, 14 May 2015 21:23:21 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:34732 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933595AbbEOBXT (ORCPT ); Thu, 14 May 2015 21:23:19 -0400 Subject: [PATCH] MIPS64: Support of at least 48 bits of SEGBITS From: Leonid Yegoshin To: , , , , , , , , , , , Date: Thu, 14 May 2015 18:23:14 -0700 Message-ID: <20150515012314.6819.30051.stgit@ubuntu-yegoshin> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.20.3.79] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3610 Lines: 109 SEGBITS default is 40 bits or less, depending from CPU type. This patch introduces 48bits of application virtual address (SEGBITS) support. It is defined only for 16K and 64K pages and is optional (configurable). Penalty - a small number of additional pages for generic (small) applications. But for 64K pages it adds 3rd level of PTE structure, which has a little impact during software TLB refill. This patch is needed because MIPS I6XXX and P6XXX cores have 48 bit of virtual address in each segment (SEGBITS). Signed-off-by: Leonid Yegoshin --- arch/mips/Kconfig | 10 ++++++++++ arch/mips/include/asm/pgtable-64.h | 18 +++++++++++------- arch/mips/include/asm/processor.h | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 76efb02ae99f..0a151a59a9ac 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2032,6 +2032,16 @@ config PAGE_SIZE_64KB endchoice +config 48VMBITS + bool "48 bits virtual memory" + depends on PAGE_SIZE_16KB || PAGE_SIZE_64KB + help + Define a maximum at least 48 bits of application virtual memory. + Default is 40 bits or less, depending from CPU. + In generic (small) application it is a small set of pages increase + in page tables. + If unsure, say N. + config FORCE_MAX_ZONEORDER int "Maximum zone order" range 14 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index cf661a2fb141..c6b5473440e6 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -17,7 +17,7 @@ #include #include -#ifdef CONFIG_PAGE_SIZE_64KB +#if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_48VMBITS) #include #else #include @@ -90,7 +90,11 @@ #define PTE_ORDER 0 #endif #ifdef CONFIG_PAGE_SIZE_16KB -#define PGD_ORDER 0 +#ifdef CONFIG_48VMBITS +#define PGD_ORDER 1 +#else +#define PGD_ORDER 0 +#endif #define PUD_ORDER aieeee_attempt_to_allocate_pud #define PMD_ORDER 0 #define PTE_ORDER 0 @@ -104,7 +108,11 @@ #ifdef CONFIG_PAGE_SIZE_64KB #define PGD_ORDER 0 #define PUD_ORDER aieeee_attempt_to_allocate_pud +#ifdef CONFIG_48VMBITS +#define PMD_ORDER 0 +#else #define PMD_ORDER aieeee_attempt_to_allocate_pmd +#endif #define PTE_ORDER 0 #endif @@ -114,11 +122,7 @@ #endif #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) -#if PGDIR_SIZE >= TASK_SIZE64 -#define USER_PTRS_PER_PGD (1) -#else -#define USER_PTRS_PER_PGD (TASK_SIZE64 / PGDIR_SIZE) -#endif +#define USER_PTRS_PER_PGD ((TASK_SIZE64 / PGDIR_SIZE)?(TASK_SIZE64 / PGDIR_SIZE):1) #define FIRST_USER_ADDRESS 0UL /* diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index 9b3b48e21c22..3ccb63eaa6c8 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h @@ -69,7 +69,7 @@ extern unsigned int vced_count, vcei_count; * 8192EB ... */ #define TASK_SIZE32 0x7fff8000UL -#define TASK_SIZE64 0x10000000000UL +#define TASK_SIZE64 (0x1UL << cpu_data[0].vmbits) #define TASK_SIZE (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64) #define STACK_TOP_MAX TASK_SIZE64 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/