Currently pci_iov_add_virtfn() scans the SR-IOV BARs, adds the VF to the bus and also creates the sysfs links between the newly added VF and its parent PF. With pdev->no_vf_scan fencing off the entire pci_iov_add_virtfn() call s390 as the sole pdev->no_vf_scan user thus ends up missing these sysfs links which are required for example by QEMU/libvirt. Instead of duplicating the code refactor pci_iov_add_virtfn() to make sysfs link creation callable separately.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -2048,6 +2048,8 @@ int pci_iov_virtfn_devfn(struct pci_dev *dev, int id); · 2047 unmodified lines | |||
| 2048 | 2048 | ||
| 2049 | int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | 2049 | int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); |
| 2050 | void pci_disable_sriov(struct pci_dev *dev); | 2050 | void pci_disable_sriov(struct pci_dev *dev); |
| 2051 | |||
| 2052 | int pci_iov_sysfs_link(struct pci_dev *dev, struct pci_dev *virtfn, int id); | ||
| 2051 | int pci_iov_add_virtfn(struct pci_dev *dev, int id); | 2053 | int pci_iov_add_virtfn(struct pci_dev *dev, int id); |
| 2052 | void pci_iov_remove_virtfn(struct pci_dev *dev, int id); | 2054 | void pci_iov_remove_virtfn(struct pci_dev *dev, int id); |
| 2053 | int pci_num_vf(struct pci_dev *dev); | 2055 | int pci_num_vf(struct pci_dev *dev); |
| @@ -2073,6 +2075,12 @@ static inline int pci_iov_virtfn_devfn(struct pci_dev *dev, int id) · 19 unmodified lines | |||
| 2073 | } | 2075 | } |
| 2074 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 2076 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
| 2075 | { return -ENODEV; } | 2077 | { return -ENODEV; } |
| 2078 | |||
| 2079 | static inline int pci_iov_sysfs_link(struct pci_dev *dev, | ||
| 2080 | struct pci_dev *virtfn, int id) | ||
| 2081 | { | ||
| 2082 | return -ENODEV; | ||
| 2083 | } | ||
| 2076 | static inline int pci_iov_add_virtfn(struct pci_dev *dev, int id) | 2084 | static inline int pci_iov_add_virtfn(struct pci_dev *dev, int id) |
| 2077 | { | 2085 | { |
| 2078 | return -ENOSYS; | 2086 | return -ENOSYS; |