diff options
author | Paul Mundt <lethal@linux-sh.org> | 2012-01-08 19:56:37 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2012-01-08 19:56:37 -0500 |
commit | 04cf399640b7acfa9abe2eb7900cd934db8af697 (patch) | |
tree | f9a055f2f0170550f5f0b0507b06ffce8d98945d /arch/powerpc/kernel | |
parent | 17f0056e6a2f3d1818801705f5e12b71217bf4ef (diff) | |
parent | a0e86bd4252519321b0d102dc4ed90557aa7bee9 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into rmobile-latest
Conflicts:
arch/arm/mach-shmobile/Makefile
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/powerpc/kernel')
36 files changed, 953 insertions, 524 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index ce4f7f179117..ee728e433aa2 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -85,6 +85,8 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o | |||
85 | extra-$(CONFIG_8xx) := head_8xx.o | 85 | extra-$(CONFIG_8xx) := head_8xx.o |
86 | extra-y += vmlinux.lds | 86 | extra-y += vmlinux.lds |
87 | 87 | ||
88 | obj-$(CONFIG_RELOCATABLE_PPC32) += reloc_32.o | ||
89 | |||
88 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o | 90 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o |
89 | obj-$(CONFIG_PPC64) += dma-iommu.o iommu.o | 91 | obj-$(CONFIG_PPC64) += dma-iommu.o iommu.o |
90 | obj-$(CONFIG_KGDB) += kgdb.o | 92 | obj-$(CONFIG_KGDB) += kgdb.o |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 7c5324f1ec9c..04caee7d9bc1 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -208,6 +208,7 @@ int main(void) | |||
208 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); | 208 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); |
209 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); | 209 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); |
210 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); | 210 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); |
211 | DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost)); | ||
211 | #endif /* CONFIG_PPC64 */ | 212 | #endif /* CONFIG_PPC64 */ |
212 | 213 | ||
213 | /* RTAS */ | 214 | /* RTAS */ |
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index a3c684b4c862..92c6b008dd2b 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c | |||
@@ -451,15 +451,15 @@ out: | |||
451 | static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) | 451 | static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) |
452 | { | 452 | { |
453 | struct cache_dir *cache_dir; | 453 | struct cache_dir *cache_dir; |
454 | struct sys_device *sysdev; | 454 | struct device *dev; |
455 | struct kobject *kobj = NULL; | 455 | struct kobject *kobj = NULL; |
456 | 456 | ||
457 | sysdev = get_cpu_sysdev(cpu_id); | 457 | dev = get_cpu_device(cpu_id); |
458 | WARN_ONCE(!sysdev, "no sysdev for CPU %i\n", cpu_id); | 458 | WARN_ONCE(!dev, "no dev for CPU %i\n", cpu_id); |
459 | if (!sysdev) | 459 | if (!dev) |
460 | goto err; | 460 | goto err; |
461 | 461 | ||
462 | kobj = kobject_create_and_add("cache", &sysdev->kobj); | 462 | kobj = kobject_create_and_add("cache", &dev->kobj); |
463 | if (!kobj) | 463 | if (!kobj) |
464 | goto err; | 464 | goto err; |
465 | 465 | ||
diff --git a/arch/powerpc/kernel/cpu_setup_a2.S b/arch/powerpc/kernel/cpu_setup_a2.S index 7f818feaa7a5..ebc62f42a237 100644 --- a/arch/powerpc/kernel/cpu_setup_a2.S +++ b/arch/powerpc/kernel/cpu_setup_a2.S | |||
@@ -41,11 +41,16 @@ _GLOBAL(__setup_cpu_a2) | |||
41 | * core local but doing it always won't hurt | 41 | * core local but doing it always won't hurt |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #ifdef CONFIG_PPC_WSP_COPRO | 44 | #ifdef CONFIG_PPC_ICSWX |
45 | /* Make sure ACOP starts out as zero */ | 45 | /* Make sure ACOP starts out as zero */ |
46 | li r3,0 | 46 | li r3,0 |
47 | mtspr SPRN_ACOP,r3 | 47 | mtspr SPRN_ACOP,r3 |
48 | 48 | ||
49 | /* Skip the following if we are in Guest mode */ | ||
50 | mfmsr r3 | ||
51 | andis. r0,r3,MSR_GS@h | ||
52 | bne _icswx_skip_guest | ||
53 | |||
49 | /* Enable icswx instruction */ | 54 | /* Enable icswx instruction */ |
50 | mfspr r3,SPRN_A2_CCR2 | 55 | mfspr r3,SPRN_A2_CCR2 |
51 | ori r3,r3,A2_CCR2_ENABLE_ICSWX | 56 | ori r3,r3,A2_CCR2_ENABLE_ICSWX |
@@ -54,7 +59,8 @@ _GLOBAL(__setup_cpu_a2) | |||
54 | /* Unmask all CTs in HACOP */ | 59 | /* Unmask all CTs in HACOP */ |
55 | li r3,-1 | 60 | li r3,-1 |
56 | mtspr SPRN_HACOP,r3 | 61 | mtspr SPRN_HACOP,r3 |
57 | #endif /* CONFIG_PPC_WSP_COPRO */ | 62 | _icswx_skip_guest: |
63 | #endif /* CONFIG_PPC_ICSWX */ | ||
58 | 64 | ||
59 | /* Enable doorbell */ | 65 | /* Enable doorbell */ |
60 | mfspr r3,SPRN_A2_CCR2 | 66 | mfspr r3,SPRN_A2_CCR2 |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index edae5bb06f1f..81db9e2a8a20 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -1505,6 +1505,19 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
1505 | .machine_check = machine_check_4xx, | 1505 | .machine_check = machine_check_4xx, |
1506 | .platform = "ppc405", | 1506 | .platform = "ppc405", |
1507 | }, | 1507 | }, |
1508 | { /* APM8018X */ | ||
1509 | .pvr_mask = 0xffff0000, | ||
1510 | .pvr_value = 0x7ff11432, | ||
1511 | .cpu_name = "APM8018X", | ||
1512 | .cpu_features = CPU_FTRS_40X, | ||
1513 | .cpu_user_features = PPC_FEATURE_32 | | ||
1514 | PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, | ||
1515 | .mmu_features = MMU_FTR_TYPE_40x, | ||
1516 | .icache_bsize = 32, | ||
1517 | .dcache_bsize = 32, | ||
1518 | .machine_check = machine_check_4xx, | ||
1519 | .platform = "ppc405", | ||
1520 | }, | ||
1508 | { /* default match */ | 1521 | { /* default match */ |
1509 | .pvr_mask = 0x00000000, | 1522 | .pvr_mask = 0x00000000, |
1510 | .pvr_value = 0x00000000, | 1523 | .pvr_value = 0x00000000, |
@@ -1830,6 +1843,20 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
1830 | .machine_check = machine_check_47x, | 1843 | .machine_check = machine_check_47x, |
1831 | .platform = "ppc470", | 1844 | .platform = "ppc470", |
1832 | }, | 1845 | }, |
1846 | { /* 476fpe */ | ||
1847 | .pvr_mask = 0xffff0000, | ||
1848 | .pvr_value = 0x7ff50000, | ||
1849 | .cpu_name = "476fpe", | ||
1850 | .cpu_features = CPU_FTRS_47X | CPU_FTR_476_DD2, | ||
1851 | .cpu_user_features = COMMON_USER_BOOKE | | ||
1852 | PPC_FEATURE_HAS_FPU, | ||
1853 | .mmu_features = MMU_FTR_TYPE_47x | | ||
1854 | MMU_FTR_USE_TLBIVAX_BCAST | MMU_FTR_LOCK_BCAST_INVAL, | ||
1855 | .icache_bsize = 32, | ||
1856 | .dcache_bsize = 128, | ||
1857 | .machine_check = machine_check_47x, | ||
1858 | .platform = "ppc470", | ||
1859 | }, | ||
1833 | { /* 476 iss */ | 1860 | { /* 476 iss */ |
1834 | .pvr_mask = 0xffff0000, | 1861 | .pvr_mask = 0xffff0000, |
1835 | .pvr_value = 0x00050000, | 1862 | .pvr_value = 0x00050000, |
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index d879809d5c45..28be3452e67a 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -10,85 +10,85 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #undef DEBUG | ||
14 | |||
15 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
16 | #include <linux/smp.h> | 14 | #include <linux/smp.h> |
17 | #include <linux/reboot.h> | 15 | #include <linux/reboot.h> |
18 | #include <linux/kexec.h> | 16 | #include <linux/kexec.h> |
19 | #include <linux/bootmem.h> | ||
20 | #include <linux/export.h> | 17 | #include <linux/export.h> |
21 | #include <linux/crash_dump.h> | 18 | #include <linux/crash_dump.h> |
22 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
23 | #include <linux/elf.h> | ||
24 | #include <linux/elfcore.h> | ||
25 | #include <linux/init.h> | 20 | #include <linux/init.h> |
26 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
27 | #include <linux/types.h> | 22 | #include <linux/types.h> |
28 | #include <linux/memblock.h> | ||
29 | 23 | ||
30 | #include <asm/processor.h> | 24 | #include <asm/processor.h> |
31 | #include <asm/machdep.h> | 25 | #include <asm/machdep.h> |
32 | #include <asm/kexec.h> | 26 | #include <asm/kexec.h> |
33 | #include <asm/kdump.h> | 27 | #include <asm/kdump.h> |
34 | #include <asm/prom.h> | 28 | #include <asm/prom.h> |
35 | #include <asm/firmware.h> | ||
36 | #include <asm/smp.h> | 29 | #include <asm/smp.h> |
37 | #include <asm/system.h> | 30 | #include <asm/system.h> |
38 | #include <asm/setjmp.h> | 31 | #include <asm/setjmp.h> |
39 | 32 | ||
40 | #ifdef DEBUG | 33 | /* |
41 | #include <asm/udbg.h> | 34 | * The primary CPU waits a while for all secondary CPUs to enter. This is to |
42 | #define DBG(fmt...) udbg_printf(fmt) | 35 | * avoid sending an IPI if the secondary CPUs are entering |
43 | #else | 36 | * crash_kexec_secondary on their own (eg via a system reset). |
44 | #define DBG(fmt...) | 37 | * |
45 | #endif | 38 | * The secondary timeout has to be longer than the primary. Both timeouts are |
39 | * in milliseconds. | ||
40 | */ | ||
41 | #define PRIMARY_TIMEOUT 500 | ||
42 | #define SECONDARY_TIMEOUT 1000 | ||
46 | 43 | ||
47 | /* This keeps a track of which one is crashing cpu. */ | 44 | #define IPI_TIMEOUT 10000 |
45 | #define REAL_MODE_TIMEOUT 10000 | ||
46 | |||
47 | /* This keeps a track of which one is the crashing cpu. */ | ||
48 | int crashing_cpu = -1; | 48 | int crashing_cpu = -1; |
49 | static cpumask_t cpus_in_crash = CPU_MASK_NONE; | 49 | static atomic_t cpus_in_crash; |
50 | cpumask_t cpus_in_sr = CPU_MASK_NONE; | 50 | static int time_to_dump; |
51 | 51 | ||
52 | #define CRASH_HANDLER_MAX 3 | 52 | #define CRASH_HANDLER_MAX 3 |
53 | /* NULL terminated list of shutdown handles */ | 53 | /* NULL terminated list of shutdown handles */ |
54 | static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1]; | 54 | static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1]; |
55 | static DEFINE_SPINLOCK(crash_handlers_lock); | 55 | static DEFINE_SPINLOCK(crash_handlers_lock); |
56 | 56 | ||
57 | static unsigned long crash_shutdown_buf[JMP_BUF_LEN]; | ||
58 | static int crash_shutdown_cpu = -1; | ||
59 | |||
60 | static int handle_fault(struct pt_regs *regs) | ||
61 | { | ||
62 | if (crash_shutdown_cpu == smp_processor_id()) | ||
63 | longjmp(crash_shutdown_buf, 1); | ||
64 | return 0; | ||
65 | } | ||
66 | |||
57 | #ifdef CONFIG_SMP | 67 | #ifdef CONFIG_SMP |
58 | static atomic_t enter_on_soft_reset = ATOMIC_INIT(0); | ||
59 | 68 | ||
60 | void crash_ipi_callback(struct pt_regs *regs) | 69 | void crash_ipi_callback(struct pt_regs *regs) |
61 | { | 70 | { |
71 | static cpumask_t cpus_state_saved = CPU_MASK_NONE; | ||
72 | |||
62 | int cpu = smp_processor_id(); | 73 | int cpu = smp_processor_id(); |
63 | 74 | ||
64 | if (!cpu_online(cpu)) | 75 | if (!cpu_online(cpu)) |
65 | return; | 76 | return; |
66 | 77 | ||
67 | hard_irq_disable(); | 78 | hard_irq_disable(); |
68 | if (!cpumask_test_cpu(cpu, &cpus_in_crash)) | 79 | if (!cpumask_test_cpu(cpu, &cpus_state_saved)) { |
69 | crash_save_cpu(regs, cpu); | 80 | crash_save_cpu(regs, cpu); |
70 | cpumask_set_cpu(cpu, &cpus_in_crash); | 81 | cpumask_set_cpu(cpu, &cpus_state_saved); |
71 | |||
72 | /* | ||
73 | * Entered via soft-reset - could be the kdump | ||
74 | * process is invoked using soft-reset or user activated | ||
75 | * it if some CPU did not respond to an IPI. | ||
76 | * For soft-reset, the secondary CPU can enter this func | ||
77 | * twice. 1 - using IPI, and 2. soft-reset. | ||
78 | * Tell the kexec CPU that entered via soft-reset and ready | ||
79 | * to go down. | ||
80 | */ | ||
81 | if (cpumask_test_cpu(cpu, &cpus_in_sr)) { | ||
82 | cpumask_clear_cpu(cpu, &cpus_in_sr); | ||
83 | atomic_inc(&enter_on_soft_reset); | ||
84 | } | 82 | } |
85 | 83 | ||
84 | atomic_inc(&cpus_in_crash); | ||
85 | smp_mb__after_atomic_inc(); | ||
86 | |||
86 | /* | 87 | /* |
87 | * Starting the kdump boot. | 88 | * Starting the kdump boot. |
88 | * This barrier is needed to make sure that all CPUs are stopped. | 89 | * This barrier is needed to make sure that all CPUs are stopped. |
89 | * If not, soft-reset will be invoked to bring other CPUs. | ||
90 | */ | 90 | */ |
91 | while (!cpumask_test_cpu(crashing_cpu, &cpus_in_crash)) | 91 | while (!time_to_dump) |
92 | cpu_relax(); | 92 | cpu_relax(); |
93 | 93 | ||
94 | if (ppc_md.kexec_cpu_down) | 94 | if (ppc_md.kexec_cpu_down) |
@@ -103,106 +103,99 @@ void crash_ipi_callback(struct pt_regs *regs) | |||
103 | /* NOTREACHED */ | 103 | /* NOTREACHED */ |
104 | } | 104 | } |
105 | 105 | ||
106 | /* | ||
107 | * Wait until all CPUs are entered via soft-reset. | ||
108 | */ | ||
109 | static void crash_soft_reset_check(int cpu) | ||
110 | { | ||
111 | unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ | ||
112 | |||
113 | cpumask_clear_cpu(cpu, &cpus_in_sr); | ||
114 | while (atomic_read(&enter_on_soft_reset) != ncpus) | ||
115 | cpu_relax(); | ||
116 | } | ||
117 | |||
118 | |||
119 | static void crash_kexec_prepare_cpus(int cpu) | 106 | static void crash_kexec_prepare_cpus(int cpu) |
120 | { | 107 | { |
121 | unsigned int msecs; | 108 | unsigned int msecs; |
122 | |||
123 | unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ | 109 | unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ |
110 | int tries = 0; | ||
111 | int (*old_handler)(struct pt_regs *regs); | ||
112 | |||
113 | printk(KERN_EMERG "Sending IPI to other CPUs\n"); | ||
124 | 114 | ||
125 | crash_send_ipi(crash_ipi_callback); | 115 | crash_send_ipi(crash_ipi_callback); |
126 | smp_wmb(); | 116 | smp_wmb(); |
127 | 117 | ||
118 | again: | ||
128 | /* | 119 | /* |
129 | * FIXME: Until we will have the way to stop other CPUs reliably, | 120 | * FIXME: Until we will have the way to stop other CPUs reliably, |
130 | * the crash CPU will send an IPI and wait for other CPUs to | 121 | * the crash CPU will send an IPI and wait for other CPUs to |
131 | * respond. | 122 | * respond. |
132 | * Delay of at least 10 seconds. | ||
133 | */ | 123 | */ |
134 | printk(KERN_EMERG "Sending IPI to other cpus...\n"); | 124 | msecs = IPI_TIMEOUT; |
135 | msecs = 10000; | 125 | while ((atomic_read(&cpus_in_crash) < ncpus) && (--msecs > 0)) |
136 | while ((cpumask_weight(&cpus_in_crash) < ncpus) && (--msecs > 0)) { | ||
137 | cpu_relax(); | ||
138 | mdelay(1); | 126 | mdelay(1); |
139 | } | ||
140 | 127 | ||
141 | /* Would it be better to replace the trap vector here? */ | 128 | /* Would it be better to replace the trap vector here? */ |
142 | 129 | ||
130 | if (atomic_read(&cpus_in_crash) >= ncpus) { | ||
131 | printk(KERN_EMERG "IPI complete\n"); | ||
132 | return; | ||
133 | } | ||
134 | |||
135 | printk(KERN_EMERG "ERROR: %d cpu(s) not responding\n", | ||
136 | ncpus - atomic_read(&cpus_in_crash)); | ||
137 | |||
143 | /* | 138 | /* |
144 | * FIXME: In case if we do not get all CPUs, one possibility: ask the | 139 | * If we have a panic timeout set then we can't wait indefinitely |
145 | * user to do soft reset such that we get all. | 140 | * for someone to activate system reset. We also give up on the |
146 | * Soft-reset will be used until better mechanism is implemented. | 141 | * second time through if system reset fail to work. |
147 | */ | 142 | */ |
148 | if (cpumask_weight(&cpus_in_crash) < ncpus) { | 143 | if ((panic_timeout > 0) || (tries > 0)) |
149 | printk(KERN_EMERG "done waiting: %d cpu(s) not responding\n", | 144 | return; |
150 | ncpus - cpumask_weight(&cpus_in_crash)); | 145 | |
151 | printk(KERN_EMERG "Activate soft-reset to stop other cpu(s)\n"); | ||
152 | cpumask_clear(&cpus_in_sr); | ||
153 | atomic_set(&enter_on_soft_reset, 0); | ||
154 | while (cpumask_weight(&cpus_in_crash) < ncpus) | ||
155 | cpu_relax(); | ||
156 | } | ||
157 | /* | 146 | /* |
158 | * Make sure all CPUs are entered via soft-reset if the kdump is | 147 | * A system reset will cause all CPUs to take an 0x100 exception. |
159 | * invoked using soft-reset. | 148 | * The primary CPU returns here via setjmp, and the secondary |
149 | * CPUs reexecute the crash_kexec_secondary path. | ||
160 | */ | 150 | */ |
161 | if (cpumask_test_cpu(cpu, &cpus_in_sr)) | 151 | old_handler = __debugger; |
162 | crash_soft_reset_check(cpu); | 152 | __debugger = handle_fault; |
163 | /* Leave the IPI callback set */ | 153 | crash_shutdown_cpu = smp_processor_id(); |
154 | |||
155 | if (setjmp(crash_shutdown_buf) == 0) { | ||
156 | printk(KERN_EMERG "Activate system reset (dumprestart) " | ||
157 | "to stop other cpu(s)\n"); | ||
158 | |||
159 | /* | ||
160 | * A system reset will force all CPUs to execute the | ||
161 | * crash code again. We need to reset cpus_in_crash so we | ||
162 | * wait for everyone to do this. | ||
163 | */ | ||
164 | atomic_set(&cpus_in_crash, 0); | ||
165 | smp_mb(); | ||
166 | |||
167 | while (atomic_read(&cpus_in_crash) < ncpus) | ||
168 | cpu_relax(); | ||
169 | } | ||
170 | |||
171 | crash_shutdown_cpu = -1; | ||
172 | __debugger = old_handler; | ||
173 | |||
174 | tries++; | ||
175 | goto again; | ||
164 | } | 176 | } |
165 | 177 | ||
166 | /* | 178 | /* |
167 | * This function will be called by secondary cpus or by kexec cpu | 179 | * This function will be called by secondary cpus. |
168 | * if soft-reset is activated to stop some CPUs. | ||
169 | */ | 180 | */ |
170 | void crash_kexec_secondary(struct pt_regs *regs) | 181 | void crash_kexec_secondary(struct pt_regs *regs) |
171 | { | 182 | { |
172 | int cpu = smp_processor_id(); | ||
173 | unsigned long flags; | 183 | unsigned long flags; |
174 | int msecs = 5; | 184 | int msecs = SECONDARY_TIMEOUT; |
175 | 185 | ||
176 | local_irq_save(flags); | 186 | local_irq_save(flags); |
177 | /* Wait 5ms if the kexec CPU is not entered yet. */ | 187 | |
188 | /* Wait for the primary crash CPU to signal its progress */ | ||
178 | while (crashing_cpu < 0) { | 189 | while (crashing_cpu < 0) { |
179 | if (--msecs < 0) { | 190 | if (--msecs < 0) { |
180 | /* | 191 | /* No response, kdump image may not have been loaded */ |
181 | * Either kdump image is not loaded or | ||
182 | * kdump process is not started - Probably xmon | ||
183 | * exited using 'x'(exit and recover) or | ||
184 | * kexec_should_crash() failed for all running tasks. | ||
185 | */ | ||
186 | cpumask_clear_cpu(cpu, &cpus_in_sr); | ||
187 | local_irq_restore(flags); | 192 | local_irq_restore(flags); |
188 | return; | 193 | return; |
189 | } | 194 | } |
195 | |||
190 | mdelay(1); | 196 | mdelay(1); |
191 | cpu_relax(); | ||
192 | } | ||
193 | if (cpu == crashing_cpu) { | ||
194 | /* | ||
195 | * Panic CPU will enter this func only via soft-reset. | ||
196 | * Wait until all secondary CPUs entered and | ||
197 | * then start kexec boot. | ||
198 | */ | ||
199 | crash_soft_reset_check(cpu); | ||
200 | cpumask_set_cpu(crashing_cpu, &cpus_in_crash); | ||
201 | if (ppc_md.kexec_cpu_down) | ||
202 | ppc_md.kexec_cpu_down(1, 0); | ||
203 | machine_kexec(kexec_crash_image); | ||
204 | /* NOTREACHED */ | ||
205 | } | 197 | } |
198 | |||
206 | crash_ipi_callback(regs); | 199 | crash_ipi_callback(regs); |
207 | } | 200 | } |
208 | 201 | ||
@@ -211,7 +204,7 @@ void crash_kexec_secondary(struct pt_regs *regs) | |||
211 | static void crash_kexec_prepare_cpus(int cpu) | 204 | static void crash_kexec_prepare_cpus(int cpu) |
212 | { | 205 | { |
213 | /* | 206 | /* |
214 | * move the secondarys to us so that we can copy | 207 | * move the secondaries to us so that we can copy |
215 | * the new kernel 0-0x100 safely | 208 | * the new kernel 0-0x100 safely |
216 | * | 209 | * |
217 | * do this if kexec in setup.c ? | 210 | * do this if kexec in setup.c ? |
@@ -225,7 +218,6 @@ static void crash_kexec_prepare_cpus(int cpu) | |||
225 | 218 | ||
226 | void crash_kexec_secondary(struct pt_regs *regs) | 219 | void crash_kexec_secondary(struct pt_regs *regs) |
227 | { | 220 | { |
228 | cpumask_clear(&cpus_in_sr); | ||
229 | } | 221 | } |
230 | #endif /* CONFIG_SMP */ | 222 | #endif /* CONFIG_SMP */ |
231 | 223 | ||
@@ -236,7 +228,7 @@ static void crash_kexec_wait_realmode(int cpu) | |||
236 | unsigned int msecs; | 228 | unsigned int msecs; |
237 | int i; | 229 | int i; |
238 | 230 | ||
239 | msecs = 10000; | 231 | msecs = REAL_MODE_TIMEOUT; |
240 | for (i=0; i < nr_cpu_ids && msecs > 0; i++) { | 232 | for (i=0; i < nr_cpu_ids && msecs > 0; i++) { |
241 | if (i == cpu) | 233 | if (i == cpu) |
242 | continue; | 234 | continue; |
@@ -308,22 +300,11 @@ int crash_shutdown_unregister(crash_shutdown_t handler) | |||
308 | } | 300 | } |
309 | EXPORT_SYMBOL(crash_shutdown_unregister); | 301 | EXPORT_SYMBOL(crash_shutdown_unregister); |
310 | 302 | ||
311 | static unsigned long crash_shutdown_buf[JMP_BUF_LEN]; | ||
312 | static int crash_shutdown_cpu = -1; | ||
313 | |||
314 | static int handle_fault(struct pt_regs *regs) | ||
315 | { | ||
316 | if (crash_shutdown_cpu == smp_processor_id()) | ||
317 | longjmp(crash_shutdown_buf, 1); | ||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | void default_machine_crash_shutdown(struct pt_regs *regs) | 303 | void default_machine_crash_shutdown(struct pt_regs *regs) |
322 | { | 304 | { |
323 | unsigned int i; | 305 | unsigned int i; |
324 | int (*old_handler)(struct pt_regs *regs); | 306 | int (*old_handler)(struct pt_regs *regs); |
325 | 307 | ||
326 | |||
327 | /* | 308 | /* |
328 | * This function is only called after the system | 309 | * This function is only called after the system |
329 | * has panicked or is otherwise in a critical state. | 310 | * has panicked or is otherwise in a critical state. |
@@ -341,15 +322,26 @@ void default_machine_crash_shutdown(struct pt_regs *regs) | |||
341 | * such that another IPI will not be sent. | 322 | * such that another IPI will not be sent. |
342 | */ | 323 | */ |
343 | crashing_cpu = smp_processor_id(); | 324 | crashing_cpu = smp_processor_id(); |
344 | crash_save_cpu(regs, crashing_cpu); | 325 | |
326 | /* | ||
327 | * If we came in via system reset, wait a while for the secondary | ||
328 | * CPUs to enter. | ||
329 | */ | ||
330 | if (TRAP(regs) == 0x100) | ||
331 | mdelay(PRIMARY_TIMEOUT); | ||
332 | |||
345 | crash_kexec_prepare_cpus(crashing_cpu); | 333 | crash_kexec_prepare_cpus(crashing_cpu); |
346 | cpumask_set_cpu(crashing_cpu, &cpus_in_crash); | 334 | |
335 | crash_save_cpu(regs, crashing_cpu); | ||
336 | |||
337 | time_to_dump = 1; | ||
338 | |||
347 | crash_kexec_wait_realmode(crashing_cpu); | 339 | crash_kexec_wait_realmode(crashing_cpu); |
348 | 340 | ||
349 | machine_kexec_mask_interrupts(); | 341 | machine_kexec_mask_interrupts(); |
350 | 342 | ||
351 | /* | 343 | /* |
352 | * Call registered shutdown routines savely. Swap out | 344 | * Call registered shutdown routines safely. Swap out |
353 | * __debugger_fault_handler, and replace on exit. | 345 | * __debugger_fault_handler, and replace on exit. |
354 | */ | 346 | */ |
355 | old_handler = __debugger_fault_handler; | 347 | old_handler = __debugger_fault_handler; |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 424afb6b8fba..b3ba5163eae2 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #define DBG(fmt...) | 28 | #define DBG(fmt...) |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifndef CONFIG_RELOCATABLE | 31 | #ifndef CONFIG_NONSTATIC_KERNEL |
32 | void __init reserve_kdump_trampoline(void) | 32 | void __init reserve_kdump_trampoline(void) |
33 | { | 33 | { |
34 | memblock_reserve(0, KDUMP_RESERVE_LIMIT); | 34 | memblock_reserve(0, KDUMP_RESERVE_LIMIT); |
@@ -67,7 +67,7 @@ void __init setup_kdump_trampoline(void) | |||
67 | 67 | ||
68 | DBG(" <- setup_kdump_trampoline()\n"); | 68 | DBG(" <- setup_kdump_trampoline()\n"); |
69 | } | 69 | } |
70 | #endif /* CONFIG_RELOCATABLE */ | 70 | #endif /* CONFIG_NONSTATIC_KERNEL */ |
71 | 71 | ||
72 | static int __init parse_savemaxmem(char *p) | 72 | static int __init parse_savemaxmem(char *p) |
73 | { | 73 | { |
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 56212bc0ab08..4f80cf1ce77b 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -215,7 +215,22 @@ reenable_mmu: /* re-enable mmu so we can */ | |||
215 | stw r9,8(r1) | 215 | stw r9,8(r1) |
216 | stw r11,12(r1) | 216 | stw r11,12(r1) |
217 | stw r3,ORIG_GPR3(r1) | 217 | stw r3,ORIG_GPR3(r1) |
218 | /* | ||
219 | * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1. | ||
220 | * If from user mode there is only one stack frame on the stack, and | ||
221 | * accessing CALLER_ADDR1 will cause oops. So we need create a dummy | ||
222 | * stack frame to make trace_hardirqs_off happy. | ||
223 | */ | ||
224 | andi. r12,r12,MSR_PR | ||
225 | beq 11f | ||
226 | stwu r1,-16(r1) | ||
227 | bl trace_hardirqs_off | ||
228 | addi r1,r1,16 | ||
229 | b 12f | ||
230 | |||
231 | 11: | ||
218 | bl trace_hardirqs_off | 232 | bl trace_hardirqs_off |
233 | 12: | ||
219 | lwz r0,GPR0(r1) | 234 | lwz r0,GPR0(r1) |
220 | lwz r3,ORIG_GPR3(r1) | 235 | lwz r3,ORIG_GPR3(r1) |
221 | lwz r4,GPR4(r1) | 236 | lwz r4,GPR4(r1) |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index cf9c69b9189c..d4be7bb3dbdf 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -65,7 +65,7 @@ BEGIN_FTR_SECTION | |||
65 | lbz r0,PACAPROCSTART(r13) | 65 | lbz r0,PACAPROCSTART(r13) |
66 | cmpwi r0,0x80 | 66 | cmpwi r0,0x80 |
67 | bne 1f | 67 | bne 1f |
68 | li r0,0 | 68 | li r0,1 |
69 | stb r0,PACAPROCSTART(r13) | 69 | stb r0,PACAPROCSTART(r13) |
70 | b kvm_start_guest | 70 | b kvm_start_guest |
71 | 1: | 71 | 1: |
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index b725dab0f88a..7dd2981bcc50 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S | |||
@@ -64,6 +64,35 @@ _ENTRY(_start); | |||
64 | mr r31,r3 /* save device tree ptr */ | 64 | mr r31,r3 /* save device tree ptr */ |
65 | li r24,0 /* CPU number */ | 65 | li r24,0 /* CPU number */ |
66 | 66 | ||
67 | #ifdef CONFIG_RELOCATABLE | ||
68 | /* | ||
69 | * Relocate ourselves to the current runtime address. | ||
70 | * This is called only by the Boot CPU. | ||
71 | * "relocate" is called with our current runtime virutal | ||
72 | * address. | ||
73 | * r21 will be loaded with the physical runtime address of _stext | ||
74 | */ | ||
75 | bl 0f /* Get our runtime address */ | ||
76 | 0: mflr r21 /* Make it accessible */ | ||
77 | addis r21,r21,(_stext - 0b)@ha | ||
78 | addi r21,r21,(_stext - 0b)@l /* Get our current runtime base */ | ||
79 | |||
80 | /* | ||
81 | * We have the runtime (virutal) address of our base. | ||
82 | * We calculate our shift of offset from a 256M page. | ||
83 | * We could map the 256M page we belong to at PAGE_OFFSET and | ||
84 | * get going from there. | ||
85 | */ | ||
86 | lis r4,KERNELBASE@h | ||
87 | ori r4,r4,KERNELBASE@l | ||
88 | rlwinm r6,r21,0,4,31 /* r6 = PHYS_START % 256M */ | ||
89 | rlwinm r5,r4,0,4,31 /* r5 = KERNELBASE % 256M */ | ||
90 | subf r3,r5,r6 /* r3 = r6 - r5 */ | ||
91 | add r3,r4,r3 /* Required Virutal Address */ | ||
92 | |||
93 | bl relocate | ||
94 | #endif | ||
95 | |||
67 | bl init_cpu_state | 96 | bl init_cpu_state |
68 | 97 | ||
69 | /* | 98 | /* |
@@ -88,6 +117,65 @@ _ENTRY(_start); | |||
88 | 117 | ||
89 | #ifdef CONFIG_RELOCATABLE | 118 | #ifdef CONFIG_RELOCATABLE |
90 | /* | 119 | /* |
120 | * Relocatable kernel support based on processing of dynamic | ||
121 | * relocation entries. | ||
122 | * | ||
123 | * r25 will contain RPN/ERPN for the start address of memory | ||
124 | * r21 will contain the current offset of _stext | ||
125 | */ | ||
126 | lis r3,kernstart_addr@ha | ||
127 | la r3,kernstart_addr@l(r3) | ||
128 | |||
129 | /* | ||
130 | * Compute the kernstart_addr. | ||
131 | * kernstart_addr => (r6,r8) | ||
132 | * kernstart_addr & ~0xfffffff => (r6,r7) | ||
133 | */ | ||
134 | rlwinm r6,r25,0,28,31 /* ERPN. Bits 32-35 of Address */ | ||
135 | rlwinm r7,r25,0,0,3 /* RPN - assuming 256 MB page size */ | ||
136 | rlwinm r8,r21,0,4,31 /* r8 = (_stext & 0xfffffff) */ | ||
137 | or r8,r7,r8 /* Compute the lower 32bit of kernstart_addr */ | ||
138 | |||
139 | /* Store kernstart_addr */ | ||
140 | stw r6,0(r3) /* higher 32bit */ | ||
141 | stw r8,4(r3) /* lower 32bit */ | ||
142 | |||
143 | /* | ||
144 | * Compute the virt_phys_offset : | ||
145 | * virt_phys_offset = stext.run - kernstart_addr | ||
146 | * | ||
147 | * stext.run = (KERNELBASE & ~0xfffffff) + (kernstart_addr & 0xfffffff) | ||
148 | * When we relocate, we have : | ||
149 | * | ||
150 | * (kernstart_addr & 0xfffffff) = (stext.run & 0xfffffff) | ||
151 | * | ||
152 | * hence: | ||
153 | * virt_phys_offset = (KERNELBASE & ~0xfffffff) - (kernstart_addr & ~0xfffffff) | ||
154 | * | ||
155 | */ | ||
156 | |||
157 | /* KERNELBASE&~0xfffffff => (r4,r5) */ | ||
158 | li r4, 0 /* higer 32bit */ | ||
159 | lis r5,KERNELBASE@h | ||
160 | rlwinm r5,r5,0,0,3 /* Align to 256M, lower 32bit */ | ||
161 | |||
162 | /* | ||
163 | * 64bit subtraction. | ||
164 | */ | ||
165 | subfc r5,r7,r5 | ||
166 | subfe r4,r6,r4 | ||
167 | |||
168 | /* Store virt_phys_offset */ | ||
169 | lis r3,virt_phys_offset@ha | ||
170 | la r3,virt_phys_offset@l(r3) | ||
171 | |||
172 | stw r4,0(r3) | ||
173 | stw r5,4(r3) | ||
174 | |||
175 | #elif defined(CONFIG_DYNAMIC_MEMSTART) | ||
176 | /* | ||
177 | * Mapping based, page aligned dynamic kernel loading. | ||
178 | * | ||
91 | * r25 will contain RPN/ERPN for the start address of memory | 179 | * r25 will contain RPN/ERPN for the start address of memory |
92 | * | 180 | * |
93 | * Add the difference between KERNELBASE and PAGE_OFFSET to the | 181 | * Add the difference between KERNELBASE and PAGE_OFFSET to the |
@@ -732,6 +820,8 @@ _GLOBAL(init_cpu_state) | |||
732 | /* We use the PVR to differenciate 44x cores from 476 */ | 820 | /* We use the PVR to differenciate 44x cores from 476 */ |
733 | mfspr r3,SPRN_PVR | 821 | mfspr r3,SPRN_PVR |
734 | srwi r3,r3,16 | 822 | srwi r3,r3,16 |
823 | cmplwi cr0,r3,PVR_476FPE@h | ||
824 | beq head_start_47x | ||
735 | cmplwi cr0,r3,PVR_476@h | 825 | cmplwi cr0,r3,PVR_476@h |
736 | beq head_start_47x | 826 | beq head_start_47x |
737 | cmplwi cr0,r3,PVR_476_ISS@h | 827 | cmplwi cr0,r3,PVR_476_ISS@h |
@@ -800,12 +890,29 @@ skpinv: addi r4,r4,1 /* Increment */ | |||
800 | /* | 890 | /* |
801 | * Configure and load pinned entry into TLB slot 63. | 891 | * Configure and load pinned entry into TLB slot 63. |
802 | */ | 892 | */ |
893 | #ifdef CONFIG_NONSTATIC_KERNEL | ||
894 | /* | ||
895 | * In case of a NONSTATIC_KERNEL we reuse the TLB XLAT | ||
896 | * entries of the initial mapping set by the boot loader. | ||
897 | * The XLAT entry is stored in r25 | ||
898 | */ | ||
899 | |||
900 | /* Read the XLAT entry for our current mapping */ | ||
901 | tlbre r25,r23,PPC44x_TLB_XLAT | ||
902 | |||
903 | lis r3,KERNELBASE@h | ||
904 | ori r3,r3,KERNELBASE@l | ||
905 | |||
906 | /* Use our current RPN entry */ | ||
907 | mr r4,r25 | ||
908 | #else | ||
803 | 909 | ||
804 | lis r3,PAGE_OFFSET@h | 910 | lis r3,PAGE_OFFSET@h |
805 | ori r3,r3,PAGE_OFFSET@l | 911 | ori r3,r3,PAGE_OFFSET@l |
806 | 912 | ||
807 | /* Kernel is at the base of RAM */ | 913 | /* Kernel is at the base of RAM */ |
808 | li r4, 0 /* Load the kernel physical address */ | 914 | li r4, 0 /* Load the kernel physical address */ |
915 | #endif | ||
809 | 916 | ||
810 | /* Load the kernel PID = 0 */ | 917 | /* Load the kernel PID = 0 */ |
811 | li r0,0 | 918 | li r0,0 |
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index 9f5d210ddf3f..d5d78c4ceef6 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S | |||
@@ -197,7 +197,7 @@ _ENTRY(__early_start) | |||
197 | 197 | ||
198 | bl early_init | 198 | bl early_init |
199 | 199 | ||
200 | #ifdef CONFIG_RELOCATABLE | 200 | #ifdef CONFIG_DYNAMIC_MEMSTART |
201 | lis r3,kernstart_addr@ha | 201 | lis r3,kernstart_addr@ha |
202 | la r3,kernstart_addr@l(r3) | 202 | la r3,kernstart_addr@l(r3) |
203 | #ifdef CONFIG_PHYS_64BIT | 203 | #ifdef CONFIG_PHYS_64BIT |
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c index 39a2baa6ad58..7c66ce13da89 100644 --- a/arch/powerpc/kernel/idle.c +++ b/arch/powerpc/kernel/idle.c | |||
@@ -39,13 +39,23 @@ | |||
39 | #define cpu_should_die() 0 | 39 | #define cpu_should_die() 0 |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | unsigned long cpuidle_disable = IDLE_NO_OVERRIDE; | ||
43 | EXPORT_SYMBOL(cpuidle_disable); | ||
44 | |||
42 | static int __init powersave_off(char *arg) | 45 | static int __init powersave_off(char *arg) |
43 | { | 46 | { |
44 | ppc_md.power_save = NULL; | 47 | ppc_md.power_save = NULL; |
48 | cpuidle_disable = IDLE_POWERSAVE_OFF; | ||
45 | return 0; | 49 | return 0; |
46 | } | 50 | } |
47 | __setup("powersave=off", powersave_off); | 51 | __setup("powersave=off", powersave_off); |
48 | 52 | ||
53 | #if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_TRACEPOINTS) | ||
54 | static const bool idle_uses_rcu = 1; | ||
55 | #else | ||
56 | static const bool idle_uses_rcu; | ||
57 | #endif | ||
58 | |||
49 | /* | 59 | /* |
50 | * The body of the idle task. | 60 | * The body of the idle task. |
51 | */ | 61 | */ |
@@ -56,7 +66,10 @@ void cpu_idle(void) | |||
56 | 66 | ||
57 | set_thread_flag(TIF_POLLING_NRFLAG); | 67 | set_thread_flag(TIF_POLLING_NRFLAG); |
58 | while (1) { | 68 | while (1) { |
59 | tick_nohz_stop_sched_tick(1); | 69 | tick_nohz_idle_enter(); |
70 | if (!idle_uses_rcu) | ||
71 | rcu_idle_enter(); | ||
72 | |||
60 | while (!need_resched() && !cpu_should_die()) { | 73 | while (!need_resched() && !cpu_should_die()) { |
61 | ppc64_runlatch_off(); | 74 | ppc64_runlatch_off(); |
62 | 75 | ||
@@ -93,7 +106,9 @@ void cpu_idle(void) | |||
93 | 106 | ||
94 | HMT_medium(); | 107 | HMT_medium(); |
95 | ppc64_runlatch_on(); | 108 | ppc64_runlatch_on(); |
96 | tick_nohz_restart_sched_tick(); | 109 | if (!idle_uses_rcu) |
110 | rcu_idle_exit(); | ||
111 | tick_nohz_idle_exit(); | ||
97 | preempt_enable_no_resched(); | 112 | preempt_enable_no_resched(); |
98 | if (cpu_should_die()) | 113 | if (cpu_should_die()) |
99 | cpu_die(); | 114 | cpu_die(); |
@@ -102,6 +117,29 @@ void cpu_idle(void) | |||
102 | } | 117 | } |
103 | } | 118 | } |
104 | 119 | ||
120 | |||
121 | /* | ||
122 | * cpu_idle_wait - Used to ensure that all the CPUs come out of the old | ||
123 | * idle loop and start using the new idle loop. | ||
124 | * Required while changing idle handler on SMP systems. | ||
125 | * Caller must have changed idle handler to the new value before the call. | ||
126 | * This window may be larger on shared systems. | ||
127 | */ | ||
128 | void cpu_idle_wait(void) | ||
129 | { | ||
130 | int cpu; | ||
131 | smp_mb(); | ||
132 | |||
133 | /* kick all the CPUs so that they exit out of old idle routine */ | ||
134 | get_online_cpus(); | ||
135 | for_each_online_cpu(cpu) { | ||
136 | if (cpu != smp_processor_id()) | ||
137 | smp_send_reschedule(cpu); | ||
138 | } | ||
139 | put_online_cpus(); | ||
140 | } | ||
141 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||
142 | |||
105 | int powersave_nap; | 143 | int powersave_nap; |
106 | 144 | ||
107 | #ifdef CONFIG_SYSCTL | 145 | #ifdef CONFIG_SYSCTL |
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index 3a70845a51c7..fcdff198da4b 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S | |||
@@ -54,6 +54,7 @@ _GLOBAL(power7_idle) | |||
54 | li r0,0 | 54 | li r0,0 |
55 | stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */ | 55 | stb r0,PACASOFTIRQEN(r13) /* we'll hard-enable shortly */ |
56 | stb r0,PACAHARDIRQEN(r13) | 56 | stb r0,PACAHARDIRQEN(r13) |
57 | stb r0,PACA_NAPSTATELOST(r13) | ||
57 | 58 | ||
58 | /* Continue saving state */ | 59 | /* Continue saving state */ |
59 | SAVE_GPR(2, r1) | 60 | SAVE_GPR(2, r1) |
@@ -86,6 +87,9 @@ _GLOBAL(power7_wakeup_loss) | |||
86 | rfid | 87 | rfid |
87 | 88 | ||
88 | _GLOBAL(power7_wakeup_noloss) | 89 | _GLOBAL(power7_wakeup_noloss) |
90 | lbz r0,PACA_NAPSTATELOST(r13) | ||
91 | cmpwi r0,0 | ||
92 | bne .power7_wakeup_loss | ||
89 | ld r1,PACAR1(r13) | 93 | ld r1,PACAR1(r13) |
90 | ld r4,_MSR(r1) | 94 | ld r4,_MSR(r1) |
91 | ld r5,_NIP(r1) | 95 | ld r5,_NIP(r1) |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 5c3c46948d94..701d4aceb4f4 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -115,6 +115,15 @@ static inline notrace void set_soft_enabled(unsigned long enable) | |||
115 | : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled))); | 115 | : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled))); |
116 | } | 116 | } |
117 | 117 | ||
118 | static inline notrace void decrementer_check_overflow(void) | ||
119 | { | ||
120 | u64 now = get_tb_or_rtc(); | ||
121 | u64 *next_tb = &__get_cpu_var(decrementers_next_tb); | ||
122 | |||
123 | if (now >= *next_tb) | ||
124 | set_dec(1); | ||
125 | } | ||
126 | |||
118 | notrace void arch_local_irq_restore(unsigned long en) | 127 | notrace void arch_local_irq_restore(unsigned long en) |
119 | { | 128 | { |
120 | /* | 129 | /* |
@@ -164,24 +173,21 @@ notrace void arch_local_irq_restore(unsigned long en) | |||
164 | */ | 173 | */ |
165 | local_paca->hard_enabled = en; | 174 | local_paca->hard_enabled = en; |
166 | 175 | ||
167 | #ifndef CONFIG_BOOKE | 176 | /* |
168 | /* On server, re-trigger the decrementer if it went negative since | 177 | * Trigger the decrementer if we have a pending event. Some processors |
169 | * some processors only trigger on edge transitions of the sign bit. | 178 | * only trigger on edge transitions of the sign bit. We might also |
170 | * | 179 | * have disabled interrupts long enough that the decrementer wrapped |
171 | * BookE has a level sensitive decrementer (latches in TSR) so we | 180 | * to positive. |
172 | * don't need that | ||
173 | */ | 181 | */ |
174 | if ((int)mfspr(SPRN_DEC) < 0) | 182 | decrementer_check_overflow(); |
175 | mtspr(SPRN_DEC, 1); | ||
176 | #endif /* CONFIG_BOOKE */ | ||
177 | 183 | ||
178 | /* | 184 | /* |
179 | * Force the delivery of pending soft-disabled interrupts on PS3. | 185 | * Force the delivery of pending soft-disabled interrupts on PS3. |
180 | * Any HV call will have this side effect. | 186 | * Any HV call will have this side effect. |
181 | */ | 187 | */ |
182 | if (firmware_has_feature(FW_FEATURE_PS3_LV1)) { | 188 | if (firmware_has_feature(FW_FEATURE_PS3_LV1)) { |
183 | u64 tmp; | 189 | u64 tmp, tmp2; |
184 | lv1_get_version_info(&tmp); | 190 | lv1_get_version_info(&tmp, &tmp2); |
185 | } | 191 | } |
186 | 192 | ||
187 | __hard_irq_enable(); | 193 | __hard_irq_enable(); |
diff --git a/arch/powerpc/kernel/jump_label.c b/arch/powerpc/kernel/jump_label.c index 368d158d665d..a1ed8a8c7cb4 100644 --- a/arch/powerpc/kernel/jump_label.c +++ b/arch/powerpc/kernel/jump_label.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/jump_label.h> | 11 | #include <linux/jump_label.h> |
12 | #include <asm/code-patching.h> | 12 | #include <asm/code-patching.h> |
13 | 13 | ||
14 | #ifdef HAVE_JUMP_LABEL | ||
14 | void arch_jump_label_transform(struct jump_entry *entry, | 15 | void arch_jump_label_transform(struct jump_entry *entry, |
15 | enum jump_label_type type) | 16 | enum jump_label_type type) |
16 | { | 17 | { |
@@ -21,3 +22,4 @@ void arch_jump_label_transform(struct jump_entry *entry, | |||
21 | else | 22 | else |
22 | patch_instruction(addr, PPC_INST_NOP); | 23 | patch_instruction(addr, PPC_INST_NOP); |
23 | } | 24 | } |
25 | #endif | ||
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c index 35f27646c4ff..2985338d0e10 100644 --- a/arch/powerpc/kernel/kvm.c +++ b/arch/powerpc/kernel/kvm.c | |||
@@ -132,7 +132,6 @@ static void kvm_patch_ins_b(u32 *inst, int addr) | |||
132 | /* On relocatable kernels interrupts handlers and our code | 132 | /* On relocatable kernels interrupts handlers and our code |
133 | can be in different regions, so we don't patch them */ | 133 | can be in different regions, so we don't patch them */ |
134 | 134 | ||
135 | extern u32 __end_interrupts; | ||
136 | if ((ulong)inst < (ulong)&__end_interrupts) | 135 | if ((ulong)inst < (ulong)&__end_interrupts) |
137 | return; | 136 | return; |
138 | #endif | 137 | #endif |
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 84daabe2fcba..578f35f18723 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
@@ -783,7 +783,7 @@ static const struct file_operations lparcfg_fops = { | |||
783 | static int __init lparcfg_init(void) | 783 | static int __init lparcfg_init(void) |
784 | { | 784 | { |
785 | struct proc_dir_entry *ent; | 785 | struct proc_dir_entry *ent; |
786 | mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; | 786 | umode_t mode = S_IRUSR | S_IRGRP | S_IROTH; |
787 | 787 | ||
788 | /* Allow writing if we have FW_FEATURE_SPLPAR */ | 788 | /* Allow writing if we have FW_FEATURE_SPLPAR */ |
789 | if (firmware_has_feature(FW_FEATURE_SPLPAR) && | 789 | if (firmware_has_feature(FW_FEATURE_SPLPAR) && |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index 9ce1672afb59..c957b1202bdc 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -107,9 +107,6 @@ void __init reserve_crashkernel(void) | |||
107 | unsigned long long crash_size, crash_base; | 107 | unsigned long long crash_size, crash_base; |
108 | int ret; | 108 | int ret; |
109 | 109 | ||
110 | /* this is necessary because of memblock_phys_mem_size() */ | ||
111 | memblock_analyze(); | ||
112 | |||
113 | /* use common parsing */ | 110 | /* use common parsing */ |
114 | ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), | 111 | ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), |
115 | &crash_size, &crash_base); | 112 | &crash_size, &crash_base); |
@@ -128,7 +125,7 @@ void __init reserve_crashkernel(void) | |||
128 | 125 | ||
129 | crash_size = resource_size(&crashk_res); | 126 | crash_size = resource_size(&crashk_res); |
130 | 127 | ||
131 | #ifndef CONFIG_RELOCATABLE | 128 | #ifndef CONFIG_NONSTATIC_KERNEL |
132 | if (crashk_res.start != KDUMP_KERNELBASE) | 129 | if (crashk_res.start != KDUMP_KERNELBASE) |
133 | printk("Crash kernel location must be 0x%x\n", | 130 | printk("Crash kernel location must be 0x%x\n", |
134 | KDUMP_KERNELBASE); | 131 | KDUMP_KERNELBASE); |
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S index f7d760ab5ca1..7cd07b42ca1a 100644 --- a/arch/powerpc/kernel/misc_32.S +++ b/arch/powerpc/kernel/misc_32.S | |||
@@ -738,7 +738,7 @@ relocate_new_kernel: | |||
738 | mr r5, r31 | 738 | mr r5, r31 |
739 | 739 | ||
740 | li r0, 0 | 740 | li r0, 0 |
741 | #elif defined(CONFIG_44x) && !defined(CONFIG_47x) | 741 | #elif defined(CONFIG_44x) && !defined(CONFIG_PPC_47x) |
742 | 742 | ||
743 | /* | 743 | /* |
744 | * Code for setting up 1:1 mapping for PPC440x for KEXEC | 744 | * Code for setting up 1:1 mapping for PPC440x for KEXEC |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 458ed3bee663..fa4a573d6716 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -214,7 +214,7 @@ char __devinit *pcibios_setup(char *str) | |||
214 | * If the interrupt is used, then gets the interrupt line from the | 214 | * If the interrupt is used, then gets the interrupt line from the |
215 | * openfirmware and sets it in the pci_dev and pci_config line. | 215 | * openfirmware and sets it in the pci_dev and pci_config line. |
216 | */ | 216 | */ |
217 | int pci_read_irq_line(struct pci_dev *pci_dev) | 217 | static int pci_read_irq_line(struct pci_dev *pci_dev) |
218 | { | 218 | { |
219 | struct of_irq oirq; | 219 | struct of_irq oirq; |
220 | unsigned int virq; | 220 | unsigned int virq; |
@@ -283,7 +283,6 @@ int pci_read_irq_line(struct pci_dev *pci_dev) | |||
283 | 283 | ||
284 | return 0; | 284 | return 0; |
285 | } | 285 | } |
286 | EXPORT_SYMBOL(pci_read_irq_line); | ||
287 | 286 | ||
288 | /* | 287 | /* |
289 | * Platform support for /proc/bus/pci/X/Y mmap()s, | 288 | * Platform support for /proc/bus/pci/X/Y mmap()s, |
@@ -921,18 +920,22 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev) | |||
921 | struct resource *res = dev->resource + i; | 920 | struct resource *res = dev->resource + i; |
922 | if (!res->flags) | 921 | if (!res->flags) |
923 | continue; | 922 | continue; |
924 | /* On platforms that have PCI_PROBE_ONLY set, we don't | 923 | |
925 | * consider 0 as an unassigned BAR value. It's technically | 924 | /* If we're going to re-assign everything, we mark all resources |
926 | * a valid value, but linux doesn't like it... so when we can | 925 | * as unset (and 0-base them). In addition, we mark BARs starting |
927 | * re-assign things, we do so, but if we can't, we keep it | 926 | * at 0 as unset as well, except if PCI_PROBE_ONLY is also set |
928 | * around and hope for the best... | 927 | * since in that case, we don't want to re-assign anything |
929 | */ | 928 | */ |
930 | if (res->start == 0 && !pci_has_flag(PCI_PROBE_ONLY)) { | 929 | if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) || |
931 | pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] is unassigned\n", | 930 | (res->start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { |
932 | pci_name(dev), i, | 931 | /* Only print message if not re-assigning */ |
933 | (unsigned long long)res->start, | 932 | if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) |
934 | (unsigned long long)res->end, | 933 | pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] " |
935 | (unsigned int)res->flags); | 934 | "is unassigned\n", |
935 | pci_name(dev), i, | ||
936 | (unsigned long long)res->start, | ||
937 | (unsigned long long)res->end, | ||
938 | (unsigned int)res->flags); | ||
936 | res->end -= res->start; | 939 | res->end -= res->start; |
937 | res->start = 0; | 940 | res->start = 0; |
938 | res->flags |= IORESOURCE_UNSET; | 941 | res->flags |= IORESOURCE_UNSET; |
@@ -1042,6 +1045,16 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus) | |||
1042 | if (i >= 3 && bus->self->transparent) | 1045 | if (i >= 3 && bus->self->transparent) |
1043 | continue; | 1046 | continue; |
1044 | 1047 | ||
1048 | /* If we are going to re-assign everything, mark the resource | ||
1049 | * as unset and move it down to 0 | ||
1050 | */ | ||
1051 | if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) { | ||
1052 | res->flags |= IORESOURCE_UNSET; | ||
1053 | res->end -= res->start; | ||
1054 | res->start = 0; | ||
1055 | continue; | ||
1056 | } | ||
1057 | |||
1045 | pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n", | 1058 | pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n", |
1046 | pci_name(dev), i, | 1059 | pci_name(dev), i, |
1047 | (unsigned long long)res->start,\ | 1060 | (unsigned long long)res->start,\ |
@@ -1262,18 +1275,15 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
1262 | pci_bus_for_each_resource(bus, res, i) { | 1275 | pci_bus_for_each_resource(bus, res, i) { |
1263 | if (!res || !res->flags || res->start > res->end || res->parent) | 1276 | if (!res || !res->flags || res->start > res->end || res->parent) |
1264 | continue; | 1277 | continue; |
1278 | |||
1279 | /* If the resource was left unset at this point, we clear it */ | ||
1280 | if (res->flags & IORESOURCE_UNSET) | ||
1281 | goto clear_resource; | ||
1282 | |||
1265 | if (bus->parent == NULL) | 1283 | if (bus->parent == NULL) |
1266 | pr = (res->flags & IORESOURCE_IO) ? | 1284 | pr = (res->flags & IORESOURCE_IO) ? |
1267 | &ioport_resource : &iomem_resource; | 1285 | &ioport_resource : &iomem_resource; |
1268 | else { | 1286 | else { |
1269 | /* Don't bother with non-root busses when | ||
1270 | * re-assigning all resources. We clear the | ||
1271 | * resource flags as if they were colliding | ||
1272 | * and as such ensure proper re-allocation | ||
1273 | * later. | ||
1274 | */ | ||
1275 | if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) | ||
1276 | goto clear_resource; | ||
1277 | pr = pci_find_parent_resource(bus->self, res); | 1287 | pr = pci_find_parent_resource(bus->self, res); |
1278 | if (pr == res) { | 1288 | if (pr == res) { |
1279 | /* this happens when the generic PCI | 1289 | /* this happens when the generic PCI |
@@ -1304,9 +1314,9 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
1304 | if (reparent_resources(pr, res) == 0) | 1314 | if (reparent_resources(pr, res) == 0) |
1305 | continue; | 1315 | continue; |
1306 | } | 1316 | } |
1307 | printk(KERN_WARNING "PCI: Cannot allocate resource region " | 1317 | pr_warning("PCI: Cannot allocate resource region " |
1308 | "%d of PCI bridge %d, will remap\n", i, bus->number); | 1318 | "%d of PCI bridge %d, will remap\n", i, bus->number); |
1309 | clear_resource: | 1319 | clear_resource: |
1310 | res->start = res->end = 0; | 1320 | res->start = res->end = 0; |
1311 | res->flags = 0; | 1321 | res->flags = 0; |
1312 | } | 1322 | } |
@@ -1451,16 +1461,11 @@ void __init pcibios_resource_survey(void) | |||
1451 | { | 1461 | { |
1452 | struct pci_bus *b; | 1462 | struct pci_bus *b; |
1453 | 1463 | ||
1454 | /* Allocate and assign resources. If we re-assign everything, then | 1464 | /* Allocate and assign resources */ |
1455 | * we skip the allocate phase | ||
1456 | */ | ||
1457 | list_for_each_entry(b, &pci_root_buses, node) | 1465 | list_for_each_entry(b, &pci_root_buses, node) |
1458 | pcibios_allocate_bus_resources(b); | 1466 | pcibios_allocate_bus_resources(b); |
1459 | 1467 | pcibios_allocate_resources(0); | |
1460 | if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) { | 1468 | pcibios_allocate_resources(1); |
1461 | pcibios_allocate_resources(0); | ||
1462 | pcibios_allocate_resources(1); | ||
1463 | } | ||
1464 | 1469 | ||
1465 | /* Before we start assigning unassigned resource, we try to reserve | 1470 | /* Before we start assigning unassigned resource, we try to reserve |
1466 | * the low IO area and the VGA memory area if they intersect the | 1471 | * the low IO area and the VGA memory area if they intersect the |
@@ -1732,6 +1737,12 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1732 | if (mode == PCI_PROBE_NORMAL) | 1737 | if (mode == PCI_PROBE_NORMAL) |
1733 | hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); | 1738 | hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); |
1734 | 1739 | ||
1740 | /* Platform gets a chance to do some global fixups before | ||
1741 | * we proceed to resource allocation | ||
1742 | */ | ||
1743 | if (ppc_md.pcibios_fixup_phb) | ||
1744 | ppc_md.pcibios_fixup_phb(hose); | ||
1745 | |||
1735 | /* Configure PCI Express settings */ | 1746 | /* Configure PCI Express settings */ |
1736 | if (bus && !pci_has_flag(PCI_PROBE_ONLY)) { | 1747 | if (bus && !pci_has_flag(PCI_PROBE_ONLY)) { |
1737 | struct pci_bus *child; | 1748 | struct pci_bus *child; |
@@ -1747,10 +1758,13 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1747 | static void fixup_hide_host_resource_fsl(struct pci_dev *dev) | 1758 | static void fixup_hide_host_resource_fsl(struct pci_dev *dev) |
1748 | { | 1759 | { |
1749 | int i, class = dev->class >> 8; | 1760 | int i, class = dev->class >> 8; |
1761 | /* When configured as agent, programing interface = 1 */ | ||
1762 | int prog_if = dev->class & 0xf; | ||
1750 | 1763 | ||
1751 | if ((class == PCI_CLASS_PROCESSOR_POWERPC || | 1764 | if ((class == PCI_CLASS_PROCESSOR_POWERPC || |
1752 | class == PCI_CLASS_BRIDGE_OTHER) && | 1765 | class == PCI_CLASS_BRIDGE_OTHER) && |
1753 | (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) && | 1766 | (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) && |
1767 | (prog_if == 0) && | ||
1754 | (dev->bus->parent == NULL)) { | 1768 | (dev->bus->parent == NULL)) { |
1755 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | 1769 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
1756 | dev->resource[i].start = 0; | 1770 | dev->resource[i].start = 0; |
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index 4e69deb89b37..dd9e4a04bf79 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c | |||
@@ -50,6 +50,9 @@ void * __devinit update_dn_pci_info(struct device_node *dn, void *data) | |||
50 | dn->data = pdn; | 50 | dn->data = pdn; |
51 | pdn->node = dn; | 51 | pdn->node = dn; |
52 | pdn->phb = phb; | 52 | pdn->phb = phb; |
53 | #ifdef CONFIG_PPC_POWERNV | ||
54 | pdn->pe_number = IODA_INVALID_PE; | ||
55 | #endif | ||
53 | regs = of_get_property(dn, "reg", NULL); | 56 | regs = of_get_property(dn, "reg", NULL); |
54 | if (regs) { | 57 | if (regs) { |
55 | /* First register entry is addr (00BBSS00) */ | 58 | /* First register entry is addr (00BBSS00) */ |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 9054ca9ab4f9..ebe5766781aa 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -486,28 +486,6 @@ struct task_struct *__switch_to(struct task_struct *prev, | |||
486 | new_thread = &new->thread; | 486 | new_thread = &new->thread; |
487 | old_thread = ¤t->thread; | 487 | old_thread = ¤t->thread; |
488 | 488 | ||
489 | #if defined(CONFIG_PPC_BOOK3E_64) | ||
490 | /* XXX Current Book3E code doesn't deal with kernel side DBCR0, | ||
491 | * we always hold the user values, so we set it now. | ||
492 | * | ||
493 | * However, we ensure the kernel MSR:DE is appropriately cleared too | ||
494 | * to avoid spurrious single step exceptions in the kernel. | ||
495 | * | ||
496 | * This will have to change to merge with the ppc32 code at some point, | ||
497 | * but I don't like much what ppc32 is doing today so there's some | ||
498 | * thinking needed there | ||
499 | */ | ||
500 | if ((new_thread->dbcr0 | old_thread->dbcr0) & DBCR0_IDM) { | ||
501 | u32 dbcr0; | ||
502 | |||
503 | mtmsr(mfmsr() & ~MSR_DE); | ||
504 | isync(); | ||
505 | dbcr0 = mfspr(SPRN_DBCR0); | ||
506 | dbcr0 = (dbcr0 & DBCR0_EDM) | new_thread->dbcr0; | ||
507 | mtspr(SPRN_DBCR0, dbcr0); | ||
508 | } | ||
509 | #endif /* CONFIG_PPC64_BOOK3E */ | ||
510 | |||
511 | #ifdef CONFIG_PPC64 | 489 | #ifdef CONFIG_PPC64 |
512 | /* | 490 | /* |
513 | * Collect processor utilization data per process | 491 | * Collect processor utilization data per process |
@@ -606,16 +584,32 @@ static struct regbit { | |||
606 | unsigned long bit; | 584 | unsigned long bit; |
607 | const char *name; | 585 | const char *name; |
608 | } msr_bits[] = { | 586 | } msr_bits[] = { |
587 | #if defined(CONFIG_PPC64) && !defined(CONFIG_BOOKE) | ||
588 | {MSR_SF, "SF"}, | ||
589 | {MSR_HV, "HV"}, | ||
590 | #endif | ||
591 | {MSR_VEC, "VEC"}, | ||
592 | {MSR_VSX, "VSX"}, | ||
593 | #ifdef CONFIG_BOOKE | ||
594 | {MSR_CE, "CE"}, | ||
595 | #endif | ||
609 | {MSR_EE, "EE"}, | 596 | {MSR_EE, "EE"}, |
610 | {MSR_PR, "PR"}, | 597 | {MSR_PR, "PR"}, |
611 | {MSR_FP, "FP"}, | 598 | {MSR_FP, "FP"}, |
612 | {MSR_VEC, "VEC"}, | ||
613 | {MSR_VSX, "VSX"}, | ||
614 | {MSR_ME, "ME"}, | 599 | {MSR_ME, "ME"}, |
615 | {MSR_CE, "CE"}, | 600 | #ifdef CONFIG_BOOKE |
616 | {MSR_DE, "DE"}, | 601 | {MSR_DE, "DE"}, |
602 | #else | ||
603 | {MSR_SE, "SE"}, | ||
604 | {MSR_BE, "BE"}, | ||
605 | #endif | ||
617 | {MSR_IR, "IR"}, | 606 | {MSR_IR, "IR"}, |
618 | {MSR_DR, "DR"}, | 607 | {MSR_DR, "DR"}, |
608 | {MSR_PMM, "PMM"}, | ||
609 | #ifndef CONFIG_BOOKE | ||
610 | {MSR_RI, "RI"}, | ||
611 | {MSR_LE, "LE"}, | ||
612 | #endif | ||
619 | {0, NULL} | 613 | {0, NULL} |
620 | }; | 614 | }; |
621 | 615 | ||
@@ -657,7 +651,7 @@ void show_regs(struct pt_regs * regs) | |||
657 | if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR)) | 651 | if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR)) |
658 | printk("CFAR: "REG"\n", regs->orig_gpr3); | 652 | printk("CFAR: "REG"\n", regs->orig_gpr3); |
659 | if (trap == 0x300 || trap == 0x600) | 653 | if (trap == 0x300 || trap == 0x600) |
660 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS | 654 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) |
661 | printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr); | 655 | printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr); |
662 | #else | 656 | #else |
663 | printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); | 657 | printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index fa1235b0503b..abe405dab34d 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -733,8 +733,6 @@ void __init early_init_devtree(void *params) | |||
733 | of_scan_flat_dt(early_init_dt_scan_chosen_ppc, cmd_line); | 733 | of_scan_flat_dt(early_init_dt_scan_chosen_ppc, cmd_line); |
734 | 734 | ||
735 | /* Scan memory nodes and rebuild MEMBLOCKs */ | 735 | /* Scan memory nodes and rebuild MEMBLOCKs */ |
736 | memblock_init(); | ||
737 | |||
738 | of_scan_flat_dt(early_init_dt_scan_root, NULL); | 736 | of_scan_flat_dt(early_init_dt_scan_root, NULL); |
739 | of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); | 737 | of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); |
740 | 738 | ||
@@ -756,20 +754,14 @@ void __init early_init_devtree(void *params) | |||
756 | early_reserve_mem(); | 754 | early_reserve_mem(); |
757 | phyp_dump_reserve_mem(); | 755 | phyp_dump_reserve_mem(); |
758 | 756 | ||
759 | limit = memory_limit; | 757 | /* |
760 | if (! limit) { | 758 | * Ensure that total memory size is page-aligned, because otherwise |
761 | phys_addr_t memsize; | 759 | * mark_bootmem() gets upset. |
762 | 760 | */ | |
763 | /* Ensure that total memory size is page-aligned, because | 761 | limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE); |
764 | * otherwise mark_bootmem() gets upset. */ | ||
765 | memblock_analyze(); | ||
766 | memsize = memblock_phys_mem_size(); | ||
767 | if ((memsize & PAGE_MASK) != memsize) | ||
768 | limit = memsize & PAGE_MASK; | ||
769 | } | ||
770 | memblock_enforce_memory_limit(limit); | 762 | memblock_enforce_memory_limit(limit); |
771 | 763 | ||
772 | memblock_analyze(); | 764 | memblock_allow_resize(); |
773 | memblock_dump_all(); | 765 | memblock_dump_all(); |
774 | 766 | ||
775 | DBG("Phys. mem: %llx\n", memblock_phys_mem_size()); | 767 | DBG("Phys. mem: %llx\n", memblock_phys_mem_size()); |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index b4fa66127495..eca626ea3f23 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -742,7 +742,7 @@ static unsigned char ibm_architecture_vec[] = { | |||
742 | W(0xffffffff), /* virt_base */ | 742 | W(0xffffffff), /* virt_base */ |
743 | W(0xffffffff), /* virt_size */ | 743 | W(0xffffffff), /* virt_size */ |
744 | W(0xffffffff), /* load_base */ | 744 | W(0xffffffff), /* load_base */ |
745 | W(64), /* 64MB min RMA */ | 745 | W(256), /* 256MB min RMA */ |
746 | W(0xffffffff), /* full client load */ | 746 | W(0xffffffff), /* full client load */ |
747 | 0, /* min RMA percentage of total RAM */ | 747 | 0, /* min RMA percentage of total RAM */ |
748 | 48, /* max log_2(hash table size) */ | 748 | 48, /* max log_2(hash table size) */ |
@@ -1224,14 +1224,6 @@ static void __init prom_init_mem(void) | |||
1224 | 1224 | ||
1225 | RELOC(alloc_bottom) = PAGE_ALIGN((unsigned long)&RELOC(_end) + 0x4000); | 1225 | RELOC(alloc_bottom) = PAGE_ALIGN((unsigned long)&RELOC(_end) + 0x4000); |
1226 | 1226 | ||
1227 | /* Check if we have an initrd after the kernel, if we do move our bottom | ||
1228 | * point to after it | ||
1229 | */ | ||
1230 | if (RELOC(prom_initrd_start)) { | ||
1231 | if (RELOC(prom_initrd_end) > RELOC(alloc_bottom)) | ||
1232 | RELOC(alloc_bottom) = PAGE_ALIGN(RELOC(prom_initrd_end)); | ||
1233 | } | ||
1234 | |||
1235 | /* | 1227 | /* |
1236 | * If prom_memory_limit is set we reduce the upper limits *except* for | 1228 | * If prom_memory_limit is set we reduce the upper limits *except* for |
1237 | * alloc_top_high. This must be the real top of RAM so we can put | 1229 | * alloc_top_high. This must be the real top of RAM so we can put |
@@ -1269,6 +1261,15 @@ static void __init prom_init_mem(void) | |||
1269 | RELOC(alloc_top) = RELOC(rmo_top); | 1261 | RELOC(alloc_top) = RELOC(rmo_top); |
1270 | RELOC(alloc_top_high) = RELOC(ram_top); | 1262 | RELOC(alloc_top_high) = RELOC(ram_top); |
1271 | 1263 | ||
1264 | /* | ||
1265 | * Check if we have an initrd after the kernel but still inside | ||
1266 | * the RMO. If we do move our bottom point to after it. | ||
1267 | */ | ||
1268 | if (RELOC(prom_initrd_start) && | ||
1269 | RELOC(prom_initrd_start) < RELOC(rmo_top) && | ||
1270 | RELOC(prom_initrd_end) > RELOC(alloc_bottom)) | ||
1271 | RELOC(alloc_bottom) = PAGE_ALIGN(RELOC(prom_initrd_end)); | ||
1272 | |||
1272 | prom_printf("memory layout at init:\n"); | 1273 | prom_printf("memory layout at init:\n"); |
1273 | prom_printf(" memory_limit : %x (16 MB aligned)\n", RELOC(prom_memory_limit)); | 1274 | prom_printf(" memory_limit : %x (16 MB aligned)\n", RELOC(prom_memory_limit)); |
1274 | prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); | 1275 | prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); |
@@ -1579,10 +1580,8 @@ static void __init prom_instantiate_rtas(void) | |||
1579 | return; | 1580 | return; |
1580 | 1581 | ||
1581 | base = alloc_down(size, PAGE_SIZE, 0); | 1582 | base = alloc_down(size, PAGE_SIZE, 0); |
1582 | if (base == 0) { | 1583 | if (base == 0) |
1583 | prom_printf("RTAS allocation failed !\n"); | 1584 | prom_panic("Could not allocate memory for RTAS\n"); |
1584 | return; | ||
1585 | } | ||
1586 | 1585 | ||
1587 | rtas_inst = call_prom("open", 1, 1, ADDR("/rtas")); | 1586 | rtas_inst = call_prom("open", 1, 1, ADDR("/rtas")); |
1588 | if (!IHANDLE_VALID(rtas_inst)) { | 1587 | if (!IHANDLE_VALID(rtas_inst)) { |
@@ -2081,7 +2080,7 @@ static void __init prom_check_displays(void) | |||
2081 | /* Setup a usable color table when the appropriate | 2080 | /* Setup a usable color table when the appropriate |
2082 | * method is available. Should update this to set-colors */ | 2081 | * method is available. Should update this to set-colors */ |
2083 | clut = RELOC(default_colors); | 2082 | clut = RELOC(default_colors); |
2084 | for (i = 0; i < 32; i++, clut += 3) | 2083 | for (i = 0; i < 16; i++, clut += 3) |
2085 | if (prom_set_color(ih, i, clut[0], clut[1], | 2084 | if (prom_set_color(ih, i, clut[0], clut[1], |
2086 | clut[2]) != 0) | 2085 | clut[2]) != 0) |
2087 | break; | 2086 | break; |
@@ -2846,7 +2845,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2846 | RELOC(of_platform) = prom_find_machine_type(); | 2845 | RELOC(of_platform) = prom_find_machine_type(); |
2847 | prom_printf("Detected machine type: %x\n", RELOC(of_platform)); | 2846 | prom_printf("Detected machine type: %x\n", RELOC(of_platform)); |
2848 | 2847 | ||
2849 | #ifndef CONFIG_RELOCATABLE | 2848 | #ifndef CONFIG_NONSTATIC_KERNEL |
2850 | /* Bail if this is a kdump kernel. */ | 2849 | /* Bail if this is a kdump kernel. */ |
2851 | if (PHYSICAL_START > 0) | 2850 | if (PHYSICAL_START > 0) |
2852 | prom_panic("Error: You can't boot a kdump kernel from OF!\n"); | 2851 | prom_panic("Error: You can't boot a kdump kernel from OF!\n"); |
@@ -2971,9 +2970,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2971 | /* | 2970 | /* |
2972 | * in case stdin is USB and still active on IBM machines... | 2971 | * in case stdin is USB and still active on IBM machines... |
2973 | * Unfortunately quiesce crashes on some powermacs if we have | 2972 | * Unfortunately quiesce crashes on some powermacs if we have |
2974 | * closed stdin already (in particular the powerbook 101). | 2973 | * closed stdin already (in particular the powerbook 101). It |
2974 | * appears that the OPAL version of OFW doesn't like it either. | ||
2975 | */ | 2975 | */ |
2976 | if (RELOC(of_platform) != PLATFORM_POWERMAC) | 2976 | if (RELOC(of_platform) != PLATFORM_POWERMAC && |
2977 | RELOC(of_platform) != PLATFORM_OPAL) | ||
2977 | prom_close_stdin(); | 2978 | prom_close_stdin(); |
2978 | 2979 | ||
2979 | /* | 2980 | /* |
@@ -2989,8 +2990,12 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2989 | * is common to us and kexec | 2990 | * is common to us and kexec |
2990 | */ | 2991 | */ |
2991 | hdr = RELOC(dt_header_start); | 2992 | hdr = RELOC(dt_header_start); |
2992 | prom_printf("returning from prom_init\n"); | 2993 | |
2993 | prom_debug("->dt_header_start=0x%x\n", hdr); | 2994 | /* Don't print anything after quiesce under OPAL, it crashes OFW */ |
2995 | if (RELOC(of_platform) != PLATFORM_OPAL) { | ||
2996 | prom_printf("returning from prom_init\n"); | ||
2997 | prom_debug("->dt_header_start=0x%x\n", hdr); | ||
2998 | } | ||
2994 | 2999 | ||
2995 | #ifdef CONFIG_PPC32 | 3000 | #ifdef CONFIG_PPC32 |
2996 | reloc_got2(-offset); | 3001 | reloc_got2(-offset); |
diff --git a/arch/powerpc/kernel/reloc_32.S b/arch/powerpc/kernel/reloc_32.S new file mode 100644 index 000000000000..ef46ba6e094f --- /dev/null +++ b/arch/powerpc/kernel/reloc_32.S | |||
@@ -0,0 +1,208 @@ | |||
1 | /* | ||
2 | * Code to process dynamic relocations for PPC32. | ||
3 | * | ||
4 | * Copyrights (C) IBM Corporation, 2011. | ||
5 | * Author: Suzuki Poulose <suzuki@in.ibm.com> | ||
6 | * | ||
7 | * - Based on ppc64 code - reloc_64.S | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <asm/ppc_asm.h> | ||
16 | |||
17 | /* Dynamic section table entry tags */ | ||
18 | DT_RELA = 7 /* Tag for Elf32_Rela section */ | ||
19 | DT_RELASZ = 8 /* Size of the Rela relocs */ | ||
20 | DT_RELAENT = 9 /* Size of one Rela reloc entry */ | ||
21 | |||
22 | STN_UNDEF = 0 /* Undefined symbol index */ | ||
23 | STB_LOCAL = 0 /* Local binding for the symbol */ | ||
24 | |||
25 | R_PPC_ADDR16_LO = 4 /* Lower half of (S+A) */ | ||
26 | R_PPC_ADDR16_HI = 5 /* Upper half of (S+A) */ | ||
27 | R_PPC_ADDR16_HA = 6 /* High Adjusted (S+A) */ | ||
28 | R_PPC_RELATIVE = 22 | ||
29 | |||
30 | /* | ||
31 | * r3 = desired final address | ||
32 | */ | ||
33 | |||
34 | _GLOBAL(relocate) | ||
35 | |||
36 | mflr r0 /* Save our LR */ | ||
37 | bl 0f /* Find our current runtime address */ | ||
38 | 0: mflr r12 /* Make it accessible */ | ||
39 | mtlr r0 | ||
40 | |||
41 | lwz r11, (p_dyn - 0b)(r12) | ||
42 | add r11, r11, r12 /* runtime address of .dynamic section */ | ||
43 | lwz r9, (p_rela - 0b)(r12) | ||
44 | add r9, r9, r12 /* runtime address of .rela.dyn section */ | ||
45 | lwz r10, (p_st - 0b)(r12) | ||
46 | add r10, r10, r12 /* runtime address of _stext section */ | ||
47 | lwz r13, (p_sym - 0b)(r12) | ||
48 | add r13, r13, r12 /* runtime address of .dynsym section */ | ||
49 | |||
50 | /* | ||
51 | * Scan the dynamic section for RELA, RELASZ entries | ||
52 | */ | ||
53 | li r6, 0 | ||
54 | li r7, 0 | ||
55 | li r8, 0 | ||
56 | 1: lwz r5, 0(r11) /* ELF_Dyn.d_tag */ | ||
57 | cmpwi r5, 0 /* End of ELF_Dyn[] */ | ||
58 | beq eodyn | ||
59 | cmpwi r5, DT_RELA | ||
60 | bne relasz | ||
61 | lwz r7, 4(r11) /* r7 = rela.link */ | ||
62 | b skip | ||
63 | relasz: | ||
64 | cmpwi r5, DT_RELASZ | ||
65 | bne relaent | ||
66 | lwz r8, 4(r11) /* r8 = Total Rela relocs size */ | ||
67 | b skip | ||
68 | relaent: | ||
69 | cmpwi r5, DT_RELAENT | ||
70 | bne skip | ||
71 | lwz r6, 4(r11) /* r6 = Size of one Rela reloc */ | ||
72 | skip: | ||
73 | addi r11, r11, 8 | ||
74 | b 1b | ||
75 | eodyn: /* End of Dyn Table scan */ | ||
76 | |||
77 | /* Check if we have found all the entries */ | ||
78 | cmpwi r7, 0 | ||
79 | beq done | ||
80 | cmpwi r8, 0 | ||
81 | beq done | ||
82 | cmpwi r6, 0 | ||
83 | beq done | ||
84 | |||
85 | |||
86 | /* | ||
87 | * Work out the current offset from the link time address of .rela | ||
88 | * section. | ||
89 | * cur_offset[r7] = rela.run[r9] - rela.link [r7] | ||
90 | * _stext.link[r12] = _stext.run[r10] - cur_offset[r7] | ||
91 | * final_offset[r3] = _stext.final[r3] - _stext.link[r12] | ||
92 | */ | ||
93 | subf r7, r7, r9 /* cur_offset */ | ||
94 | subf r12, r7, r10 | ||
95 | subf r3, r12, r3 /* final_offset */ | ||
96 | |||
97 | subf r8, r6, r8 /* relaz -= relaent */ | ||
98 | /* | ||
99 | * Scan through the .rela table and process each entry | ||
100 | * r9 - points to the current .rela table entry | ||
101 | * r13 - points to the symbol table | ||
102 | */ | ||
103 | |||
104 | /* | ||
105 | * Check if we have a relocation based on symbol | ||
106 | * r5 will hold the value of the symbol. | ||
107 | */ | ||
108 | applyrela: | ||
109 | lwz r4, 4(r9) /* r4 = rela.r_info */ | ||
110 | srwi r5, r4, 8 /* ELF32_R_SYM(r_info) */ | ||
111 | cmpwi r5, STN_UNDEF /* sym == STN_UNDEF ? */ | ||
112 | beq get_type /* value = 0 */ | ||
113 | /* Find the value of the symbol at index(r5) */ | ||
114 | slwi r5, r5, 4 /* r5 = r5 * sizeof(Elf32_Sym) */ | ||
115 | add r12, r13, r5 /* r12 = &__dyn_sym[Index] */ | ||
116 | |||
117 | /* | ||
118 | * GNU ld has a bug, where dynamic relocs based on | ||
119 | * STB_LOCAL symbols, the value should be assumed | ||
120 | * to be zero. - Alan Modra | ||
121 | */ | ||
122 | /* XXX: Do we need to check if we are using GNU ld ? */ | ||
123 | lbz r5, 12(r12) /* r5 = dyn_sym[Index].st_info */ | ||
124 | extrwi r5, r5, 4, 24 /* r5 = ELF32_ST_BIND(r5) */ | ||
125 | cmpwi r5, STB_LOCAL /* st_value = 0, ld bug */ | ||
126 | beq get_type /* We have r5 = 0 */ | ||
127 | lwz r5, 4(r12) /* r5 = __dyn_sym[Index].st_value */ | ||
128 | |||
129 | get_type: | ||
130 | /* Load the relocation type to r4 */ | ||
131 | extrwi r4, r4, 8, 24 /* r4 = ELF32_R_TYPE(r_info) = ((char*)r4)[3] */ | ||
132 | |||
133 | /* R_PPC_RELATIVE */ | ||
134 | cmpwi r4, R_PPC_RELATIVE | ||
135 | bne hi16 | ||
136 | lwz r4, 0(r9) /* r_offset */ | ||
137 | lwz r0, 8(r9) /* r_addend */ | ||
138 | add r0, r0, r3 /* final addend */ | ||
139 | stwx r0, r4, r7 /* memory[r4+r7]) = (u32)r0 */ | ||
140 | b nxtrela /* continue */ | ||
141 | |||
142 | /* R_PPC_ADDR16_HI */ | ||
143 | hi16: | ||
144 | cmpwi r4, R_PPC_ADDR16_HI | ||
145 | bne ha16 | ||
146 | lwz r4, 0(r9) /* r_offset */ | ||
147 | lwz r0, 8(r9) /* r_addend */ | ||
148 | add r0, r0, r3 | ||
149 | add r0, r0, r5 /* r0 = (S+A+Offset) */ | ||
150 | extrwi r0, r0, 16, 0 /* r0 = (r0 >> 16) */ | ||
151 | b store_half | ||
152 | |||
153 | /* R_PPC_ADDR16_HA */ | ||
154 | ha16: | ||
155 | cmpwi r4, R_PPC_ADDR16_HA | ||
156 | bne lo16 | ||
157 | lwz r4, 0(r9) /* r_offset */ | ||
158 | lwz r0, 8(r9) /* r_addend */ | ||
159 | add r0, r0, r3 | ||
160 | add r0, r0, r5 /* r0 = (S+A+Offset) */ | ||
161 | extrwi r5, r0, 1, 16 /* Extract bit 16 */ | ||
162 | extrwi r0, r0, 16, 0 /* r0 = (r0 >> 16) */ | ||
163 | add r0, r0, r5 /* Add it to r0 */ | ||
164 | b store_half | ||
165 | |||
166 | /* R_PPC_ADDR16_LO */ | ||
167 | lo16: | ||
168 | cmpwi r4, R_PPC_ADDR16_LO | ||
169 | bne nxtrela | ||
170 | lwz r4, 0(r9) /* r_offset */ | ||
171 | lwz r0, 8(r9) /* r_addend */ | ||
172 | add r0, r0, r3 | ||
173 | add r0, r0, r5 /* r0 = (S+A+Offset) */ | ||
174 | extrwi r0, r0, 16, 16 /* r0 &= 0xffff */ | ||
175 | /* Fall through to */ | ||
176 | |||
177 | /* Store half word */ | ||
178 | store_half: | ||
179 | sthx r0, r4, r7 /* memory[r4+r7] = (u16)r0 */ | ||
180 | |||
181 | nxtrela: | ||
182 | /* | ||
183 | * We have to flush the modified instructions to the | ||
184 | * main storage from the d-cache. And also, invalidate the | ||
185 | * cached instructions in i-cache which has been modified. | ||
186 | * | ||
187 | * We delay the sync / isync operation till the end, since | ||
188 | * we won't be executing the modified instructions until | ||
189 | * we return from here. | ||
190 | */ | ||
191 | dcbst r4,r7 | ||
192 | sync /* Ensure the data is flushed before icbi */ | ||
193 | icbi r4,r7 | ||
194 | cmpwi r8, 0 /* relasz = 0 ? */ | ||
195 | ble done | ||
196 | add r9, r9, r6 /* move to next entry in the .rela table */ | ||
197 | subf r8, r6, r8 /* relasz -= relaent */ | ||
198 | b applyrela | ||
199 | |||
200 | done: | ||
201 | sync /* Wait for the flush to finish */ | ||
202 | isync /* Discard prefetched instructions */ | ||
203 | blr | ||
204 | |||
205 | p_dyn: .long __dynamic_start - 0b | ||
206 | p_rela: .long __rela_dyn_start - 0b | ||
207 | p_sym: .long __dynamic_symtab - 0b | ||
208 | p_st: .long _stext - 0b | ||
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index e037c7494fd8..4174b4b23246 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -568,6 +568,12 @@ static void rtas_flash_firmware(int reboot_type) | |||
568 | } | 568 | } |
569 | 569 | ||
570 | /* | 570 | /* |
571 | * Just before starting the firmware flash, cancel the event scan work | ||
572 | * to avoid any soft lockup issues. | ||
573 | */ | ||
574 | rtas_cancel_event_scan(); | ||
575 | |||
576 | /* | ||
571 | * NOTE: the "first" block must be under 4GB, so we create | 577 | * NOTE: the "first" block must be under 4GB, so we create |
572 | * an entry with no data blocks in the reserved buffer in | 578 | * an entry with no data blocks in the reserved buffer in |
573 | * the kernel data segment. | 579 | * the kernel data segment. |
diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c index 481ef064c8f1..1045ff49cc6d 100644 --- a/arch/powerpc/kernel/rtasd.c +++ b/arch/powerpc/kernel/rtasd.c | |||
@@ -472,6 +472,13 @@ static void start_event_scan(void) | |||
472 | &event_scan_work, event_scan_delay); | 472 | &event_scan_work, event_scan_delay); |
473 | } | 473 | } |
474 | 474 | ||
475 | /* Cancel the rtas event scan work */ | ||
476 | void rtas_cancel_event_scan(void) | ||
477 | { | ||
478 | cancel_delayed_work_sync(&event_scan_work); | ||
479 | } | ||
480 | EXPORT_SYMBOL_GPL(rtas_cancel_event_scan); | ||
481 | |||
475 | static int __init rtas_init(void) | 482 | static int __init rtas_init(void) |
476 | { | 483 | { |
477 | struct proc_dir_entry *entry; | 484 | struct proc_dir_entry *entry; |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index c1ce86357ecb..ac7610815113 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -107,6 +107,8 @@ notrace unsigned long __init early_init(unsigned long dt_ptr) | |||
107 | PTRRELOC(&__start___lwsync_fixup), | 107 | PTRRELOC(&__start___lwsync_fixup), |
108 | PTRRELOC(&__stop___lwsync_fixup)); | 108 | PTRRELOC(&__stop___lwsync_fixup)); |
109 | 109 | ||
110 | do_final_fixups(); | ||
111 | |||
110 | return KERNELBASE + offset; | 112 | return KERNELBASE + offset; |
111 | } | 113 | } |
112 | 114 | ||
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 1a9dea80a69b..4cb8f1e9d044 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
36 | #include <linux/lockdep.h> | 36 | #include <linux/lockdep.h> |
37 | #include <linux/memblock.h> | 37 | #include <linux/memblock.h> |
38 | #include <linux/hugetlb.h> | ||
39 | |||
38 | #include <asm/io.h> | 40 | #include <asm/io.h> |
39 | #include <asm/kdump.h> | 41 | #include <asm/kdump.h> |
40 | #include <asm/prom.h> | 42 | #include <asm/prom.h> |
@@ -64,6 +66,7 @@ | |||
64 | #include <asm/mmu_context.h> | 66 | #include <asm/mmu_context.h> |
65 | #include <asm/code-patching.h> | 67 | #include <asm/code-patching.h> |
66 | #include <asm/kvm_ppc.h> | 68 | #include <asm/kvm_ppc.h> |
69 | #include <asm/hugetlb.h> | ||
67 | 70 | ||
68 | #include "setup.h" | 71 | #include "setup.h" |
69 | 72 | ||
@@ -217,6 +220,13 @@ void __init early_setup(unsigned long dt_ptr) | |||
217 | /* Initialize the hash table or TLB handling */ | 220 | /* Initialize the hash table or TLB handling */ |
218 | early_init_mmu(); | 221 | early_init_mmu(); |
219 | 222 | ||
223 | /* | ||
224 | * Reserve any gigantic pages requested on the command line. | ||
225 | * memblock needs to have been initialized by the time this is | ||
226 | * called since this will reserve memory. | ||
227 | */ | ||
228 | reserve_hugetlb_gpages(); | ||
229 | |||
220 | DBG(" <- early_setup()\n"); | 230 | DBG(" <- early_setup()\n"); |
221 | } | 231 | } |
222 | 232 | ||
@@ -359,6 +369,7 @@ void __init setup_system(void) | |||
359 | &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); | 369 | &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); |
360 | do_lwsync_fixups(cur_cpu_spec->cpu_features, | 370 | do_lwsync_fixups(cur_cpu_spec->cpu_features, |
361 | &__start___lwsync_fixup, &__stop___lwsync_fixup); | 371 | &__start___lwsync_fixup, &__stop___lwsync_fixup); |
372 | do_final_fixups(); | ||
362 | 373 | ||
363 | /* | 374 | /* |
364 | * Unflatten the device-tree passed by prom_init or kexec | 375 | * Unflatten the device-tree passed by prom_init or kexec |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 78b76dc54dfb..836a5a19eb2c 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -97,7 +97,7 @@ static inline int put_sigset_t(compat_sigset_t __user *uset, sigset_t *set) | |||
97 | compat_sigset_t cset; | 97 | compat_sigset_t cset; |
98 | 98 | ||
99 | switch (_NSIG_WORDS) { | 99 | switch (_NSIG_WORDS) { |
100 | case 4: cset.sig[5] = set->sig[3] & 0xffffffffull; | 100 | case 4: cset.sig[6] = set->sig[3] & 0xffffffffull; |
101 | cset.sig[7] = set->sig[3] >> 32; | 101 | cset.sig[7] = set->sig[3] >> 32; |
102 | case 3: cset.sig[4] = set->sig[2] & 0xffffffffull; | 102 | case 3: cset.sig[4] = set->sig[2] & 0xffffffffull; |
103 | cset.sig[5] = set->sig[2] >> 32; | 103 | cset.sig[5] = set->sig[2] >> 32; |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 6df70907d60a..46695febc09f 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/cache.h> | 28 | #include <linux/cache.h> |
29 | #include <linux/err.h> | 29 | #include <linux/err.h> |
30 | #include <linux/sysdev.h> | 30 | #include <linux/device.h> |
31 | #include <linux/cpu.h> | 31 | #include <linux/cpu.h> |
32 | #include <linux/notifier.h> | 32 | #include <linux/notifier.h> |
33 | #include <linux/topology.h> | 33 | #include <linux/topology.h> |
@@ -187,7 +187,8 @@ int smp_request_message_ipi(int virq, int msg) | |||
187 | return 1; | 187 | return 1; |
188 | } | 188 | } |
189 | #endif | 189 | #endif |
190 | err = request_irq(virq, smp_ipi_action[msg], IRQF_PERCPU, | 190 | err = request_irq(virq, smp_ipi_action[msg], |
191 | IRQF_PERCPU | IRQF_NO_THREAD, | ||
191 | smp_ipi_name[msg], 0); | 192 | smp_ipi_name[msg], 0); |
192 | WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n", | 193 | WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n", |
193 | virq, smp_ipi_name[msg], err); | 194 | virq, smp_ipi_name[msg], err); |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index ce035c1905f0..883e74c0d1b3 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include <linux/sysdev.h> | 1 | #include <linux/device.h> |
2 | #include <linux/cpu.h> | 2 | #include <linux/cpu.h> |
3 | #include <linux/smp.h> | 3 | #include <linux/smp.h> |
4 | #include <linux/percpu.h> | 4 | #include <linux/percpu.h> |
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/machdep.h> | 18 | #include <asm/machdep.h> |
19 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
20 | #include <asm/pmc.h> | 20 | #include <asm/pmc.h> |
21 | #include <asm/system.h> | ||
21 | 22 | ||
22 | #include "cacheinfo.h" | 23 | #include "cacheinfo.h" |
23 | 24 | ||
@@ -37,12 +38,12 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
37 | /* Time in microseconds we delay before sleeping in the idle loop */ | 38 | /* Time in microseconds we delay before sleeping in the idle loop */ |
38 | DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; | 39 | DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; |
39 | 40 | ||
40 | static ssize_t store_smt_snooze_delay(struct sys_device *dev, | 41 | static ssize_t store_smt_snooze_delay(struct device *dev, |
41 | struct sysdev_attribute *attr, | 42 | struct device_attribute *attr, |
42 | const char *buf, | 43 | const char *buf, |
43 | size_t count) | 44 | size_t count) |
44 | { | 45 | { |
45 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 46 | struct cpu *cpu = container_of(dev, struct cpu, dev); |
46 | ssize_t ret; | 47 | ssize_t ret; |
47 | long snooze; | 48 | long snooze; |
48 | 49 | ||
@@ -50,21 +51,22 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev, | |||
50 | if (ret != 1) | 51 | if (ret != 1) |
51 | return -EINVAL; | 52 | return -EINVAL; |
52 | 53 | ||
53 | per_cpu(smt_snooze_delay, cpu->sysdev.id) = snooze; | 54 | per_cpu(smt_snooze_delay, cpu->dev.id) = snooze; |
55 | update_smt_snooze_delay(snooze); | ||
54 | 56 | ||
55 | return count; | 57 | return count; |
56 | } | 58 | } |
57 | 59 | ||
58 | static ssize_t show_smt_snooze_delay(struct sys_device *dev, | 60 | static ssize_t show_smt_snooze_delay(struct device *dev, |
59 | struct sysdev_attribute *attr, | 61 | struct device_attribute *attr, |
60 | char *buf) | 62 | char *buf) |
61 | { | 63 | { |
62 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 64 | struct cpu *cpu = container_of(dev, struct cpu, dev); |
63 | 65 | ||
64 | return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->sysdev.id)); | 66 | return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id)); |
65 | } | 67 | } |
66 | 68 | ||
67 | static SYSDEV_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, | 69 | static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, |
68 | store_smt_snooze_delay); | 70 | store_smt_snooze_delay); |
69 | 71 | ||
70 | static int __init setup_smt_snooze_delay(char *str) | 72 | static int __init setup_smt_snooze_delay(char *str) |
@@ -117,25 +119,25 @@ static void write_##NAME(void *val) \ | |||
117 | ppc_enable_pmcs(); \ | 119 | ppc_enable_pmcs(); \ |
118 | mtspr(ADDRESS, *(unsigned long *)val); \ | 120 | mtspr(ADDRESS, *(unsigned long *)val); \ |
119 | } \ | 121 | } \ |
120 | static ssize_t show_##NAME(struct sys_device *dev, \ | 122 | static ssize_t show_##NAME(struct device *dev, \ |
121 | struct sysdev_attribute *attr, \ | 123 | struct device_attribute *attr, \ |
122 | char *buf) \ | 124 | char *buf) \ |
123 | { \ | 125 | { \ |
124 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ | 126 | struct cpu *cpu = container_of(dev, struct cpu, dev); \ |
125 | unsigned long val; \ | 127 | unsigned long val; \ |
126 | smp_call_function_single(cpu->sysdev.id, read_##NAME, &val, 1); \ | 128 | smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \ |
127 | return sprintf(buf, "%lx\n", val); \ | 129 | return sprintf(buf, "%lx\n", val); \ |
128 | } \ | 130 | } \ |
129 | static ssize_t __used \ | 131 | static ssize_t __used \ |
130 | store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ | 132 | store_##NAME(struct device *dev, struct device_attribute *attr, \ |
131 | const char *buf, size_t count) \ | 133 | const char *buf, size_t count) \ |
132 | { \ | 134 | { \ |
133 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ | 135 | struct cpu *cpu = container_of(dev, struct cpu, dev); \ |
134 | unsigned long val; \ | 136 | unsigned long val; \ |
135 | int ret = sscanf(buf, "%lx", &val); \ | 137 | int ret = sscanf(buf, "%lx", &val); \ |
136 | if (ret != 1) \ | 138 | if (ret != 1) \ |
137 | return -EINVAL; \ | 139 | return -EINVAL; \ |
138 | smp_call_function_single(cpu->sysdev.id, write_##NAME, &val, 1); \ | 140 | smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \ |
139 | return count; \ | 141 | return count; \ |
140 | } | 142 | } |
141 | 143 | ||
@@ -177,23 +179,25 @@ SYSFS_PMCSETUP(mmcra, SPRN_MMCRA); | |||
177 | SYSFS_PMCSETUP(purr, SPRN_PURR); | 179 | SYSFS_PMCSETUP(purr, SPRN_PURR); |
178 | SYSFS_PMCSETUP(spurr, SPRN_SPURR); | 180 | SYSFS_PMCSETUP(spurr, SPRN_SPURR); |
179 | SYSFS_PMCSETUP(dscr, SPRN_DSCR); | 181 | SYSFS_PMCSETUP(dscr, SPRN_DSCR); |
182 | SYSFS_PMCSETUP(pir, SPRN_PIR); | ||
180 | 183 | ||
181 | static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); | 184 | static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra); |
182 | static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); | 185 | static DEVICE_ATTR(spurr, 0600, show_spurr, NULL); |
183 | static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); | 186 | static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr); |
184 | static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); | 187 | static DEVICE_ATTR(purr, 0600, show_purr, store_purr); |
188 | static DEVICE_ATTR(pir, 0400, show_pir, NULL); | ||
185 | 189 | ||
186 | unsigned long dscr_default = 0; | 190 | unsigned long dscr_default = 0; |
187 | EXPORT_SYMBOL(dscr_default); | 191 | EXPORT_SYMBOL(dscr_default); |
188 | 192 | ||
189 | static ssize_t show_dscr_default(struct sysdev_class *class, | 193 | static ssize_t show_dscr_default(struct device *dev, |
190 | struct sysdev_class_attribute *attr, char *buf) | 194 | struct device_attribute *attr, char *buf) |
191 | { | 195 | { |
192 | return sprintf(buf, "%lx\n", dscr_default); | 196 | return sprintf(buf, "%lx\n", dscr_default); |
193 | } | 197 | } |
194 | 198 | ||
195 | static ssize_t __used store_dscr_default(struct sysdev_class *class, | 199 | static ssize_t __used store_dscr_default(struct device *dev, |
196 | struct sysdev_class_attribute *attr, const char *buf, | 200 | struct device_attribute *attr, const char *buf, |
197 | size_t count) | 201 | size_t count) |
198 | { | 202 | { |
199 | unsigned long val; | 203 | unsigned long val; |
@@ -207,15 +211,14 @@ static ssize_t __used store_dscr_default(struct sysdev_class *class, | |||
207 | return count; | 211 | return count; |
208 | } | 212 | } |
209 | 213 | ||
210 | static SYSDEV_CLASS_ATTR(dscr_default, 0600, | 214 | static DEVICE_ATTR(dscr_default, 0600, |
211 | show_dscr_default, store_dscr_default); | 215 | show_dscr_default, store_dscr_default); |
212 | 216 | ||
213 | static void sysfs_create_dscr_default(void) | 217 | static void sysfs_create_dscr_default(void) |
214 | { | 218 | { |
215 | int err = 0; | 219 | int err = 0; |
216 | if (cpu_has_feature(CPU_FTR_DSCR)) | 220 | if (cpu_has_feature(CPU_FTR_DSCR)) |
217 | err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | 221 | err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default); |
218 | &attr_dscr_default.attr); | ||
219 | } | 222 | } |
220 | #endif /* CONFIG_PPC64 */ | 223 | #endif /* CONFIG_PPC64 */ |
221 | 224 | ||
@@ -259,72 +262,72 @@ SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3); | |||
259 | #endif /* HAS_PPC_PMC_PA6T */ | 262 | #endif /* HAS_PPC_PMC_PA6T */ |
260 | 263 | ||
261 | #ifdef HAS_PPC_PMC_IBM | 264 | #ifdef HAS_PPC_PMC_IBM |
262 | static struct sysdev_attribute ibm_common_attrs[] = { | 265 | static struct device_attribute ibm_common_attrs[] = { |
263 | _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), | 266 | __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), |
264 | _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), | 267 | __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), |
265 | }; | 268 | }; |
266 | #endif /* HAS_PPC_PMC_G4 */ | 269 | #endif /* HAS_PPC_PMC_G4 */ |
267 | 270 | ||
268 | #ifdef HAS_PPC_PMC_G4 | 271 | #ifdef HAS_PPC_PMC_G4 |
269 | static struct sysdev_attribute g4_common_attrs[] = { | 272 | static struct device_attribute g4_common_attrs[] = { |
270 | _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), | 273 | __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), |
271 | _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), | 274 | __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), |
272 | _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), | 275 | __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), |
273 | }; | 276 | }; |
274 | #endif /* HAS_PPC_PMC_G4 */ | 277 | #endif /* HAS_PPC_PMC_G4 */ |
275 | 278 | ||
276 | static struct sysdev_attribute classic_pmc_attrs[] = { | 279 | static struct device_attribute classic_pmc_attrs[] = { |
277 | _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), | 280 | __ATTR(pmc1, 0600, show_pmc1, store_pmc1), |
278 | _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), | 281 | __ATTR(pmc2, 0600, show_pmc2, store_pmc2), |
279 | _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), | 282 | __ATTR(pmc3, 0600, show_pmc3, store_pmc3), |
280 | _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), | 283 | __ATTR(pmc4, 0600, show_pmc4, store_pmc4), |
281 | _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), | 284 | __ATTR(pmc5, 0600, show_pmc5, store_pmc5), |
282 | _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), | 285 | __ATTR(pmc6, 0600, show_pmc6, store_pmc6), |
283 | #ifdef CONFIG_PPC64 | 286 | #ifdef CONFIG_PPC64 |
284 | _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), | 287 | __ATTR(pmc7, 0600, show_pmc7, store_pmc7), |
285 | _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), | 288 | __ATTR(pmc8, 0600, show_pmc8, store_pmc8), |
286 | #endif | 289 | #endif |
287 | }; | 290 | }; |
288 | 291 | ||
289 | #ifdef HAS_PPC_PMC_PA6T | 292 | #ifdef HAS_PPC_PMC_PA6T |
290 | static struct sysdev_attribute pa6t_attrs[] = { | 293 | static struct device_attribute pa6t_attrs[] = { |
291 | _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), | 294 | __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), |
292 | _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), | 295 | __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), |
293 | _SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), | 296 | __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), |
294 | _SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), | 297 | __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), |
295 | _SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), | 298 | __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), |
296 | _SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), | 299 | __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), |
297 | _SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), | 300 | __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), |
298 | _SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), | 301 | __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), |
299 | #ifdef CONFIG_DEBUG_KERNEL | 302 | #ifdef CONFIG_DEBUG_KERNEL |
300 | _SYSDEV_ATTR(hid0, 0600, show_hid0, store_hid0), | 303 | __ATTR(hid0, 0600, show_hid0, store_hid0), |
301 | _SYSDEV_ATTR(hid1, 0600, show_hid1, store_hid1), | 304 | __ATTR(hid1, 0600, show_hid1, store_hid1), |
302 | _SYSDEV_ATTR(hid4, 0600, show_hid4, store_hid4), | 305 | __ATTR(hid4, 0600, show_hid4, store_hid4), |
303 | _SYSDEV_ATTR(hid5, 0600, show_hid5, store_hid5), | 306 | __ATTR(hid5, 0600, show_hid5, store_hid5), |
304 | _SYSDEV_ATTR(ima0, 0600, show_ima0, store_ima0), | 307 | __ATTR(ima0, 0600, show_ima0, store_ima0), |
305 | _SYSDEV_ATTR(ima1, 0600, show_ima1, store_ima1), | 308 | __ATTR(ima1, 0600, show_ima1, store_ima1), |
306 | _SYSDEV_ATTR(ima2, 0600, show_ima2, store_ima2), | 309 | __ATTR(ima2, 0600, show_ima2, store_ima2), |
307 | _SYSDEV_ATTR(ima3, 0600, show_ima3, store_ima3), | 310 | __ATTR(ima3, 0600, show_ima3, store_ima3), |
308 | _SYSDEV_ATTR(ima4, 0600, show_ima4, store_ima4), | 311 | __ATTR(ima4, 0600, show_ima4, store_ima4), |
309 | _SYSDEV_ATTR(ima5, 0600, show_ima5, store_ima5), | 312 | __ATTR(ima5, 0600, show_ima5, store_ima5), |
310 | _SYSDEV_ATTR(ima6, 0600, show_ima6, store_ima6), | 313 | __ATTR(ima6, 0600, show_ima6, store_ima6), |
311 | _SYSDEV_ATTR(ima7, 0600, show_ima7, store_ima7), | 314 | __ATTR(ima7, 0600, show_ima7, store_ima7), |
312 | _SYSDEV_ATTR(ima8, 0600, show_ima8, store_ima8), | 315 | __ATTR(ima8, 0600, show_ima8, store_ima8), |
313 | _SYSDEV_ATTR(ima9, 0600, show_ima9, store_ima9), | 316 | __ATTR(ima9, 0600, show_ima9, store_ima9), |
314 | _SYSDEV_ATTR(imaat, 0600, show_imaat, store_imaat), | 317 | __ATTR(imaat, 0600, show_imaat, store_imaat), |
315 | _SYSDEV_ATTR(btcr, 0600, show_btcr, store_btcr), | 318 | __ATTR(btcr, 0600, show_btcr, store_btcr), |
316 | _SYSDEV_ATTR(pccr, 0600, show_pccr, store_pccr), | 319 | __ATTR(pccr, 0600, show_pccr, store_pccr), |
317 | _SYSDEV_ATTR(rpccr, 0600, show_rpccr, store_rpccr), | 320 | __ATTR(rpccr, 0600, show_rpccr, store_rpccr), |
318 | _SYSDEV_ATTR(der, 0600, show_der, store_der), | 321 | __ATTR(der, 0600, show_der, store_der), |
319 | _SYSDEV_ATTR(mer, 0600, show_mer, store_mer), | 322 | __ATTR(mer, 0600, show_mer, store_mer), |
320 | _SYSDEV_ATTR(ber, 0600, show_ber, store_ber), | 323 | __ATTR(ber, 0600, show_ber, store_ber), |
321 | _SYSDEV_ATTR(ier, 0600, show_ier, store_ier), | 324 | __ATTR(ier, 0600, show_ier, store_ier), |
322 | _SYSDEV_ATTR(sier, 0600, show_sier, store_sier), | 325 | __ATTR(sier, 0600, show_sier, store_sier), |
323 | _SYSDEV_ATTR(siar, 0600, show_siar, store_siar), | 326 | __ATTR(siar, 0600, show_siar, store_siar), |
324 | _SYSDEV_ATTR(tsr0, 0600, show_tsr0, store_tsr0), | 327 | __ATTR(tsr0, 0600, show_tsr0, store_tsr0), |
325 | _SYSDEV_ATTR(tsr1, 0600, show_tsr1, store_tsr1), | 328 | __ATTR(tsr1, 0600, show_tsr1, store_tsr1), |
326 | _SYSDEV_ATTR(tsr2, 0600, show_tsr2, store_tsr2), | 329 | __ATTR(tsr2, 0600, show_tsr2, store_tsr2), |
327 | _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), | 330 | __ATTR(tsr3, 0600, show_tsr3, store_tsr3), |
328 | #endif /* CONFIG_DEBUG_KERNEL */ | 331 | #endif /* CONFIG_DEBUG_KERNEL */ |
329 | }; | 332 | }; |
330 | #endif /* HAS_PPC_PMC_PA6T */ | 333 | #endif /* HAS_PPC_PMC_PA6T */ |
@@ -333,14 +336,14 @@ static struct sysdev_attribute pa6t_attrs[] = { | |||
333 | static void __cpuinit register_cpu_online(unsigned int cpu) | 336 | static void __cpuinit register_cpu_online(unsigned int cpu) |
334 | { | 337 | { |
335 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 338 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
336 | struct sys_device *s = &c->sysdev; | 339 | struct device *s = &c->dev; |
337 | struct sysdev_attribute *attrs, *pmc_attrs; | 340 | struct device_attribute *attrs, *pmc_attrs; |
338 | int i, nattrs; | 341 | int i, nattrs; |
339 | 342 | ||
340 | #ifdef CONFIG_PPC64 | 343 | #ifdef CONFIG_PPC64 |
341 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && | 344 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && |
342 | cpu_has_feature(CPU_FTR_SMT)) | 345 | cpu_has_feature(CPU_FTR_SMT)) |
343 | sysdev_create_file(s, &attr_smt_snooze_delay); | 346 | device_create_file(s, &dev_attr_smt_snooze_delay); |
344 | #endif | 347 | #endif |
345 | 348 | ||
346 | /* PMC stuff */ | 349 | /* PMC stuff */ |
@@ -348,14 +351,14 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
348 | #ifdef HAS_PPC_PMC_IBM | 351 | #ifdef HAS_PPC_PMC_IBM |
349 | case PPC_PMC_IBM: | 352 | case PPC_PMC_IBM: |
350 | attrs = ibm_common_attrs; | 353 | attrs = ibm_common_attrs; |
351 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); | 354 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); |
352 | pmc_attrs = classic_pmc_attrs; | 355 | pmc_attrs = classic_pmc_attrs; |
353 | break; | 356 | break; |
354 | #endif /* HAS_PPC_PMC_IBM */ | 357 | #endif /* HAS_PPC_PMC_IBM */ |
355 | #ifdef HAS_PPC_PMC_G4 | 358 | #ifdef HAS_PPC_PMC_G4 |
356 | case PPC_PMC_G4: | 359 | case PPC_PMC_G4: |
357 | attrs = g4_common_attrs; | 360 | attrs = g4_common_attrs; |
358 | nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); | 361 | nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); |
359 | pmc_attrs = classic_pmc_attrs; | 362 | pmc_attrs = classic_pmc_attrs; |
360 | break; | 363 | break; |
361 | #endif /* HAS_PPC_PMC_G4 */ | 364 | #endif /* HAS_PPC_PMC_G4 */ |
@@ -363,7 +366,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
363 | case PPC_PMC_PA6T: | 366 | case PPC_PMC_PA6T: |
364 | /* PA Semi starts counting at PMC0 */ | 367 | /* PA Semi starts counting at PMC0 */ |
365 | attrs = pa6t_attrs; | 368 | attrs = pa6t_attrs; |
366 | nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); | 369 | nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); |
367 | pmc_attrs = NULL; | 370 | pmc_attrs = NULL; |
368 | break; | 371 | break; |
369 | #endif /* HAS_PPC_PMC_PA6T */ | 372 | #endif /* HAS_PPC_PMC_PA6T */ |
@@ -374,24 +377,27 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
374 | } | 377 | } |
375 | 378 | ||
376 | for (i = 0; i < nattrs; i++) | 379 | for (i = 0; i < nattrs; i++) |
377 | sysdev_create_file(s, &attrs[i]); | 380 | device_create_file(s, &attrs[i]); |
378 | 381 | ||
379 | if (pmc_attrs) | 382 | if (pmc_attrs) |
380 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) | 383 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) |
381 | sysdev_create_file(s, &pmc_attrs[i]); | 384 | device_create_file(s, &pmc_attrs[i]); |
382 | 385 | ||
383 | #ifdef CONFIG_PPC64 | 386 | #ifdef CONFIG_PPC64 |
384 | if (cpu_has_feature(CPU_FTR_MMCRA)) | 387 | if (cpu_has_feature(CPU_FTR_MMCRA)) |
385 | sysdev_create_file(s, &attr_mmcra); | 388 | device_create_file(s, &dev_attr_mmcra); |
386 | 389 | ||
387 | if (cpu_has_feature(CPU_FTR_PURR)) | 390 | if (cpu_has_feature(CPU_FTR_PURR)) |
388 | sysdev_create_file(s, &attr_purr); | 391 | device_create_file(s, &dev_attr_purr); |
389 | 392 | ||
390 | if (cpu_has_feature(CPU_FTR_SPURR)) | 393 | if (cpu_has_feature(CPU_FTR_SPURR)) |
391 | sysdev_create_file(s, &attr_spurr); | 394 | device_create_file(s, &dev_attr_spurr); |
392 | 395 | ||
393 | if (cpu_has_feature(CPU_FTR_DSCR)) | 396 | if (cpu_has_feature(CPU_FTR_DSCR)) |
394 | sysdev_create_file(s, &attr_dscr); | 397 | device_create_file(s, &dev_attr_dscr); |
398 | |||
399 | if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2)) | ||
400 | device_create_file(s, &dev_attr_pir); | ||
395 | #endif /* CONFIG_PPC64 */ | 401 | #endif /* CONFIG_PPC64 */ |
396 | 402 | ||
397 | cacheinfo_cpu_online(cpu); | 403 | cacheinfo_cpu_online(cpu); |
@@ -401,8 +407,8 @@ static void __cpuinit register_cpu_online(unsigned int cpu) | |||
401 | static void unregister_cpu_online(unsigned int cpu) | 407 | static void unregister_cpu_online(unsigned int cpu) |
402 | { | 408 | { |
403 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 409 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
404 | struct sys_device *s = &c->sysdev; | 410 | struct device *s = &c->dev; |
405 | struct sysdev_attribute *attrs, *pmc_attrs; | 411 | struct device_attribute *attrs, *pmc_attrs; |
406 | int i, nattrs; | 412 | int i, nattrs; |
407 | 413 | ||
408 | BUG_ON(!c->hotpluggable); | 414 | BUG_ON(!c->hotpluggable); |
@@ -410,7 +416,7 @@ static void unregister_cpu_online(unsigned int cpu) | |||
410 | #ifdef CONFIG_PPC64 | 416 | #ifdef CONFIG_PPC64 |
411 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && | 417 | if (!firmware_has_feature(FW_FEATURE_ISERIES) && |
412 | cpu_has_feature(CPU_FTR_SMT)) | 418 | cpu_has_feature(CPU_FTR_SMT)) |
413 | sysdev_remove_file(s, &attr_smt_snooze_delay); | 419 | device_remove_file(s, &dev_attr_smt_snooze_delay); |
414 | #endif | 420 | #endif |
415 | 421 | ||
416 | /* PMC stuff */ | 422 | /* PMC stuff */ |
@@ -418,14 +424,14 @@ static void unregister_cpu_online(unsigned int cpu) | |||
418 | #ifdef HAS_PPC_PMC_IBM | 424 | #ifdef HAS_PPC_PMC_IBM |
419 | case PPC_PMC_IBM: | 425 | case PPC_PMC_IBM: |
420 | attrs = ibm_common_attrs; | 426 | attrs = ibm_common_attrs; |
421 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); | 427 | nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); |
422 | pmc_attrs = classic_pmc_attrs; | 428 | pmc_attrs = classic_pmc_attrs; |
423 | break; | 429 | break; |
424 | #endif /* HAS_PPC_PMC_IBM */ | 430 | #endif /* HAS_PPC_PMC_IBM */ |
425 | #ifdef HAS_PPC_PMC_G4 | 431 | #ifdef HAS_PPC_PMC_G4 |
426 | case PPC_PMC_G4: | 432 | case PPC_PMC_G4: |
427 | attrs = g4_common_attrs; | 433 | attrs = g4_common_attrs; |
428 | nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); | 434 | nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); |
429 | pmc_attrs = classic_pmc_attrs; | 435 | pmc_attrs = classic_pmc_attrs; |
430 | break; | 436 | break; |
431 | #endif /* HAS_PPC_PMC_G4 */ | 437 | #endif /* HAS_PPC_PMC_G4 */ |
@@ -433,7 +439,7 @@ static void unregister_cpu_online(unsigned int cpu) | |||
433 | case PPC_PMC_PA6T: | 439 | case PPC_PMC_PA6T: |
434 | /* PA Semi starts counting at PMC0 */ | 440 | /* PA Semi starts counting at PMC0 */ |
435 | attrs = pa6t_attrs; | 441 | attrs = pa6t_attrs; |
436 | nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); | 442 | nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); |
437 | pmc_attrs = NULL; | 443 | pmc_attrs = NULL; |
438 | break; | 444 | break; |
439 | #endif /* HAS_PPC_PMC_PA6T */ | 445 | #endif /* HAS_PPC_PMC_PA6T */ |
@@ -444,24 +450,27 @@ static void unregister_cpu_online(unsigned int cpu) | |||
444 | } | 450 | } |
445 | 451 | ||
446 | for (i = 0; i < nattrs; i++) | 452 | for (i = 0; i < nattrs; i++) |
447 | sysdev_remove_file(s, &attrs[i]); | 453 | device_remove_file(s, &attrs[i]); |
448 | 454 | ||
449 | if (pmc_attrs) | 455 | if (pmc_attrs) |
450 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) | 456 | for (i = 0; i < cur_cpu_spec->num_pmcs; i++) |
451 | sysdev_remove_file(s, &pmc_attrs[i]); | 457 | device_remove_file(s, &pmc_attrs[i]); |
452 | 458 | ||
453 | #ifdef CONFIG_PPC64 | 459 | #ifdef CONFIG_PPC64 |
454 | if (cpu_has_feature(CPU_FTR_MMCRA)) | 460 | if (cpu_has_feature(CPU_FTR_MMCRA)) |
455 | sysdev_remove_file(s, &attr_mmcra); | 461 | device_remove_file(s, &dev_attr_mmcra); |
456 | 462 | ||
457 | if (cpu_has_feature(CPU_FTR_PURR)) | 463 | if (cpu_has_feature(CPU_FTR_PURR)) |
458 | sysdev_remove_file(s, &attr_purr); | 464 | device_remove_file(s, &dev_attr_purr); |
459 | 465 | ||
460 | if (cpu_has_feature(CPU_FTR_SPURR)) | 466 | if (cpu_has_feature(CPU_FTR_SPURR)) |
461 | sysdev_remove_file(s, &attr_spurr); | 467 | device_remove_file(s, &dev_attr_spurr); |
462 | 468 | ||
463 | if (cpu_has_feature(CPU_FTR_DSCR)) | 469 | if (cpu_has_feature(CPU_FTR_DSCR)) |
464 | sysdev_remove_file(s, &attr_dscr); | 470 | device_remove_file(s, &dev_attr_dscr); |
471 | |||
472 | if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2)) | ||
473 | device_remove_file(s, &dev_attr_pir); | ||
465 | #endif /* CONFIG_PPC64 */ | 474 | #endif /* CONFIG_PPC64 */ |
466 | 475 | ||
467 | cacheinfo_cpu_offline(cpu); | 476 | cacheinfo_cpu_offline(cpu); |
@@ -513,70 +522,70 @@ static struct notifier_block __cpuinitdata sysfs_cpu_nb = { | |||
513 | 522 | ||
514 | static DEFINE_MUTEX(cpu_mutex); | 523 | static DEFINE_MUTEX(cpu_mutex); |
515 | 524 | ||
516 | int cpu_add_sysdev_attr(struct sysdev_attribute *attr) | 525 | int cpu_add_dev_attr(struct device_attribute *attr) |
517 | { | 526 | { |
518 | int cpu; | 527 | int cpu; |
519 | 528 | ||
520 | mutex_lock(&cpu_mutex); | 529 | mutex_lock(&cpu_mutex); |
521 | 530 | ||
522 | for_each_possible_cpu(cpu) { | 531 | for_each_possible_cpu(cpu) { |
523 | sysdev_create_file(get_cpu_sysdev(cpu), attr); | 532 | device_create_file(get_cpu_device(cpu), attr); |
524 | } | 533 | } |
525 | 534 | ||
526 | mutex_unlock(&cpu_mutex); | 535 | mutex_unlock(&cpu_mutex); |
527 | return 0; | 536 | return 0; |
528 | } | 537 | } |
529 | EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); | 538 | EXPORT_SYMBOL_GPL(cpu_add_dev_attr); |
530 | 539 | ||
531 | int cpu_add_sysdev_attr_group(struct attribute_group *attrs) | 540 | int cpu_add_dev_attr_group(struct attribute_group *attrs) |
532 | { | 541 | { |
533 | int cpu; | 542 | int cpu; |
534 | struct sys_device *sysdev; | 543 | struct device *dev; |
535 | int ret; | 544 | int ret; |
536 | 545 | ||
537 | mutex_lock(&cpu_mutex); | 546 | mutex_lock(&cpu_mutex); |
538 | 547 | ||
539 | for_each_possible_cpu(cpu) { | 548 | for_each_possible_cpu(cpu) { |
540 | sysdev = get_cpu_sysdev(cpu); | 549 | dev = get_cpu_device(cpu); |
541 | ret = sysfs_create_group(&sysdev->kobj, attrs); | 550 | ret = sysfs_create_group(&dev->kobj, attrs); |
542 | WARN_ON(ret != 0); | 551 | WARN_ON(ret != 0); |
543 | } | 552 | } |
544 | 553 | ||
545 | mutex_unlock(&cpu_mutex); | 554 | mutex_unlock(&cpu_mutex); |
546 | return 0; | 555 | return 0; |
547 | } | 556 | } |
548 | EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); | 557 | EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group); |
549 | 558 | ||
550 | 559 | ||
551 | void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) | 560 | void cpu_remove_dev_attr(struct device_attribute *attr) |
552 | { | 561 | { |
553 | int cpu; | 562 | int cpu; |
554 | 563 | ||
555 | mutex_lock(&cpu_mutex); | 564 | mutex_lock(&cpu_mutex); |
556 | 565 | ||
557 | for_each_possible_cpu(cpu) { | 566 | for_each_possible_cpu(cpu) { |
558 | sysdev_remove_file(get_cpu_sysdev(cpu), attr); | 567 | device_remove_file(get_cpu_device(cpu), attr); |
559 | } | 568 | } |
560 | 569 | ||
561 | mutex_unlock(&cpu_mutex); | 570 | mutex_unlock(&cpu_mutex); |
562 | } | 571 | } |
563 | EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); | 572 | EXPORT_SYMBOL_GPL(cpu_remove_dev_attr); |
564 | 573 | ||
565 | void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) | 574 | void cpu_remove_dev_attr_group(struct attribute_group *attrs) |
566 | { | 575 | { |
567 | int cpu; | 576 | int cpu; |
568 | struct sys_device *sysdev; | 577 | struct device *dev; |
569 | 578 | ||
570 | mutex_lock(&cpu_mutex); | 579 | mutex_lock(&cpu_mutex); |
571 | 580 | ||
572 | for_each_possible_cpu(cpu) { | 581 | for_each_possible_cpu(cpu) { |
573 | sysdev = get_cpu_sysdev(cpu); | 582 | dev = get_cpu_device(cpu); |
574 | sysfs_remove_group(&sysdev->kobj, attrs); | 583 | sysfs_remove_group(&dev->kobj, attrs); |
575 | } | 584 | } |
576 | 585 | ||
577 | mutex_unlock(&cpu_mutex); | 586 | mutex_unlock(&cpu_mutex); |
578 | } | 587 | } |
579 | EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); | 588 | EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group); |
580 | 589 | ||
581 | 590 | ||
582 | /* NUMA stuff */ | 591 | /* NUMA stuff */ |
@@ -590,18 +599,18 @@ static void register_nodes(void) | |||
590 | register_one_node(i); | 599 | register_one_node(i); |
591 | } | 600 | } |
592 | 601 | ||
593 | int sysfs_add_device_to_node(struct sys_device *dev, int nid) | 602 | int sysfs_add_device_to_node(struct device *dev, int nid) |
594 | { | 603 | { |
595 | struct node *node = &node_devices[nid]; | 604 | struct node *node = &node_devices[nid]; |
596 | return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, | 605 | return sysfs_create_link(&node->dev.kobj, &dev->kobj, |
597 | kobject_name(&dev->kobj)); | 606 | kobject_name(&dev->kobj)); |
598 | } | 607 | } |
599 | EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); | 608 | EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); |
600 | 609 | ||
601 | void sysfs_remove_device_from_node(struct sys_device *dev, int nid) | 610 | void sysfs_remove_device_from_node(struct device *dev, int nid) |
602 | { | 611 | { |
603 | struct node *node = &node_devices[nid]; | 612 | struct node *node = &node_devices[nid]; |
604 | sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); | 613 | sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj)); |
605 | } | 614 | } |
606 | EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); | 615 | EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); |
607 | 616 | ||
@@ -614,14 +623,14 @@ static void register_nodes(void) | |||
614 | #endif | 623 | #endif |
615 | 624 | ||
616 | /* Only valid if CPU is present. */ | 625 | /* Only valid if CPU is present. */ |
617 | static ssize_t show_physical_id(struct sys_device *dev, | 626 | static ssize_t show_physical_id(struct device *dev, |
618 | struct sysdev_attribute *attr, char *buf) | 627 | struct device_attribute *attr, char *buf) |
619 | { | 628 | { |
620 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 629 | struct cpu *cpu = container_of(dev, struct cpu, dev); |
621 | 630 | ||
622 | return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->sysdev.id)); | 631 | return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id)); |
623 | } | 632 | } |
624 | static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); | 633 | static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL); |
625 | 634 | ||
626 | static int __init topology_init(void) | 635 | static int __init topology_init(void) |
627 | { | 636 | { |
@@ -646,7 +655,7 @@ static int __init topology_init(void) | |||
646 | if (cpu_online(cpu) || c->hotpluggable) { | 655 | if (cpu_online(cpu) || c->hotpluggable) { |
647 | register_cpu(c, cpu); | 656 | register_cpu(c, cpu); |
648 | 657 | ||
649 | sysdev_create_file(&c->sysdev, &attr_physical_id); | 658 | device_create_file(&c->dev, &dev_attr_physical_id); |
650 | } | 659 | } |
651 | 660 | ||
652 | if (cpu_online(cpu)) | 661 | if (cpu_online(cpu)) |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 522bb1dfc353..567dd7c3ac2a 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -86,8 +86,6 @@ static struct clocksource clocksource_rtc = { | |||
86 | .rating = 400, | 86 | .rating = 400, |
87 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 87 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
88 | .mask = CLOCKSOURCE_MASK(64), | 88 | .mask = CLOCKSOURCE_MASK(64), |
89 | .shift = 22, | ||
90 | .mult = 0, /* To be filled in */ | ||
91 | .read = rtc_read, | 89 | .read = rtc_read, |
92 | }; | 90 | }; |
93 | 91 | ||
@@ -97,8 +95,6 @@ static struct clocksource clocksource_timebase = { | |||
97 | .rating = 400, | 95 | .rating = 400, |
98 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 96 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
99 | .mask = CLOCKSOURCE_MASK(64), | 97 | .mask = CLOCKSOURCE_MASK(64), |
100 | .shift = 22, | ||
101 | .mult = 0, /* To be filled in */ | ||
102 | .read = timebase_read, | 98 | .read = timebase_read, |
103 | }; | 99 | }; |
104 | 100 | ||
@@ -110,22 +106,16 @@ static void decrementer_set_mode(enum clock_event_mode mode, | |||
110 | struct clock_event_device *dev); | 106 | struct clock_event_device *dev); |
111 | 107 | ||
112 | static struct clock_event_device decrementer_clockevent = { | 108 | static struct clock_event_device decrementer_clockevent = { |
113 | .name = "decrementer", | 109 | .name = "decrementer", |
114 | .rating = 200, | 110 | .rating = 200, |
115 | .shift = 0, /* To be filled in */ | 111 | .irq = 0, |
116 | .mult = 0, /* To be filled in */ | 112 | .set_next_event = decrementer_set_next_event, |
117 | .irq = 0, | 113 | .set_mode = decrementer_set_mode, |
118 | .set_next_event = decrementer_set_next_event, | 114 | .features = CLOCK_EVT_FEAT_ONESHOT, |
119 | .set_mode = decrementer_set_mode, | ||
120 | .features = CLOCK_EVT_FEAT_ONESHOT, | ||
121 | }; | 115 | }; |
122 | 116 | ||
123 | struct decrementer_clock { | 117 | DEFINE_PER_CPU(u64, decrementers_next_tb); |
124 | struct clock_event_device event; | 118 | static DEFINE_PER_CPU(struct clock_event_device, decrementers); |
125 | u64 next_tb; | ||
126 | }; | ||
127 | |||
128 | static DEFINE_PER_CPU(struct decrementer_clock, decrementers); | ||
129 | 119 | ||
130 | #ifdef CONFIG_PPC_ISERIES | 120 | #ifdef CONFIG_PPC_ISERIES |
131 | static unsigned long __initdata iSeries_recal_titan; | 121 | static unsigned long __initdata iSeries_recal_titan; |
@@ -168,13 +158,13 @@ EXPORT_SYMBOL_GPL(ppc_tb_freq); | |||
168 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 158 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
169 | /* | 159 | /* |
170 | * Factors for converting from cputime_t (timebase ticks) to | 160 | * Factors for converting from cputime_t (timebase ticks) to |
171 | * jiffies, milliseconds, seconds, and clock_t (1/USER_HZ seconds). | 161 | * jiffies, microseconds, seconds, and clock_t (1/USER_HZ seconds). |
172 | * These are all stored as 0.64 fixed-point binary fractions. | 162 | * These are all stored as 0.64 fixed-point binary fractions. |
173 | */ | 163 | */ |
174 | u64 __cputime_jiffies_factor; | 164 | u64 __cputime_jiffies_factor; |
175 | EXPORT_SYMBOL(__cputime_jiffies_factor); | 165 | EXPORT_SYMBOL(__cputime_jiffies_factor); |
176 | u64 __cputime_msec_factor; | 166 | u64 __cputime_usec_factor; |
177 | EXPORT_SYMBOL(__cputime_msec_factor); | 167 | EXPORT_SYMBOL(__cputime_usec_factor); |
178 | u64 __cputime_sec_factor; | 168 | u64 __cputime_sec_factor; |
179 | EXPORT_SYMBOL(__cputime_sec_factor); | 169 | EXPORT_SYMBOL(__cputime_sec_factor); |
180 | u64 __cputime_clockt_factor; | 170 | u64 __cputime_clockt_factor; |
@@ -192,8 +182,8 @@ static void calc_cputime_factors(void) | |||
192 | 182 | ||
193 | div128_by_32(HZ, 0, tb_ticks_per_sec, &res); | 183 | div128_by_32(HZ, 0, tb_ticks_per_sec, &res); |
194 | __cputime_jiffies_factor = res.result_low; | 184 | __cputime_jiffies_factor = res.result_low; |
195 | div128_by_32(1000, 0, tb_ticks_per_sec, &res); | 185 | div128_by_32(1000000, 0, tb_ticks_per_sec, &res); |
196 | __cputime_msec_factor = res.result_low; | 186 | __cputime_usec_factor = res.result_low; |
197 | div128_by_32(1, 0, tb_ticks_per_sec, &res); | 187 | div128_by_32(1, 0, tb_ticks_per_sec, &res); |
198 | __cputime_sec_factor = res.result_low; | 188 | __cputime_sec_factor = res.result_low; |
199 | div128_by_32(USER_HZ, 0, tb_ticks_per_sec, &res); | 189 | div128_by_32(USER_HZ, 0, tb_ticks_per_sec, &res); |
@@ -441,7 +431,7 @@ EXPORT_SYMBOL(profile_pc); | |||
441 | /* | 431 | /* |
442 | * This function recalibrates the timebase based on the 49-bit time-of-day | 432 | * This function recalibrates the timebase based on the 49-bit time-of-day |
443 | * value in the Titan chip. The Titan is much more accurate than the value | 433 | * value in the Titan chip. The Titan is much more accurate than the value |
444 | * returned by the service processor for the timebase frequency. | 434 | * returned by the service processor for the timebase frequency. |
445 | */ | 435 | */ |
446 | 436 | ||
447 | static int __init iSeries_tb_recal(void) | 437 | static int __init iSeries_tb_recal(void) |
@@ -576,9 +566,8 @@ void arch_irq_work_raise(void) | |||
576 | void timer_interrupt(struct pt_regs * regs) | 566 | void timer_interrupt(struct pt_regs * regs) |
577 | { | 567 | { |
578 | struct pt_regs *old_regs; | 568 | struct pt_regs *old_regs; |
579 | struct decrementer_clock *decrementer = &__get_cpu_var(decrementers); | 569 | u64 *next_tb = &__get_cpu_var(decrementers_next_tb); |
580 | struct clock_event_device *evt = &decrementer->event; | 570 | struct clock_event_device *evt = &__get_cpu_var(decrementers); |
581 | u64 now; | ||
582 | 571 | ||
583 | /* Ensure a positive value is written to the decrementer, or else | 572 | /* Ensure a positive value is written to the decrementer, or else |
584 | * some CPUs will continue to take decrementer exceptions. | 573 | * some CPUs will continue to take decrementer exceptions. |
@@ -613,16 +602,9 @@ void timer_interrupt(struct pt_regs * regs) | |||
613 | get_lppaca()->int_dword.fields.decr_int = 0; | 602 | get_lppaca()->int_dword.fields.decr_int = 0; |
614 | #endif | 603 | #endif |
615 | 604 | ||
616 | now = get_tb_or_rtc(); | 605 | *next_tb = ~(u64)0; |
617 | if (now >= decrementer->next_tb) { | 606 | if (evt->event_handler) |
618 | decrementer->next_tb = ~(u64)0; | 607 | evt->event_handler(evt); |
619 | if (evt->event_handler) | ||
620 | evt->event_handler(evt); | ||
621 | } else { | ||
622 | now = decrementer->next_tb - now; | ||
623 | if (now <= DECREMENTER_MAX) | ||
624 | set_dec((int)now); | ||
625 | } | ||
626 | 608 | ||
627 | #ifdef CONFIG_PPC_ISERIES | 609 | #ifdef CONFIG_PPC_ISERIES |
628 | if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending()) | 610 | if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending()) |
@@ -650,9 +632,9 @@ static void generic_suspend_disable_irqs(void) | |||
650 | * with suspending. | 632 | * with suspending. |
651 | */ | 633 | */ |
652 | 634 | ||
653 | set_dec(0x7fffffff); | 635 | set_dec(DECREMENTER_MAX); |
654 | local_irq_disable(); | 636 | local_irq_disable(); |
655 | set_dec(0x7fffffff); | 637 | set_dec(DECREMENTER_MAX); |
656 | } | 638 | } |
657 | 639 | ||
658 | static void generic_suspend_enable_irqs(void) | 640 | static void generic_suspend_enable_irqs(void) |
@@ -824,9 +806,8 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, | |||
824 | ++vdso_data->tb_update_count; | 806 | ++vdso_data->tb_update_count; |
825 | smp_mb(); | 807 | smp_mb(); |
826 | 808 | ||
827 | /* XXX this assumes clock->shift == 22 */ | 809 | /* 19342813113834067 ~= 2^(20+64) / 1e9 */ |
828 | /* 4611686018 ~= 2^(20+64-22) / 1e9 */ | 810 | new_tb_to_xs = (u64) mult * (19342813113834067ULL >> clock->shift); |
829 | new_tb_to_xs = (u64) mult * 4611686018ULL; | ||
830 | new_stamp_xsec = (u64) wall_time->tv_nsec * XSEC_PER_SEC; | 811 | new_stamp_xsec = (u64) wall_time->tv_nsec * XSEC_PER_SEC; |
831 | do_div(new_stamp_xsec, 1000000000); | 812 | do_div(new_stamp_xsec, 1000000000); |
832 | new_stamp_xsec += (u64) wall_time->tv_sec * XSEC_PER_SEC; | 813 | new_stamp_xsec += (u64) wall_time->tv_sec * XSEC_PER_SEC; |
@@ -877,9 +858,7 @@ static void __init clocksource_init(void) | |||
877 | else | 858 | else |
878 | clock = &clocksource_timebase; | 859 | clock = &clocksource_timebase; |
879 | 860 | ||
880 | clock->mult = clocksource_hz2mult(tb_ticks_per_sec, clock->shift); | 861 | if (clocksource_register_hz(clock, tb_ticks_per_sec)) { |
881 | |||
882 | if (clocksource_register(clock)) { | ||
883 | printk(KERN_ERR "clocksource: %s is already registered\n", | 862 | printk(KERN_ERR "clocksource: %s is already registered\n", |
884 | clock->name); | 863 | clock->name); |
885 | return; | 864 | return; |
@@ -892,7 +871,7 @@ static void __init clocksource_init(void) | |||
892 | static int decrementer_set_next_event(unsigned long evt, | 871 | static int decrementer_set_next_event(unsigned long evt, |
893 | struct clock_event_device *dev) | 872 | struct clock_event_device *dev) |
894 | { | 873 | { |
895 | __get_cpu_var(decrementers).next_tb = get_tb_or_rtc() + evt; | 874 | __get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt; |
896 | set_dec(evt); | 875 | set_dec(evt); |
897 | return 0; | 876 | return 0; |
898 | } | 877 | } |
@@ -904,34 +883,9 @@ static void decrementer_set_mode(enum clock_event_mode mode, | |||
904 | decrementer_set_next_event(DECREMENTER_MAX, dev); | 883 | decrementer_set_next_event(DECREMENTER_MAX, dev); |
905 | } | 884 | } |
906 | 885 | ||
907 | static inline uint64_t div_sc64(unsigned long ticks, unsigned long nsec, | ||
908 | int shift) | ||
909 | { | ||
910 | uint64_t tmp = ((uint64_t)ticks) << shift; | ||
911 | |||
912 | do_div(tmp, nsec); | ||
913 | return tmp; | ||
914 | } | ||
915 | |||
916 | static void __init setup_clockevent_multiplier(unsigned long hz) | ||
917 | { | ||
918 | u64 mult, shift = 32; | ||
919 | |||
920 | while (1) { | ||
921 | mult = div_sc64(hz, NSEC_PER_SEC, shift); | ||
922 | if (mult && (mult >> 32UL) == 0UL) | ||
923 | break; | ||
924 | |||
925 | shift--; | ||
926 | } | ||
927 | |||
928 | decrementer_clockevent.shift = shift; | ||
929 | decrementer_clockevent.mult = mult; | ||
930 | } | ||
931 | |||
932 | static void register_decrementer_clockevent(int cpu) | 886 | static void register_decrementer_clockevent(int cpu) |
933 | { | 887 | { |
934 | struct clock_event_device *dec = &per_cpu(decrementers, cpu).event; | 888 | struct clock_event_device *dec = &per_cpu(decrementers, cpu); |
935 | 889 | ||
936 | *dec = decrementer_clockevent; | 890 | *dec = decrementer_clockevent; |
937 | dec->cpumask = cpumask_of(cpu); | 891 | dec->cpumask = cpumask_of(cpu); |
@@ -946,7 +900,8 @@ static void __init init_decrementer_clockevent(void) | |||
946 | { | 900 | { |
947 | int cpu = smp_processor_id(); | 901 | int cpu = smp_processor_id(); |
948 | 902 | ||
949 | setup_clockevent_multiplier(ppc_tb_freq); | 903 | clockevents_calc_mult_shift(&decrementer_clockevent, ppc_tb_freq, 4); |
904 | |||
950 | decrementer_clockevent.max_delta_ns = | 905 | decrementer_clockevent.max_delta_ns = |
951 | clockevent_delta2ns(DECREMENTER_MAX, &decrementer_clockevent); | 906 | clockevent_delta2ns(DECREMENTER_MAX, &decrementer_clockevent); |
952 | decrementer_clockevent.min_delta_ns = | 907 | decrementer_clockevent.min_delta_ns = |
@@ -1014,10 +969,10 @@ void __init time_init(void) | |||
1014 | boot_tb = get_tb_or_rtc(); | 969 | boot_tb = get_tb_or_rtc(); |
1015 | 970 | ||
1016 | /* If platform provided a timezone (pmac), we correct the time */ | 971 | /* If platform provided a timezone (pmac), we correct the time */ |
1017 | if (timezone_offset) { | 972 | if (timezone_offset) { |
1018 | sys_tz.tz_minuteswest = -timezone_offset / 60; | 973 | sys_tz.tz_minuteswest = -timezone_offset / 60; |
1019 | sys_tz.tz_dsttime = 0; | 974 | sys_tz.tz_dsttime = 0; |
1020 | } | 975 | } |
1021 | 976 | ||
1022 | vdso_data->tb_update_count = 0; | 977 | vdso_data->tb_update_count = 0; |
1023 | vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; | 978 | vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 4e5908264d1a..c091527efd89 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -98,18 +98,14 @@ static void pmac_backlight_unblank(void) | |||
98 | static inline void pmac_backlight_unblank(void) { } | 98 | static inline void pmac_backlight_unblank(void) { } |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | int die(const char *str, struct pt_regs *regs, long err) | 101 | static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED; |
102 | static int die_owner = -1; | ||
103 | static unsigned int die_nest_count; | ||
104 | static int die_counter; | ||
105 | |||
106 | static unsigned __kprobes long oops_begin(struct pt_regs *regs) | ||
102 | { | 107 | { |
103 | static struct { | 108 | int cpu; |
104 | raw_spinlock_t lock; | ||
105 | u32 lock_owner; | ||
106 | int lock_owner_depth; | ||
107 | } die = { | ||
108 | .lock = __RAW_SPIN_LOCK_UNLOCKED(die.lock), | ||
109 | .lock_owner = -1, | ||
110 | .lock_owner_depth = 0 | ||
111 | }; | ||
112 | static int die_counter; | ||
113 | unsigned long flags; | 109 | unsigned long flags; |
114 | 110 | ||
115 | if (debugger(regs)) | 111 | if (debugger(regs)) |
@@ -117,66 +113,109 @@ int die(const char *str, struct pt_regs *regs, long err) | |||
117 | 113 | ||
118 | oops_enter(); | 114 | oops_enter(); |
119 | 115 | ||
120 | if (die.lock_owner != raw_smp_processor_id()) { | 116 | /* racy, but better than risking deadlock. */ |
121 | console_verbose(); | 117 | raw_local_irq_save(flags); |
122 | raw_spin_lock_irqsave(&die.lock, flags); | 118 | cpu = smp_processor_id(); |
123 | die.lock_owner = smp_processor_id(); | 119 | if (!arch_spin_trylock(&die_lock)) { |
124 | die.lock_owner_depth = 0; | 120 | if (cpu == die_owner) |
125 | bust_spinlocks(1); | 121 | /* nested oops. should stop eventually */; |
126 | if (machine_is(powermac)) | 122 | else |
127 | pmac_backlight_unblank(); | 123 | arch_spin_lock(&die_lock); |
128 | } else { | ||
129 | local_save_flags(flags); | ||
130 | } | 124 | } |
125 | die_nest_count++; | ||
126 | die_owner = cpu; | ||
127 | console_verbose(); | ||
128 | bust_spinlocks(1); | ||
129 | if (machine_is(powermac)) | ||
130 | pmac_backlight_unblank(); | ||
131 | return flags; | ||
132 | } | ||
131 | 133 | ||
132 | if (++die.lock_owner_depth < 3) { | 134 | static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, |
133 | printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); | 135 | int signr) |
134 | #ifdef CONFIG_PREEMPT | 136 | { |
135 | printk("PREEMPT "); | 137 | bust_spinlocks(0); |
136 | #endif | 138 | die_owner = -1; |
137 | #ifdef CONFIG_SMP | 139 | add_taint(TAINT_DIE); |
138 | printk("SMP NR_CPUS=%d ", NR_CPUS); | 140 | die_nest_count--; |
139 | #endif | 141 | oops_exit(); |
140 | #ifdef CONFIG_DEBUG_PAGEALLOC | 142 | printk("\n"); |
141 | printk("DEBUG_PAGEALLOC "); | 143 | if (!die_nest_count) |
142 | #endif | 144 | /* Nest count reaches zero, release the lock. */ |
143 | #ifdef CONFIG_NUMA | 145 | arch_spin_unlock(&die_lock); |
144 | printk("NUMA "); | 146 | raw_local_irq_restore(flags); |
145 | #endif | ||
146 | printk("%s\n", ppc_md.name ? ppc_md.name : ""); | ||
147 | 147 | ||
148 | if (notify_die(DIE_OOPS, str, regs, err, 255, | 148 | /* |
149 | SIGSEGV) == NOTIFY_STOP) | 149 | * A system reset (0x100) is a request to dump, so we always send |
150 | return 1; | 150 | * it through the crashdump code. |
151 | */ | ||
152 | if (kexec_should_crash(current) || (TRAP(regs) == 0x100)) { | ||
153 | crash_kexec(regs); | ||
151 | 154 | ||
152 | print_modules(); | 155 | /* |
153 | show_regs(regs); | 156 | * We aren't the primary crash CPU. We need to send it |
154 | } else { | 157 | * to a holding pattern to avoid it ending up in the panic |
155 | printk("Recursive die() failure, output suppressed\n"); | 158 | * code. |
159 | */ | ||
160 | crash_kexec_secondary(regs); | ||
156 | } | 161 | } |
157 | 162 | ||
158 | bust_spinlocks(0); | 163 | if (!signr) |
159 | die.lock_owner = -1; | 164 | return; |
160 | add_taint(TAINT_DIE); | ||
161 | raw_spin_unlock_irqrestore(&die.lock, flags); | ||
162 | 165 | ||
163 | if (kexec_should_crash(current) || | 166 | /* |
164 | kexec_sr_activated(smp_processor_id())) | 167 | * While our oops output is serialised by a spinlock, output |
165 | crash_kexec(regs); | 168 | * from panic() called below can race and corrupt it. If we |
166 | crash_kexec_secondary(regs); | 169 | * know we are going to panic, delay for 1 second so we have a |
170 | * chance to get clean backtraces from all CPUs that are oopsing. | ||
171 | */ | ||
172 | if (in_interrupt() || panic_on_oops || !current->pid || | ||
173 | is_global_init(current)) { | ||
174 | mdelay(MSEC_PER_SEC); | ||
175 | } | ||
167 | 176 | ||
168 | if (in_interrupt()) | 177 | if (in_interrupt()) |
169 | panic("Fatal exception in interrupt"); | 178 | panic("Fatal exception in interrupt"); |
170 | |||
171 | if (panic_on_oops) | 179 | if (panic_on_oops) |
172 | panic("Fatal exception"); | 180 | panic("Fatal exception"); |
181 | do_exit(signr); | ||
182 | } | ||
173 | 183 | ||
174 | oops_exit(); | 184 | static int __kprobes __die(const char *str, struct pt_regs *regs, long err) |
175 | do_exit(err); | 185 | { |
186 | printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); | ||
187 | #ifdef CONFIG_PREEMPT | ||
188 | printk("PREEMPT "); | ||
189 | #endif | ||
190 | #ifdef CONFIG_SMP | ||
191 | printk("SMP NR_CPUS=%d ", NR_CPUS); | ||
192 | #endif | ||
193 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
194 | printk("DEBUG_PAGEALLOC "); | ||
195 | #endif | ||
196 | #ifdef CONFIG_NUMA | ||
197 | printk("NUMA "); | ||
198 | #endif | ||
199 | printk("%s\n", ppc_md.name ? ppc_md.name : ""); | ||
200 | |||
201 | if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV) == NOTIFY_STOP) | ||
202 | return 1; | ||
203 | |||
204 | print_modules(); | ||
205 | show_regs(regs); | ||
176 | 206 | ||
177 | return 0; | 207 | return 0; |
178 | } | 208 | } |
179 | 209 | ||
210 | void die(const char *str, struct pt_regs *regs, long err) | ||
211 | { | ||
212 | unsigned long flags = oops_begin(regs); | ||
213 | |||
214 | if (__die(str, regs, err)) | ||
215 | err = 0; | ||
216 | oops_end(flags, regs, err); | ||
217 | } | ||
218 | |||
180 | void user_single_step_siginfo(struct task_struct *tsk, | 219 | void user_single_step_siginfo(struct task_struct *tsk, |
181 | struct pt_regs *regs, siginfo_t *info) | 220 | struct pt_regs *regs, siginfo_t *info) |
182 | { | 221 | { |
@@ -195,10 +234,11 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) | |||
195 | "at %016lx nip %016lx lr %016lx code %x\n"; | 234 | "at %016lx nip %016lx lr %016lx code %x\n"; |
196 | 235 | ||
197 | if (!user_mode(regs)) { | 236 | if (!user_mode(regs)) { |
198 | if (die("Exception in kernel mode", regs, signr)) | 237 | die("Exception in kernel mode", regs, signr); |
199 | return; | 238 | return; |
200 | } else if (show_unhandled_signals && | 239 | } |
201 | unhandled_signal(current, signr)) { | 240 | |
241 | if (show_unhandled_signals && unhandled_signal(current, signr)) { | ||
202 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, | 242 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, |
203 | current->comm, current->pid, signr, | 243 | current->comm, current->pid, signr, |
204 | addr, regs->nip, regs->link, code); | 244 | addr, regs->nip, regs->link, code); |
@@ -220,25 +260,8 @@ void system_reset_exception(struct pt_regs *regs) | |||
220 | return; | 260 | return; |
221 | } | 261 | } |
222 | 262 | ||
223 | #ifdef CONFIG_KEXEC | ||
224 | cpumask_set_cpu(smp_processor_id(), &cpus_in_sr); | ||
225 | #endif | ||
226 | |||
227 | die("System Reset", regs, SIGABRT); | 263 | die("System Reset", regs, SIGABRT); |
228 | 264 | ||
229 | /* | ||
230 | * Some CPUs when released from the debugger will execute this path. | ||
231 | * These CPUs entered the debugger via a soft-reset. If the CPU was | ||
232 | * hung before entering the debugger it will return to the hung | ||
233 | * state when exiting this function. This causes a problem in | ||
234 | * kdump since the hung CPU(s) will not respond to the IPI sent | ||
235 | * from kdump. To prevent the problem we call crash_kexec_secondary() | ||
236 | * here. If a kdump had not been initiated or we exit the debugger | ||
237 | * with the "exit and recover" command (x) crash_kexec_secondary() | ||
238 | * will return after 5ms and the CPU returns to its previous state. | ||
239 | */ | ||
240 | crash_kexec_secondary(regs); | ||
241 | |||
242 | /* Must die if the interrupt is not recoverable */ | 265 | /* Must die if the interrupt is not recoverable */ |
243 | if (!(regs->msr & MSR_RI)) | 266 | if (!(regs->msr & MSR_RI)) |
244 | panic("Unrecoverable System Reset"); | 267 | panic("Unrecoverable System Reset"); |
@@ -1298,14 +1321,12 @@ void __kprobes DebugException(struct pt_regs *regs, unsigned long debug_status) | |||
1298 | 1321 | ||
1299 | if (user_mode(regs)) { | 1322 | if (user_mode(regs)) { |
1300 | current->thread.dbcr0 &= ~DBCR0_IC; | 1323 | current->thread.dbcr0 &= ~DBCR0_IC; |
1301 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS | ||
1302 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, | 1324 | if (DBCR_ACTIVE_EVENTS(current->thread.dbcr0, |
1303 | current->thread.dbcr1)) | 1325 | current->thread.dbcr1)) |
1304 | regs->msr |= MSR_DE; | 1326 | regs->msr |= MSR_DE; |
1305 | else | 1327 | else |
1306 | /* Make sure the IDM bit is off */ | 1328 | /* Make sure the IDM bit is off */ |
1307 | current->thread.dbcr0 &= ~DBCR0_IDM; | 1329 | current->thread.dbcr0 &= ~DBCR0_IDM; |
1308 | #endif | ||
1309 | } | 1330 | } |
1310 | 1331 | ||
1311 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); | 1332 | _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); |
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index f65af61996bd..8b086299ba25 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -1406,7 +1406,6 @@ static struct bus_type vio_bus_type = { | |||
1406 | .match = vio_bus_match, | 1406 | .match = vio_bus_match, |
1407 | .probe = vio_bus_probe, | 1407 | .probe = vio_bus_probe, |
1408 | .remove = vio_bus_remove, | 1408 | .remove = vio_bus_remove, |
1409 | .pm = GENERIC_SUBSYS_PM_OPS, | ||
1410 | }; | 1409 | }; |
1411 | 1410 | ||
1412 | /** | 1411 | /** |
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 920276c0f6a1..710a54005dfb 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
@@ -170,7 +170,13 @@ SECTIONS | |||
170 | } | 170 | } |
171 | #ifdef CONFIG_RELOCATABLE | 171 | #ifdef CONFIG_RELOCATABLE |
172 | . = ALIGN(8); | 172 | . = ALIGN(8); |
173 | .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET) { *(.dynsym) } | 173 | .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET) |
174 | { | ||
175 | #ifdef CONFIG_RELOCATABLE_PPC32 | ||
176 | __dynamic_symtab = .; | ||
177 | #endif | ||
178 | *(.dynsym) | ||
179 | } | ||
174 | .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) } | 180 | .dynstr : AT(ADDR(.dynstr) - LOAD_OFFSET) { *(.dynstr) } |
175 | .dynamic : AT(ADDR(.dynamic) - LOAD_OFFSET) | 181 | .dynamic : AT(ADDR(.dynamic) - LOAD_OFFSET) |
176 | { | 182 | { |