drm/i915/gvt: Dma-buf support for GVT-g
v3 cover drm/i915/gvt: Dma-buf support for GVT-g
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 render or other operations.
User need to create a fd(for intel GVT-g dma-buf support it is a:dma-buf management fd) then user can use this fd to query the plane information or create a dma-buf. The life cycle of this fd is managed by GVT-g user do not need to care about that.
We have an example program on how to use the dma-buf. You can download the program to have a try. Good luck :)
git repo: https://github.com/01org/igvtg-qemu branch:kvmgt_dmabuf_example
Xiaoguang Chen (5):
drm/i915/gvt: Extend the GVT-g architecture to support vfio device
region
drm/i915/gvt: OpRegion support for GVT-g
drm/i915/gvt: Frame buffer decoder support for GVT-g drm/i915/gvt: Dmabuf support for GVT-g
drm/i915/gvt: Adding interface so user space can get the dma-buf
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 | 276 +++++++++++++++++++ drivers/gpu/drm/i915/gvt/dmabuf.h | 32 +++ drivers/gpu/drm/i915/gvt/fb_decoder.c | 487 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/fb_decoder.h | 170 ++++++++++++ drivers/gpu/drm/i915/gvt/gvt.c | 2 + drivers/gpu/drm/i915/gvt/gvt.h | 7 + drivers/gpu/drm/i915/gvt/kvmgt.c | 205 +++++++++++++- drivers/gpu/drm/i915/gvt/opregion.c | 8 +- drivers/gpu/drm/i915/i915_gem.c | 8 + drivers/gpu/drm/i915/i915_gem_object.h | 3 + include/uapi/linux/vfio.h | 36 +++ 14 files changed, 1235 insertions(+), 6 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 v3 1/5 drm/i915/gvt: Extend the GVT-g architecture to support vfio device region
--- drivers/gpu/drm/i915/gvt/kvmgt.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gvt/kvmgt.c +18 -3
@@ -53,11 +53,21 @@ static const struct intel_gvt_ops *intel_gvt_ops;#define VFIO_PCI_INDEX_TO_OFFSET (index) ((u64)(index) << VFIO_PCI_OFFSET_SHIFT)#define VFIO_PCI_OFFSET_MASK (((u64)(1) << VFIO_PCI_OFFSET_SHIFT) - 1) +struct vfio_region ; +struct intel_vgpu_regops { +size_t (*rw)(struct intel_vgpu *vgpu,char *buf, +size_t count,loff_t *ppos,bool iswrite); +void (*release)(struct intel_vgpu *vgpu, +struct vfio_region *region); +}; +struct vfio_region {u32 type;u32 subtype;size_t size;u32 flags; +const struct intel_vgpu_regops *ops; +void *data; };struct kvmgt_pgfn {
@@ -642,7 +652,7 @@ static ssize_t intel_vgpu_rw(struct mdev_device *mdev, char *buf,int ret = -EINVAL ; -if (index >=VFIO_PCI_NUM_REGIONS ) { +if (index >=VFIO_PCI_NUM_REGIONS + vgpu->vdev.num_regions) {gvt_vgpu_err ("invalid index: %u\n" , index);return -EINVAL ; }
@@ -676,8 +686,11 @@ static ssize_t intel_vgpu_rw(struct mdev_device *mdev, char *buf,case VFIO_PCI_BAR5_REGION_INDEX :case VFIO_PCI_VGA_REGION_INDEX :case VFIO_PCI_ROM_REGION_INDEX : +break ;default : -gvt_vgpu_err ("unsupported region: %u\n" , index); + index -=VFIO_PCI_NUM_REGIONS ; +return vgpu->vdev.region[index].ops->rw (vgpu, buf, count, + ppos, is_write); }return ret ==0 ? count : ret;
@@ -940,7 +953,8 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd, info.flags =VFIO_DEVICE_FLAGS_PCI ; info.flags |=VFIO_DEVICE_FLAGS_RESET ; - info.num_regions =VFIO_PCI_NUM_REGIONS ; + info.num_regions =VFIO_PCI_NUM_REGIONS + + vgpu->vdev.num_regions; info.num_irqs =VFIO_PCI_NUM_IRQS ; return copy_to_user((void __user *)arg, &info, minsz) ?
@@ -1061,6 +1075,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd, }if (caps.size) { + info.flags |=VFIO_REGION_INFO_FLAG_CAPS ;if (info.argsz <sizeof (info) + caps.size) { info.argsz =sizeof (info) + caps.size; info.cap_offset =0 ;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 2/5 drm/i915/gvt: OpRegion support for GVT-g
In reply to Xiaoguang ChenOpRegion is needed to support display related operation for intel vgpu.
A vfio device region is added to intel vgpu to deliver the host OpRegion information to user space so user space can construct the OpRegion for vgpu.
--- drivers/gpu/drm/i915/gvt/kvmgt.c | 97 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/opregion.c | 8 ++- 2 files changed, 104 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/kvmgt.c +97 -0
@@ -53,6 +53,8 @@ static const struct intel_gvt_ops *intel_gvt_ops;#define VFIO_PCI_INDEX_TO_OFFSET (index) ((u64)(index) << VFIO_PCI_OFFSET_SHIFT)#define VFIO_PCI_OFFSET_MASK (((u64)(1) << VFIO_PCI_OFFSET_SHIFT) - 1) +#define OPREGION_SIGNATURE "IntelGraphicsMem" +struct vfio_region ;struct intel_vgpu_regops { size_t (*rw)(struct intel_vgpu *vgpu, char *buf,
@@ -436,6 +438,92 @@ static void kvmgt_protect_table_del(struct kvmgt_guest_info *info, } } +static size_t intel_vgpu_reg_rw_opregion (struct intel_vgpu *vgpu,char *buf, +size_t count,loff_t *ppos,bool iswrite) +{ +unsigned int i =VFIO_PCI_OFFSET_TO_INDEX (*ppos) - +VFIO_PCI_NUM_REGIONS ; +void *base = vgpu->vdev.region[i].data; +loff_t pos = *ppos &VFIO_PCI_OFFSET_MASK ; + +if (pos >= vgpu->vdev.region[i].size || iswrite) { +gvt_vgpu_err ("invalid op or offset for Intel vgpu OpRegion\n" ); +return -EINVAL ; + } + count =min (count, (size_t )(vgpu->vdev.region[i].size - pos)); +memcpy (buf, base + pos, count); + +return count; +} + +static void intel_vgpu_reg_release_opregion (struct intel_vgpu *vgpu, +struct vfio_region *region) +{ +memunmap (region->data); +} + +static const struct intel_vgpu_regops intel_vgpu_regops_opregion = { + .rw = intel_vgpu_reg_rw_opregion, + .release = intel_vgpu_reg_release_opregion, +}; + +static int intel_vgpu_register_reg (struct intel_vgpu *vgpu, +unsigned int type,unsigned int subtype, +const struct intel_vgpu_regops *ops, +size_t size,u32 flags,void *data) +{ +struct vfio_region *region; + + region =krealloc (vgpu->vdev.region, + (vgpu->vdev.num_regions +1 ) *sizeof (*region), +GFP_KERNEL ); +if (!region) +return -ENOMEM ; + + vgpu->vdev.region = region; + vgpu->vdev.region[vgpu->vdev.num_regions].type = type; + vgpu->vdev.region[vgpu->vdev.num_regions].subtype = subtype; + vgpu->vdev.region[vgpu->vdev.num_regions].ops = ops; + vgpu->vdev.region[vgpu->vdev.num_regions].size = size; + vgpu->vdev.region[vgpu->vdev.num_regions].flags = flags; + vgpu->vdev.region[vgpu->vdev.num_regions].data = data; + vgpu->vdev.num_regions++; + +return 0 ; +} + +static int intel_vgpu_reg_init_opregion (struct intel_vgpu *vgpu) +{ +unsigned int addr; +void *base; +int ret; + + addr = vgpu->gvt->opregion.opregion_pa; +if (!addr || !(~addr)) +return -ENODEV ; + + base =memremap (addr,OPREGION_SIZE ,MEMREMAP_WB ); +if (!base) +return -ENOMEM ; + +if (memcmp (base,OPREGION_SIGNATURE ,16 )) { +memunmap (base); +return -EINVAL ; + } + + ret =intel_vgpu_register_reg (vgpu, +PCI_VENDOR_ID_INTEL |VFIO_REGION_TYPE_PCI_VENDOR_TYPE , +VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION , + &intel_vgpu_regops_opregion,OPREGION_SIZE , +VFIO_REGION_INFO_FLAG_READ , base); +if (ret) { +memunmap (base); +return ret; + } + +return ret; +} +static int intel_vgpu_create (struct kobject *kobj,struct mdev_device *mdev) {struct intel_vgpu *vgpu =NULL ;
@@ -467,6 +555,15 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) vgpu->vdev.mdev = mdev;mdev_set_drvdata (mdev, vgpu); + ret =intel_vgpu_reg_init_opregion (vgpu); +if (ret) { +gvt_vgpu_err ("create OpRegion failed\n" ); + goto out; + } + +gvt_dbg_core ("create OpRegion succeeded for mdev:%s\n" , +dev_name (mdev_dev (mdev))); +gvt_dbg_core ("intel_vgpu_create succeeded for mdev: %s\n" ,dev_name (mdev_dev (mdev))); ret =0 ;
drivers/gpu/drm/i915/gvt/opregion.c +7 -1
@@ -114,6 +114,7 @@ void intel_vgpu_clean_opregion(struct intel_vgpu *vgpu)int intel_vgpu_init_opregion (struct intel_vgpu *vgpu,u32 gpa) {int ret; +unsigned long pfn;gvt_dbg_core ("vgpu%d: init vgpu opregion\n" , vgpu->id);
@@ -127,7 +128,12 @@ int intel_vgpu_init_opregion(struct intel_vgpu *vgpu, u32 gpa) ret =map_vgpu_opregion (vgpu, true);if (ret)return ret; - } + }else { + 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 ); + }return 0 ; }
Signature · 1 line
2.7.4
PATCH v3 3/5 drm/i915/gvt: Frame buffer decoder support for GVT-g
In reply to Xiaoguang Chendecode frambuffer attributes of primary, cursor and sprite plane
--- 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/fb_decoder.c | 487 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/fb_decoder.h | 170 ++++++++++++ drivers/gpu/drm/i915/gvt/gvt.h | 1 + 6 files changed, 663 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.c create mode 100644 drivers/gpu/drm/i915/gvt/fb_decoder.h
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) -Wall 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 +487 -0
487 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/fb_decoder.h new file +170 -0
170 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
PATCH v3 4/5 drm/i915/gvt: Dmabuf support for GVT-g
In reply to Xiaoguang Chendmabuf for GVT-g can be exported to users who can use the dmabuf to show the desktop of vm which use intel vgpu.
Currently we provide query and create new dmabuf operations.
Users of dmabuf can cache some created dmabufs and related information such as the framebuffer's address, size, tiling mode, width, height etc. When refresh the screen first query the currnet vgpu's frambuffer and compare with the cached ones(address, size, tiling, width, height etc) if found one then reuse the found dmabuf to gain performance improvment.
If there is no dmabuf created yet or not found in the cached dmabufs then need to create a new dmabuf. To create a dmabuf first a gem object will be created and the backing storage of this gem object is the vgpu's framebuffer(primary/cursor). Then associate this gem object to a dmabuf and export this dmabuf. A file descriptor will be generated for this dmabuf and this file descriptor can be sent to user space to do display.
--- drivers/gpu/drm/i915/gvt/Makefile | 2 +- drivers/gpu/drm/i915/gvt/dmabuf.c | 275 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/dmabuf.h | 54 +++++++ drivers/gpu/drm/i915/gvt/gvt.h | 3 + drivers/gpu/drm/i915/i915_gem.c | 8 + drivers/gpu/drm/i915/i915_gem_object.h | 3 + 6 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.c create mode 100644 drivers/gpu/drm/i915/gvt/dmabuf.h
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) -Wall i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
drivers/gpu/drm/i915/gvt/dmabuf.c new file +275 -0
275 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/dmabuf.h new file +54 -0
54 lines not on this page · raw message
drivers/gpu/drm/i915/gvt/gvt.h +3 -0
@@ -47,6 +47,7 @@#include "render.h" #include "cmd_parser.h" #include "fb_decoder.h" +#include "dmabuf.h" #define GVT_MAX_VGPU 8
@@ -186,6 +187,8 @@ struct intel_vgpu {atomic_t released; } vdev;#endif +struct intel_vgpu_plane_info *plane_info; +struct drm_i915_gem_object *obj_dmabuf; }; struct intel_gvt_gm {
drivers/gpu/drm/i915/i915_gem.c +8 -0
@@ -1609,6 +1609,10 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,if (!obj)return -ENOENT ; +/* The obj is a gvt dma-buf object and set domain is not supported */ +if (obj->ops->flags &I915_GEM_OBJECT_IS_GVT_DMABUF ) +return -EPERM ; +/* Try to flush the object off the GPU without holding the lock. * We will repeat the flush holding the lock in the normal manner * to catch cases where we are gazumped.
@@ -3717,6 +3721,10 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data,if (!obj)return -ENOENT ; +/* the obj is a gvt dma-buf and set caching mode is not supported */ +if (obj->ops->flags &I915_GEM_OBJECT_IS_GVT_DMABUF ) +return -EPERM ; +if (obj->cache_level == level) goto out;
drivers/gpu/drm/i915/i915_gem_object.h +3 -0
@@ -39,6 +39,7 @@ struct drm_i915_gem_object_ops {unsigned int flags;#define I915_GEM_OBJECT_HAS_STRUCT_PAGE 0x1#define I915_GEM_OBJECT_IS_SHRINKABLE 0x2 +#define I915_GEM_OBJECT_IS_GVT_DMABUF 0x3/* Interface between the GEM object and its backing storage. * get_pages() is called once prior to the use of the associated set
@@ -184,6 +185,8 @@ struct drm_i915_gem_object { } userptr;unsigned long scratch; + +void *gvt_plane_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
PATCH v3 5/5 drm/i915/gvt: Adding interface so user space can get the dma-buf
In reply to Xiaoguang ChenUser space will try to create a management fd for the dma-buf operation. Using this management fd user can query the plane information and create a dma-buf fd if necessary.
GVT-g will handle the life cycle of the management fd and will align the life cycle of the fd with the vfio device.
User space should handle the life cycle of the created dma-buf fd close the dma-buf fd timely when finishing use.
--- drivers/gpu/drm/i915/gvt/dmabuf.c | 23 ++++++----- drivers/gpu/drm/i915/gvt/dmabuf.h | 22 ---------- drivers/gpu/drm/i915/gvt/gvt.c | 2 + drivers/gpu/drm/i915/gvt/gvt.h | 3 ++ drivers/gpu/drm/i915/gvt/kvmgt.c | 87 +++++++++++++++++++++++++++++++++++++++ include/uapi/linux/vfio.h | 36 ++++++++++++++++ 6 files changed, 140 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/gvt/dmabuf.c +12 -11
@@ -29,6 +29,7 @@#include <linux/dma-buf.h> #include <drm/drmP.h> +#include <linux/vfio.h> #include "i915_drv.h" #include "gvt.h"
@@ -45,9 +46,9 @@ static struct sg_table *intel_vgpu_gem_get_pages(int i, ret;gen8_pte_t __iomem *gtt_entries;unsigned int fb_gma =0 , fb_size =0 ; -struct intel_vgpu_plane_info *plane_info; +struct plane_info *plane_info; - plane_info = (struct intel_vgpu_plane_info *)obj->gvt_plane_info; + plane_info = (struct plane_info *)obj->gvt_plane_info;if (WARN_ON (!plane_info))return ERR_PTR (-EINVAL );
@@ -81,9 +82,9 @@ static struct sg_table *intel_vgpu_gem_get_pages(static void intel_vgpu_gem_put_pages (struct drm_i915_gem_object *obj,struct sg_table *pages) { -struct intel_vgpu_plane_info *plane_info; +struct plane_info *plane_info; - plane_info = (struct intel_vgpu_plane_info *)obj->gvt_plane_info; + plane_info = (struct plane_info *)obj->gvt_plane_info;if (WARN_ON (!plane_info))return ;
@@ -98,7 +99,7 @@ static const struct drm_i915_gem_object_ops intel_vgpu_gem_ops = { };static struct drm_i915_gem_object *intel_vgpu_create_gem (struct drm_device *dev, -struct intel_vgpu_plane_info *info) +struct plane_info *info) {struct drm_i915_private *pri = dev->dev_private;struct drm_i915_gem_object *obj;
@@ -141,14 +142,14 @@ static struct drm_i915_gem_object *intel_vgpu_create_gem(struct drm_device *dev,return obj; } -static struct intel_vgpu_plane_info *intel_vgpu_get_plane_info ( +static struct plane_info *intel_vgpu_get_plane_info (struct drm_device *dev,struct intel_vgpu *vgpu,int plane_id) {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_vgpu_primary_plane_format *p;struct intel_vgpu_cursor_plane_format *c; -struct intel_vgpu_plane_info *info; +struct plane_info *info; info =kmalloc (sizeof (*info),GFP_KERNEL );if (!info)
@@ -225,8 +226,8 @@ static struct intel_vgpu_plane_info *intel_vgpu_get_plane_info(int intel_vgpu_query_dmabuf (struct intel_vgpu *vgpu,void *args) {struct drm_device *dev = &vgpu->gvt->dev_priv->drm; -struct intel_vgpu_dmabuf *gvt_dmabuf = args; -struct intel_vgpu_plane_info *info; +struct dmabuf_info *gvt_dmabuf = args; +struct plane_info *info; info =intel_vgpu_get_plane_info (dev, vgpu, gvt_dmabuf->plane_id);if (info ==NULL )
@@ -242,8 +243,8 @@ int intel_vgpu_create_dmabuf(struct intel_vgpu *vgpu, void *args)struct dma_buf *dmabuf;struct drm_i915_gem_object *obj;struct drm_device *dev = &vgpu->gvt->dev_priv->drm; -struct intel_vgpu_dmabuf *gvt_dmabuf = args; -struct intel_vgpu_plane_info *info; +struct dmabuf_info *gvt_dmabuf = args; +struct plane_info *info;int ret; info =intel_vgpu_get_plane_info (dev, vgpu, gvt_dmabuf->plane_id);
drivers/gpu/drm/i915/gvt/dmabuf.h +0 -22
@@ -26,28 +26,6 @@#ifndef _GVT_DMABUF_H_#define _GVT_DMABUF_H_ -struct intel_vgpu_plane_info { -uint32_t drm_format; -uint32_t width; -uint32_t height; -uint32_t stride; -uint32_t start; -uint32_t x_pos; -uint32_t y_pos; -uint32_t size; -uint64_t drm_format_mod; -}; - -#define INTEL_VGPU_QUERY_DMABUF 0 -#define INTEL_VGPU_GENERATE_DMABUF 1 - -struct intel_vgpu_dmabuf { -uint32_t plane_id; -/* out */ -uint32_t fd; -struct intel_vgpu_plane_info plane_info; -}; -int intel_vgpu_query_dmabuf (struct intel_vgpu *vgpu,void *args);int intel_vgpu_create_dmabuf (struct intel_vgpu *vgpu,void *args);
drivers/gpu/drm/i915/gvt/gvt.c +2 -0
@@ -54,6 +54,8 @@ 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_dmabuf = intel_vgpu_query_dmabuf, + .vgpu_create_dmabuf = intel_vgpu_create_dmabuf, };/**
drivers/gpu/drm/i915/gvt/gvt.h +3 -0
@@ -185,6 +185,7 @@ struct intel_vgpu {struct kvm *kvm;struct work_struct release_work;atomic_t released; + struct vfio_device *vfio_device; } vdev;#endif struct intel_vgpu_plane_info *plane_info;
@@ -469,6 +470,8 @@ 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_dmabuf)(struct intel_vgpu *,void *); +int (*vgpu_create_dmabuf)(struct intel_vgpu *,void *); };
drivers/gpu/drm/i915/gvt/kvmgt.c +87 -0
105 lines not on this page · raw message
include/uapi/linux/vfio.h +36 -0
@@ -502,6 +502,42 @@ struct vfio_pci_hot_reset {#define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) +/** +* VFIO_DEVICE_GET_FD - _IO(VFIO_TYPE, VFIO_BASE + 14, __u32) +* +* Create a fd for a vfio device based on the input type +* Vendor driver should handle this ioctl to create a fd and manage the +* life cycle of this fd. +* +* Return: a fd if vendor support that type, -errno if not supported +*/ + +struct plane_info { +__u32 drm_format; +__u32 width; +__u32 height; +__u32 stride; +__u32 start; +__u32 x_pos; +__u32 y_pos; +__u32 size; +__u64 drm_format_mod; +}; + +struct dmabuf_info { +__u32 plane_id; +/* out */ +__u32 fd; +struct plane_info plane_info; +}; + +#define VFIO_DEVICE_QUERY_DMABUF 0 +#define VFIO_DEVICE_CREATE_DMABUF 1 + +#define VFIO_DEVICE_DMABUF_MGR_FD 0 + +#define VFIO_DEVICE_GET_FD _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
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915/gvt: dma-buf support for GVT-g (rev3)
In reply to Xiaoguang Chen== Series Details ==
== Series Details ==
Series: drm/i915/gvt: dma-buf support for GVT-g (rev3)
URL : https://patchwork.freedesktop.org/series/23686/
State : failure
== Summary ==
Series 23686v3 drm/i915/gvt: dma-buf support for GVT-g
https://patchwork.freedesktop.org/api/1.0/series/23686/revisions/3/mbox/
Test gem_busy:
Subgroup basic-busy-default:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700hq)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
Subgroup basic-hang-default:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700hq)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
Test gem_cpu_reloc:
Subgroup basic:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700hq)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
Test gem_cs_tlb:
Subgroup basic-default:
pass -> FAIL (fi-ilk-650)
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)
pass -> FAIL (fi-skl-6700hq)
pass -> FAIL (fi-skl-6700k)
pass -> FAIL (fi-skl-6770hq)
pass -> FAIL (fi-skl-gvtdvm)
pass -> FAIL (fi-bxt-j4205)
pass -> FAIL (fi-kbl-7500u)
Test gem_exec_basic:
Subgroup gtt-blt:
pass -> FAIL (fi-snb-2520m)
pass -> FAIL (fi-snb-2600)
pass -> FAIL (fi-ivb-3520m)
pass -> FAIL (fi-ivb-3770)
pass -> FAIL (fi-byt-j1900)
pass -> FAIL (fi-byt-n2820)
pass -> FAIL (fi-hsw-4770)
pass -> FAIL (fi-hsw-4770r)
pass -> FAIL (fi-bdw-5557u)
pass -> FAIL (fi-bdw-gvtdvm)
pass -> FAIL (fi-bsw-n3050)
pass -> FAIL (fi-skl-6260u)WARNING: Long output truncated
ec077216f6939248d037dc27dc6e0b56f7121d2b drm-tip: 2017y-05m-22d-10h-46m-27s UTC integration manifest f15e9ba drm/i915/gvt: Adding interface so user space can get the dma-buf
76cb609 drm/i915/gvt: Dmabuf support for GVT-g
b190f38 drm/i915/gvt: Frame buffer decoder support for GVT-g
dfd8b0b drm/i915/gvt: OpRegion support for GVT-g
6e781ce drm/i915/gvt: Extend the GVT-g architecture to support vfio device region
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4768/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx