On 2017年02月21日 04:53, Alex Williamson wrote: > On Sun, 19 Feb 2017 22:47:07 +0800 > Lan Tianyu <tianyu.lan@xxxxxxxxx> wrote: >> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h >> index 519eff3..8616334 100644 >> --- a/include/uapi/linux/vfio.h >> +++ b/include/uapi/linux/vfio.h >> @@ -547,6 +547,21 @@ struct vfio_iommu_type1_dma_unmap { >> #define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) >> #define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) >> >> +/* >> + * VFIO_IOMMU_SET_FAULT_EVENT_FD _IO(VFIO_TYPE, VFIO_BASE + 17) >> + * >> + * Receive eventfd from userspace to notify fault event from IOMMU. >> + */ >> +struct vfio_iommu_type1_set_fault_eventfd { >> + __u32 argsz; >> + __u32 flags; >> +/* What IOMMU Fault events should be reported. */ >> +#define VFIO_IOMMU_UR_FAULT_WITHOUT_PASID (1 << 0) > > Is this a filter? Would multiple filters be allowed using the same > eventfd or would each type require a separate eventfd? How would a > user be able to probe what flags/filters are available? Should this > simply use the IRQ_INFO and SET_IRQ ioctls from the device file > descriptor for consistency? The filer should be in the IOMMU driver. VFIO driver needs to pass the flag to IOMMU driver. The flag indicates what kind of fault events IOMMU driver should report and is provided by userspace. Qemu has info what kind of fault event it can handle. The new IOMMU driver API of registering IOMMU fault notifier is still under design stage and so I didn't use the flag in this patchset. The new VFIO fault event channel also will affect the parameters of new IOMMU API and so I sent the patchset first to get some conclusion before finalizing new IOMMU API. Just like you mentioned "such an event might logically be connected to the vfio container rather than the device" about IOMMU fault event in the AER ERR mail(the discussion with Kevin), I put the IOMMU fault evenfd with VFIO container rather than vfio-pci device. -- Best regards Tianyu Lan