aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-09-17 15:52:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-09-17 15:52:01 -0400
commitbaf009f92731c0fc1f036d8b7dba3bf5bb2c2a5e (patch)
tree20561586e27bbb43162badad10a0c3280e42e6bc
parent4d2899d73c4734cd04edb9409a72d0ef637cfb06 (diff)
parented7d9a1d7da6fe7b1c7477dc70e95051583fd60c (diff)
Merge tag 'powerpc-4.8-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "Fixes for code merged this cycle: - Fix restore of SPRs upon wake up from hypervisor state loss from Gautham R Shenoy - Fix the state of root PE from Gavin Shan - Detach from PE on releasing PCI device from Gavin Shan - Fix size of NUM_CPU_FTR_KEYS on 32-bit - Fix missed TCE invalidations that should fallback to OPAL" * tag 'powerpc-4.8-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/powernv/pci: Fix missed TCE invalidations that should fallback to OPAL powerpc/powernv: Detach from PE on releasing PCI device powerpc/powernv: Fix the state of root PE powerpc/kernel: Fix size of NUM_CPU_FTR_KEYS on 32-bit powerpc/powernv: Fix restore of SPRs upon wake up from hypervisor state loss
-rw-r--r--arch/powerpc/include/asm/cpu_has_feature.h2
-rw-r--r--arch/powerpc/kernel/idle_book3s.S10
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c26
3 files changed, 29 insertions, 9 deletions
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h
index 2ef55f8968a2..b312b152461b 100644
--- a/arch/powerpc/include/asm/cpu_has_feature.h
+++ b/arch/powerpc/include/asm/cpu_has_feature.h
@@ -15,7 +15,7 @@ static inline bool early_cpu_has_feature(unsigned long feature)
15#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS 15#ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS
16#include <linux/jump_label.h> 16#include <linux/jump_label.h>
17 17
18#define NUM_CPU_FTR_KEYS 64 18#define NUM_CPU_FTR_KEYS BITS_PER_LONG
19 19
20extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; 20extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS];
21 21
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 2265c6398a17..bd739fed26e3 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -411,7 +411,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
411 * 411 *
412 * r13 - PACA 412 * r13 - PACA
413 * cr3 - gt if waking up with partial/complete hypervisor state loss 413 * cr3 - gt if waking up with partial/complete hypervisor state loss
414 * cr4 - eq if waking up from complete hypervisor state loss. 414 * cr4 - gt or eq if waking up from complete hypervisor state loss.
415 */ 415 */
416_GLOBAL(pnv_wakeup_tb_loss) 416_GLOBAL(pnv_wakeup_tb_loss)
417 ld r1,PACAR1(r13) 417 ld r1,PACAR1(r13)
@@ -453,7 +453,7 @@ lwarx_loop2:
453 * At this stage 453 * At this stage
454 * cr2 - eq if first thread to wakeup in core 454 * cr2 - eq if first thread to wakeup in core
455 * cr3- gt if waking up with partial/complete hypervisor state loss 455 * cr3- gt if waking up with partial/complete hypervisor state loss
456 * cr4 - eq if waking up from complete hypervisor state loss. 456 * cr4 - gt or eq if waking up from complete hypervisor state loss.
457 */ 457 */
458 458
459 ori r15,r15,PNV_CORE_IDLE_LOCK_BIT 459 ori r15,r15,PNV_CORE_IDLE_LOCK_BIT
@@ -481,7 +481,7 @@ first_thread_in_subcore:
481 * If waking up from sleep, subcore state is not lost. Hence 481 * If waking up from sleep, subcore state is not lost. Hence
482 * skip subcore state restore 482 * skip subcore state restore
483 */ 483 */
484 bne cr4,subcore_state_restored 484 blt cr4,subcore_state_restored
485 485
486 /* Restore per-subcore state */ 486 /* Restore per-subcore state */
487 ld r4,_SDR1(r1) 487 ld r4,_SDR1(r1)
@@ -526,7 +526,7 @@ timebase_resync:
526 * If waking up from sleep, per core state is not lost, skip to 526 * If waking up from sleep, per core state is not lost, skip to
527 * clear_lock. 527 * clear_lock.
528 */ 528 */
529 bne cr4,clear_lock 529 blt cr4,clear_lock
530 530
531 /* 531 /*
532 * First thread in the core to wake up and its waking up with 532 * First thread in the core to wake up and its waking up with
@@ -557,7 +557,7 @@ common_exit:
557 * If waking up from sleep, hypervisor state is not lost. Hence 557 * If waking up from sleep, hypervisor state is not lost. Hence
558 * skip hypervisor state restore. 558 * skip hypervisor state restore.
559 */ 559 */
560 bne cr4,hypervisor_state_restored 560 blt cr4,hypervisor_state_restored
561 561
562 /* Waking up from winkle */ 562 /* Waking up from winkle */
563 563
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index c16d790808f1..bc0c91e84ca0 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2217,7 +2217,7 @@ static long pnv_pci_ioda2_set_window(struct iommu_table_group *table_group,
2217 2217
2218 pnv_pci_link_table_and_group(phb->hose->node, num, 2218 pnv_pci_link_table_and_group(phb->hose->node, num,
2219 tbl, &pe->table_group); 2219 tbl, &pe->table_group);
2220 pnv_pci_phb3_tce_invalidate_pe(pe); 2220 pnv_pci_ioda2_tce_invalidate_pe(pe);
2221 2221
2222 return 0; 2222 return 0;
2223} 2223}
@@ -2355,7 +2355,7 @@ static long pnv_pci_ioda2_unset_window(struct iommu_table_group *table_group,
2355 if (ret) 2355 if (ret)
2356 pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); 2356 pe_warn(pe, "Unmapping failed, ret = %ld\n", ret);
2357 else 2357 else
2358 pnv_pci_phb3_tce_invalidate_pe(pe); 2358 pnv_pci_ioda2_tce_invalidate_pe(pe);
2359 2359
2360 pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); 2360 pnv_pci_unlink_table_and_group(table_group->tables[num], table_group);
2361 2361
@@ -3426,7 +3426,17 @@ static void pnv_ioda_release_pe(struct pnv_ioda_pe *pe)
3426 } 3426 }
3427 } 3427 }
3428 3428
3429 pnv_ioda_free_pe(pe); 3429 /*
3430 * The PE for root bus can be removed because of hotplug in EEH
3431 * recovery for fenced PHB error. We need to mark the PE dead so
3432 * that it can be populated again in PCI hot add path. The PE
3433 * shouldn't be destroyed as it's the global reserved resource.
3434 */
3435 if (phb->ioda.root_pe_populated &&
3436 phb->ioda.root_pe_idx == pe->pe_number)
3437 phb->ioda.root_pe_populated = false;
3438 else
3439 pnv_ioda_free_pe(pe);
3430} 3440}
3431 3441
3432static void pnv_pci_release_device(struct pci_dev *pdev) 3442static void pnv_pci_release_device(struct pci_dev *pdev)
@@ -3442,7 +3452,17 @@ static void pnv_pci_release_device(struct pci_dev *pdev)
3442 if (!pdn || pdn->pe_number == IODA_INVALID_PE) 3452 if (!pdn || pdn->pe_number == IODA_INVALID_PE)
3443 return; 3453 return;
3444 3454
3455 /*
3456 * PCI hotplug can happen as part of EEH error recovery. The @pdn
3457 * isn't removed and added afterwards in this scenario. We should
3458 * set the PE number in @pdn to an invalid one. Otherwise, the PE's
3459 * device count is decreased on removing devices while failing to
3460 * be increased on adding devices. It leads to unbalanced PE's device
3461 * count and eventually make normal PCI hotplug path broken.
3462 */
3445 pe = &phb->ioda.pe_array[pdn->pe_number]; 3463 pe = &phb->ioda.pe_array[pdn->pe_number];
3464 pdn->pe_number = IODA_INVALID_PE;
3465
3446 WARN_ON(--pe->device_count < 0); 3466 WARN_ON(--pe->device_count < 0);
3447 if (pe->device_count == 0) 3467 if (pe->device_count == 0)
3448 pnv_ioda_release_pe(pe); 3468 pnv_ioda_release_pe(pe);