1. 15 8月, 2017 1 次提交
    • T
      drm/i915/gvt: Fix guest i915 full ppgtt blocking issue · 6b3816d6
      Tina Zhang 提交于
      Guest i915 full ppgtt functionality was blocking by an issue, which would
      lead to gpu hardware hang. Guest i915 driver may update the ppgtt table
      just before this workload is going to be submitted to the hardware by
      device model. This case wasn't handled well by device model before, due
      to the small time window between removing old ppgtt entry and adding the
      new one. Errors occur when the workload is executed by hardware during
      that small time window. This patch is to remove this time window by adding
      the new ppgtt entry first and then remove the old one.
      
      Changes in v2:
      - Move VGT_CAPS_FULL_PPGTT introduction to patch 2/4. (Joonas)
      
      Changes since v2:
      - Divide the whole patch set into two separate patch series, with one
        patch in i915 side to check guest i915 full ppgtt capability and enable
        it when this capability is supported by the device model, and the other
        one in gvt side which fixs the blocking issue and enables the device
        model to provide the capability to guest. And this patch focuses on gvt
        side. (Joonas)
      - Change the title from "reorder the shadow ppgtt update process by adding
        entry first" to "Fix guest i915 full ppgtt blocking issue". (Tina)
      
      Changes since v3:
      - Rebase to the latest branch.
      
      Changes since v4:
      - Tested by Tina Zhang.
      
      Changes since v5:
      - Rebase to the latest branch.
      
      v6:
      - Update full 48bit ppgtt definition
      
      Cc: Tina Zhang <tina.zhang@intel.com>
      Signed-off-by: NTina Zhang <tina.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      6b3816d6
  2. 10 8月, 2017 13 次提交
  3. 27 7月, 2017 2 次提交
  4. 11 7月, 2017 5 次提交
  5. 29 6月, 2017 1 次提交
  6. 27 6月, 2017 2 次提交
    • X
      drm/i915/gvt: Don't read ADPA_CRT_HOTPLUG_MONITOR from host · 75e64ff2
      Xiong Zhang 提交于
      When host connects a crt screen, linux guest will detect two
      screens: crt and dp. This is wrong as linux guest has only
      one dp.
      
      In order to avoid guest get host crt screen, we should set
      ADPA_CRT_HOTPLUG_MONITOR to none. But MMIO_RO(PCH_ADPA) prevent
      from that. So MMIO_DH should be used instead of MMIO_RO.
      
      v2: Clear its staus to none at initialize, so guest don't
          get host crt.(Zhangyu)
      v3: SKL doesn't have this register, limit it to pre_skl.(xiong)
      Signed-off-by: NXiong Zhang <xiong.y.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      75e64ff2
    • X
      drm/i915/gvt: Set initial PORT_CLK_SEL vreg for BDW · 295a0d0b
      Xiong Zhang 提交于
      On BDW, when host physical screen and guest virtual screen aren't on
      the same DDI port, guest i915 driver prints the following error and
      stop running.
      [    6.775873] BUG: unable to handle kernel NULL pointer dereference
      at 0000000000000068
      [    6.775928] IP: intel_ddi_clock_get+0x81/0x430 [i915]
      [    6.776206] Call Trace:
      [    6.776233]  ? vgpu_read32+0x4f/0x100 [i915]
      [    6.776264]  intel_ddi_get_config+0x11c/0x230 [i915]
      [    6.776298]  intel_modeset_setup_hw_state+0x313/0xd40 [i915]
      [    6.776334]  intel_modeset_init+0xe49/0x18d0 [i915]
      [    6.776368]  ? vgpu_write32+0x53/0x100 [i915]
      [    6.776731]  ? intel_i2c_reset+0x42/0x50 [i915]
      [    6.777085]  ? intel_setup_gmbus+0x32a/0x350 [i915]
      [    6.777427]  i915_driver_load+0xabc/0x14d0 [i915]
      [    6.777768]  i915_pci_probe+0x4f/0x70 [i915]
      
      The null pointer is guest intel_crtc_state->shared_dpll which is
      setted in haswell_get_ddi_pll(). When guest and host screen are
      on different DDI port, host driver won't set PORT_CLK_SET(guest_port),
      so haswell_get_ddi_pll() will return null and don't set
      pipe_config->shared_dpll, once the following program refernce this
      structure, it will print the above error.
      
      This patch set the initial val of guest PORT_CLK_SEL(guest_port) to
      LCPLL_810. And guest i915 driver will reset this value according to
      guest screen mode.
      Signed-off-by: NXiong Zhang <xiong.y.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      295a0d0b
  7. 26 6月, 2017 2 次提交
    • C
      drm/i915/gvt: Fix inconsistent locks holding sequence · f16bd3dd
      Chuanxiao Dong 提交于
      There are two kinds of locking sequence.
      
      One is in the thread which is started by vfio ioctl to do
      the iommu unmapping. The locking sequence is:
      	down_read(&group_lock) ----> mutex_lock(&cached_lock)
      
      The other is in the vfio release thread which will unpin all
      the cached pages. The lock sequence is:
      	mutex_lock(&cached_lock) ---> down_read(&group_lock)
      
      And, the cache_lock is used to protect the rb tree of the cache
      node and doing vfio unpin doesn't require this lock. Move the
      vfio unpin out of the cache_lock protected region.
      
      v2:
      - use for style instead of do{}while(1). (Zhenyu)
      
      Fixes: f30437c5 ("drm/i915/gvt: add KVMGT support")
      Signed-off-by: NChuanxiao Dong <chuanxiao.dong@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: stable@vger.kernel.org # v4.10+
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      f16bd3dd
    • C
      drm/i915/gvt: Fix possible recursive locking issue · 62d02fd1
      Chuanxiao Dong 提交于
      vfio_unpin_pages will hold a read semaphore however it is already hold
      in the same thread by vfio ioctl. It will cause below warning:
      
      [ 5102.127454] ============================================
      [ 5102.133379] WARNING: possible recursive locking detected
      [ 5102.139304] 4.12.0-rc4+ #3 Not tainted
      [ 5102.143483] --------------------------------------------
      [ 5102.149407] qemu-system-x86/1620 is trying to acquire lock:
      [ 5102.155624]  (&container->group_lock){++++++}, at: [<ffffffff817768c6>] vfio_unpin_pages+0x96/0xf0
      [ 5102.165626]
      but task is already holding lock:
      [ 5102.172134]  (&container->group_lock){++++++}, at: [<ffffffff8177728f>] vfio_fops_unl_ioctl+0x5f/0x280
      [ 5102.182522]
      other info that might help us debug this:
      [ 5102.189806]  Possible unsafe locking scenario:
      
      [ 5102.196411]        CPU0
      [ 5102.199136]        ----
      [ 5102.201861]   lock(&container->group_lock);
      [ 5102.206527]   lock(&container->group_lock);
      [ 5102.211191]
      *** DEADLOCK ***
      
      [ 5102.217796]  May be due to missing lock nesting notation
      
      [ 5102.225370] 3 locks held by qemu-system-x86/1620:
      [ 5102.230618]  #0:  (&container->group_lock){++++++}, at: [<ffffffff8177728f>] vfio_fops_unl_ioctl+0x5f/0x280
      [ 5102.241482]  #1:  (&(&iommu->notifier)->rwsem){++++..}, at: [<ffffffff810de775>] __blocking_notifier_call_chain+0x35/0x70
      [ 5102.253713]  #2:  (&vgpu->vdev.cache_lock){+.+...}, at: [<ffffffff8157b007>] intel_vgpu_iommu_notifier+0x77/0x120
      [ 5102.265163]
      stack backtrace:
      [ 5102.270022] CPU: 5 PID: 1620 Comm: qemu-system-x86 Not tainted 4.12.0-rc4+ #3
      [ 5102.277991] Hardware name: Intel Corporation S1200RP/S1200RP, BIOS S1200RP.86B.03.01.APER.061220151418 06/12/2015
      [ 5102.289445] Call Trace:
      [ 5102.292175]  dump_stack+0x85/0xc7
      [ 5102.295871]  validate_chain.isra.21+0x9da/0xaf0
      [ 5102.300925]  __lock_acquire+0x405/0x820
      [ 5102.305202]  lock_acquire+0xc7/0x220
      [ 5102.309191]  ? vfio_unpin_pages+0x96/0xf0
      [ 5102.313666]  down_read+0x2b/0x50
      [ 5102.317259]  ? vfio_unpin_pages+0x96/0xf0
      [ 5102.321732]  vfio_unpin_pages+0x96/0xf0
      [ 5102.326024]  intel_vgpu_iommu_notifier+0xe5/0x120
      [ 5102.331283]  notifier_call_chain+0x4a/0x70
      [ 5102.335851]  __blocking_notifier_call_chain+0x4d/0x70
      [ 5102.341490]  blocking_notifier_call_chain+0x16/0x20
      [ 5102.346935]  vfio_iommu_type1_ioctl+0x87b/0x920
      [ 5102.351994]  vfio_fops_unl_ioctl+0x81/0x280
      [ 5102.356660]  ? __fget+0xf0/0x210
      [ 5102.360261]  do_vfs_ioctl+0x93/0x6a0
      [ 5102.364247]  ? __fget+0x111/0x210
      [ 5102.367942]  SyS_ioctl+0x41/0x70
      [ 5102.371542]  entry_SYSCALL_64_fastpath+0x1f/0xbe
      
      put the vfio_unpin_pages in a workqueue can fix this.
      
      v2:
      - use for style instead of do{}while(1). (Zhenyu)
      v3:
      - rename gvt_cache_mark to gvt_cache_mark_remove. (Zhenyu)
      
      Fixes: 659643f7 ("drm/i915/gvt/kvmgt: add vfio/mdev support to KVMGT")
      Signed-off-by: NChuanxiao Dong <chuanxiao.dong@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: stable@vger.kernel.org # v4.10+
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      62d02fd1
  8. 21 6月, 2017 1 次提交
  9. 08 6月, 2017 13 次提交