* [PATCH] powerpc/eeh: sysfs entries lost
@ 2014-06-26 6:58 Mike Qiu
2014-06-26 7:15 ` Gavin Shan
0 siblings, 1 reply; 2+ messages in thread
From: Mike Qiu @ 2014-06-26 6:58 UTC (permalink / raw)
To: linuxppc-dev; +Cc: weiyang, Mike Qiu, gwshan
The sysfs entries are lost because of commit 2213fb1 ("powerpc/eeh:
Skip eeh sysfs when eeh is disabled"). That commit added condition
to create sysfs entries with EEH_ENABLED, which isn't populated
when trying to create sysfs entries on PowerNV platform during system
boot time. The patch fixes the issue by:
* Reoder EEH initialization functions so that they're same on
PowerNV/pSeries.
* Cache PE's primary bus by PowerNV platform instead of EEH core
to avoid kernel crash caused by the function reorder. Another
benefit with this is to avoid one eeh_probe_mode_dev() in EEH
core.
Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
---
arch/powerpc/kernel/eeh_pe.c | 11 -----------
arch/powerpc/platforms/powernv/eeh-powernv.c | 17 ++++++++++++++++-
arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index fbd01eb..1dce071a 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -351,17 +351,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
pe->config_addr = edev->config_addr;
/*
- * While doing PE reset, we probably hot-reset the
- * upstream bridge. However, the PCI devices including
- * the associated EEH devices might be removed when EEH
- * core is doing recovery. So that won't safe to retrieve
- * the bridge through downstream EEH device. We have to
- * trace the parent PCI bus, then the upstream bridge.
- */
- if (eeh_probe_mode_dev())
- pe->bus = eeh_dev_to_pci_dev(edev)->bus;
-
- /*
* Put the new EEH PE into hierarchy tree. If the parent
* can't be found, the newly created PE will be attached
* to PHB directly. Otherwise, we have to associate the
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 56a206f..48eb223 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -107,6 +107,7 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
struct pnv_phb *phb = hose->private_data;
struct device_node *dn = pci_device_to_OF_node(dev);
struct eeh_dev *edev = of_node_to_eeh_dev(dn);
+ int ret;
/*
* When probing the root bridge, which doesn't have any
@@ -143,7 +144,21 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
edev->pe_config_addr = phb->bdfn_to_pe(phb, dev->bus, dev->devfn & 0xff);
/* Create PE */
- eeh_add_to_parent_pe(edev);
+ ret = eeh_add_to_parent_pe(edev);
+ if (ret) {
+ pr_warn("%s: Can't add PCI dev %s to parent PE (%d)\n",
+ __func__, pci_name(dev), ret);
+ return ret;
+ }
+
+ /*
+ * Cache the PE primary bus, which can't be fetched when
+ * full hotplug is in progress. In that case, all child
+ * PCI devices of the PE are expected to be removed prior
+ * to PE reset.
+ */
+ if (!edev->pe->bus)
+ edev->pe->bus = dev->bus;
/*
* Enable EEH explicitly so that we will do EEH check
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index de19ede..81f2d3a 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1142,8 +1142,8 @@ static void pnv_pci_ioda_fixup(void)
#ifdef CONFIG_EEH
eeh_probe_mode_set(EEH_PROBE_MODE_DEV);
- eeh_addr_cache_build();
eeh_init();
+ eeh_addr_cache_build();
#endif
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc/eeh: sysfs entries lost
2014-06-26 6:58 [PATCH] powerpc/eeh: sysfs entries lost Mike Qiu
@ 2014-06-26 7:15 ` Gavin Shan
0 siblings, 0 replies; 2+ messages in thread
From: Gavin Shan @ 2014-06-26 7:15 UTC (permalink / raw)
To: Mike Qiu; +Cc: weiyang, linuxppc-dev, gwshan
On Thu, Jun 26, 2014 at 02:58:47AM -0400, Mike Qiu wrote:
>The sysfs entries are lost because of commit 2213fb1 ("powerpc/eeh:
>Skip eeh sysfs when eeh is disabled"). That commit added condition
>to create sysfs entries with EEH_ENABLED, which isn't populated
>when trying to create sysfs entries on PowerNV platform during system
>boot time. The patch fixes the issue by:
>
> * Reoder EEH initialization functions so that they're same on
> PowerNV/pSeries.
> * Cache PE's primary bus by PowerNV platform instead of EEH core
> to avoid kernel crash caused by the function reorder. Another
> benefit with this is to avoid one eeh_probe_mode_dev() in EEH
> core.
>
>Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Thanks,
Gavin
>---
> arch/powerpc/kernel/eeh_pe.c | 11 -----------
> arch/powerpc/platforms/powernv/eeh-powernv.c | 17 ++++++++++++++++-
> arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
> 3 files changed, 17 insertions(+), 13 deletions(-)
>
>diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
>index fbd01eb..1dce071a 100644
>--- a/arch/powerpc/kernel/eeh_pe.c
>+++ b/arch/powerpc/kernel/eeh_pe.c
>@@ -351,17 +351,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
> pe->config_addr = edev->config_addr;
>
> /*
>- * While doing PE reset, we probably hot-reset the
>- * upstream bridge. However, the PCI devices including
>- * the associated EEH devices might be removed when EEH
>- * core is doing recovery. So that won't safe to retrieve
>- * the bridge through downstream EEH device. We have to
>- * trace the parent PCI bus, then the upstream bridge.
>- */
>- if (eeh_probe_mode_dev())
>- pe->bus = eeh_dev_to_pci_dev(edev)->bus;
>-
>- /*
> * Put the new EEH PE into hierarchy tree. If the parent
> * can't be found, the newly created PE will be attached
> * to PHB directly. Otherwise, we have to associate the
>diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
>index 56a206f..48eb223 100644
>--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
>+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
>@@ -107,6 +107,7 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
> struct pnv_phb *phb = hose->private_data;
> struct device_node *dn = pci_device_to_OF_node(dev);
> struct eeh_dev *edev = of_node_to_eeh_dev(dn);
>+ int ret;
>
> /*
> * When probing the root bridge, which doesn't have any
>@@ -143,7 +144,21 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
> edev->pe_config_addr = phb->bdfn_to_pe(phb, dev->bus, dev->devfn & 0xff);
>
> /* Create PE */
>- eeh_add_to_parent_pe(edev);
>+ ret = eeh_add_to_parent_pe(edev);
>+ if (ret) {
>+ pr_warn("%s: Can't add PCI dev %s to parent PE (%d)\n",
>+ __func__, pci_name(dev), ret);
>+ return ret;
>+ }
>+
>+ /*
>+ * Cache the PE primary bus, which can't be fetched when
>+ * full hotplug is in progress. In that case, all child
>+ * PCI devices of the PE are expected to be removed prior
>+ * to PE reset.
>+ */
>+ if (!edev->pe->bus)
>+ edev->pe->bus = dev->bus;
>
> /*
> * Enable EEH explicitly so that we will do EEH check
>diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
>index de19ede..81f2d3a 100644
>--- a/arch/powerpc/platforms/powernv/pci-ioda.c
>+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
>@@ -1142,8 +1142,8 @@ static void pnv_pci_ioda_fixup(void)
>
> #ifdef CONFIG_EEH
> eeh_probe_mode_set(EEH_PROBE_MODE_DEV);
>- eeh_addr_cache_build();
> eeh_init();
>+ eeh_addr_cache_build();
> #endif
> }
>
>--
>1.8.1.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-26 7:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26 6:58 [PATCH] powerpc/eeh: sysfs entries lost Mike Qiu
2014-06-26 7:15 ` Gavin Shan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).