Re: [PATCH v18 5/6] vfio: ABI for mdev display dma-buf operation

From: Gerd Hoffmann
Date: Wed Nov 15 2017 - 05:48:05 EST


On Wed, Nov 15, 2017 at 05:11:54PM +0800, Tina Zhang wrote:
> Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user query and get
> a plane and its information. So far, two types of buffers are supported:
> buffers based on dma-buf and buffers based on region.
>
> This ioctl can be invoked with:
> 1) Either DMABUF or REGION flag. Vendor driver returns a plane_info
> successfully only when the specific kind of buffer is supported.
> 2) Flag PROBE. And at the same time either DMABUF or REGION must be set,
> so that vendor driver returns success only when the specific kind of
> buffer is supported.
>
> Add VFIO_DEVICE_GET_GFX_DMABUF ioctl command to let user get a specific
> dma-buf fd of an exposed MDEV buffer provided by dmabuf_id which was
> returned in VFIO_DEVICE_QUERY_GFX_PLANE ioctl command.
>
> The life cycle of an exposed MDEV buffer is handled by userspace and
> tracked by kernel space. The returned dmabuf_id in struct vfio_device_
> query_gfx_plane can be a new id of a new exposed buffer or an old id of
> a re-exported buffer. Host user can check the value of dmabuf_id to see
> if it needs to create new resources according to the new exposed buffer
> or just re-use the existing resource related to the old buffer.

Reviewed-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>