On 2021/11/25 19:47, Robin Murphy wrote:
On 2021-11-25 10:42, Tvrtko Ursulin wrote:
From: Tvrtko Ursulin tvrtko.ursulin@intel.com
With both integrated and discrete Intel GPUs in a system, the current global check of intel_iommu_gfx_mapped, as done from intel_vtd_active() may not be completely accurate.
In this patch we add i915 parameter to intel_vtd_active() in order to prepare it for multiple GPUs and we also change the check away from Intel specific intel_iommu_gfx_mapped (global exported by the Intel IOMMU driver) to probing the presence of IOMMU domain on a specific device using iommu_get_domain_for_dev().
FWIW the way you have it now is functionally equivalent to using device_iommu_mapped(), which I think might be slightly clearer for the current intent, but I don't have a significantly strong preference (after all, this *was* the de-facto way of checking before device_iommu_mapped() was introduced, and there are still other examples of it around). So from the IOMMU perspective,
Acked-by: Robin Murphy robin.murphy@arm.com
Perhaps the AGP driver could also be tweaked and intel_iommu_gfx_mapped cleaned away entirely, but I'll leave that for Baolu to think about :)
I fully agreed with Robin.
I prefer device_iommu_mapped() more than iommu_get_domain_for_dev().
"iommu_get_domain_for_dev(dev) == NULL" simply means that the device does not have any domain attached. Although at present, it is equivalent to device DMAing without IOMMU translation. But I'm sure it will change in the future.
With device_iommu_mapped() replaced,
Reviewed-by: Lu Baolu baolu.lu@linux.intel.com
Best regards, baolu