1. 13 8月, 2019 1 次提交
    • G
      drm/i915/gvt: no need to check return value of debugfs_create functions · f8871ec8
      Greg Kroah-Hartman 提交于
      When calling debugfs functions, there is no need to ever check the
      return value.  The function can work or not, but the code logic should
      never do something different based on this.
      
      Because there is no need to check these functions, a number of local
      functions can be made to return void to simplify things as nothing can
      fail.
      
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: intel-gvt-dev@lists.freedesktop.org
      Cc: intel-gfx@lists.freedesktop.org
      Cc: dri-devel@lists.freedesktop.org
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      f8871ec8
  2. 14 6月, 2019 1 次提交
  3. 13 6月, 2019 1 次提交
  4. 27 4月, 2019 1 次提交
  5. 02 4月, 2019 1 次提交
  6. 11 3月, 2019 1 次提交
  7. 18 2月, 2019 1 次提交
  8. 31 1月, 2019 1 次提交
  9. 15 1月, 2019 1 次提交
    • C
      drm/i915: Markup paired operations on wakerefs · 16e4dd03
      Chris Wilson 提交于
      The majority of runtime-pm operations are bounded and scoped within a
      function; these are easy to verify that the wakeref are handled
      correctly. We can employ the compiler to help us, and reduce the number
      of wakerefs tracked when debugging, by passing around cookies provided
      by the various rpm_get functions to their rpm_put counterpart. This
      makes the pairing explicit, and given the required wakeref cookie the
      compiler can verify that we pass an initialised value to the rpm_put
      (quite handy for double checking error paths).
      
      For regular builds, the compiler should be able to eliminate the unused
      local variables and the program growth should be minimal. Fwiw, it came
      out as a net improvement as gcc was able to refactor rpm_get and
      rpm_get_if_in_use together,
      
      v2: Just s/rpm_put/rpm_put_unchecked/ everywhere, leaving the manual
      mark up for smaller more targeted patches.
      v3: Mention the cookie in Returns
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190114142129.24398-2-chris@chris-wilson.co.uk
      16e4dd03
  10. 02 1月, 2019 1 次提交
    • Z
      drm/i915/gvt: Change KVMGT as self load module · 9bdb0734
      Zhenyu Wang 提交于
      This trys to make 'kvmgt' module as self loadable instead of loading
      by i915/gvt device model. So hypervisor specific module could be
      stand-alone, e.g only after loading hypervisor specific module, GVT
      feature could be enabled via specific hypervisor interface, e.g VFIO/mdev.
      
      So this trys to use hypervisor module register/unregister interface
      for that. Hypervisor module needs to take care of module reference
      itself when working for hypervisor interface, e.g for VFIO/mdev,
      hypervisor module would reference counting mdev when open and release.
      
      This makes 'kvmgt' module really split from GVT device model. User
      needs to load 'kvmgt' to enable VFIO/mdev interface.
      
      v6:
      - remove unused variable
      
      v5:
      - put module reference in register error path
      
      v4:
      - fix checkpatch warning
      
      v3:
      - Fix module reference handling for device open and release. Unused
        mdev devices would be cleaned up in device unregister when module unload.
      
      v2:
      - Fix kvmgt order after i915 for built-in case
      
      Cc: "Yuan, Hang" <hang.yuan@intel.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: "He, Min" <min.he@intel.com>
      Reviewed-by: NYuan, Hang <hang.yuan@intel.com>
      Acked-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      9bdb0734
  11. 07 12月, 2018 1 次提交
  12. 13 8月, 2018 1 次提交
  13. 05 7月, 2018 1 次提交
  14. 06 6月, 2018 1 次提交
  15. 18 5月, 2018 2 次提交
    • C
      drm/i915/gvt: Use sched_lock to protect gvt scheduler logic. · 9a512e23
      Colin Xu 提交于
      The scheduler lock(gvt->sched_lock) is used to protect gvt
      scheduler logic, including the gvt scheduler structure(gvt->scheduler
      and per vgpu schedule data(vgpu->sched_data, vgpu->sched_ctl).
      
      v9:
        - Change commit author since the patches are improved a lot compared
          with original version.
          Original author: Pei Zhang <pei.zhang@intel.com>
        - Rebase to latest gvt-staging.
      v8:
        - Correct coding wqstyle.
        - Rebase to latest gvt-staging.
      v7:
        - Remove gtt_lock since already proteced by gvt_lock and vgpu_lock.
      v6:
        - Rebase to latest gvt-staging.
      v5:
        - Rebase to latest gvt-staging.
      v4:
        - Rebase to latest gvt-staging.
      v3: update to latest code base
      Signed-off-by: NPei Zhang <pei.zhang@intel.com>
      Signed-off-by: NColin Xu <colin.xu@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      9a512e23
    • C
      drm/i915/gvt: Use vgpu_lock to protect per vgpu access · f25a49ab
      Colin Xu 提交于
      The patch set splits out 2 small locks from the original big gvt lock:
        - vgpu_lock protects per-vGPU data and logic, especially the vGPU
          trap emulation path.
        - sched_lock protects gvt scheudler structure, context schedule logic
          and vGPU's schedule data.
      
      Use vgpu_lock to replace the gvt big lock. By doing this, the
      mmio read/write trap path, vgpu virtual event emulation and other
      vgpu related process, would be protected under per vgpu_lock.
      
      v9:
        - Change commit author since the patches are improved a lot compared
          with original version.
          Original author: Pei Zhang <pei.zhang@intel.com>
        - Rebase to latest gvt-staging.
      v8:
        - Correct coding and comment style.
        - Rebase to latest gvt-staging.
      v7:
        - Remove gtt_lock since already proteced by gvt_lock and vgpu_lock.
        - Fix a typo in intel_gvt_deactivate_vgpu, unlock the wrong lock.
      v6:
        - Rebase to latest gvt-staging.
      v5:
        - Rebase to latest gvt-staging.
        - intel_vgpu_page_track_handler should use vgpu_lock.
      v4:
        - Rebase to latest gvt-staging.
        - Protect vgpu->active access with vgpu_lock.
        - Do not wait gpu idle in vgpu_lock.
      v3: update to latest code base
      v2: add gvt->lock in function gvt_check_vblank_emulation
      
      Performance comparison on Kabylake platform.
        - Configuration:
          Host: Ubuntu 16.04.
          Guest 1 & 2: Ubuntu 16.04.
      
      glmark2 score comparison:
        - Configuration:
          Host: glxgears.
          Guests: glmark2.
      +--------------------------------+-----------------+
      | Setup                          | glmark2 score   |
      +--------------------------------+-----------------+
      | unified lock, iommu=on         | 58~62 (avg. 60) |
      +--------------------------------+-----------------+
      | unified lock, iommu=igfx_off   | 57~61 (avg. 59) |
      +--------------------------------+-----------------+
      | per-logic lock, iommu=on       | 60~68 (avg. 64) |
      +--------------------------------+-----------------+
      | per-logic lock, iommu=igfx_off | 61~67 (avg. 64) |
      +--------------------------------+-----------------+
      
      lock_stat comparison:
        - Configuration:
          Stop lock stat immediately after boot up.
          Boot 2 VM Guests.
          Run glmark2 in guests.
          Start perf lock_stat for 20 seconds and stop again.
        - Legend: c - contentions; w - waittime-avg
      +------------+-----------------+-----------+---------------+------------+
      |            | gvt_lock        |sched_lock | vgpu_lock     | gtt_lock   |
      + lock type; +-----------------+-----------+---------------+------------+
      | iommu set  | c     | w       | c  | w    | c    | w      | c   | w    |
      +------------+-------+---------+----+------+------+--------+-----+------+
      | unified;   | 20697 | 839     |N/A | N/A  | N/A  | N/A    | N/A | N/A  |
      | on         |       |         |    |      |      |        |     |      |
      +------------+-------+---------+----+------+------+--------+-----+------+
      | unified;   | 21838 | 658.15  |N/A | N/A  | N/A  | N/A    | N/A | N/A  |
      | igfx_off   |       |         |    |      |      |        |     |      |
      +------------+-------+---------+----+------+------+--------+-----+------+
      | per-logic; | 1553  | 1599.96 |9458|429.97| 5846 | 274.33 | 0   | 0.00 |
      | on         |       |         |    |      |      |        |     |      |
      +------------+-------+---------+----+------+------+--------+-----+------+
      | per-logic; | 1911  | 1678.32 |8335|445.16| 5451 | 244.80 | 0   | 0.00 |
      | igfx_off   |       |         |    |      |      |        |     |      |
      +------------+-------+---------+----+------+------+--------+-----+------+
      Signed-off-by: NPei Zhang <pei.zhang@intel.com>
      Signed-off-by: NColin Xu <colin.xu@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      f25a49ab
  16. 14 5月, 2018 1 次提交
  17. 23 4月, 2018 1 次提交
    • Z
      drm/i915/gvt: scan non-privileged batch buffer for debug purpose · 96bebe39
      Zhao Yan 提交于
      For perfomance purpose, scanning of non-privileged batch buffer is turned
      off by default. But for debugging purpose, it can be turned on via debugfs.
      After scanning, we submit the original non-privileged batch buffer into
      hardware, so that the scanning is only a peeking window of guest submitted
      commands and will not affect the execution results.
      
      v4:
      - refine debugfs print format&content (zhenyu wang)
      - print engine id instread of engine name to prevent potential memory leak
        in debugfs warning message. (zhenyu wang)
      
      v3:
      - change vgpu->scan_nonprivbb from type bool to u32, so it is able to
        selectively turn on/off scanning of non-privileged batch buffer on engine
        level. e.g.
        if vgpu->scan_nonprivbb=3, then it will scan non-privileged batch buffer
        on engine 0 and 1.
      - in debugfs interface to set vgpu->scan_nonprivbb, print warning message
        to warn user and explicitly tell state change in kernel log (zhenyu wang)
      v2:
      - rebase
      - update comments for start_gma_offset (henry)
      Signed-off-by: NZhao Yan <yan.y.zhao@intel.com>
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      96bebe39
  18. 06 3月, 2018 5 次提交
    • C
      drm/i915/kvmgt: Add kvmgt debugfs entry nr_cache_entries under vgpu · 6846dfeb
      Changbin Du 提交于
      Add a new debugfs entry kvmgt_nr_cache_entries under vgpu which shows
      the number of entry in dma cache.
      
      $ cat /sys/kernel/debug/gvt/vgpu1/kvmgt_nr_cache_entries
      10101
      
      v3: fix compiling error for some configuration. (Xiong Zhang <xiong.y.zhang@intel.com>)
      v2: keep debugfs layout flat.
      Signed-off-by: NChangbin Du <changbin.du@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      6846dfeb
    • C
      drm/i915/gvt: Fix guest vGPU hang caused by very high dma setup overhead · cf4ee73f
      Changbin Du 提交于
      The implementation of current kvmgt implicitly setup dma mapping at MPT
      API gfn_to_mfn. First this design against the API's original purpose.
      Second, there is no unmap hit in this design. The result is that the
      dma mapping keep growing larger and larger. For mutl-vm case, they will
      consume IOMMU IOVA low 4GB address space quickly and so tons of rbtree
      entries crated in the IOMMU IOVA allocator. Finally, single IOVA
      allocation can take as long as ~70ms. Such latency is intolerable.
      
      To address both above issues, this patch introduced two new MPT API:
        o dma_map_guest_page - setup dma map for guest page
        o dma_unmap_guest_page - cancel dma map for guest page
      
      The kvmgt implements these 2 API. And to reduce dma setup overhead for
      duplicated pages (eg. scratch pages), two caches are used: one is for
      mapping gfn to struct gvt_dma, another is for mapping dma addr to
      struct gvt_dma.
      
      With these 2 new API, the gtt now is able to cancel dma mapping when page
      table is invalidated. The dma mapping is not in a gradual increase now.
      
      v2: follow the old logic for VFIO_IOMMU_NOTIFY_DMA_UNMAP at this point.
      
      Cc: Hang Yuan <hang.yuan@intel.com>
      Cc: Xiong Zhang <xiong.y.zhang@intel.com>
      Signed-off-by: NChangbin Du <changbin.du@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      cf4ee73f
    • Z
      drm/i915/gvt: remove gvt max port definition · 0102d0d9
      Zhenyu Wang 提交于
      Remove GVT-g private max port definition but use i915 one.
      
      Fix error caused by:
      drivers/gpu/drm/i915//gvt/handlers.c:871 dp_aux_ch_ctl_mmio_write() error: buffer overflow 'display->ports' 5 <= 5
      Reviewed-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      0102d0d9
    • W
      drm/i915/gvt: init mmio by lri command in vgpu inhibit context · cd7e61b9
      Weinan Li 提交于
      There is one issue relates to Coarse Power Gating(CPG) on KBL NUC in GVT-g,
      vgpu can't get the correct default context by updating the registers before
      inhibit context submission. It always get back the hardware default value
      unless the inhibit context submission happened before the 1st time
      forcewake put. With this wrong default context, vgpu will run with
      incorrect state and meet unknown issues.
      
      The solution is initialize these mmios by adding lri command in ring buffer
      of the inhibit context, then gpu hardware has no chance to go down RC6 when
      lri commands are right being executed, and then vgpu can get correct
      default context for further use.
      
      v3:
      - fix code fault, use 'for' to loop through mmio render list(Zhenyu)
      
      v4:
      - save the count of engine mmio need to be restored for inhibit context and
        refine some comments. (Kevin)
      
      v5:
      - code rebase
      
      Cc: Kevin Tian <kevin.tian@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NWeinan Li <weinan.z.li@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      cd7e61b9
    • C
      drm/i915/gvt: Provide generic page_track infrastructure for write-protected page · e502a2af
      Changbin Du 提交于
      This patch provide generic page_track infrastructure for write-protected
      guest page. The old page_track logic gets rewrote and now stays in a new
      standalone page_track.c. This page track infrastructure can be both used
      by vGUC and GTT shadowing.
      
      The important change is that it uses radix tree instead of hash table.
      We don't have a predictable number of pages that will be tracked.
      
      Here is some performance data (duration in us) of looking up a element:
      Before: (aka. intel_vgpu_find_tracked_page)
       0.091 0.089 0.090 ... 0.093 0.091 0.087 ... 0.292 0.285 0.292 0.291
      After: (aka. intel_vgpu_find_page_track)
       0.104 0.105 0.100 0.102 0.102 0.100 ... 0.101 0.101 0.105 0.105
      
      The hash table has good performance at beginning, but turns bad with
      more pages being tracked even no 3D applications are running. As
      expected, radix tree has stable duration and very quick.
      
      The overall benchmark (tested with Heaven Benchmark) marginally improved
      since this is not the bottleneck. What we benefit more from this change
      is scalability.
      Signed-off-by: NChangbin Du <changbin.du@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      e502a2af
  19. 07 2月, 2018 3 次提交
  20. 22 12月, 2017 2 次提交
  21. 12 12月, 2017 1 次提交
  22. 08 12月, 2017 2 次提交
  23. 04 12月, 2017 4 次提交
    • T
      drm/i915/gvt: Dmabuf support for GVT-g · e546e281
      Tina Zhang 提交于
      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: NTina 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: NZhenyu Wang <zhenyuw@linux.intel.com>
      e546e281
    • T
      drm/i915/gvt: Add framebuffer decoder support · 9f31d106
      Tina Zhang 提交于
      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: NTina Zhang <tina.zhang@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      9f31d106
    • T
      drm/i915/gvt: Add opregion support · b851adea
      Tina Zhang 提交于
      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: NBing Niu <bing.niu@intel.com>
      Signed-off-by: NTina Zhang <tina.zhang@intel.com>
      Tested-by: NXiong Zhang <xiong.y.zhang@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      b851adea
    • X
      drm/i915/gvt: Alloc and Init guest opregion at vgpu creation · 4dff110b
      Xiong Zhang 提交于
      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: NXiong Zhang <xiong.y.zhang@intel.com>
      Tested-by: NTina Zhang <tina.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      4dff110b
  24. 16 11月, 2017 5 次提交