Skip to content

Commit 831e45d

Browse files
committed
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().
2 parents 751b9a5 + 116e711 commit 831e45d

File tree

17 files changed

+37
-65
lines changed

17 files changed

+37
-65
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ config MIPS
6565
select ARCH_CLOCKSOURCE_DATA
6666
select HANDLE_DOMAIN_IRQ
6767
select HAVE_EXIT_THREAD
68+
select HAVE_REGS_AND_STACK_ACCESS_API
6869

6970
menu "Machine selection"
7071

arch/mips/Kconfig.debug

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -113,42 +113,6 @@ config SPINLOCK_TEST
113113
help
114114
Add several files to the debugfs to test spinlock speed.
115115

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-
152116
config SCACHE_DEBUGFS
153117
bool "L2 cache debugfs entries"
154118
depends on DEBUG_FS

arch/mips/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,6 @@ endif
203203
toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt)
204204
cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT
205205

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-
210206
#
211207
# Firmware support
212208
#

arch/mips/ath79/clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static struct clk * __init ath79_reg_ffclk(const char *name,
9696
struct clk *clk;
9797

9898
clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div);
99-
if (!clk)
99+
if (IS_ERR(clk))
100100
panic("failed to allocate %s clock structure", name);
101101

102102
return clk;

arch/mips/cavium-octeon/octeon-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ static int __init octeon_publish_devices(void)
10591059
{
10601060
return of_platform_bus_probe(NULL, octeon_ids, NULL);
10611061
}
1062-
device_initcall(octeon_publish_devices);
1062+
arch_initcall(octeon_publish_devices);
10631063

10641064
MODULE_AUTHOR("David Daney <[email protected]>");
10651065
MODULE_LICENSE("GPL");

arch/mips/include/asm/asmmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
ldc1 $f28, THREAD_FPR28(\thread)
158158
ldc1 $f30, THREAD_FPR30(\thread)
159159
ctc1 \tmp, fcr31
160+
.set pop
160161
.endm
161162

162163
.macro fpu_restore_16odd thread

arch/mips/include/asm/mach-cavium-octeon/mangle-port.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
static inline bool __should_swizzle_bits(volatile void *a)
1616
{
1717
extern const bool octeon_should_swizzle_table[];
18+
u64 did = ((u64)(uintptr_t)a >> 40) & 0xff;
1819

19-
unsigned long did = ((unsigned long)a >> 40) & 0xff;
2020
return octeon_should_swizzle_table[did];
2121
}
2222

@@ -29,7 +29,7 @@ static inline bool __should_swizzle_bits(volatile void *a)
2929

3030
#define __should_swizzle_bits(a) false
3131

32-
static inline bool __should_swizzle_addr(unsigned long p)
32+
static inline bool __should_swizzle_addr(u64 p)
3333
{
3434
/* boot bus? */
3535
return ((p >> 40) & 0xff) == 0;

arch/mips/include/asm/mach-paravirt/kernel-entry-init.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
#define CP0_EBASE $15, 1
1212

1313
.macro kernel_entry_setup
14+
#ifdef CONFIG_SMP
1415
mfc0 t0, CP0_EBASE
1516
andi t0, t0, 0x3ff # CPUNum
1617
beqz t0, 1f
1718
# CPUs other than zero goto smp_bootstrap
1819
j smp_bootstrap
20+
#endif /* CONFIG_SMP */
1921

2022
1:
2123
.endm

arch/mips/kernel/mips-r2-to-r6-emul.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,9 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, unsigned long *fcr31)
11641164
regs->regs[31] = r31;
11651165
regs->cp0_epc = epc;
11661166
if (!used_math()) { /* First time FPU user. */
1167+
preempt_disable();
11671168
err = init_fpu();
1169+
preempt_enable();
11681170
set_used_math();
11691171
}
11701172
lose_fpu(1); /* Save FPU state for the emulator. */

arch/mips/kernel/process.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,14 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
605605
return -EOPNOTSUPP;
606606

607607
/* 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))
610610
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)
612612
return -EOPNOTSUPP;
613613

614614
/* 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)
616616
return -EOPNOTSUPP;
617617

618618
/* Proceed with the mode switch */

