drm/i915/gvt: Dma-buf support for GVT-g
Subsystems (5)
v14 cover drm/i915/gvt: Dma-buf support for GVT-g
v13->v14:
1) add PROBE, DMABUF and REGION flags. (Alex)
2) return -ENXIO when gem proxy object is banned by ioctl. (Chris) (Daniel)
3) add some details about the float pixel format. (Daniel)
4) add F suffix to the defined name. (Daniel)
5) refine pixel format table. (Zhenyu)
v12->v13:
1) add comments to GEM proxy. (Chris)
2) don't ban GEM proxy in i915_gem_sw_finish_ioctl. (Chris)
3) check GEM proxy bar after finishing i915_gem_object_wait. (Chris)
4) remove GEM proxy bar in i915_gem_madvise_ioctl.
v11->v12:
1) add drm_format_mod back. (Gerd and Zhenyu)
2) add region_index. (Gerd)
3) refine the lifecycle of dmabuf.
4) send to [email protected]. (Ville)
v10->v11:
1) rename plane_type to drm_plane_type. (Gerd)
2) move fields of vfio_device_query_gfx_plane to
vfio_device_gfx_plane_info. (Gerd)
3) remove drm_format_mod, start fields. (Daniel)
4) remove plane_id.
v9->v10:
1) remove dma-buf management
2) refine the ABI API VFIO_DEVICE_QUERY_GFX_PLANE
3) track the dma-buf create and release in kernel mode
v8->v9:
1) refine the dma-buf ioctl definition
2) add a lock to protect the dmabuf list
3) move drm format change to a separate patch
4) codes cleanup
v7->v8:
1) refine framebuffer decoder code
2) fix a bug in decoding primary plane
v6->v7:
1) release dma-buf related allocations in dma-buf's associated release function.
2) refine ioctl interface for querying plane info or create dma-buf
3) refine framebuffer decoder code
4) the patch series is based on 4.12.0-rc1
v5->v6:
1) align the dma-buf life cycle with the vfio device.
2) add the dma-buf related operations in a separate patch.
3) i915 releated changes.
v4->v5:
1) fix bug while checking whether the gem obj is gvt's dma-buf when user change caching mode or domains. Add a helper function to do it.
2) add definition for the query plane and create dma-buf.
v3->v4:
1) fix bug while checking whether the gem obj is gvt's dma-buf when set caching mode or doamins.
v2->v3:
1) add a field gvt_plane_info in the drm_i915_gem_obj structure to save the decoded plane information to avoid look up while need the plane info.
2) declare a new flag I915_GEM_OBJECT_IS_GVT_DMABUF in drm_i915_gem_object to represent the gem obj for gvt's dma-buf. The tiling mode, caching mode and domains can not be changed for this kind of gem object.
3) change dma-buf related information to be more generic. So other vendor can use the same interface.
v1->v2:
1) create a management fd for dma-buf operations.
2) alloc gem object's backing storage in gem obj's get_pages() callback.
This patch set adds the dma-buf support for intel GVT-g. dma-buf is a uniform mechanism to share DMA buffers across different devices and sub-systems.
dma-buf for intel GVT-g is mainly used to share the vgpu's framebuffer to other users or sub-systems so they can use the dma-buf to show the desktop of a VM which uses intel vgpu.
The main idea is we create a gem object and set vgpu's framebuffer as the backing storage of this gem object. And associate this gem obj to a dma-buf object then export this dma-buf at the meantime generate a file descriptor for this dma-buf. Finally deliver this file descriptor to user space. And user can use this dma-buf fd to do rendering or other operations.
This patch set can be tried with the following example:
https://github.com/01org/Igvtg-qemu branch: topic/dmabuf
Tina Zhang (7):
drm/i915/gvt: Add framebuffer decoder support
drm: Introduce RGB 64-bit 16:16:16:16 float format drm/i915/gvt: Add RGB 64-bit 16:16:16:16 float format drm/i915/gvt: Add opregion support
vfio: ABI for mdev display dma-buf operation drm/i915: Introduce GEM proxy
drm/i915/gvt: Dmabuf support for GVT-g
drivers/gpu/drm/i915/gvt/Makefile | 3 +- drivers/gpu/drm/i915/gvt/display.c | 2 +- drivers/gpu/drm/i915/gvt/display.h | 2 + drivers/gpu/drm/i915/gvt/dmabuf.c | 387 ++++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/dmabuf.h | 58 ++++ drivers/gpu/drm/i915/gvt/fb_decoder.c | 521 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/fb_decoder.h | 169 +++++++++++ drivers/gpu/drm/i915/gvt/gvt.c | 1 + drivers/gpu/drm/i915/gvt/gvt.h | 10 + drivers/gpu/drm/i915/gvt/hypercall.h | 3 + drivers/gpu/drm/i915/gvt/kvmgt.c | 151 +++++++++- drivers/gpu/drm/i915/gvt/mpt.h | 45 +++ drivers/gpu/drm/i915/gvt/opregion.c | 26 +- drivers/gpu/drm/i915/gvt/vgpu.c | 6 +- drivers/gpu/drm/i915/i915_gem.c | 24 +- drivers/gpu/drm/i915/i915_gem_object.h | 9 + drivers/gpu/drm/i915/i915_gem_tiling.c | 8 + include/uapi/drm/drm_fourcc.h | 4 + include/uapi/linux/vfio.h | 43 +++ 19 files changed, 1459 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.c create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.h create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.c create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.h
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v14 1/7 drm/i915/gvt: Add framebuffer decoder support
This patch is to introduce the framebuffer decoder which can decode guest OS's framebuffer information, including primary, cursor and sprite plane.
v14:
- refine pixel format table. (Zhenyu)
v9:
- move drm format change to a separate patch. (Xiaoguang)
v8:
- fix a bug in decoding primary plane. (Tina)
v7:
- refine framebuffer decoder code. (Zhenyu)
drivers/gpu/drm/i915/gvt/Makefile +2 -1
@@ -1,7 +1,8 @@ GVT_DIR := gvt GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \ interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \ - execlist.o scheduler.o sched_policy.o render.o cmd_parser.o + execlist.o scheduler.o sched_policy.o render.o cmd_parser.o \ + fb_decoder.o ccflags-y += -I$(src) -I$(src)/$(GVT_DIR) i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
drivers/gpu/drm/i915/gvt/display.c +1 -1
@@ -67,7 +67,7 @@ static int edp_pipe_is_enabled(struct intel_vgpu *vgpu)return 1 ; } -static int pipe_is_enabled (struct intel_vgpu *vgpu,int pipe) +int pipe_is_enabled (struct intel_vgpu *vgpu,int pipe) {struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
drivers/gpu/drm/i915/gvt/display.h +2 -0
@@ -179,4 +179,6 @@ int intel_vgpu_init_display(struct intel_vgpu *vgpu, u64 resolution);void intel_vgpu_reset_display (struct intel_vgpu *vgpu);void intel_vgpu_clean_display (struct intel_vgpu *vgpu); +int pipe_is_enabled (struct intel_vgpu *vgpu,int pipe); +#endif
drivers/gpu/drm/i915/gvt/fb_decoder.c new file +507 -0
507 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/fb_decoder.h new file +169 -0
169 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/gvt.h +1 -0
@@ -46,6 +46,7 @@#include "sched_policy.h" #include "render.h" #include "cmd_parser.h" +#include "fb_decoder.h" #define GVT_MAX_VGPU 8
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 1/7] drm/i915/gvt: Add framebuffer decoder support
Quoted 41 lines · Tina Zhang
This patch is to introduce the framebuffer decoder which can decode guest OS's framebuffer information, including primary, cursor and sprite plane.
v14:
- refine pixel format table. (Zhenyu)v9:
- move drm format change to a separate patch. (Xiaoguang)v8:
- fix a bug in decoding primary plane. (Tina)v7:
- refine framebuffer decoder code. (Zhenyu)Signed-off-by Tina Zhang <[email protected]>Cc Zhenyu Wang <[email protected]>drivers/gpu/drm/i915/gvt/fb_decoder.c new file +22
-0+static struct pixel_format bdw_pixel_formats[] = { + {DRM_FORMAT_C8 ,8 ,"8-bit Indexed" }, + {DRM_FORMAT_RGB565 ,16 ,"16-bit BGRX (5:6:5 MSB-R:G:B)" }, + {DRM_FORMAT_XRGB8888 ,32 ,"32-bit BGRX (8:8:8:8 MSB-X:R:G:B)" }, + {DRM_FORMAT_XBGR2101010 ,32 ,"32-bit RGBX (2:10:10:10 MSB-X:B:G:R)" }, + + {DRM_FORMAT_XRGB2101010 ,32 ,"32-bit BGRX (2:10:10:10 MSB-X:R:G:B)" }, + {DRM_FORMAT_XBGR8888 ,32 ,"32-bit RGBX (8:8:8:8 MSB-X:B:G:R)" }, + +/* non-supported format has bpp default to 0 */ + {0 ,0 ,NULL }, +}; + +static struct pixel_format skl_pixel_formats[] = { + {DRM_FORMAT_YUYV ,16 ,"16-bit packed YUYV (8:8:8:8 MSB-V:Y2:U:Y1)" }, + {DRM_FORMAT_UYVY ,16 ,"16-bit packed UYVY (8:8:8:8 MSB-Y2:V:Y1:U)" }, + {DRM_FORMAT_YVYU ,16 ,"16-bit packed YVYU (8:8:8:8 MSB-U:Y2:V:Y1)" }, + {DRM_FORMAT_VYUY ,16 ,"16-bit packed VYUY (8:8:8:8 MSB-Y2:U:Y1:V)" }, + + {DRM_FORMAT_C8 ,8 ,"8-bit Indexed" }, + {DRM_FORMAT_RGB565 ,16 ,"16-bit BGRX (5:6:5 MSB-R:G:B)" }, + {DRM_FORMAT_ABGR8888 ,32 ,"32-bit RGBA (8:8:8:8 MSB-A:B:G:R)" },
drivers/gpu/drm/i915/gvt/fb_decoder.c line 78
Quoted 10 lines
drivers/gpu/drm/i915/gvt/fb_decoder.c new file +10
-0+ {DRM_FORMAT_XBGR8888, 32, "32-bit RGBX (8:8:8:8 MSB-X:B:G:R)"}, + + {DRM_FORMAT_ARGB8888, 32, "32-bit BGRA (8:8:8:8 MSB-A:R:G:B)"}, + {DRM_FORMAT_XRGB8888, 32, "32-bit BGRX (8:8:8:8 MSB-X:R:G:B)"}, + {DRM_FORMAT_XBGR2101010, 32, "32-bit RGBX (2:10:10:10 MSB-X:B:G:R)"}, + {DRM_FORMAT_XRGB2101010, 32, "32-bit BGRX (2:10:10:10 MSB-X:R:G:B)"}, + +/* non-supported format has bpp default to 0 */ + {0, 0, NULL}, +};
What about KBL support of this? If not fully supported now, need to set proper state at "probe" ioctl time.
Signature · 3 lines
Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v14 2/7 drm: Introduce RGB 64-bit 16:16:16:16 float format
In reply to Tina ZhangThe RGB 64-bit 16:16:16:16 float pixel format is needed by some Apps in windows. The float format in each component is 1:5:10 MSb-sign:exponent:
fraction.
This patch is to introduce the format to drm, so that the windows guest's framebuffer in this kind of format can be recognized and used by linux host.
v14:
- add some details about the float pixel format. (Daniel)
- add F suffix to the defined name. (Daniel)
v12:
- send to dri-devel at lists.freedesktop.org. (Ville)
v9:
- separated from framebuffer decoder patch. (Zhenyu) (Xiaoguang)
include/uapi/drm/drm_fourcc.h +4 -0
@@ -113,6 +113,10 @@ extern "C" {#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V')/* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ +/* 64 bpp RGB 16:16:16:16 Floating Point */ +#define DRM_FORMAT_XRGB161616F fourcc_code('X', 'R', '3', 'F')/* [63:0] x:R:G:B 16:16:16:16 little endian */ +#define DRM_FORMAT_XBGR161616F fourcc_code('X', 'B', '3', 'F')/* [63:0] x:B:G:R 16:16:16:16 little endian */ +/* * 2 plane RGB + A * index 0 = RGB plane, same format as the corresponding non _A8 format has
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v14 3/7 drm/i915/gvt: Add RGB 64-bit 16:16:16:16 float format
In reply to Tina ZhangThe RGB 64-bit 16:16:16:16 float pixel format is needed by windows 10 guest VM. This patch is to add this pixel format support to gvt device model. Without this patch, some Apps, e.g. "DXGIGammaVM.exe", will crash and make guest screen black.
drivers/gpu/drm/i915/gvt/fb_decoder.c +21 -7
@@ -52,6 +52,8 @@ static struct pixel_format bdw_pixel_formats[] = { {DRM_FORMAT_XRGB2101010, 32, "32-bit BGRX (2:10:10:10 MSB-X:R:G:B)"}, {DRM_FORMAT_XBGR8888, 32, "32-bit RGBX (8:8:8:8 MSB-X:B:G:R)"}, + {DRM_FORMAT_XRGB161616F, 64, + "64-bit XRGB Floating Point (16:16:16:16 MSB-X:R:G:B)"},/* non-supported format has bpp default to 0 */ {0, 0, NULL},
@@ -73,13 +75,18 @@ static struct pixel_format skl_pixel_formats[] = { {DRM_FORMAT_XBGR2101010, 32, "32-bit RGBX (2:10:10:10 MSB-X:B:G:R)"}, {DRM_FORMAT_XRGB2101010, 32, "32-bit BGRX (2:10:10:10 MSB-X:R:G:B)"}, + {DRM_FORMAT_XRGB161616F, 64, + "64-bit XRGB Floating Point (16:16:16:16 MSB-X:R:G:B)"}, + {DRM_FORMAT_XBGR161616F, 64, + "64-bit XBGR Floating Point (16:16:16:16 MSB-X:B:G:R)"}, +/* non-supported format has bpp default to 0 */ {0, 0, NULL}, };static int bdw_format_to_drm (int format) { -int bdw_pixel_formats_index =6 ; +int bdw_pixel_formats_index =7 ;switch (format) {case DISPPLANE_8BPP :
@@ -100,7 +107,9 @@ static int bdw_format_to_drm(int format)case DISPPLANE_RGBX888 : bdw_pixel_formats_index =5 ;break ; - +case DISPPLANE_RGBX161616 : + bdw_pixel_formats_index =6 ; +break ;default :break ; }
@@ -111,7 +120,7 @@ static int bdw_format_to_drm(int format)static int skl_format_to_drm (int format,bool rgb_order,bool alpha,int yuv_order) { -int skl_pixel_formats_index =12 ; +int skl_pixel_formats_index =14 ;switch (format) {case PLANE_CTL_FORMAT_INDEXED :
@@ -129,6 +138,9 @@ static int skl_format_to_drm(int format, bool rgb_order, bool alpha,case PLANE_CTL_FORMAT_XRGB_2101010 : skl_pixel_formats_index = rgb_order ?10 :11 ;break ; +case PLANE_CTL_FORMAT_XRGB_16161616F : + skl_pixel_formats_index = rgb_order ?12 :13 ; +break ;case PLANE_CTL_FORMAT_YUV422 : skl_pixel_formats_index = yuv_order >>16 ;if (skl_pixel_formats_index >3 )
@@ -389,11 +401,13 @@ int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu,#define SPRITE_FORMAT_NUM (1 << 3)static struct pixel_format sprite_pixel_formats[SPRITE_FORMAT_NUM ] = { - [0x0 ] = {DRM_FORMAT_YUV422 ,16 ,"YUV 16-bit 4:2:2 packed" }, - [0x1 ] = {DRM_FORMAT_XRGB2101010 ,32 ,"RGB 32-bit 2:10:10:10" }, - [0x2 ] = {DRM_FORMAT_XRGB8888 ,32 ,"RGB 32-bit 8:8:8:8" }, + [0x0 ] = {DRM_FORMAT_YUV422 ,16 ,"16-bit YUV 4:2:2 packed" }, + [0x1 ] = {DRM_FORMAT_XRGB2101010 ,32 ,"32-bit BGRX (2:10:10:10 MSB-X:R:G:B)" }, + [0x2 ] = {DRM_FORMAT_XRGB8888 ,32 ,"32-bit RGBX (8:8:8:8 MSB-X:B:G:R)" }, + [0x3 ] = {DRM_FORMAT_XRGB161616F ,64 , +"64-bit XRGB Floating Point (16:16:16:16 MSB-X:R:G:B)" }, [0x4 ] = {DRM_FORMAT_AYUV ,32 , -"YUV 32-bit 4:4:4 packed (8:8:8:8 MSB-X:Y:U:V)" }, +"32-bit YUV 4:4:4 packed (8:8:8:8 MSB-X:Y:U:V)" }, };/**
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v14 4/7 drm/i915/gvt: Add opregion support
In reply to Tina ZhangWindows guest driver needs vbt in opregion, to configure the setting for display. Without opregion support, the display registers won't be set and this blocks display model to get the correct information of the guest display plane.
This patch is to provide a virtual opregion for guest. Current implementation is to fill the virtual opregion with the content in host's opregion. The original author of this patch is Xiaoguang Chen.
drivers/gpu/drm/i915/gvt/hypercall.h +1 -0
@@ -55,6 +55,7 @@ struct intel_gvt_mpt { unsigned long mfn, unsigned int nr, bool map);int (*set_trap_area)(unsigned long handle,u64 start,u64 end,bool map); +int (*set_opregion)(void *vgpu); };extern struct intel_gvt_mpt xengt_mpt;
drivers/gpu/drm/i915/gvt/kvmgt.c +106 -3
157 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/mpt.h +15 -0
@@ -292,4 +292,19 @@ static inline int intel_gvt_hypervisor_set_trap_area( return intel_gvt_host.mpt->set_trap_area(vgpu->handle, start, end, map); } +/** +* intel_gvt_hypervisor_set_opregion - Set opregion for guest +* @vgpu: a vGPU +* +* Returns: +* Zero on success, negative error code if failed. +*/ +static inline int intel_gvt_hypervisor_set_opregion (struct intel_vgpu *vgpu) +{ +if (!intel_gvt_host.mpt->set_opregion) +return 0 ; + +return intel_gvt_host.mpt->set_opregion (vgpu); +} +#endif /* _GVT_MPT_H_ */
drivers/gpu/drm/i915/gvt/opregion.c +20 -6
@@ -113,23 +113,37 @@ void intel_vgpu_clean_opregion(struct intel_vgpu *vgpu)*/ int intel_vgpu_init_opregion (struct intel_vgpu *vgpu,u32 gpa) { -int ret; +int ret =0 ; +unsigned long pfn;gvt_dbg_core ("vgpu%d: init vgpu opregion\n" , vgpu->id); -if (intel_gvt_host.hypervisor_type ==INTEL_GVT_HYPERVISOR_XEN ) { +switch (intel_gvt_host.hypervisor_type) { +case INTEL_GVT_HYPERVISOR_KVM : + pfn =intel_gvt_hypervisor_gfn_to_mfn (vgpu, gpa >>PAGE_SHIFT ); +vgpu_opregion (vgpu)->va =memremap (pfn <<PAGE_SHIFT , +INTEL_GVT_OPREGION_SIZE , +MEMREMAP_WB ); +if (!vgpu_opregion (vgpu)->va) { +gvt_vgpu_err ("failed to map guest opregion\n" ); + ret = -EFAULT ; + } +break ; +case INTEL_GVT_HYPERVISOR_XEN :gvt_dbg_core ("emulate opregion from kernel\n" ); ret =init_vgpu_opregion (vgpu, gpa);if (ret) -return ret; +break ; ret =map_vgpu_opregion (vgpu, true); -if (ret) -return ret; +break ; +default : + ret = -EINVAL ; +gvt_vgpu_err ("not supported hypervisor\n" ); } -return 0 ; +return ret; }/**
drivers/gpu/drm/i915/gvt/vgpu.c +4 -0
@@ -383,6 +383,10 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,if (ret) goto out_clean_shadow_ctx; + ret =intel_gvt_hypervisor_set_opregion (vgpu); +if (ret) + goto out_clean_shadow_ctx; +mutex_unlock (&gvt->lock);return vgpu;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v14 5/7 vfio: ABI for mdev display dma-buf operation
In reply to Tina ZhangAdd VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user mode query and get the plan and its related information. This ioctl can be invoked with:
1) either flag DMABUF or REGION is set. Vendor driver returns success and the plane_info only when the specific kind of buffer is supported.
2) flag PROBE is set with either DMABUF or REGION. Vendor driver returns success only when the specific kind of buffer is supported.
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.
v14:
- add PROBE, DMABUF and REGION flags. (Alex)
v12:
- add drm_format_mod back. (Gerd and Zhenyu)
- add region_index. (Gerd)
v11:
- rename plane_type to drm_plane_type. (Gerd)
- move fields of vfio_device_query_gfx_plane to vfio_device_gfx_plane_info. (Gerd)
- remove drm_format_mod, start fields. (Daniel)
- remove plane_id.
v10:
- refine the ABI API VFIO_DEVICE_QUERY_GFX_PLANE. (Alex) (Gerd)
v3:
- add a field gvt_plane_info in the drm_i915_gem_obj structure to save the decoded plane information to avoid look up while need the plane info. (Gerd)
include/uapi/linux/vfio.h +43 -0
@@ -502,6 +502,49 @@ 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) +* +* Set the drm_plane_type and flags, then retrieve information about the gfx plane. +* +* flags: +* VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_DMABUF are set to ask if the mdev +* supports dma-buf. 0 on support, -EINVAL on no support for dma-buf. +* VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_REGION are set to ask if the mdev +* supports region. 0 on support, -EINVAL on no support for region. +* VFIO_GFX_PLANE_TYPE_DMABUF or VFIO_GFX_PLANE_TYPE_REGION is set with each call to +* query the plane info. +* Others are invalid and return -EINVAL. +* +* Return: 0 on success, -ENODEV with all out fields zero on mdev device initialization, -errno on +* other failure. +*/ +struct vfio_device_gfx_plane_info { +__u32 argsz; +__u32 flags; +#define VFIO_GFX_PLANE_TYPE_PROBE (1 << 0) +#define VFIO_GFX_PLANE_TYPE_DMABUF (1 << 1) +#define VFIO_GFX_PLANE_TYPE_REGION (1 << 2) +/* in */ +__u32 drm_plane_type;/* type of plane: DRM_PLANE_TYPE_* */ +/* out */ +__u32 drm_format;/* drm format of plane */ +__u64 drm_format_mod;/* tiled mode */ +__u32 width;/* width of plane */ +__u32 height;/* height of plane */ +__u32 stride;/* stride of plane */ +__u32 size;/* size of plane in bytes, align on page*/ +__u32 x_pos;/* horizontal position of cursor plane, upper left corner in pixels */ +__u32 y_pos;/* vertical position of cursor plane, upper left corner in lines*/ +union { +__u32 region_index;/* region index */ +__s32 fd;/* dma-buf fd */ + }; +}; + +#define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14) + +/* -------- API for Type1 VFIO IOMMU -------- */ /**
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Quoted 15 lines · Tina Zhang
+/**
+ *VFIO_DEVICE_QUERY_GFX_PLANE-_IOW(VFIO_TYPE, VFIO_BASE + 14, struct vfio_device_query_gfx_plane)
+ *
+ * Set thedrm_plane_typeand flags, then retrieve information about the gfx plane.
+ *
+ * flags:
+ * VFIO_GFX_PLANE_TYPE_PROBE andVFIO_GFX_PLANE_TYPE_DMABUFare set to ask if the mdev
+ * supports dma-buf. 0 on support,-EINVALon no support for dma-buf.
+ *VFIO_GFX_PLANE_TYPE_PROBEandVFIO_GFX_PLANE_TYPE_REGIONare set to ask if the mdev
+ * supports region. 0 on support,-EINVALon no support for
Quoted 8 lines
region.
+ *VFIO_GFX_PLANE_TYPE_DMABUForVFIO_GFX_PLANE_TYPE_REGIONis set with each call to
+ * query the plane info.
+ * Others are invalid and return-EINVAL.
+ *
+ * Return: 0 on success,-ENODEVwith all out fields zero on mdev device initialization,
Do you mean PROBE calls here?
The behavior in case the guest driver hasn't yet initialized the plane should be documented here too.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
In reply to Tina ZhangHi,
[ bringing a private discussion back to the list ]
Quoted 8 lines
The dma-buf's life cycle is handled by user mode and tracked by kernel.
The returned fd in structvfio_device_query_gfx_planecan 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):
include/uapi/linux/vfio.h +0 -0
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
It's really tricky to handle the cached dmabuf_obj's life-cycle without touching other kernel modules (e.g. i915 or dmabuf).The proposed two ioctls will be helpful.
So, there is a problem about the releasing cached dmabuf_obj. We cannot rely on the drm_i915_gem_object_ops.release() to release the cached dmabuf_obj, as this release operation is running in another thread, which leads to a racing condition and tricky to be solved without touching other modules.
So, in order to solve that kind of problem, I’d like to add one more ioctl, which is used for user mode to close the dmabuf_obj.
Including the proposed two ioctls, the incremental patch is like this:
linux-headers/linux/vfio.h +21 -1
@@ -538,12 +538,33 @@ 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 */ +__s32 dmabuf_id;/* dma-buf fd */ }; };#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) + + +struct vfio_device_gfx_buffer { +__u32 argsz; +__u32 flags; +/* in */ +__u32 id; +}; + +#define VFIO_DEVICE_CLOSE_BUF _IO(VFIO_TYPE, VFIO_BASE + 16)
And here are some details:
1. VFIO_DEVICE_QUERY_GFX_PLANE: is used for user mode to ask kernel part to create a buffer (in dmabuf case is dmabuf_obj in kernel) and return the buffer info.
2. VFIO_DEVICE_GET_GFX_DMABUF: is used for user mode to ask kernel part which interface it likes the buffer to be wrapped. Actually, I think there could be a bunch of types, including DMBUF type.
So, maybe we can change the IOCTL's name to some generic name and use flags field to distinguish them.
In dmabuf case, a new dmabuf will be created each time with this ioctl invoked, and installed with a new fd. The dmabuf is just a wrapper of kernel dmabuf_obj distinguished by dmabuf_id. So there could be more than one dmabuf as the wrappers of the same dmabuf_obj, if this ioctl was invoked with the same dmabuf_id many times. The dmabuf and its fd is fully controlled by user mode. And the VFIO_DEVICE_CLOSE_BUF can guarantee the referenced dmabuf_obj will be released at last, after all the dmabufs are released.
3. VFIO_DEVICE_CLOSE_BUF: is used for user mode to tell kernel part to release that buffer.
In dmabuf case, this ioctl won't release the dmabuf_obj at once. It just decreases the reference count of the dmabuf_obj and make sure this dmabuf_obj won't be reused through VFIO_DEVICE_QUERY_GFX_PLANE again. At last, after all the referencing dmabuf are released by user mode, the dmabuf_obj will be released by kernel.
Thanks,
BR,
Tina
Quoted 57 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Tuesday, September 26, 2017 3:12 PM
To: Zhang, Tina <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Alex Williamson <[email protected]>; Daniel Vetter <[email protected]>
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operationHi,
[ bringing a private discussion back to the list ]
Quoted 6 lines
The dma-buf's life cycle is handled by user mode and tracked by kernel.
The returned fd in structvfio_device_query_gfx_planecan 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):
include/uapi/linux/vfio.h +0
-0@@ -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)include/uapi/linux/vfio.h +10
-0+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 ]
Quoted 8 lines
git branch, kernel, with updated dmabuf patch:
https://www.kraxel.org/cgit/linux/log/?h=gvt-dmabuf-v14qemu branch:
https://www.kraxel.org/cgit/qemu/log/?h=work/intel-vgpucheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Hi,
Quoted 6 lines
So, there is a problem about the releasing cached
dmabuf_obj. We cannot rely on thedrm_i915_gem_object_ops.release()to release the cacheddmabuf_obj,
as this release operation is running in another thread, which leads to a racing condition and tricky to be solved without touching other modules.
PLANE_INFO just creates a intel_vgpu_dmabuf_obj.
GET_DMABUF creates a fresh proxy gem object and dmabuf.
proxy gem object references intel_vgpu_dmabuf_obj but not the other way around. Then you can simply refcount intel_vgpu_dmabuf_obj and be done with it.
https://www.kraxel.org/cgit/linux/commit/?h=gvt-dmabuf-v14&id=350a0e834971e6f53d7235d8b6167bed4dccf074
Note: Patch renamed intel_vgpu_dmabuf_obj to intel_vgpu_fb_obj, because it doesn't refer to dmabufs any more. It basically carries the guest plane/framebuffer information and the ID associated with it.
Quoted 2 lines
So, in order to solve that kind of problem, I’d like to add one more ioctl, which is used for user mode to close the
dmabuf_obj.
Depending on userspace notifying the kernel for that kind of cleanups is a bad idea. What happens in case userspace crashes? Do you leak dmabufs then?
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Thanks for the patch. Actually, I did the same thing in my local repo and also, I have a patch for the local Qemu repo to test it. I will send them out later.
The reason why I want to propose the close IOCTL is because that the current lock (fb_obj_list_lock), cannot sync the intel_vgpu_fb_info releasing and reusing. You see, the intel_vgpu_fb_info reusing and releasing are in different threads. There is a case that intel_vgpu_find_dmabuf can return a intel_vgpu_fb_obj, while the intel_vgpu_fb_obj is on the way to be released. That's the problem.
The invoker of the close IOCTL is only Qemu. So, if the Qemu crashes, the whole vGPU's resource is going to be released. We can handle our dmabuf_obj to be released there.
Thanks.
BR,
Tina
Quoted 40 lines
-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Gerd Hoffmann
Sent: Wednesday, September 27, 2017 6:11 PM
To: Zhang, Tina <[email protected]>; [email protected]; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; [email protected]; Alex Williamson <[email protected]>; Lv, Zhiyuan <[email protected]>
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operationHi,
Quoted 5 lines
So, there is a problem about the releasing cached
dmabuf_obj. We cannot rely on thedrm_i915_gem_object_ops.release()to release the cacheddmabuf_obj, as this release operation is running in another thread, which leads to a racing condition and tricky to be solved without touching other modules.
PLANE_INFOjust creates aintel_vgpu_dmabuf_obj.
GET_DMABUFcreates a fresh proxy gem object and dmabuf.proxy gem object references
intel_vgpu_dmabuf_objbut not the other way around. Then you can simply refcountintel_vgpu_dmabuf_objand be done with it.https://www.kraxel.org/cgit/linux/commit/?h=gvt-dmabuf-v14&id=350a0e834
971e6f53d7235d8b6167bed4dccf074Note: Patch renamed intel_vgpu_dmabuf_obj to
intel_vgpu_fb_obj, because it doesn't refer to dmabufs any more. It basically carries the guest plane/framebuffer information and the ID associated with it.Quoted 2 lines
So, in order to solve that kind of problem, I’d like to add one more ioctl, which is used for user mode to close the
dmabuf_obj.Depending on userspace notifying the kernel for that kind of cleanups is a bad idea. What happens in case userspace crashes? Do you leak dmabufs then?
Quoted 7 lines
cheers,
Gerd_______________________________________________
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
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Hi,
Quoted 7 lines
The reason why I want to propose the close IOCTL is because that the current lock (
fb_obj_list_lock), cannot sync theintel_vgpu_fb_inforeleasing and reusing.
You see, theintel_vgpu_fb_inforeusing and releasing are in different threads. There is a case thatintel_vgpu_find_dmabufcan return aintel_vgpu_fb_obj, while theintel_vgpu_fb_objis on the way to be released. That's the problem.
Oh, right. But that race is fixable. We need to move the locks one level up, so we don't only cover list operations (add/lookup/delete) but also the kref_{get,put} operations for the list elements.
Patch against my tree, only build-tested so far.
cheers,
Gerd
Quoted 1 line
From
3e8c30a857d98d36357e8d9bb04b7ccb72264543Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <[email protected]>
Date: Fri, 29 Sep 2017 08:59:34 +0200
Subject: [PATCH] fix locking
--- drivers/gpu/drm/i915/gvt/dmabuf.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gvt/dmabuf.c +13 -13
@@ -84,24 +84,25 @@ static void intel_vgpu_fb_obj_release(struct kref *kref) {struct intel_vgpu_fb_obj *fb_obj = container_of(kref, struct intel_vgpu_fb_obj, kref); -struct intel_vgpu *vgpu; - vgpu = fb_obj->vgpu; -mutex_lock (&vgpu->fb_obj_list_lock);list_del (&fb_obj->list); -mutex_unlock (&vgpu->fb_obj_list_lock);kfree (fb_obj); }static void intel_vgpu_gem_release (struct drm_i915_gem_object *obj) { +struct intel_vgpu *vgpu; +if (WARN_ON (!obj->gvt || !obj->gvt->vgpu)) {gvt_err ("gvt info is invalid\n" );return ; } -intel_gvt_hypervisor_put_vfio_device (obj->gvt->vgpu); + vgpu = obj->gvt->vgpu; +intel_gvt_hypervisor_put_vfio_device (vgpu); +mutex_lock (&vgpu->fb_obj_list_lock);kref_put (&obj->gvt->kref, intel_vgpu_fb_obj_release); +mutex_unlock (&vgpu->fb_obj_list_lock); obj->gvt =NULL ; }
@@ -239,7 +240,6 @@ intel_vgpu_pick_exposed_dmabuf(struct intel_vgpu *vgpu,struct list_head *pos;struct intel_vgpu_fb_obj *fb_obj; -mutex_lock (&vgpu->fb_obj_list_lock);list_for_each (pos, &vgpu->fb_obj_list_head) { fb_obj = container_of(pos, struct intel_vgpu_fb_obj, list);
@@ -251,11 +251,9 @@ intel_vgpu_pick_exposed_dmabuf(struct intel_vgpu *vgpu, (fb_obj->fb.width == latest_info->width) && (fb_obj->fb.height == latest_info->height) && (fb_obj->fb.stride == latest_info->stride)) { -mutex_unlock (&vgpu->fb_obj_list_lock);return fb_obj; } } -mutex_unlock (&vgpu->fb_obj_list_lock);return NULL ; }
@@ -265,16 +263,13 @@ intel_vgpu_find_dmabuf(struct intel_vgpu *vgpu, u32 dmabuf_id)struct list_head *pos;struct intel_vgpu_fb_obj *fb_obj; -mutex_lock (&vgpu->fb_obj_list_lock);list_for_each (pos, &vgpu->fb_obj_list_head) { fb_obj = container_of(pos, struct intel_vgpu_fb_obj, list);if (fb_obj->dmabuf_id == dmabuf_id) { -mutex_unlock (&vgpu->fb_obj_list_lock);return fb_obj; } } -mutex_unlock (&vgpu->fb_obj_list_lock);return NULL ; }
@@ -327,8 +322,10 @@ int intel_vgpu_query_plane(struct intel_vgpu *vgpu, void *args)return ret;/* If exists, pick up the exposed dmabuf fd */ +mutex_lock (&vgpu->fb_obj_list_lock); fb_obj =intel_vgpu_pick_exposed_dmabuf (vgpu, &fb_info);if (fb_obj !=NULL ) { +mutex_unlock (&vgpu->fb_obj_list_lock);update_fb_info (gvt_dmabuf, fb_obj);return 0 ; }
@@ -345,7 +342,6 @@ int intel_vgpu_query_plane(struct intel_vgpu *vgpu, void *args) fb_obj->fb = fb_info; fb_obj->dmabuf_id = id++; -mutex_lock (&vgpu->fb_obj_list_lock);list_add_tail (&fb_obj->list, &vgpu->fb_obj_list_head);mutex_unlock (&vgpu->fb_obj_list_lock);update_fb_info (gvt_dmabuf, fb_obj);
@@ -362,11 +358,15 @@ int intel_vgpu_get_dmabuf(struct intel_vgpu *vgpu, void *args)struct dma_buf *dmabuf;int ret; +mutex_lock (&vgpu->fb_obj_list_lock); fb_obj =intel_vgpu_find_dmabuf (vgpu, gvt_dmabuf->dmabuf_id); -if (NULL == fb_obj) +if (NULL == fb_obj) { +mutex_unlock (&vgpu->fb_obj_list_lock);return -EINVAL ; + } obj =intel_vgpu_create_gem (dev, fb_obj); +mutex_unlock (&vgpu->fb_obj_list_lock);if (obj ==NULL ) {gvt_vgpu_err ("create gvt gem obj failed:%d\n" , vgpu->id);return -ENOMEM ;
Signature · 1 line
2.9.3
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
In reply to Gerd HoffmannSo, there won't be dmabuf leaking problem, as we release all the dmabuf_obj in the release ops when user space crashing.
Can we just stop considering the way to fix the dmabuf life-cycle issue and try to just consider the generic way to handle buffer exposing? Does the generic way need the close ioctl?
In my opinion, it's like to build up a producer-consumer way to expose the buffer:
Create buffer and return its info
Mdev devices -----------------------------------------------------> User space
<-----------------------------------------------------
(producer) Close it (consumer)
Alex and Gerd, can you share your thoughts?
Thanks.
BR,
Tina
Quoted 68 lines
-----Original Message-----
From: Zhang, Tina
Sent: Friday, September 29, 2017 7:43 AM
To: 'Gerd Hoffmann' <[email protected]>; [email protected]; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; [email protected]; Alex Williamson <[email protected]>; Lv, Zhiyuan <[email protected]>
Subject: RE: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operationThanks for the patch. Actually, I did the same thing in my local repo and also, I have a patch for the local Qemu repo to test it. I will send them out later.
The reason why I want to propose the close IOCTL is because that the current lock (
fb_obj_list_lock), cannot sync theintel_vgpu_fb_inforeleasing and reusing.
You see, theintel_vgpu_fb_inforeusing and releasing are in different threads. There is a case thatintel_vgpu_find_dmabufcan return aintel_vgpu_fb_obj, while theintel_vgpu_fb_objis on the way to be released. That's the problem.The invoker of the close IOCTL is only Qemu. So, if the Qemu crashes, the whole vGPU's resource is going to be released. We can handle our
dmabuf_objto be released there.Thanks.
BR,
TinaQuoted 24 lines
-----Original Message-----
From: intel-gvt-dev [mailto:[email protected]] On Behalf Of Gerd Hoffmann
Sent: Wednesday, September 27, 2017 6:11 PM
To: Zhang, Tina <[email protected]>; [email protected]; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; [email protected]; Alex Williamson <[email protected]>; Lv, Zhiyuan <[email protected]>
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operationHi,
Quoted 5 lines
So, there is a problem about the releasing cached
dmabuf_obj. We cannot rely on thedrm_i915_gem_object_ops.release()to release the cacheddmabuf_obj, as this release operation is running in another thread, which leads to a racing condition and tricky to be solved without touching other modules.
PLANE_INFOjust creates aintel_vgpu_dmabuf_obj.Quoted 7 lines
GET_DMABUFcreates a fresh proxy gem object and dmabuf.proxy gem object references
intel_vgpu_dmabuf_objbut not the other way around. Then you can simply refcountintel_vgpu_dmabuf_objand be done with it.v14&id=350a0e83
Quoted 7 lines
4
971e6f53d7235d8b6167bed4dccf074Note: Patch renamed intel_vgpu_dmabuf_obj to
intel_vgpu_fb_obj, because it doesn't refer to dmabufs any more. It basically carries the guest plane/framebuffer information and the ID associated with it.
Quoted 14 lines
Quoted 5 lines
Quoted 2 lines
So, in order to solve that kind of problem, I’d like to add one more ioctl, which is used for user mode to close the
dmabuf_obj.Depending on userspace notifying the kernel for that kind of cleanups is a bad idea. What happens in case userspace crashes? Do you leak dmabufs
then?
Quoted 8 lines
cheers,
Gerd_______________________________________________
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
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Quoted 6 lines · Tina
So, there won't be dmabuf leaking problem, as we release all the
dmabuf_objin the release ops when user space crashing.Can we just stop considering the way to fix the dmabuf life-cycle issue and try to just consider the generic way to handle buffer exposing?
Can you describe in more detail what you have in mind?
Quoted 1 line
Does the generic way need the close ioctl?
I think we don't need a close ioctl anyway.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Quoted 20 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Friday, September 29, 2017 3:29 PM
To: Zhang, Tina <[email protected]>; [email protected]; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; Alex Williamson <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; [email protected]; Lv, Zhiyuan <[email protected]>
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operationQuoted 6 lines · Tina
So, there won't be dmabuf leaking problem, as we release all the
dmabuf_objin the release ops when user space crashing.Can we just stop considering the way to fix the dmabuf life-cycle issue and try to just consider the generic way to handle buffer exposing?
Quoted 5 lines
Can you describe in more detail what you have in mind?
Quoted 1 line
Does the generic way need the close ioctl?
I think we don't need a close ioctl anyway.
Can you share your thoughts?
Do you think the fd interface is enough for all kinds of buffer exposed by Mdev? Thanks.
BR,
Tina
Quoted 4 lines
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Hi,
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Does the generic way need the close ioctl?
I think we don't need a close ioctl anyway.
Can you share your thoughts?
See other mail. I think the race can be fixed by changing the locking, so a explicit close ioctl isn't needed.
Quoted 2 lines
Do you think the fd interface is enough for all kinds of buffer exposed by Mdev?
What kind of buffers do you have in mind which might not be covered?
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Quoted 14 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Friday, September 29, 2017 4:03 PM
To: Zhang, Tina <[email protected]>; [email protected]; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; Alex Williamson <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; [email protected]; Lv, Zhiyuan <[email protected]>
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operationHi,
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Does the generic way need the close ioctl?
I think we don't need a close ioctl anyway.
Can you share your thoughts?
See other mail. I think the race can be fixed by changing the locking, so a explicit close ioctl isn't needed.
Yeah, I understand your idea. But unfortunately, it cannot solve the current issue.
There will still be a racing condition between releasing dmabuf_obj and reusing it.
For example, if the old reused dmabuf_obj is released just after query ioctl return it, the next get_fd ioctl would return error as the dmabuf_obj has already been closed.
Quoted 5 lines
Quoted 3 lines
Do you think the fd interface is enough for all kinds of buffer exposed by Mdev?
What kind of buffers do you have in mind which might not be covered?
I thinking about the case that would like to postpone the buffers releasing operation, after user space has closed all the fd. Later these buffers may be used to expose to other kinds of fd to user space.
Thanks.
BR,
Tina
Quoted 3 lines
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Hi,
Quoted 3 lines
For example, if the old reused
dmabuf_objis released just after query ioctl return it, the nextget_fdioctl would return error as thedmabuf_objhas already been closed.
My branch already grabs an extra reference when creating a new dmabuf_obj, which will be dropped on GET_DMABUF ioctl, exactly to avoid the dmabuf_obj disappear between QUERY_PLANE and GET_DMABUF ioctls.
Can easily be extended to handle the reuse case too.
https://www.kraxel.org/cgit/linux/commit/?h=gvt-dmabuf-v14&id=9959109ae52cf15e119715a6b7de080fb849e3d2
While being at it also cleanup properly on close (so we don't leak structs in case userspace never calls GET_DMABUF for a plane).
https://www.kraxel.org/cgit/linux/commit/?h=gvt-dmabuf-v14&id=c0b0c407e33904e749dec1ef44ec01099c16d39f
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Do you think the fd interface is enough for all kinds of buffer exposed by Mdev?
What kind of buffers do you have in mind which might not be covered?
I thinking about the case that would like to postpone the buffers releasing operation, after user space has closed all the fd.
Work fine. qemu can import the dma-buf as opengl texture, which creates a extra reference. Then close the fd. dma-buf continues to exist as long as the texture referencing it exists.
Quoted 2 lines
Later these buffers may be used to expose to other kinds of fd to user space.
Sorry, I don't understand that sentence.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Quoted 14 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Friday, September 29, 2017 6:21 PM
To: Zhang, Tina <[email protected]>; [email protected]; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; Alex Williamson <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; [email protected]; Lv, Zhiyuan <[email protected]>
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operationHi,
Quoted 7 lines
Quoted 3 lines
For example, if the old reused
dmabuf_objis released just after query ioctl return it, the nextget_fdioctl would return error as thedmabuf_objhas already been closed.My branch already grabs an extra reference when creating a new
dmabuf_obj, which will be dropped onGET_DMABUFioctl, exactly to avoid thedmabuf_objdisappear betweenQUERY_PLANEandGET_DMABUFioctls.
Yeah, that could solve the problem. But I'm not sure if it could be acceptable. Zhenyu, can you share your comments?
Thanks.
BR,
Tina
Quoted 24 lines
Can easily be extended to handle the reuse case too.
https://www.kraxel.org/cgit/linux/commit/?h=gvt-dmabuf-v14&id=9959109ae
52cf15e119715a6b7de080fb849e3d2While being at it also cleanup properly on close (so we don't leak structs in case userspace never calls
GET_DMABUFfor a plane).https://www.kraxel.org/cgit/linux/commit/?h=gvt-dmabuf-v14&id=c0b0c407e
33904e749dec1ef44ec01099c16d39fQuoted 7 lines
Quoted 4 lines
Quoted 2 lines
Do you think the fd interface is enough for all kinds of buffer exposed by Mdev?
What kind of buffers do you have in mind which might not be covered?
I thinking about the case that would like to postpone the buffers releasing operation, after user space has closed all the fd.
Work fine. qemu can import the dma-buf as opengl texture, which creates a extra reference. Then close the fd. dma-buf continues to exist as long as the texture referencing it exists.
Quoted 7 lines
Quoted 2 lines
Later these buffers may be used to expose to other kinds of fd to user space.
Sorry, I don't understand that sentence.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Hi,
Quoted 3 lines
Yeah, that could solve the problem. But I'm not sure if it could be acceptable.
Zhenyu, can you share your comments?
Ping? Any progress here? We are at 4.14-rc3 already. v15 is needed really soon now otherwise the 4.15 merge window will be missed.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Quoted 11 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Friday, October 6, 2017 8:13 PM
To: Zhang, Tina <[email protected]>; [email protected]; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; Alex Williamson <[email protected]>
Cc: Daniel Vetter <[email protected]>; [email protected]; [email protected]; Lv, Zhiyuan <[email protected]>
Subject: Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
Quoted 8 lines
Hi,
Quoted 3 lines
Yeah, that could solve the problem. But I'm not sure if it could be acceptable.
Zhenyu, can you share your comments?Ping? Any progress here? We are at 4.14-rc3 already. v15 is needed really soon now otherwise the 4.15 merge window will be missed.
V15 will be submitted next week, after discussion with maintainers. Thanks.
BR,
Tina
Quoted 3 lines
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 5/7] vfio: ABI for mdev display dma-buf operation
In reply to Tina ZhangHi,
Quoted 4 lines
(quoted diff) +1
-0+ __u32 x_pos; /* horizontal position of cursor plane,upper left corner in pixels */
(quoted diff) +1
-0+ __u32 y_pos; /* vertical position of cursor plane,upper left corner in lines*/
Completely separate question: Does the host know the cursor hotspot?
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v14 6/7 drm/i915: Introduce GEM proxy
In reply to Tina ZhangGEM proxy is a kind of GEM, whose backing physical memory is pinned and produced by guest VM and is used by host as read only. With GEM proxy, host is able to access guest physical memory through GEM object interface. As GEM proxy is such a special kind of GEM, a new flag I915_GEM_OBJECT_IS_PROXY is introduced to ban host from changing the backing storage of GEM proxy.
v14:
- return -ENXIO when gem proxy object is banned by ioctl. (Chris) (Daniel)
v13:
- add comments to GEM proxy. (Chris)
- don't ban GEM proxy in i915_gem_sw_finish_ioctl. (Chris)
- check GEM proxy bar after finishing i915_gem_object_wait. (Chris)
- remove GEM proxy bar in i915_gem_madvise_ioctl.
v6:
- add gem proxy barrier in the following ioctls. (Chris) i915_gem_set_caching_ioctl i915_gem_set_domain_ioctl i915_gem_sw_finish_ioctl i915_gem_set_tiling_ioctl i915_gem_madvise_ioctl
drivers/gpu/drm/i915/i915_gem.c +23 -1
@@ -1584,6 +1584,16 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,if (err) goto out; +/* Proxy objects do not control access to the backing storage, ergo +* they cannot be used as a means to manipulate the cache domain +* tracking for that backing storage. The proxy object is always +* considered to be outside of any cache domain. +*/ +if (i915_gem_object_is_proxy (obj)) { + err = -ENXIO ; + goto out; + } +/* Flush and acquire obj->pages so that we are coherent through * direct access in memory with previous cached writes through * shmemfs and that our cache domain tracking remains valid.
@@ -1640,6 +1650,10 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,if (!obj)return -ENOENT ; +/* Proxy objects are barred from CPU access, so there is no +* need to ban sw_finish as it is a nop. +*/ +/* Pinned buffers may be scanout, so flush the cache */ i915_gem_object_flush_if_display (obj);i915_gem_object_put (obj);
@@ -1690,7 +1704,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,*/ if (!obj->base.filp) {i915_gem_object_put (obj); -return -EINVAL ; +return -ENXIO ; } addr = vm_mmap(obj->base.filp, 0, args->size,
@@ -3749,6 +3763,14 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,if (!obj)return -ENOENT ; +/* The caching mode of proxy object is handled by its generator, and not +* expected to be changed by user mode. +*/ +if (i915_gem_object_is_proxy (obj)) { + ret = -ENXIO ; + goto out; + } +if (obj->cache_level == level) goto out;
drivers/gpu/drm/i915/i915_gem_object.h +7 -0
@@ -39,6 +39,7 @@ struct drm_i915_gem_object_ops {unsigned int flags;#define I915_GEM_OBJECT_HAS_STRUCT_PAGE BIT(0)#define I915_GEM_OBJECT_IS_SHRINKABLE BIT(1) +#define I915_GEM_OBJECT_IS_PROXY BIT(2)/* Interface between the GEM object and its backing storage. * get_pages() is called once prior to the use of the associated set
@@ -300,6 +301,12 @@ i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) }static inline bool +i915_gem_object_is_proxy (const struct drm_i915_gem_object *obj) +{ +return obj->ops->flags &I915_GEM_OBJECT_IS_PROXY ; +} + +static inline bool i915_gem_object_is_active (const struct drm_i915_gem_object *obj) {return obj->active_count;
drivers/gpu/drm/i915/i915_gem_tiling.c +8 -0
@@ -345,6 +345,14 @@ i915_gem_set_tiling_ioctl(struct drm_device *dev, void *data,if (!obj)return -ENOENT ; +/* The tiling mode of proxy objects is handled by its generator, and not +* expected to be changed by user mode. +*/ +if (i915_gem_object_is_proxy (obj)) { + err = -ENXIO ; + goto err; + } +if (!i915_tiling_ok (obj, args->tiling_mode, args->stride)) { err = -EINVAL ; goto err;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v14 6/7] drm/i915: Introduce GEM proxy
Quoted 25 lines · Tina Zhang
GEM proxy is a kind of GEM, whose backing physical memory is pinned and produced by guest VM and is used by host as read only. With GEM proxy, host is able to access guest physical memory through GEM object interface. As GEM proxy is such a special kind of GEM, a new flag
I915_GEM_OBJECT_IS_PROXYis introduced to ban host from changing the backing storage of GEM proxy.v14:
- return-ENXIOwhen gem proxy object is banned by ioctl. (Chris) (Daniel)v13:
- add comments to GEM proxy. (Chris)
- don't ban GEM proxy ini915_gem_sw_finish_ioctl. (Chris)
- check GEM proxy bar after finishingi915_gem_object_wait. (Chris)
- remove GEM proxy bar ini915_gem_madvise_ioctl.v6:
- add gem proxy barrier in the following ioctls. (Chris)i915_gem_set_caching_ioctli915_gem_set_domain_ioctli915_gem_sw_finish_ioctli915_gem_set_tiling_ioctli915_gem_madvise_ioctl
Quoted 4 lines
Signed-off-by Tina Zhang <[email protected]>Cc Daniel Vetter <[email protected]>Cc Chris Wilson <[email protected]>Cc Joonas Lahtinen <[email protected]>
This is now as agreed.
Regards, Joonas
PS. I think you have --no-stat option turned on in git format-patch. Please turn it back off, it'll make it far easier for anybody reading the patches to get an overview of which files the patch touches.
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v14 7/7 drm/i915/gvt: Dmabuf support for GVT-g
In reply to Tina ZhangThis patch introduces a guest's framebuffer sharing mechanism based on dma-buf subsystem. With this sharing mechanism, guest's framebuffer can be shared between guest VM and host.
v14:
- add PROBE, DMABUF and REGION flags. (Alex)
v12:
- refine the lifecycle of dmabuf.
v9:
- remove dma-buf management. (Alex)
- track the dma-buf create and release in kernel mode. (Gerd) (Daniel)
v8:
- refine the dma-buf ioctl definition.(Alex)
- add a lock to protect the dmabuf list. (Alex)
v7:
- release dma-buf related allocations in dma-buf's associated release function. (Alex)
- refine ioctl interface for querying plane info or create dma-buf. (Alex)
v6:
- align the dma-buf life cycle with the vfio device. (Alex)
- add the dma-buf related operations in a separate patch. (Gerd)
- i915 related changes. (Chris)
v5:
- fix bug while checking whether the gem obj is gvt's dma-buf when user change caching mode or domains. Add a helper function to do it. (Xiaoguang)
- add definition for the query plane and create dma-buf. (Xiaoguang)
v4:
- fix bug while checking whether the gem obj is gvt's dma-buf when set caching mode or doamins. (Xiaoguang)
v3:
- declare a new flag I915_GEM_OBJECT_IS_GVT_DMABUF in drm_i915_gem_object to represent the gem obj for gvt's dma-buf. The tiling mode, caching mode and domains can not be changed for this kind of gem object. (Alex)
- change dma-buf related information to be more generic. So other vendor can use the same interface. (Alex)
v2:
- create a management fd for dma-buf operations. (Alex)
- alloc gem object's backing storage in gem obj's get_pages() callback. (Chris)
drivers/gpu/drm/i915/gvt/Makefile +1 -1
@@ -2,7 +2,7 @@ GVT_DIR := gvt GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \ interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \ execlist.o scheduler.o sched_policy.o render.o cmd_parser.o \ - fb_decoder.o + fb_decoder.o dmabuf.o ccflags-y += -I$(src) -I$(src)/$(GVT_DIR) i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
drivers/gpu/drm/i915/gvt/dmabuf.c new file +387 -0
387 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/dmabuf.h new file +58 -0
58 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/gvt.c +1 -0
@@ -54,6 +54,7 @@ static const struct intel_gvt_ops intel_gvt_ops = { .vgpu_reset = intel_gvt_reset_vgpu, .vgpu_activate = intel_gvt_activate_vgpu, .vgpu_deactivate = intel_gvt_deactivate_vgpu, + .vgpu_query_plane = intel_vgpu_query_plane, };/**
drivers/gpu/drm/i915/gvt/gvt.h +9 -0
@@ -47,6 +47,7 @@#include "render.h" #include "cmd_parser.h" #include "fb_decoder.h" +#include "dmabuf.h" #define GVT_MAX_VGPU 8
@@ -183,8 +184,15 @@ struct intel_vgpu {struct kvm *kvm;struct work_struct release_work;atomic_t released; +struct vfio_device *vfio_device; } vdev;#endif + +struct list_head dmabuf_obj_list_head; +struct mutex dmabuf_list_lock; + +struct completion vblank_done; + }; struct intel_gvt_gm {
@@ -500,6 +508,7 @@ struct intel_gvt_ops {void (*vgpu_reset)(struct intel_vgpu *);void (*vgpu_activate)(struct intel_vgpu *);void (*vgpu_deactivate)(struct intel_vgpu *); +int (*vgpu_query_plane)(struct intel_vgpu *vgpu,void *); };
drivers/gpu/drm/i915/gvt/hypercall.h +2 -0
@@ -56,6 +56,8 @@ struct intel_gvt_mpt {int (*set_trap_area)(unsigned long handle,u64 start,u64 end,bool map);int (*set_opregion)(void *vgpu); +int (*get_vfio_device)(void *vgpu); +void (*put_vfio_device)(void *vgpu); };extern struct intel_gvt_mpt xengt_mpt;
drivers/gpu/drm/i915/gvt/kvmgt.c +42 -0
76 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/mpt.h +30 -0
@@ -307,4 +307,34 @@ static inline int intel_gvt_hypervisor_set_opregion(struct intel_vgpu *vgpu) return intel_gvt_host.mpt->set_opregion(vgpu); } +/** +* intel_gvt_hypervisor_get_vfio_device - increase vfio device ref count +* @vgpu: a vGPU +* +* Returns: +* Zero on success, negative error code if failed. +*/ +static inline int intel_gvt_hypervisor_get_vfio_device (struct intel_vgpu *vgpu) +{ +if (!intel_gvt_host.mpt->get_vfio_device) +return 0 ; + +return intel_gvt_host.mpt->get_vfio_device (vgpu); +} + +/** +* intel_gvt_hypervisor_put_vfio_device - decrease vfio device ref count +* @vgpu: a vGPU +* +* Returns: +* Zero on success, negative error code if failed. +*/ +static inline void intel_gvt_hypervisor_put_vfio_device (struct intel_vgpu *vgpu) +{ +if (!intel_gvt_host.mpt->put_vfio_device) +return ; + + intel_gvt_host.mpt->put_vfio_device (vgpu); +} +#endif /* _GVT_MPT_H_ */
drivers/gpu/drm/i915/gvt/vgpu.c +1 -1
@@ -346,7 +346,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, vgpu->gvt = gvt; vgpu->sched_ctl.weight = param->weight;bitmap_zero (vgpu->tlb_handle_pending,I915_NUM_ENGINES ); - +INIT_LIST_HEAD (&vgpu->dmabuf_obj_list_head);intel_vgpu_init_cfg_space (vgpu, param->primary); ret =intel_vgpu_init_mmio (vgpu);
drivers/gpu/drm/i915/i915_gem_object.h +2 -0
@@ -199,6 +199,8 @@ struct drm_i915_gem_object { } userptr;unsigned long scratch; + +void *gvt_info; };/** for phys allocated objects */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/gvt: Dma-buf support for GVT-g
In reply to Tina Zhang== Series Details ==
== Series Details ==
Series: drm/i915/gvt: Dma-buf support for GVT-g
URL : https://patchwork.freedesktop.org/series/28980/
State : success
== Summary ==
Series 28980v1 drm/i915/gvt: Dma-buf support for GVT-g
https://patchwork.freedesktop.org/api/1.0/series/28980/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
pass -> FAIL (fi-snb-2600) fdo#100007
Test gem_ringfill:
Subgroup basic-default:
pass -> SKIP (fi-bsw-n3050) fdo#101915fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#101915 https://bugs.freedesktop.org/show_bug.cgi?id=101915
fi-bdw-5557u total:279 pass:268 dwarn:0 dfail:0 fail:0 skip:11 time:451s fi-bdw-gvtdvm total:279 pass:265 dwarn:0 dfail:0 fail:0 skip:14 time:441s fi-blb-e6850 total:279 pass:224 dwarn:1 dfail:0 fail:0 skip:54 time:362s fi-bsw-n3050 total:279 pass:242 dwarn:0 dfail:0 fail:0 skip:37 time:560s fi-bxt-j4205 total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:521s fi-byt-j1900 total:279 pass:254 dwarn:1 dfail:0 fail:0 skip:24 time:528s fi-byt-n2820 total:279 pass:250 dwarn:1 dfail:0 fail:0 skip:28 time:511s fi-glk-2a total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:609s fi-hsw-4770 total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:443s fi-hsw-4770r total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:423s fi-ilk-650 total:279 pass:229 dwarn:0 dfail:0 fail:0 skip:50 time:425s fi-ivb-3520m total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:510s fi-ivb-3770 total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:478s fi-kbl-7500u total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:476s fi-kbl-7560u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:596s fi-kbl-r total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:597s fi-pnv-d510 total:279 pass:223 dwarn:1 dfail:0 fail:0 skip:55 time:533s fi-skl-6260u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:473s fi-skl-6700k total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:483s fi-skl-6770hq total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:488s fi-skl-gvtdvm total:279 pass:266 dwarn:0 dfail:0 fail:0 skip:13 time:446s fi-skl-x1585l total:279 pass:268 dwarn:0 dfail:0 fail:0 skip:11 time:484s fi-snb-2520m total:279 pass:251 dwarn:0 dfail:0 fail:0 skip:28 time:546s fi-snb-2600 total:279 pass:249 dwarn:0 dfail:0 fail:1 skip:29 time:404s
8183095ca4abce6ec2ad43c1e36e877792c140f1 drm-tip: 2017y-08m-18d-09h-08m-28s UTC integration manifest 06591ef22442 drm/i915/gvt: Dmabuf support for GVT-g69d9112b7ab5 drm/i915: Introduce GEM proxyd905c36647f8 vfio: ABI for mdev display dma-buf operationbd594b6c0125 drm/i915/gvt: Add opregion support83284f2a7ef6 drm/i915/gvt: Add RGB 64-bit 16:16:16:16 float format09d19af42ee3 drm: Introduce RGB 64-bit 16:16:16:16 float format3fc810c1addb drm/i915/gvt: Add framebuffer decoder support
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5437/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Tina Zhang
v13->v14:
1) add PROBE, DMABUF and REGION flags. (Alex)
2) return-ENXIOwhen gem proxy object is banned by ioctl. (Chris) (Daniel)
3) add some details about the float pixel format. (Daniel)
4) add F suffix to the defined name. (Daniel)
5) refine pixel format table. (Zhenyu)
Ok, patch series applies cleanly to 4.13-rc6. The new flags are working fine.
However, I see VFIO_DEVICE_QUERY_GFX_PLANE failures which I think should not be there. When the guest didn't define a plane yet I get "No such device" errors instead of a plane_info struct with fields (drm_format, width, height, size) set to zero. I also see "Bad address" errors now and then with no obvious cause.
Cursor support isn't working too.
I'm testing with "-display egl-headless -spice gl=off,port=...". In that configuration qemu will import the dma-bufs as textures and reads them using ReadPixels for display.
qemu branch: https://www.kraxel.org/cgit/qemu/log/?h=work/intel-vgpu
The qemu branch has support for both dmabufs and regions. The region- based display code is totaly untested though.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi Gerd:
Thanks for the testing. We will find out the problem and refresh the whole patch series.
Thanks,
Zhi.
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Friday, August 25, 2017 2:47 PM
To: Zhang, Tina <[email protected]>; [email protected]; Lv, Zhiyuan <[email protected]>; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v14 0/7] drm/i915/gvt: Dma-buf support for GVT-g
Quoted 7 lines · Tina Zhang
v13->v14:
1) add PROBE, DMABUF and REGION flags. (Alex)
2) return-ENXIOwhen gem proxy object is banned by ioctl. (Chris) (Daniel)
3) add some details about the float pixel format. (Daniel)
4) add F suffix to the defined name. (Daniel)
5) refine pixel format table. (Zhenyu)
Ok, patch series applies cleanly to 4.13-rc6. The new flags are working fine.
However, I see VFIO_DEVICE_QUERY_GFX_PLANE failures which I think should not be there. When the guest didn't define a plane yet I get "No such device" errors instead of a plane_info struct with fields (drm_format, width, height, size) set to zero. I also see "Bad address" errors now and then with no obvious cause.
Cursor support isn't working too.
I'm testing with "-display egl-headless -spice gl=off,port=...". In that configuration qemu will import the dma-bufs as textures and reads them using ReadPixels for display.
qemu branch: https://www.kraxel.org/cgit/qemu/log/?h=work/intel-vgpu
The qemu branch has support for both dmabufs and regions. The region- based display code is totaly untested though.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thanks Zhi and Gerd for testing v14 patch-set.
Quoted 38 lines
-----Original Message-----
From: Wang, Zhi A
Sent: Friday, August 25, 2017 8:53 PM
To: Gerd Hoffmann <[email protected]>; Zhang, Tina <[email protected]>; [email protected]; Lv, Zhiyuan <[email protected]>; Tian, Kevin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [PATCH v14 0/7] drm/i915/gvt: Dma-buf support for GVT-gHi Gerd:
Thanks for the testing. We will find out the problem and refresh the whole
patch series.Thanks,
Zhi.-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Friday, August 25, 2017 2:47 PM
To: Zhang, Tina <[email protected]>; [email protected]; Lv, Zhiyuan <[email protected]>; Wang, Zhi A <[email protected]>; Tian, Kevin <[email protected]>; [email protected]; chris@chris- wilson.co.uk; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v14 0/7] drm/i915/gvt: Dma-buf support for GVT-gQuoted 7 lines · Tina Zhang
v13->v14:
1) add PROBE, DMABUF and REGION flags. (Alex)
2) return-ENXIOwhen gem proxy object is banned by ioctl. (Chris) (Daniel)
3) add some details about the float pixel format. (Daniel)
4) add F suffix to the defined name. (Daniel)
5) refine pixel format table. (Zhenyu)
Quoted 6 lines
Ok, patch series applies cleanly to 4.13-rc6. The new flags are working fine.
However, I see
VFIO_DEVICE_QUERY_GFX_PLANEfailures which I think should not be there. When the guest didn't define a plane yet I get "No such device" errors instead of aplane_infostruct with fields (drm_format, width, height, size) set to zero. I also see "Bad address" errors now and then with no obvious cause.
The idea is to return "No such device" error with fields set to zero.
There are two cases, in which the "No such device" error is returned: one is the guest IGD driver has not finished the initialization and the other is the plane is disabled by guest IGD driver. If we prefer to return success in these two situations with fields set to zero, I can add it in the next version.
We didn't meet the "Bad address" errors before. I will try your qemu repo to see whether I can meet the issue. Thanks.
Quoted 1 line
Cursor support isn't working too.
It seems there is some issue in i915 of version 4.13-rc6, which blocks the cursor on native platform. I just tried the rc7 (the latest staging), there is on such issue.
Thanks.
Tina
Quoted 5 lines
I'm testing with "-display egl-headless -spice gl=off,port=...". In that configuration qemu will import the dma-bufs as textures and reads them using ReadPixels for display.
Quoted 7 lines
qemu branch: https://www.kraxel.org/cgit/qemu/log/?h=work/intel-vgpu
The qemu branch has support for both dmabufs and regions. The region- based display code is totaly untested though.
cheers,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi,
Quoted 9 lines
Quoted 8 lines
However, I see
VFIO_DEVICE_QUERY_GFX_PLANEfailures which I think should
not be there. When the guest didn't define a plane yet I get "No such device"
errors instead of aplane_infostruct with fields (drm_format, width, height, size)
set to zero. I also see "Bad address" errors now and then with no obvious cause.
Quoted 8 lines
The idea is to return "No such device" error with fields set to zero. There are two cases, in which the "No such device" error is returned:
one is the guest IGD driver
has not finished the initialization and the other is the plane is disabled by guest IGD driver.
If we prefer to return success in these two situations with fields set to zero, I can add it in the
next version.
Yes, success should be returned in those cases. Querying the plane information worked and the struct is filled by the driver. Userspace can figure that there is no plane defined by the guest by looking at the struct fields.
Quoted 6 lines
Quoted 1 line
Cursor support isn't working too.
It seems there is some issue in i915 of version 4.13-rc6, which blocks the cursor on native platform.
I just tried the rc7 (the latest staging), there is on such issue. Thanks.
OK, I'll go re-test with the just-released 4.13 kernel then.
thanks,
Gerd
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx