Skip to content

Commit b7f3a20

Browse files
committed
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
2 parents 6d6b89b + 4b17764 commit b7f3a20

23 files changed

Lines changed: 176 additions & 100 deletions
Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
11
#ifndef _SPARC_SCATTERLIST_H
22
#define _SPARC_SCATTERLIST_H
33

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)
214
#define sg_dma_len(sg) ((sg)->dma_length)
225

23-
#define ISA_DMA_THRESHOLD (~0UL)
24-
25-
#define ARCH_HAS_SG_CHAIN
6+
#include <asm-generic/scatterlist.h>
267

278
#endif /* !(_SPARC_SCATTERLIST_H) */

‎arch/sparc/kernel/devices.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,4 @@ void __init device_scan(void)
143143

144144
if (ARCH_SUN4C)
145145
sun4c_probe_memerr_reg();
146-
147-
return;
148146
}

‎arch/sparc/kernel/leon_kernel.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
124124

125125
if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) &
126126
(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");
128128
BUG();
129129
}
130130

‎arch/sparc/kernel/leon_smp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void __init leon_boot_cpus(void)
177177
int nrcpu = leon_smp_nrcpus();
178178
int me = smp_processor_id();
179179

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,
181181
(unsigned int)nrcpu, (unsigned int)NR_CPUS,
182182
(unsigned int)&(leon3_irqctrl_regs->mpstatus));
183183

@@ -226,7 +226,7 @@ int __cpuinit leon_boot_one_cpu(int i)
226226
break;
227227
udelay(200);
228228
}
229-
printk(KERN_INFO "Started CPU %d \n", (unsigned int)i);
229+
printk(KERN_INFO "Started CPU %d\n", (unsigned int)i);
230230

231231
if (!(cpu_callin_map[i])) {
232232
printk(KERN_ERR "Processor %d is stuck.\n", i);

‎arch/sparc/kernel/pci.c‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,3 +1095,78 @@ static int __init pcibios_init(void)
10951095
return 0;
10961096
}
10971097
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

‎arch/sparc/kernel/pcic.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,6 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
585585
writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_LO);
586586
}
587587
}
588-
589-
return;
590588
}
591589

592590
/*

‎arch/sparc/kernel/setup_32.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ static void prom_sync_me(void)
9595
"nop\n\t"
9696
"nop\n\t" : : "r" (prom_tbr));
9797
local_irq_restore(flags);
98-
99-
return;
10098
}
10199

102100
static unsigned int boot_flags __initdata = 0;

‎arch/sparc/kernel/sun4d_smp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ int __cpuinit smp4d_boot_one_cpu(int i)
194194
smp_penguin_ctable.reg_size = 0;
195195

196196
/* 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));
198198
local_flush_cache_all();
199199
prom_startcpu(cpu_node,
200200
&smp_penguin_ctable, 0, (char *)entry);

‎arch/sparc/kernel/unaligned_64.c‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/smp.h>
2222
#include <linux/bitops.h>
2323
#include <linux/perf_event.h>
24+
#include <linux/ratelimit.h>
2425
#include <asm/fpumacro.h>
2526

2627
enum direction {
@@ -274,13 +275,9 @@ static void kernel_mna_trap_fault(int fixup_tstate_asi)
274275

275276
static void log_unaligned(struct pt_regs *regs)
276277
{
277-
static unsigned long count, last_time;
278+
static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
278279

279-
if (time_after(jiffies, last_time + 5 * HZ))
280-
count = 0;
281-
if (count < 5) {
282-
last_time = jiffies;
283-
count++;
280+
if (__ratelimit(&ratelimit)) {
284281
printk("Kernel unaligned access at TPC[%lx] %pS\n",
285282
regs->tpc, (void *) regs->tpc);
286283
}
@@ -636,7 +633,6 @@ void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr
636633
return;
637634
}
638635
advance(regs);
639-
return;
640636
}
641637

642638
void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
@@ -685,5 +681,4 @@ void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr
685681
return;
686682
}
687683
advance(regs);
688-
return;
689684
}

‎arch/sparc/mm/fault_32.c‎

Lines changed: 60 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
extern int prom_node_root;
3737

38+
int show_unhandled_signals = 1;
39+
3840
/* At boot time we determine these two values necessary for setting
3941
* up the segment maps and page table entries (pte's).
4042
*/
@@ -149,6 +151,45 @@ asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
149151
return 0;
150152
}
151153

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+
152193
extern unsigned long safe_compute_effective_address(struct pt_regs *,
153194
unsigned int);
154195

