[PATCH v2] drm/amdkfd: fixes for HMM mem allocation
Felix Kuehling
felix.kuehling at amd.com
Mon Jan 8 17:51:29 UTC 2024
On 2024-01-07 08:07, Dafna Hirschfeld wrote:
> Fix err return value and reset pgmap->type after checking it.
>
> Fixes: c83dee9b6394 ("drm/amdkfd: add SPM support for SVM")
> Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>
> Signed-off-by: Dafna Hirschfeld <dhirschfeld at habana.ai>
> ---
> v2: remove unrelated DOC fix and add 'Fixes' tag.
Thank you. I'm going to apply this patch to amd-staging-drm-next.
Regards,
Felix
>
> drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 6c25dab051d5..b8680e0753ca 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -1021,7 +1021,7 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev)
> } else {
> res = devm_request_free_mem_region(adev->dev, &iomem_resource, size);
> if (IS_ERR(res))
> - return -ENOMEM;
> + return PTR_ERR(res);
> pgmap->range.start = res->start;
> pgmap->range.end = res->end;
> pgmap->type = MEMORY_DEVICE_PRIVATE;
> @@ -1037,10 +1037,10 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev)
> r = devm_memremap_pages(adev->dev, pgmap);
> if (IS_ERR(r)) {
> pr_err("failed to register HMM device memory\n");
> - /* Disable SVM support capability */
> - pgmap->type = 0;
> if (pgmap->type == MEMORY_DEVICE_PRIVATE)
> devm_release_mem_region(adev->dev, res->start, resource_size(res));
> + /* Disable SVM support capability */
> + pgmap->type = 0;
> return PTR_ERR(r);
> }
>
More information about the amd-gfx
mailing list