aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/pgtable_32.h4
-rw-r--r--arch/sparc/include/asm/pgtable_64.h2
-rw-r--r--arch/sparc/include/asm/scatterlist.h21
-rw-r--r--arch/sparc/include/asm/stat.h4
-rw-r--r--arch/sparc/include/asm/syscall.h7
-rw-r--r--arch/sparc/kernel/devices.c4
-rw-r--r--arch/sparc/kernel/ftrace.c11
-rw-r--r--arch/sparc/kernel/kstack.h4
-rw-r--r--arch/sparc/kernel/leon_kernel.c2
-rw-r--r--arch/sparc/kernel/leon_smp.c4
-rw-r--r--arch/sparc/kernel/of_device_32.c4
-rw-r--r--arch/sparc/kernel/of_device_64.c2
-rw-r--r--arch/sparc/kernel/pci.c87
-rw-r--r--arch/sparc/kernel/pcic.c7
-rw-r--r--arch/sparc/kernel/perf_event.c10
-rw-r--r--arch/sparc/kernel/process_32.c2
-rw-r--r--arch/sparc/kernel/process_64.c8
-rw-r--r--arch/sparc/kernel/prom.h3
-rw-r--r--arch/sparc/kernel/prom_common.c18
-rw-r--r--arch/sparc/kernel/setup_32.c2
-rw-r--r--arch/sparc/kernel/signal32.c10
-rw-r--r--arch/sparc/kernel/signal_32.c6
-rw-r--r--arch/sparc/kernel/signal_64.c8
-rw-r--r--arch/sparc/kernel/smp_64.c2
-rw-r--r--arch/sparc/kernel/sun4d_smp.c2
-rw-r--r--arch/sparc/kernel/sys_sparc32.c1
-rw-r--r--arch/sparc/kernel/tsb.S6
-rw-r--r--arch/sparc/kernel/unaligned_64.c11
-rw-r--r--arch/sparc/mm/fault_32.c110
-rw-r--r--arch/sparc/mm/fault_64.c34
-rw-r--r--arch/sparc/mm/init_64.c3
-rw-r--r--arch/sparc/mm/nosun4c.c2
-rw-r--r--arch/sparc/mm/srmmu.c6
-rw-r--r--arch/sparc/mm/sun4c.c6
-rw-r--r--arch/sparc/prom/console_32.c1
-rw-r--r--arch/sparc/prom/console_64.c1
-rw-r--r--arch/sparc/prom/devmap.c1
-rw-r--r--arch/sparc/prom/devops_32.c2
-rw-r--r--arch/sparc/prom/init_32.c1
-rw-r--r--arch/sparc/prom/palloc.c1
-rw-r--r--arch/sparc/prom/ranges.c2
-rw-r--r--arch/sparc/prom/segment.c1
-rw-r--r--arch/sparc/prom/tree_32.c1
-rw-r--r--arch/sparc/prom/tree_64.c1
44 files changed, 251 insertions, 174 deletions
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index e0cabe790ec1..77f906d8cc21 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -330,9 +330,9 @@ BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *)
330#define FAULT_CODE_WRITE 0x2 330#define FAULT_CODE_WRITE 0x2
331#define FAULT_CODE_USER 0x4 331#define FAULT_CODE_USER 0x4
332 332
333BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t) 333BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t *)
334 334
335#define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte) 335#define update_mmu_cache(vma,addr,ptep) BTFIXUP_CALL(update_mmu_cache)(vma,addr,ptep)
336 336
337BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long, 337BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long,
338 unsigned long, unsigned int) 338 unsigned long, unsigned int)
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index f3cb790fa2ae..f5b5fa76c02d 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -706,7 +706,7 @@ extern unsigned long find_ecache_flush_span(unsigned long size);
706#define mmu_unlockarea(vaddr, len) do { } while(0) 706#define mmu_unlockarea(vaddr, len) do { } while(0)
707 707
708struct vm_area_struct; 708struct vm_area_struct;
709extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 709extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
710 710
711/* Encode and de-code a swap entry */ 711/* Encode and de-code a swap entry */
712#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL) 712#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL)
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
7struct 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/include/asm/stat.h b/arch/sparc/include/asm/stat.h
index 55db5eca08e2..39327d6a57eb 100644
--- a/arch/sparc/include/asm/stat.h
+++ b/arch/sparc/include/asm/stat.h
@@ -53,8 +53,8 @@ struct stat {
53 ino_t st_ino; 53 ino_t st_ino;
54 mode_t st_mode; 54 mode_t st_mode;
55 short st_nlink; 55 short st_nlink;
56 uid_t st_uid; 56 uid16_t st_uid;
57 gid_t st_gid; 57 gid16_t st_gid;
58 unsigned short st_rdev; 58 unsigned short st_rdev;
59 off_t st_size; 59 off_t st_size;
60 time_t st_atime; 60 time_t st_atime;
diff --git a/arch/sparc/include/asm/syscall.h b/arch/sparc/include/asm/syscall.h
index 7486c605e23c..025a02ad2e31 100644
--- a/arch/sparc/include/asm/syscall.h
+++ b/arch/sparc/include/asm/syscall.h
@@ -5,6 +5,13 @@
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <asm/ptrace.h> 6#include <asm/ptrace.h>
7 7
8/*
9 * The syscall table always contains 32 bit pointers since we know that the
10 * address of the function to be called is (way) below 4GB. So the "int"
11 * type here is what we want [need] for both 32 bit and 64 bit systems.
12 */
13extern const unsigned int sys_call_table[];
14
8/* The system call number is given by the user in %g1 */ 15/* The system call number is given by the user in %g1 */
9static inline long syscall_get_nr(struct task_struct *task, 16static inline long syscall_get_nr(struct task_struct *task,
10 struct pt_regs *regs) 17 struct pt_regs *regs)
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index b171ae8de90d..62dc7a021413 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -59,7 +59,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
59 59
60 cur_inst = 0; 60 cur_inst = 0;
61 for_each_node_by_type(dp, "cpu") { 61 for_each_node_by_type(dp, "cpu") {
62 int err = check_cpu_node(dp->node, &cur_inst, 62 int err = check_cpu_node(dp->phandle, &cur_inst,
63 compare, compare_arg, 63 compare, compare_arg,
64 prom_node, mid); 64 prom_node, mid);
65 if (!err) { 65 if (!err) {
@@ -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/ftrace.c b/arch/sparc/kernel/ftrace.c
index 29973daa9930..9103a56b39e8 100644
--- a/arch/sparc/kernel/ftrace.c
+++ b/arch/sparc/kernel/ftrace.c
@@ -91,14 +91,3 @@ int __init ftrace_dyn_arch_init(void *data)
91 return 0; 91 return 0;
92} 92}
93#endif 93#endif
94
95#ifdef CONFIG_FTRACE_SYSCALLS
96
97extern unsigned int sys_call_table[];
98
99unsigned long __init arch_syscall_addr(int nr)
100{
101 return (unsigned long)sys_call_table[nr];
102}
103
104#endif
diff --git a/arch/sparc/kernel/kstack.h b/arch/sparc/kernel/kstack.h
index 4248d969272f..5247283d1c03 100644
--- a/arch/sparc/kernel/kstack.h
+++ b/arch/sparc/kernel/kstack.h
@@ -11,6 +11,10 @@ static inline bool kstack_valid(struct thread_info *tp, unsigned long sp)
11{ 11{
12 unsigned long base = (unsigned long) tp; 12 unsigned long base = (unsigned long) tp;
13 13
14 /* Stack pointer must be 16-byte aligned. */
15 if (sp & (16UL - 1))
16 return false;
17
14 if (sp >= (base + sizeof(struct thread_info)) && 18 if (sp >= (base + sizeof(struct thread_info)) &&
15 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) 19 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
16 return true; 20 return true;
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/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 4c26eb59e742..da527b33ebc7 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -105,7 +105,7 @@ static unsigned long of_bus_sbus_get_flags(const u32 *addr, unsigned long flags)
105 105
106static int of_bus_ambapp_match(struct device_node *np) 106static int of_bus_ambapp_match(struct device_node *np)
107{ 107{
108 return !strcmp(np->name, "ambapp"); 108 return !strcmp(np->type, "ambapp");
109} 109}
110 110
111static void of_bus_ambapp_count_cells(struct device_node *child, 111static void of_bus_ambapp_count_cells(struct device_node *child,
@@ -433,7 +433,7 @@ build_resources:
433 if (!parent) 433 if (!parent)
434 dev_set_name(&op->dev, "root"); 434 dev_set_name(&op->dev, "root");
435 else 435 else
436 dev_set_name(&op->dev, "%08x", dp->node); 436 dev_set_name(&op->dev, "%08x", dp->phandle);
437 437
438 if (of_device_register(op)) { 438 if (of_device_register(op)) {
439 printk("%s: Could not register of device.\n", 439 printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 0a6f2d1798d1..b3d4cb5d21b3 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -676,7 +676,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
676 if (!parent) 676 if (!parent)
677 dev_set_name(&op->dev, "root"); 677 dev_set_name(&op->dev, "root");
678 else 678 else
679 dev_set_name(&op->dev, "%08x", dp->node); 679 dev_set_name(&op->dev, "%08x", dp->phandle);
680 680
681 if (of_device_register(op)) { 681 if (of_device_register(op)) {
682 printk("%s: Could not register of device.\n", 682 printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 539e83f8e087..5ac539a5930f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -247,6 +247,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
247 struct pci_bus *bus, int devfn) 247 struct pci_bus *bus, int devfn)
248{ 248{
249 struct dev_archdata *sd; 249 struct dev_archdata *sd;
250 struct pci_slot *slot;
250 struct of_device *op; 251 struct of_device *op;
251 struct pci_dev *dev; 252 struct pci_dev *dev;
252 const char *type; 253 const char *type;
@@ -286,6 +287,11 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
286 dev->dev.bus = &pci_bus_type; 287 dev->dev.bus = &pci_bus_type;
287 dev->devfn = devfn; 288 dev->devfn = devfn;
288 dev->multifunction = 0; /* maybe a lie? */ 289 dev->multifunction = 0; /* maybe a lie? */
290 set_pcie_port_type(dev);
291
292 list_for_each_entry(slot, &dev->bus->slots, list)
293 if (PCI_SLOT(dev->devfn) == slot->number)
294 dev->slot = slot;
289 295
290 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); 296 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff);
291 dev->device = of_getintprop_default(node, "device-id", 0xffff); 297 dev->device = of_getintprop_default(node, "device-id", 0xffff);
@@ -322,6 +328,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
322 328
323 dev->current_state = 4; /* unknown power state */ 329 dev->current_state = 4; /* unknown power state */
324 dev->error_state = pci_channel_io_normal; 330 dev->error_state = pci_channel_io_normal;
331 dev->dma_mask = 0xffffffff;
325 332
326 if (!strcmp(node->name, "pci")) { 333 if (!strcmp(node->name, "pci")) {
327 /* a PCI-PCI bridge */ 334 /* a PCI-PCI bridge */
@@ -715,9 +722,10 @@ void pcibios_update_irq(struct pci_dev *pdev, int irq)
715{ 722{
716} 723}
717 724
718void pcibios_align_resource(void *data, struct resource *res, 725resource_size_t pcibios_align_resource(void *data, const struct resource *res,
719 resource_size_t size, resource_size_t align) 726 resource_size_t size, resource_size_t align)
720{ 727{
728 return res->start;
721} 729}
722 730
723int pcibios_enable_device(struct pci_dev *dev, int mask) 731int pcibios_enable_device(struct pci_dev *dev, int mask)
@@ -1087,3 +1095,78 @@ static int __init pcibios_init(void)
1087 return 0; 1095 return 0;
1088} 1096}
1089subsys_initcall(pcibios_init); 1097subsys_initcall(pcibios_init);
1098
1099#ifdef CONFIG_SYSFS
1100static 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
1146static 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
1171module_init(of_pci_slot_init);
1172#endif
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 4e2724ec2bb6..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/*
@@ -768,9 +766,10 @@ char * __devinit pcibios_setup(char *str)
768 return str; 766 return str;
769} 767}
770 768
771void pcibios_align_resource(void *data, struct resource *res, 769resource_size_t pcibios_align_resource(void *data, const struct resource *res,
772 resource_size_t size, resource_size_t align) 770 resource_size_t size, resource_size_t align)
773{ 771{
772 return res->start;
774} 773}
775 774
776int pcibios_enable_device(struct pci_dev *pdev, int mask) 775int pcibios_enable_device(struct pci_dev *pdev, int mask)
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index e856456ec02f..9f2b2bac8b2b 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -980,10 +980,10 @@ static int collect_events(struct perf_event *group, int max_count,
980 return n; 980 return n;
981} 981}
982 982
983static void event_sched_in(struct perf_event *event, int cpu) 983static void event_sched_in(struct perf_event *event)
984{ 984{
985 event->state = PERF_EVENT_STATE_ACTIVE; 985 event->state = PERF_EVENT_STATE_ACTIVE;
986 event->oncpu = cpu; 986 event->oncpu = smp_processor_id();
987 event->tstamp_running += event->ctx->time - event->tstamp_stopped; 987 event->tstamp_running += event->ctx->time - event->tstamp_stopped;
988 if (is_software_event(event)) 988 if (is_software_event(event))
989 event->pmu->enable(event); 989 event->pmu->enable(event);
@@ -991,7 +991,7 @@ static void event_sched_in(struct perf_event *event, int cpu)
991 991
992int hw_perf_group_sched_in(struct perf_event *group_leader, 992int hw_perf_group_sched_in(struct perf_event *group_leader,
993 struct perf_cpu_context *cpuctx, 993 struct perf_cpu_context *cpuctx,
994 struct perf_event_context *ctx, int cpu) 994 struct perf_event_context *ctx)
995{ 995{
996 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 996 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
997 struct perf_event *sub; 997 struct perf_event *sub;
@@ -1015,10 +1015,10 @@ int hw_perf_group_sched_in(struct perf_event *group_leader,
1015 1015
1016 cpuctx->active_oncpu += n; 1016 cpuctx->active_oncpu += n;
1017 n = 1; 1017 n = 1;
1018 event_sched_in(group_leader, cpu); 1018 event_sched_in(group_leader);
1019 list_for_each_entry(sub, &group_leader->sibling_list, group_entry) { 1019 list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
1020 if (sub->state != PERF_EVENT_STATE_OFF) { 1020 if (sub->state != PERF_EVENT_STATE_OFF) {
1021 event_sched_in(sub, cpu); 1021 event_sched_in(sub);
1022 n++; 1022 n++;
1023 } 1023 }
1024 } 1024 }
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 2830b415e214..c49865b30719 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -526,7 +526,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
526 * Set some valid stack frames to give to the child. 526 * Set some valid stack frames to give to the child.
527 */ 527 */
528 childstack = (struct sparc_stackf __user *) 528 childstack = (struct sparc_stackf __user *)
529 (sp & ~0x7UL); 529 (sp & ~0xfUL);
530 parentstack = (struct sparc_stackf __user *) 530 parentstack = (struct sparc_stackf __user *)
531 regs->u_regs[UREG_FP]; 531 regs->u_regs[UREG_FP];
532 532
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index c3f1cce0e95e..cb70476bd8f5 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -398,11 +398,11 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
398 } else 398 } else
399 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6])); 399 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
400 400
401 /* Now 8-byte align the stack as this is mandatory in the 401 /* Now align the stack as this is mandatory in the Sparc ABI
402 * Sparc ABI due to how register windows work. This hides 402 * due to how register windows work. This hides the
403 * the restriction from thread libraries etc. -DaveM 403 * restriction from thread libraries etc.
404 */ 404 */
405 csp &= ~7UL; 405 csp &= ~15UL;
406 406
407 distance = fp - psp; 407 distance = fp - psp;
408 rval = (csp - distance); 408 rval = (csp - distance);
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index 453397fe5e14..a8591ef2636d 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -4,9 +4,6 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/prom.h> 5#include <asm/prom.h>
6 6
7extern struct device_node *allnodes; /* temporary while merging */
8extern rwlock_t devtree_lock; /* temporary while merging */
9
10extern void * prom_early_alloc(unsigned long size); 7extern void * prom_early_alloc(unsigned long size);
11extern void irq_trans_init(struct device_node *dp); 8extern void irq_trans_init(struct device_node *dp);
12 9
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index d80a65d9e893..57ac9e28be0c 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -37,18 +37,6 @@ EXPORT_SYMBOL(of_console_path);
37char *of_console_options; 37char *of_console_options;
38EXPORT_SYMBOL(of_console_options); 38EXPORT_SYMBOL(of_console_options);
39 39
40struct device_node *of_find_node_by_phandle(phandle handle)
41{
42 struct device_node *np;
43
44 for (np = allnodes; np; np = np->allnext)
45 if (np->node == handle)
46 break;
47
48 return np;
49}
50EXPORT_SYMBOL(of_find_node_by_phandle);
51
52int of_getintprop_default(struct device_node *np, const char *name, int def) 40int of_getintprop_default(struct device_node *np, const char *name, int def)
53{ 41{
54 struct property *prop; 42 struct property *prop;
@@ -89,7 +77,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
89 void *old_val = prop->value; 77 void *old_val = prop->value;
90 int ret; 78 int ret;
91 79
92 ret = prom_setprop(dp->node, name, val, len); 80 ret = prom_setprop(dp->phandle, name, val, len);
93 81
94 err = -EINVAL; 82 err = -EINVAL;
95 if (ret >= 0) { 83 if (ret >= 0) {
@@ -236,7 +224,7 @@ static struct device_node * __init prom_create_node(phandle node,
236 224
237 dp->name = get_one_property(node, "name"); 225 dp->name = get_one_property(node, "name");
238 dp->type = get_one_property(node, "device_type"); 226 dp->type = get_one_property(node, "device_type");
239 dp->node = node; 227 dp->phandle = node;
240 228
241 dp->properties = build_prop_list(node); 229 dp->properties = build_prop_list(node);
242 230
@@ -313,7 +301,7 @@ void __init prom_build_devicetree(void)
313 301
314 nextp = &allnodes->allnext; 302 nextp = &allnodes->allnext;
315 allnodes->child = prom_build_tree(allnodes, 303 allnodes->child = prom_build_tree(allnodes,
316 prom_getchild(allnodes->node), 304 prom_getchild(allnodes->phandle),
317 &nextp); 305 &nextp);
318 of_console_init(); 306 of_console_init();
319 307
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
102static unsigned int boot_flags __initdata = 0; 100static unsigned int boot_flags __initdata = 0;
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ba5b09ad6666..ea22cd373c64 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -120,8 +120,8 @@ struct rt_signal_frame32 {
120}; 120};
121 121
122/* Align macros */ 122/* Align macros */
123#define SF_ALIGNEDSZ (((sizeof(struct signal_frame32) + 7) & (~7))) 123#define SF_ALIGNEDSZ (((sizeof(struct signal_frame32) + 15) & (~15)))
124#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame32) + 7) & (~7))) 124#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame32) + 15) & (~15)))
125 125
126int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 126int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
127{ 127{
@@ -420,15 +420,17 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns
420 sp = current->sas_ss_sp + current->sas_ss_size; 420 sp = current->sas_ss_sp + current->sas_ss_size;
421 } 421 }
422 422
423 sp -= framesize;
424
423 /* Always align the stack frame. This handles two cases. First, 425 /* Always align the stack frame. This handles two cases. First,
424 * sigaltstack need not be mindful of platform specific stack 426 * sigaltstack need not be mindful of platform specific stack
425 * alignment. Second, if we took this signal because the stack 427 * alignment. Second, if we took this signal because the stack
426 * is not aligned properly, we'd like to take the signal cleanly 428 * is not aligned properly, we'd like to take the signal cleanly
427 * and report that. 429 * and report that.
428 */ 430 */
429 sp &= ~7UL; 431 sp &= ~15UL;
430 432
431 return (void __user *)(sp - framesize); 433 return (void __user *) sp;
432} 434}
433 435
434static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) 436static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 7ce1a1005b1d..9882df92ba0a 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -267,15 +267,17 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
267 sp = current->sas_ss_sp + current->sas_ss_size; 267 sp = current->sas_ss_sp + current->sas_ss_size;
268 } 268 }
269 269
270 sp -= framesize;
271
270 /* Always align the stack frame. This handles two cases. First, 272 /* Always align the stack frame. This handles two cases. First,
271 * sigaltstack need not be mindful of platform specific stack 273 * sigaltstack need not be mindful of platform specific stack
272 * alignment. Second, if we took this signal because the stack 274 * alignment. Second, if we took this signal because the stack
273 * is not aligned properly, we'd like to take the signal cleanly 275 * is not aligned properly, we'd like to take the signal cleanly
274 * and report that. 276 * and report that.
275 */ 277 */
276 sp &= ~7UL; 278 sp &= ~15UL;
277 279
278 return (void __user *)(sp - framesize); 280 return (void __user *) sp;
279} 281}
280 282
281static inline int 283static inline int
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 647afbda7ae1..9fa48c30037e 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -353,7 +353,7 @@ segv:
353/* Checks if the fp is valid */ 353/* Checks if the fp is valid */
354static int invalid_frame_pointer(void __user *fp, int fplen) 354static int invalid_frame_pointer(void __user *fp, int fplen)
355{ 355{
356 if (((unsigned long) fp) & 7) 356 if (((unsigned long) fp) & 15)
357 return 1; 357 return 1;
358 return 0; 358 return 0;
359} 359}
@@ -396,15 +396,17 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *
396 sp = current->sas_ss_sp + current->sas_ss_size; 396 sp = current->sas_ss_sp + current->sas_ss_size;
397 } 397 }
398 398
399 sp -= framesize;
400
399 /* Always align the stack frame. This handles two cases. First, 401 /* Always align the stack frame. This handles two cases. First,
400 * sigaltstack need not be mindful of platform specific stack 402 * sigaltstack need not be mindful of platform specific stack
401 * alignment. Second, if we took this signal because the stack 403 * alignment. Second, if we took this signal because the stack
402 * is not aligned properly, we'd like to take the signal cleanly 404 * is not aligned properly, we'd like to take the signal cleanly
403 * and report that. 405 * and report that.
404 */ 406 */
405 sp &= ~7UL; 407 sp &= ~15UL;
406 408
407 return (void __user *)(sp - framesize); 409 return (void __user *) sp;
408} 410}
409 411
410static inline void 412static inline void
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index aa36223497b9..eb14844a0021 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -370,7 +370,7 @@ static int __cpuinit smp_boot_one_cpu(unsigned int cpu)
370 } else { 370 } else {
371 struct device_node *dp = of_find_node_by_cpuid(cpu); 371 struct device_node *dp = of_find_node_by_cpuid(cpu);
372 372
373 prom_startcpu(dp->node, entry, cookie); 373 prom_startcpu(dp->phandle, entry, cookie);
374 } 374 }
375 375
376 for (timeout = 0; timeout < 50000; timeout++) { 376 for (timeout = 0; timeout < 50000; timeout++) {
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/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index dc0ac197e7e2..daded3b96398 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -43,7 +43,6 @@
43#include <linux/security.h> 43#include <linux/security.h>
44#include <linux/compat.h> 44#include <linux/compat.h>
45#include <linux/vfs.h> 45#include <linux/vfs.h>
46#include <linux/netfilter_ipv4/ip_tables.h>
47#include <linux/ptrace.h> 46#include <linux/ptrace.h>
48 47
49#include <asm/types.h> 48#include <asm/types.h>
diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index 8c91d9b29a2f..db15d123f054 100644
--- a/arch/sparc/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -191,10 +191,12 @@ tsb_dtlb_load:
191 191
192tsb_itlb_load: 192tsb_itlb_load:
193 /* Executable bit must be set. */ 193 /* Executable bit must be set. */
194661: andcc %g5, _PAGE_EXEC_4U, %g0 194661: sethi %hi(_PAGE_EXEC_4U), %g4
195 .section .sun4v_1insn_patch, "ax" 195 andcc %g5, %g4, %g0
196 .section .sun4v_2insn_patch, "ax"
196 .word 661b 197 .word 661b
197 andcc %g5, _PAGE_EXEC_4V, %g0 198 andcc %g5, _PAGE_EXEC_4V, %g0
199 nop
198 .previous 200 .previous
199 201
200 be,pn %xcc, tsb_do_fault 202 be,pn %xcc, tsb_do_fault
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
26enum direction { 27enum direction {
@@ -274,13 +275,9 @@ static void kernel_mna_trap_fault(int fixup_tstate_asi)
274 275
275static void log_unaligned(struct pt_regs *regs) 276static 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
642void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 638void 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 a3413acb8f12..bd8601601afa 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -35,6 +35,8 @@
35 35
36extern int prom_node_root; 36extern int prom_node_root;
37 37
38int 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
154static inline void
155show_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
175static 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
152extern unsigned long safe_compute_effective_address(struct pt_regs *, 193extern 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
212static 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
171asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, 220asmlinkage 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 */
231good_area: 279good_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
274bad_area_nosemaphore: 322bad_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
336do_sigbus: 374do_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
@@ -378,7 +411,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
378 unsigned long address) 411 unsigned long address)
379{ 412{
380 extern void sun4c_update_mmu_cache(struct vm_area_struct *, 413 extern void sun4c_update_mmu_cache(struct vm_area_struct *,
381 unsigned long,pte_t); 414 unsigned long,pte_t *);
382 extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long); 415 extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long);
383 struct task_struct *tsk = current; 416 struct task_struct *tsk = current;
384 struct mm_struct *mm = tsk->mm; 417 struct mm_struct *mm = tsk->mm;
@@ -455,7 +488,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
455 * on the CPU and doing a shrink_mmap() on this vma. 488 * on the CPU and doing a shrink_mmap() on this vma.
456 */ 489 */
457 sun4c_update_mmu_cache (find_vma(current->mm, address), address, 490 sun4c_update_mmu_cache (find_vma(current->mm, address), address,
458 *ptep); 491 ptep);
459 else 492 else
460 do_sparc_fault(regs, text_fault, write, address); 493 do_sparc_fault(regs, text_fault, write, address);
461} 494}
@@ -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;
487good_area: 516good_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;
503bad_area: 532bad_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
518do_sigbus: 537do_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
528void window_overflow_fault(void) 542void 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
35int show_unhandled_signals = 1;
36
35static inline __kprobes int notify_page_fault(struct pt_regs *regs) 37static 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
133static inline void
134show_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
131extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int); 154extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int);
132 155
133static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, 156static 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/mm/init_64.c b/arch/sparc/mm/init_64.c
index 1886d37d411b..9245a822a2f1 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -289,12 +289,13 @@ static void flush_dcache(unsigned long pfn)
289 } 289 }
290} 290}
291 291
292void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 292void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
293{ 293{
294 struct mm_struct *mm; 294 struct mm_struct *mm;
295 struct tsb *tsb; 295 struct tsb *tsb;
296 unsigned long tag, flags; 296 unsigned long tag, flags;
297 unsigned long tsb_index, tsb_hash_shift; 297 unsigned long tsb_index, tsb_hash_shift;
298 pte_t pte = *ptep;
298 299
299 if (tlb_type != hypervisor) { 300 if (tlb_type != hypervisor) {
300 unsigned long pfn = pte_pfn(pte); 301 unsigned long pfn = pte_pfn(pte);
diff --git a/arch/sparc/mm/nosun4c.c b/arch/sparc/mm/nosun4c.c
index 196263f895b7..4e62c27147c4 100644
--- a/arch/sparc/mm/nosun4c.c
+++ b/arch/sparc/mm/nosun4c.c
@@ -62,7 +62,7 @@ pte_t *sun4c_pte_offset_kernel(pmd_t *dir, unsigned long address)
62 return NULL; 62 return NULL;
63} 63}
64 64
65void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 65void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
66{ 66{
67} 67}
68 68
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 367321a030dd..df49b200ca4c 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -694,7 +694,7 @@ extern void tsunami_setup_blockops(void);
694 * The following code is a deadwood that may be necessary when 694 * The following code is a deadwood that may be necessary when
695 * we start to make precise page flushes again. --zaitcev 695 * we start to make precise page flushes again. --zaitcev
696 */ 696 */
697static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte) 697static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t *ptep)
698{ 698{
699#if 0 699#if 0
700 static unsigned long last; 700 static unsigned long last;
@@ -703,10 +703,10 @@ static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long ad
703 703
704 if (address == last) { 704 if (address == last) {
705 val = srmmu_hwprobe(address); 705 val = srmmu_hwprobe(address);
706 if (val != 0 && pte_val(pte) != val) { 706 if (val != 0 && pte_val(*ptep) != val) {
707 printk("swift_update_mmu_cache: " 707 printk("swift_update_mmu_cache: "
708 "addr %lx put %08x probed %08x from %p\n", 708 "addr %lx put %08x probed %08x from %p\n",
709 address, pte_val(pte), val, 709 address, pte_val(*ptep), val,
710 __builtin_return_address(0)); 710 __builtin_return_address(0));
711 srmmu_flush_whole_tlb(); 711 srmmu_flush_whole_tlb();
712 } 712 }
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index a89baf0d875a..18652534b91a 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -1887,7 +1887,7 @@ static void sun4c_check_pgt_cache(int low, int high)
1887/* An experiment, turn off by default for now... -DaveM */ 1887/* An experiment, turn off by default for now... -DaveM */
1888#define SUN4C_PRELOAD_PSEG 1888#define SUN4C_PRELOAD_PSEG
1889 1889
1890void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 1890void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
1891{ 1891{
1892 unsigned long flags; 1892 unsigned long flags;
1893 int pseg; 1893 int pseg;
@@ -1929,7 +1929,7 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
1929 start += PAGE_SIZE; 1929 start += PAGE_SIZE;
1930 } 1930 }
1931#ifndef SUN4C_PRELOAD_PSEG 1931#ifndef SUN4C_PRELOAD_PSEG
1932 sun4c_put_pte(address, pte_val(pte)); 1932 sun4c_put_pte(address, pte_val(*ptep));
1933#endif 1933#endif
1934 local_irq_restore(flags); 1934 local_irq_restore(flags);
1935 return; 1935 return;
@@ -1940,7 +1940,7 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
1940 add_lru(entry); 1940 add_lru(entry);
1941 } 1941 }
1942 1942
1943 sun4c_put_pte(address, pte_val(pte)); 1943 sun4c_put_pte(address, pte_val(*ptep));
1944 local_irq_restore(flags); 1944 local_irq_restore(flags);
1945} 1945}
1946 1946
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
94prom_putchar(char c) 94prom_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
62prom_putchar(char c) 62prom_putchar(char c)
63{ 63{
64 prom_nbputchar(c); 64 prom_nbputchar(c);
65 return;
66} 65}
67 66
68void 67void
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
94void 92void
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}
178EXPORT_SYMBOL(prom_getstring); 177EXPORT_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}
159EXPORT_SYMBOL(prom_getstring); 158EXPORT_SYMBOL(prom_getstring);
160 159