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

From: Stephen Rothwell <[email-masked]>
Date: Thu, 3 Sep 2020 17:06:12 +1000

Hi all,

On Wed, 26 Aug 2020 10:18:53 +1000 Stephen Rothwell <[email-masked]> wrote:
>
> Hi all,
> 
> Today's linux-next merge of the drm-misc tree got conflicts in:
> 
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> 
> between commits:
> 
>   cacbbe7c0065 ("drm/amdgpu: move stolen memory from gmc to mman")
>   72de33f8f7ba ("drm/amdgpu: move IP discovery data to mman")
>   87ded5caeec3 ("drm/amdgpu: move vram usage by vbios to mman (v2)")
>   1348969ab68c ("drm/amdgpu: drm_device to amdgpu_device by inline-f (v2)")
> 
> from the amdgpu tree and commits:
> 
>   6c28aed6e5b7 ("drm/amdgfx/ttm: use wrapper to get ttm memory managers")
>   9de59bc20149 ("drm/ttm: rename ttm_mem_type_manager -> ttm_resource_manager.")
>   4f297b9c82e1 ("drm/amdgpu/ttm: move vram/gtt mgr allocations to mman.")
> 
> 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/amd/amdgpu/amdgpu_gtt_mgr.c
> index e1b66898cb76,697bc2c6fdb2..000000000000
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> @@@ -47,10 -46,10 +46,10 @@@ static ssize_t amdgpu_mem_info_gtt_tota
>   		struct device_attribute *attr, char *buf)
>   {
>   	struct drm_device *ddev = dev_get_drvdata(dev);
>  -	struct amdgpu_device *adev = ddev->dev_private;
>  +	struct amdgpu_device *adev = drm_to_adev(ddev);
> - 
> + 	struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
>   	return snprintf(buf, PAGE_SIZE, "%llu\n",
> - 			(adev->mman.bdev.man[TTM_PL_TT].size) * PAGE_SIZE);
> + 			man->size * PAGE_SIZE);
>   }
>   
>   /**
> @@@ -65,10 -64,10 +64,10 @@@ static ssize_t amdgpu_mem_info_gtt_used
>   		struct device_attribute *attr, char *buf)
>   {
>   	struct drm_device *ddev = dev_get_drvdata(dev);
>  -	struct amdgpu_device *adev = ddev->dev_private;
>  +	struct amdgpu_device *adev = drm_to_adev(ddev);
> - 
> + 	struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
>   	return snprintf(buf, PAGE_SIZE, "%llu\n",
> - 			amdgpu_gtt_mgr_usage(&adev->mman.bdev.man[TTM_PL_TT]));
> + 			amdgpu_gtt_mgr_usage(man));
>   }
>   
>   static DEVICE_ATTR(mem_info_gtt_total, S_IRUGO,
> diff --cc drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 63e541409549,fc5f7ac53d0a..000000000000
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@@ -2316,8 -2251,8 +2261,8 @@@ static int amdgpu_mm_dump_table(struct 
>   	struct drm_info_node *node = (struct drm_info_node *)m->private;
>   	unsigned ttm_pl = (uintptr_t)node->info_ent->data;
>   	struct drm_device *dev = node->minor->dev;
>  -	struct amdgpu_device *adev = dev->dev_private;
>  +	struct amdgpu_device *adev = drm_to_adev(dev);
> - 	struct ttm_mem_type_manager *man = &adev->mman.bdev.man[ttm_pl];
> + 	struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, ttm_pl);
>   	struct drm_printer p = drm_seq_file_printer(m);
>   
>   	man->func->debug(man, &p);
> diff --cc drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> index de37ceff0e56,7ba2be37e6ba..000000000000
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> @@@ -60,22 -75,8 +75,24 @@@ struct amdgpu_mman 
>   	/* Scheduler entity for buffer moves */
>   	struct drm_sched_entity			entity;
>   
>  +	uint64_t		stolen_vga_size;
>  +	struct amdgpu_bo	*stolen_vga_memory;
>  +	uint64_t		stolen_extended_size;
>  +	struct amdgpu_bo	*stolen_extended_memory;
>  +	bool			keep_stolen_vga_memory;
>  +
>  +	/* discovery */
>  +	uint8_t				*discovery_bin;
>  +	uint32_t			discovery_tmr_size;
>  +	struct amdgpu_bo		*discovery_memory;
>  +
>  +	/* firmware VRAM reservation */
>  +	u64		fw_vram_usage_start_offset;
>  +	u64		fw_vram_usage_size;
>  +	struct amdgpu_bo	*fw_vram_usage_reserved_bo;
>  +	void		*fw_vram_usage_va;
> + 	struct amdgpu_vram_mgr vram_mgr;
> + 	struct amdgpu_gtt_mgr gtt_mgr;
>   };
>   
>   struct amdgpu_copy_mem {
> diff --cc drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 91098a385ed6,7574be6cd7a0..000000000000
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@@ -81,10 -84,10 +84,10 @@@ static ssize_t amdgpu_mem_info_vram_use
>   		struct device_attribute *attr, char *buf)
>   {
>   	struct drm_device *ddev = dev_get_drvdata(dev);
>  -	struct amdgpu_device *adev = ddev->dev_private;
>  +	struct amdgpu_device *adev = drm_to_adev(ddev);
> - 
> + 	struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
>   	return snprintf(buf, PAGE_SIZE, "%llu\n",
> - 		amdgpu_vram_mgr_usage(&adev->mman.bdev.man[TTM_PL_VRAM]));
> + 			amdgpu_vram_mgr_usage(man));
>   }
>   
>   /**
> @@@ -99,10 -102,10 +102,10 @@@ static ssize_t amdgpu_mem_info_vis_vram
>   		struct device_attribute *attr, char *buf)
>   {
>   	struct drm_device *ddev = dev_get_drvdata(dev);
>  -	struct amdgpu_device *adev = ddev->dev_private;
>  +	struct amdgpu_device *adev = drm_to_adev(ddev);
> - 
> + 	struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
>   	return snprintf(buf, PAGE_SIZE, "%llu\n",
> - 		amdgpu_vram_mgr_vis_usage(&adev->mman.bdev.man[TTM_PL_VRAM]));
> + 			amdgpu_vram_mgr_vis_usage(man));
>   }
>   
>   static ssize_t amdgpu_mem_info_vram_vendor(struct device *dev,

These are now conflict between the amdgpu tree and the drm tree.

-- 
Cheers,
Stephen Rothwell