Skip to content

vfio pci: Add support for OpenCAPI devices

christophe lombard linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2powerpc/powernv: Register IOMMU group for OpenCAPI devicesarch/powerpc/platforms/powernv/ocxl.c arch/powerpc/platforms/powernv/pci-ioda.c arch/powerpc/platforms/powernv/pci.h+156 -400 replies
2/2vfio/pci: Introduce OpenCAPI devices support.drivers/vfio/pci/Kconfig drivers/vfio/pci/Makefile drivers/vfio/pci/vfio_pci.c +4 more+374 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] vfio pci: Add support for OpenCAPI devices

This series adds support for the OpenCAPI devices for vfio pci.

It builds on top of the existing ocxl driver +
http://patchwork.ozlabs.org/patch/1177999/

VFIO is a Linux kernel driver framework used by QEMU to make devices directly assignable to virtual machines.

All OpenCAPI devices on the same PCI slot will all be grouped and assigned to the same guest.

- Assume these are the devices you want to assign 0007:00:00.0 Processing accelerators: IBM Device 062b 0007:00:00.1 Processing accelerators: IBM Device 062b

- Two Devices in the group

$ ls /sys/bus/pci/devices/0007\:00\:00.0/iommu_group/devices/
 0007:00:00.0  0007:00:00.1

- Find vendor & device ID

$ lspci -n -s 0007:00:00
 0007:00:00.0 1200: 1014:062b
 0007:00:00.1 1200: 1014:062b

- Unbind from the current ocxl device driver if already loaded

$ rmmod ocxl

- Load vfio-pci if it's not already done.

$ modprobe vfio-pci

- Bind to vfio-pci

$ echo 1014 062b > /sys/bus/pci/drivers/vfio-pci/new_id

This will result in a new device node "/dev/vfio/7", which will be use by QEMU to setup the devices for passthrough.

- Pass to qemu using -device vfio-pci
-device vfio-pci,multifunction=on,host=0007:00:00.0,addr=2.0 -device vfio-pci,multifunction=on,host=0007:00:00.1,addr=2.1

It has been tested in a bare-metal and QEMU environment using the memcpy and the AFP AFUs.

christophe lombard (2):
powerpc/powernv: Register IOMMU group for OpenCAPI devices vfio/pci: Introduce OpenCAPI devices support.

 arch/powerpc/platforms/powernv/ocxl.c     | 164 ++++++++++---
 arch/powerpc/platforms/powernv/pci-ioda.c |  19 +-
 arch/powerpc/platforms/powernv/pci.h      |  13 +
 drivers/vfio/pci/Kconfig                  |   7 +
 drivers/vfio/pci/Makefile                 |   1 +
 drivers/vfio/pci/vfio_pci.c               |  19 ++
 drivers/vfio/pci/vfio_pci_ocxl.c          | 287 ++++++++++++++++++++++
 drivers/vfio/vfio.c                       |  25 ++
 include/linux/vfio.h                      |  13 +
 include/uapi/linux/vfio.h                 |  22 ++
 10 files changed, 530 insertions(+), 40 deletions(-)
 create mode 100644 drivers/vfio/pci/vfio_pci_ocxl.c
Signature · 1 line
2.21.0