[PATCH] drm/amdgpu: fix the ioctl direction for DRM_IOCTL_AMDGPU_GEM_VA

Michel Dänzer michel.daenzer at mailbox.org
Tue Aug 6 09:42:06 UTC 2024


Hi Yamato-san,


On 2024-08-06 04:43, Masatake YAMATO wrote:
> Though drmCommandWriteRead() is used in libdrm [1],
> DRM_IOCTL_AMDGPU_GEM_VA uses DRM_IOW for encoding.
> 
> [1] https://gitlab.freedesktop.org/mesa/drm/-/blob/main/amdgpu/amdgpu_bo.c?ref_type=heads

AFAICT libdrm doesn't read from the struct drm_amdgpu_gem_va it passes to the ioctl after the latter returns though.

Also, while amdgpu_gem_va_ioctl (the ioctl implementation in the kernel) modifies the struct:

	args->va_address &= AMDGPU_GMC_HOLE_MASK;

that looks like an implementation detail which could be avoided if necessary, and shouldn't be propagated back to user space.


I'd suggest fixing libdrm to use drmCommandWrite instead.


-- 
Earthling Michel Dänzer       \        GNOME / Xwayland / Mesa developer
https://redhat.com             \               Libre software enthusiast


More information about the amd-gfx mailing list