From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: linuxppc-dev@ozlabs.org
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: [PATCH 3/3] powerpc/powernv: Issue fundamental reset if required
Date: Thu, 4 Dec 2014 16:50:53 +1100 [thread overview]
Message-ID: <1417672253-26692-4-git-send-email-gwshan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1417672253-26692-1-git-send-email-gwshan@linux.vnet.ibm.com>
Function pnv_pci_reset_secondary_bus() is used to reset specified
PCI bus, which is leaded by root complex or PCI bridge. That means
the function shouldn't be called on PCI root bus and the patch
removes the logic for the case.
Also, some adapters may require fundamental reset to reload their
firmwares. Otherwise, they will fail to load their firmwares and
those adapters can't work properly after reset, as being reported
in VFIO pass-through scenario. The patch checks the reset type
required by the child adapters of the PCI bus and issue fundamental
reset if necessary.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
arch/powerpc/platforms/powernv/eeh-ioda.c | 34 +++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 78d94df..cf38781 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -636,18 +636,34 @@ static int ioda_eeh_bridge_reset(struct pci_dev *dev, int option)
return (rc == OPAL_SUCCESS) ? 0 : -EIO;
}
-void pnv_pci_reset_secondary_bus(struct pci_dev *dev)
+static int pnv_pci_dev_reset_type(struct pci_dev *pdev, void *data)
{
- struct pci_controller *hose;
+ int *freset = data;
- if (pci_is_root_bus(dev->bus)) {
- hose = pci_bus_to_host(dev->bus);
- ioda_eeh_phb_reset(hose, EEH_RESET_HOT);
- ioda_eeh_phb_reset(hose, EEH_RESET_DEACTIVATE);
- } else {
- ioda_eeh_bridge_reset(dev, EEH_RESET_HOT);
- ioda_eeh_bridge_reset(dev, EEH_RESET_DEACTIVATE);
+ /*
+ * Stop the iteration immediately if any one PCI
+ * device requires fundamental reset
+ */
+ *freset |= pdev->needs_freset;
+ return *freset;
+}
+
+void pnv_pci_reset_secondary_bus(struct pci_dev *pdev)
+{
+ int option = EEH_RESET_HOT;
+ int freset = 0;
+
+ /* Check if we need issue fundamental reset */
+ if (pdev->subordinate) {
+ pci_walk_bus(pdev->subordinate,
+ pnv_pci_dev_reset_type, &freset);
+ if (freset)
+ option = EEH_RESET_FUNDAMENTAL;
}
+
+ /* Issue required reset type */
+ ioda_eeh_bridge_reset(pdev, option);
+ ioda_eeh_bridge_reset(pdev, EEH_RESET_DEACTIVATE);
}
/**
--
1.8.3.2
next prev parent reply other threads:[~2014-12-04 5:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 5:50 [PATCH v2 0/3] powerpc/pci: PCI slot unified reset Gavin Shan
2014-12-04 5:50 ` [PATCH 1/3] powerpc/powernv: Use PCI slot reset infrastructure Gavin Shan
2014-12-04 5:50 ` [PATCH 2/3] powerpc/powernv: Refactor ioda_eeh_reset() Gavin Shan
2014-12-04 5:50 ` Gavin Shan [this message]
2015-02-17 2:29 ` [PATCH v2 0/3] powerpc/pci: PCI slot unified reset Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1417672253-26692-4-git-send-email-gwshan@linux.vnet.ibm.com \
--to=gwshan@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).