Skip to contentSkip to conversation

vfio: ABI for mdev display dma-buf operation

PATCH Superseded Tina Zhang 6 participants 25 messages Jul 5, 2017 – Jul 19, 2017 VFIO driver

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Tina Zhang

author
#0 lore raw

PATCH v10 1/1 vfio: ABI for mdev display dma-buf operation

Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user mode query and get the plan and its related information.

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 need to creat new resource according to the new fd or just use the existed resource related to the old fd.

include/uapi/linux/vfio.h +30 -0
index ae46105..c92bc69 100644
@@ -502,6 +502,36 @@ struct vfio_pci_hot_reset {
 
 #define VFIO_DEVICE_PCI_HOT_RESET	_IO(VFIO_TYPE, VFIO_BASE + 13)
 
+/**
+ * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
+ *                           struct vfio_device_query_gfx_plane)
+ * Return: 0 on success, -errno on failure.
+ */
+
+struct vfio_device_gfx_plane_info {
+	__u64 start;
+	__u64 drm_format_mod;
+	__u32 drm_format;
+	__u32 width;
+	__u32 height;
+	__u32 stride;
+	__u32 size;
+	__u32 x_pos;
+	__u32 y_pos;
+};
+
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+
+#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14)
+
+
 /* -------- API for Type1 VFIO IOMMU -------- */
 
 /**
Signature · 1 line
2.7.4
#1 lore raw

✓ Fi.CI.BAT: success for vfio: ABI for mdev display dma-buf operation (rev2)

== Series Details ==

== Series Details ==

Series: vfio: ABI for mdev display dma-buf operation (rev2)
URL : https://patchwork.freedesktop.org/series/26786/
State : success

== Summary ==

Series 26786v2 vfio: ABI for mdev display dma-buf operation
https://patchwork.freedesktop.org/api/1.0/series/26786/revisions/2/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:444s
fi-bdw-gvtdvm    total:279  pass:257  dwarn:8   dfail:0   fail:0   skip:14  time:432s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:356s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:529s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:515s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:489s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:483s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:592s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:434s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:416s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:422s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:494s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:476s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:472s
fi-kbl-7560u     total:279  pass:268  dwarn:1   dfail:0   fail:0   skip:10  time:575s
fi-kbl-r         total:279  pass:260  dwarn:1   dfail:0   fail:0   skip:18  time:577s
fi-pnv-d510      total:279  pass:222  dwarn:2   dfail:0   fail:0   skip:55  time:559s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:461s
fi-skl-6700hq    total:279  pass:262  dwarn:0   dfail:0   fail:0   skip:17  time:591s
fi-skl-6700k     total:279  pass:257  dwarn:4   dfail:0   fail:0   skip:18  time:465s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:479s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:439s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:547s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:406s

cefc82aab8bb8ec201e922cf23d227c47845094c drm-tip: 2017y-07m-05d-20h-21m-17s UTC integration manifest b641b66 vfio: ABI for mdev display dma-buf operation

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5119/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Tina Zhang
Quoted 27 lines · Tina Zhang

Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user mode query and get the plan and its related information.

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 need to creat new resource according to the new fd or just use the existed resource related to the old fd.

include/uapi/linux/vfio.h +8 -0
index ae46105..c92bc69 100644
@@ -502,6 +502,36 @@ struct vfio_pci_hot_reset {
 
 #define VFIO_DEVICE_PCI_HOT_RESET	_IO(VFIO_TYPE, VFIO_BASE + 13)
 
+/**
+ * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
+ *                           struct vfio_device_query_gfx_plane)
+ * Return: 0 on success, -errno on failure.
+ */
+
+struct vfio_device_gfx_plane_info {
+	__u64 start;

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 522

Quoted 10 lines
include/uapi/linux/vfio.h +10 -0
+	__u64 drm_format_mod;
+	__u32 drm_format;
+	__u32 width;
+	__u32 height;
+	__u32 stride;
+	__u32 size;
+	__u32 x_pos;
+	__u32 y_pos;
+};
+

Above structure looks good to me.

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 9 lines
include/uapi/linux/vfio.h +9 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values for plane_type and plane_id.

Thanks,
Kirti

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 537

Quoted 7 lines
include/uapi/linux/vfio.h +3 -0
+#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14)
+
+
 /* -------- API for Type1 VFIO IOMMU -------- */
 
 /**

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Hi,

Quoted 5 lines
Quoted 5 lines
include/uapi/linux/vfio.h +5 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
Quoted 8 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 4 lines
include/uapi/linux/vfio.h +4 -0
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values
for plane_type and plane_id.

plane_type is DRM_PLANE_TYPE_*.

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

plane_id needs a specification.

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 16 lines · Gerd Hoffmann

Hi,

Quoted 5 lines
Quoted 5 lines
include/uapi/linux/vfio.h +5 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
Quoted 8 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 4 lines
include/uapi/linux/vfio.h +4 -0
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values
for plane_type and plane_id.

Quoted 7 lines

plane_type is DRM_PLANE_TYPE_*.

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

plane_id needs a specification.

Why do you need plane_type? With universal planes the plane_id along is sufficient to identify a plane on a given drm device instance. I'd just remove it.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 37 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, July 11, 2017 5:13 PM
To: Gerd Hoffmann <[email protected]>
Cc: Tian, Kevin <[email protected]>; [email protected]; intel- [email protected]; [email protected]; [email protected]; [email protected]; Kirti Wankhede <[email protected]>; Lv, Zhiyuan <[email protected]>; [email protected]; Zhang, Tina <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 21 lines · Gerd Hoffmann

Hi,

Quoted 4 lines
Quoted 4 lines
include/uapi/linux/vfio.h +4 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
Quoted 8 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 5 lines
include/uapi/linux/vfio.h +5 -0
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values for plane_type and plane_id.

plane_type is DRM_PLANE_TYPE_*.

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

Quoted 5 lines
Quoted 1 line

plane_id needs a specification.

Why do you need plane_type? With universal planes the plane_id along is sufficient to identify a plane on a given drm device instance. I'd just remove it. -Daniel

The plane_type here, is to ask the mdev vendor driver to return the information according to the value in field plane_type. So, it's a input field. The values in plane_type field is the same of drm_plane_type. And yes, it's better to use drm_plane_type instead of plane_id. Thanks.

Tina

Quoted 8 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
Quoted 37 lines · Tina
Quoted 37 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, July 11, 2017 5:13 PM
To: Gerd Hoffmann <[email protected]>
Cc: Tian, Kevin <[email protected]>; [email protected]; intel- [email protected]; [email protected]; [email protected]; [email protected]; Kirti Wankhede <[email protected]>; Lv, Zhiyuan <[email protected]>; [email protected]; Zhang, Tina <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 21 lines · Gerd Hoffmann

Hi,

Quoted 4 lines
Quoted 4 lines
include/uapi/linux/vfio.h +4 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
Quoted 8 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 5 lines
include/uapi/linux/vfio.h +5 -0
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values for plane_type and plane_id.

plane_type is DRM_PLANE_TYPE_*.

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

plane_id needs a specification.

Why do you need plane_type? With universal planes the plane_id along is sufficient to identify a plane on a given drm device instance. I'd just remove it. -Daniel

The plane_type here, is to ask the mdev vendor driver to return the information according to the value in field plane_type. So, it's a input field. The values in plane_type field is the same of drm_plane_type. And yes, it's better to use drm_plane_type instead of plane_id.

I have no idea what you mean here, I guess that just shows that discussing an ioctl struct without solid definitions of what field does what and why is not all that useful. What exactly it plane_id for then?

This just confused me more ...
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 43 lines · Daniel Vetter
Quoted 42 lines · Tina
Quoted 42 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, July 11, 2017 5:13 PM
To: Gerd Hoffmann <[email protected]>
Cc: Tian, Kevin <[email protected]>; [email protected]; intel- [email protected]; [email protected]; [email protected]; [email protected]; Kirti Wankhede <[email protected]>; Lv, Zhiyuan <[email protected]>; [email protected]; Zhang, Tina <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 15 lines · Gerd Hoffmann

Hi,

Quoted 4 lines
Quoted 4 lines
include/uapi/linux/vfio.h +4 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
Quoted 8 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 5 lines
include/uapi/linux/vfio.h +5 -0
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values for plane_type and plane_id.

Quoted 7 lines

plane_type is DRM_PLANE_TYPE_*.

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

plane_id needs a specification.

Why do you need plane_type? With universal planes the plane_id along is sufficient to identify a plane on a given drm device instance. I'd just remove it. -Daniel

Quoted 7 lines
Quoted 2 lines

The plane_type here, is to ask the mdev vendor driver to return the information according to the value in field plane_type. So, it's a input field. The values in plane_type field is the same of drm_plane_type. And yes, it's better to use drm_plane_type instead of plane_id.

I have no idea what you mean here, I guess that just shows that discussing an ioctl struct without solid definitions of what field does what and why is not all that useful. What exactly it plane_id for then?

plane type could be DRM_PLANE_TYPE_PRIMARY or DRM_PLANE_TYPE_CURSOR.

In case when VFIO region is used to provide surface to QEMU, plane_id would be region index, for example region 10 could be used for primary surface and region 11 could be used for cursor surface. So in that case, mdev vendor driver should return plane_type and its corresponding plane_id.

Thanks,
Kirti

Quoted 3 lines

This just confused me more ...
-Daniel

#8 lore raw
Quoted 74 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Kirti Wankhede
Sent: Wednesday, July 12, 2017 8:45 PM
To: Zhang, Tina <[email protected]>; Gerd Hoffmann <[email protected]>; Tian, Kevin <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; chris@chris- wilson.co.uk; Lv, Zhiyuan <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 37 lines · Daniel Vetter
Quoted 36 lines · Tina
Quoted 36 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, July 11, 2017 5:13 PM
To: Gerd Hoffmann <[email protected]>
Cc: Tian, Kevin <[email protected]>; [email protected]; intel- [email protected]; [email protected]; [email protected]; [email protected]; Kirti Wankhede <[email protected]>; Lv, Zhiyuan <[email protected]>; [email protected]; Zhang, Tina <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 17 lines · Gerd Hoffmann

Hi,

Quoted 4 lines
Quoted 4 lines
(quoted diff) +4 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values for plane_type and plane_id.

plane_type is DRM_PLANE_TYPE_*.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

plane_id needs a specification.

Why do you need plane_type? With universal planes the plane_id along is sufficient to identify a plane on a given drm device instance. I'd just

remove it.

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

-Daniel

The plane_type here, is to ask the mdev vendor driver to return the

information according to the value in field plane_type. So, it's a input field.

Quoted 1 line
Quoted 1 line

The values in plane_type field is the same of drm_plane_type. And yes, it's

better to use drm_plane_type instead of plane_id.

Quoted 5 lines

I have no idea what you mean here, I guess that just shows that discussing an ioctl struct without solid definitions of what field does what and why is not all that useful. What exactly it plane_id for then?

Quoted 7 lines

plane type could be DRM_PLANE_TYPE_PRIMARY or
DRM_PLANE_TYPE_CURSOR.

In case when VFIO region is used to provide surface to QEMU, plane_id would be region index, for example region 10 could be used for primary surface and region 11 could be used for cursor surface. So in that case, mdev vendor driver should return plane_type and its corresponding plane_id.

Thanks, Kirti, do you mean there will be multiple DRM_PLANE_TYPE_PRIMARY and multiple DRM_PLANE_TYPE_CURSOR planes existing in the same time and region usage needs to use plane_id to distinguish among them? Is it for the multiple output or that's the typical way of region usage? Thanks.

Tina

Quoted 11 lines

Thanks,
Kirti

Quoted 3 lines

This just confused me more ...
-Daniel

_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
Quoted 77 lines · Tina
Quoted 77 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Kirti Wankhede
Sent: Wednesday, July 12, 2017 8:45 PM
To: Zhang, Tina <[email protected]>; Gerd Hoffmann <[email protected]>; Tian, Kevin <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; chris@chris- wilson.co.uk; Lv, Zhiyuan <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 37 lines · Daniel Vetter
Quoted 36 lines · Tina
Quoted 36 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, July 11, 2017 5:13 PM
To: Gerd Hoffmann <[email protected]>
Cc: Tian, Kevin <[email protected]>; [email protected]; intel- [email protected]; [email protected]; [email protected]; [email protected]; Kirti Wankhede <[email protected]>; Lv, Zhiyuan <[email protected]>; [email protected]; Zhang, Tina <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 17 lines · Gerd Hoffmann

Hi,

Quoted 4 lines
Quoted 4 lines
(quoted diff) +4 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values for plane_type and plane_id.

plane_type is DRM_PLANE_TYPE_*.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

plane_id needs a specification.

Why do you need plane_type? With universal planes the plane_id along is sufficient to identify a plane on a given drm device instance. I'd just

remove it.

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

-Daniel

The plane_type here, is to ask the mdev vendor driver to return the

information according to the value in field plane_type. So, it's a input field.

Quoted 1 line
Quoted 1 line

The values in plane_type field is the same of drm_plane_type. And yes, it's

better to use drm_plane_type instead of plane_id.

Quoted 5 lines

I have no idea what you mean here, I guess that just shows that discussing an ioctl struct without solid definitions of what field does what and why is not all that useful. What exactly it plane_id for then?

plane type could be DRM_PLANE_TYPE_PRIMARY or
DRM_PLANE_TYPE_CURSOR.

Quoted 6 lines
Quoted 4 lines

In case when VFIO region is used to provide surface to QEMU, plane_id would be region index, for example region 10 could be used for primary surface and region 11 could be used for cursor surface. So in that case, mdev vendor driver should return plane_type and its corresponding plane_id.

Thanks, Kirti, do you mean there will be multiple DRM_PLANE_TYPE_PRIMARY and multiple DRM_PLANE_TYPE_CURSOR planes existing in the same time and region usage needs to use plane_id to distinguish among them? Is it for the multiple output or that's the typical way of region usage? Thanks.

There could be only two planes, one DRM_PLANE_TYPE_PRIMARY and one DRM_PLANE_TYPE_CURSOR.
Steps from gfx_update for region case would be:
- VFIO_DEVICE_QUERY_GFX_PLANE with plane_type = DRM_PLANE_TYPE_PRIMARY
- if vfio_device_gfx_plane_info.size > 0, read region for primary surface and update console surface
- VFIO_DEVICE_QUERY_GFX_PLANE with plane_type = DRM_PLANE_TYPE_CURSOR
- if vfio_device_gfx_plane_info.size > 0, read region for cursor surface update cursor on surface.

Thanks,
Kirti

Quoted 14 lines

Tina

Quoted 11 lines

Thanks,
Kirti

Quoted 3 lines

This just confused me more ...
-Daniel

_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

Hi,

Quoted 8 lines

There could be only two planes, one DRM_PLANE_TYPE_PRIMARY and one DRM_PLANE_TYPE_CURSOR.
Steps from gfx_update for region case would be:
- VFIO_DEVICE_QUERY_GFX_PLANE with plane_type = DRM_PLANE_TYPE_PRIMARY

- if vfio_device_gfx_plane_info.size > 0, read region for primary surface and update console surface

Why? I suspect you want notify the caller whenever the surface has been updated or not? If so we should add an explicit flag or field for that.

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 5 lines

There could be only two planes, one DRM_PLANE_TYPE_PRIMARY and one DRM_PLANE_TYPE_CURSOR.
Steps from gfx_update for region case would be:
- VFIO_DEVICE_QUERY_GFX_PLANE with plane_type = DRM_PLANE_TYPE_PRIMARY

Quoted 7 lines
Quoted 2 lines

- if vfio_device_gfx_plane_info.size > 0, read region for primary surface and update console surface

Why? I suspect you want notify the caller whenever the surface has been updated or not? If so we should add an explicit flag or field for that.

No need of flag here. If vGPU driver is not loaded in the guest, there is no surface being managed by vGPU, in that case this size will be zero.

Thanks,
Kirti
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

Hi,

Quoted 4 lines

No need of flag here. If vGPU driver is not loaded in the guest, there
is no surface being managed by vGPU, in that case this size will be zero.

Ok, we certainly have the same situation with intel. When the guest driver is not loaded (yet) there is no valid surface.

We should cleanly define what the ioctl should do in that case, so all drivers behave the same way.

I'd suggest that all fields defining the surface (drm_format, width, height, stride, size) should be set to zero in that case.

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw
Quoted 19 lines

-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Monday, July 17, 2017 7:03 PM
To: Kirti Wankhede <[email protected]>; Zhang, Tina <[email protected]>; Tian, Kevin <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; chris@chris- wilson.co.uk; Lv, Zhiyuan <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Hi,

Quoted 3 lines

No need of flag here. If vGPU driver is not loaded in the guest, there is no surface being managed by vGPU, in that case this size will be zero.

Quoted 8 lines

Ok, we certainly have the same situation with intel. When the guest driver is not loaded (yet) there is no valid surface.

We should cleanly define what the ioctl should do in that case, so all drivers behave the same way.

I'd suggest that all fields defining the surface (drm_format, width, height, stride, size) should be set to zero in that case.

Yeah, it's reasonable. How about the return value? Currently, the ioctl also returns "-ENODEV" in that situation.

thanks,
Tina

Quoted 3 lines

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw
Quoted 28 lines · Tina
Quoted 28 lines

-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Monday, July 17, 2017 7:03 PM
To: Kirti Wankhede <[email protected]>; Zhang, Tina <[email protected]>; Tian, Kevin <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; chris@chris- wilson.co.uk; Lv, Zhiyuan <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

  Hi,

Quoted 5 lines

No need of flag here. If vGPU driver is not loaded in the guest, there
is no surface being managed by vGPU, in that case this size will be
zero.

Ok, we certainly have the same situation with intel.  When the guest driver is not
loaded (yet) there is no valid surface.

We should cleanly define what the ioctl should do in that case, so all drivers
behave the same way.

Quoted 6 lines
Quoted 3 lines

I'd suggest that all fields defining the surface (drm_format, width, height, stride,
size) should be set to zero in that case.

Yeah, it's reasonable. How about the return value? Currently, the ioctl also returns "-ENODEV" in that situation.

I think it should not return an error. Querying the plane parameters worked fine.

cheers,
Gerd

#15 lore raw
Quoted 33 lines · Gerd Hoffmann
Quoted 32 lines · Tina
Quoted 31 lines

-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Monday, July 17, 2017 7:03 PM
To: Kirti Wankhede <[email protected]>; Zhang, Tina <[email protected]>; Tian, Kevin <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; chris@chris- wilson.co.uk; Lv, Zhiyuan <[email protected]>; intel-gvt- [email protected]; Wang, Zhi A <[email protected]>
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Hi,

Quoted 5 lines

No need of flag here. If vGPU driver is not loaded in the guest, there
is no surface being managed by vGPU, in that case this size will be
zero.

Ok, we certainly have the same situation with intel. When the guest driver is not
loaded (yet) there is no valid surface.

We should cleanly define what the ioctl should do in that case, so all drivers
behave the same way.

I'd suggest that all fields defining the surface (drm_format, width, height, stride,
size) should be set to zero in that case.

Quoted 6 lines
Quoted 2 lines

Yeah, it's reasonable. How about the return value? Currently, the ioctl also returns "-ENODEV" in that situation.

I think it should not return an error. Querying the plane parameters worked fine.

Sounds good to me too.

Thanks,
Kirti
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw
In reply to Kirti Wankhede

Hi,

Quoted 2 lines

In case when VFIO region is used to provide surface to QEMU, plane_id would be region index,

Then we should name it "region_index" not "plane_id".

Quoted 5 lines

for example region 10 could be used for primary
surface and region 11 could be used for cursor surface. So in that case,
mdev vendor driver should return plane_type and its corresponding plane_id.

Hmm? plane_type is the input (userspace -> kernel) parameter.

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw
Quoted 7 lines · Gerd Hoffmann

Hi,

Quoted 2 lines

In case when VFIO region is used to provide surface to QEMU, plane_id would be region index,

Then we should name it "region_index" not "plane_id".

Quoted 8 lines
Quoted 5 lines

for example region 10 could be used for primary
surface and region 11 could be used for cursor surface. So in that case,
mdev vendor driver should return plane_type and its corresponding plane_id.

Hmm? plane_type is the input (userspace -> kernel) parameter.

Yes, that's right. Sorry for confusion. And mdev vendor driver would return which region to read.

Thanks,
Kirti

Quoted 3 lines

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw
Quoted 17 lines · Kirti Wankhede
Quoted 15 lines · Gerd Hoffmann

  Hi,

Quoted 3 lines

In case when VFIO region is used to provide surface to QEMU, plane_id
would be region index,

Then we should name it "region_index" not "plane_id".

Quoted 6 lines

for example region 10 could be used for primary
surface and region 11 could be used for cursor surface. So in that
case,
mdev vendor driver should return plane_type and its corresponding plane_id.

Quoted 5 lines
Quoted 2 lines

Hmm?  plane_type is the input (userspace -> kernel) parameter.

Yes, that's right. Sorry for confusion. And mdev vendor driver would return which region to read.

Ok, so the plan for supporting multiple planes is to have a separate vfio region for each? Ok, we should add region_index to the struct then.

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw
In reply to Daniel Vetter
Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Gerd Hoffmann

Hi,

Quoted 13 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 9 lines
include/uapi/linux/vfio.h +9 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values
for plane_type and plane_id.

Quoted 5 lines
Quoted 5 lines

plane_type is DRM_PLANE_TYPE_*.

yes, a comment saying so would be good, same for drm_format which is DRM_FORMAT_*. While looking at these two: renaming plane_type to drm_plane_type (for consistency) is probably a good idea too.

For drm universal plane, this is not in drm uapi, but uabi. I think we can align with drm plane definition for sure, but not need to pull in drm header for that enum type.

Quoted 6 lines
Quoted 2 lines

plane_id needs a specification.

Why do you need plane_type? With universal planes the plane_id along is sufficient to identify a plane on a given drm device instance. I'd just remove it.

This interface is to get vGPU display plane info, there's no normal drm kms client involved, but vGPU device model trys to expose guest planes for display. We need to ask for what type of plane required on target vGPU. I think plane_id here doesn't mean like in drm kms, but I'm not sure about plane_id here without details, what's the purpose, etc.

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
#20 lore raw
In reply to Kirti Wankhede
Quoted 57 lines

-----Original Message-----
From: Kirti Wankhede [mailto:[email protected]]
Sent: Thursday, July 6, 2017 10:02 PM
To: Zhang, Tina <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Lv, Zhiyuan <[email protected]>; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 16 lines · Tina Zhang

Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user mode query and get the plan and its related information.

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 need to creat new resource according to the new fd or just use the existed resource related to the old fd.

include/uapi/linux/vfio.h +0 -0
index ae46105..c92bc69 100644

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 503

Quoted 2 lines
include/uapi/linux/vfio.h +0 -0
@@ -502,6 +502,36 @@ struct vfio_pci_hot_reset {
 
 #define VFIO_DEVICE_PCI_HOT_RESET	_IO(VFIO_TYPE, VFIO_BASE +

13)

Quoted 9 lines
include/uapi/linux/vfio.h +8 -0
+/**
+ * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
+ *                           struct vfio_device_query_gfx_plane)
+ * Return: 0 on success, -errno on failure.
+ */
+
+struct vfio_device_gfx_plane_info {
+	__u64 start;

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 522

Quoted 10 lines
include/uapi/linux/vfio.h +10 -0
+	__u64 drm_format_mod;
+	__u32 drm_format;
+	__u32 width;
+	__u32 height;
+	__u32 stride;
+	__u32 size;
+	__u32 x_pos;
+	__u32 y_pos;
+};
+

Above structure looks good to me.

Quoted 12 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 531

Quoted 9 lines
include/uapi/linux/vfio.h +9 -0
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};
+

