[Intel-gfx] [PATCH] drm/i915/selftests: Disable iommu for the mock device

Chris Wilson chris at chris-wilson.co.uk
Mon Sep 18 16:40:44 UTC 2017


Quoting Chris Wilson (2017-09-14 17:22:40)
> On some machines, the iommu cannot allocate a domain for the mock device
> causing the dma_map_sg() to fail, and the selftest to fail with -ENOMEM.
> For the mock selftests, we are using a fake device and do not care about
> iommu; so convince intel_iommu to treat us as a dummy device with an
> identity mapping (and no iommu domain).
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101080
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/selftests/mock_gem_device.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index 678723430d78..38ed006be5be 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -146,6 +146,9 @@ struct drm_i915_private *mock_gem_device(void)
>         dev_set_name(&pdev->dev, "mock");
>         dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
>  
> +       /* hack to disable iommu for the fake device; force identity mapping */
> +       pdev->dev.archdata.iommu = (void *)-1;

Drat, and now having pushed it to a wider set of machines, that tells me
that archdata.iommu only exists under CONFIG_INTEL_IOMMU
-Chris


More information about the Intel-gfx mailing list