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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> 
> 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.

Thank you.

After reading this mail, I inspected drm_ioctl.c.
I was surprised that drm_ioctl() uses only the offset from DRM_COMMAND_BASE when choosing
the real handler for a cmd. Therefore we can switch from drmCommandWriteRead to drmCommandWrite
without breaking applications using the library. 

Masatake YAMATO

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





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux