Skip to content

Commit 3d339d3

Browse files
committed
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: "Another round of 4.11 for the MIPS architecture. This time around it's mostly arch but little platforms-specific code. - PCI: Register controllers in the right order to aoid a PCI error - KGDB: Use kernel context for sleeping threads - smp-cps: Fix potentially uninitialised value of core - KASLR: Fix build - ELF: Fix BUG() warning in arch_check_elf - Fix modversioning of _mcount symbol - fix out-of-tree defconfig target builds - cevt-r4k: Fix out-of-bounds array access - perf: fix deadlock - Malta: Fix i8259 irqchip setup" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: PCI: add controllers before the specified head MIPS: KGDB: Use kernel context for sleeping threads MIPS: smp-cps: Fix potentially uninitialised value of core MIPS: KASLR: Add missing header files MIPS: Avoid BUG warning in arch_check_elf MIPS: Fix modversioning of _mcount symbol MIPS: generic: fix out-of-tree defconfig target builds MIPS: cevt-r4k: Fix out-of-bounds array access MIPS: perf: fix deadlock MIPS: Malta: Fix i8259 irqchip setup
2 parents 5a7ad11 + edb0b6a commit 3d339d3

File tree

10 files changed

+58
-28
lines changed

10 files changed

+58
-28
lines changed

arch/mips/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ $(generic_defconfigs):
489489
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
490490
-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/generic_defconfig $^ \
491491
$(foreach board,$(BOARDS),$(generic_config_dir)/board-$(board).config)
492-
$(Q)$(MAKE) olddefconfig
492+
$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
493493

494494
#
495495
# Prevent generic merge_config rules attempting to merge single fragments
@@ -503,8 +503,8 @@ $(generic_config_dir)/%.config: ;
503503
#
504504
.PHONY: sead3_defconfig
505505
sead3_defconfig:
506-
$(Q)$(MAKE) 32r2el_defconfig BOARDS=sead-3
506+
$(Q)$(MAKE) -f $(srctree)/Makefile 32r2el_defconfig BOARDS=sead-3
507507

508508
.PHONY: sead3micro_defconfig
509509
sead3micro_defconfig:
510-
$(Q)$(MAKE) micro32r2el_defconfig BOARDS=sead-3
510+
$(Q)$(MAKE) -f $(srctree)/Makefile micro32r2el_defconfig BOARDS=sead-3

arch/mips/include/asm/asm-prototypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
#include <asm/fpu.h>
44
#include <asm-generic/asm-prototypes.h>
55
#include <asm/uaccess.h>
6+
#include <asm/ftrace.h>

arch/mips/kernel/cevt-r4k.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static unsigned int calculate_min_delta(void)
8080
}
8181

