1. 09 1月, 2019 1 次提交
    • Z
      drm/i915/gvt: Fix workload request allocation before request add · f0e99437
      Zhenyu Wang 提交于
      In commit 6bb2a2af ("drm/i915/gvt: Fix crash after request->hw_context change"),
      forgot to handle workload scan path in ELSP handler case which was to
      optimize scanning earlier instead of in gvt submission thread, so request
      alloc and add was splitting then which is against right process.
      
      This trys to do a partial revert of that commit which still has workload
      request alloc helper and make sure shadow state population is handled after
      request alloc for target state buffer.
      
      v3: Fix missed workload status setting in request alloc error path
      v2: Fix dispatch workload err path that should add request after alloc anyway.
      
      Fixes: 6bb2a2af ("drm/i915/gvt: Fix crash after request->hw_context change")
      Cc: Bin Yang <bin.yang@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Tested-by: NBin Yang <bin.yang@intel.com>
      Reviewed-by: NXiaolin Zhang <xiaolin.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      f0e99437
  2. 13 8月, 2018 1 次提交
  3. 18 5月, 2018 1 次提交
  4. 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
  5. 15 3月, 2018 1 次提交
    • F
      drm/i915/gvt: Correct the privilege shadow batch buffer address · ef75c685
      fred gao 提交于
      Once the ring buffer is copied to ring_scan_buffer and scanned,
      the shadow batch buffer start address is only updated into
      ring_scan_buffer, not the real ring address allocated through
      intel_ring_begin in later copy_workload_to_ring_buffer.
      
      This patch is only to set the right shadow batch buffer address
      from Ring buffer, not include the shadow_wa_ctx.
      
      v2:
      - refine some comments. (Zhenyu)
      v3:
      - fix typo in title. (Zhenyu)
      v4:
      - remove the unnecessary comments. (Zhenyu)
      - add comments in bb_start_cmd_va update. (Zhenyu)
      
      Fixes: 0a53bc07 ("drm/i915/gvt: Separate cmd scan from request allocation")
      Cc: stable@vger.kernel.org  # v4.15
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Yulei Zhang <yulei.zhang@intel.com>
      Signed-off-by: Nfred gao <fred.gao@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      ef75c685
  6. 09 3月, 2018 1 次提交
  7. 22 2月, 2018 1 次提交
  8. 07 2月, 2018 1 次提交
  9. 04 12月, 2017 1 次提交
  10. 28 11月, 2017 1 次提交
  11. 16 11月, 2017 8 次提交
  12. 27 10月, 2017 1 次提交
  13. 08 9月, 2017 1 次提交
    • F
      drm/i915/gvt: Add error handling for intel_gvt_scan_and_shadow_workload · a3cfdca9
      fred gao 提交于
      When an error occurs after shadow_indirect_ctx, this patch is to do the
      proper cleanup and rollback to the original states for shadowed indirect
      context before the workload is abandoned.
      
      v2:
      - split the mixed several error paths for better review. (Zhenyu)
      
      v3:
      - no return check for clean up functions. (Changbin)
      
      v4:
      - expose and reuse the existing release_shadow_wa_ctx. (Zhenyu)
      
      v5:
      - move the release function to scheduler.c file. (Zhenyu)
      
      v6:
      - move error handling code of intel_gvt_scan_and_shadow_workload
        to here. (Zhenyu)
      Signed-off-by: Nfred gao <fred.gao@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      a3cfdca9
  14. 10 8月, 2017 1 次提交
  15. 08 6月, 2017 1 次提交
    • C
      drm/i915/gvt: implement per-vm mmio switching optimization · 0e86cc9c
      Changbin Du 提交于
      Commit ab9da627906a ("drm/i915: make context status notifier head be
      per engine") gives us a chance to inspect every single request. Then
      we can eliminate unnecessary mmio switching for same vGPU. We only
      need mmio switching for different VMs (including host).
      
      This patch introduced a new general API intel_gvt_switch_mmio() to
      replace the old intel_gvt_load/restore_render_mmio(). This function
      can be further optimized for vGPU to vGPU switching.
      
      To support individual ring switch, we track the owner who occupy
      each ring. When another VM or host request a ring we do the mmio
      context switching. Otherwise no need to switch the ring.
      
      This optimization is very useful if only one guest has plenty of
      workloads and the host is mostly idle. The best case is no mmio
      switching will happen.
      
      v2:
        o fix missing ring switch issue. (chuanxiao)
        o support individual ring switch.
      Signed-off-by: NChangbin Du <changbin.du@intel.com>
      Reviewed-by: NChuanxiao Dong <chuanxiao.dong@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      0e86cc9c
  16. 29 3月, 2017 1 次提交
  17. 17 1月, 2017 1 次提交
  18. 14 10月, 2016 10 次提交
    • Z
      drm/i915/gvt: vGPU command scanner · be1da707
      Zhi Wang 提交于
      This patch introduces a command scanner to scan guest command buffers.
      Signed-off-by: NYulei Zhang <yulei.zhang@intel.com>
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      be1da707
    • Z
      drm/i915/gvt: vGPU schedule policy framework · 4b63960e
      Zhi Wang 提交于
      This patch introduces a vGPU schedule policy framework, with a timer based
      schedule policy module for now
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      4b63960e
    • Z
      drm/i915/gvt: vGPU workload scheduler · e4734057
      Zhi Wang 提交于
      This patch introduces the vGPU workload scheduler routines.
      
      GVT workload scheduler is responsible for picking and executing GVT workload
      from current scheduled vGPU. Before the workload is submitted to host i915,
      the guest execlist context will be shadowed in the host GVT shadow context.
      the instructions in guest ring buffer will be copied into GVT shadow ring
      buffer. Then GVT-g workload scheduler will scan the instructions in guest
      ring buffer and submit it to host i915.
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      e4734057
    • Z
      drm/i915/gvt: vGPU workload submission · 28c4c6ca
      Zhi Wang 提交于
      This patch introduces the vGPU workload submission logics.
      
      Under virtualization environment, guest will submit workload through
      virtual execlist submit port. The submitted workload load will be wrapped
      into an gvt workload which will be picked by GVT workload scheduler and
      executed on host i915 later.
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      28c4c6ca
    • Z
      drm/i915/gvt: vGPU execlist virtualization · 8453d674
      Zhi Wang 提交于
      This patch introduces the vGPU execlist virtualization.
      
      Under virtulization environment, HW execlist interface are fully emulated
      including virtual CSB emulation, virtual execlist emulation. The framework
      will emulate the virtual CSB according to the guest workload running status
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      8453d674
    • Z
      drm/i915/gvt: vGPU display virtualization · 04d348ae
      Zhi Wang 提交于
      This patch introduces the GVT-g display virtualization.
      
      It consists a collection of display MMIO handlers, like power well register
      handler, pipe register handler, plane register handler, which will emulate
      all display MMIOs behavior to support virtual mode setting sequence for
      guest.
      Signed-off-by: NBing Niu <bing.niu@intel.com>
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      04d348ae
    • Z
      drm/i915/gvt: vGPU MMIO virtualization · e39c5add
      Zhi Wang 提交于
      This patch introduces the generic vGPU MMIO emulation intercept
      framework.  The MPT modules will request GVT-g core logic to
      emulate MMIO read/write through IO emulation operations
      callback when hypervisor trapped a guest GTTMMIO read/write.
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      e39c5add
    • Z
      drm/i915/gvt: vGPU graphics memory virtualization · 2707e444
      Zhi Wang 提交于
      The vGPU graphics memory emulation framework is responsible for graphics
      memory table virtualization. Under virtualization environment, a VM will
      populate the page table entry with guest page frame number(GPFN/GFN), while
      HW needs a page table filled with MFN(Machine frame number). The
      relationship between GFN and MFN(Machine frame number) is managed by
      hypervisor, while GEN HW doesn't have such knowledge to translate a GFN.
      
      To solve this gap, shadow GGTT/PPGTT page table is introdcued.
      
      For GGTT, the GFN inside the guest GGTT page table entry will be translated
      into MFN and written into physical GTT MMIO registers when guest write
      virtual GTT MMIO registers.
      
      For PPGTT, a shadow PPGTT page table will be created and write-protected
      translated from guest PPGTT page table.  And the shadow page table root
      pointers will be written into the shadow context after a guest workload
      is shadowed.
      
      vGPU graphics memory emulation framework consists:
      
      - Per-GEN HW platform page table entry bits extract/de-extract routines.
      - GTT MMIO register emulation handlers, which will call hypercall to do
      GFN->MFN translation when guest write GTT MMIO register
      - PPGTT shadow page table routines, e.g. shadow create/destroy/out-of-sync
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      2707e444
    • Z
      drm/i915/gvt: vGPU interrupt virtualization. · c8fe6a68
      Zhi Wang 提交于
      This patch introduces vGPU interrupt emulation framework.
      
      The vGPU intrerrupt emulation framework is an event-based interrupt
      emulation framework. It's responsible for emulating GEN hardware interrupts
      during emulating other HW behaviour.
      
      It consists several components:
      
      - Descriptions of interrupt register bit
      - Upper level <-> lower level interrupt mapping
      - GEN HW IER/IMR/IIR register emulation routines
      - Event-based interrupt propagation interface
      
      When a GVT-g component wants to inject an interrupt to a VM during a
      emulation, first it should specify the event needs to be emulated and the
      framework will deal with the rest of emulation:
      
      - Generating related virtual IIR bit according to virtual IER and IMRs,
      - Generate related virtual upper level virtual IIR bit accodring to the
      per-platform interrupt mapping
      - Injecting a MSI to VM
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      c8fe6a68
    • Z
      drm/i915/gvt: vGPU HW resource management · 28a60dee
      Zhi Wang 提交于
      This patch introduces the GVT-g vGPU HW resource management. Under
      GVT-g virtualizaion environment, each vGPU requires portions HW
      resources, including aperture, hidden GM space, and fence registers.
      
      When creating a vGPU, GVT-g will request these HW resources from host,
      and return them to host after a vGPU is destroyed.
      Signed-off-by: NZhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      28a60dee
  19. 18 6月, 2016 3 次提交
  20. 11 5月, 2016 1 次提交
  21. 18 11月, 2015 2 次提交
    • V
      drm/i915: Type safe register read/write · f0f59a00
      Ville Syrjälä 提交于
      Make I915_READ and I915_WRITE more type safe by wrapping the register
      offset in a struct. This should eliminate most of the fumbles we've had
      with misplaced parens.
      
      This only takes care of normal mmio registers. We could extend the idea
      to other register types and define each with its own struct. That way
      you wouldn't be able to accidentally pass the wrong thing to a specific
      register access function.
      
      The gpio_reg setup is probably the ugliest thing left. But I figure I'd
      just leave it for now, and wait for some divine inspiration to strike
      before making it nice.
      
      As for the generated code, it's actually a bit better sometimes. Eg.
      looking at i915_irq_handler(), we can see the following change:
        lea    0x70024(%rdx,%rax,1),%r9d
        mov    $0x1,%edx
      - movslq %r9d,%r9
      - mov    %r9,%rsi
      - mov    %r9,-0x58(%rbp)
      - callq  *0xd8(%rbx)
      + mov    %r9d,%esi
      + mov    %r9d,-0x48(%rbp)
       callq  *0xd8(%rbx)
      
      So previously gcc thought the register offset might be signed and
      decided to sign extend it, just in case. The rest appears to be
      mostly just minor shuffling of instructions.
      
      v2: i915_mmio_reg_{offset,equal,valid}() helpers added
          s/_REG/_MMIO/ in the register defines
          mo more switch statements left to worry about
          ring_emit stuff got sorted in a prep patch
          cmd parser, lrc context and w/a batch buildup also in prep patch
          vgpu stuff cleaned up and moved to a prep patch
          all other unrelated changes split out
      v3: Rebased due to BXT DSI/BLC, MOCS, etc.
      v4: Rebased due to churn, s/i915_mmio_reg_t/i915_reg_t/
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: http://patchwork.freedesktop.org/patch/msgid/1447853606-2751-1-git-send-email-ville.syrjala@linux.intel.com
      f0f59a00
    • V
      drm/i915: Turn vgpu pdps into an array · ab75bb5d
      Ville Syrjälä 提交于
      We'll want to avoid performing arithmetic with register offsets, so
      instead calculating the vgpu PDP as pdp0_lo+offset, make the PDPs
      into an array. This way we can simply loop through them.
      
      Cc: Eddie Dong <eddie.dong@intel.com>
      Cc: Jike Song <jike.song@intel.com>
      Cc: Kevin Tian <kevin.tian@intel.com>
      Cc: Yu Zhang <yu.c.zhang@linux.intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Cc: Zhiyuan Lv <zhiyuan.lv@intel.com>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1446672017-24497-25-git-send-email-ville.syrjala@linux.intel.comReviewed-by: NZhiyuan Lv <zhiyuan.lv@intel.com>
      ab75bb5d