aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/powernv')
-rw-r--r--arch/powerpc/platforms/powernv/Kconfig1
-rw-r--r--arch/powerpc/platforms/powernv/opal.c30
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c36
-rw-r--r--arch/powerpc/platforms/powernv/pci.c18
-rw-r--r--arch/powerpc/platforms/powernv/pci.h2
-rw-r--r--arch/powerpc/platforms/powernv/powernv.h2
-rw-r--r--arch/powerpc/platforms/powernv/setup.c16
-rw-r--r--arch/powerpc/platforms/powernv/smp.c62
8 files changed, 142 insertions, 25 deletions
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index d3e840d643af..c24684c818ab 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -6,6 +6,7 @@ config PPC_POWERNV
6 select PPC_ICP_NATIVE 6 select PPC_ICP_NATIVE
7 select PPC_P7_NAP 7 select PPC_P7_NAP
8 select PPC_PCI_CHOICE if EMBEDDED 8 select PPC_PCI_CHOICE if EMBEDDED
9 select EPAPR_BOOT
9 default y 10 default y
10 11
11config POWERNV_MSI 12config POWERNV_MSI
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index ade4463226c6..628c564ceadb 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -15,6 +15,7 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/slab.h>
18#include <asm/opal.h> 19#include <asm/opal.h>
19#include <asm/firmware.h> 20#include <asm/firmware.h>
20 21
@@ -28,6 +29,8 @@ struct opal {
28static struct device_node *opal_node; 29static struct device_node *opal_node;
29static DEFINE_SPINLOCK(opal_write_lock); 30static DEFINE_SPINLOCK(opal_write_lock);
30extern u64 opal_mc_secondary_handler[]; 31extern u64 opal_mc_secondary_handler[];
32static unsigned int *opal_irqs;
33static unsigned int opal_irq_count;
31 34
32int __init early_init_dt_scan_opal(unsigned long node, 35int __init early_init_dt_scan_opal(unsigned long node,
33 const char *uname, int depth, void *data) 36 const char *uname, int depth, void *data)
@@ -53,7 +56,11 @@ int __init early_init_dt_scan_opal(unsigned long node,
53 opal.entry, entryp, entrysz); 56 opal.entry, entryp, entrysz);
54 57
55 powerpc_firmware_features |= FW_FEATURE_OPAL; 58 powerpc_firmware_features |= FW_FEATURE_OPAL;
56 if (of_flat_dt_is_compatible(node, "ibm,opal-v2")) { 59 if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) {
60 powerpc_firmware_features |= FW_FEATURE_OPALv2;
61 powerpc_firmware_features |= FW_FEATURE_OPALv3;
62 printk("OPAL V3 detected !\n");
63 } else if (of_flat_dt_is_compatible(node, "ibm,opal-v2")) {
57 powerpc_firmware_features |= FW_FEATURE_OPALv2; 64 powerpc_firmware_features |= FW_FEATURE_OPALv2;
58 printk("OPAL V2 detected !\n"); 65 printk("OPAL V2 detected !\n");
59 } else { 66 } else {
@@ -144,6 +151,13 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
144 rc == OPAL_BUSY_EVENT || rc == OPAL_SUCCESS)) { 151 rc == OPAL_BUSY_EVENT || rc == OPAL_SUCCESS)) {
145 len = total_len; 152 len = total_len;
146 rc = opal_console_write(vtermno, &len, data); 153 rc = opal_console_write(vtermno, &len, data);
154
155 /* Closed or other error drop */
156 if (rc != OPAL_SUCCESS && rc != OPAL_BUSY &&
157 rc != OPAL_BUSY_EVENT) {
158 written = total_len;
159 break;
160 }
147 if (rc == OPAL_SUCCESS) { 161 if (rc == OPAL_SUCCESS) {
148 total_len -= len; 162 total_len -= len;
149 data += len; 163 data += len;
@@ -316,6 +330,8 @@ static int __init opal_init(void)
316 irqs = of_get_property(opal_node, "opal-interrupts", &irqlen); 330 irqs = of_get_property(opal_node, "opal-interrupts", &irqlen);
317 pr_debug("opal: Found %d interrupts reserved for OPAL\n", 331 pr_debug("opal: Found %d interrupts reserved for OPAL\n",
318 irqs ? (irqlen / 4) : 0); 332 irqs ? (irqlen / 4) : 0);
333 opal_irq_count = irqlen / 4;
334 opal_irqs = kzalloc(opal_irq_count * sizeof(unsigned int), GFP_KERNEL);
319 for (i = 0; irqs && i < (irqlen / 4); i++, irqs++) { 335 for (i = 0; irqs && i < (irqlen / 4); i++, irqs++) {
320 unsigned int hwirq = be32_to_cpup(irqs); 336 unsigned int hwirq = be32_to_cpup(irqs);
321 unsigned int irq = irq_create_mapping(NULL, hwirq); 337 unsigned int irq = irq_create_mapping(NULL, hwirq);
@@ -327,7 +343,19 @@ static int __init opal_init(void)
327 if (rc) 343 if (rc)
328 pr_warning("opal: Error %d requesting irq %d" 344 pr_warning("opal: Error %d requesting irq %d"
329 " (0x%x)\n", rc, irq, hwirq); 345 " (0x%x)\n", rc, irq, hwirq);
346 opal_irqs[i] = irq;
330 } 347 }
331 return 0; 348 return 0;
332} 349}
333subsys_initcall(opal_init); 350subsys_initcall(opal_init);
351
352void opal_shutdown(void)
353{
354 unsigned int i;
355
356 for (i = 0; i < opal_irq_count; i++) {
357 if (opal_irqs[i])
358 free_irq(opal_irqs[i], 0);
359 opal_irqs[i] = 0;
360 }
361}
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 1da578b7c1bf..9c9d15e4cdf2 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -68,16 +68,6 @@ define_pe_printk_level(pe_err, KERN_ERR);
68define_pe_printk_level(pe_warn, KERN_WARNING); 68define_pe_printk_level(pe_warn, KERN_WARNING);
69define_pe_printk_level(pe_info, KERN_INFO); 69define_pe_printk_level(pe_info, KERN_INFO);
70 70
71static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev)
72{
73 struct device_node *np;
74
75 np = pci_device_to_OF_node(dev);
76 if (!np)
77 return NULL;
78 return PCI_DN(np);
79}
80
81static int pnv_ioda_alloc_pe(struct pnv_phb *phb) 71static int pnv_ioda_alloc_pe(struct pnv_phb *phb)
82{ 72{
83 unsigned long pe; 73 unsigned long pe;
@@ -110,7 +100,7 @@ static struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev)
110{ 100{
111 struct pci_controller *hose = pci_bus_to_host(dev->bus); 101 struct pci_controller *hose = pci_bus_to_host(dev->bus);
112 struct pnv_phb *phb = hose->private_data; 102 struct pnv_phb *phb = hose->private_data;
113 struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 103 struct pci_dn *pdn = pci_get_pdn(dev);
114 104
115 if (!pdn) 105 if (!pdn)
116 return NULL; 106 return NULL;
@@ -173,7 +163,7 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
173 163
174 /* Add to all parents PELT-V */ 164 /* Add to all parents PELT-V */
175 while (parent) { 165 while (parent) {
176 struct pci_dn *pdn = pnv_ioda_get_pdn(parent); 166 struct pci_dn *pdn = pci_get_pdn(parent);
177 if (pdn && pdn->pe_number != IODA_INVALID_PE) { 167 if (pdn && pdn->pe_number != IODA_INVALID_PE) {
178 rc = opal_pci_set_peltv(phb->opal_id, pdn->pe_number, 168 rc = opal_pci_set_peltv(phb->opal_id, pdn->pe_number,
179 pe->pe_number, OPAL_ADD_PE_TO_DOMAIN); 169 pe->pe_number, OPAL_ADD_PE_TO_DOMAIN);
@@ -252,7 +242,7 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)
252{ 242{
253 struct pci_controller *hose = pci_bus_to_host(dev->bus); 243 struct pci_controller *hose = pci_bus_to_host(dev->bus);
254 struct pnv_phb *phb = hose->private_data; 244 struct pnv_phb *phb = hose->private_data;
255 struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 245 struct pci_dn *pdn = pci_get_pdn(dev);
256 struct pnv_ioda_pe *pe; 246 struct pnv_ioda_pe *pe;
257 int pe_num; 247 int pe_num;
258 248
@@ -323,7 +313,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
323 struct pci_dev *dev; 313 struct pci_dev *dev;
324 314
325 list_for_each_entry(dev, &bus->devices, bus_list) { 315 list_for_each_entry(dev, &bus->devices, bus_list) {
326 struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 316 struct pci_dn *pdn = pci_get_pdn(dev);
327 317
328 if (pdn == NULL) { 318 if (pdn == NULL) {
329 pr_warn("%s: No device node associated with device !\n", 319 pr_warn("%s: No device node associated with device !\n",
@@ -436,7 +426,7 @@ static void pnv_pci_ioda_setup_PEs(void)
436 426
437static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev) 427static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev)
438{ 428{
439 struct pci_dn *pdn = pnv_ioda_get_pdn(pdev); 429 struct pci_dn *pdn = pci_get_pdn(pdev);
440 struct pnv_ioda_pe *pe; 430 struct pnv_ioda_pe *pe;
441 431
442 /* 432 /*
@@ -768,6 +758,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
768 unsigned int is_64, struct msi_msg *msg) 758 unsigned int is_64, struct msi_msg *msg)
769{ 759{
770 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); 760 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev);
761 struct pci_dn *pdn = pci_get_pdn(dev);
771 struct irq_data *idata; 762 struct irq_data *idata;
772 struct irq_chip *ichip; 763 struct irq_chip *ichip;
773 unsigned int xive_num = hwirq - phb->msi_base; 764 unsigned int xive_num = hwirq - phb->msi_base;
@@ -783,6 +774,10 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
783 if (pe->mve_number < 0) 774 if (pe->mve_number < 0)
784 return -ENXIO; 775 return -ENXIO;
785 776
777 /* Force 32-bit MSI on some broken devices */
778 if (pdn && pdn->force_32bit_msi)
779 is_64 = 0;
780
786 /* Assign XIVE to PE */ 781 /* Assign XIVE to PE */
787 rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num); 782 rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num);
788 if (rc) { 783 if (rc) {
@@ -1035,7 +1030,7 @@ static int pnv_pci_enable_device_hook(struct pci_dev *dev)
1035 if (!phb->initialized) 1030 if (!phb->initialized)
1036 return 0; 1031 return 0;
1037 1032
1038 pdn = pnv_ioda_get_pdn(dev); 1033 pdn = pci_get_pdn(dev);
1039 if (!pdn || pdn->pe_number == IODA_INVALID_PE) 1034 if (!pdn || pdn->pe_number == IODA_INVALID_PE)
1040 return -EINVAL; 1035 return -EINVAL;
1041 1036
@@ -1048,6 +1043,12 @@ static u32 pnv_ioda_bdfn_to_pe(struct pnv_phb *phb, struct pci_bus *bus,
1048 return phb->ioda.pe_rmap[(bus->number << 8) | devfn]; 1043 return phb->ioda.pe_rmap[(bus->number << 8) | devfn];
1049} 1044}
1050 1045
1046static void pnv_pci_ioda_shutdown(struct pnv_phb *phb)
1047{
1048 opal_pci_reset(phb->opal_id, OPAL_PCI_IODA_TABLE_RESET,
1049 OPAL_ASSERT_RESET);
1050}
1051
1051void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type) 1052void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
1052{ 1053{
1053 struct pci_controller *hose; 1054 struct pci_controller *hose;
@@ -1178,6 +1179,9 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
1178 /* Setup TCEs */ 1179 /* Setup TCEs */
1179 phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup; 1180 phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup;
1180 1181
1182 /* Setup shutdown function for kexec */
1183 phb->shutdown = pnv_pci_ioda_shutdown;
1184
1181 /* Setup MSI support */ 1185 /* Setup MSI support */
1182 pnv_pci_init_ioda_msis(phb); 1186 pnv_pci_init_ioda_msis(phb);
1183 1187
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 55dfca844ddf..277343cc6a3d 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -47,6 +47,10 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type)
47{ 47{
48 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 48 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
49 struct pnv_phb *phb = hose->private_data; 49 struct pnv_phb *phb = hose->private_data;
50 struct pci_dn *pdn = pci_get_pdn(pdev);
51
52 if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
53 return -ENODEV;
50 54
51 return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV; 55 return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
52} 56}
@@ -367,7 +371,7 @@ static void pnv_tce_free(struct iommu_table *tbl, long index, long npages)
367 while (npages--) 371 while (npages--)
368 *(tcep++) = 0; 372 *(tcep++) = 0;
369 373
370 if (tbl->it_type & TCE_PCI_SWINV_CREATE) 374 if (tbl->it_type & TCE_PCI_SWINV_FREE)
371 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); 375 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1);
372} 376}
373 377
@@ -450,6 +454,18 @@ static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
450 pnv_pci_dma_fallback_setup(hose, pdev); 454 pnv_pci_dma_fallback_setup(hose, pdev);
451} 455}
452 456
457void pnv_pci_shutdown(void)
458{
459 struct pci_controller *hose;
460
461 list_for_each_entry(hose, &hose_list, list_node) {
462 struct pnv_phb *phb = hose->private_data;
463
464 if (phb && phb->shutdown)
465 phb->shutdown(phb);
466 }
467}
468
453/* Fixup wrong class code in p7ioc and p8 root complex */ 469/* Fixup wrong class code in p7ioc and p8 root complex */
454static void pnv_p7ioc_rc_quirk(struct pci_dev *dev) 470static void pnv_p7ioc_rc_quirk(struct pci_dev *dev)
455{ 471{
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 48dc4bb856a1..25d76c4df50b 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -86,6 +86,7 @@ struct pnv_phb {
86 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev); 86 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev);
87 void (*fixup_phb)(struct pci_controller *hose); 87 void (*fixup_phb)(struct pci_controller *hose);
88 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); 88 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn);
89 void (*shutdown)(struct pnv_phb *phb);
89 90
90 union { 91 union {
91 struct { 92 struct {
@@ -158,4 +159,5 @@ extern void pnv_pci_init_ioda_hub(struct device_node *np);
158extern void pnv_pci_init_ioda2_phb(struct device_node *np); 159extern void pnv_pci_init_ioda2_phb(struct device_node *np);
159extern void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl, 160extern void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl,
160 u64 *startp, u64 *endp); 161 u64 *startp, u64 *endp);
162
161#endif /* __POWERNV_PCI_H */ 163#endif /* __POWERNV_PCI_H */
diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
index 8a9df7f9667e..a1c6f83fc391 100644
--- a/arch/powerpc/platforms/powernv/powernv.h
+++ b/arch/powerpc/platforms/powernv/powernv.h
@@ -9,8 +9,10 @@ static inline void pnv_smp_init(void) { }
9 9
10#ifdef CONFIG_PCI 10#ifdef CONFIG_PCI
11extern void pnv_pci_init(void); 11extern void pnv_pci_init(void);
12extern void pnv_pci_shutdown(void);
12#else 13#else
13static inline void pnv_pci_init(void) { } 14static inline void pnv_pci_init(void) { }
15static inline void pnv_pci_shutdown(void) { }
14#endif 16#endif
15 17
16#endif /* _POWERNV_H */ 18#endif /* _POWERNV_H */
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index db1ad1c8f68f..d4459bfc92f7 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -78,7 +78,9 @@ static void pnv_show_cpuinfo(struct seq_file *m)
78 if (root) 78 if (root)
79 model = of_get_property(root, "model", NULL); 79 model = of_get_property(root, "model", NULL);
80 seq_printf(m, "machine\t\t: PowerNV %s\n", model); 80 seq_printf(m, "machine\t\t: PowerNV %s\n", model);
81 if (firmware_has_feature(FW_FEATURE_OPALv2)) 81 if (firmware_has_feature(FW_FEATURE_OPALv3))
82 seq_printf(m, "firmware\t: OPAL v3\n");
83 else if (firmware_has_feature(FW_FEATURE_OPALv2))
82 seq_printf(m, "firmware\t: OPAL v2\n"); 84 seq_printf(m, "firmware\t: OPAL v2\n");
83 else if (firmware_has_feature(FW_FEATURE_OPAL)) 85 else if (firmware_has_feature(FW_FEATURE_OPAL))
84 seq_printf(m, "firmware\t: OPAL v1\n"); 86 seq_printf(m, "firmware\t: OPAL v1\n");
@@ -126,6 +128,17 @@ static void pnv_progress(char *s, unsigned short hex)
126{ 128{
127} 129}
128 130
131static void pnv_shutdown(void)
132{
133 /* Let the PCI code clear up IODA tables */
134 pnv_pci_shutdown();
135
136 /* And unregister all OPAL interrupts so they don't fire
137 * up while we kexec
138 */
139 opal_shutdown();
140}
141
129#ifdef CONFIG_KEXEC 142#ifdef CONFIG_KEXEC
130static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) 143static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
131{ 144{
@@ -187,6 +200,7 @@ define_machine(powernv) {
187 .init_IRQ = pnv_init_IRQ, 200 .init_IRQ = pnv_init_IRQ,
188 .show_cpuinfo = pnv_show_cpuinfo, 201 .show_cpuinfo = pnv_show_cpuinfo,
189 .progress = pnv_progress, 202 .progress = pnv_progress,
203 .machine_shutdown = pnv_shutdown,
190 .power_save = power7_idle, 204 .power_save = power7_idle,
191 .calibrate_decr = generic_calibrate_decr, 205 .calibrate_decr = generic_calibrate_decr,
192#ifdef CONFIG_KEXEC 206#ifdef CONFIG_KEXEC
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 6a3ecca5b725..88c9459c3e07 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -71,18 +71,68 @@ int pnv_smp_kick_cpu(int nr)
71 71
72 BUG_ON(nr < 0 || nr >= NR_CPUS); 72 BUG_ON(nr < 0 || nr >= NR_CPUS);
73 73
74 /* On OPAL v2 the CPU are still spinning inside OPAL itself, 74 /*
75 * get them back now 75 * If we already started or OPALv2 is not supported, we just
76 * kick the CPU via the PACA
76 */ 77 */
77 if (!paca[nr].cpu_start && firmware_has_feature(FW_FEATURE_OPALv2)) { 78 if (paca[nr].cpu_start || !firmware_has_feature(FW_FEATURE_OPALv2))
78 pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n", nr, pcpu); 79 goto kick;
79 rc = opal_start_cpu(pcpu, start_here); 80
81 /*
82 * At this point, the CPU can either be spinning on the way in
83 * from kexec or be inside OPAL waiting to be started for the
84 * first time. OPAL v3 allows us to query OPAL to know if it
85 * has the CPUs, so we do that
86 */
87 if (firmware_has_feature(FW_FEATURE_OPALv3)) {
88 uint8_t status;
89
90 rc = opal_query_cpu_status(pcpu, &status);
80 if (rc != OPAL_SUCCESS) { 91 if (rc != OPAL_SUCCESS) {
81 pr_warn("OPAL Error %ld starting CPU %d\n", 92 pr_warn("OPAL Error %ld querying CPU %d state\n",
82 rc, nr); 93 rc, nr);
83 return -ENODEV; 94 return -ENODEV;
84 } 95 }
96
97 /*
98 * Already started, just kick it, probably coming from
99 * kexec and spinning
100 */
101 if (status == OPAL_THREAD_STARTED)
102 goto kick;
103
104 /*
105 * Available/inactive, let's kick it
106 */
107 if (status == OPAL_THREAD_INACTIVE) {
108 pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n",
109 nr, pcpu);
110 rc = opal_start_cpu(pcpu, start_here);
111 if (rc != OPAL_SUCCESS) {
112 pr_warn("OPAL Error %ld starting CPU %d\n",
113 rc, nr);
114 return -ENODEV;
115 }
116 } else {
117 /*
118 * An unavailable CPU (or any other unknown status)
119 * shouldn't be started. It should also
120 * not be in the possible map but currently it can
121 * happen
122 */
123 pr_devel("OPAL: CPU %d (HW 0x%x) is unavailable"
124 " (status %d)...\n", nr, pcpu, status);
125 return -ENODEV;
126 }
127 } else {
128 /*
129 * On OPAL v2, we just kick it and hope for the best,
130 * we must not test the error from opal_start_cpu() or
131 * we would fail to get CPUs from kexec.
132 */
133 opal_start_cpu(pcpu, start_here);
85 } 134 }
135 kick:
86 return smp_generic_kick_cpu(nr); 136 return smp_generic_kick_cpu(nr);
87} 137}
88 138