Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS fixes from Ralf Baechle:
"A round of 4.8 fixes:

MIPS generic code:
- Add a missing ".set pop" in an early commit
- Fix memory regions reaching top of physical
- MAAR: Fix address alignment
- vDSO: Fix Malta EVA mapping to vDSO page structs
- uprobes: fix incorrect uprobe brk handling
- uprobes: select HAVE_REGS_AND_STACK_ACCESS_API
- Avoid a BUG warning during PR_SET_FP_MODE prctl
- SMP: Fix possibility of deadlock when bringing CPUs online
- R6: Remove compact branch policy Kconfig entries
- Fix size calc when avoiding IPIs for small icache flushes
- Fix pre-r6 emulation FPU initialisation
- Fix delay slot emulation count in debugfs

ATH79:
- Fix test for error return of clk_register_fixed_factor.

Octeon:
- Fix kernel header to work for VDSO build.
- Fix initialization of platform device probing.

paravirt:
- Fix undefined reference to smp_bootstrap"

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
MIPS: Fix delay slot emulation count in debugfs
MIPS: SMP: Fix possibility of deadlock when bringing CPUs online
MIPS: Fix pre-r6 emulation FPU initialisation
MIPS: vDSO: Fix Malta EVA mapping to vDSO page structs
MIPS: Select HAVE_REGS_AND_STACK_ACCESS_API
MIPS: Octeon: Fix platform bus probing
MIPS: Octeon: mangle-port: fix build failure with VDSO code
MIPS: Avoid a BUG warning during prctl(PR_SET_FP_MODE, ...)
MIPS: c-r4k: Fix size calc when avoiding IPIs for small icache flushes
MIPS: Add a missing ".set pop" in an early commit
MIPS: paravirt: Fix undefined reference to smp_bootstrap
MIPS: Remove compact branch policy Kconfig entries
MIPS: MAAR: Fix address alignment
MIPS: Fix memory regions reaching top of physical
MIPS: uprobes: fix incorrect uprobe brk handling
MIPS: ath79: Fix test for error return of clk_register_fixed_factor().

Changed files
+37 -65
arch
+1
arch/mips/Kconfig
··· 65 65 select ARCH_CLOCKSOURCE_DATA 66 66 select HANDLE_DOMAIN_IRQ 67 67 select HAVE_EXIT_THREAD 68 + select HAVE_REGS_AND_STACK_ACCESS_API 68 69 69 70 menu "Machine selection" 70 71
-36
arch/mips/Kconfig.debug
··· 113 113 help 114 114 Add several files to the debugfs to test spinlock speed. 115 115 116 - if CPU_MIPSR6 117 - 118 - choice 119 - prompt "Compact branch policy" 120 - default MIPS_COMPACT_BRANCHES_OPTIMAL 121 - 122 - config MIPS_COMPACT_BRANCHES_NEVER 123 - bool "Never (force delay slot branches)" 124 - help 125 - Pass the -mcompact-branches=never flag to the compiler in order to 126 - force it to always emit branches with delay slots, and make no use 127 - of the compact branch instructions introduced by MIPSr6. This is 128 - useful if you suspect there may be an issue with compact branches in 129 - either the compiler or the CPU. 130 - 131 - config MIPS_COMPACT_BRANCHES_OPTIMAL 132 - bool "Optimal (use where beneficial)" 133 - help 134 - Pass the -mcompact-branches=optimal flag to the compiler in order for 135 - it to make use of compact branch instructions where it deems them 136 - beneficial, and use branches with delay slots elsewhere. This is the 137 - default compiler behaviour, and should be used unless you have a 138 - reason to choose otherwise. 139 - 140 - config MIPS_COMPACT_BRANCHES_ALWAYS 141 - bool "Always (force compact branches)" 142 - help 143 - Pass the -mcompact-branches=always flag to the compiler in order to 144 - force it to always emit compact branches, making no use of branch 145 - instructions with delay slots. This can result in more compact code 146 - which may be beneficial in some scenarios. 147 - 148 - endchoice 149 - 150 - endif # CPU_MIPSR6 151 - 152 116 config SCACHE_DEBUGFS 153 117 bool "L2 cache debugfs entries" 154 118 depends on DEBUG_FS
-4
arch/mips/Makefile
··· 203 203 toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt) 204 204 cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT 205 205 206 - cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_NEVER) += -mcompact-branches=never 207 - cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_OPTIMAL) += -mcompact-branches=optimal 208 - cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_ALWAYS) += -mcompact-branches=always 209 - 210 206 # 211 207 # Firmware support 212 208 #
+1 -1
arch/mips/ath79/clock.c
··· 96 96 struct clk *clk; 97 97 98 98 clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); 99 - if (!clk) 99 + if (IS_ERR(clk)) 100 100 panic("failed to allocate %s clock structure", name); 101 101 102 102 return clk;
+1 -1
arch/mips/cavium-octeon/octeon-platform.c
··· 1059 1059 { 1060 1060 return of_platform_bus_probe(NULL, octeon_ids, NULL); 1061 1061 } 1062 - device_initcall(octeon_publish_devices); 1062 + arch_initcall(octeon_publish_devices); 1063 1063 1064 1064 MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); 1065 1065 MODULE_LICENSE("GPL");
+1
arch/mips/include/asm/asmmacro.h
··· 157 157 ldc1 $f28, THREAD_FPR28(\thread) 158 158 ldc1 $f30, THREAD_FPR30(\thread) 159 159 ctc1 \tmp, fcr31 160 + .set pop 160 161 .endm 161 162 162 163 .macro fpu_restore_16odd thread
+2 -2
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h
··· 15 15 static inline bool __should_swizzle_bits(volatile void *a) 16 16 { 17 17 extern const bool octeon_should_swizzle_table[]; 18 + u64 did = ((u64)(uintptr_t)a >> 40) & 0xff; 18 19 19 - unsigned long did = ((unsigned long)a >> 40) & 0xff; 20 20 return octeon_should_swizzle_table[did]; 21 21 } 22 22 ··· 29 29 30 30 #define __should_swizzle_bits(a) false 31 31 32 - static inline bool __should_swizzle_addr(unsigned long p) 32 + static inline bool __should_swizzle_addr(u64 p) 33 33 { 34 34 /* boot bus? */ 35 35 return ((p >> 40) & 0xff) == 0;
+2
arch/mips/include/asm/mach-paravirt/kernel-entry-init.h
··· 11 11 #define CP0_EBASE $15, 1 12 12 13 13 .macro kernel_entry_setup 14 + #ifdef CONFIG_SMP 14 15 mfc0 t0, CP0_EBASE 15 16 andi t0, t0, 0x3ff # CPUNum 16 17 beqz t0, 1f 17 18 # CPUs other than zero goto smp_bootstrap 18 19 j smp_bootstrap 20 + #endif /* CONFIG_SMP */ 19 21 20 22 1: 21 23 .endm
+2
arch/mips/kernel/mips-r2-to-r6-emul.c
··· 1164 1164 regs->regs[31] = r31; 1165 1165 regs->cp0_epc = epc; 1166 1166 if (!used_math()) { /* First time FPU user. */ 1167 + preempt_disable(); 1167 1168 err = init_fpu(); 1169 + preempt_enable(); 1168 1170 set_used_math(); 1169 1171 } 1170 1172 lose_fpu(1); /* Save FPU state for the emulator. */
+4 -4
arch/mips/kernel/process.c
··· 605 605 return -EOPNOTSUPP; 606 606 607 607 /* Avoid inadvertently triggering emulation */ 608 - if ((value & PR_FP_MODE_FR) && cpu_has_fpu && 609 - !(current_cpu_data.fpu_id & MIPS_FPIR_F64)) 608 + if ((value & PR_FP_MODE_FR) && raw_cpu_has_fpu && 609 + !(raw_current_cpu_data.fpu_id & MIPS_FPIR_F64)) 610 610 return -EOPNOTSUPP; 611 - if ((value & PR_FP_MODE_FRE) && cpu_has_fpu && !cpu_has_fre) 611 + if ((value & PR_FP_MODE_FRE) && raw_cpu_has_fpu && !cpu_has_fre) 612 612 return -EOPNOTSUPP; 613 613 614 614 /* FR = 0 not supported in MIPS R6 */ 615 - if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6) 615 + if (!(value & PR_FP_MODE_FR) && raw_cpu_has_fpu && cpu_has_mips_r6) 616 616 return -EOPNOTSUPP; 617 617 618 618 /* Proceed with the mode switch */
+7
arch/mips/kernel/setup.c
··· 87 87 int x = boot_mem_map.nr_map; 88 88 int i; 89 89 90 + /* 91 + * If the region reaches the top of the physical address space, adjust 92 + * the size slightly so that (start + size) doesn't overflow 93 + */ 94 + if (start + size - 1 == (phys_addr_t)ULLONG_MAX) 95 + --size; 96 + 90 97 /* Sanity check */ 91 98 if (start + size < start) { 92 99 pr_warn("Trying to add an invalid memory region, skipped\n");
+3 -4
arch/mips/kernel/smp.c
··· 322 322 cpumask_set_cpu(cpu, &cpu_coherent_mask); 323 323 notify_cpu_starting(cpu); 324 324 325 + cpumask_set_cpu(cpu, &cpu_callin_map); 326 + synchronise_count_slave(cpu); 327 + 325 328 set_cpu_online(cpu, true); 326 329 327 330 set_cpu_sibling_map(cpu); 328 331 set_cpu_core_map(cpu); 329 332 330 333 calculate_cpu_foreign_map(); 331 - 332 - cpumask_set_cpu(cpu, &cpu_callin_map); 333 - 334 - synchronise_count_slave(cpu); 335 334 336 335 /* 337 336 * irq will be enabled in ->smp_finish(), enabling it too early
+1 -1
arch/mips/kernel/uprobes.c
··· 222 222 return NOTIFY_DONE; 223 223 224 224 switch (val) { 225 - case DIE_BREAK: 225 + case DIE_UPROBE: 226 226 if (uprobe_pre_sstep_notifier(regs)) 227 227 return NOTIFY_STOP; 228 228 break;
+4 -4
arch/mips/kernel/vdso.c
··· 39 39 static void __init init_vdso_image(struct mips_vdso_image *image) 40 40 { 41 41 unsigned long num_pages, i; 42 + unsigned long data_pfn; 42 43 43 44 BUG_ON(!PAGE_ALIGNED(image->data)); 44 45 BUG_ON(!PAGE_ALIGNED(image->size)); 45 46 46 47 num_pages = image->size / PAGE_SIZE; 47 48 48 - for (i = 0; i < num_pages; i++) { 49 - image->mapping.pages[i] = 50 - virt_to_page(image->data + (i * PAGE_SIZE)); 51 - } 49 + data_pfn = __phys_to_pfn(__pa_symbol(image->data)); 50 + for (i = 0; i < num_pages; i++) 51 + image->mapping.pages[i] = pfn_to_page(data_pfn + i); 52 52 } 53 53 54 54 static int __init init_vdso(void)
+1
arch/mips/math-emu/dsemul.c
··· 298 298 /* Set EPC to return to post-branch instruction */ 299 299 xcp->cp0_epc = current->thread.bd_emu_cont_pc; 300 300 pr_debug("dsemulret to 0x%08lx\n", xcp->cp0_epc); 301 + MIPS_FPU_EMU_INC_STATS(ds_emul); 301 302 return true; 302 303 }
+1 -1
arch/mips/mm/c-r4k.c
··· 800 800 * If address-based cache ops don't require an SMP call, then 801 801 * use them exclusively for small flushes. 802 802 */ 803 - size = start - end; 803 + size = end - start; 804 804 cache_size = icache_size; 805 805 if (!cpu_has_ic_fills_f_dc) { 806 806 size *= 2;
+6 -7
arch/mips/mm/init.c
··· 261 261 { 262 262 struct maar_config cfg[BOOT_MEM_MAP_MAX]; 263 263 unsigned i, num_configured, num_cfg = 0; 264 - phys_addr_t skip; 265 264 266 265 for (i = 0; i < boot_mem_map.nr_map; i++) { 267 266 switch (boot_mem_map.map[i].type) { ··· 271 272 continue; 272 273 } 273 274 274 - skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff); 275 - 275 + /* Round lower up */ 276 276 cfg[num_cfg].lower = boot_mem_map.map[i].addr; 277 - cfg[num_cfg].lower += skip; 277 + cfg[num_cfg].lower = (cfg[num_cfg].lower + 0xffff) & ~0xffff; 278 278 279 - cfg[num_cfg].upper = cfg[num_cfg].lower; 280 - cfg[num_cfg].upper += boot_mem_map.map[i].size - 1; 281 - cfg[num_cfg].upper -= skip; 279 + /* Round upper down */ 280 + cfg[num_cfg].upper = boot_mem_map.map[i].addr + 281 + boot_mem_map.map[i].size; 282 + cfg[num_cfg].upper = (cfg[num_cfg].upper & ~0xffff) - 1; 282 283 283 284 cfg[num_cfg].attrs = MIPS_MAAR_S; 284 285 num_cfg++;