diff options
-rw-r--r-- | arch/powerpc/include/asm/ppc-opcode.h | 3 | ||||
-rw-r--r-- | arch/powerpc/include/asm/reg.h | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/cputable.c | 20 | ||||
-rw-r--r-- | arch/powerpc/kernel/dbell.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/exceptions-64s.S | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/smp.c | 14 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/mobility.c | 44 |
7 files changed, 64 insertions, 24 deletions
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 03cd858a401c..4cbe23af400a 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h | |||
@@ -153,6 +153,7 @@ | |||
153 | #define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff | 153 | #define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff |
154 | #define PPC_INST_MFTMR 0x7c0002dc | 154 | #define PPC_INST_MFTMR 0x7c0002dc |
155 | #define PPC_INST_MSGSND 0x7c00019c | 155 | #define PPC_INST_MSGSND 0x7c00019c |
156 | #define PPC_INST_MSGCLR 0x7c0001dc | ||
156 | #define PPC_INST_MSGSNDP 0x7c00011c | 157 | #define PPC_INST_MSGSNDP 0x7c00011c |
157 | #define PPC_INST_MTTMR 0x7c0003dc | 158 | #define PPC_INST_MTTMR 0x7c0003dc |
158 | #define PPC_INST_NOP 0x60000000 | 159 | #define PPC_INST_NOP 0x60000000 |
@@ -309,6 +310,8 @@ | |||
309 | ___PPC_RB(b) | __PPC_EH(eh)) | 310 | ___PPC_RB(b) | __PPC_EH(eh)) |
310 | #define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ | 311 | #define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ |
311 | ___PPC_RB(b)) | 312 | ___PPC_RB(b)) |
313 | #define PPC_MSGCLR(b) stringify_in_c(.long PPC_INST_MSGCLR | \ | ||
314 | ___PPC_RB(b)) | ||
312 | #define PPC_MSGSNDP(b) stringify_in_c(.long PPC_INST_MSGSNDP | \ | 315 | #define PPC_MSGSNDP(b) stringify_in_c(.long PPC_INST_MSGSNDP | \ |
313 | ___PPC_RB(b)) | 316 | ___PPC_RB(b)) |
314 | #define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \ | 317 | #define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \ |
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 1c874fb533bb..af56b5c6c81a 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -608,13 +608,16 @@ | |||
608 | #define SRR1_ISI_N_OR_G 0x10000000 /* ISI: Access is no-exec or G */ | 608 | #define SRR1_ISI_N_OR_G 0x10000000 /* ISI: Access is no-exec or G */ |
609 | #define SRR1_ISI_PROT 0x08000000 /* ISI: Other protection fault */ | 609 | #define SRR1_ISI_PROT 0x08000000 /* ISI: Other protection fault */ |
610 | #define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */ | 610 | #define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */ |
611 | #define SRR1_WAKEMASK_P8 0x003c0000 /* reason for wakeup on POWER8 */ | ||
611 | #define SRR1_WAKESYSERR 0x00300000 /* System error */ | 612 | #define SRR1_WAKESYSERR 0x00300000 /* System error */ |
612 | #define SRR1_WAKEEE 0x00200000 /* External interrupt */ | 613 | #define SRR1_WAKEEE 0x00200000 /* External interrupt */ |
613 | #define SRR1_WAKEMT 0x00280000 /* mtctrl */ | 614 | #define SRR1_WAKEMT 0x00280000 /* mtctrl */ |
614 | #define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */ | 615 | #define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */ |
615 | #define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */ | 616 | #define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */ |
617 | #define SRR1_WAKEDBELL 0x00140000 /* Privileged doorbell on P8 */ | ||
616 | #define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */ | 618 | #define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */ |
617 | #define SRR1_WAKERESET 0x00100000 /* System reset */ | 619 | #define SRR1_WAKERESET 0x00100000 /* System reset */ |
620 | #define SRR1_WAKEHDBELL 0x000c0000 /* Hypervisor doorbell on P8 */ | ||
618 | #define SRR1_WAKESTATE 0x00030000 /* Powersave exit mask [46:47] */ | 621 | #define SRR1_WAKESTATE 0x00030000 /* Powersave exit mask [46:47] */ |
619 | #define SRR1_WS_DEEPEST 0x00030000 /* Some resources not maintained, | 622 | #define SRR1_WS_DEEPEST 0x00030000 /* Some resources not maintained, |
620 | * may not be recoverable */ | 623 | * may not be recoverable */ |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index f337666768a7..f83046878336 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -437,6 +437,26 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
437 | .machine_check_early = __machine_check_early_realmode_p8, | 437 | .machine_check_early = __machine_check_early_realmode_p8, |
438 | .platform = "power8", | 438 | .platform = "power8", |
439 | }, | 439 | }, |
440 | { /* Power8NVL */ | ||
441 | .pvr_mask = 0xffff0000, | ||
442 | .pvr_value = 0x004c0000, | ||
443 | .cpu_name = "POWER8NVL (raw)", | ||
444 | .cpu_features = CPU_FTRS_POWER8, | ||
445 | .cpu_user_features = COMMON_USER_POWER8, | ||
446 | .cpu_user_features2 = COMMON_USER2_POWER8, | ||
447 | .mmu_features = MMU_FTRS_POWER8, | ||
448 | .icache_bsize = 128, | ||
449 | .dcache_bsize = 128, | ||
450 | .num_pmcs = 6, | ||
451 | .pmc_type = PPC_PMC_IBM, | ||
452 | .oprofile_cpu_type = "ppc64/power8", | ||
453 | .oprofile_type = PPC_OPROFILE_INVALID, | ||
454 | .cpu_setup = __setup_cpu_power8, | ||
455 | .cpu_restore = __restore_cpu_power8, | ||
456 | .flush_tlb = __flush_tlb_power8, | ||
457 | .machine_check_early = __machine_check_early_realmode_p8, | ||
458 | .platform = "power8", | ||
459 | }, | ||
440 | { /* Power8 DD1: Does not support doorbell IPIs */ | 460 | { /* Power8 DD1: Does not support doorbell IPIs */ |
441 | .pvr_mask = 0xffffff00, | 461 | .pvr_mask = 0xffffff00, |
442 | .pvr_value = 0x004d0100, | 462 | .pvr_value = 0x004d0100, |
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c index f4217819cc31..2128f3a96c32 100644 --- a/arch/powerpc/kernel/dbell.c +++ b/arch/powerpc/kernel/dbell.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/dbell.h> | 18 | #include <asm/dbell.h> |
19 | #include <asm/irq_regs.h> | 19 | #include <asm/irq_regs.h> |
20 | #include <asm/kvm_ppc.h> | ||
20 | 21 | ||
21 | #ifdef CONFIG_SMP | 22 | #ifdef CONFIG_SMP |
22 | void doorbell_setup_this_cpu(void) | 23 | void doorbell_setup_this_cpu(void) |
@@ -41,6 +42,7 @@ void doorbell_exception(struct pt_regs *regs) | |||
41 | 42 | ||
42 | may_hard_irq_enable(); | 43 | may_hard_irq_enable(); |
43 | 44 | ||
45 | kvmppc_set_host_ipi(smp_processor_id(), 0); | ||
44 | __this_cpu_inc(irq_stat.doorbell_irqs); | 46 | __this_cpu_inc(irq_stat.doorbell_irqs); |
45 | 47 | ||
46 | smp_ipi_demux(); | 48 | smp_ipi_demux(); |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index c2df8150bd7a..9519e6bdc6d7 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -1408,7 +1408,7 @@ machine_check_handle_early: | |||
1408 | bne 9f /* continue in V mode if we are. */ | 1408 | bne 9f /* continue in V mode if we are. */ |
1409 | 1409 | ||
1410 | 5: | 1410 | 5: |
1411 | #ifdef CONFIG_KVM_BOOK3S_64_HV | 1411 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER |
1412 | /* | 1412 | /* |
1413 | * We are coming from kernel context. Check if we are coming from | 1413 | * We are coming from kernel context. Check if we are coming from |
1414 | * guest. if yes, then we can continue. We will fall through | 1414 | * guest. if yes, then we can continue. We will fall through |
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c index fc34025ef822..38a45088f633 100644 --- a/arch/powerpc/platforms/powernv/smp.c +++ b/arch/powerpc/platforms/powernv/smp.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <asm/runlatch.h> | 33 | #include <asm/runlatch.h> |
34 | #include <asm/code-patching.h> | 34 | #include <asm/code-patching.h> |
35 | #include <asm/dbell.h> | 35 | #include <asm/dbell.h> |
36 | #include <asm/kvm_ppc.h> | ||
37 | #include <asm/ppc-opcode.h> | ||
36 | 38 | ||
37 | #include "powernv.h" | 39 | #include "powernv.h" |
38 | 40 | ||
@@ -149,7 +151,7 @@ static int pnv_smp_cpu_disable(void) | |||
149 | static void pnv_smp_cpu_kill_self(void) | 151 | static void pnv_smp_cpu_kill_self(void) |
150 | { | 152 | { |
151 | unsigned int cpu; | 153 | unsigned int cpu; |
152 | unsigned long srr1; | 154 | unsigned long srr1, wmask; |
153 | u32 idle_states; | 155 | u32 idle_states; |
154 | 156 | ||
155 | /* Standard hot unplug procedure */ | 157 | /* Standard hot unplug procedure */ |
@@ -161,6 +163,10 @@ static void pnv_smp_cpu_kill_self(void) | |||
161 | generic_set_cpu_dead(cpu); | 163 | generic_set_cpu_dead(cpu); |
162 | smp_wmb(); | 164 | smp_wmb(); |
163 | 165 | ||
166 | wmask = SRR1_WAKEMASK; | ||
167 | if (cpu_has_feature(CPU_FTR_ARCH_207S)) | ||
168 | wmask = SRR1_WAKEMASK_P8; | ||
169 | |||
164 | idle_states = pnv_get_supported_cpuidle_states(); | 170 | idle_states = pnv_get_supported_cpuidle_states(); |
165 | /* We don't want to take decrementer interrupts while we are offline, | 171 | /* We don't want to take decrementer interrupts while we are offline, |
166 | * so clear LPCR:PECE1. We keep PECE2 enabled. | 172 | * so clear LPCR:PECE1. We keep PECE2 enabled. |
@@ -191,10 +197,14 @@ static void pnv_smp_cpu_kill_self(void) | |||
191 | * having finished executing in a KVM guest, then srr1 | 197 | * having finished executing in a KVM guest, then srr1 |
192 | * contains 0. | 198 | * contains 0. |
193 | */ | 199 | */ |
194 | if ((srr1 & SRR1_WAKEMASK) == SRR1_WAKEEE) { | 200 | if ((srr1 & wmask) == SRR1_WAKEEE) { |
195 | icp_native_flush_interrupt(); | 201 | icp_native_flush_interrupt(); |
196 | local_paca->irq_happened &= PACA_IRQ_HARD_DIS; | 202 | local_paca->irq_happened &= PACA_IRQ_HARD_DIS; |
197 | smp_mb(); | 203 | smp_mb(); |
204 | } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) { | ||
205 | unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER); | ||
206 | asm volatile(PPC_MSGCLR(%0) : : "r" (msg)); | ||
207 | kvmppc_set_host_ipi(cpu, 0); | ||
198 | } | 208 | } |
199 | 209 | ||
200 | if (cpu_core_split_required()) | 210 | if (cpu_core_split_required()) |
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c index 90cf3dcbd9f2..8f35d525cede 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c | |||
@@ -25,10 +25,10 @@ | |||
25 | static struct kobject *mobility_kobj; | 25 | static struct kobject *mobility_kobj; |
26 | 26 | ||
27 | struct update_props_workarea { | 27 | struct update_props_workarea { |
28 | u32 phandle; | 28 | __be32 phandle; |
29 | u32 state; | 29 | __be32 state; |
30 | u64 reserved; | 30 | __be64 reserved; |
31 | u32 nprops; | 31 | __be32 nprops; |
32 | } __packed; | 32 | } __packed; |
33 | 33 | ||
34 | #define NODE_ACTION_MASK 0xff000000 | 34 | #define NODE_ACTION_MASK 0xff000000 |
@@ -54,11 +54,11 @@ static int mobility_rtas_call(int token, char *buf, s32 scope) | |||
54 | return rc; | 54 | return rc; |
55 | } | 55 | } |
56 | 56 | ||
57 | static int delete_dt_node(u32 phandle) | 57 | static int delete_dt_node(__be32 phandle) |
58 | { | 58 | { |
59 | struct device_node *dn; | 59 | struct device_node *dn; |
60 | 60 | ||
61 | dn = of_find_node_by_phandle(phandle); | 61 | dn = of_find_node_by_phandle(be32_to_cpu(phandle)); |
62 | if (!dn) | 62 | if (!dn) |
63 | return -ENOENT; | 63 | return -ENOENT; |
64 | 64 | ||
@@ -127,7 +127,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop, | |||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | static int update_dt_node(u32 phandle, s32 scope) | 130 | static int update_dt_node(__be32 phandle, s32 scope) |
131 | { | 131 | { |
132 | struct update_props_workarea *upwa; | 132 | struct update_props_workarea *upwa; |
133 | struct device_node *dn; | 133 | struct device_node *dn; |
@@ -136,6 +136,7 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
136 | char *prop_data; | 136 | char *prop_data; |
137 | char *rtas_buf; | 137 | char *rtas_buf; |
138 | int update_properties_token; | 138 | int update_properties_token; |
139 | u32 nprops; | ||
139 | u32 vd; | 140 | u32 vd; |
140 | 141 | ||
141 | update_properties_token = rtas_token("ibm,update-properties"); | 142 | update_properties_token = rtas_token("ibm,update-properties"); |
@@ -146,7 +147,7 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
146 | if (!rtas_buf) | 147 | if (!rtas_buf) |
147 | return -ENOMEM; | 148 | return -ENOMEM; |
148 | 149 | ||
149 | dn = of_find_node_by_phandle(phandle); | 150 | dn = of_find_node_by_phandle(be32_to_cpu(phandle)); |
150 | if (!dn) { | 151 | if (!dn) { |
151 | kfree(rtas_buf); | 152 | kfree(rtas_buf); |
152 | return -ENOENT; | 153 | return -ENOENT; |
@@ -162,6 +163,7 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
162 | break; | 163 | break; |
163 | 164 | ||
164 | prop_data = rtas_buf + sizeof(*upwa); | 165 | prop_data = rtas_buf + sizeof(*upwa); |
166 | nprops = be32_to_cpu(upwa->nprops); | ||
165 | 167 | ||
166 | /* On the first call to ibm,update-properties for a node the | 168 | /* On the first call to ibm,update-properties for a node the |
167 | * the first property value descriptor contains an empty | 169 | * the first property value descriptor contains an empty |
@@ -170,17 +172,17 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
170 | */ | 172 | */ |
171 | if (*prop_data == 0) { | 173 | if (*prop_data == 0) { |
172 | prop_data++; | 174 | prop_data++; |
173 | vd = *(u32 *)prop_data; | 175 | vd = be32_to_cpu(*(__be32 *)prop_data); |
174 | prop_data += vd + sizeof(vd); | 176 | prop_data += vd + sizeof(vd); |
175 | upwa->nprops--; | 177 | nprops--; |
176 | } | 178 | } |
177 | 179 | ||
178 | for (i = 0; i < upwa->nprops; i++) { | 180 | for (i = 0; i < nprops; i++) { |
179 | char *prop_name; | 181 | char *prop_name; |
180 | 182 | ||
181 | prop_name = prop_data; | 183 | prop_name = prop_data; |
182 | prop_data += strlen(prop_name) + 1; | 184 | prop_data += strlen(prop_name) + 1; |
183 | vd = *(u32 *)prop_data; | 185 | vd = be32_to_cpu(*(__be32 *)prop_data); |
184 | prop_data += sizeof(vd); | 186 | prop_data += sizeof(vd); |
185 | 187 | ||
186 | switch (vd) { | 188 | switch (vd) { |
@@ -212,13 +214,13 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
212 | return 0; | 214 | return 0; |
213 | } | 215 | } |
214 | 216 | ||
215 | static int add_dt_node(u32 parent_phandle, u32 drc_index) | 217 | static int add_dt_node(__be32 parent_phandle, __be32 drc_index) |
216 | { | 218 | { |
217 | struct device_node *dn; | 219 | struct device_node *dn; |
218 | struct device_node *parent_dn; | 220 | struct device_node *parent_dn; |
219 | int rc; | 221 | int rc; |
220 | 222 | ||
221 | parent_dn = of_find_node_by_phandle(parent_phandle); | 223 | parent_dn = of_find_node_by_phandle(be32_to_cpu(parent_phandle)); |
222 | if (!parent_dn) | 224 | if (!parent_dn) |
223 | return -ENOENT; | 225 | return -ENOENT; |
224 | 226 | ||
@@ -237,7 +239,7 @@ static int add_dt_node(u32 parent_phandle, u32 drc_index) | |||
237 | int pseries_devicetree_update(s32 scope) | 239 | int pseries_devicetree_update(s32 scope) |
238 | { | 240 | { |
239 | char *rtas_buf; | 241 | char *rtas_buf; |
240 | u32 *data; | 242 | __be32 *data; |
241 | int update_nodes_token; | 243 | int update_nodes_token; |
242 | int rc; | 244 | int rc; |
243 | 245 | ||
@@ -254,17 +256,17 @@ int pseries_devicetree_update(s32 scope) | |||
254 | if (rc && rc != 1) | 256 | if (rc && rc != 1) |
255 | break; | 257 | break; |
256 | 258 | ||
257 | data = (u32 *)rtas_buf + 4; | 259 | data = (__be32 *)rtas_buf + 4; |
258 | while (*data & NODE_ACTION_MASK) { | 260 | while (be32_to_cpu(*data) & NODE_ACTION_MASK) { |
259 | int i; | 261 | int i; |
260 | u32 action = *data & NODE_ACTION_MASK; | 262 | u32 action = be32_to_cpu(*data) & NODE_ACTION_MASK; |
261 | int node_count = *data & NODE_COUNT_MASK; | 263 | u32 node_count = be32_to_cpu(*data) & NODE_COUNT_MASK; |
262 | 264 | ||
263 | data++; | 265 | data++; |
264 | 266 | ||
265 | for (i = 0; i < node_count; i++) { | 267 | for (i = 0; i < node_count; i++) { |
266 | u32 phandle = *data++; | 268 | __be32 phandle = *data++; |
267 | u32 drc_index; | 269 | __be32 drc_index; |
268 | 270 | ||
269 | switch (action) { | 271 | switch (action) { |
270 | case DELETE_DT_NODE: | 272 | case DELETE_DT_NODE: |