EEH Support for VFIO PCI Device The series of patches intend to support EEH for VFIO PCI devices on sPAPR platform. It requires corresponding host kernel support. Also, it was built on top of Alexey's VFIO-for-sPAPR git repository.
QEMU: git://github.com/aik/qemu.git (branch: vfio) Kernel: http://linuxppc.10917.n7.nabble.com/PATCH-v7-0-3-EEH-Support-for-VFIO-PCI-Device-td82692.html Here are some highlights and I don't have experience with QEMU. Any comments should be appreciated. * EEH RTAS calls captured by sPAPR platform firstly, and then routed to VFIO for handling if VFIO can. Otheriwse, it will be routed to host kernel for handling via dedicated VFIO container IOCTL command. * PHB BUID is the identifier to one specific PHB, which is required information for EEH address mapping. In order to retrieve that from VFIO, the PCI bus struct has been extended to have additional field "sysdata" for that. * The guest can't do error injection until holding valid token. Each guest is allowed to have one token at once. The RTAS calls managing token is simply emulated in QEMU. However, the error injection has to be routed to host kernel by dedicated syscall. Changelog ========= v3 -> v4: * Remove the error injection from the patchset. Mike or I will work on it later. * The IOCTL command is handled by VFIO PCI device instead of container. * "sysdata" in root bus to pass PHB BUID isn't needed. * Update the IOCTL argunemt according to kernel's changes. v4 -> v6: * Header file update according to kerenl's change. * Split one ioctl command to 5. * Doesn't rely the kerenl to figure out RTAS return value. QEMU translate return value from ioctl() to RTAS return value insteadly. v6 -> v7: * All ioctl commands go to VFIO container fd instead of PCI device fd. * QEMU figures out the PE address directly. * Rely on sPAPRVFIOPHBState, which is one-to-one mapping with IOMMU group. Gavin Shan (3): headers: Sync with Linux header VFIO: Helper function to retrieve container fd sPAPR: EEH support for VFIO PCI device hw/misc/vfio.c | 17 +++ hw/ppc/spapr.c | 1 + hw/ppc/spapr_pci.c | 1 + hw/ppc/spapr_pci_vfio.c | 332 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/misc/vfio.h | 1 + include/hw/pci-host/spapr.h | 1 + include/hw/ppc/spapr.h | 1 + linux-headers/linux/vfio.h | 66 +++++++++ 8 files changed, 420 insertions(+) -- 1.8.3.2