Subject: linux-next: manual merge of the drm-misc tree with the drm-intel tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 22 Sep 2020 13:34:20 +1000

Hi all,

Today's linux-next merge of the drm-misc tree got a conflict in:

  drivers/gpu/drm/i915/selftests/mock_gem_device.c

between commit:

  9f9f4101fc98 ("drm/i915/selftests: Push the fake iommu device from the stack to data")

from the drm-intel tree and commit:

  cd01269d11a3 ("drm/i915/selftests: align more to real device lifetimes")

from the drm-misc tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 397c313a8b69,c207d2239791..000000000000
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@@ -118,12 -116,11 +116,11 @@@ static struct dev_pm_domain pm_domain 
  
  struct drm_i915_private *mock_gem_device(void)
  {
 -	struct drm_i915_private *i915;
 -	struct pci_dev *pdev;
  #if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
 -	struct dev_iommu iommu;
 +	static struct dev_iommu fake_iommu = { .priv = (void *)-1 };
  #endif
 +	struct drm_i915_private *i915;
 +	struct pci_dev *pdev;
- 	int err;
  
  	pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
  	if (!pdev)
@@@ -141,11 -132,28 +132,26 @@@
  	dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
  
  #if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
 -	/* HACK HACK HACK to disable iommu for the fake device; force identity mapping */
 -	memset(&iommu, 0, sizeof(iommu));
 -	iommu.priv = (void *)-1;
 -	pdev->dev.iommu = &iommu;
 +	/* HACK to disable iommu for the fake device; force identity mapping */
 +	pdev->dev.iommu = &fake_iommu;
  #endif
+ 	if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) {
+ 		put_device(&pdev->dev);
+ 		return NULL;
+ 	}
+ 
+ 	i915 = devm_drm_dev_alloc(&pdev->dev, &mock_driver,
+ 				  struct drm_i915_private, drm);
+ 	if (IS_ERR(i915)) {
+ 		pr_err("Failed to allocate mock GEM device: err=%ld\n", PTR_ERR(i915));
+ 		devres_release_group(&pdev->dev, NULL);
+ 		put_device(&pdev->dev);
+ 
+ 		return NULL;
+ 	}
  
  	pci_set_drvdata(pdev, i915);
+ 	i915->drm.pdev = pdev;
  
  	dev_pm_domain_set(&pdev->dev, &pm_domain);
  	pm_runtime_enable(&pdev->dev);