diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 07:56:44 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 07:56:44 -0800 |
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 @@ #ifndef _SPARC_SCATTERLIST_H #define _SPARC_SCATTERLIST_H -#include <asm/page.h> -#include <asm/types.h> - -struct scatterlist { -#ifdef CONFIG_DEBUG_SG - unsigned long sg_magic; -#endif - unsigned long page_link; - unsigned int offset; - - unsigned int length; - - dma_addr_t dma_address; - __u32 dma_length; -}; - -#define sg_dma_address(sg) ((sg)->dma_address) #define sg_dma_len(sg) ((sg)->dma_length) -#define ISA_DMA_THRESHOLD (~0UL) - -#define ARCH_HAS_SG_CHAIN +#include <asm-generic/scatterlist.h> #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) if (ARCH_SUN4C) sun4c_probe_memerr_reg(); - - return; } 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) if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & (1<<LEON3_GPTIMER_SEPIRQ))) { - prom_printf("irq timer not configured with seperate irqs \n"); + prom_printf("irq timer not configured with separate irqs\n"); BUG(); } 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) int nrcpu = leon_smp_nrcpus(); int me = smp_processor_id(); - printk(KERN_INFO "%d:(%d:%d) cpus mpirq at 0x%x \n", (unsigned int)me, + printk(KERN_INFO "%d:(%d:%d) cpus mpirq at 0x%x\n", (unsigned int)me, (unsigned int)nrcpu, (unsigned int)NR_CPUS, (unsigned int)&(leon3_irqctrl_regs->mpstatus)); @@ -226,7 +226,7 @@ int __cpuinit leon_boot_one_cpu(int i) break; udelay(200); } - printk(KERN_INFO "Started CPU %d \n", (unsigned int)i); + printk(KERN_INFO "Started CPU %d\n", (unsigned int)i); if (!(cpu_callin_map[i])) { 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) return 0; } subsys_initcall(pcibios_init); + +#ifdef CONFIG_SYSFS +static void __devinit pci_bus_slot_names(struct device_node *node, + struct pci_bus *bus) +{ + const struct pci_slot_names { + u32 slot_mask; + char names[0]; + } *prop; + const char *sp; + int len, i; + u32 mask; + + prop = of_get_property(node, "slot-names", &len); + if (!prop) + return; + + mask = prop->slot_mask; + sp = prop->names; + + if (ofpci_verbose) + printk("PCI: Making slots for [%s] mask[0x%02x]\n", + node->full_name, mask); + + i = 0; + while (mask) { + struct pci_slot *pci_slot; + u32 this_bit = 1 << i; + + if (!(mask & this_bit)) { + i++; + continue; + } + + if (ofpci_verbose) + printk("PCI: Making slot [%s]\n", sp); + + pci_slot = pci_create_slot(bus, i, sp, NULL); + if (IS_ERR(pci_slot)) + printk(KERN_ERR "PCI: pci_create_slot returned %ld\n", + PTR_ERR(pci_slot)); + + sp += strlen(sp) + 1; + mask &= ~this_bit; + i++; + } +} + +static int __init of_pci_slot_init(void) +{ + struct pci_bus *pbus = NULL; + + while ((pbus = pci_find_next_bus(pbus)) != NULL) { + struct device_node *node; + + if (pbus->self) { + struct dev_archdata *sd = pbus->self->sysdata; + + /* PCI->PCI bridge */ + node = sd->prom_node; + } else { + struct pci_pbm_info *pbm = pbus->sysdata; + + /* Host PCI controller */ + node = pbm->op->node; + } + + pci_bus_slot_names(node, pbus); + } + + return 0; +} + +module_init(of_pci_slot_init); +#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) writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_LO); } } - - return; } /* 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) "nop\n\t" "nop\n\t" : : "r" (prom_tbr)); local_irq_restore(flags); - - return; } 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) smp_penguin_ctable.reg_size = 0; /* whirrr, whirrr, whirrrrrrrrr... */ - SMP_PRINTK(("Starting CPU %d at %p \n", i, entry)); + SMP_PRINTK(("Starting CPU %d at %p\n", i, entry)); local_flush_cache_all(); prom_startcpu(cpu_node, &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 @@ #include <linux/smp.h> #include <linux/bitops.h> #include <linux/perf_event.h> +#include <linux/ratelimit.h> #include <asm/fpumacro.h> enum direction { @@ -274,13 +275,9 @@ static void kernel_mna_trap_fault(int fixup_tstate_asi) static void log_unaligned(struct pt_regs *regs) { - static unsigned long count, last_time; + static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5); - if (time_after(jiffies, last_time + 5 * HZ)) - count = 0; - if (count < 5) { - last_time = jiffies; - count++; + if (__ratelimit(&ratelimit)) { printk("Kernel unaligned access at TPC[%lx] %pS\n", regs->tpc, (void *) regs->tpc); } @@ -636,7 +633,6 @@ daex: return; } advance(regs); - return; } void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) @@ -685,5 +681,4 @@ daex: return; } advance(regs); - return; } 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 @@ extern int prom_node_root; +int show_unhandled_signals = 1; + /* At boot time we determine these two values necessary for setting * up the segment maps and page table entries (pte's). */ @@ -149,6 +151,45 @@ asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc, return 0; } +static inline void +show_signal_msg(struct pt_regs *regs, int sig, int code, + unsigned long address, struct task_struct *tsk) +{ + if (!unhandled_signal(tsk, sig)) + return; + + if (!printk_ratelimit()) + return; + + printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x", + task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, + tsk->comm, task_pid_nr(tsk), address, + (void *)regs->pc, (void *)regs->u_regs[UREG_I7], + (void *)regs->u_regs[UREG_FP], code); + + print_vma_addr(KERN_CONT " in ", regs->pc); + + printk(KERN_CONT "\n"); +} + +static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs, + unsigned long addr) +{ + siginfo_t info; + + info.si_signo = sig; + info.si_code = code; + info.si_errno = 0; + info.si_addr = (void __user *) addr; + info.si_trapno = 0; + + if (unlikely(show_unhandled_signals)) + show_signal_msg(regs, sig, info.si_code, + addr, current); + + force_sig_info (sig, &info, current); +} + extern unsigned long safe_compute_effective_address(struct pt_regs *, unsigned int); @@ -168,6 +209,14 @@ static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) return safe_compute_effective_address(regs, insn); } +static noinline void do_fault_siginfo(int code, int sig, struct pt_regs *regs, + int text_fault) +{ + unsigned long addr = compute_si_addr(regs, text_fault); + + __do_fault_siginfo(code, sig, regs, addr); +} + asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, unsigned long address) { @@ -176,9 +225,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, struct mm_struct *mm = tsk->mm; unsigned int fixup; unsigned long g2; - siginfo_t info; int from_user = !(regs->psr & PSR_PS); - int fault; + int fault, code; if(text_fault) address = regs->pc; @@ -195,7 +243,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, if (!ARCH_SUN4C && address >= TASK_SIZE) goto vmalloc_fault; - info.si_code = SEGV_MAPERR; + code = SEGV_MAPERR; /* * 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, * we can handle it.. */ good_area: - info.si_code = SEGV_ACCERR; + code = SEGV_ACCERR; if(write) { if(!(vma->vm_flags & VM_WRITE)) goto bad_area; @@ -273,18 +321,8 @@ bad_area: bad_area_nosemaphore: /* User mode accesses just cause a SIGSEGV */ - if(from_user) { -#if 0 - printk("Fault whee %s [%d]: segfaults at %08lx pc=%08lx\n", - tsk->comm, tsk->pid, address, regs->pc); -#endif - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* info.si_code set above to make clear whether - this was a SEGV_MAPERR or SEGV_ACCERR fault. */ - info.si_addr = (void __user *)compute_si_addr(regs, text_fault); - info.si_trapno = 0; - force_sig_info (SIGSEGV, &info, tsk); + if (from_user) { + do_fault_siginfo(code, SIGSEGV, regs, text_fault); return; } @@ -335,12 +373,7 @@ out_of_memory: do_sigbus: up_read(&mm->mmap_sem); - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void __user *) compute_si_addr(regs, text_fault); - info.si_trapno = 0; - force_sig_info (SIGBUS, &info, tsk); + do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault); if (!from_user) goto no_context; @@ -466,14 +499,10 @@ static void force_user_fault(unsigned long address, int write) struct vm_area_struct *vma; struct task_struct *tsk = current; struct mm_struct *mm = tsk->mm; - siginfo_t info; + int code; - info.si_code = SEGV_MAPERR; + code = SEGV_MAPERR; -#if 0 - printk("wf<pid=%d,wr=%d,addr=%08lx>\n", - tsk->pid, write, address); -#endif down_read(&mm->mmap_sem); vma = find_vma(mm, address); if(!vma) @@ -485,7 +514,7 @@ static void force_user_fault(unsigned long address, int write) if(expand_stack(vma, address)) goto bad_area; good_area: - info.si_code = SEGV_ACCERR; + code = SEGV_ACCERR; if(write) { if(!(vma->vm_flags & VM_WRITE)) goto bad_area; @@ -502,27 +531,12 @@ good_area: return; bad_area: up_read(&mm->mmap_sem); -#if 0 - printk("Window whee %s [%d]: segfaults at %08lx\n", - tsk->comm, tsk->pid, address); -#endif - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* info.si_code set above to make clear whether - this was a SEGV_MAPERR or SEGV_ACCERR fault. */ - info.si_addr = (void __user *) address; - info.si_trapno = 0; - force_sig_info (SIGSEGV, &info, tsk); + __do_fault_siginfo(code, SIGSEGV, tsk->thread.kregs, address); return; do_sigbus: up_read(&mm->mmap_sem); - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void __user *) address; - info.si_trapno = 0; - force_sig_info (SIGBUS, &info, tsk); + __do_fault_siginfo(BUS_ADRERR, SIGBUS, tsk->thread.kregs, address); } 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 @@ #include <asm/sections.h> #include <asm/mmu_context.h> +int show_unhandled_signals = 1; + static inline __kprobes int notify_page_fault(struct pt_regs *regs) { int ret = 0; @@ -128,22 +130,48 @@ outret: return insn; } +static inline void +show_signal_msg(struct pt_regs *regs, int sig, int code, + unsigned long address, struct task_struct *tsk) +{ + if (!unhandled_signal(tsk, sig)) + return; + + if (!printk_ratelimit()) + return; + + printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x", + task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, + tsk->comm, task_pid_nr(tsk), address, + (void *)regs->tpc, (void *)regs->u_regs[UREG_I7], + (void *)regs->u_regs[UREG_FP], code); + + print_vma_addr(KERN_CONT " in ", regs->tpc); + + printk(KERN_CONT "\n"); +} + extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int); static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, unsigned int insn, int fault_code) { + unsigned long addr; siginfo_t info; info.si_code = code; info.si_signo = sig; info.si_errno = 0; if (fault_code & FAULT_CODE_ITLB) - info.si_addr = (void __user *) regs->tpc; + addr = regs->tpc; else - info.si_addr = (void __user *) - compute_effective_address(regs, insn, 0); + addr = compute_effective_address(regs, insn, 0); + info.si_addr = (void __user *) addr; info.si_trapno = 0; + + if (unlikely(show_unhandled_signals)) + show_signal_msg(regs, sig, code, addr, current); + force_sig_info(sig, &info, current); } 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 prom_putchar(char c) { while(prom_nbputchar(c) == -1) ; - return; } 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 prom_putchar(char c) { prom_nbputchar(c); - return; } 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) (*(romvec->pv_v2devops.v2_dumb_munmap))(vaddr, num_bytes); restore_current(); spin_unlock_irqrestore(&prom_lock, flags); - return; } 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) }; restore_current(); spin_unlock_irqrestore(&prom_lock, flags); - - return; } 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) romvec->pv_romvers, prom_rev); /* Initialization successful. */ - return; } 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) { if((prom_vers == PROM_V0) || (num_bytes == 0x0)) return; (*(romvec->pv_v2devops.v2_dumb_mem_free))(vaddr, num_bytes); - return; } 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) if(num_obio_ranges) prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); - - return; } 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) (*(romvec->pv_setctxt))(ctx, (char *) vaddr, segment); restore_current(); spin_unlock_irqrestore(&prom_lock, flags); - return; } 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) len = prom_getproperty(node, prop, user_buf, ubuf_size); if(len != -1) return; user_buf[0] = 0; - return; } EXPORT_SYMBOL(prom_getstring); 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) len = prom_getproperty(node, prop, user_buf, ubuf_size); if(len != -1) return; user_buf[0] = 0; - return; } EXPORT_SYMBOL(prom_getstring); |