From: Gerd Hoffmann <kraxel@redhat.com>
To: Tina Zhang <tina.zhang@intel.com>, zhenyuw@linux.intel.com
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx@lists.freedesktop.org,
intel-gvt-dev@lists.freedesktop.org
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Date: Tue, 26 Sep 2017 09:12:03 +0200 [thread overview]
Message-ID: <1506409923.32072.9.camel@redhat.com> (raw)
In-Reply-To: <1503051696-5158-6-git-send-email-tina.zhang@intel.com>
Hi,
[ bringing a private discussion back to the list ]
> The dma-buf's life cycle is handled by user mode and tracked by
> kernel.
> The returned fd in struct vfio_device_query_gfx_plane can be a new
> fd or an old fd of a re-exported dma-buf. Host user mode can check
> the
> value of fd and to see if it needs to create new resource according
> to
> the new fd or just use the existed resource related to the old fd.
Ok, this idea has a fundamental flaw: The life cycle of the dma-buf
and the file handle are not identical. The dma-buf can exist longer
than the file handle in case other references to the dma-buf exist. So
when trying to use the file handle as identifier for the dma-buf you'll
end up with all sorts of strange effects.
So, I'd suggest to use a id instead, and add a ioctl to get a dmabuf
for a given id (incremental patch):
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -538,12 +538,22 @@ struct vfio_device_gfx_plane_info {
__u32 y_pos; /* vertical position of cursor plane, upper
left corner in lines*/
union {
__u32 region_index; /* region index */
- __s32 fd; /* dma-buf fd */
+ __u32 dmabuf_id; /* dma-buf id */
};
};
#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14)
+struct vfio_device_gfx_dmabuf_fd {
+ __u32 argsz;
+ __u32 flags;
+ /* in */
+ __u32 dmabuf_id;
+ /* out */
+ __s32 dmabuf_fd;
+};
+
+#define VFIO_DEVICE_GET_GFX_DMABUF _IO(VFIO_TYPE, VFIO_BASE + 15)
/* -------- API for Type1 VFIO IOMMU -------- */
[ no changes for a region-based display ]
git branch, kernel, with updated dmabuf patch:
https://www.kraxel.org/cgit/linux/log/?h=gvt-dmabuf-v14
qemu branch:
https://www.kraxel.org/cgit/qemu/log/?h=work/intel-vgpu
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-09-26 7:12 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 10:21 [PATCH v14 0/7] drm/i915/gvt: Dma-buf support for GVT-g Tina Zhang
2017-08-18 10:21 ` [PATCH v14 1/7] drm/i915/gvt: Add framebuffer decoder support Tina Zhang
2017-08-23 9:45 ` Zhenyu Wang
2017-08-18 10:21 ` [PATCH v14 2/7] drm: Introduce RGB 64-bit 16:16:16:16 float format Tina Zhang
2017-08-18 10:21 ` [PATCH v14 3/7] drm/i915/gvt: Add " Tina Zhang
2017-08-18 10:21 ` [PATCH v14 4/7] drm/i915/gvt: Add opregion support Tina Zhang
2017-08-18 10:21 ` [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation Tina Zhang
2017-08-22 8:33 ` Gerd Hoffmann
2017-09-26 7:12 ` Gerd Hoffmann [this message]
2017-09-27 9:03 ` Zhang, Tina
2017-09-27 10:11 ` Gerd Hoffmann
2017-09-28 23:43 ` Zhang, Tina
2017-09-29 7:11 ` Gerd Hoffmann
2017-09-29 7:04 ` Zhang, Tina
2017-09-29 7:28 ` Gerd Hoffmann
2017-09-29 7:49 ` Zhang, Tina
2017-09-29 8:03 ` Gerd Hoffmann
2017-09-29 9:08 ` Zhang, Tina
2017-09-29 10:20 ` Gerd Hoffmann
2017-09-29 23:59 ` Zhang, Tina
2017-10-06 12:12 ` Gerd Hoffmann
2017-10-07 7:39 ` Zhang, Tina
2017-09-29 7:32 ` Gerd Hoffmann
2017-08-18 10:21 ` [PATCH v14 6/7] drm/i915: Introduce GEM proxy Tina Zhang
2017-08-18 11:36 ` Joonas Lahtinen
2017-08-18 10:21 ` [PATCH v14 7/7] drm/i915/gvt: Dmabuf support for GVT-g Tina Zhang
2017-08-18 12:19 ` ✓ Fi.CI.BAT: success for drm/i915/gvt: Dma-buf " Patchwork
2017-08-25 11:47 ` [PATCH v14 0/7] " Gerd Hoffmann
2017-08-25 12:52 ` Wang, Zhi A
2017-09-04 6:23 ` Zhang, Tina
2017-09-04 6:38 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506409923.32072.9.camel@redhat.com \
--to=kraxel@redhat.com \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=tina.zhang@intel.com \
--cc=zhenyuw@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.