]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amdgpu: fix metadata_size for ubo ioctl queries
authorShiwu Zhang <shiwu.zhang@amd.com>
Mon, 24 May 2021 06:30:21 +0000 (14:30 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 2 Jun 2021 02:35:50 +0000 (22:35 -0400)
Although the kfd_ioctl_get_dmabuf_info() still fail it will indicate
the caller right metadat_size useful for the same kfd ioctl next time.

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index 6b09d79cfa90f46820804001a7d32ce4a1baf0f3..9fcb3bc59558c8ac90c6ab7fa07e0af1d7e7aeb6 100644 (file)
@@ -1197,6 +1197,9 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
 
        BUG_ON(bo->tbo.type == ttm_bo_type_kernel);
        ubo = to_amdgpu_bo_user(bo);
+       if (metadata_size)
+               *metadata_size = ubo->metadata_size;
+
        if (buffer) {
                if (buffer_size < ubo->metadata_size)
                        return -EINVAL;
@@ -1205,8 +1208,6 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
                        memcpy(buffer, ubo->metadata, ubo->metadata_size);
        }
 
-       if (metadata_size)
-               *metadata_size = ubo->metadata_size;
        if (flags)
                *flags = ubo->metadata_flags;