[PATCH 1/9] drm/ttm: initialize the system domain with defaults

Christian König christian.koenig at amd.com
Mon Jul 27 12:23:11 UTC 2020


Am 27.07.20 um 12:50 schrieb Hellstrom, Thomas:
> On Mon, 2020-07-27 at 12:39 +0200, Christian König wrote:
>> Am 27.07.20 um 11:42 schrieb daniel at ffwll.ch:
>>> On Thu, Jul 23, 2020 at 05:16:13PM +0200, Christian König wrote:
>>>> Instead of repeating that in each driver.
>>>>
>>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>>>> ---
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 3 ---
>>>>    drivers/gpu/drm/drm_gem_vram_helper.c      | 3 ---
>>>>    drivers/gpu/drm/nouveau/nouveau_bo.c       | 3 ---
>>>>    drivers/gpu/drm/qxl/qxl_ttm.c              | 3 ---
>>>>    drivers/gpu/drm/radeon/radeon_ttm.c        | 3 ---
>>>>    drivers/gpu/drm/ttm/ttm_bo.c               | 2 ++
>>>>    drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 --
>>>>    7 files changed, 2 insertions(+), 17 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>> index 0dd5e802091d..e57c49a91b73 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>> @@ -84,9 +84,6 @@ static int amdgpu_init_mem_type(struct
>>>> ttm_bo_device *bdev, uint32_t type,
>>>>    	switch (type) {
>>>>    	case TTM_PL_SYSTEM:
>>>>    		/* System memory */
>>>> -		man->flags = 0;
>>>> -		man->available_caching = TTM_PL_MASK_CACHING;
>>>> -		man->default_caching = TTM_PL_FLAG_CACHED;
>>>>    		break;
>>>>    	case TTM_PL_TT:
>>>>    		/* GTT memory  */
>>>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c
>>>> b/drivers/gpu/drm/drm_gem_vram_helper.c
>>>> index 3296ed3df358..be177afdeb9a 100644
>>>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
>>>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
>>>> @@ -1009,9 +1009,6 @@ static int bo_driver_init_mem_type(struct
>>>> ttm_bo_device *bdev, uint32_t type,
>>>>    {
>>>>    	switch (type) {
>>>>    	case TTM_PL_SYSTEM:
>>>> -		man->flags = 0;
>>>> -		man->available_caching = TTM_PL_MASK_CACHING;
>>>> -		man->default_caching = TTM_PL_FLAG_CACHED;
>>>>    		break;
>>>>    	case TTM_PL_VRAM:
>>>>    		man->func = &ttm_bo_manager_func;
>>>> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c
>>>> b/drivers/gpu/drm/nouveau/nouveau_bo.c
>>>> index 4ccf937df0d0..53af25020bb2 100644
>>>> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
>>>> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
>>>> @@ -655,9 +655,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device
>>>> *bdev, uint32_t type,
>>>>    
>>>>    	switch (type) {
>>>>    	case TTM_PL_SYSTEM:
>>>> -		man->flags = 0;
>>>> -		man->available_caching = TTM_PL_MASK_CACHING;
>>>> -		man->default_caching = TTM_PL_FLAG_CACHED;
>>>>    		break;
>>>>    	case TTM_PL_VRAM:
>>>>    		man->flags = TTM_MEMTYPE_FLAG_FIXED;
>>>> diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c
>>>> b/drivers/gpu/drm/qxl/qxl_ttm.c
>>>> index 1d8e07b8b19e..e9b8c921c1f0 100644
>>>> --- a/drivers/gpu/drm/qxl/qxl_ttm.c
>>>> +++ b/drivers/gpu/drm/qxl/qxl_ttm.c
>>>> @@ -54,9 +54,6 @@ static int qxl_init_mem_type(struct
>>>> ttm_bo_device *bdev, uint32_t type,
>>>>    	switch (type) {
>>>>    	case TTM_PL_SYSTEM:
>>>>    		/* System memory */
>>>> -		man->flags = 0;
>>>> -		man->available_caching = TTM_PL_MASK_CACHING;
>>>> -		man->default_caching = TTM_PL_FLAG_CACHED;
>>>>    		break;
>>>>    	case TTM_PL_VRAM:
>>>>    	case TTM_PL_PRIV:
>>>> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c
>>>> b/drivers/gpu/drm/radeon/radeon_ttm.c
>>>> index b474781a0920..b4cb75361577 100644
>>>> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
>>>> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
>>>> @@ -76,9 +76,6 @@ static int radeon_init_mem_type(struct
>>>> ttm_bo_device *bdev, uint32_t type,
>>>>    	switch (type) {
>>>>    	case TTM_PL_SYSTEM:
>>>>    		/* System memory */
>>>> -		man->flags = 0;
>>>> -		man->available_caching = TTM_PL_MASK_CACHING;
>>>> -		man->default_caching = TTM_PL_FLAG_CACHED;
>>>>    		break;
>>>>    	case TTM_PL_TT:
>>>>    		man->func = &ttm_bo_manager_func;
>>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c
>>>> b/drivers/gpu/drm/ttm/ttm_bo.c
>>>> index 7c02ce784805..1f1f9e463265 100644
>>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>>> @@ -1677,6 +1677,8 @@ int ttm_bo_device_init(struct ttm_bo_device
>>>> *bdev,
>>>>    	 * Initialize the system memory buffer type.
>>>>    	 * Other types need to be driver / IOCTL initialized.
>>>>    	 */
>>>> +	bdev->man[TTM_PL_SYSTEM].available_caching =
>>>> TTM_PL_MASK_CACHING;
>>>> +	bdev->man[TTM_PL_SYSTEM].default_caching = TTM_PL_FLAG_CACHED;
>>>>    	ret = ttm_bo_init_mm(bdev, TTM_PL_SYSTEM, 0);
>>>>    	if (unlikely(ret != 0))
>>>>    		goto out_no_sys;
>>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
>>>> b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
>>>> index 1d78187eaba6..00cef1a3a178 100644
>>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
>>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
>>>> @@ -742,8 +742,6 @@ static int vmw_init_mem_type(struct
>>>> ttm_bo_device *bdev, uint32_t type,
>>>>    	switch (type) {
>>>>    	case TTM_PL_SYSTEM:
>>>>    		/* System memory */
>>>> -		man->available_caching = TTM_PL_FLAG_CACHED;
>>> Above is CACHED, not CACHING, so needs to stay to overwrite the
>>> default.
>> Crap I missed that. Problem is that I wanted to remove the
>> possibility
>> to init the system domain with different caching attributes.
>>
>> I don't see how vmwgfx is every going to use this? Thomas do you
>> have
>> any idea what this was good for?
> I interpret that like vmwgfx can't handle any other caching attribute
> than 'cached'. But I can't see anyone feeding vmwgfx system memory
> buffers with other caching attributes. In that case, those would be
> ignored.

Yeah, agree. So any objections to change that setting in vmwgfx?

This way we could have the same settings for all drivers in the kernel 
and I don't see why any driver should have something special here.

Christian.

>
> /Thomas
>
>
>> Thanks,
>> Christian.
>>
>>> With that fixed:
>>>
>>> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
>>>
>>>> -		man->default_caching = TTM_PL_FLAG_CACHED;
>>>>    		break;
>>>>    	case TTM_PL_VRAM:
>>>>    		/* "On-card" video ram */
>>>> -- 
>>>> 2.17.1
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel at lists.freedesktop.org
>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7C66991383884c46a79f4608d8321ae136%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637314438323255193&sdata=Y86QJdnrTmhaG5Sx1NmKaeUbbOkrVvQQP%2BBB29SuA9I%3D&reserved=0
> ----------------------------------------------------------------------
> Intel Sweden AB
> Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden
> Registration Number: 556189-6027
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.



More information about the dri-devel mailing list