diff mbox

drm/i915/selftests: Only touch archdata.iommu when it exists

Message ID 20170918164652.14200-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Sept. 18, 2017, 4:46 p.m. UTC
archdata.iommu only exists when CONFIG_IOMMU_API is enabled (and only
applies to intel-iommu in our case) so conditionally compile it when it
doesn't exist.

Fixes: b5891fb520f7 ("drm/i915/selftests: Disable iommu for the mock device")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Matthew Auld Sept. 18, 2017, 6:35 p.m. UTC | #1
On 18 September 2017 at 17:46, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> archdata.iommu only exists when CONFIG_IOMMU_API is enabled (and only
> applies to intel-iommu in our case) so conditionally compile it when it
> doesn't exist.
>
> Fixes: b5891fb520f7 ("drm/i915/selftests: Disable iommu for the mock device")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Chris Wilson Sept. 19, 2017, 9:17 a.m. UTC | #2
Quoting Matthew Auld (2017-09-18 19:35:15)
> On 18 September 2017 at 17:46, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > archdata.iommu only exists when CONFIG_IOMMU_API is enabled (and only
> > applies to intel-iommu in our case) so conditionally compile it when it
> > doesn't exist.
> >
> > Fixes: b5891fb520f7 ("drm/i915/selftests: Disable iommu for the mock device")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>

Ta. Thanks and pushed,
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 38ed006be5be..2388424a14da 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -146,8 +146,10 @@  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));
 
+#if IS_ENABLED(CONFIG_IOMMU_API)
 	/* hack to disable iommu for the fake device; force identity mapping */
 	pdev->dev.archdata.iommu = (void *)-1;
+#endif
 
 	dev_pm_domain_set(&pdev->dev, &pm_domain);
 	pm_runtime_enable(&pdev->dev);