diff mbox

powerpc/pci: Fix SRIOV not building without EEH enabled

Message ID 20160617052517.25322-1-ruscur@russell.cc (mailing list archive)
State Accepted
Headers show

Commit Message

Russell Currey June 17, 2016, 5:25 a.m. UTC
On Book3E CPUs (and possibly other configs), it is possible to have SRIOV
(CONFIG_PCI_IOV) set without CONFIG_EEH.  The SRIOV code does not check
for this, and if EEH is disabled, pci_dn.c fails to build.

Fix this by gating the EEH-specific code in the SRIOV implementation
behind CONFIG_EEH.

Fixes: 39218cd0 ("powerpc/eeh: EEH device for VF")
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: <stable@vger.kernel.org> # 4.1+
Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 arch/powerpc/kernel/pci_dn.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Ellerman June 21, 2016, 12:27 p.m. UTC | #1
On Fri, 2016-17-06 at 05:25:17 UTC, Russell Currey wrote:
> On Book3E CPUs (and possibly other configs), it is possible to have SRIOV
> (CONFIG_PCI_IOV) set without CONFIG_EEH.  The SRIOV code does not check
> for this, and if EEH is disabled, pci_dn.c fails to build.
> 
> Fix this by gating the EEH-specific code in the SRIOV implementation
> behind CONFIG_EEH.
> 
> Fixes: 39218cd0 ("powerpc/eeh: EEH device for VF")
> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Russell Currey <ruscur@russell.cc>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/fb36e90736938d50fdaa1be7af

cheers
diff mbox

Patch

diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index ecdccce..afeda26 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -181,7 +181,9 @@  struct pci_dn *add_dev_pci_data(struct pci_dev *pdev)
 {
 #ifdef CONFIG_PCI_IOV
 	struct pci_dn *parent, *pdn;
+#ifdef CONFIG_EEH
 	struct eeh_dev *edev;
+#endif /* CONFIG_EEH */
 	int i;
 
 	/* Only support IOV for now */
@@ -208,11 +210,13 @@  struct pci_dn *add_dev_pci_data(struct pci_dev *pdev)
 			return NULL;
 		}
 
+#ifdef CONFIG_EEH
 		/* Create the EEH device for the VF */
 		eeh_dev_init(pdn, pci_bus_to_host(pdev->bus));
 		edev = pdn_to_eeh_dev(pdn);
 		BUG_ON(!edev);
 		edev->physfn = pdev;
+#endif /* CONFIG_EEH */
 	}
 #endif /* CONFIG_PCI_IOV */
 
@@ -266,12 +270,14 @@  void remove_dev_pci_data(struct pci_dev *pdev)
 			    pdn->devfn != pci_iov_virtfn_devfn(pdev, i))
 				continue;
 
+#ifdef CONFIG_EEH
 			/* Release EEH device for the VF */
 			edev = pdn_to_eeh_dev(pdn);
 			if (edev) {
 				pdn->edev = NULL;
 				kfree(edev);
 			}
+#endif /* CONFIG_EEH */
 
 			if (!list_empty(&pdn->list))
 				list_del(&pdn->list);