aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
commit0cb7bf61b1e9f05027de58c80f9b46a714d24e35 (patch)
tree41fb55cf62d07b425122f9a8b96412c0d8eb99c5 /arch/powerpc
parentaa877175e7a9982233ed8f10cb4bfddd78d82741 (diff)
parent3eab887a55424fc2c27553b7bfe32330df83f7b8 (diff)
Merge branch 'linus' into smp/hotplug
Apply upstream changes to avoid conflicts with pending patches.
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Makefile22
-rw-r--r--arch/powerpc/crypto/crc32c-vpmsum_glue.c3
-rw-r--r--arch/powerpc/include/asm/cpuidle.h13
-rw-r--r--arch/powerpc/include/asm/feature-fixups.h1
-rw-r--r--arch/powerpc/include/asm/switch_to.h8
-rw-r--r--arch/powerpc/include/asm/xics.h2
-rw-r--r--arch/powerpc/kernel/eeh.c4
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S69
-rw-r--r--arch/powerpc/kernel/idle_book3s.S17
-rw-r--r--arch/powerpc/kernel/mce.c3
-rw-r--r--arch/powerpc/kernel/pci-common.c7
-rw-r--r--arch/powerpc/kernel/process.c20
-rw-r--r--arch/powerpc/kernel/prom_init.c2
-rw-r--r--arch/powerpc/kernel/ptrace.c19
-rw-r--r--arch/powerpc/kernel/setup_32.c9
-rw-r--r--arch/powerpc/kernel/setup_64.c1
-rw-r--r--arch/powerpc/kernel/vdso.c1
-rw-r--r--arch/powerpc/kernel/vdso32/Makefile6
-rw-r--r--arch/powerpc/kernel/vdso64/Makefile6
-rw-r--r--arch/powerpc/kvm/book3s_xics.c12
-rw-r--r--arch/powerpc/lib/checksum_32.S7
-rw-r--r--arch/powerpc/lib/feature-fixups.c3
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c4
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c5
-rw-r--r--arch/powerpc/platforms/powernv/opal-irqchip.c3
-rw-r--r--arch/powerpc/platforms/powernv/opal.c1
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c32
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c26
-rw-r--r--arch/powerpc/sysdev/xics/Kconfig1
-rw-r--r--arch/powerpc/sysdev/xics/ics-opal.c4
-rw-r--r--arch/powerpc/sysdev/xics/ics-rtas.c4
-rw-r--r--arch/powerpc/sysdev/xics/xics-common.c59
32 files changed, 235 insertions, 139 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index ca254546cd05..1934707bf321 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -66,29 +66,28 @@ endif
66UTS_MACHINE := $(OLDARCH) 66UTS_MACHINE := $(OLDARCH)
67 67
68ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) 68ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
69override CC += -mlittle-endian
70ifneq ($(cc-name),clang)
71override CC += -mno-strict-align
72endif
73override AS += -mlittle-endian
74override LD += -EL 69override LD += -EL
75override CROSS32CC += -mlittle-endian
76override CROSS32AS += -mlittle-endian 70override CROSS32AS += -mlittle-endian
77LDEMULATION := lppc 71LDEMULATION := lppc
78GNUTARGET := powerpcle 72GNUTARGET := powerpcle
79MULTIPLEWORD := -mno-multiple 73MULTIPLEWORD := -mno-multiple
80KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) 74KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
81else 75else
82ifeq ($(call cc-option-yn,-mbig-endian),y)
83override CC += -mbig-endian
84override AS += -mbig-endian
85endif
86override LD += -EB 76override LD += -EB
87LDEMULATION := ppc 77LDEMULATION := ppc
88GNUTARGET := powerpc 78GNUTARGET := powerpc
89MULTIPLEWORD := -mmultiple 79MULTIPLEWORD := -mmultiple
90endif 80endif
91 81
82cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
83cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
84ifneq ($(cc-name),clang)
85 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align
86endif
87
88aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
89aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
90
92ifeq ($(HAS_BIARCH),y) 91ifeq ($(HAS_BIARCH),y)
93override AS += -a$(CONFIG_WORD_SIZE) 92override AS += -a$(CONFIG_WORD_SIZE)
94override LD += -m elf$(CONFIG_WORD_SIZE)$(LDEMULATION) 93override LD += -m elf$(CONFIG_WORD_SIZE)$(LDEMULATION)
@@ -232,6 +231,9 @@ cpu-as-$(CONFIG_E200) += -Wa,-me200
232KBUILD_AFLAGS += $(cpu-as-y) 231KBUILD_AFLAGS += $(cpu-as-y)
233KBUILD_CFLAGS += $(cpu-as-y) 232KBUILD_CFLAGS += $(cpu-as-y)
234 233
234KBUILD_AFLAGS += $(aflags-y)
235KBUILD_CFLAGS += $(cflags-y)
236
235head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o 237head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o
236head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o 238head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o
237head-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o 239head-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o
diff --git a/arch/powerpc/crypto/crc32c-vpmsum_glue.c b/arch/powerpc/crypto/crc32c-vpmsum_glue.c
index bfe3d37a24ef..9fa046d56eba 100644
--- a/arch/powerpc/crypto/crc32c-vpmsum_glue.c
+++ b/arch/powerpc/crypto/crc32c-vpmsum_glue.c
@@ -4,6 +4,7 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/string.h> 5#include <linux/string.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/cpufeature.h>
7#include <asm/switch_to.h> 8#include <asm/switch_to.h>
8 9
9#define CHKSUM_BLOCK_SIZE 1 10#define CHKSUM_BLOCK_SIZE 1
@@ -157,7 +158,7 @@ static void __exit crc32c_vpmsum_mod_fini(void)
157 crypto_unregister_shash(&alg); 158 crypto_unregister_shash(&alg);
158} 159}
159 160
160module_init(crc32c_vpmsum_mod_init); 161module_cpu_feature_match(PPC_MODULE_FEATURE_VEC_CRYPTO, crc32c_vpmsum_mod_init);
161module_exit(crc32c_vpmsum_mod_fini); 162module_exit(crc32c_vpmsum_mod_fini);
162 163
163MODULE_AUTHOR("Anton Blanchard <anton@samba.org>"); 164MODULE_AUTHOR("Anton Blanchard <anton@samba.org>");
diff --git a/arch/powerpc/include/asm/cpuidle.h b/arch/powerpc/include/asm/cpuidle.h
index 3d7fc06532a1..01b8a13f0224 100644
--- a/arch/powerpc/include/asm/cpuidle.h
+++ b/arch/powerpc/include/asm/cpuidle.h
@@ -19,4 +19,17 @@ extern u64 pnv_first_deep_stop_state;
19 19
20#endif 20#endif
21 21
22/* Idle state entry routines */
23#ifdef CONFIG_PPC_P7_NAP
24#define IDLE_STATE_ENTER_SEQ(IDLE_INST) \
25 /* Magic NAP/SLEEP/WINKLE mode enter sequence */ \
26 std r0,0(r1); \
27 ptesync; \
28 ld r0,0(r1); \
291: cmp cr0,r0,r0; \
30 bne 1b; \
31 IDLE_INST; \
32 b .
33#endif /* CONFIG_PPC_P7_NAP */
34
22#endif 35#endif
diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h
index 57fec8ac7b92..ddf54f5bbdd1 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -186,6 +186,7 @@ label##3: \
186 186
187#ifndef __ASSEMBLY__ 187#ifndef __ASSEMBLY__
188void apply_feature_fixups(void); 188void apply_feature_fixups(void);
189void setup_feature_keys(void);
189#endif 190#endif
190 191
191#endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */ 192#endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 0a74ebe934e1..17c8380673a6 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -75,14 +75,6 @@ static inline void disable_kernel_spe(void)
75static inline void __giveup_spe(struct task_struct *t) { } 75static inline void __giveup_spe(struct task_struct *t) { }
76#endif 76#endif
77 77
78#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
79extern void flush_tmregs_to_thread(struct task_struct *);
80#else
81static inline void flush_tmregs_to_thread(struct task_struct *t)
82{
83}
84#endif
85
86static inline void clear_task_ebb(struct task_struct *t) 78static inline void clear_task_ebb(struct task_struct *t)
87{ 79{
88#ifdef CONFIG_PPC_BOOK3S_64 80#ifdef CONFIG_PPC_BOOK3S_64
diff --git a/arch/powerpc/include/asm/xics.h b/arch/powerpc/include/asm/xics.h
index f5f729c11578..f0b238516e9b 100644
--- a/arch/powerpc/include/asm/xics.h
+++ b/arch/powerpc/include/asm/xics.h
@@ -159,6 +159,8 @@ extern void xics_teardown_cpu(void);
159extern void xics_kexec_teardown_cpu(int secondary); 159extern void xics_kexec_teardown_cpu(int secondary);
160extern void xics_migrate_irqs_away(void); 160extern void xics_migrate_irqs_away(void);
161extern void icp_native_eoi(struct irq_data *d); 161extern void icp_native_eoi(struct irq_data *d);
162extern int xics_set_irq_type(struct irq_data *d, unsigned int flow_type);
163extern int xics_retrigger(struct irq_data *data);
162#ifdef CONFIG_SMP 164#ifdef CONFIG_SMP
163extern int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask, 165extern int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask,
164 unsigned int strict_check); 166 unsigned int strict_check);
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index c9bc78e9c610..7429556eb8df 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -168,10 +168,10 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)
168 int n = 0, l = 0; 168 int n = 0, l = 0;
169 char buffer[128]; 169 char buffer[128];
170 170
171 n += scnprintf(buf+n, len-n, "%04x:%02x:%02x:%01x\n", 171 n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n",
172 edev->phb->global_number, pdn->busno, 172 edev->phb->global_number, pdn->busno,
173 PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); 173 PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
174 pr_warn("EEH: of node=%04x:%02x:%02x:%01x\n", 174 pr_warn("EEH: of node=%04x:%02x:%02x.%01x\n",
175 edev->phb->global_number, pdn->busno, 175 edev->phb->global_number, pdn->busno,
176 PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); 176 PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
177 177
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 41091fdf9bd8..df6d45eb4115 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -144,29 +144,14 @@ machine_check_pSeries_1:
144 * vector 144 * vector
145 */ 145 */
146 SET_SCRATCH0(r13) /* save r13 */ 146 SET_SCRATCH0(r13) /* save r13 */
147#ifdef CONFIG_PPC_P7_NAP 147 /*
148BEGIN_FTR_SECTION 148 * Running native on arch 2.06 or later, we may wakeup from winkle
149 /* Running native on arch 2.06 or later, check if we are 149 * inside machine check. If yes, then last bit of HSPGR0 would be set
150 * waking up from nap. We only handle no state loss and 150 * to 1. Hence clear it unconditionally.
151 * supervisor state loss. We do -not- handle hypervisor
152 * state loss at this time.
153 */ 151 */
154 mfspr r13,SPRN_SRR1 152 GET_PACA(r13)
155 rlwinm. r13,r13,47-31,30,31 153 clrrdi r13,r13,1
156 OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR) 154 SET_PACA(r13)
157 beq 9f
158
159 mfspr r13,SPRN_SRR1
160 rlwinm. r13,r13,47-31,30,31
161 /* waking up from powersave (nap) state */
162 cmpwi cr1,r13,2
163 /* Total loss of HV state is fatal. let's just stay stuck here */
164 OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
165 bgt cr1,.
1669:
167 OPT_SET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
168END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
169#endif /* CONFIG_PPC_P7_NAP */
170 EXCEPTION_PROLOG_0(PACA_EXMC) 155 EXCEPTION_PROLOG_0(PACA_EXMC)
171BEGIN_FTR_SECTION 156BEGIN_FTR_SECTION
172 b machine_check_powernv_early 157 b machine_check_powernv_early
@@ -1273,25 +1258,51 @@ machine_check_handle_early:
1273 * Check if thread was in power saving mode. We come here when any 1258 * Check if thread was in power saving mode. We come here when any
1274 * of the following is true: 1259 * of the following is true:
1275 * a. thread wasn't in power saving mode 1260 * a. thread wasn't in power saving mode
1276 * b. thread was in power saving mode with no state loss or 1261 * b. thread was in power saving mode with no state loss,
1277 * supervisor state loss 1262 * supervisor state loss or hypervisor state loss.
1278 * 1263 *
1279 * Go back to nap again if (b) is true. 1264 * Go back to nap/sleep/winkle mode again if (b) is true.
1280 */ 1265 */
1281 rlwinm. r11,r12,47-31,30,31 /* Was it in power saving mode? */ 1266 rlwinm. r11,r12,47-31,30,31 /* Was it in power saving mode? */
1282 beq 4f /* No, it wasn;t */ 1267 beq 4f /* No, it wasn;t */
1283 /* Thread was in power saving mode. Go back to nap again. */ 1268 /* Thread was in power saving mode. Go back to nap again. */
1284 cmpwi r11,2 1269 cmpwi r11,2
1285 bne 3f 1270 blt 3f
1286 /* Supervisor state loss */ 1271 /* Supervisor/Hypervisor state loss */
1287 li r0,1 1272 li r0,1
1288 stb r0,PACA_NAPSTATELOST(r13) 1273 stb r0,PACA_NAPSTATELOST(r13)
12893: bl machine_check_queue_event 12743: bl machine_check_queue_event
1290 MACHINE_CHECK_HANDLER_WINDUP 1275 MACHINE_CHECK_HANDLER_WINDUP
1291 GET_PACA(r13) 1276 GET_PACA(r13)
1292 ld r1,PACAR1(r13) 1277 ld r1,PACAR1(r13)
1293 li r3,PNV_THREAD_NAP 1278 /*
1294 b pnv_enter_arch207_idle_mode 1279 * Check what idle state this CPU was in and go back to same mode
1280 * again.
1281 */
1282 lbz r3,PACA_THREAD_IDLE_STATE(r13)
1283 cmpwi r3,PNV_THREAD_NAP
1284 bgt 10f
1285 IDLE_STATE_ENTER_SEQ(PPC_NAP)
1286 /* No return */
128710:
1288 cmpwi r3,PNV_THREAD_SLEEP
1289 bgt 2f
1290 IDLE_STATE_ENTER_SEQ(PPC_SLEEP)
1291 /* No return */
1292
12932:
1294 /*
1295 * Go back to winkle. Please note that this thread was woken up in
1296 * machine check from winkle and have not restored the per-subcore
1297 * state. Hence before going back to winkle, set last bit of HSPGR0
1298 * to 1. This will make sure that if this thread gets woken up
1299 * again at reset vector 0x100 then it will get chance to restore
1300 * the subcore state.
1301 */
1302 ori r13,r13,1
1303 SET_PACA(r13)
1304 IDLE_STATE_ENTER_SEQ(PPC_WINKLE)
1305 /* No return */
12954: 13064:
1296#endif 1307#endif
1297 /* 1308 /*
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index ba79d15f4ddd..2265c6398a17 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -44,18 +44,6 @@
44 PSSCR_PSLL_MASK | PSSCR_TR_MASK | \ 44 PSSCR_PSLL_MASK | PSSCR_TR_MASK | \
45 PSSCR_MTL_MASK 45 PSSCR_MTL_MASK
46 46
47/* Idle state entry routines */
48
49#define IDLE_STATE_ENTER_SEQ(IDLE_INST) \
50 /* Magic NAP/SLEEP/WINKLE mode enter sequence */ \
51 std r0,0(r1); \
52 ptesync; \
53 ld r0,0(r1); \
541: cmp cr0,r0,r0; \
55 bne 1b; \
56 IDLE_INST; \
57 b .
58
59 .text 47 .text
60 48
61/* 49/*
@@ -363,8 +351,8 @@ _GLOBAL(power9_idle_stop)
363 * cr3 - set to gt if waking up with partial/complete hypervisor state loss 351 * cr3 - set to gt if waking up with partial/complete hypervisor state loss
364 */ 352 */
365_GLOBAL(pnv_restore_hyp_resource) 353_GLOBAL(pnv_restore_hyp_resource)
366 ld r2,PACATOC(r13);
367BEGIN_FTR_SECTION 354BEGIN_FTR_SECTION
355 ld r2,PACATOC(r13);
368 /* 356 /*
369 * POWER ISA 3. Use PSSCR to determine if we 357 * POWER ISA 3. Use PSSCR to determine if we
370 * are waking up from deep idle state 358 * are waking up from deep idle state
@@ -395,6 +383,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
395 */ 383 */
396 clrldi r5,r13,63 384 clrldi r5,r13,63
397 clrrdi r13,r13,1 385 clrrdi r13,r13,1
386
387 /* Now that we are sure r13 is corrected, load TOC */
388 ld r2,PACATOC(r13);
398 cmpwi cr4,r5,1 389 cmpwi cr4,r5,1
399 mtspr SPRN_HSPRG0,r13 390 mtspr SPRN_HSPRG0,r13
400 391
diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
index ef267fd9dd22..5e7ece0fda9f 100644
--- a/arch/powerpc/kernel/mce.c
+++ b/arch/powerpc/kernel/mce.c
@@ -92,7 +92,8 @@ void save_mce_event(struct pt_regs *regs, long handled,
92 mce->in_use = 1; 92 mce->in_use = 1;
93 93
94 mce->initiator = MCE_INITIATOR_CPU; 94 mce->initiator = MCE_INITIATOR_CPU;
95 if (handled) 95 /* Mark it recovered if we have handled it and MSR(RI=1). */
96 if (handled && (regs->msr & MSR_RI))
96 mce->disposition = MCE_DISPOSITION_RECOVERED; 97 mce->disposition = MCE_DISPOSITION_RECOVERED;
97 else 98 else
98 mce->disposition = MCE_DISPOSITION_NOT_RECOVERED; 99 mce->disposition = MCE_DISPOSITION_NOT_RECOVERED;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index a5c0153ede37..7fdf324d5b51 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -78,6 +78,7 @@ EXPORT_SYMBOL(get_pci_dma_ops);
78static int get_phb_number(struct device_node *dn) 78static int get_phb_number(struct device_node *dn)
79{ 79{
80 int ret, phb_id = -1; 80 int ret, phb_id = -1;
81 u32 prop_32;
81 u64 prop; 82 u64 prop;
82 83
83 /* 84 /*
@@ -86,8 +87,10 @@ static int get_phb_number(struct device_node *dn)
86 * reading "ibm,opal-phbid", only present in OPAL environment. 87 * reading "ibm,opal-phbid", only present in OPAL environment.
87 */ 88 */
88 ret = of_property_read_u64(dn, "ibm,opal-phbid", &prop); 89 ret = of_property_read_u64(dn, "ibm,opal-phbid", &prop);
89 if (ret) 90 if (ret) {
90 ret = of_property_read_u32_index(dn, "reg", 1, (u32 *)&prop); 91 ret = of_property_read_u32_index(dn, "reg", 1, &prop_32);
92 prop = prop_32;
93 }
91 94
92 if (!ret) 95 if (!ret)
93 phb_id = (int)(prop & (MAX_PHBS - 1)); 96 phb_id = (int)(prop & (MAX_PHBS - 1));
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 58ccf86415b4..9ee2623e0f67 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1074,26 +1074,6 @@ static inline void restore_sprs(struct thread_struct *old_thread,
1074#endif 1074#endif
1075} 1075}
1076 1076
1077#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1078void flush_tmregs_to_thread(struct task_struct *tsk)
1079{
1080 /*
1081 * Process self tracing is not yet supported through
1082 * ptrace interface. Ptrace generic code should have
1083 * prevented this from happening in the first place.
1084 * Warn once here with the message, if some how it
1085 * is attempted.
1086 */
1087 WARN_ONCE(tsk == current,
1088 "Not expecting ptrace on self: TM regs may be incorrect\n");
1089
1090 /*
1091 * If task is not current, it should have been flushed
1092 * already to it's thread_struct during __switch_to().
1093 */
1094}
1095#endif
1096
1097struct task_struct *__switch_to(struct task_struct *prev, 1077struct task_struct *__switch_to(struct task_struct *prev,
1098 struct task_struct *new) 1078 struct task_struct *new)
1099{ 1079{
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 6ee4b72cda42..4e74fc588a3f 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2940,7 +2940,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2940 2940
2941 /* Don't print anything after quiesce under OPAL, it crashes OFW */ 2941 /* Don't print anything after quiesce under OPAL, it crashes OFW */
2942 if (of_platform != PLATFORM_OPAL) { 2942 if (of_platform != PLATFORM_OPAL) {
2943 prom_printf("Booting Linux via __start() ...\n"); 2943 prom_printf("Booting Linux via __start() @ 0x%lx ...\n", kbase);
2944 prom_debug("->dt_header_start=0x%x\n", hdr); 2944 prom_debug("->dt_header_start=0x%x\n", hdr);
2945 } 2945 }
2946 2946
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 4f3c5756cc09..bf91658a8a40 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -38,6 +38,7 @@
38#include <asm/page.h> 38#include <asm/page.h>
39#include <asm/pgtable.h> 39#include <asm/pgtable.h>
40#include <asm/switch_to.h> 40#include <asm/switch_to.h>
41#include <asm/tm.h>
41 42
42#define CREATE_TRACE_POINTS 43#define CREATE_TRACE_POINTS
43#include <trace/events/syscalls.h> 44#include <trace/events/syscalls.h>
@@ -118,6 +119,24 @@ static const struct pt_regs_offset regoffset_table[] = {
118 REG_OFFSET_END, 119 REG_OFFSET_END,
119}; 120};
120 121
122#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
123static void flush_tmregs_to_thread(struct task_struct *tsk)
124{
125 /*
126 * If task is not current, it will have been flushed already to
127 * it's thread_struct during __switch_to().
128 *
129 * A reclaim flushes ALL the state.
130 */
131
132 if (tsk == current && MSR_TM_SUSPENDED(mfmsr()))
133 tm_reclaim_current(TM_CAUSE_SIGNAL);
134
135}
136#else
137static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }
138#endif
139
121/** 140/**
122 * regs_query_register_offset() - query register offset from its name 141 * regs_query_register_offset() - query register offset from its name
123 * @name: the name of a register 142 * @name: the name of a register
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index c3e861df4b20..24ec3ea4b3a2 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -93,15 +93,16 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
93 * and we are running with enough of the MMU enabled to have our 93 * and we are running with enough of the MMU enabled to have our
94 * proper kernel virtual addresses 94 * proper kernel virtual addresses
95 * 95 *
96 * Find out what kind of machine we're on and save any data we need 96 * We do the initial parsing of the flat device-tree and prepares
97 * from the early boot process (devtree is copied on pmac by prom_init()). 97 * for the MMU to be fully initialized.
98 * This is called very early on the boot process, after a minimal
99 * MMU environment has been set up but before MMU_init is called.
100 */ 98 */
101extern unsigned int memset_nocache_branch; /* Insn to be replaced by NOP */ 99extern unsigned int memset_nocache_branch; /* Insn to be replaced by NOP */
102 100
103notrace void __init machine_init(u64 dt_ptr) 101notrace void __init machine_init(u64 dt_ptr)
104{ 102{
103 /* Configure static keys first, now that we're relocated. */
104 setup_feature_keys();
105
105 /* Enable early debugging if any specified (see udbg.h) */ 106 /* Enable early debugging if any specified (see udbg.h) */
106 udbg_early_init(); 107 udbg_early_init();
107 108
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index eafb9a79e011..7ac8e6eaab5b 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -300,6 +300,7 @@ void __init early_setup(unsigned long dt_ptr)
300 300
301 /* Apply all the dynamic patching */ 301 /* Apply all the dynamic patching */
302 apply_feature_fixups(); 302 apply_feature_fixups();
303 setup_feature_keys();
303 304
304 /* Initialize the hash table or TLB handling */ 305 /* Initialize the hash table or TLB handling */
305 early_init_mmu(); 306 early_init_mmu();
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 6767605ea8da..4111d30badfa 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -22,6 +22,7 @@
22#include <linux/security.h> 22#include <linux/security.h>
23#include <linux/memblock.h> 23#include <linux/memblock.h>
24 24
25#include <asm/cpu_has_feature.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/processor.h> 27#include <asm/processor.h>
27#include <asm/mmu.h> 28#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index cbabd143acae..78a7449bf489 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -30,7 +30,7 @@ CPPFLAGS_vdso32.lds += -P -C -Upowerpc
30$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so 30$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
31 31
32# link rule for the .so file, .lds has to be first 32# link rule for the .so file, .lds has to be first
33$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) 33$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE
34 $(call if_changed,vdso32ld) 34 $(call if_changed,vdso32ld)
35 35
36# strip rule for the .so file 36# strip rule for the .so file
@@ -39,12 +39,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
39 $(call if_changed,objcopy) 39 $(call if_changed,objcopy)
40 40
41# assembly rules for the .S files 41# assembly rules for the .S files
42$(obj-vdso32): %.o: %.S 42$(obj-vdso32): %.o: %.S FORCE
43 $(call if_changed_dep,vdso32as) 43 $(call if_changed_dep,vdso32as)
44 44
45# actual build commands 45# actual build commands
46quiet_cmd_vdso32ld = VDSO32L $@ 46quiet_cmd_vdso32ld = VDSO32L $@
47 cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $^ -o $@ 47 cmd_vdso32ld = $(CROSS32CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
48quiet_cmd_vdso32as = VDSO32A $@ 48quiet_cmd_vdso32as = VDSO32A $@
49 cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $< 49 cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
50 50
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index c710802b8fb6..366ae09b14c1 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -23,7 +23,7 @@ CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
23$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so 23$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so
24 24
25# link rule for the .so file, .lds has to be first 25# link rule for the .so file, .lds has to be first
26$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) 26$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE
27 $(call if_changed,vdso64ld) 27 $(call if_changed,vdso64ld)
28 28
29# strip rule for the .so file 29# strip rule for the .so file
@@ -32,12 +32,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
32 $(call if_changed,objcopy) 32 $(call if_changed,objcopy)
33 33
34# assembly rules for the .S files 34# assembly rules for the .S files
35$(obj-vdso64): %.o: %.S 35$(obj-vdso64): %.o: %.S FORCE
36 $(call if_changed_dep,vdso64as) 36 $(call if_changed_dep,vdso64as)
37 37
38# actual build commands 38# actual build commands
39quiet_cmd_vdso64ld = VDSO64L $@ 39quiet_cmd_vdso64ld = VDSO64L $@
40 cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ 40 cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
41quiet_cmd_vdso64as = VDSO64A $@ 41quiet_cmd_vdso64as = VDSO64A $@
42 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< 42 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
43 43
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index a75ba38a2d81..05aa11399a78 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1329,20 +1329,16 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
1329 xics->kvm = kvm; 1329 xics->kvm = kvm;
1330 1330
1331 /* Already there ? */ 1331 /* Already there ? */
1332 mutex_lock(&kvm->lock);
1333 if (kvm->arch.xics) 1332 if (kvm->arch.xics)
1334 ret = -EEXIST; 1333 ret = -EEXIST;
1335 else 1334 else
1336 kvm->arch.xics = xics; 1335 kvm->arch.xics = xics;
1337 mutex_unlock(&kvm->lock);
1338 1336
1339 if (ret) { 1337 if (ret) {
1340 kfree(xics); 1338 kfree(xics);
1341 return ret; 1339 return ret;
1342 } 1340 }
1343 1341
1344 xics_debugfs_init(xics);
1345
1346#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE 1342#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
1347 if (cpu_has_feature(CPU_FTR_ARCH_206)) { 1343 if (cpu_has_feature(CPU_FTR_ARCH_206)) {
1348 /* Enable real mode support */ 1344 /* Enable real mode support */
@@ -1354,9 +1350,17 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
1354 return 0; 1350 return 0;
1355} 1351}
1356 1352
1353static void kvmppc_xics_init(struct kvm_device *dev)
1354{
1355 struct kvmppc_xics *xics = (struct kvmppc_xics *)dev->private;
1356
1357 xics_debugfs_init(xics);
1358}
1359
1357struct kvm_device_ops kvm_xics_ops = { 1360struct kvm_device_ops kvm_xics_ops = {
1358 .name = "kvm-xics", 1361 .name = "kvm-xics",
1359 .create = kvmppc_xics_create, 1362 .create = kvmppc_xics_create,
1363 .init = kvmppc_xics_init,
1360 .destroy = kvmppc_xics_free, 1364 .destroy = kvmppc_xics_free,
1361 .set_attr = xics_set_attr, 1365 .set_attr = xics_set_attr,
1362 .get_attr = xics_get_attr, 1366 .get_attr = xics_get_attr,
diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S
index d90870a66b60..0a57fe6d49cc 100644
--- a/arch/powerpc/lib/checksum_32.S
+++ b/arch/powerpc/lib/checksum_32.S
@@ -127,8 +127,9 @@ _GLOBAL(csum_partial_copy_generic)
127 stw r7,12(r1) 127 stw r7,12(r1)
128 stw r8,8(r1) 128 stw r8,8(r1)
129 129
130 andi. r0,r4,1 /* is destination address even ? */ 130 rlwinm r0,r4,3,0x8
131 cmplwi cr7,r0,0 131 rlwnm r6,r6,r0,0,31 /* odd destination address: rotate one byte */
132 cmplwi cr7,r0,0 /* is destination address even ? */
132 addic r12,r6,0 133 addic r12,r6,0
133 addi r6,r4,-4 134 addi r6,r4,-4
134 neg r0,r4 135 neg r0,r4
@@ -237,7 +238,7 @@ _GLOBAL(csum_partial_copy_generic)
23766: addze r3,r12 23866: addze r3,r12
238 addi r1,r1,16 239 addi r1,r1,16
239 beqlr+ cr7 240 beqlr+ cr7
240 rlwinm r3,r3,8,0,31 /* swap bytes for odd destination */ 241 rlwinm r3,r3,8,0,31 /* odd destination address: rotate one byte */
241 blr 242 blr
242 243
243/* read fault */ 244/* read fault */
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
index 74145f02ad41..043415f0bdb1 100644
--- a/arch/powerpc/lib/feature-fixups.c
+++ b/arch/powerpc/lib/feature-fixups.c
@@ -188,7 +188,10 @@ void __init apply_feature_fixups(void)
188 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup); 188 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
189#endif 189#endif
190 do_final_fixups(); 190 do_final_fixups();
191}
191 192
193void __init setup_feature_keys(void)
194{
192 /* 195 /*
193 * Initialise jump label. This causes all the cpu/mmu_has_feature() 196 * Initialise jump label. This causes all the cpu/mmu_has_feature()
194 * checks to take on their correct polarity based on the current set of 197 * checks to take on their correct polarity based on the current set of
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 5be15cff758d..2975754c65ea 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -496,8 +496,10 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode)
496 gang = alloc_spu_gang(); 496 gang = alloc_spu_gang();
497 SPUFS_I(inode)->i_ctx = NULL; 497 SPUFS_I(inode)->i_ctx = NULL;
498 SPUFS_I(inode)->i_gang = gang; 498 SPUFS_I(inode)->i_gang = gang;
499 if (!gang) 499 if (!gang) {
500 ret = -ENOMEM;
500 goto out_iput; 501 goto out_iput;
502 }
501 503
502 inode->i_op = &simple_dir_inode_operations; 504 inode->i_op = &simple_dir_inode_operations;
503 inode->i_fop = &simple_dir_operations; 505 inode->i_fop = &simple_dir_operations;
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 309d9ccccd50..c61667e8bb06 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -187,6 +187,11 @@ static void pci_dma_dev_setup_pasemi(struct pci_dev *dev)
187 if (dev->vendor == 0x1959 && dev->device == 0xa007 && 187 if (dev->vendor == 0x1959 && dev->device == 0xa007 &&
188 !firmware_has_feature(FW_FEATURE_LPAR)) { 188 !firmware_has_feature(FW_FEATURE_LPAR)) {
189 dev->dev.archdata.dma_ops = &dma_direct_ops; 189 dev->dev.archdata.dma_ops = &dma_direct_ops;
190 /*
191 * Set the coherent DMA mask to prevent the iommu
192 * being used unnecessarily
193 */
194 dev->dev.coherent_dma_mask = DMA_BIT_MASK(44);
190 return; 195 return;
191 } 196 }
192#endif 197#endif
diff --git a/arch/powerpc/platforms/powernv/opal-irqchip.c b/arch/powerpc/platforms/powernv/opal-irqchip.c
index e505223b4ec5..ed8bba68a162 100644
--- a/arch/powerpc/platforms/powernv/opal-irqchip.c
+++ b/arch/powerpc/platforms/powernv/opal-irqchip.c
@@ -228,7 +228,8 @@ int __init opal_event_init(void)
228 } 228 }
229 229
230 /* Install interrupt handler */ 230 /* Install interrupt handler */
231 rc = request_irq(virq, opal_interrupt, 0, "opal", NULL); 231 rc = request_irq(virq, opal_interrupt, IRQF_TRIGGER_LOW,
232 "opal", NULL);
232 if (rc) { 233 if (rc) {
233 irq_dispose_mapping(virq); 234 irq_dispose_mapping(virq);
234 pr_warn("Error %d requesting irq %d (0x%x)\n", 235 pr_warn("Error %d requesting irq %d (0x%x)\n",
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 8b4fc68cebcb..6c9a65b52e63 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -399,6 +399,7 @@ static int opal_recover_mce(struct pt_regs *regs,
399 399
400 if (!(regs->msr & MSR_RI)) { 400 if (!(regs->msr & MSR_RI)) {
401 /* If MSR_RI isn't set, we cannot recover */ 401 /* If MSR_RI isn't set, we cannot recover */
402 pr_err("Machine check interrupt unrecoverable: MSR(RI=0)\n");
402 recovered = 0; 403 recovered = 0;
403 } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) { 404 } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) {
404 /* Platform corrected itself */ 405 /* Platform corrected itself */
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 6b9528307f62..fd9444f9fb0c 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -111,10 +111,17 @@ static int __init iommu_setup(char *str)
111} 111}
112early_param("iommu", iommu_setup); 112early_param("iommu", iommu_setup);
113 113
114static inline bool pnv_pci_is_mem_pref_64(unsigned long flags) 114static inline bool pnv_pci_is_m64(struct pnv_phb *phb, struct resource *r)
115{ 115{
116 return ((flags & (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH)) == 116 /*
117 (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH)); 117 * WARNING: We cannot rely on the resource flags. The Linux PCI
118 * allocation code sometimes decides to put a 64-bit prefetchable
119 * BAR in the 32-bit window, so we have to compare the addresses.
120 *
121 * For simplicity we only test resource start.
122 */
123 return (r->start >= phb->ioda.m64_base &&
124 r->start < (phb->ioda.m64_base + phb->ioda.m64_size));
118} 125}
119 126
120static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no) 127static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no)
@@ -229,7 +236,7 @@ static void pnv_ioda_reserve_dev_m64_pe(struct pci_dev *pdev,
229 sgsz = phb->ioda.m64_segsize; 236 sgsz = phb->ioda.m64_segsize;
230 for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 237 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
231 r = &pdev->resource[i]; 238 r = &pdev->resource[i];
232 if (!r->parent || !pnv_pci_is_mem_pref_64(r->flags)) 239 if (!r->parent || !pnv_pci_is_m64(phb, r))
233 continue; 240 continue;
234 241
235 start = _ALIGN_DOWN(r->start - base, sgsz); 242 start = _ALIGN_DOWN(r->start - base, sgsz);
@@ -1877,7 +1884,7 @@ static void pnv_pci_phb3_tce_invalidate(struct pnv_ioda_pe *pe, bool rm,
1877 unsigned shift, unsigned long index, 1884 unsigned shift, unsigned long index,
1878 unsigned long npages) 1885 unsigned long npages)
1879{ 1886{
1880 __be64 __iomem *invalidate = pnv_ioda_get_inval_reg(pe->phb, false); 1887 __be64 __iomem *invalidate = pnv_ioda_get_inval_reg(pe->phb, rm);
1881 unsigned long start, end, inc; 1888 unsigned long start, end, inc;
1882 1889
1883 /* We'll invalidate DMA address in PE scope */ 1890 /* We'll invalidate DMA address in PE scope */
@@ -2863,7 +2870,7 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)
2863 res = &pdev->resource[i + PCI_IOV_RESOURCES]; 2870 res = &pdev->resource[i + PCI_IOV_RESOURCES];
2864 if (!res->flags || res->parent) 2871 if (!res->flags || res->parent)
2865 continue; 2872 continue;
2866 if (!pnv_pci_is_mem_pref_64(res->flags)) { 2873 if (!pnv_pci_is_m64(phb, res)) {
2867 dev_warn(&pdev->dev, "Don't support SR-IOV with" 2874 dev_warn(&pdev->dev, "Don't support SR-IOV with"
2868 " non M64 VF BAR%d: %pR. \n", 2875 " non M64 VF BAR%d: %pR. \n",
2869 i, res); 2876 i, res);
@@ -2958,7 +2965,7 @@ static void pnv_ioda_setup_pe_res(struct pnv_ioda_pe *pe,
2958 index++; 2965 index++;
2959 } 2966 }
2960 } else if ((res->flags & IORESOURCE_MEM) && 2967 } else if ((res->flags & IORESOURCE_MEM) &&
2961 !pnv_pci_is_mem_pref_64(res->flags)) { 2968 !pnv_pci_is_m64(phb, res)) {
2962 region.start = res->start - 2969 region.start = res->start -
2963 phb->hose->mem_offset[0] - 2970 phb->hose->mem_offset[0] -
2964 phb->ioda.m32_pci_base; 2971 phb->ioda.m32_pci_base;
@@ -3083,9 +3090,12 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
3083 bridge = bridge->bus->self; 3090 bridge = bridge->bus->self;
3084 } 3091 }
3085 3092
3086 /* We fail back to M32 if M64 isn't supported */ 3093 /*
3087 if (phb->ioda.m64_segsize && 3094 * We fall back to M32 if M64 isn't supported. We enforce the M64
3088 pnv_pci_is_mem_pref_64(type)) 3095 * alignment for any 64-bit resource, PCIe doesn't care and
3096 * bridges only do 64-bit prefetchable anyway.
3097 */
3098 if (phb->ioda.m64_segsize && (type & IORESOURCE_MEM_64))
3089 return phb->ioda.m64_segsize; 3099 return phb->ioda.m64_segsize;
3090 if (type & IORESOURCE_MEM) 3100 if (type & IORESOURCE_MEM)
3091 return phb->ioda.m32_segsize; 3101 return phb->ioda.m32_segsize;
@@ -3125,7 +3135,7 @@ static void pnv_pci_fixup_bridge_resources(struct pci_bus *bus,
3125 w = NULL; 3135 w = NULL;
3126 if (r->flags & type & IORESOURCE_IO) 3136 if (r->flags & type & IORESOURCE_IO)
3127 w = &hose->io_resource; 3137 w = &hose->io_resource;
3128 else if (pnv_pci_is_mem_pref_64(r->flags) && 3138 else if (pnv_pci_is_m64(phb, r) &&
3129 (type & IORESOURCE_PREFETCH) && 3139 (type & IORESOURCE_PREFETCH) &&
3130 phb->ioda.m64_segsize) 3140 phb->ioda.m64_segsize)
3131 w = &hose->mem_resources[1]; 3141 w = &hose->mem_resources[1];
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 43f7beb2902d..76ec104e88be 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -320,19 +320,6 @@ static int dlpar_remove_device_tree_lmb(struct of_drconf_cell *lmb)
320 return dlpar_update_device_tree_lmb(lmb); 320 return dlpar_update_device_tree_lmb(lmb);
321} 321}
322 322
323static struct memory_block *lmb_to_memblock(struct of_drconf_cell *lmb)
324{
325 unsigned long section_nr;
326 struct mem_section *mem_sect;
327 struct memory_block *mem_block;
328
329 section_nr = pfn_to_section_nr(PFN_DOWN(lmb->base_addr));
330 mem_sect = __nr_to_section(section_nr);
331
332 mem_block = find_memory_block(mem_sect);
333 return mem_block;
334}
335
336#ifdef CONFIG_MEMORY_HOTREMOVE 323#ifdef CONFIG_MEMORY_HOTREMOVE
337static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) 324static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
338{ 325{
@@ -420,6 +407,19 @@ static bool lmb_is_removable(struct of_drconf_cell *lmb)
420 407
421static int dlpar_add_lmb(struct of_drconf_cell *); 408static int dlpar_add_lmb(struct of_drconf_cell *);
422 409
410static struct memory_block *lmb_to_memblock(struct of_drconf_cell *lmb)
411{
412 unsigned long section_nr;
413 struct mem_section *mem_sect;
414 struct memory_block *mem_block;
415
416 section_nr = pfn_to_section_nr(PFN_DOWN(lmb->base_addr));
417 mem_sect = __nr_to_section(section_nr);
418
419 mem_block = find_memory_block(mem_sect);
420 return mem_block;
421}
422
423static int dlpar_remove_lmb(struct of_drconf_cell *lmb) 423static int dlpar_remove_lmb(struct of_drconf_cell *lmb)
424{ 424{
425 struct memory_block *mem_block; 425 struct memory_block *mem_block;
diff --git a/arch/powerpc/sysdev/xics/Kconfig b/arch/powerpc/sysdev/xics/Kconfig
index 0031eda320c3..385e7aa9e273 100644
--- a/arch/powerpc/sysdev/xics/Kconfig
+++ b/arch/powerpc/sysdev/xics/Kconfig
@@ -1,6 +1,7 @@
1config PPC_XICS 1config PPC_XICS
2 def_bool n 2 def_bool n
3 select PPC_SMP_MUXED_IPI 3 select PPC_SMP_MUXED_IPI
4 select HARDIRQS_SW_RESEND
4 5
5config PPC_ICP_NATIVE 6config PPC_ICP_NATIVE
6 def_bool n 7 def_bool n
diff --git a/arch/powerpc/sysdev/xics/ics-opal.c b/arch/powerpc/sysdev/xics/ics-opal.c
index 27c936c080a6..1c6bf4b66f56 100644
--- a/arch/powerpc/sysdev/xics/ics-opal.c
+++ b/arch/powerpc/sysdev/xics/ics-opal.c
@@ -156,7 +156,9 @@ static struct irq_chip ics_opal_irq_chip = {
156 .irq_mask = ics_opal_mask_irq, 156 .irq_mask = ics_opal_mask_irq,
157 .irq_unmask = ics_opal_unmask_irq, 157 .irq_unmask = ics_opal_unmask_irq,
158 .irq_eoi = NULL, /* Patched at init time */ 158 .irq_eoi = NULL, /* Patched at init time */
159 .irq_set_affinity = ics_opal_set_affinity 159 .irq_set_affinity = ics_opal_set_affinity,
160 .irq_set_type = xics_set_irq_type,
161 .irq_retrigger = xics_retrigger,
160}; 162};
161 163
162static int ics_opal_map(struct ics *ics, unsigned int virq); 164static int ics_opal_map(struct ics *ics, unsigned int virq);
diff --git a/arch/powerpc/sysdev/xics/ics-rtas.c b/arch/powerpc/sysdev/xics/ics-rtas.c
index 3854dd41558d..78ee5c778ef8 100644
--- a/arch/powerpc/sysdev/xics/ics-rtas.c
+++ b/arch/powerpc/sysdev/xics/ics-rtas.c
@@ -163,7 +163,9 @@ static struct irq_chip ics_rtas_irq_chip = {
163 .irq_mask = ics_rtas_mask_irq, 163 .irq_mask = ics_rtas_mask_irq,
164 .irq_unmask = ics_rtas_unmask_irq, 164 .irq_unmask = ics_rtas_unmask_irq,
165 .irq_eoi = NULL, /* Patched at init time */ 165 .irq_eoi = NULL, /* Patched at init time */
166 .irq_set_affinity = ics_rtas_set_affinity 166 .irq_set_affinity = ics_rtas_set_affinity,
167 .irq_set_type = xics_set_irq_type,
168 .irq_retrigger = xics_retrigger,
167}; 169};
168 170
169static int ics_rtas_map(struct ics *ics, unsigned int virq) 171static int ics_rtas_map(struct ics *ics, unsigned int virq)
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index a795a5f0301c..9d530f479588 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -328,8 +328,12 @@ static int xics_host_map(struct irq_domain *h, unsigned int virq,
328 328
329 pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw); 329 pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw);
330 330
331 /* They aren't all level sensitive but we just don't really know */ 331 /*
332 irq_set_status_flags(virq, IRQ_LEVEL); 332 * Mark interrupts as edge sensitive by default so that resend
333 * actually works. The device-tree parsing will turn the LSIs
334 * back to level.
335 */
336 irq_clear_status_flags(virq, IRQ_LEVEL);
333 337
334 /* Don't call into ICS for IPIs */ 338 /* Don't call into ICS for IPIs */
335 if (hw == XICS_IPI) { 339 if (hw == XICS_IPI) {
@@ -351,13 +355,54 @@ static int xics_host_xlate(struct irq_domain *h, struct device_node *ct,
351 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 355 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
352 356
353{ 357{
354 /* Current xics implementation translates everything
355 * to level. It is not technically right for MSIs but this
356 * is irrelevant at this point. We might get smarter in the future
357 */
358 *out_hwirq = intspec[0]; 358 *out_hwirq = intspec[0];
359 *out_flags = IRQ_TYPE_LEVEL_LOW;
360 359
360 /*
361 * If intsize is at least 2, we look for the type in the second cell,
362 * we assume the LSB indicates a level interrupt.
363 */
364 if (intsize > 1) {
365 if (intspec[1] & 1)
366 *out_flags = IRQ_TYPE_LEVEL_LOW;
367 else
368 *out_flags = IRQ_TYPE_EDGE_RISING;
369 } else
370 *out_flags = IRQ_TYPE_LEVEL_LOW;
371
372 return 0;
373}
374
375int xics_set_irq_type(struct irq_data *d, unsigned int flow_type)
376{
377 /*
378 * We only support these. This has really no effect other than setting
379 * the corresponding descriptor bits mind you but those will in turn
380 * affect the resend function when re-enabling an edge interrupt.
381 *
382 * Set set the default to edge as explained in map().
383 */
384 if (flow_type == IRQ_TYPE_DEFAULT || flow_type == IRQ_TYPE_NONE)
385 flow_type = IRQ_TYPE_EDGE_RISING;
386
387 if (flow_type != IRQ_TYPE_EDGE_RISING &&
388 flow_type != IRQ_TYPE_LEVEL_LOW)
389 return -EINVAL;
390
391 irqd_set_trigger_type(d, flow_type);
392
393 return IRQ_SET_MASK_OK_NOCOPY;
394}
395
396int xics_retrigger(struct irq_data *data)
397{
398 /*
399 * We need to push a dummy CPPR when retriggering, since the subsequent
400 * EOI will try to pop it. Passing 0 works, as the function hard codes
401 * the priority value anyway.
402 */
403 xics_push_cppr(0);
404
405 /* Tell the core to do a soft retrigger */
361 return 0; 406 return 0;
362} 407}
363 408