Skip to content

Introduce a vfio driver over virtio devices

Yishai Hadas kvm llvm oe-kbuild-all virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 168 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11virtio-pci: Use virtio pci device layer vq info instead of generic onedrivers/virtio/virtio_pci_common.c drivers/virtio/virtio_pci_common.h+10 -34 replies
2/11virtio: Define feature bit for administration virtqueueinclude/uapi/linux/virtio_config.h+7 -10 replies
3/11virtio-pci: Introduce admin virtqueuedrivers/virtio/Makefile drivers/virtio/virtio.c drivers/virtio/virtio_pci_common.h +4 more+129 -75 replies
4/11virtio: Expose the synchronous command helper functiondrivers/net/virtio_net.c drivers/virtio/virtio_ring.c include/linux/virtio.h+40 -150 replies
5/11virtio-pci: Introduce admin command sending functiondrivers/virtio/virtio.c drivers/virtio/virtio_pci_common.h drivers/virtio/virtio_pci_modern.c +4 more+119 -00 replies
6/11virtio-pci: Introduce API to get PF virtio device from VF PCI devicedrivers/virtio/virtio_pci_common.c include/linux/virtio.h+13 -00 replies
7/11virtio-pci: Introduce admin commandsinclude/uapi/linux/virtio_pci.h+44 -00 replies
8/11vfio/pci: Expose vfio_pci_core_setup_barmap()drivers/vfio/pci/vfio_pci_core.c drivers/vfio/pci/vfio_pci_rdwr.c include/linux/vfio_pci_core.h+28 -262 replies
9/11vfio/pci: Expose vfio_pci_iowrite/read##size()drivers/vfio/pci/vfio_pci_rdwr.c include/linux/vfio_pci_core.h+25 -40 replies
10/11vfio/virtio: Expose admin commands over virtio devicedrivers/vfio/pci/virtio/cmd.c drivers/vfio/pci/virtio/cmd.h+173 -063 replies
11/11vfio/virtio: Introduce a vfio driver over virtio devicesMAINTAINERS drivers/vfio/pci/Kconfig drivers/vfio/pci/Makefile +5 more+585 -294 replies

Reviews trailers per patch

7 of 11 patches have a Reviewed-by or Acked-by.

PatchParav PanditJiri Pirko
1/11R-b R-b
2/11R-b R-b
3/11R-b R-b
4/11R-b R-b
5/11R-b R-b
6/11R-b R-b
7/11R-b R-b
8/11
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH vfio 00/11] Introduce a vfio driver over virtio devices

This series introduce a vfio driver over virtio devices to support the legacy interface functionality for VFs.

Background, from the virtio spec [1].
--------------------------------------------------------------------
In some systems, there is a need to support a virtio legacy driver with a device that does not directly support the legacy interface. In such scenarios, a group owner device can provide the legacy interface functionality for the group member devices. The driver of the owner device can then access the legacy interface of a member device on behalf of the legacy member device driver.

For example, with the SR-IOV group type, group members (VFs) can not present the legacy interface in an I/O BAR in BAR0 as expected by the legacy pci driver. If the legacy driver is running inside a virtual machine, the hypervisor executing the virtual machine can present a virtual device with an I/O BAR in BAR0. The hypervisor intercepts the legacy driver accesses to this I/O BAR and forwards them to the group owner device (PF) using group administration commands.
--------------------------------------------------------------------

The first 7 patches are in the virtio area and handle the below:
- Introduce the admin virtqueue infrastcture.
- Expose APIs to enable upper layers as of vfio, net, etc to execute admin commands.
- Expose the layout of the commands that should be used for supporting the legacy access.

The above follows the virtio spec that was lastly accepted in that area [1].

The last 4 patches are in the vfio area and handle the below:
- Expose some APIs from vfio/pci to be used by the vfio/virtio driver.
- Expose admin commands over virtio device.
- Introduce a vfio driver over virtio devices to support the legacy interface functionality for VFs.

The series was tested successfully over virtio-net VFs in the host, while running in the guest both modern and legacy drivers.

[1]
https://github.com/oasis-tcs/virtio-spec/commit/03c2d32e5093ca9f2a17797242fbef88efe94b8c

Yishai

Feng Liu (7):
virtio-pci: Use virtio pci device layer vq info instead of generic one
virtio: Define feature bit for administration virtqueue
virtio-pci: Introduce admin virtqueue
virtio: Expose the synchronous command helper function
virtio-pci: Introduce admin command sending function
virtio-pci: Introduce API to get PF virtio device from VF PCI device
virtio-pci: Introduce admin commands

Yishai Hadas (4):
vfio/pci: Expose vfio_pci_core_setup_barmap() vfio/pci: Expose vfio_pci_iowrite/read##size() vfio/virtio: Expose admin commands over virtio device vfio/virtio: Introduce a vfio driver over virtio devices

 MAINTAINERS                            |   6 +
 drivers/net/virtio_net.c               |  21 +-
 drivers/vfio/pci/Kconfig               |   2 +
 drivers/vfio/pci/Makefile              |   2 +
 drivers/vfio/pci/vfio_pci_core.c       |  25 ++
 drivers/vfio/pci/vfio_pci_rdwr.c       |  38 +-
 drivers/vfio/pci/virtio/Kconfig        |  15 +
 drivers/vfio/pci/virtio/Makefile       |   4 +
 drivers/vfio/pci/virtio/cmd.c          | 146 +++++++
 drivers/vfio/pci/virtio/cmd.h          |  35 ++
 drivers/vfio/pci/virtio/main.c         | 546 +++++++++++++++++++++++++
 drivers/virtio/Makefile                |   2 +-
 drivers/virtio/virtio.c                |  44 +-
 drivers/virtio/virtio_pci_common.c     |  24 +-
 drivers/virtio/virtio_pci_common.h     |  17 +-
 drivers/virtio/virtio_pci_modern.c     |  12 +-
 drivers/virtio/virtio_pci_modern_avq.c | 138 +++++++
 drivers/virtio/virtio_ring.c           |  27 ++
 include/linux/vfio_pci_core.h          |  20 +
 include/linux/virtio.h                 |  19 +
 include/linux/virtio_config.h          |   7 +
 include/linux/virtio_pci_modern.h      |   3 +
 include/uapi/linux/virtio_config.h     |   8 +-
 include/uapi/linux/virtio_pci.h        |  66 +++
 24 files changed, 1171 insertions(+), 56 deletions(-)
 create mode 100644 drivers/vfio/pci/virtio/Kconfig
 create mode 100644 drivers/vfio/pci/virtio/Makefile
 create mode 100644 drivers/vfio/pci/virtio/cmd.c
 create mode 100644 drivers/vfio/pci/virtio/cmd.h
 create mode 100644 drivers/vfio/pci/virtio/main.c
 create mode 100644 drivers/virtio/virtio_pci_modern_avq.c
Signature · 6 lines
2.27.0

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization