[PATCH v2 0/5] intel_iommu: Enable PRQ support for passthrough device

Zhenzhong Duan posted 5 patches 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260618034844.618011-1-zhenzhong.duan@intel.com
Maintainers: Yi Liu <yi.l.liu@intel.com>, Eric Auger <eric.auger@redhat.com>, Zhenzhong Duan <zhenzhong.duan@intel.com>, Peter Maydell <peter.maydell@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, "Clément Mathieu--Drif" <clement.mathieu--drif@bull.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>
hw/i386/intel_iommu_accel.h   |  14 ++
include/hw/i386/intel_iommu.h |   6 +
include/system/iommufd.h      |   7 +-
backends/iommufd.c            |  28 +++-
hw/arm/smmuv3-accel.c         |   6 +-
hw/i386/intel_iommu.c         |   4 +
hw/i386/intel_iommu_accel.c   | 245 +++++++++++++++++++++++++++++++++-
hw/vfio/iommufd.c             |   2 +-
backends/trace-events         |   3 +-
hw/i386/trace-events          |   2 +
10 files changed, 301 insertions(+), 16 deletions(-)
[PATCH v2 0/5] intel_iommu: Enable PRQ support for passthrough device
Posted by Zhenzhong Duan 1 month, 1 week ago
Hi,

When svm=on,pasid-bits=N,fsts=on is configured for virtual vtd, we enable
guest's support for vSVM. In this case, the host VTD may generate
recoverable first stage page fault event, QEMU read the event and inject
it to guest.

After guest handles the event, it sends a page group response, QEMU gets
the response and pass it to host VTD.

This series adds QEMU support for receiving such host events through the
FAULTQ interface and propagating them to the guest, then catching guest's
responses and propagating them to host.

GIT branch: https://github.com/yiliu1765/qemu/tree/zhenzhong/iommufd_prq.v2

Tests:
Tested with DSA wq attached to an user APP which triggers IO page fault on
process page table durging DMA.

Thanks
Zhenzhong

Changelog:
v2:
- define fault_fd int type (Liuyi)
- update comments on FAULTQ_BUF_SIZE (Liuyi)
- drop param vtd_hiod in vtd_destroy_old_fs_faultq() (Liuyi)
- s/vtd_propagate_page_group_response_accel/vtd_accel_propagate_page_group_response (Liuyi)
- call vtd_prq_response_notify() directly instead of through pri_notifier (Liuyi)
- replace "fault_id != 0" check with "fault_fd < 0" check (Liuyi)

Zhenzhong Duan (5):
  backends/iommufd: Introduce iommufd_backend_alloc_faultq
  backends/iommufd: Extend iommufd_backend_alloc_hwpt() with fault_id
  intel_iommu_accel: Add PRQ injection for passthrough device
  intel_iommu_accel: Accept PRQ response for passthrough device
  intel_iommu_accel: teardown FAULTQ resources in bottom half

 hw/i386/intel_iommu_accel.h   |  14 ++
 include/hw/i386/intel_iommu.h |   6 +
 include/system/iommufd.h      |   7 +-
 backends/iommufd.c            |  28 +++-
 hw/arm/smmuv3-accel.c         |   6 +-
 hw/i386/intel_iommu.c         |   4 +
 hw/i386/intel_iommu_accel.c   | 245 +++++++++++++++++++++++++++++++++-
 hw/vfio/iommufd.c             |   2 +-
 backends/trace-events         |   3 +-
 hw/i386/trace-events          |   2 +
 10 files changed, 301 insertions(+), 16 deletions(-)

-- 
2.52.0