arch/mips/kernel/setup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type)
8787
int x = boot_mem_map.nr_map;
8888
int i;
8989

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+
9097
/* Sanity check */
9198
if (start + size < start) {
9299
pr_warn("Trying to add an invalid memory region, skipped\n");

arch/mips/kernel/smp.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,16 @@ asmlinkage void start_secondary(void)
322322
cpumask_set_cpu(cpu, &cpu_coherent_mask);
323323
notify_cpu_starting(cpu);
324324

325+
cpumask_set_cpu(cpu, &cpu_callin_map);
326+
synchronise_count_slave(cpu);
327+
325328
set_cpu_online(cpu, true);
326329

327330
set_cpu_sibling_map(cpu);
328331
set_cpu_core_map(cpu);
329332

330333
calculate_cpu_foreign_map();
331334

332-
cpumask_set_cpu(cpu, &cpu_callin_map);
333-
334-
synchronise_count_slave(cpu);
335-
336335
/*
337336
* irq will be enabled in ->smp_finish(), enabling it too early
338337
* is dangerous.

arch/mips/kernel/uprobes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,
222222
return NOTIFY_DONE;
223223

224224
switch (val) {
225-
case DIE_BREAK:
225+
case DIE_UPROBE:
226226
if (uprobe_pre_sstep_notifier(regs))
227227
return NOTIFY_STOP;
228228
break;

arch/mips/kernel/vdso.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ static struct vm_special_mapping vdso_vvar_mapping = {
3939
static void __init init_vdso_image(struct mips_vdso_image *image)
4040
{
4141
unsigned long num_pages, i;
42+
unsigned long data_pfn;
4243

4344
BUG_ON(!PAGE_ALIGNED(image->data));
4445
BUG_ON(!PAGE_ALIGNED(image->size));
4546

4647
num_pages = image->size / PAGE_SIZE;
4748

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);
5252
}
5353

5454
static int __init init_vdso(void)

arch/mips/math-emu/dsemul.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,5 +298,6 @@ bool do_dsemulret(struct pt_regs *xcp)
298298
/* Set EPC to return to post-branch instruction */
299299
xcp->cp0_epc = current->thread.bd_emu_cont_pc;
300300
pr_debug("dsemulret to 0x%08lx\n", xcp->cp0_epc);
301+
MIPS_FPU_EMU_INC_STATS(ds_emul);
301302
return true;
302303
}

arch/mips/mm/c-r4k.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
800800
* If address-based cache ops don't require an SMP call, then
801801
* use them exclusively for small flushes.
802802
*/
803-
size = start - end;
803+
size = end - start;
804804
cache_size = icache_size;
805805
if (!cpu_has_ic_fills_f_dc) {
806806
size *= 2;

arch/mips/mm/init.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ unsigned __weak platform_maar_init(unsigned num_pairs)
261261
{
262262
struct maar_config cfg[BOOT_MEM_MAP_MAX];
263263
unsigned i, num_configured, num_cfg = 0;
264-
phys_addr_t skip;
265264

266265
for (i = 0; i < boot_mem_map.nr_map; i++) {
267266
switch (boot_mem_map.map[i].type) {
@@ -272,14 +271,14 @@ unsigned __weak platform_maar_init(unsigned num_pairs)
272271
continue;
273272
}
274273

275-
skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff);
276-
274+
/* Round lower up */
277275
cfg[num_cfg].lower = boot_mem_map.map[i].addr;
278-
cfg[num_cfg].lower += skip;
276+
cfg[num_cfg].lower = (cfg[num_cfg].lower + 0xffff) & ~0xffff;
279277

280-
cfg[num_cfg].upper = cfg[num_cfg].lower;
281-
cfg[num_cfg].upper += boot_mem_map.map[i].size - 1;
282-
cfg[num_cfg].upper -= skip;
278+
/* Round upper down */
279+
cfg[num_cfg].upper = boot_mem_map.map[i].addr +
280+
boot_mem_map.map[i].size;
281+
cfg[num_cfg].upper = (cfg[num_cfg].upper & ~0xffff) - 1;
283282

284283
cfg[num_cfg].attrs = MIPS_MAAR_S;
285284
num_cfg++;

0 commit comments

Comments
 (0)