aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/atags_proc.c28
-rw-r--r--arch/arm/kernel/early_printk.c17
-rw-r--r--arch/arm/kernel/etm.c2
-rw-r--r--arch/arm/kernel/irq.c6
-rw-r--r--arch/arm/kernel/process.c108
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/kernel/smp_twd.c17
-rw-r--r--arch/arm/kernel/swp_emulate.c43
-rw-r--r--arch/arm/kernel/topology.c2
-rw-r--r--arch/arm/kernel/traps.c7
10 files changed, 72 insertions, 160 deletions
diff --git a/arch/arm/kernel/atags_proc.c b/arch/arm/kernel/atags_proc.c
index 42a1a1415fa6..c7ff8073416f 100644
--- a/arch/arm/kernel/atags_proc.c
+++ b/arch/arm/kernel/atags_proc.c
@@ -9,24 +9,18 @@ struct buffer {
9 char data[]; 9 char data[];
10}; 10};
11 11
12static int 12static ssize_t atags_read(struct file *file, char __user *buf,
13read_buffer(char* page, char** start, off_t off, int count, 13 size_t count, loff_t *ppos)
14 int* eof, void* data)
15{ 14{
16 struct buffer *buffer = (struct buffer *)data; 15 struct buffer *b = PDE_DATA(file_inode(file));
17 16 return simple_read_from_buffer(buf, count, ppos, b->data, b->size);
18 if (off >= buffer->size) {
19 *eof = 1;
20 return 0;
21 }
22
23 count = min((int) (buffer->size - off), count);
24
25 memcpy(page, &buffer->data[off], count);
26
27 return count;
28} 17}
29 18
19static const struct file_operations atags_fops = {
20 .read = atags_read,
21 .llseek = default_llseek,
22};
23
30#define BOOT_PARAMS_SIZE 1536 24#define BOOT_PARAMS_SIZE 1536
31static char __initdata atags_copy[BOOT_PARAMS_SIZE]; 25static char __initdata atags_copy[BOOT_PARAMS_SIZE];
32 26
@@ -66,9 +60,7 @@ static int __init init_atags_procfs(void)
66 b->size = size; 60 b->size = size;
67 memcpy(b->data, atags_copy, size); 61 memcpy(b->data, atags_copy, size);
68 62
69 tags_entry = create_proc_read_entry("atags", 0400, 63 tags_entry = proc_create_data("atags", 0400, NULL, &atags_fops, b);
70 NULL, read_buffer, b);
71
72 if (!tags_entry) 64 if (!tags_entry)
73 goto nomem; 65 goto nomem;
74 66
diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
index 85aa2b292692..43076536965c 100644
--- a/arch/arm/kernel/early_printk.c
+++ b/arch/arm/kernel/early_printk.c
@@ -29,28 +29,17 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
29 early_write(s, n); 29 early_write(s, n);
30} 30}
31 31
32static struct console early_console = { 32static struct console early_console_dev = {
33 .name = "earlycon", 33 .name = "earlycon",
34 .write = early_console_write, 34 .write = early_console_write,
35 .flags = CON_PRINTBUFFER | CON_BOOT, 35 .flags = CON_PRINTBUFFER | CON_BOOT,
36 .index = -1, 36 .index = -1,
37}; 37};
38 38
39asmlinkage void early_printk(const char *fmt, ...)
40{
41 char buf[512];
42 int n;
43 va_list ap;
44
45 va_start(ap, fmt);
46 n = vscnprintf(buf, sizeof(buf), fmt, ap);
47 early_write(buf, n);
48 va_end(ap);
49}
50
51static int __init setup_early_printk(char *buf) 39static int __init setup_early_printk(char *buf)
52{ 40{
53 register_console(&early_console); 41 early_console = &early_console_dev;
42 register_console(&early_console_dev);
54 return 0; 43 return 0;
55} 44}
56 45
diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
index 9b6de8c988f3..8ff0ecdc637f 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -254,7 +254,7 @@ static void sysrq_etm_dump(int key)
254 254
255static struct sysrq_key_op sysrq_etm_op = { 255static struct sysrq_key_op sysrq_etm_op = {
256 .handler = sysrq_etm_dump, 256 .handler = sysrq_etm_dump,
257 .help_msg = "ETM buffer dump", 257 .help_msg = "etm-buffer-dump(v)",
258 .action_msg = "etm", 258 .action_msg = "etm",
259}; 259};
260 260
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 8e4ef4c83a74..9723d17b8f38 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -26,6 +26,7 @@
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/irq.h> 28#include <linux/irq.h>
29#include <linux/irqchip.h>
29#include <linux/random.h> 30#include <linux/random.h>
30#include <linux/smp.h> 31#include <linux/smp.h>
31#include <linux/init.h> 32#include <linux/init.h>
@@ -114,7 +115,10 @@ EXPORT_SYMBOL_GPL(set_irq_flags);
114 115
115void __init init_IRQ(void) 116void __init init_IRQ(void)
116{ 117{
117 machine_desc->init_irq(); 118 if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq)
119 irqchip_init();
120 else
121 machine_desc->init_irq();
118} 122}
119 123
120#ifdef CONFIG_MULTI_IRQ_HANDLER 124#ifdef CONFIG_MULTI_IRQ_HANDLER
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index cbd0f51937cc..f21970316836 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -57,38 +57,6 @@ static const char *isa_modes[] = {
57 "ARM" , "Thumb" , "Jazelle", "ThumbEE" 57 "ARM" , "Thumb" , "Jazelle", "ThumbEE"
58}; 58};
59 59
60static volatile int hlt_counter;
61
62void disable_hlt(void)
63{
64 hlt_counter++;
65}
66
67EXPORT_SYMBOL(disable_hlt);
68
69void enable_hlt(void)
70{
71 hlt_counter--;
72 BUG_ON(hlt_counter < 0);
73}
74
75EXPORT_SYMBOL(enable_hlt);
76
77static int __init nohlt_setup(char *__unused)
78{
79 hlt_counter = 1;
80 return 1;
81}
82
83static int __init hlt_setup(char *__unused)
84{
85 hlt_counter = 0;
86 return 1;
87}
88
89__setup("nohlt", nohlt_setup);
90__setup("hlt", hlt_setup);
91
92extern void call_with_stack(void (*fn)(void *), void *arg, void *sp); 60extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
93typedef void (*phys_reset_t)(unsigned long); 61typedef void (*phys_reset_t)(unsigned long);
94 62
@@ -172,54 +140,38 @@ static void default_idle(void)
172 local_irq_enable(); 140 local_irq_enable();
173} 141}
174 142
175/* 143void arch_cpu_idle_prepare(void)
176 * The idle thread.
177 * We always respect 'hlt_counter' to prevent low power idle.
178 */
179void cpu_idle(void)
180{ 144{
181 local_fiq_enable(); 145 local_fiq_enable();
146}
182 147
183 /* endless idle loop with no priority at all */ 148void arch_cpu_idle_enter(void)
184 while (1) { 149{
185 tick_nohz_idle_enter(); 150 ledtrig_cpu(CPU_LED_IDLE_START);
186 rcu_idle_enter(); 151#ifdef CONFIG_PL310_ERRATA_769419
187 ledtrig_cpu(CPU_LED_IDLE_START); 152 wmb();
188 while (!need_resched()) {
189#ifdef CONFIG_HOTPLUG_CPU
190 if (cpu_is_offline(smp_processor_id()))
191 cpu_die();
192#endif 153#endif
154}
193 155
194 /* 156void arch_cpu_idle_exit(void)
195 * We need to disable interrupts here 157{
196 * to ensure we don't miss a wakeup call. 158 ledtrig_cpu(CPU_LED_IDLE_END);
197 */ 159}
198 local_irq_disable(); 160
199#ifdef CONFIG_PL310_ERRATA_769419 161#ifdef CONFIG_HOTPLUG_CPU
200 wmb(); 162void arch_cpu_idle_dead(void)
163{
164 cpu_die();
165}
201#endif 166#endif
202 if (hlt_counter) { 167
203 local_irq_enable(); 168/*
204 cpu_relax(); 169 * Called from the core idle loop.
205 } else if (!need_resched()) { 170 */
206 stop_critical_timings(); 171void arch_cpu_idle(void)
207 if (cpuidle_idle_call()) 172{
208 default_idle(); 173 if (cpuidle_idle_call())
209 start_critical_timings(); 174 default_idle();
210 /*
211 * default_idle functions must always
212 * return with IRQs enabled.
213 */
214 WARN_ON(irqs_disabled());
215 } else
216 local_irq_enable();
217 }
218 ledtrig_cpu(CPU_LED_IDLE_END);
219 rcu_idle_exit();
220 tick_nohz_idle_exit();
221 schedule_preempt_disabled();
222 }
223} 175}
224 176
225static char reboot_mode = 'h'; 177static char reboot_mode = 'h';
@@ -273,11 +225,8 @@ void __show_regs(struct pt_regs *regs)
273 unsigned long flags; 225 unsigned long flags;
274 char buf[64]; 226 char buf[64];
275 227
276 printk("CPU: %d %s (%s %.*s)\n", 228 show_regs_print_info(KERN_DEFAULT);
277 raw_smp_processor_id(), print_tainted(), 229
278 init_utsname()->release,
279 (int)strcspn(init_utsname()->version, " "),
280 init_utsname()->version);
281 print_symbol("PC is at %s\n", instruction_pointer(regs)); 230 print_symbol("PC is at %s\n", instruction_pointer(regs));
282 print_symbol("LR is at %s\n", regs->ARM_lr); 231 print_symbol("LR is at %s\n", regs->ARM_lr);
283 printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" 232 printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
@@ -332,7 +281,6 @@ void __show_regs(struct pt_regs *regs)
332void show_regs(struct pt_regs * regs) 281void show_regs(struct pt_regs * regs)
333{ 282{
334 printk("\n"); 283 printk("\n");
335 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
336 __show_regs(regs); 284 __show_regs(regs);
337 dump_stack(); 285 dump_stack();
338} 286}
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 4231034b8128..47ab90563bf4 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -370,7 +370,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
370 /* 370 /*
371 * OK, it's off to the idle thread for us 371 * OK, it's off to the idle thread for us
372 */ 372 */
373 cpu_idle(); 373 cpu_startup_entry(CPUHP_ONLINE);
374} 374}
375 375
376void __init smp_cpus_done(unsigned int max_cpus) 376void __init smp_cpus_done(unsigned int max_cpus)
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 3f2565037480..90525d9d290b 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -362,25 +362,13 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt)
362} 362}
363 363
364#ifdef CONFIG_OF 364#ifdef CONFIG_OF
365const static struct of_device_id twd_of_match[] __initconst = { 365static void __init twd_local_timer_of_register(struct device_node *np)
366 { .compatible = "arm,cortex-a9-twd-timer", },
367 { .compatible = "arm,cortex-a5-twd-timer", },
368 { .compatible = "arm,arm11mp-twd-timer", },
369 { },
370};
371
372void __init twd_local_timer_of_register(void)
373{ 366{
374 struct device_node *np;
375 int err; 367 int err;
376 368
377 if (!is_smp() || !setup_max_cpus) 369 if (!is_smp() || !setup_max_cpus)
378 return; 370 return;
379 371
380 np = of_find_matching_node(NULL, twd_of_match);
381 if (!np)
382 return;
383
384 twd_ppi = irq_of_parse_and_map(np, 0); 372 twd_ppi = irq_of_parse_and_map(np, 0);
385 if (!twd_ppi) { 373 if (!twd_ppi) {
386 err = -EINVAL; 374 err = -EINVAL;
@@ -398,4 +386,7 @@ void __init twd_local_timer_of_register(void)
398out: 386out:
399 WARN(err, "twd_local_timer_of_register failed (%d)\n", err); 387 WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
400} 388}
389CLOCKSOURCE_OF_DECLARE(arm_twd_a9, "arm,cortex-a9-twd-timer", twd_local_timer_of_register);
390CLOCKSOURCE_OF_DECLARE(arm_twd_a5, "arm,cortex-a5-twd-timer", twd_local_timer_of_register);
391CLOCKSOURCE_OF_DECLARE(arm_twd_11mp, "arm,arm11mp-twd-timer", twd_local_timer_of_register);
401#endif 392#endif
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index ab1017bd1667..087fc321e9e5 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/proc_fs.h> 23#include <linux/proc_fs.h>
24#include <linux/seq_file.h>
24#include <linux/sched.h> 25#include <linux/sched.h>
25#include <linux/syscalls.h> 26#include <linux/syscalls.h>
26#include <linux/perf_event.h> 27#include <linux/perf_event.h>
@@ -79,27 +80,27 @@ static unsigned long abtcounter;
79static pid_t previous_pid; 80static pid_t previous_pid;
80 81
81#ifdef CONFIG_PROC_FS 82#ifdef CONFIG_PROC_FS
82static int proc_read_status(char *page, char **start, off_t off, int count, 83static int proc_status_show(struct seq_file *m, void *v)
83 int *eof, void *data)
84{ 84{
85 char *p = page; 85 seq_printf(m, "Emulated SWP:\t\t%lu\n", swpcounter);
86 int len; 86 seq_printf(m, "Emulated SWPB:\t\t%lu\n", swpbcounter);
87 87 seq_printf(m, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
88 p += sprintf(p, "Emulated SWP:\t\t%lu\n", swpcounter);
89 p += sprintf(p, "Emulated SWPB:\t\t%lu\n", swpbcounter);
90 p += sprintf(p, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
91 if (previous_pid != 0) 88 if (previous_pid != 0)
92 p += sprintf(p, "Last process:\t\t%d\n", previous_pid); 89 seq_printf(m, "Last process:\t\t%d\n", previous_pid);
93 90 return 0;
94 len = (p - page) - off; 91}
95 if (len < 0)
96 len = 0;
97
98 *eof = (len <= count) ? 1 : 0;
99 *start = page + off;
100 92
101 return len; 93static int proc_status_open(struct inode *inode, struct file *file)
94{
95 return single_open(file, proc_status_show, PDE_DATA(inode));
102} 96}
97
98static const struct file_operations proc_status_fops = {
99 .open = proc_status_open,
100 .read = seq_read,
101 .llseek = seq_lseek,
102 .release = seq_release,
103};
103#endif 104#endif
104 105
105/* 106/*
@@ -266,14 +267,8 @@ static struct undef_hook swp_hook = {
266static int __init swp_emulation_init(void) 267static int __init swp_emulation_init(void)
267{ 268{
268#ifdef CONFIG_PROC_FS 269#ifdef CONFIG_PROC_FS
269 struct proc_dir_entry *res; 270 if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops))
270
271 res = create_proc_entry("cpu/swp_emulation", S_IRUGO, NULL);
272
273 if (!res)
274 return -ENOMEM; 271 return -ENOMEM;
275
276 res->read_proc = proc_read_status;
277#endif /* CONFIG_PROC_FS */ 272#endif /* CONFIG_PROC_FS */
278 273
279 printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n"); 274 printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n");
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 79282ebcd939..f10316b4ecdc 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -100,7 +100,7 @@ static void __init parse_dt_topology(void)
100 int alloc_size, cpu = 0; 100 int alloc_size, cpu = 0;
101 101
102 alloc_size = nr_cpu_ids * sizeof(struct cpu_capacity); 102 alloc_size = nr_cpu_ids * sizeof(struct cpu_capacity);
103 cpu_capacity = (struct cpu_capacity *)kzalloc(alloc_size, GFP_NOWAIT); 103 cpu_capacity = kzalloc(alloc_size, GFP_NOWAIT);
104 104
105 while ((cn = of_find_node_by_type(cn, "cpu"))) { 105 while ((cn = of_find_node_by_type(cn, "cpu"))) {
106 const u32 *rate, *reg; 106 const u32 *rate, *reg;
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 1c089119b2d7..18b32e8e4497 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -204,13 +204,6 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
204} 204}
205#endif 205#endif
206 206
207void dump_stack(void)
208{
209 dump_backtrace(NULL, NULL);
210}
211
212EXPORT_SYMBOL(dump_stack);
213
214void show_stack(struct task_struct *tsk, unsigned long *sp) 207void show_stack(struct task_struct *tsk, unsigned long *sp)
215{ 208{
216 dump_backtrace(NULL, tsk); 209 dump_backtrace(NULL, tsk);