diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-08 22:59:21 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-08 22:59:21 -0400 |
| commit | 3fbdc379567aef1c43b4be110179b541d68afdf6 (patch) | |
| tree | 9b5b964487bc6a2afd20da2c3b442a3cd82fe917 | |
| parent | af0b3152bbfebd3f8291fd61988c12ece4f60f57 (diff) | |
| parent | 46011e6ea39235e4aca656673c500eac81a07a17 (diff) | |
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle:
"Another round of MIPS fixes for 4.2. No area does particularly stand
out but we have a two unpleasant ones:
- Kernel ptes are marked with a global bit which allows the kernel to
share kernel TLB entries between all processes. For this to work
both entries of an adjacent even/odd pte pair need to have the
global bit set. There has been a subtle race in setting the other
entry's global bit since ~ 2000 but it take particularly
pathological workloads that essentially do mostly vmalloc/vfree to
trigger this.
This pull request fixes the 64-bit case but leaves the case of 32
bit CPUs with 64 bit ptes unsolved for now. The unfixed cases
affect hardware that is not available in the field yet.
- Instruction emulation requires loading instructions from user space
but the current fast but simplistic approach will fail on pages
that are PROT_EXEC but !PROT_READ. For this reason we temporarily
do not permit this permission and will map pages with PROT_EXEC |
PROT_READ.
The remainder of this pull request is more or less across the field
and the short log explains them well"
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
MIPS: Make set_pte() SMP safe.
MIPS: Replace add and sub instructions in relocate_kernel.S with addiu
MIPS: Flush RPS on kernel entry with EVA
Revert "MIPS: BCM63xx: Provide a plat_post_dma_flush hook"
MIPS: BMIPS: Delete unused Kconfig symbol
MIPS: Export get_c0_perfcount_int()
MIPS: show_stack: Fix stack trace with EVA
MIPS: do_mcheck: Fix kernel code dump with EVA
MIPS: SMP: Don't increment irq_count multiple times for call function IPIs
MIPS: Partially disable RIXI support.
MIPS: Handle page faults of executable but unreadable pages correctly.
MIPS: Malta: Don't reinitialise RTC
MIPS: unaligned: Fix build error on big endian R6 kernels
MIPS: Fix sched_getaffinity with MT FPAFF enabled
MIPS: Fix build with CONFIG_OF=y for non OF-enabled targets
CPUFREQ: Loongson2: Fix broken build due to incorrect include.
31 files changed, 130 insertions, 62 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index cee5f93e5712..199a8357838c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -151,7 +151,6 @@ config BMIPS_GENERIC | |||
| 151 | select BCM7120_L2_IRQ | 151 | select BCM7120_L2_IRQ |
| 152 | select BRCMSTB_L2_IRQ | 152 | select BRCMSTB_L2_IRQ |
| 153 | select IRQ_MIPS_CPU | 153 | select IRQ_MIPS_CPU |
| 154 | select RAW_IRQ_ACCESSORS | ||
| 155 | select DMA_NONCOHERENT | 154 | select DMA_NONCOHERENT |
| 156 | select SYS_SUPPORTS_32BIT_KERNEL | 155 | select SYS_SUPPORTS_32BIT_KERNEL |
| 157 | select SYS_SUPPORTS_LITTLE_ENDIAN | 156 | select SYS_SUPPORTS_LITTLE_ENDIAN |
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index 01a644f174dd..1ba21204ebe0 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c | |||
| @@ -190,6 +190,7 @@ int get_c0_perfcount_int(void) | |||
| 190 | { | 190 | { |
| 191 | return ATH79_MISC_IRQ(5); | 191 | return ATH79_MISC_IRQ(5); |
| 192 | } | 192 | } |
| 193 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 193 | 194 | ||
| 194 | unsigned int get_c0_compare_int(void) | 195 | unsigned int get_c0_compare_int(void) |
| 195 | { | 196 | { |
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c index 56f5d080ef9d..b7fa9ae28c36 100644 --- a/arch/mips/cavium-octeon/smp.c +++ b/arch/mips/cavium-octeon/smp.c | |||
| @@ -42,7 +42,7 @@ static irqreturn_t mailbox_interrupt(int irq, void *dev_id) | |||
| 42 | cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action); | 42 | cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action); |
| 43 | 43 | ||
| 44 | if (action & SMP_CALL_FUNCTION) | 44 | if (action & SMP_CALL_FUNCTION) |
| 45 | smp_call_function_interrupt(); | 45 | generic_smp_call_function_interrupt(); |
| 46 | if (action & SMP_RESCHEDULE_YOURSELF) | 46 | if (action & SMP_RESCHEDULE_YOURSELF) |
| 47 | scheduler_ipi(); | 47 | scheduler_ipi(); |
| 48 | 48 | ||
diff --git a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h b/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h deleted file mode 100644 index 11d3b572b1b3..000000000000 --- a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | #ifndef __ASM_MACH_BCM63XX_DMA_COHERENCE_H | ||
| 2 | #define __ASM_MACH_BCM63XX_DMA_COHERENCE_H | ||
| 3 | |||
| 4 | #include <asm/bmips.h> | ||
| 5 | |||
| 6 | #define plat_post_dma_flush bmips_post_dma_flush | ||
| 7 | |||
| 8 | #include <asm/mach-generic/dma-coherence.h> | ||
| 9 | |||
| 10 | #endif /* __ASM_MACH_BCM63XX_DMA_COHERENCE_H */ | ||
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 9d8106758142..ae8569475264 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
| @@ -182,8 +182,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
| 182 | * Make sure the buddy is global too (if it's !none, | 182 | * Make sure the buddy is global too (if it's !none, |
| 183 | * it better already be global) | 183 | * it better already be global) |
| 184 | */ | 184 | */ |
| 185 | #ifdef CONFIG_SMP | ||
| 186 | /* | ||
| 187 | * For SMP, multiple CPUs can race, so we need to do | ||
| 188 | * this atomically. | ||
| 189 | */ | ||
| 190 | #ifdef CONFIG_64BIT | ||
| 191 | #define LL_INSN "lld" | ||
| 192 | #define SC_INSN "scd" | ||
| 193 | #else /* CONFIG_32BIT */ | ||
| 194 | #define LL_INSN "ll" | ||
| 195 | #define SC_INSN "sc" | ||
| 196 | #endif | ||
| 197 | unsigned long page_global = _PAGE_GLOBAL; | ||
| 198 | unsigned long tmp; | ||
| 199 | |||
| 200 | __asm__ __volatile__ ( | ||
| 201 | " .set push\n" | ||
| 202 | " .set noreorder\n" | ||
| 203 | "1: " LL_INSN " %[tmp], %[buddy]\n" | ||
| 204 | " bnez %[tmp], 2f\n" | ||
| 205 | " or %[tmp], %[tmp], %[global]\n" | ||
| 206 | " " SC_INSN " %[tmp], %[buddy]\n" | ||
| 207 | " beqz %[tmp], 1b\n" | ||
| 208 | " nop\n" | ||
| 209 | "2:\n" | ||
| 210 | " .set pop" | ||
| 211 | : [buddy] "+m" (buddy->pte), | ||
| 212 | [tmp] "=&r" (tmp) | ||
| 213 | : [global] "r" (page_global)); | ||
| 214 | #else /* !CONFIG_SMP */ | ||
| 185 | if (pte_none(*buddy)) | 215 | if (pte_none(*buddy)) |
| 186 | pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; | 216 | pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; |
| 217 | #endif /* CONFIG_SMP */ | ||
| 187 | } | 218 | } |
| 188 | #endif | 219 | #endif |
| 189 | } | 220 | } |
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 16f1ea9ab191..03722d4326a1 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
| @@ -83,8 +83,6 @@ static inline void __cpu_die(unsigned int cpu) | |||
| 83 | extern void play_dead(void); | 83 | extern void play_dead(void); |
| 84 | #endif | 84 | #endif |
| 85 | 85 | ||
| 86 | extern asmlinkage void smp_call_function_interrupt(void); | ||
| 87 | |||
| 88 | static inline void arch_send_call_function_single_ipi(int cpu) | 86 | static inline void arch_send_call_function_single_ipi(int cpu) |
| 89 | { | 87 | { |
| 90 | extern struct plat_smp_ops *mp_ops; /* private */ | 88 | extern struct plat_smp_ops *mp_ops; /* private */ |
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h index 28d6d9364bd1..a71da576883c 100644 --- a/arch/mips/include/asm/stackframe.h +++ b/arch/mips/include/asm/stackframe.h | |||
| @@ -152,6 +152,31 @@ | |||
| 152 | .set noreorder | 152 | .set noreorder |
| 153 | bltz k0, 8f | 153 | bltz k0, 8f |
| 154 | move k1, sp | 154 | move k1, sp |
| 155 | #ifdef CONFIG_EVA | ||
| 156 | /* | ||
| 157 | * Flush interAptiv's Return Prediction Stack (RPS) by writing | ||
| 158 | * EntryHi. Toggling Config7.RPS is slower and less portable. | ||
| 159 | * | ||
| 160 | * The RPS isn't automatically flushed when exceptions are | ||
| 161 | * taken, which can result in kernel mode speculative accesses | ||
| 162 | * to user addresses if the RPS mispredicts. That's harmless | ||
| 163 | * when user and kernel share the same address space, but with | ||
| 164 | * EVA the same user segments may be unmapped to kernel mode, | ||
| 165 | * even containing sensitive MMIO regions or invalid memory. | ||
| 166 | * | ||
| 167 | * This can happen when the kernel sets the return address to | ||
| 168 | * ret_from_* and jr's to the exception handler, which looks | ||
| 169 | * more like a tail call than a function call. If nested calls | ||
| 170 | * don't evict the last user address in the RPS, it will | ||
| 171 | * mispredict the return and fetch from a user controlled | ||
| 172 | * address into the icache. | ||
| 173 | * | ||
| 174 | * More recent EVA-capable cores with MAAR to restrict | ||
| 175 | * speculative accesses aren't affected. | ||
| 176 | */ | ||
| 177 | MFC0 k0, CP0_ENTRYHI | ||
| 178 | MTC0 k0, CP0_ENTRYHI | ||
| 179 | #endif | ||
| 155 | .set reorder | 180 | .set reorder |
| 156 | /* Called from user mode, new stack. */ | 181 | /* Called from user mode, new stack. */ |
| 157 | get_saved_sp | 182 | get_saved_sp |
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c index 3e4491aa6d6b..789d7bf4fef3 100644 --- a/arch/mips/kernel/mips-mt-fpaff.c +++ b/arch/mips/kernel/mips-mt-fpaff.c | |||
| @@ -154,7 +154,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, | |||
| 154 | |||
