[Intel-gfx] linux-next: manual merge of the amdgpu tree with the drm-misc tree

Stephen Rothwell sfr at canb.auug.org.au
Fri May 21 01:16:31 UTC 2021


Hi all,

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

  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c

between commit:

  35bba8313b95 ("drm/amdgpu: Convert driver sysfs attributes to static attributes")

from the drm-misc tree and commit:

  a614b336f1c1 ("drm/amdgpu: fix coding style and documentation in amdgpu_gtt_mgr.c")

from the amdgpu 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/amd/amdgpu/amdgpu_gtt_mgr.c
index a4404da8ca6d,8860545344c7..000000000000
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
@@@ -75,75 -80,6 +80,16 @@@ static DEVICE_ATTR(mem_info_gtt_total, 
  static DEVICE_ATTR(mem_info_gtt_used, S_IRUGO,
  	           amdgpu_mem_info_gtt_used_show, NULL);
  
 +static struct attribute *amdgpu_gtt_mgr_attributes[] = {
 +	&dev_attr_mem_info_gtt_total.attr,
 +	&dev_attr_mem_info_gtt_used.attr,
 +	NULL
 +};
 +
 +const struct attribute_group amdgpu_gtt_mgr_attr_group = {
 +	.attrs = amdgpu_gtt_mgr_attributes
 +};
 +
- static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func;
- /**
-  * amdgpu_gtt_mgr_init - init GTT manager and DRM MM
-  *
-  * @adev: amdgpu_device pointer
-  * @gtt_size: maximum size of GTT
-  *
-  * Allocate and initialize the GTT manager.
-  */
- int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size)
- {
- 	struct amdgpu_gtt_mgr *mgr = &adev->mman.gtt_mgr;
- 	struct ttm_resource_manager *man = &mgr->manager;
- 	uint64_t start, size;
- 
- 	man->use_tt = true;
- 	man->func = &amdgpu_gtt_mgr_func;
- 
- 	ttm_resource_manager_init(man, gtt_size >> PAGE_SHIFT);
- 
- 	start = AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS;
- 	size = (adev->gmc.gart_size >> PAGE_SHIFT) - start;
- 	drm_mm_init(&mgr->mm, start, size);
- 	spin_lock_init(&mgr->lock);
- 	atomic64_set(&mgr->available, gtt_size >> PAGE_SHIFT);
- 
- 	ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_TT, &mgr->manager);
- 	ttm_resource_manager_set_used(man, true);
- 	return 0;
- }
- 
- /**
-  * amdgpu_gtt_mgr_fini - free and destroy GTT manager
-  *
-  * @adev: amdgpu_device pointer
-  *
-  * Destroy and free the GTT manager, returns -EBUSY if ranges are still
-  * allocated inside it.
-  */
- void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev)
- {
- 	struct amdgpu_gtt_mgr *mgr = &adev->mman.gtt_mgr;
- 	struct ttm_resource_manager *man = &mgr->manager;
- 	int ret;
- 
- 	ttm_resource_manager_set_used(man, false);
- 
- 	ret = ttm_resource_manager_evict_all(&adev->mman.bdev, man);
- 	if (ret)
- 		return;
- 
- 	spin_lock(&mgr->lock);
- 	drm_mm_takedown(&mgr->mm);
- 	spin_unlock(&mgr->lock);
- 
- 	ttm_resource_manager_cleanup(man);
- 	ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_TT, NULL);
- }
- 
  /**
   * amdgpu_gtt_mgr_has_gart_addr - Check if mem has address space
   *
@@@ -306,3 -249,76 +259,61 @@@ static const struct ttm_resource_manage
  	.free = amdgpu_gtt_mgr_del,
  	.debug = amdgpu_gtt_mgr_debug
  };
+ 
+ /**
+  * amdgpu_gtt_mgr_init - init GTT manager and DRM MM
+  *
+  * @adev: amdgpu_device pointer
+  * @gtt_size: maximum size of GTT
+  *
+  * Allocate and initialize the GTT manager.
+  */
+ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size)
+ {
+ 	struct amdgpu_gtt_mgr *mgr = &adev->mman.gtt_mgr;
+ 	struct ttm_resource_manager *man = &mgr->manager;
+ 	uint64_t start, size;
 -	int ret;
+ 
+ 	man->use_tt = true;
+ 	man->func = &amdgpu_gtt_mgr_func;
+ 
+ 	ttm_resource_manager_init(man, gtt_size >> PAGE_SHIFT);
+ 
+ 	start = AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS;
+ 	size = (adev->gmc.gart_size >> PAGE_SHIFT) - start;
+ 	drm_mm_init(&mgr->mm, start, size);
+ 	spin_lock_init(&mgr->lock);
+ 	atomic64_set(&mgr->available, gtt_size >> PAGE_SHIFT);
+ 
 -	ret = device_create_file(adev->dev, &dev_attr_mem_info_gtt_total);
 -	if (ret) {
 -		DRM_ERROR("Failed to create device file mem_info_gtt_total\n");
 -		return ret;
 -	}
 -	ret = device_create_file(adev->dev, &dev_attr_mem_info_gtt_used);
 -	if (ret) {
 -		DRM_ERROR("Failed to create device file mem_info_gtt_used\n");
 -		return ret;
 -	}
 -
+ 	ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_TT, &mgr->manager);
+ 	ttm_resource_manager_set_used(man, true);
+ 	return 0;
+ }
+ 
+ /**
+  * amdgpu_gtt_mgr_fini - free and destroy GTT manager
+  *
+  * @adev: amdgpu_device pointer
+  *
+  * Destroy and free the GTT manager, returns -EBUSY if ranges are still
+  * allocated inside it.
+  */
+ void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev)
+ {
+ 	struct amdgpu_gtt_mgr *mgr = &adev->mman.gtt_mgr;
+ 	struct ttm_resource_manager *man = &mgr->manager;
+ 	int ret;
+ 
+ 	ttm_resource_manager_set_used(man, false);
+ 
+ 	ret = ttm_resource_manager_evict_all(&adev->mman.bdev, man);
+ 	if (ret)
+ 		return;
+ 
+ 	spin_lock(&mgr->lock);
+ 	drm_mm_takedown(&mgr->mm);
+ 	spin_unlock(&mgr->lock);
+ 
 -	device_remove_file(adev->dev, &dev_attr_mem_info_gtt_total);
 -	device_remove_file(adev->dev, &dev_attr_mem_info_gtt_used);
 -
+ 	ttm_resource_manager_cleanup(man);
+ 	ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_TT, NULL);
+ }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20210521/01b29c1e/attachment.sig>


More information about the Intel-gfx mailing list