It would be better to have comment here about what are expected values for plane_type and plane_id.

I will add the comments for these fields. Thanks.

Tina

Quoted 11 lines

Thanks,
Kirti

include/uapi/linux/vfio.h struct vfio_pci_hot_reset {

Quoted 7 lines
include/uapi/linux/vfio.h +3 -0
+#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14)
+
+
 /* -------- API for Type1 VFIO IOMMU -------- */
 
 /**
 

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw
In reply to Tina Zhang
Quoted 7 lines
include/uapi/linux/vfio.h +7 -0
+/**
+ * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
+ *                           struct vfio_device_query_gfx_plane)
+ * Return: 0 on success, -errno on failure.
+ */
+
+struct vfio_device_gfx_plane_info {

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 521

Quoted 10 lines
include/uapi/linux/vfio.h +10 -0
+	__u64 start;
+	__u64 drm_format_mod;
+	__u32 drm_format;
+	__u32 width;
+	__u32 height;
+	__u32 stride;
+	__u32 size;
+	__u32 x_pos;
+	__u32 y_pos;
+};

Do we want keep that as separate struct? Given we now have only a single struct using that as sub-struct it looks pointless, at least from a API point of view. Does the driver use the struct internally?

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 529

Quoted 8 lines
include/uapi/linux/vfio.h +8 -0
+
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;

What is plane_id?

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw
Quoted 26 lines

-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Tuesday, July 11, 2017 2:08 PM
To: Zhang, Tina <[email protected]>; [email protected]; [email protected]; [email protected]; Lv, Zhiyuan <[email protected]>; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 13 lines
include/uapi/linux/vfio.h +13 -0
+/**
+ * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
+ *                           struct vfio_device_query_gfx_plane)
+ * Return: 0 on success, -errno on failure.
+ */
+
+struct vfio_device_gfx_plane_info {
+	__u64 start;
+	__u64 drm_format_mod;
+	__u32 drm_format;
+	__u32 width;
+	__u32 height;
+	__u32 stride;
Quoted 8 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 521

Quoted 4 lines
include/uapi/linux/vfio.h +4 -0
+	__u32 size;
+	__u32 x_pos;
+	__u32 y_pos;
+};

Do we want keep that as separate struct? Given we now have only a single struct using that as sub-struct it looks pointless, at least from a API point of view. Does the driver use the struct internally?

Driver has another struct which is super-set of these fields. Yes, we can move all these fields into struct vfio_device_query_gfx_plane. Also, we can remove some of these fields which may seem useless for user mode. Thanks.

Tina

Quoted 11 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 529

Quoted 9 lines
include/uapi/linux/vfio.h +8 -0
+
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;

What is plane_id?

I cannot figure out the mean of plane_id either. If I remember correctly, it was asked by region usage. Of course, if no one needs it, I'd like to remove it. Thanks.

Tina

Quoted 3 lines

cheers,
Gerd

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw
In reply to Tina Zhang
Quoted 26 lines · Tina Zhang

Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user mode query and get the plan and its related information.

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 need to creat new resource according to the new fd or just use the existed resource related to the old fd.

include/uapi/linux/vfio.h +7 -0
index ae46105..c92bc69 100644
@@ -502,6 +502,36 @@ struct vfio_pci_hot_reset {
 
 #define VFIO_DEVICE_PCI_HOT_RESET	_IO(VFIO_TYPE, VFIO_BASE + 13)
 
+/**
+ * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
+ *                           struct vfio_device_query_gfx_plane)
+ * Return: 0 on success, -errno on failure.
+ */
+
+struct vfio_device_gfx_plane_info {

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 521

Quoted 10 lines
include/uapi/linux/vfio.h +10 -0
+	__u64 start;
+	__u64 drm_format_mod;
+	__u32 drm_format;
+	__u32 width;
+	__u32 height;
+	__u32 stride;
+	__u32 size;
+	__u32 x_pos;
+	__u32 y_pos;
+};

Would be good to have a detailed spec of all this stuff, plus what's it meant to be used for. I assume that e.g. start would be the opaque cookie thing we've talked about, for dma-buf reuse? Otherwise I'm not sure what it's good for, since the same gpu vram address can be reused for different memory objects ...

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 530

Quoted 9 lines
include/uapi/linux/vfio.h +9 -0
+
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};

As mentioned in the other reply already, I'm not sure what plane_type is for. Otherwise this looks ok-ish, but hard to tell without more detailed spec.
-Daniel

Quoted 10 lines
include/uapi/linux/vfio.h +4 -0
+
+#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14)
+
+
 /* -------- API for Type1 VFIO IOMMU -------- */
 
 /**
Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw
Quoted 49 lines

-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, July 11, 2017 5:16 PM
To: Zhang, Tina <[email protected]>
Cc: Tian, Kevin <[email protected]>; [email protected]; intel- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Lv, Zhiyuan <[email protected]>; [email protected]; [email protected]; Wang, Zhi A <[email protected]>; [email protected]
Subject: Re: [PATCH v10] vfio: ABI for mdev display dma-buf operation

Quoted 16 lines · Tina Zhang

Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user mode query and get the plan and its related information.

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 need to creat new resource according to the new fd or just use the existed resource related to the old fd.

include/uapi/linux/vfio.h +0 -0
index ae46105..c92bc69 100644

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 503

Quoted 2 lines
include/uapi/linux/vfio.h +0 -0
@@ -502,6 +502,36 @@ struct vfio_pci_hot_reset {
 
 #define VFIO_DEVICE_PCI_HOT_RESET	_IO(VFIO_TYPE, VFIO_BASE +

13)

Quoted 15 lines
include/uapi/linux/vfio.h +14 -0
+/**
+ * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
+ *                           struct vfio_device_query_gfx_plane)
+ * Return: 0 on success, -errno on failure.
+ */
+
+struct vfio_device_gfx_plane_info {
+	__u64 start;
+	__u64 drm_format_mod;
+	__u32 drm_format;
+	__u32 width;
+	__u32 height;
+	__u32 stride;
+	__u32 size;
Quoted 8 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 521

Quoted 3 lines
include/uapi/linux/vfio.h +3 -0
+	__u32 x_pos;
+	__u32 y_pos;
+};

Would be good to have a detailed spec of all this stuff, plus what's it meant to be used for. I assume that e.g. start would be the opaque cookie thing we've talked about, for dma-buf reuse? Otherwise I'm not sure what it's good for, since the same gpu vram address can be reused for different memory objects ...

Yes, I will add more comments in the next version. Here, some historical reason might be helpful to understand. Previously, we reported all the information to user mode and let user mode to decide whether it was an exported dmabuf or not. If it was an exported dmabuf, user mode can directly use its cached resources, without needing to create again. This design turned out to have some limitations:
1). User mode has to keep so many information to do the comparing.
2). The design needs at least two ioctls, with one for query info and the other one for exporting dmabuf. So, there will be a time window between these two ioctls, during which the guest framebuffer might be changed.