8282
/* Sorted insert of 75th percentile into buf2 */
83-
for (k = 0; k < i; ++k) {
83+
for (k = 0; k < i && k < ARRAY_SIZE(buf2); ++k) {
8484
if (buf1[ARRAY_SIZE(buf1) - 1] < buf2[k]) {
8585
l = min_t(unsigned int,
8686
i, ARRAY_SIZE(buf2) - 1);

arch/mips/kernel/elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ int arch_check_elf(void *_ehdr, bool has_interpreter, void *_interp_ehdr,
257257
else if ((prog_req.fr1 && prog_req.frdefault) ||
258258
(prog_req.single && !prog_req.frdefault))
259259
/* Make sure 64-bit MIPS III/IV/64R1 will not pick FR1 */
260-
state->overall_fp_mode = ((current_cpu_data.fpu_id & MIPS_FPIR_F64) &&
260+
state->overall_fp_mode = ((raw_current_cpu_data.fpu_id & MIPS_FPIR_F64) &&
261261
cpu_has_mips_r2_r6) ?
262262
FP_FR1 : FP_FR0;
263263
else if (prog_req.fr1)

arch/mips/kernel/kgdb.c

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,35 +244,53 @@ static int compute_signal(int tt)
244244
void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
245245
{
246246
int reg;
247-
struct thread_info *ti = task_thread_info(p);
248-
unsigned long ksp = (unsigned long)ti + THREAD_SIZE - 32;
249-
struct pt_regs *regs = (struct pt_regs *)ksp - 1;
250247
#if (KGDB_GDB_REG_SIZE == 32)
251248
u32 *ptr = (u32 *)gdb_regs;
252249
#else
253250
u64 *ptr = (u64 *)gdb_regs;
254251
#endif
255252

256253
for (reg = 0; reg < 16; reg++)
257-
*(ptr++) = regs->regs[reg];
254+
*(ptr++) = 0;
258255

259256
/* S0 - S7 */
260-
for (reg = 16; reg < 24; reg++)
261-
*(ptr++) = regs->regs[reg];
257+
*(ptr++) = p->thread.reg16;
258+
*(ptr++) = p->thread.reg17;
259+
*(ptr++) = p->thread.reg18;
260+
*(ptr++) = p->thread.reg19;
261+
*(ptr++) = p->thread.reg20;
262+
*(ptr++) = p->thread.reg21;
263+
*(ptr++) = p->thread.reg22;
264+
*(ptr++) = p->thread.reg23;
262265

263266
for (reg = 24; reg < 28; reg++)
264267
*(ptr++) = 0;
265268

266269
/* GP, SP, FP, RA */
267-
for (reg = 28; reg < 32; reg++)
268-
*(ptr++) = regs->regs[reg];
269-
270-
*(ptr++) = regs->cp0_status;
271-
*(ptr++) = regs->lo;
272-
*(ptr++) = regs->hi;
273-
*(ptr++) = regs->cp0_badvaddr;
274-
*(ptr++) = regs->cp0_cause;
275-
*(ptr++) = regs->cp0_epc;
270+
*(ptr++) = (long)p;
271+
*(ptr++) = p->thread.reg29;
272+
*(ptr++) = p->thread.reg30;
273+
*(ptr++) = p->thread.reg31;
274+
275+
*(ptr++) = p->thread.cp0_status;
276+
277+
/* lo, hi */
278+
*(ptr++) = 0;
279+
*(ptr++) = 0;
280+
281+
/*
282+
* BadVAddr, Cause
283+
* Ideally these would come from the last exception frame up the stack
284+
* but that requires unwinding, otherwise we can't know much for sure.
285+
*/
286+
*(ptr++) = 0;
287+
*(ptr++) = 0;
288+
289+
/*
290+
* PC
291+
* use return address (RA), i.e. the moment after return from resume()
292+
*/
293+
*(ptr++) = p->thread.reg31;
276294
}
277295

278296
void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)

arch/mips/kernel/perf_event_mipsxx.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,11 @@ static int mipsxx_pmu_handle_shared_irq(void)
14461446
HANDLE_COUNTER(0)
14471447
}
14481448

1449+
#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
1450+
read_unlock(&pmuint_rwlock);
1451+
#endif
1452+
resume_local_counters();
1453+
14491454
/*
14501455
* Do all the work for the pending perf events. We can do this
14511456
* in here because the performance counter interrupt is a regular
@@ -1454,10 +1459,6 @@ static int mipsxx_pmu_handle_shared_irq(void)
14541459
if (handled == IRQ_HANDLED)
14551460
irq_work_run();
14561461

1457-
#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
1458-
read_unlock(&pmuint_rwlock);
1459-
#endif
1460-
resume_local_counters();
14611462
return handled;
14621463
}
14631464

arch/mips/kernel/relocate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <linux/kernel.h>
1919
#include <linux/libfdt.h>
2020
#include <linux/of_fdt.h>
21-
#include <linux/sched.h>
21+
#include <linux/sched/task.h>
2222
#include <linux/start_kernel.h>
2323
#include <linux/string.h>
2424
#include <linux/printk.h>

arch/mips/kernel/smp-cps.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,12 @@ void play_dead(void)
422422
local_irq_disable();
423423
idle_task_exit();
424424
cpu = smp_processor_id();
425+
core = cpu_data[cpu].core;
425426
cpu_death = CPU_DEATH_POWER;
426427

427428
pr_debug("CPU%d going offline\n", cpu);
428429

429430
if (cpu_has_mipsmt || cpu_has_vp) {
430-
core = cpu_data[cpu].core;
431-
432431
/* Look for another online VPE within the core */
433432
for_each_online_cpu(cpu_death_sibling) {
434433
if (cpu_data[cpu_death_sibling].core != core)

arch/mips/mti-malta/malta-int.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,17 @@ void __init arch_init_irq(void)
232232
{
233233
int corehi_irq;
234234

235+
/*
236+
* Preallocate the i8259's expected virq's here. Since irqchip_init()
237+
* will probe the irqchips in hierarchial order, i8259 is probed last.
238+
* If anything allocates a virq before the i8259 is probed, it will
239+
* be given one of the i8259's expected range and consequently setup
240+
* of the i8259 will fail.
241+
*/
242+
WARN(irq_alloc_descs(I8259A_IRQ_BASE, I8259A_IRQ_BASE,
243+
16, numa_node_id()) < 0,
244+
"Cannot reserve i8259 virqs at IRQ%d\n", I8259A_IRQ_BASE);
245+
235246
i8259_set_poll(mips_pcibios_iack);
236247
irqchip_init();
237248

arch/mips/pci/pci-legacy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void register_pci_controller(struct pci_controller *hose)
190190
}
191191

192192
INIT_LIST_HEAD(&hose->list);
193-
list_add(&hose->list, &controllers);
193+
list_add_tail(&hose->list, &controllers);
194194

195195
/*
196196
* Do not panic here but later - this might happen before console init.

0 commit comments

Comments
 (0)