diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2013-06-20 01:20:55 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-06-20 03:05:45 -0400 |
commit | 8cdb283371241d298332c44d7c722e26d9858ec1 (patch) | |
tree | f29eb2df0faa05409bf4ca01acc830d4c34f3e01 /arch/powerpc/kernel/eeh_pe.c | |
parent | 01566808547b7ecc5017a741d50dead9e53f86fa (diff) |
powerpc/eeh: Trace PCI bus from PE
There're several types of PEs can be supported for now: PHB, Bus
and Device dependent PE. For PCI bus dependent PE, tracing the
corresponding PCI bus from PE (struct eeh_pe) would make the code
more efficient. The patch also enables the retrieval of PCI bus based
on the PCI bus dependent PE.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/eeh_pe.c')
-rw-r--r-- | arch/powerpc/kernel/eeh_pe.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 3d2dcf5afc29..c96366758acf 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c | |||
@@ -365,6 +365,17 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) | |||
365 | pe->config_addr = edev->config_addr; | 365 | pe->config_addr = edev->config_addr; |
366 | 366 | ||
367 | /* | 367 | /* |
368 | * While doing PE reset, we probably hot-reset the | ||
369 | * upstream bridge. However, the PCI devices including | ||
370 | * the associated EEH devices might be removed when EEH | ||
371 | * core is doing recovery. So that won't safe to retrieve | ||
372 | * the bridge through downstream EEH device. We have to | ||
373 | * trace the parent PCI bus, then the upstream bridge. | ||
374 | */ | ||
375 | if (eeh_probe_mode_dev()) | ||
376 | pe->bus = eeh_dev_to_pci_dev(edev)->bus; | ||
377 | |||
378 | /* | ||
368 | * Put the new EEH PE into hierarchy tree. If the parent | 379 | * Put the new EEH PE into hierarchy tree. If the parent |
369 | * can't be found, the newly created PE will be attached | 380 | * can't be found, the newly created PE will be attached |
370 | * to PHB directly. Otherwise, we have to associate the | 381 | * to PHB directly. Otherwise, we have to associate the |
@@ -641,12 +652,18 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe) | |||
641 | bus = pe->phb->bus; | 652 | bus = pe->phb->bus; |
642 | } else if (pe->type & EEH_PE_BUS || | 653 | } else if (pe->type & EEH_PE_BUS || |
643 | pe->type & EEH_PE_DEVICE) { | 654 | pe->type & EEH_PE_DEVICE) { |
655 | if (pe->bus) { | ||
656 | bus = pe->bus; | ||
657 | goto out; | ||
658 | } | ||
659 | |||
644 | edev = list_first_entry(&pe->edevs, struct eeh_dev, list); | 660 | edev = list_first_entry(&pe->edevs, struct eeh_dev, list); |
645 | pdev = eeh_dev_to_pci_dev(edev); | 661 | pdev = eeh_dev_to_pci_dev(edev); |
646 | if (pdev) | 662 | if (pdev) |
647 | bus = pdev->bus; | 663 | bus = pdev->bus; |
648 | } | 664 | } |
649 | 665 | ||
666 | out: | ||
650 | eeh_unlock(); | 667 | eeh_unlock(); |
651 | 668 | ||
652 | return bus; | 669 | return bus; |