1. 04 Dec, 2017 6 commits
    • Tina Zhang's avatar
      drm/i915/gvt: Dmabuf support for GVT-g · e546e281
      Tina Zhang authored
      This 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.
      
      v17:
      - modify VFIO_DEVICE_GET_GFX_DMABUF interface. (Alex)
      
      v16:
      - add x_hot and y_hot. (Gerd)
      - add flag validation for VFIO_DEVICE_GET_GFX_DMABUF. (Alex)
      - rebase 4.14.0-rc6.
      
      v15:
      - add VFIO_DEVICE_GET_GFX_DMABUF ABI. (Gerd)
      - add intel_vgpu_dmabuf_cleanup() to clean up the vGPU's dmabuf. (Gerd)
      
      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)
      Signed-off-by: default avatarTina Zhang <tina.zhang@intel.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      e546e281
    • Tina Zhang's avatar
      vfio: ABI for mdev display dma-buf operation · e20eaa23
      Tina Zhang authored
      Add VFIO_DEVICE_QUERY_GFX_PLANE ioctl command to let user query and get
      a plane and its information. So far, two types of buffers are supported:
      buffers based on dma-buf and buffers based on region.
      
      This ioctl can be invoked with:
      1) Either DMABUF or REGION flag. Vendor driver returns a plane_info
      successfully only when the specific kind of buffer is supported.
      2) Flag PROBE. And at the same time either DMABUF or REGION must be set,
      so that vendor driver returns success only when the specific kind of
      buffer is supported.
      
      Add VFIO_DEVICE_GET_GFX_DMABUF ioctl command to let user get a specific
      dma-buf fd of an exposed MDEV buffer provided by dmabuf_id which was
      returned in VFIO_DEVICE_QUERY_GFX_PLANE ioctl command.
      
      The life cycle of an exposed MDEV buffer is handled by userspace and
      tracked by kernel space. The returned dmabuf_id in struct vfio_device_
      query_gfx_plane can be a new id of a new exposed buffer or an old id of
      a re-exported buffer. Host user can check the value of dmabuf_id to see
      if it needs to create new resources according to the new exposed buffer
      or just re-use the existing resource related to the old buffer.
      
      v18:
      - update comments for VFIO_DEVICE_GET_GFX_DMABUF. (Alex)
      
      v17:
      - modify VFIO_DEVICE_GET_GFX_DMABUF interface. (Alex)
      
      v16:
      - add x_hot and y_hot fields. (Gerd)
      - add comments for VFIO_DEVICE_GET_GFX_DMABUF. (Alex)
      - rebase to 4.14.0-rc6.
      
      v15:
      - add a ioctl to get a dmabuf for a given dmabuf id. (Gerd)
      
      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)
      Signed-off-by: default avatarTina Zhang <tina.zhang@intel.com>
      Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
      Acked-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      e20eaa23
    • Tina Zhang's avatar
      drm/i915/gvt: Add framebuffer decoder support · 9f31d106
      Tina Zhang authored
      This patch is to introduce the framebuffer decoder which can decode guest
      OS's framebuffer information, including primary, cursor and sprite plane.
      
      v16:
      - rebase to 4.14.0-rc6.
      
      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: default avatarTina Zhang <tina.zhang@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      9f31d106
    • Tina Zhang's avatar
      drm/i915/gvt: Add opregion support · b851adea
      Tina Zhang authored
      Windows 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. The original
      author of this patch is Xiaoguang Chen.
      
      This patch is split from the "Dma-buf support for GVT-g" patch set,
      with being rebased to the latest gvt-staging branch.
      
      v3:
      - add checking region index during intel_vgpu_rw. (Xiong)
      
      v2:
      - refine intel_vgpu_reg_release_opregion. (Xiong)
      
      Here are the previous version comments:
      
      v18:
      - unmap vgpu's opregion when destroying vgpu.
      
      v16:
      - rebase to 4.14.0-rc6.
      Signed-off-by: default avatarBing Niu <bing.niu@intel.com>
      Signed-off-by: default avatarTina Zhang <tina.zhang@intel.com>
      Tested-by: default avatarXiong Zhang <xiong.y.zhang@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      b851adea
    • Xiong Zhang's avatar
      drm/i915/gvt: Alloc and Init guest opregion at vgpu creation · 4dff110b
      Xiong Zhang authored
      Currently guest opregion is allocated and initialised when guest
      write opregion base register. This is too late for kvmgt, so
      move it to vgpu_create time.
      Signed-off-by: default avatarXiong Zhang <xiong.y.zhang@intel.com>
      Tested-by: default avatarTina Zhang <tina.zhang@intel.com>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      4dff110b
    • Chris Wilson's avatar
      drm/i915/gvt: Fix out-of-bounds buffer write into opregion->signature[] · ea26c96d
      Chris Wilson authored
      sparse spots
      
      drivers/gpu/drm/i915/gvt/opregion.c:234 alloc_and_init_virt_opregion() error: memcpy() 'header->signature' too small (16 vs 17)
      
      as gvt is indeed trying to memcpy a string longer than the signature[].
      
      Fixes: b2d6ef70 ("drm/i915/gvt: Let each vgpu has separate opregion memory")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Xiong Zhang <xiong.y.zhang@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Cc: intel-gvt-dev@lists.freedesktop.org
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      ea26c96d
  2. 21 Nov, 2017 1 commit
    • Chris Wilson's avatar
      drm/i915/gvt: Cleanup unwanted public symbols · 7b302556
      Chris Wilson authored
      drivers/gpu/drm/i915/gvt/execlist.c:531:6: warning: symbol 'clean_execlist' was not declared. Should it be static?
      drivers/gpu/drm/i915/gvt/execlist.c:545:6: warning: symbol 'reset_execlist' was not declared. Should it be static?
      drivers/gpu/drm/i915/gvt/execlist.c:556:5: warning: symbol 'init_execlist' was not declared. Should it be static?
      drivers/gpu/drm/i915/gvt/scheduler.c:248:6: warning: symbol 'release_shadow_wa_ctx' was not declared. Should it be static?
      
      References: 06bb372f ("drm/i915/gvt: Introduce intel_vgpu_reset_submission")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: intel-gvt-dev@lists.freedesktop.org
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      7b302556
  3. 16 Nov, 2017 33 commits