@samitouri / QOSamiQemu / commits / 2b0d91ed44

intel_iommu: Expose flag VIOMMU_FLAG_PASID_SUPPORTED and VIOMMU_FLAG_WANT_PASID_ATTACH

VFIO device will check flag VIOMMU_FLAG_PASID_SUPPORTED and expose PASID capability, also check VIOMMU_FLAG_WANT_PASID_ATTACH to enable pasid attachment, without those guest could not enable PASID of this device even if vIOMMU's pasid is configured. We don't expose the two flags when fist stage translation is not configured as we don't support shadow page table on a PASID. This is the final knob to enable PASID. Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Clement Mathieu--Drif <clement.mathieu--drif@bull.com> Tested-by: Xudong Hao <xudong.hao@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260527054658.1021096-18-zhenzhong.duan@intel.com>

Zhenzhong Duan committed May 27, 2026 at 01:46 UTC 2b0d91ed44e5e0dc77d151cbdc0dba40c6101490
1 file changed +5
hw/i386/intel_iommu.c
+5
@@ -4788,6 +4788,11 @@ static uint64_t vtd_get_viommu_flags(void *opaque)
4788 if (s->fsts) {
4789 flags = VIOMMU_FLAG_WANT_NESTING_PARENT |
4790 VIOMMU_FLAG_WANT_NESTING_DIRTY_TRACKING;
4791 +
4792 + if (s->pasid) {
4793 + flags |= VIOMMU_FLAG_PASID_SUPPORTED |
4794 + VIOMMU_FLAG_WANT_PASID_ATTACH;
4795 + }
4796 }
4797
4798 return flags;