aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-16 10:22:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-16 10:22:42 -0400
commitcc7ce90153e74f8266eefee9fba466faa1a2d5df (patch)
tree7ebac4bc27c2d400aca256c0b557c561540543e2 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parent83f3ef3de625a5766de2382f9e077d4daafd5bac (diff)
parent8da0e1525b7f0d69c6cb44094963906282b32673 (diff)
Merge tag 'drm-next-2019-05-16' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "A bunch of fixes for the merge window closure, doesn't seem to be anything too major or serious in there. It does add TU117 turing modesetting to nouveau but it's just an enable for preexisting code. amdgpu: - gpu reset at load crash fix - ATPX hotplug fix for when dGPU is off - SR-IOV fixes radeon: - r5xx pll fixes i915: - GVT (MCHBAR, buffer alignment, misc warnings fixes) - Fixes for newly enabled semaphore code - Geminilake disable framebuffer compression - HSW edp fast modeset fix - IRQ vs RCU race fix nouveau: - Turing modesetting fixes - TU117 support msm: - SDM845 bringup fixes panfrost: - static checker fixes pl111: - spinlock init fix. bridge: - refresh rate register fix for adv7511" * tag 'drm-next-2019-05-16' of git://anongit.freedesktop.org/drm/drm: (36 commits) drm/msm: Upgrade gxpd checks to IS_ERR_OR_NULL drm/msm/dpu: Remove duplicate header drm/pl111: Initialize clock spinlock early drm/msm: correct attempted NULL pointer dereference in debugfs drm/msm: remove resv fields from msm_gem_object struct drm/nouveau: fix duplication of nv50_head_atom struct drm/nouveau/disp/dp: respect sink limits when selecting failsafe link configuration drm/nouveau/core: initial support for boards with TU117 chipset drm/nouveau/core: allow detected chipset to be overridden drm/nouveau/kms/gf119-gp10x: push HeadSetControlOutputResource() mthd when encoders change drm/nouveau/kms/nv50-: fix bug preventing non-vsync'd page flips drm/nouveau/kms/gv100-: fix spurious window immediate interlocks drm/bridge: adv7511: Fix low refresh rate selection drm/panfrost: Add missing _fini() calls in panfrost_device_fini() drm/panfrost: Only put sync_out if non-NULL drm/i915: Seal races between async GPU cancellation, retirement and signaling drm/i915: Fix fastset vs. pfit on/off on HSW EDP transcoder drm/i915/fbc: disable framebuffer compression on GeminiLake drm/amdgpu/psp: move psp version specific function pointers to early_init drm/radeon: prefer lower reference dividers ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index a07c85815b7a..4f10f5aba00b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2757,6 +2757,37 @@ error_free_sched_entity:
2757} 2757}
2758 2758
2759/** 2759/**
2760 * amdgpu_vm_check_clean_reserved - check if a VM is clean
2761 *
2762 * @adev: amdgpu_device pointer
2763 * @vm: the VM to check
2764 *
2765 * check all entries of the root PD, if any subsequent PDs are allocated,
2766 * it means there are page table creating and filling, and is no a clean
2767 * VM
2768 *
2769 * Returns:
2770 * 0 if this VM is clean
2771 */
2772static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev,
2773 struct amdgpu_vm *vm)
2774{
2775 enum amdgpu_vm_level root = adev->vm_manager.root_level;
2776 unsigned int entries = amdgpu_vm_num_entries(adev, root);
2777 unsigned int i = 0;
2778
2779 if (!(vm->root.entries))
2780 return 0;
2781
2782 for (i = 0; i < entries; i++) {
2783 if (vm->root.entries[i].base.bo)
2784 return -EINVAL;
2785 }
2786
2787 return 0;
2788}
2789
2790/**
2760 * amdgpu_vm_make_compute - Turn a GFX VM into a compute VM 2791 * amdgpu_vm_make_compute - Turn a GFX VM into a compute VM
2761 * 2792 *
2762 * @adev: amdgpu_device pointer 2793 * @adev: amdgpu_device pointer
@@ -2786,10 +2817,9 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
2786 return r; 2817 return r;
2787 2818
2788 /* Sanity checks */ 2819 /* Sanity checks */
2789 if (!RB_EMPTY_ROOT(&vm->va.rb_root) || vm->root.entries) { 2820 r = amdgpu_vm_check_clean_reserved(adev, vm);
2790 r = -EINVAL; 2821 if (r)
2791 goto unreserve_bo; 2822 goto unreserve_bo;
2792 }
2793 2823
2794 if (pasid) { 2824 if (pasid) {
2795 unsigned long flags; 2825 unsigned long flags;