aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/head.S3
-rw-r--r--arch/mips/kernel/irq_txx9.c2
-rw-r--r--arch/mips/kernel/module.c12
-rw-r--r--arch/mips/kernel/proc.c2
-rw-r--r--arch/mips/kernel/process.c4
-rw-r--r--arch/mips/kernel/scall32-o32.S1
-rw-r--r--arch/mips/kernel/scall64-64.S1
-rw-r--r--arch/mips/kernel/scall64-n32.S1
-rw-r--r--arch/mips/kernel/scall64-o32.S1
-rw-r--r--arch/mips/kernel/smtc.c13
-rw-r--r--arch/mips/kernel/stacktrace.c2
-rw-r--r--arch/mips/kernel/vpe.c49
12 files changed, 47 insertions, 44 deletions
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 492a0a8d70f..531ce7b1612 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -188,7 +188,8 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
188 188
189 MTC0 zero, CP0_CONTEXT # clear context register 189 MTC0 zero, CP0_CONTEXT # clear context register
190 PTR_LA $28, init_thread_union 190 PTR_LA $28, init_thread_union
191 PTR_LI sp, _THREAD_SIZE - 32 191 /* Set the SP after an empty pt_regs. */
192 PTR_LI sp, _THREAD_SIZE - 32 - PT_SIZE
192 PTR_ADDU sp, $28 193 PTR_ADDU sp, $28
193 set_saved_sp sp, t0, t1 194 set_saved_sp sp, t0, t1
194 PTR_SUBU sp, 4 * SZREG # init stack pointer 195 PTR_SUBU sp, 4 * SZREG # init stack pointer
diff --git a/arch/mips/kernel/irq_txx9.c b/arch/mips/kernel/irq_txx9.c
index a4d1462c27f..9b78029bea7 100644
--- a/arch/mips/kernel/irq_txx9.c
+++ b/arch/mips/kernel/irq_txx9.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/mips/kernel/irq_txx9.c
3 *
4 * Based on linux/arch/mips/jmr3927/rbhma3100/irq.c, 2 * Based on linux/arch/mips/jmr3927/rbhma3100/irq.c,
5 * linux/arch/mips/tx4927/common/tx4927_irq.c, 3 * linux/arch/mips/tx4927/common/tx4927_irq.c,
6 * linux/arch/mips/tx4938/common/irq.c 4 * linux/arch/mips/tx4938/common/irq.c
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index 3e9100dcc12..6f51dda87fc 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -98,7 +98,8 @@ static int apply_r_mips_32_rela(struct module *me, u32 *location, Elf_Addr v)
98static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) 98static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
99{ 99{
100 if (v % 4) { 100 if (v % 4) {
101 printk(KERN_ERR "module %s: dangerous relocation\n", me->name); 101 pr_err("module %s: dangerous R_MIPS_26 REL relocation\n",
102 me->name);
102 return -ENOEXEC; 103 return -ENOEXEC;
103 } 104 }
104 105
@@ -118,7 +119,8 @@ static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
118static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) 119static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v)
119{ 120{
120 if (v % 4) { 121 if (v % 4) {
121 printk(KERN_ERR "module %s: dangerous relocation\n", me->name); 122 pr_err("module %s: dangerous R_MIPS_26 RELArelocation\n",
123 me->name);
122 return -ENOEXEC; 124 return -ENOEXEC;
123 } 125 }
124 126
@@ -222,7 +224,7 @@ static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)
222 return 0; 224 return 0;
223 225
224out_danger: 226out_danger:
225 printk(KERN_ERR "module %s: dangerous " "relocation\n", me->name); 227 pr_err("module %s: dangerous R_MIPS_LO16 REL relocation\n", me->name);
226 228
227 return -ENOEXEC; 229 return -ENOEXEC;
228} 230}
@@ -301,7 +303,7 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
301 /* This is the symbol it is referring to */ 303 /* This is the symbol it is referring to */
302 sym = (Elf_Sym *)sechdrs[symindex].sh_addr 304 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
303 + ELF_MIPS_R_SYM(rel[i]); 305 + ELF_MIPS_R_SYM(rel[i]);
304 if (!sym->st_value) { 306 if (IS_ERR_VALUE(sym->st_value)) {
305 /* Ignore unresolved weak symbol */ 307 /* Ignore unresolved weak symbol */
306 if (ELF_ST_BIND(sym->st_info) == STB_WEAK) 308 if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
307 continue; 309 continue;
@@ -341,7 +343,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
341 /* This is the symbol it is referring to */ 343 /* This is the symbol it is referring to */
342 sym = (Elf_Sym *)sechdrs[symindex].sh_addr 344 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
343 + ELF_MIPS_R_SYM(rel[i]); 345 + ELF_MIPS_R_SYM(rel[i]);
344 if (!sym->st_value) { 346 if (IS_ERR_VALUE(sym->st_value)) {
345 /* Ignore unresolved weak symbol */ 347 /* Ignore unresolved weak symbol */
346 if (ELF_ST_BIND(sym->st_info) == STB_WEAK) 348 if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
347 continue; 349 continue;
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index e0a4ac18fa0..26109c4d517 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/mips/kernel/proc.c
3 *
4 * Copyright (C) 1995, 1996, 2001 Ralf Baechle 2 * Copyright (C) 1995, 1996, 2001 Ralf Baechle
5 * Copyright (C) 2001, 2004 MIPS Technologies, Inc. 3 * Copyright (C) 2001, 2004 MIPS Technologies, Inc.
6 * Copyright (C) 2004 Maciej W. Rozycki 4 * Copyright (C) 2004 Maciej W. Rozycki
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index c09d681b718..f3d73e1831c 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -115,7 +115,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
115{ 115{
116 struct thread_info *ti = task_thread_info(p); 116 struct thread_info *ti = task_thread_info(p);
117 struct pt_regs *childregs; 117 struct pt_regs *childregs;
118 long childksp; 118 unsigned long childksp;
119 p->set_child_tid = p->clear_child_tid = NULL; 119 p->set_child_tid = p->clear_child_tid = NULL;
120 120
121 childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32; 121 childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;
@@ -132,6 +132,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
132 132
133 /* set up new TSS. */ 133 /* set up new TSS. */
134 childregs = (struct pt_regs *) childksp - 1; 134 childregs = (struct pt_regs *) childksp - 1;
135 /* Put the stack after the struct pt_regs. */
136 childksp = (unsigned long) childregs;
135 *childregs = *regs; 137 *childregs = *regs;
136 childregs->regs[7] = 0; /* Clear error flag */ 138 childregs->regs[7] = 0; /* Clear error flag */
137 139
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 20a86e08fd5..b5708212353 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -654,6 +654,7 @@ einval: li v0, -ENOSYS
654 sys sys_pwritev 6 654 sys sys_pwritev 6
655 sys sys_rt_tgsigqueueinfo 4 655 sys sys_rt_tgsigqueueinfo 4
656 sys sys_perf_counter_open 5 656 sys sys_perf_counter_open 5
657 sys sys_accept4 4
657 .endm 658 .endm
658 659
659 /* We pre-compute the number of _instruction_ bytes needed to 660 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index b046130d4c5..3d866f24e06 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -491,4 +491,5 @@ sys_call_table:
491 PTR sys_pwritev /* 5390 */ 491 PTR sys_pwritev /* 5390 */
492 PTR sys_rt_tgsigqueueinfo 492 PTR sys_rt_tgsigqueueinfo
493 PTR sys_perf_counter_open 493 PTR sys_perf_counter_open
494 PTR sys_accept4
494 .size sys_call_table,.-sys_call_table 495 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 15874f9812c..e855b118a07 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -417,4 +417,5 @@ EXPORT(sysn32_call_table)
417 PTR sys_pwritev 417 PTR sys_pwritev
418 PTR compat_sys_rt_tgsigqueueinfo /* 5295 */ 418 PTR compat_sys_rt_tgsigqueueinfo /* 5295 */
419 PTR sys_perf_counter_open 419 PTR sys_perf_counter_open
420 PTR sys_accept4
420 .size sysn32_call_table,.-sysn32_call_table 421 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 781e0f1e953..0c49f1a660b 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -537,4 +537,5 @@ sys_call_table:
537 PTR compat_sys_pwritev 537 PTR compat_sys_pwritev
538 PTR compat_sys_rt_tgsigqueueinfo 538 PTR compat_sys_rt_tgsigqueueinfo
539 PTR sys_perf_counter_open 539 PTR sys_perf_counter_open
540 PTR sys_accept4
540 .size sys_call_table,.-sys_call_table 541 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 8a0626cbb10..c16bb6d6c25 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -465,11 +465,8 @@ void smtc_prepare_cpus(int cpus)
465 smtc_configure_tlb(); 465 smtc_configure_tlb();
466 466
467 for (tc = 0, vpe = 0 ; (vpe < nvpe) && (tc < ntc) ; vpe++) { 467 for (tc = 0, vpe = 0 ; (vpe < nvpe) && (tc < ntc) ; vpe++) {
468 /* 468 if (tcpervpe[vpe] == 0)
469 * Set the MVP bits. 469 continue;
470 */
471 settc(tc);
472 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_MVP);
473 if (vpe != 0) 470 if (vpe != 0)
474 printk(", "); 471 printk(", ");
475 printk("VPE %d: TC", vpe); 472 printk("VPE %d: TC", vpe);
@@ -488,6 +485,12 @@ void smtc_prepare_cpus(int cpus)
488 } 485 }
489 if (vpe != 0) { 486 if (vpe != 0) {
490 /* 487 /*
488 * Allow this VPE to control others.
489 */
490 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() |
491 VPECONF0_MVP);
492
493 /*
491 * Clear any stale software interrupts from VPE's Cause 494 * Clear any stale software interrupts from VPE's Cause
492 */ 495 */
493 write_vpe_c0_cause(0); 496 write_vpe_c0_cause(0);
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
index 58f5cd76c8c..d52ff77baf3 100644
--- a/arch/mips/kernel/stacktrace.c
+++ b/arch/mips/kernel/stacktrace.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/mips/kernel/stacktrace.c
3 *
4 * Stack trace management functions 2 * Stack trace management functions
5 * 3 *
6 * Copyright (C) 2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp> 4 * Copyright (C) 2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 07b9ec2c6e3..9a1ab7e87fd 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -73,7 +73,7 @@ static int major;
73static const int minor = 1; /* fixed for now */ 73static const int minor = 1; /* fixed for now */
74 74
75#ifdef CONFIG_MIPS_APSP_KSPD 75#ifdef CONFIG_MIPS_APSP_KSPD
76 static struct kspd_notifications kspd_events; 76static struct kspd_notifications kspd_events;
77static int kspd_events_reqd = 0; 77static int kspd_events_reqd = 0;
78#endif 78#endif
79 79
@@ -155,10 +155,9 @@ struct {
155}; 155};
156 156
157static void release_progmem(void *ptr); 157static void release_progmem(void *ptr);
158extern void save_gp_address(unsigned int secbase, unsigned int rel);
159 158
160/* get the vpe associated with this minor */ 159/* get the vpe associated with this minor */
161struct vpe *get_vpe(int minor) 160static struct vpe *get_vpe(int minor)
162{ 161{
163 struct vpe *v; 162 struct vpe *v;
164 163
@@ -174,7 +173,7 @@ struct vpe *get_vpe(int minor)
174} 173}
175 174
176/* get the vpe associated with this minor */ 175/* get the vpe associated with this minor */
177struct tc *get_tc(int index) 176static struct tc *get_tc(int index)
178{ 177{
179 struct tc *t; 178 struct tc *t;
180 179
@@ -186,20 +185,8 @@ struct tc *get_tc(int index)
186 return NULL; 185 return NULL;
187} 186}
188 187
189struct tc *get_tc_unused(void)
190{
191 struct tc *t;
192
193 list_for_each_entry(t, &vpecontrol.tc_list, list) {
194 if (t->state == TC_STATE_UNUSED)
195 return t;
196 }
197
198 return NULL;
199}
200
201/* allocate a vpe and associate it with this minor (or index) */ 188/* allocate a vpe and associate it with this minor (or index) */
202struct vpe *alloc_vpe(int minor) 189static struct vpe *alloc_vpe(int minor)
203{ 190{
204 struct vpe *v; 191 struct vpe *v;
205 192
@@ -216,7 +203,7 @@ struct vpe *alloc_vpe(int minor)
216} 203}
217 204
218/* allocate a tc. At startup only tc0 is running, all other can be halted. */ 205/* allocate a tc. At startup only tc0 is running, all other can be halted. */
219struct tc *alloc_tc(int index) 206static struct tc *alloc_tc(int index)
220{ 207{
221 struct tc *tc; 208 struct tc *tc;
222 209
@@ -232,7 +219,7 @@ out:
232} 219}
233 220
234/* clean up and free everything */ 221/* clean up and free everything */
235void release_vpe(struct vpe *v) 222static void release_vpe(struct vpe *v)
236{ 223{
237 list_del(&v->list); 224 list_del(&v->list);
238 if (v->load_addr) 225 if (v->load_addr)
@@ -240,7 +227,7 @@ void release_vpe(struct vpe *v)
240 kfree(v); 227 kfree(v);
241} 228}
242 229
243void dump_mtregs(void) 230static void dump_mtregs(void)
244{ 231{
245 unsigned long val; 232 unsigned long val;
246 233
@@ -327,7 +314,8 @@ static void layout_sections(struct module *mod, const Elf_Ehdr * hdr,
327 || (s->sh_flags & masks[m][1]) 314 || (s->sh_flags & masks[m][1])
328 || s->sh_entsize != ~0UL) 315 || s->sh_entsize != ~0UL)
329 continue; 316 continue;
330 s->sh_entsize = get_offset(&mod->core_size, s); 317 s->sh_entsize =
318 get_offset((unsigned long *)&mod->core_size, s);
331 } 319 }
332 320
333 if (m == 0) 321 if (m == 0)
@@ -461,16 +449,15 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
461{ 449{
462 unsigned long insnlo = *location; 450 unsigned long insnlo = *location;
463 Elf32_Addr val, vallo; 451 Elf32_Addr val, vallo;
452 struct mips_hi16 *l, *next;
464 453
465 /* Sign extend the addend we extract from the lo insn. */ 454 /* Sign extend the addend we extract from the lo insn. */
466 vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; 455 vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000;
467 456
468 if (mips_hi16_list != NULL) { 457 if (mips_hi16_list != NULL) {
469 struct mips_hi16 *l;
470 458
471 l = mips_hi16_list; 459 l = mips_hi16_list;
472 while (l != NULL) { 460 while (l != NULL) {
473 struct mips_hi16 *next;
474 unsigned long insn; 461 unsigned long insn;
475 462
476 /* 463 /*
@@ -480,7 +467,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
480 printk(KERN_DEBUG "VPE loader: " 467 printk(KERN_DEBUG "VPE loader: "
481 "apply_r_mips_lo16/hi16: \t" 468 "apply_r_mips_lo16/hi16: \t"
482 "inconsistent value information\n"); 469 "inconsistent value information\n");
483 return -ENOEXEC; 470 goto out_free;
484 } 471 }
485 472
486 /* 473 /*
@@ -518,6 +505,16 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
518 *location = insnlo; 505 *location = insnlo;
519 506
520 return 0; 507 return 0;
508
509out_free:
510 while (l != NULL) {
511 next = l->next;
512 kfree(l);
513 l = next;
514 }
515 mips_hi16_list = NULL;
516
517 return -ENOEXEC;
521} 518}
522 519
523static int (*reloc_handlers[]) (struct module *me, uint32_t *location, 520static int (*reloc_handlers[]) (struct module *me, uint32_t *location,
@@ -541,7 +538,7 @@ static char *rstrs[] = {
541 [R_MIPS_PC16] = "MIPS_PC16" 538 [R_MIPS_PC16] = "MIPS_PC16"
542}; 539};
543 540
544int apply_relocations(Elf32_Shdr *sechdrs, 541static int apply_relocations(Elf32_Shdr *sechdrs,
545 const char *strtab, 542 const char *strtab,
546 unsigned int symindex, 543 unsigned int symindex,
547 unsigned int relsec, 544 unsigned int relsec,
@@ -586,7 +583,7 @@ int apply_relocations(Elf32_Shdr *sechdrs,
586 return 0; 583 return 0;
587} 584}
588 585
589void save_gp_address(unsigned int secbase, unsigned int rel) 586static inline void save_gp_address(unsigned int secbase, unsigned int rel)
590{ 587{
591 gp_addr = secbase + rel; 588 gp_addr = secbase + rel;
592 gp_offs = gp_addr - (secbase & 0xffff0000); 589 gp_offs = gp_addr - (secbase & 0xffff0000);