diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2016-02-09 15:55:51 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-05-13 09:30:25 -0400 |
commit | 8256b17ecb028949d80c982d0f28ad46fe4e73d8 (patch) | |
tree | 18caab2e4f081a22d5aab9dc17552c948074e1f4 | |
parent | e56c7e18818dd721179f9ca95c77dd941a360384 (diff) |
MIPS: Allow RIXI to be used on non-R2 or R6 cores
Some processors, like Broadcom's BMIPS4380 and BMIPS5000 support RIXI and the
"rotr" instruction, which can be used to get a slightly more efficient page
table layout.
Introduce a CONFIG_CPU_HAS_RIXI such that those cores can benefit from this
feature. Perform the conditional check updates where relevant.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Cc: john@phrozen.org
Cc: cernekee@gmail.com
Cc: jon.fraser@broadcom.com
Cc: pgynther@google.com
Cc: paul.burton@imgtec.com
Cc: ddaney.cavm@gmail.com
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12505/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/Kconfig | 5 | ||||
-rw-r--r-- | arch/mips/include/asm/pgtable-bits.h | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index d10ed57ad418..5562ee535db8 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1996,11 +1996,13 @@ config CPU_MIPSR1 | |||
1996 | config CPU_MIPSR2 | 1996 | config CPU_MIPSR2 |
1997 | bool | 1997 | bool |
1998 | default y if CPU_MIPS32_R2 || CPU_MIPS64_R2 || CPU_CAVIUM_OCTEON | 1998 | default y if CPU_MIPS32_R2 || CPU_MIPS64_R2 || CPU_CAVIUM_OCTEON |
1999 | select CPU_HAS_RIXI | ||
1999 | select MIPS_SPRAM | 2000 | select MIPS_SPRAM |
2000 | 2001 | ||
2001 | config CPU_MIPSR6 | 2002 | config CPU_MIPSR6 |
2002 | bool | 2003 | bool |
2003 | default y if CPU_MIPS32_R6 || CPU_MIPS64_R6 | 2004 | default y if CPU_MIPS32_R6 || CPU_MIPS64_R6 |
2005 | select CPU_HAS_RIXI | ||
2004 | select HAVE_ARCH_BITREVERSE | 2006 | select HAVE_ARCH_BITREVERSE |
2005 | select MIPS_ASID_BITS_VARIABLE | 2007 | select MIPS_ASID_BITS_VARIABLE |
2006 | select MIPS_SPRAM | 2008 | select MIPS_SPRAM |
@@ -2421,6 +2423,9 @@ config CPU_HAS_WB | |||
2421 | config XKS01 | 2423 | config XKS01 |
2422 | bool | 2424 | bool |
2423 | 2425 | ||
2426 | config CPU_HAS_RIXI | ||
2427 | bool | ||
2428 | |||
2424 | # | 2429 | # |
2425 | # Vectored interrupt mode is an R2 feature | 2430 | # Vectored interrupt mode is an R2 feature |
2426 | # | 2431 | # |
diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h index 58e8bf815404..f88a48cd68b2 100644 --- a/arch/mips/include/asm/pgtable-bits.h +++ b/arch/mips/include/asm/pgtable-bits.h | |||
@@ -104,7 +104,7 @@ enum pgtable_bits { | |||
104 | enum pgtable_bits { | 104 | enum pgtable_bits { |
105 | /* Used only by software (masked out before writing EntryLo*) */ | 105 | /* Used only by software (masked out before writing EntryLo*) */ |
106 | _PAGE_PRESENT_SHIFT, | 106 | _PAGE_PRESENT_SHIFT, |
107 | #if !defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_CPU_MIPSR6) | 107 | #if !defined(CONFIG_CPU_HAS_RIXI) |
108 | _PAGE_NO_READ_SHIFT, | 108 | _PAGE_NO_READ_SHIFT, |
109 | #endif | 109 | #endif |
110 | _PAGE_WRITE_SHIFT, | 110 | _PAGE_WRITE_SHIFT, |
@@ -115,7 +115,7 @@ enum pgtable_bits { | |||
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /* Used by TLB hardware (placed in EntryLo*) */ | 117 | /* Used by TLB hardware (placed in EntryLo*) */ |
118 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 118 | #if defined(CONFIG_CPU_HAS_RIXI) |
119 | _PAGE_NO_EXEC_SHIFT, | 119 | _PAGE_NO_EXEC_SHIFT, |
120 | _PAGE_NO_READ_SHIFT, | 120 | _PAGE_NO_READ_SHIFT, |
121 | #endif | 121 | #endif |
@@ -139,7 +139,7 @@ enum pgtable_bits { | |||
139 | /* Used by TLB hardware (placed in EntryLo*) */ | 139 | /* Used by TLB hardware (placed in EntryLo*) */ |
140 | #if defined(CONFIG_XPA) | 140 | #if defined(CONFIG_XPA) |
141 | # define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT) | 141 | # define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT) |
142 | #elif defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 142 | #elif defined(CONFIG_CPU_HAS_RIXI) |
143 | # define _PAGE_NO_EXEC (cpu_has_rixi ? (1 << _PAGE_NO_EXEC_SHIFT) : 0) | 143 | # define _PAGE_NO_EXEC (cpu_has_rixi ? (1 << _PAGE_NO_EXEC_SHIFT) : 0) |
144 | #endif | 144 | #endif |
145 | #define _PAGE_NO_READ (1 << _PAGE_NO_READ_SHIFT) | 145 | #define _PAGE_NO_READ (1 << _PAGE_NO_READ_SHIFT) |
@@ -180,7 +180,7 @@ enum pgtable_bits { | |||
180 | */ | 180 | */ |
181 | static inline uint64_t pte_to_entrylo(unsigned long pte_val) | 181 | static inline uint64_t pte_to_entrylo(unsigned long pte_val) |
182 | { | 182 | { |
183 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 183 | #ifdef CONFIG_CPU_HAS_RIXI |
184 | if (cpu_has_rixi) { | 184 | if (cpu_has_rixi) { |
185 | int sa; | 185 | int sa; |
186 | #ifdef CONFIG_32BIT | 186 | #ifdef CONFIG_32BIT |