Skip to content

Add support for unmanaged SR-IOV

Alexander Duyck kvm linux-nvme linux-pci lkml netdev virtio-dev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest5 patches 19 repliesIn review
  2. v65 patches 6 repliesSuperseded
  3. v54 patches 13 repliesSuperseded

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5pci: Add pci_sriov_configure_simple for PFs that don't manage VF resourcesdrivers/pci/iov.c include/linux/pci.h+34 -01 reply
2/5virtio_pci: Add support for unmanaged SR-IOV on virtio_pci devicesdrivers/virtio/virtio_pci_common.c+1 -015 replies
3/5ena: Migrate over to unmanaged SR-IOV supportdrivers/net/ethernet/amazon/ena/ena_netdev.c+1 -270 replies
4/5nvme: Migrate over to unmanaged SR-IOV supportdrivers/nvme/host/pci.c+1 -190 replies
5/5pci-pf-stub: Add PF driver stub for PFs that function only to enable VFsdrivers/pci/Kconfig drivers/pci/Makefile drivers/pci/pci-pf-stub.c +1 more+70 -00 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristoph HellwigDonald DutileMark Rustad
SeriesR-b
1/5T-b
2/5R-b T-b
3/5
4/5R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v7 thread

Cover letter [pci PATCH v7 0/5] Add support for unmanaged SR-IOV

This series is meant to add support for SR-IOV on devices when the VFs are not managed by the kernel. Examples of recent patches attempting to do this include:
virto - https://patchwork.kernel.org/patch/10241225/
pci-stub - https://patchwork.kernel.org/patch/10109935/
vfio - https://patchwork.kernel.org/patch/10103353/
uio - https://patchwork.kernel.org/patch/9974031/

Since this is quickly blowing up into a multi-driver problem it is probably best to implement this solution as generically as possible.

This series is an attempt to do that. What we do with this patch set is provide a generic framework to enable SR-IOV in the case that the PF driver doesn't support managing the VFs itself.

I based my patch set originally on the patch by Mark Rustad but there isn't much left after going through and cleaning out the bits that were no longer needed, and after incorporating the feedback from David Miller. At this point the only items to be fully reused was his patch description which is now present in patch 3 of the set.

This solution is limited in scope to just adding support for devices that provide no functionality for SR-IOV other than allocating the VFs by calling pci_enable_sriov. Previous sets had included patches for VFIO, but for now I am dropping that as the scope of that work is larger then I think I can take on at this time.

v2: Reduced scope back to just virtio_pci and vfio-pci
Broke into 3 patch set from single patch
Changed autoprobe behavior to always set when num_vfs is set non-zero
v3: Updated Documentation to clarify when sriov_unmanaged_autoprobe is used
Wrapped vfio_pci_sriov_configure to fix build errors w/o SR-IOV in kernel
v4: Dropped vfio-pci patch
Added ena and nvme to drivers now using pci_sriov_configure_unmanaged Dropped pci_disable_sriov call in virtio_pci to be consistent with ena
v5: Dropped sriov_unmanaged_autoprobe and pci_sriov_conifgure_unmanaged
Added new patch that enables pci_sriov_configure_simple Updated drivers to use pci_sriov_configure_simple
v6: Defined pci_sriov_configure_simple as NULL when SR-IOV is not enabled
Updated drivers to drop "#ifdef" checks for IOV
Added pci-pf-stub as place for PF-only drivers to add support
v7: Dropped pci_id table explanation from pci-pf-stub driver
Updated pci_sriov_configure_simple to drop need for err value Fixed comment explaining why pci_sriov_configure_simple is NULL

Cc Mark Rustad <[email protected]>
Cc Maximilian Heyne <[email protected]>
Cc Liang-Min Wang <[email protected]>
Cc David Woodhouse <[email protected]>

---

Alexander Duyck (5):
pci: Add pci_sriov_configure_simple for PFs that don't manage VF resources
virtio_pci: Add support for unmanaged SR-IOV on virtio_pci devices
ena: Migrate over to unmanaged SR-IOV support
nvme: Migrate over to unmanaged SR-IOV support
pci-pf-stub: Add PF driver stub for PFs that function only to enable VFs

 drivers/net/ethernet/amazon/ena/ena_netdev.c |   28 -------------
 drivers/nvme/host/pci.c                      |   20 ----------
 drivers/pci/Kconfig                          |   12 ++++++
 drivers/pci/Makefile                         |    2 +
 drivers/pci/iov.c                            |   31 +++++++++++++++
 drivers/pci/pci-pf-stub.c                    |   54 ++++++++++++++++++++++++++
 drivers/virtio/virtio_pci_common.c           |    1 
 include/linux/pci.h                          |    3 +
 include/linux/pci_ids.h                      |    2 +
 9 files changed, 107 insertions(+), 46 deletions(-)
 create mode 100644 drivers/pci/pci-pf-stub.c

--