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

Tvrtko Ursulin
2021-11-09T17:37:00Z

On 09/11/2021 17:19, Lucas De Marchi wrote:
> On Tue, Nov 09, 2021 at 12:17:59PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> On igfx + dgfx setups, it appears that intel_iommu=igfx_off option only
>> disables the igfx iommu. Stop relying on global intel_iommu_gfx_mapped
>> and probe presence of iommu domain per device to accurately reflect its
>> status.
>
> nice, I was just starting to look into thus but for another reason: we
> are adding support for other archs, like aarch64, and the global from here
> was a problem

Yes I realized the other iommu angle as well. To do this properly we
need to sort the intel_vtd_active call sites into at least two buckets -
which are truly about VT-d and which are just IOMMU.

For instance the THP decision in i915_gemfs.co would be "are we behind
any iommu". Some other call sites are possibly only about the bugs in
the igfx iommu. Not sure if there is a third bucket for any potential
differences between igfx iommu and other Intel iommu in case of dgfx.

I'd like to hear from Baolu as well to confirm if intel_iommu driver is
handling igfx + dgfx correctly in respect to the two global variables I
mention in the commit message.

> should we change drivers/gpu/drm/i915/Kconfig.debug to stop selecting
> CONFIG_INTEL_IOMMU and CONFIG_INTEL_IOMMU_DEFAULT_ON?

Don't know. For debug it is useful since it can catch more issues but
whether or not kconfig can be improved to select the right one for the
platform? I guess select X if X86, select Y if Z?

Regards,

Tvrtko