diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 10:56:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 10:56:44 -0500 |
commit | b7f3a209e9b09b3110ea084836c75f2cd26b29f2 (patch) | |
tree | b5f77cb3f2eab58a2a2f3705fdd08bd39ea02a3f /arch/sparc | |
parent | 6d6b89bd2e316b78d668f761d380837b81fa71ef (diff) | |
parent | 4b17764737bb4ee3364b8bfa2059f51ebc19ccd6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6:
sparc: Support show_unhandled_signals.
sparc: use __ratelimit
sunxvr500: Additional PCI id for sunxvr500 driver
sparc: use asm-generic/scatterlist.h
sparc64: If 'slot-names' property exist, create sysfs PCI slot information.
sparc: remove trailing space in messages
sparc: remove redundant return statements
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/scatterlist.h | 21 | ||||
-rw-r--r-- | arch/sparc/kernel/devices.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_kernel.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_smp.c | 4 | ||||
-rw-r--r-- | arch/sparc/kernel/pci.c | 75 | ||||
-rw-r--r-- | arch/sparc/kernel/pcic.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/setup_32.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/sun4d_smp.c | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/unaligned_64.c | 11 | ||||
-rw-r--r-- | arch/sparc/mm/fault_32.c | 106 | ||||
-rw-r--r-- | arch/sparc/mm/fault_64.c | 34 | ||||
-rw-r--r-- | arch/sparc/prom/console_32.c | 1 | ||||
-rw-r--r-- | arch/sparc/prom/console_64.c | 1 | ||||
-rw-r--r-- | arch/sparc/prom/devmap.c | 1 | ||||
-rw-r--r-- | arch/sparc/prom/devops_32.c | 2 | ||||
-rw-r--r-- | arch/sparc/prom/init_32.c | 1 | ||||
-rw-r--r-- | arch/sparc/prom/palloc.c | 1 | ||||
-rw-r--r-- | arch/sparc/prom/ranges.c | 2 | ||||
-rw-r--r-- | arch/sparc/prom/segment.c | 1 | ||||
-rw-r--r-- | arch/sparc/prom/tree_32.c | 1 | ||||
-rw-r--r-- | arch/sparc/prom/tree_64.c | 1 |
21 files changed, 174 insertions, 99 deletions
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h index e580f5581c88..d1120257b033 100644 --- a/arch/sparc/include/asm/scatterlist.h +++ b/arch/sparc/include/asm/scatterlist.h | |||
@@ -1,27 +1,8 @@ | |||
1 | #ifndef _SPARC_SCATTERLIST_H | 1 | #ifndef _SPARC_SCATTERLIST_H |
2 | #define _SPARC_SCATTERLIST_H | 2 | #define _SPARC_SCATTERLIST_H |
3 | 3 | ||
4 | #include <asm/page.h> | ||
5 | #include <asm/types.h> | ||
6 | |||
7 | struct scatterlist { | ||
8 | #ifdef CONFIG_DEBUG_SG | ||
9 | unsigned long sg_magic; | ||
10 | #endif | ||
11 | unsigned long page_link; | ||
12 | unsigned int offset; | ||
13 | |||
14 | unsigned int length; | ||
15 | |||
16 | dma_addr_t dma_address; | ||
17 | __u32 dma_length; | ||
18 | }; | ||
19 | |||
20 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
21 | #define sg_dma_len(sg) ((sg)->dma_length) | 4 | #define sg_dma_len(sg) ((sg)->dma_length) |
22 | 5 | ||
23 | #define ISA_DMA_THRESHOLD (~0UL) | 6 | #include <asm-generic/scatterlist.h> |
24 | |||
25 | #define ARCH_HAS_SG_CHAIN | ||
26 | 7 | ||
27 | #endif /* !(_SPARC_SCATTERLIST_H) */ | 8 | #endif /* !(_SPARC_SCATTERLIST_H) */ |
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c index b062de9424a4..62dc7a021413 100644 --- a/arch/sparc/kernel/devices.c +++ b/arch/sparc/kernel/devices.c | |||
@@ -143,6 +143,4 @@ void __init device_scan(void) | |||
143 | 143 | ||
144 | if (ARCH_SUN4C) | 144 | if (ARCH_SUN4C) |
145 | sun4c_probe_memerr_reg(); | 145 | sun4c_probe_memerr_reg(); |
146 | |||
147 | return; | ||
148 | } | 146 | } |
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index 87f1760c0aa2..0409d62d8ca2 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -124,7 +124,7 @@ void __init leon_init_timers(irq_handler_t counter_fn) | |||
124 | 124 | ||
125 | if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & | 125 | if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & |
126 | (1<<LEON3_GPTIMER_SEPIRQ))) { | 126 | (1<<LEON3_GPTIMER_SEPIRQ))) { |
127 | prom_printf("irq timer not configured with seperate irqs \n"); | 127 | prom_printf("irq timer not configured with separate irqs\n"); |
128 | BUG(); | 128 | BUG(); |
129 | } | 129 | } |
130 | 130 | ||
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 05c0dadd6371..85787577f683 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -177,7 +177,7 @@ void __init leon_boot_cpus(void) | |||
177 | int nrcpu = leon_smp_nrcpus(); | 177 | int nrcpu = leon_smp_nrcpus(); |
178 | int me = smp_processor_id(); | 178 | int me = smp_processor_id(); |
179 | 179 | ||
180 | printk(KERN_INFO "%d:(%d:%d) cpus mpirq at 0x%x \n", (unsigned int)me, | 180 | printk(KERN_INFO "%d:(%d:%d) cpus mpirq at 0x%x\n", (unsigned int)me, |
181 | (unsigned int)nrcpu, (unsigned int)NR_CPUS, | 181 | (unsigned int)nrcpu, (unsigned int)NR_CPUS, |
182 | (unsigned int)&(leon3_irqctrl_regs->mpstatus)); | 182 | (unsigned int)&(leon3_irqctrl_regs->mpstatus)); |
183 | 183 | ||
@@ -226,7 +226,7 @@ int __cpuinit leon_boot_one_cpu(int i) | |||
226 | break; | 226 | break; |
227 | udelay(200); | 227 | udelay(200); |
228 | } | 228 | } |
229 | printk(KERN_INFO "Started CPU %d \n", (unsigned int)i); | 229 | printk(KERN_INFO "Started CPU %d\n", (unsigned int)i); |
230 | 230 | ||
231 | if (!(cpu_callin_map[i])) { | 231 | if (!(cpu_callin_map[i])) { |
232 | printk(KERN_ERR "Processor %d is stuck.\n", i); | 232 | printk(KERN_ERR "Processor %d is stuck.\n", i); |
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 37b66c60abe3..5ac539a5930f 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -1095,3 +1095,78 @@ static int __init pcibios_init(void) | |||
1095 | return 0; | 1095 | return 0; |
1096 | } | 1096 | } |
1097 | subsys_initcall(pcibios_init); | 1097 | subsys_initcall(pcibios_init); |
1098 | |||
1099 | #ifdef CONFIG_SYSFS | ||
1100 | static void __devinit pci_bus_slot_names(struct device_node *node, | ||
1101 | struct pci_bus *bus) | ||
1102 | { | ||
1103 | const struct pci_slot_names { | ||
1104 | u32 slot_mask; | ||
1105 | char names[0]; | ||
1106 | } *prop; | ||
1107 | const char *sp; | ||
1108 | int len, i; | ||
1109 | u32 mask; | ||
1110 | |||
1111 | prop = of_get_property(node, "slot-names", &len); | ||
1112 | if (!prop) | ||
1113 | return; | ||
1114 | |||
1115 | mask = prop->slot_mask; | ||
1116 | sp = prop->names; | ||
1117 | |||
1118 | if (ofpci_verbose) | ||
1119 | printk("PCI: Making slots for [%s] mask[0x%02x]\n", | ||
1120 | node->full_name, mask); | ||
1121 | |||
1122 | i = 0; | ||
1123 | while (mask) { | ||
1124 | struct pci_slot *pci_slot; | ||
1125 | u32 this_bit = 1 << i; | ||
1126 | |||
1127 | if (!(mask & this_bit)) { | ||
1128 | i++; | ||
1129 | continue; | ||
1130 | } | ||
1131 | |||
1132 | if (ofpci_verbose) | ||
1133 | printk("PCI: Making slot [%s]\n", sp); | ||
1134 | |||
1135 | pci_slot = pci_create_slot(bus, i, sp, NULL); | ||
1136 | if (IS_ERR(pci_slot)) | ||
1137 | printk(KERN_ERR "PCI: pci_create_slot returned %ld\n", | ||
1138 | PTR_ERR(pci_slot)); | ||
1139 | |||
1140 | sp += strlen(sp) + 1; | ||
1141 | mask &= ~this_bit; | ||
1142 | i++; | ||
1143 | } | ||
1144 | } | ||
1145 | |||
1146 | static int __init of_pci_slot_init(void) | ||
1147 | { | ||
1148 | struct pci_bus *pbus = NULL; | ||
1149 | |||
1150 | while ((pbus = pci_find_next_bus(pbus)) != NULL) { | ||
1151 | struct device_node *node; | ||
1152 | |||
1153 | if (pbus->self) { | ||
1154 | struct dev_archdata *sd = pbus->self->sysdata; | ||
1155 | |||
1156 | /* PCI->PCI bridge */ | ||
1157 | node = sd->prom_node; | ||
1158 | } else { | ||
1159 | struct pci_pbm_info *pbm = pbus->sysdata; | ||
1160 | |||
1161 | /* Host PCI controller */ | ||
1162 | node = pbm->op->node; | ||
1163 | } | ||
1164 | |||
1165 | pci_bus_slot_names(node, pbus); | ||
1166 | } | ||
1167 | |||
1168 | return 0; | ||
1169 | } | ||
1170 | |||
1171 | module_init(of_pci_slot_init); | ||
1172 | #endif | ||
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 75e88c00bca3..d36a8d391ca0 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
@@ -585,8 +585,6 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node) | |||
585 | writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_LO); | 585 | writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_LO); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | |||
589 | return; | ||
590 | } | 588 | } |
591 | 589 | ||
592 | /* | 590 | /* |
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 9be2af55c5cd..b22ce6100403 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c | |||
@@ -95,8 +95,6 @@ static void prom_sync_me(void) | |||
95 | "nop\n\t" | 95 | "nop\n\t" |
96 | "nop\n\t" : : "r" (prom_tbr)); | 96 | "nop\n\t" : : "r" (prom_tbr)); |
97 | local_irq_restore(flags); | 97 | local_irq_restore(flags); |
98 | |||
99 | return; | ||
100 | } | 98 | } |
101 | 99 | ||
102 | static unsigned int boot_flags __initdata = 0; | 100 | static unsigned int boot_flags __initdata = 0; |
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index 68791cad7b74..482f2ab92692 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -194,7 +194,7 @@ int __cpuinit smp4d_boot_one_cpu(int i) | |||
194 | smp_penguin_ctable.reg_size = 0; | 194 | smp_penguin_ctable.reg_size = 0; |
195 | 195 | ||
196 | /* whirrr, whirrr, whirrrrrrrrr... */ | 196 | /* whirrr, whirrr, whirrrrrrrrr... */ |
197 | SMP_PRINTK(("Starting CPU %d at %p \n", i, entry)); | 197 | SMP_PRINTK(("Starting CPU %d at %p\n", i, entry)); |
198 | local_flush_cache_all(); | 198 | local_flush_cache_all(); |
199 | prom_startcpu(cpu_node, | 199 | prom_startcpu(cpu_node, |
200 | &smp_penguin_ctable, 0, (char *)entry); | 200 | &smp_penguin_ctable, 0, (char *)entry); |
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c index 378ca82b9ccc..ebce43018c49 100644 --- a/arch/sparc/kernel/unaligned_64.c +++ b/arch/sparc/kernel/unaligned_64.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/smp.h> | 21 | #include <linux/smp.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/perf_event.h> | 23 | #include <linux/perf_event.h> |
24 | #include <linux/ratelimit.h> | ||
24 | #include <asm/fpumacro.h> | 25 | #include <asm/fpumacro.h> |
25 | 26 | ||
26 | enum direction { | 27 | enum direction { |
@@ -274,13 +275,9 @@ static void kernel_mna_trap_fault(int fixup_tstate_asi) | |||
274 | 275 | ||
275 | static void log_unaligned(struct pt_regs *regs) | 276 | static void log_unaligned(struct pt_regs *regs) |
276 | { | 277 | { |
277 | static unsigned long count, last_time; | 278 | static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5); |
278 | 279 | ||
279 | if (time_after(jiffies, last_time + 5 * HZ)) | 280 | if (__ratelimit(&ratelimit)) { |
280 | count = 0; | ||
281 | if (count < 5) { | ||
282 | last_time = jiffies; | ||
283 | count++; | ||
284 | printk("Kernel unaligned access at TPC[%lx] %pS\n", | 281 | printk("Kernel unaligned access at TPC[%lx] %pS\n", |
285 | regs->tpc, (void *) regs->tpc); | 282 | regs->tpc, (void *) regs->tpc); |
286 | } | 283 | } |
@@ -636,7 +633,6 @@ daex: | |||
636 | return; | 633 | return; |
637 | } | 634 | } |
638 | advance(regs); | 635 | advance(regs); |
639 | return; | ||
640 | } | 636 | } |
641 | 637 | ||
642 | void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) | 638 | void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) |
@@ -685,5 +681,4 @@ daex: | |||
685 | return; | 681 | return; |
686 | } | 682 | } |
687 | advance(regs); | 683 | advance(regs); |
688 | return; | ||
689 | } | 684 | } |
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c index 3fa09ba3845f..bd8601601afa 100644 --- a/arch/sparc/mm/fault_32.c +++ b/arch/sparc/mm/fault_32.c | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | extern int prom_node_root; | 36 | extern int prom_node_root; |
37 | 37 | ||
38 | int show_unhandled_signals = 1; | ||
39 | |||
38 | /* At boot time we determine these two values necessary for setting | 40 | /* At boot time we determine these two values necessary for setting |
39 | * up the segment maps and page table entries (pte's). | 41 | * up the segment maps and page table entries (pte's). |
40 | */ | 42 | */ |
@@ -149,6 +151,45 @@ asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc, | |||
149 | return 0; | 151 | return 0; |
150 | } | 152 | } |
151 | 153 | ||
154 | static inline void | ||
155 | show_signal_msg(struct pt_regs *regs, int sig, int code, | ||
156 | unsigned long address, struct task_struct *tsk) | ||
157 | { | ||
158 | if (!unhandled_signal(tsk, sig)) | ||
159 | return; | ||
160 | |||
161 | if (!printk_ratelimit()) | ||
162 | return; | ||
163 | |||
164 | printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x", | ||
165 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | ||
166 | tsk->comm, task_pid_nr(tsk), address, | ||
167 | (void *)regs->pc, (void *)regs->u_regs[UREG_I7], | ||
168 | (void *)regs->u_regs[UREG_FP], code); | ||
169 | |||
170 | print_vma_addr(KERN_CONT " in ", regs->pc); | ||
171 | |||
172 | printk(KERN_CONT "\n"); | ||
173 | } | ||
174 | |||
175 | static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs, | ||
176 | unsigned long addr) | ||
177 | { | ||
178 | siginfo_t info; | ||
179 | |||
180 | info.si_signo = sig; | ||
181 | info.si_code = code; | ||
182 | info.si_errno = 0; | ||
183 | info.si_addr = (void __user *) addr; | ||
184 | info.si_trapno = 0; | ||
185 | |||
186 | if (unlikely(show_unhandled_signals)) | ||
187 | show_signal_msg(regs, sig, info.si_code, | ||
188 | addr, current); | ||
189 | |||
190 | force_sig_info (sig, &info, current); | ||
191 | } | ||
192 | |||
152 | extern unsigned long safe_compute_effective_address(struct pt_regs *, | 193 | extern unsigned long safe_compute_effective_address(struct pt_regs *, |
153 | unsigned int); | 194 | unsigned int); |
154 | 195 | ||
@@ -168,6 +209,14 @@ static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) | |||
168 | return safe_compute_effective_address(regs, insn); | 209 | return safe_compute_effective_address(regs, insn); |
169 | } | 210 | } |
170 | 211 | ||
212 | static noinline void do_fault_siginfo(int code, int sig, struct pt_regs *regs, | ||
213 | int text_fault) | ||
214 | { | ||
215 | unsigned long addr = compute_si_addr(regs, text_fault); | ||
216 | |||
217 | __do_fault_siginfo(code, sig, regs, addr); | ||
218 | } | ||
219 | |||
171 | asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | 220 | asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, |
172 | unsigned long address) | 221 | unsigned long address) |
173 | { | 222 | { |
@@ -176,9 +225,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
176 | struct mm_struct *mm = tsk->mm; | 225 | struct mm_struct *mm = tsk->mm; |
177 | unsigned int fixup; | 226 | unsigned int fixup; |
178 | unsigned long g2; | 227 | unsigned long g2; |
179 | siginfo_t info; | ||
180 | int from_user = !(regs->psr & PSR_PS); | 228 | int from_user = !(regs->psr & PSR_PS); |
181 | int fault; | 229 | int fault, code; |
182 | 230 | ||
183 | if(text_fault) | 231 | if(text_fault) |
184 | address = regs->pc; | 232 | address = regs->pc; |
@@ -195,7 +243,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
195 | if (!ARCH_SUN4C && address >= TASK_SIZE) | 243 | if (!ARCH_SUN4C && address >= TASK_SIZE) |
196 | goto vmalloc_fault; | 244 | goto vmalloc_fault; |
197 | 245 | ||
198 | info.si_code = SEGV_MAPERR; | 246 | code = SEGV_MAPERR; |
199 | 247 | ||
200 | /* | 248 | /* |
201 | * If we're in an interrupt or have no user | 249 | * If we're in an interrupt or have no user |
@@ -229,7 +277,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
229 | * we can handle it.. | 277 | * we can handle it.. |
230 | */ | 278 | */ |
231 | good_area: | 279 | good_area: |
232 | info.si_code = SEGV_ACCERR; | 280 | code = SEGV_ACCERR; |
233 | if(write) { | 281 | if(write) { |
234 | if(!(vma->vm_flags & VM_WRITE)) | 282 | if(!(vma->vm_flags & VM_WRITE)) |
235 | goto bad_area; | 283 | goto bad_area; |
@@ -273,18 +321,8 @@ bad_area: | |||
273 | 321 | ||
274 | bad_area_nosemaphore: | 322 | bad_area_nosemaphore: |
275 | /* User mode accesses just cause a SIGSEGV */ | 323 | /* User mode accesses just cause a SIGSEGV */ |
276 | if(from_user) { | 324 | if (from_user) { |
277 | #if 0 | 325 | do_fault_siginfo(code, SIGSEGV, regs, text_fault); |
278 | printk("Fault whee %s [%d]: segfaults at %08lx pc=%08lx\n", | ||
279 | tsk->comm, tsk->pid, address, regs->pc); | ||
280 | #endif | ||
281 | info.si_signo = SIGSEGV; | ||
282 | info.si_errno = 0; | ||
283 | /* info.si_code set above to make clear whether | ||
284 | this was a SEGV_MAPERR or SEGV_ACCERR fault. */ | ||
285 | info.si_addr = (void __user *)compute_si_addr(regs, text_fault); | ||
286 | info.si_trapno = 0; | ||
287 | force_sig_info (SIGSEGV, &info, tsk); | ||
288 | return; | 326 | return; |
289 | } | 327 | } |
290 | 328 | ||
@@ -335,12 +373,7 @@ out_of_memory: | |||
335 | 373 | ||
336 | do_sigbus: | 374 | do_sigbus: |
337 | up_read(&mm->mmap_sem); | 375 | up_read(&mm->mmap_sem); |
338 | info.si_signo = SIGBUS; | 376 | do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault); |
339 | info.si_errno = 0; | ||
340 | info.si_code = BUS_ADRERR; | ||
341 | info.si_addr = (void __user *) compute_si_addr(regs, text_fault); | ||
342 | info.si_trapno = 0; | ||
343 | force_sig_info (SIGBUS, &info, tsk); | ||
344 | if (!from_user) | 377 | if (!from_user) |
345 | goto no_context; | 378 | goto no_context; |
346 | 379 | ||
@@ -466,14 +499,10 @@ static void force_user_fault(unsigned long address, int write) | |||
466 | struct vm_area_struct *vma; | 499 | struct vm_area_struct *vma; |
467 | struct task_struct *tsk = current; | 500 | struct task_struct *tsk = current; |
468 | struct mm_struct *mm = tsk->mm; | 501 | struct mm_struct *mm = tsk->mm; |
469 | siginfo_t info; | 502 | int code; |
470 | 503 | ||
471 | info.si_code = SEGV_MAPERR; | 504 | code = SEGV_MAPERR; |
472 | 505 | ||
473 | #if 0 | ||
474 | printk("wf<pid=%d,wr=%d,addr=%08lx>\n", | ||
475 | tsk->pid, write, address); | ||
476 | #endif | ||
477 | down_read(&mm->mmap_sem); | 506 | down_read(&mm->mmap_sem); |
478 | vma = find_vma(mm, address); | 507 | vma = find_vma(mm, address); |
479 | if(!vma) | 508 | if(!vma) |
@@ -485,7 +514,7 @@ static void force_user_fault(unsigned long address, int write) | |||
485 | if(expand_stack(vma, address)) | 514 | if(expand_stack(vma, address)) |
486 | goto bad_area; | 515 | goto bad_area; |
487 | good_area: | 516 | good_area: |
488 | info.si_code = SEGV_ACCERR; | 517 | code = SEGV_ACCERR; |
489 | if(write) { | 518 | if(write) { |
490 | if(!(vma->vm_flags & VM_WRITE)) | 519 | if(!(vma->vm_flags & VM_WRITE)) |
491 | goto bad_area; | 520 | goto bad_area; |
@@ -502,27 +531,12 @@ good_area: | |||
502 | return; | 531 | return; |
503 | bad_area: | 532 | bad_area: |
504 | up_read(&mm->mmap_sem); | 533 | up_read(&mm->mmap_sem); |
505 | #if 0 | 534 | __do_fault_siginfo(code, SIGSEGV, tsk->thread.kregs, address); |
506 | printk("Window whee %s [%d]: segfaults at %08lx\n", | ||
507 | tsk->comm, tsk->pid, address); | ||
508 | #endif | ||
509 | info.si_signo = SIGSEGV; | ||
510 | info.si_errno = 0; | ||
511 | /* info.si_code set above to make clear whether | ||
512 | this was a SEGV_MAPERR or SEGV_ACCERR fault. */ | ||
513 | info.si_addr = (void __user *) address; | ||
514 | info.si_trapno = 0; | ||
515 | force_sig_info (SIGSEGV, &info, tsk); | ||
516 | return; | 535 | return; |
517 | 536 | ||
518 | do_sigbus: | 537 | do_sigbus: |
519 | up_read(&mm->mmap_sem); | 538 | up_read(&mm->mmap_sem); |
520 | info.si_signo = SIGBUS; | 539 | __do_fault_siginfo(BUS_ADRERR, SIGBUS, tsk->thread.kregs, address); |
521 | info.si_errno = 0; | ||
522 | info.si_code = BUS_ADRERR; | ||
523 | info.si_addr = (void __user *) address; | ||
524 | info.si_trapno = 0; | ||
525 | force_sig_info (SIGBUS, &info, tsk); | ||
526 | } | 540 | } |
527 | 541 | ||
528 | void window_overflow_fault(void) | 542 | void window_overflow_fault(void) |
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index b9d4ff02b8fc..f92ce56a8b22 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <asm/sections.h> | 32 | #include <asm/sections.h> |
33 | #include <asm/mmu_context.h> | 33 | #include <asm/mmu_context.h> |
34 | 34 | ||
35 | int show_unhandled_signals = 1; | ||
36 | |||
35 | static inline __kprobes int notify_page_fault(struct pt_regs *regs) | 37 | static inline __kprobes int notify_page_fault(struct pt_regs *regs) |
36 | { | 38 | { |
37 | int ret = 0; | 39 | int ret = 0; |
@@ -128,22 +130,48 @@ outret: | |||
128 | return insn; | 130 | return insn; |
129 | } | 131 | } |
130 | 132 | ||
133 | static inline void | ||
134 | show_signal_msg(struct pt_regs *regs, int sig, int code, | ||
135 | unsigned long address, struct task_struct *tsk) | ||
136 | { | ||
137 | if (!unhandled_signal(tsk, sig)) | ||
138 | return; | ||
139 | |||
140 | if (!printk_ratelimit()) | ||
141 | return; | ||
142 | |||
143 | printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x", | ||
144 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | ||
145 | tsk->comm, task_pid_nr(tsk), address, | ||
146 | (void *)regs->tpc, (void *)regs->u_regs[UREG_I7], | ||
147 | (void *)regs->u_regs[UREG_FP], code); | ||
148 | |||
149 | print_vma_addr(KERN_CONT " in ", regs->tpc); | ||
150 | |||
151 | printk(KERN_CONT "\n"); | ||
152 | } | ||
153 | |||
131 | extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int); | 154 | extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int); |
132 | 155 | ||
133 | static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, | 156 | static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, |
134 | unsigned int insn, int fault_code) | 157 | unsigned int insn, int fault_code) |
135 | { | 158 | { |
159 | unsigned long addr; | ||
136 | siginfo_t info; | 160 | siginfo_t info; |
137 | 161 | ||
138 | info.si_code = code; | 162 | info.si_code = code; |
139 | info.si_signo = sig; | 163 | info.si_signo = sig; |
140 | info.si_errno = 0; | 164 | info.si_errno = 0; |
141 | if (fault_code & FAULT_CODE_ITLB) | 165 | if (fault_code & FAULT_CODE_ITLB) |
142 | info.si_addr = (void __user *) regs->tpc; | 166 | addr = regs->tpc; |
143 | else | 167 | else |
144 | info.si_addr = (void __user *) | 168 | addr = compute_effective_address(regs, insn, 0); |
145 | compute_effective_address(regs, insn, 0); | 169 | info.si_addr = (void __user *) addr; |
146 | info.si_trapno = 0; | 170 | info.si_trapno = 0; |
171 | |||
172 | if (unlikely(show_unhandled_signals)) | ||
173 | show_signal_msg(regs, sig, code, addr, current); | ||
174 | |||
147 | force_sig_info(sig, &info, current); | 175 | force_sig_info(sig, &info, current); |
148 | } | 176 | } |
149 | 177 | ||
diff --git a/arch/sparc/prom/console_32.c b/arch/sparc/prom/console_32.c index b3075d73fc19..5340264b78f5 100644 --- a/arch/sparc/prom/console_32.c +++ b/arch/sparc/prom/console_32.c | |||
@@ -94,5 +94,4 @@ void | |||
94 | prom_putchar(char c) | 94 | prom_putchar(char c) |
95 | { | 95 | { |
96 | while(prom_nbputchar(c) == -1) ; | 96 | while(prom_nbputchar(c) == -1) ; |
97 | return; | ||
98 | } | 97 | } |
diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c index e1c3fc87484d..f55d58a8a156 100644 --- a/arch/sparc/prom/console_64.c +++ b/arch/sparc/prom/console_64.c | |||
@@ -62,7 +62,6 @@ void | |||
62 | prom_putchar(char c) | 62 | prom_putchar(char c) |
63 | { | 63 | { |
64 | prom_nbputchar(c); | 64 | prom_nbputchar(c); |
65 | return; | ||
66 | } | 65 | } |
67 | 66 | ||
68 | void | 67 | void |
diff --git a/arch/sparc/prom/devmap.c b/arch/sparc/prom/devmap.c index 1e517915b0df..46157d2aba0d 100644 --- a/arch/sparc/prom/devmap.c +++ b/arch/sparc/prom/devmap.c | |||
@@ -50,5 +50,4 @@ prom_unmapio(char *vaddr, unsigned int num_bytes) | |||
50 | (*(romvec->pv_v2devops.v2_dumb_munmap))(vaddr, num_bytes); | 50 | (*(romvec->pv_v2devops.v2_dumb_munmap))(vaddr, num_bytes); |
51 | restore_current(); | 51 | restore_current(); |
52 | spin_unlock_irqrestore(&prom_lock, flags); | 52 | spin_unlock_irqrestore(&prom_lock, flags); |
53 | return; | ||
54 | } | 53 | } |
diff --git a/arch/sparc/prom/devops_32.c b/arch/sparc/prom/devops_32.c index 9f1a95c91ad1..9c5d4687242a 100644 --- a/arch/sparc/prom/devops_32.c +++ b/arch/sparc/prom/devops_32.c | |||
@@ -84,6 +84,4 @@ prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo) | |||
84 | }; | 84 | }; |
85 | restore_current(); | 85 | restore_current(); |
86 | spin_unlock_irqrestore(&prom_lock, flags); | 86 | spin_unlock_irqrestore(&prom_lock, flags); |
87 | |||
88 | return; | ||
89 | } | 87 | } |
diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c index 6193c33ed4d4..ccb36c7f9b8c 100644 --- a/arch/sparc/prom/init_32.c +++ b/arch/sparc/prom/init_32.c | |||
@@ -75,5 +75,4 @@ void __init prom_init(struct linux_romvec *rp) | |||
75 | romvec->pv_romvers, prom_rev); | 75 | romvec->pv_romvers, prom_rev); |
76 | 76 | ||
77 | /* Initialization successful. */ | 77 | /* Initialization successful. */ |
78 | return; | ||
79 | } | 78 | } |
diff --git a/arch/sparc/prom/palloc.c b/arch/sparc/prom/palloc.c index 20be339cc2ce..2e2a88b211fb 100644 --- a/arch/sparc/prom/palloc.c +++ b/arch/sparc/prom/palloc.c | |||
@@ -40,5 +40,4 @@ prom_free(char *vaddr, unsigned int num_bytes) | |||
40 | { | 40 | { |
41 | if((prom_vers == PROM_V0) || (num_bytes == 0x0)) return; | 41 | if((prom_vers == PROM_V0) || (num_bytes == 0x0)) return; |
42 | (*(romvec->pv_v2devops.v2_dumb_mem_free))(vaddr, num_bytes); | 42 | (*(romvec->pv_v2devops.v2_dumb_mem_free))(vaddr, num_bytes); |
43 | return; | ||
44 | } | 43 | } |
diff --git a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c index cd5790853ff6..aeff43e44e45 100644 --- a/arch/sparc/prom/ranges.c +++ b/arch/sparc/prom/ranges.c | |||
@@ -87,8 +87,6 @@ void __init prom_ranges_init(void) | |||
87 | 87 | ||
88 | if(num_obio_ranges) | 88 | if(num_obio_ranges) |
89 | prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); | 89 | prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); |
90 | |||
91 | return; | ||
92 | } | 90 | } |
93 | 91 | ||
94 | void | 92 | void |
diff --git a/arch/sparc/prom/segment.c b/arch/sparc/prom/segment.c index 04fd03a7f926..86a663f1d3c5 100644 --- a/arch/sparc/prom/segment.c +++ b/arch/sparc/prom/segment.c | |||
@@ -25,5 +25,4 @@ prom_putsegment(int ctx, unsigned long vaddr, int segment) | |||
25 | (*(romvec->pv_setctxt))(ctx, (char *) vaddr, segment); | 25 | (*(romvec->pv_setctxt))(ctx, (char *) vaddr, segment); |
26 | restore_current(); | 26 | restore_current(); |
27 | spin_unlock_irqrestore(&prom_lock, flags); | 27 | spin_unlock_irqrestore(&prom_lock, flags); |
28 | return; | ||
29 | } | 28 | } |
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c index 646d244b1fdb..b21592f8e3fe 100644 --- a/arch/sparc/prom/tree_32.c +++ b/arch/sparc/prom/tree_32.c | |||
@@ -173,7 +173,6 @@ void prom_getstring(int node, char *prop, char *user_buf, int ubuf_size) | |||
173 | len = prom_getproperty(node, prop, user_buf, ubuf_size); | 173 | len = prom_getproperty(node, prop, user_buf, ubuf_size); |
174 | if(len != -1) return; | 174 | if(len != -1) return; |
175 | user_buf[0] = 0; | 175 | user_buf[0] = 0; |
176 | return; | ||
177 | } | 176 | } |
178 | EXPORT_SYMBOL(prom_getstring); | 177 | EXPORT_SYMBOL(prom_getstring); |
179 | 178 | ||
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c index 8ea73ddc61dc..3c0d2dd9f693 100644 --- a/arch/sparc/prom/tree_64.c +++ b/arch/sparc/prom/tree_64.c | |||
@@ -154,7 +154,6 @@ void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size) | |||
154 | len = prom_getproperty(node, prop, user_buf, ubuf_size); | 154 | len = prom_getproperty(node, prop, user_buf, ubuf_size); |
155 | if(len != -1) return; | 155 | if(len != -1) return; |
156 | user_buf[0] = 0; | 156 | user_buf[0] = 0; |
157 | return; | ||
158 | } | 157 | } |
159 | EXPORT_SYMBOL(prom_getstring); | 158 | EXPORT_SYMBOL(prom_getstring); |
160 | 159 | ||