Re: [PATCH] drm/i915: Use per device iommu check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 26/11/2021 08:26, Lu Baolu wrote:
On 2021/11/25 19:47, Robin Murphy wrote:
On 2021-11-25 10:42, Tvrtko Ursulin wrote:
From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

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@xxxxxxx>

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@xxxxxxxxxxxxxxx>

I have empirically established device_iommu_mapped() matches 1:1 with intel_iommu_gfx_mapped and a simple non-NULL check against iommu_get_domain_for_dev(), so okay, I will respin with that change.

We leave the problem of being able to distinguish between pass-through and address translation from the drivers for later. Thanks both!

Regards,

Tvrtko



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux