Skip to content

RFC VFIO: Report IOMMU fault event to userspace

Lan Tianyu kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 23 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3VFIO: Add new cmd to receive eventfd from userspace to notify IOMMU fault eventdrivers/vfio/vfio_iommu_type1.c include/uapi/linux/vfio.h+60 -05 replies
2/3VFIO: Add IOMMU fault notifier callbackdrivers/vfio/vfio_iommu_type1.c include/linux/iommu.h include/uapi/linux/vfio.h+44 -05 replies
3/3VFIO: Add new cmd for user space to get IOMMU fault infodrivers/vfio/vfio_iommu_type1.c include/uapi/linux/vfio.h+46 -01 reply

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC PATCH 0/3] VFIO: Report IOMMU fault event to userspace

This patchset proposes a solution to report hardware IOMMU fault event to userspace. Motivation is to make vIOMMU in Qemu get physical fault event and info from IOMMU hardware. vIOMMU is in charge of transforming fault info and inject to guest. The feature is also very important to support first level translation(Translation request with PASID) in VM which requires vIOMMU to inject device page request to VM.

Introduce two new VFIO cmd for VFIO IOMMU type1 driver
- VFIO_IOMMU_SET_FAULT_EVENT_FD
Receive eventfd from user space and trigger eventfd when get fault event
from IOMMU.

- VFIO_IOMMU_GET_FAULT_INFO
Return IOMMU fault info to userspace.

VFIO IOMMU Type1 driver needs to register IOMMU fault event notifier to IOMMU driver for assigned devices when they are attached to VFIO container. IOMMU driver will run VFIO fault event callback when hardware IOMMU triggers fault events for devices assigned to VFIO container. Then, type1 driver signals eventfd provided by userspace and usrspace gets fault info via new cmd.

IOMMU interface are still in design stage and so we still can't register IOMMU fault event notifier to IOMMU driver. This patchset is prototype code to check whether VFIO IOMMU type1 driver is suitable place to deal with IOMMU fault event and just passes build test.

Very appreciate for comments.

Lan Tianyu (3):
VFIO: Add new cmd to receive eventfd from userspace to notify IOMMU
fault event
VFIO: Add IOMMU fault notifier callback
VFIO: Add new cmd for user space to get IOMMU fault info

 drivers/vfio/vfio_iommu_type1.c | 106 ++++++++++++++++++++++++++++++++++++++++
 include/linux/iommu.h           |   7 +++
 include/uapi/linux/vfio.h       |  37 ++++++++++++++
 3 files changed, 150 insertions(+)
Signature · 1 line
1.8.3.1