From 6c88f174c5fc89ea6dd660a7d6fe7165e8dde4e0 Mon Sep 17 00:00:00 2001 From: "shanghui.lsh" Date: Tue, 24 Mar 2020 22:54:01 +0800 Subject: [PATCH] alinux: pci/iohub-sriov: fix iohub-sriov VF probe issue fix #26111716 When doing VF probing, it will fail when calling pci_enable_sriov() function, as we should only call this function for physfn. Fix this issue by adding physfn check before the call. Fixes: 4a5d2b59c6eb ("alinux: pci/iohub-sriov: Support for Alibaba PCIe IOHub SRIOV") Signed-off-by: shanghui.lsh Reviewed-by: luanshi [ caspar: modify the commit log] Acked-by: Caspar Zhang --- drivers/pci/iohub-sriov/iohub-sriov.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/pci/iohub-sriov/iohub-sriov.c b/drivers/pci/iohub-sriov/iohub-sriov.c index 1902f31cdbca..db2476861dff 100644 --- a/drivers/pci/iohub-sriov/iohub-sriov.c +++ b/drivers/pci/iohub-sriov/iohub-sriov.c @@ -56,11 +56,13 @@ xdragon_sriov_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) } /* VF number fixed as 255, will change to a parameter later */ - err = pci_enable_sriov(dev, 255); - if (err) { - dev_err(&dev->dev, "Failed to enable PCI sriov: %d\n", - err); - goto error; + if (dev->is_physfn) { + err = pci_enable_sriov(dev, 255); + if (err) { + dev_err(&dev->dev, "Failed to enable PCI sriov: %d\n", + err); + goto error; + } } return 0; -- GitLab