@@ -168,6 +209,14 @@ static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
168209
return safe_compute_effective_address(regs, insn);
169210
}
170211

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+
171220
asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
172221
unsigned long address)
173222
{
@@ -176,9 +225,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
176225
struct mm_struct *mm = tsk->mm;
177226
unsigned int fixup;
178227
unsigned long g2;
179-
siginfo_t info;
180228
int from_user = !(regs->psr & PSR_PS);
181-
int fault;
229+
int fault, code;
182230

183231
if(text_fault)
184232
address = regs->pc;
@@ -195,7 +243,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
195243
if (!ARCH_SUN4C && address >= TASK_SIZE)
196244
goto vmalloc_fault;
197245

198-
info.si_code = SEGV_MAPERR;
246+
code = SEGV_MAPERR;
199247

200248
/*
201249
* 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,
229277
* we can handle it..
230278
*/
231279
good_area:
232-
info.si_code = SEGV_ACCERR;
280+
code = SEGV_ACCERR;
233281
if(write) {
234282
if(!(vma->vm_flags & VM_WRITE))
235283
goto bad_area;
@@ -273,18 +321,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
273321

274322
bad_area_nosemaphore:
275323
/* User mode accesses just cause a SIGSEGV */
276-
if(from_user) {
277-
#if 0
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);
324+
if (from_user) {
325+
do_fault_siginfo(code, SIGSEGV, regs, text_fault);
288326
return;
289327
}
290328

@@ -335,12 +373,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
335373

336374
do_sigbus:
337375
up_read(&mm->mmap_sem);
338-
info.si_signo = SIGBUS;
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);
376+
do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault);
344377
if (!from_user)
345378
goto no_context;
346379

@@ -466,14 +499,10 @@ static void force_user_fault(unsigned long address, int write)
466499
struct vm_area_struct *vma;
467500
struct task_struct *tsk = current;
468501
struct mm_struct *mm = tsk->mm;
469-
siginfo_t info;
502+
int code;
470503

471-
info.si_code = SEGV_MAPERR;
504+
code = SEGV_MAPERR;
472505

473-
#if 0
474-
printk("wf<pid=%d,wr=%d,addr=%08lx>\n",
475-
tsk->pid, write, address);
476-
#endif
477506
down_read(&mm->mmap_sem);
478507
vma = find_vma(mm, address);
479508
if(!vma)
@@ -485,7 +514,7 @@ static void force_user_fault(unsigned long address, int write)
485514
if(expand_stack(vma, address))
486515
goto bad_area;
487516
good_area:
488-
info.si_code = SEGV_ACCERR;
517+
code = SEGV_ACCERR;
489518
if(write) {
490519
if(!(vma->vm_flags & VM_WRITE))
491520
goto bad_area;
@@ -502,27 +531,12 @@ static void force_user_fault(unsigned long address, int write)
502531
return;
503532
bad_area:
504533
up_read(&mm->mmap_sem);
505-
#if 0
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);
534+
__do_fault_siginfo(code, SIGSEGV, tsk->thread.kregs, address);
516535
return;
517536

518537
do_sigbus:
519538
up_read(&mm->mmap_sem);
520-
info.si_signo = SIGBUS;
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);
539+
__do_fault_siginfo(BUS_ADRERR, SIGBUS, tsk->thread.kregs, address);
526540
}
527541

528542
void window_overflow_fault(void)

0 commit comments

Comments
 (0)