1. 25 4月, 2019 2 次提交
  2. 16 4月, 2019 2 次提交
  3. 11 4月, 2019 1 次提交
  4. 08 4月, 2019 2 次提交
    • C
      drm/i915/gvt: Prevent use-after-free in ppgtt_free_all_spt() · 968a85b1
      Chris Wilson 提交于
      ppgtt_free_all_spt() iterates the radixtree as it is deleting it,
      forgoing all protection against the leaves being freed in the process
      (leaving the iter pointing into the void).
      
      A minimal fix seems to be to use the available post_shadow_list to
      decompose the tree into a list prior to destroying the radixtree.
      
      Alerted by the sparse warnings:
      
      drivers/gpu/drm/i915/gvt/gtt.c:757:9: warning: incorrect type in assignment (different address spaces)
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    expected void **slot
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    got void [noderef] <asn:4> **
      drivers/gpu/drm/i915/gvt/gtt.c:757:9: warning: incorrect type in assignment (different address spaces)
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    expected void **slot
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    got void [noderef] <asn:4> **
      drivers/gpu/drm/i915/gvt/gtt.c:758:45: warning: incorrect type in argument 1 (different address spaces)
      drivers/gpu/drm/i915/gvt/gtt.c:758:45:    expected void [noderef] <asn:4> **slot
      drivers/gpu/drm/i915/gvt/gtt.c:758:45:    got void **slot
      drivers/gpu/drm/i915/gvt/gtt.c:757:9: warning: incorrect type in argument 1 (different address spaces)
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    expected void [noderef] <asn:4> **slot
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    got void **slot
      drivers/gpu/drm/i915/gvt/gtt.c:757:9: warning: incorrect type in assignment (different address spaces)
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    expected void **slot
      drivers/gpu/drm/i915/gvt/gtt.c:757:9:    got void [noderef] <asn:4> **
      
      This would also have been loudly warning if run through CI for the
      invalid RCU dereferences.
      
      Fixes: b6c126a3 ("drm/i915/gvt: Manage shadow pages with radix tree")
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      968a85b1
    • C
      drm/i915/gvt: Annotate iomem usage · 196a6627
      Chris Wilson 提交于
      Fix the sparse warning for blithely using iomem with normal memcpy:
      
      drivers/gpu/drm/i915/gvt/kvmgt.c:916:21: warning: incorrect type in assignment (different address spaces)
      drivers/gpu/drm/i915/gvt/kvmgt.c:916:21:    expected void *aperture_va
      drivers/gpu/drm/i915/gvt/kvmgt.c:916:21:    got void [noderef] <asn:2> *
      drivers/gpu/drm/i915/gvt/kvmgt.c:927:26: warning: incorrect type in argument 1 (different address spaces)
      drivers/gpu/drm/i915/gvt/kvmgt.c:927:26:    expected void [noderef] <asn:2> *vaddr
      drivers/gpu/drm/i915/gvt/kvmgt.c:927:26:    got void *aperture_va
      
      Fixes: d480b28a ("drm/i915/gvt: Fix aperture read/write emulation when enable x-no-mmap=on")
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      196a6627
  5. 04 4月, 2019 2 次提交
  6. 02 4月, 2019 1 次提交
  7. 29 3月, 2019 6 次提交
  8. 27 3月, 2019 2 次提交
  9. 21 3月, 2019 1 次提交
  10. 15 3月, 2019 2 次提交
  11. 11 3月, 2019 1 次提交
  12. 08 3月, 2019 1 次提交
  13. 06 3月, 2019 1 次提交
  14. 04 3月, 2019 2 次提交
    • Z
      drm/i915/gvt: Add mutual lock for ppgtt mm LRU list · 72aabfb8
      Zhenyu Wang 提交于
      This adds mutex to guard against update of global ppgtt mm LRU list.
      To resolve error found as below warning.
      
      [73130.012162] ------------[ cut here ]------------
      [73130.012168] list_add corruption. prev->next should be next (ffff995f970cca50), but was 0000000000000000. (prev=ffff995f0dc5bdf8).
      [73130.012181] WARNING: CPU: 3 PID: 82 at lib/list_debug.c:28 __list_add_valid+0x4d/0x70
      [73130.012183] Modules linked in: btrfs(E) xor(E) zstd_decompress(E) zstd_compress(E) raid6_pq(E) dm_mod(E) kvmgt(E) fuse(E) xt_addrtype(E) nft_compat(E) xt_conntrack(E) nf_nat(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) libcrc32c(E) br_netfilter(E) bridge(E) stp(E) llc(E) overlay(E) devlink(E) nf_tables(E) nfnetlink(E) loop(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) coretemp(E) crct10dif_pclmul(E) crc32_pclmul(E) ghash_clmulni_intel(E) mei_me(E) aesni_intel(E) aes_x86_64(E) crypto_simd(E) cryptd(E) glue_helper(E) intel_cstate(E) intel_uncore(E) mei(E) intel_pch_thermal(E) intel_rapl_perf(E) pcspkr(E) iTCO_wdt(E) iTCO_vendor_support(E) idma64(E) sg(E) virt_dma(E) acpi_pad(E) evdev(E) binfmt_misc(E) ip_tables(E) x_tables(E) ipv6(E) autofs4(E) hid_generic(E) usbhid(E) hid(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) fscrypto(E) xhci_pci(E) sdhci_pci(E) cqhci(E) intel_lpss_pci(E) intel_lpss(E) crc32c_intel(E) xhci_hcd(E) sdhci(E) i2c_i801(E) e1000e(E) mmc_core(E)
      [73130.012218]  ptp(E) pps_core(E) usbcore(E) mfd_core(E) sd_mod(E) fan(E) thermal(E)
      [73130.012227] CPU: 3 PID: 82 Comm: gvt workload 0 Tainted: G        W   E     5.0.0-rc7-staging-190226+ #282
      [73130.012228] Hardware name:  /NUC6i5SYB, BIOS SYSKLi35.86A.0039.2016.0316.1747 03/16/2016
      [73130.012232] RIP: 0010:__list_add_valid+0x4d/0x70
      [73130.012234] Code: c3 48 89 d1 48 c7 c7 e0 82 91 bb 48 89 c2 e8 44 8a cc ff 0f 0b 31 c0 c3 48 89 c1 4c 89 c6 48 c7 c7 30 83 91 bb e8 2d 8a cc ff <0f> 0b 31 c0 c3 48 89 f2 4c 89 c1 48 89 fe 48 c7 c7 80 83 91 bb e8
      [73130.012236] RSP: 0018:ffffa4924107fdd0 EFLAGS: 00010286
      [73130.012238] RAX: 0000000000000000 RBX: ffff995d8a5ccf00 RCX: 0000000000000006
      [73130.012240] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff995faad96680
      [73130.012241] RBP: 0000000000000000 R08: 0000000000213a28 R09: 0000000000000084
      [73130.012243] R10: 0000000000000000 R11: ffffa4924107fc70 R12: ffff995d8a5ccf78
      [73130.012245] R13: ffff995f970c8000 R14: ffff995f0dc5bdf8 R15: ffff995f970cca50
      [73130.012247] FS:  0000000000000000(0000) GS:ffff995faad80000(0000) knlGS:0000000000000000
      [73130.012249] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [73130.012250] CR2: 00000222e1891000 CR3: 0000000116848002 CR4: 00000000003626e0
      [73130.012252] Call Trace:
      [73130.012258]  intel_vgpu_pin_mm+0x7a/0xa0
      [73130.012262]  workload_thread+0x683/0x12a0
      [73130.012266]  ? do_wait_intr_irq+0xb0/0xb0
      [73130.012269]  ? finish_wait+0x80/0x80
      [73130.012271]  ? intel_vgpu_clean_workloads+0x110/0x110
      [73130.012274]  kthread+0x116/0x130
      [73130.012276]  ? kthread_bind+0x30/0x30
      [73130.012280]  ret_from_fork+0x35/0x40
      [73130.012285] WARNING: CPU: 3 PID: 82 at lib/list_debug.c:28 __list_add_valid+0x4d/0x70
      [73130.012286] ---[ end trace 458a2e792eec21c0 ]---
      
      v2:
      - simplify lock handling
      Reviewed-by: NXiong Zhang <xiong.y.zhang@intel.com>
      Cc: Xiong Zhang <xiong.y.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      72aabfb8
    • Z
      drm/i915/gvt: Only assign ppgtt root at dispatch time · 1e18d5e6
      Zhenyu Wang 提交于
      This moves ppgtt root hook out of scan and shadow function,
      as it's only required at dispatch time. Also make sure this
      checks against shadow mm to be ready, otherwise bail to fail
      earlier.
      Reviewed-by: NXiong Zhang <xiong.y.zhang@intel.com>
      Cc: Xiong Zhang <xiong.y.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      1e18d5e6
  15. 01 3月, 2019 2 次提交
    • Z
      drm/i915/gvt: Don't submit request for error workload dispatch · f552e7bd
      Zhenyu Wang 提交于
      As vGPU shadow ctx is loaded with guest context state, arbitrarily
      submitting request in error workload dispatch path would cause trouble.
      So don't try to submit in error path now like in previous code.
      This is to fix VM failure when GPU hang happens.
      
      Fixes: f0e99437 ("drm/i915/gvt: Fix workload request allocation before request add")
      Reviewed-by: NXiong Zhang <xiong.y.zhang@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      f552e7bd
    • W
      drm/i915/gvt: stop scheduling workload when vgpu is inactive · 9f498477
      Weinan Li 提交于
      There is one corner case that workload_thread may pick and dispatch one
      workload of vgpu after it's already deactivated. Below is the scenario:
      
      1. deactive_vgpu got the vgpu_lock, it found pending workload was
      submitted, then it released the vgpu_lock and wait for vgpu idle.
      2. before deactive_vgpu got the vgpu_lock back, workload_thread might pick
      one new valid workload, then it was blocked by the vgpu_lock.
      3. deactive_vgpu got the vgpu_lock again, finished the last processes of
      deactivating, then release the vgpu_lock.
      4. workload_thread got the vgpu_lock, then it will try to dispatch the
      fetched workload. It's not expected one workload of deactivated vgpu is
      dispatched.
      
      The solution is to add condition check of the vgpu's active flag and stop
      to schedule when it's inactive.
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NWeinan Li <weinan.z.li@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      9f498477
  16. 28 2月, 2019 1 次提交
  17. 22 2月, 2019 1 次提交
    • C
      drm/i915/gvt: Add in context mmio 0x20D8 to gen9 mmio list · 1e8b15a1
      Colin Xu 提交于
      Depends on GEN family and I915_PARAM_HAS_CONTEXT_ISOLATION, Mesa driver
      will decide whether constant buffer 0 address is relative or absolute,
      and load GPU initial state by lri to context mmio INSTPM (GEN8)
      or 0x20D8 (>=GEN9).
      Mesa Commit fa8a764b62
      ("i965: Use absolute addressing for constant buffer 0 on Kernel 4.16+.")
      
      INSTPM is already added to gen8_engine_mmio_list, but 0x20D8 is missed
      in gen9_engine_mmio_list. From GVT point of view, different guest could
      have different context so should switch those mmio accordingly.
      
      v2: Update fixes commit ID.
      
      Fixes: 17865713 ("drm/i915/gvt: vGPU context switch")
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NColin Xu <colin.xu@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      1e8b15a1
  18. 21 2月, 2019 1 次提交
    • Z
      drm/i915/gvt: Fix MI_FLUSH_DW parsing with correct index check · 13bcb80b
      Zhenyu Wang 提交于
      When MI_FLUSH_DW post write hw status page in index mode, the index
      value is in dword step and turned into address offset in cmd dword1.
      As status page size is 4K, so can't exceed that.
      
      This fixed upper bound check in cmd parser code which incorrectly
      stopped VM for reason of invalid MI_FLUSH_DW write index.
      
      v2:
      - Fix upper bound as 4K page size because index value is address offset.
      
      Fixes: be1da707 ("drm/i915/gvt: vGPU command scanner")
      Cc: stable@vger.kernel.org # v4.10+
      Cc: "Zhao, Yan Y" <yan.y.zhao@intel.com>
      Reviewed-by: NYan Zhao <yan.y.zhao@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      13bcb80b
  19. 20 2月, 2019 2 次提交
  20. 18 2月, 2019 1 次提交
  21. 31 1月, 2019 3 次提交
  22. 23 1月, 2019 2 次提交
  23. 15 1月, 2019 1 次提交
    • Z
      drm/i915/gvt: Fix mmap range check · 51b00d85
      Zhenyu Wang 提交于
      This is to fix missed mmap range check on vGPU bar2 region
      and only allow to map vGPU allocated GMADDR range, which means
      user space should support sparse mmap to get proper offset for
      mmap vGPU aperture. And this takes care of actual pgoff in mmap
      request as original code always does from beginning of vGPU
      aperture.
      
      Fixes: 659643f7 ("drm/i915/gvt/kvmgt: add vfio/mdev support to KVMGT")
      Cc: "Monroy, Rodrigo Axel" <rodrigo.axel.monroy@intel.com>
      Cc: "Orrala Contreras, Alfredo" <alfredo.orrala.contreras@intel.com>
      Cc: stable@vger.kernel.org # v4.10+
      Reviewed-by: NHang Yuan <hang.yuan@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      51b00d85