Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Florian Fainelli and committed by
Ralf Baechle
8256b17e e56c7e18

+9 -4
+5
arch/mips/Kconfig
··· 1996 1996 config CPU_MIPSR2 1997 1997 bool 1998 1998 default y if CPU_MIPS32_R2 || CPU_MIPS64_R2 || CPU_CAVIUM_OCTEON 1999 + select CPU_HAS_RIXI 1999 2000 select MIPS_SPRAM 2000 2001 2001 2002 config CPU_MIPSR6 2002 2003 bool 2003 2004 default y if CPU_MIPS32_R6 || CPU_MIPS64_R6 2005 + select CPU_HAS_RIXI 2004 2006 select HAVE_ARCH_BITREVERSE 2005 2007 select MIPS_ASID_BITS_VARIABLE 2006 2008 select MIPS_SPRAM ··· 2421 2419 bool 2422 2420 2423 2421 config XKS01 2422 + bool 2423 + 2424 + config CPU_HAS_RIXI 2424 2425 bool 2425 2426 2426 2427 #
+4 -4
arch/mips/include/asm/pgtable-bits.h
··· 104 104 enum pgtable_bits { 105 105 /* Used only by software (masked out before writing EntryLo*) */ 106 106 _PAGE_PRESENT_SHIFT, 107 - #if !defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_CPU_MIPSR6) 107 + #if !defined(CONFIG_CPU_HAS_RIXI) 108 108 _PAGE_NO_READ_SHIFT, 109 109 #endif 110 110 _PAGE_WRITE_SHIFT, ··· 115 115 #endif 116 116 117 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 119 _PAGE_NO_EXEC_SHIFT, 120 120 _PAGE_NO_READ_SHIFT, 121 121 #endif ··· 139 139 /* Used by TLB hardware (placed in EntryLo*) */ 140 140 #if defined(CONFIG_XPA) 141 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 143 # define _PAGE_NO_EXEC (cpu_has_rixi ? (1 << _PAGE_NO_EXEC_SHIFT) : 0) 144 144 #endif 145 145 #define _PAGE_NO_READ (1 << _PAGE_NO_READ_SHIFT) ··· 180 180 */ 181 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 184 if (cpu_has_rixi) { 185 185 int sa; 186 186 #ifdef CONFIG_32BIT