[PATCH v3 2/3] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC

Michel Dänzer michel at daenzer.net
Wed Jul 24 14:24:04 UTC 2019


On 2019-07-24 4:10 p.m., Andrey Grodzovsky wrote:
> Move the logic to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC in
> amdgpu_bo_do_create into standalone helper so it can be reused
> in other functions.
> 
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
> ---
>  [...]
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 989b7b5..64c45bc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -413,6 +413,41 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
>  	return false;
>  }
>  
> +void amdgpu_bo_validate_uswc(u64 *bo_flags)

This API is a bit weird. :) I'd suggest something like

bool amdgpu_uswc_supported(void)
{
	if ([various conditions])
		return false;

	return true;
}

> @@ -466,33 +501,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
> [...]
> +	amdgpu_bo_validate_uswc(&bo->flags);

And then

	if (!amdgpu_uswc_supported())
		bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;

here.


-- 
Earthling Michel Dänzer               |              https://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list