In this patch, we leave the comparing logic to kernel, and return the dmabuf fd everytime when user mode calling VFIO_DEVICE_QUERY_GFX_PLANE ioctl. User mode can compare the value of fd to see whether it can reuse the resource of the old fd, or need to create new according to the new fd. If we take the idea in this patch, we don't need so many fields in the struct vfio_device_gfx_plane_info which seem meaningless to user mode. I'm going to remove some in the next version, including start.
Thanks.

Tina

Quoted 20 lines

include/uapi/linux/vfio.h struct vfio_pci_hot_reset { · line 530

Quoted 9 lines
include/uapi/linux/vfio.h +9 -0
+
+struct vfio_device_query_gfx_plane {
+	__u32 argsz;
+	__u32 flags;
+	struct vfio_device_gfx_plane_info plane_info;
+	__u32 plane_type;
+	__s32 fd; /* dma-buf fd */
+	__u32 plane_id;
+};

As mentioned in the other reply already, I'm not sure what plane_type is for. Otherwise this looks ok-ish, but hard to tell without more detailed spec. -Daniel

Quoted 6 lines
include/uapi/linux/vfio.h +4 -0
+
+#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14)
+
+
 /* -------- API for Type1 VFIO IOMMU -------- */
 
Quoted 13 lines
Quoted 4 lines
include/uapi/linux/vfio.h +0 -1
 /**
--

2.7.4

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx