Skip to contentSkip to conversation

CONFIG_64BIT && CONFIG_MIPS_HUGE_TLB_SUPPORT build broken

DISCUSSION Joshua Kinard 2 participants 2 messages Jun 1, 2015 – Jun 2, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

Looks like this particular build configuration has problems:

CC arch/mips/kernel/cpu-probe.o
In file included from ./arch/mips/include/asm/io.h:27:0,

                 from include/linux/io.h:22,
                 from ./arch/mips/include/asm/mips-cm.h:14,
                 from ./arch/mips/include/asm/smp-ops.h:16,
                 from ./arch/mips/include/asm/smp.h:21,
                 from include/linux/smp.h:59,
                 from ./arch/mips/include/asm/cpu-type.h:12,
                 from ./arch/mips/include/asm/timex.h:19,
                 from include/linux/timex.h:65,
                 from include/linux/sched.h:19,
                 from include/linux/ptrace.h:5,
                 from arch/mips/kernel/cpu-probe.c:16:

./arch/mips/include/asm/pgtable-bits.h:164:0: error: "_PAGE_GLOBAL_SHIFT" redefined [-Werror]
#define _PAGE_GLOBAL_SHIFT (_PAGE_MODIFIED_SHIFT + 1)
^
./arch/mips/include/asm/pgtable-bits.h:141:0: note: this is the location of the previous definition
#define _PAGE_GLOBAL_SHIFT (_PAGE_SPLITTING_SHIFT + 1)
^
cc1: all warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'arch/mips/kernel/cpu-probe.o' failed make[2]: *** [arch/mips/kernel/cpu-probe.o] Error 1 scripts/Makefile.build:403: recipe for target 'arch/mips/kernel' failed make[1]: *** [arch/mips/kernel] Error 2
Makefile:946: recipe for target 'arch/mips' failed
make: *** [arch/mips] Error 2

Caused by these two blocks:

   #if defined(CONFIG_64BIT) && defined(CONFIG_MIPS_HUGE_TLB_SUPPORT)
   /* Huge TLB page */
   #define _PAGE_HUGE_SHIFT        (_PAGE_MODIFIED_SHIFT + 1)
   #define _PAGE_HUGE              (1 << _PAGE_HUGE_SHIFT)
   #define _PAGE_SPLITTING_SHIFT   (_PAGE_HUGE_SHIFT + 1)
   #define _PAGE_SPLITTING         (1 << _PAGE_SPLITTING_SHIFT)

/* Only R2 or newer cores have the XI bit */
#ifdef CONFIG_CPU_MIPSR2
#define _PAGE_NO_EXEC_SHIFT (_PAGE_SPLITTING_SHIFT + 1)
#else
-> #define _PAGE_GLOBAL_SHIFT (_PAGE_SPLITTING_SHIFT + 1)
#define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT)
#endif /* CONFIG_CPU_MIPSR2 */

   #endif  /* CONFIG_64BIT && CONFIG_MIPS_HUGE_TLB_SUPPORT */

And ...

   #ifdef CONFIG_CPU_MIPSR2
   /* XI - page cannot be executed */
   #ifndef _PAGE_NO_EXEC_SHIFT
   #define _PAGE_NO_EXEC_SHIFT     (_PAGE_MODIFIED_SHIFT + 1)
   #endif
   #define _PAGE_NO_EXEC           (cpu_has_rixi ? (1 << _PAGE_NO_EXEC_SHIFT) : 0)

   /* RI - page cannot be read */
   #define _PAGE_READ_SHIFT        (_PAGE_NO_EXEC_SHIFT + 1)
   #define _PAGE_READ              (cpu_has_rixi ? 0 : (1 << _PAGE_READ_SHIFT))
   #define _PAGE_NO_READ_SHIFT     _PAGE_READ_SHIFT
   #define _PAGE_NO_READ           (cpu_has_rixi ? (1 << _PAGE_READ_SHIFT) : 0)

   #define _PAGE_GLOBAL_SHIFT      (_PAGE_NO_READ_SHIFT + 1)
   #define _PAGE_GLOBAL            (1 << _PAGE_GLOBAL_SHIFT)

#else /* !CONFIG_CPU_MIPSR2 */
-> #define _PAGE_GLOBAL_SHIFT (_PAGE_MODIFIED_SHIFT + 1)
#define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT)
#endif /* CONFIG_CPU_MIPSR2 */

Since this is dealing with R2 stuff, not sure what the best fix is. Looks like this is the problem commit:

http://git.linux-mips.org/cgit/ralf/linux.git/commit/arch/mips/include/asm/pgtable-bits.h?id=be0c37c985eddc46d0d67543898c086f60460e2e

--J