[PATCH 1/2] drm/amdgpu/gmc: check if AGP is disabled in amdgpu_gmc_agp_addr()

Christian König ckoenig.leichtzumerken at gmail.com
Mon Nov 27 19:09:08 UTC 2023


Am 21.11.23 um 16:05 schrieb Alex Deucher:
> Return AMDGPU_BO_INVALID_OFFSET if the AGP aperture is disabled.
> There is no reason to check further if the aperture is disabled.

Yeah, but there shouldn't be a reason to check it earlier either.

The "if (bo->ttm->dma_address[0] + PAGE_SIZE >= adev->gmc.agp_size)" 
just below this code here should catch that perfectly well.

Christian.

>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 5f71414190e9..0f85f906791b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -181,6 +181,9 @@ uint64_t amdgpu_gmc_agp_addr(struct ttm_buffer_object *bo)
>   {
>   	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev);
>   
> +	if (!adev->gmc.agp_size)
> +		return AMDGPU_BO_INVALID_OFFSET;
> +
>   	if (bo->ttm->num_pages != 1 || bo->ttm->caching == ttm_cached)
>   		return AMDGPU_BO_INVALID_OFFSET;
>   



More information about the amd-gfx mailing list