aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2019-02-10 23:04:05 -0500
committerDave Airlie <airlied@redhat.com>2019-02-10 23:04:20 -0500
commitf4bc54b532a62d8bee421ca06adb6d1b3e7ffaa9 (patch)
tree3b835f9bed6bd236fa1a6d5d0add836f25ca8262 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parent5ea3998d56346975c2701df18fb5b6e3ab5c8d9e (diff)
parent0461221316ec21e0a535a35fba3feb6ba75706e6 (diff)
Merge branch 'drm-next-5.1' of git://people.freedesktop.org/~agd5f/linux into drm-next
Updates for 5.1: - GDS fixes - Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES interface - GPUVM fixes - PCIE DPM switching fixes for vega20 - Vega10 uclk DPM regression fix - DC Freesync fixes - DC ABM fixes - Various DC cleanups Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexdeucher@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190208210214.27666-1-alexander.deucher@amd.com
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 0bc6f553dc08..75481cf3348f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -107,14 +107,6 @@ struct amdgpu_pte_update_params {
107 * DMA addresses to use for mapping, used during VM update by CPU 107 * DMA addresses to use for mapping, used during VM update by CPU
108 */ 108 */
109 dma_addr_t *pages_addr; 109 dma_addr_t *pages_addr;
110
111 /**
112 * @kptr:
113 *
114 * Kernel pointer of PD/PT BO that needs to be updated,
115 * used during VM update by CPU
116 */
117 void *kptr;
118}; 110};
119 111
120/** 112/**
@@ -1789,13 +1781,20 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
1789 if (pages_addr) 1781 if (pages_addr)
1790 params.src = ~0; 1782 params.src = ~0;
1791 1783
1792 /* Wait for PT BOs to be free. PTs share the same resv. object 1784 /* Wait for PT BOs to be idle. PTs share the same resv. object
1793 * as the root PD BO 1785 * as the root PD BO
1794 */ 1786 */
1795 r = amdgpu_vm_wait_pd(adev, vm, owner); 1787 r = amdgpu_vm_wait_pd(adev, vm, owner);
1796 if (unlikely(r)) 1788 if (unlikely(r))
1797 return r; 1789 return r;
1798 1790
1791 /* Wait for any BO move to be completed */
1792 if (exclusive) {
1793 r = dma_fence_wait(exclusive, true);
1794 if (unlikely(r))
1795 return r;
1796 }
1797
1799 params.func = amdgpu_vm_cpu_set_ptes; 1798 params.func = amdgpu_vm_cpu_set_ptes;
1800 params.pages_addr = pages_addr; 1799 params.pages_addr = pages_addr;
1801 return amdgpu_vm_update_ptes(&params, start, last + 1, 1800 return amdgpu_vm_update_ptes(&params, start, last + 1,
@@ -1809,13 +1808,12 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
1809 /* 1808 /*
1810 * reserve space for two commands every (1 << BLOCK_SIZE) 1809 * reserve space for two commands every (1 << BLOCK_SIZE)
1811 * entries or 2k dwords (whatever is smaller) 1810 * entries or 2k dwords (whatever is smaller)
1812 *
1813 * The second command is for the shadow pagetables.
1814 */ 1811 */
1812 ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1);
1813
1814 /* The second command is for the shadow pagetables. */
1815 if (vm->root.base.bo->shadow) 1815 if (vm->root.base.bo->shadow)
1816 ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1) * 2; 1816 ncmds *= 2;
1817 else
1818 ncmds = ((nptes >> min(adev->vm_manager.block_size, 11u)) + 1);
1819 1817
1820 /* padding, etc. */ 1818 /* padding, etc. */
1821 ndw = 64; 1819 ndw = 64;
@@ -1834,10 +1832,11 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
1834 ndw += ncmds * 10; 1832 ndw += ncmds * 10;
1835 1833
1836 /* extra commands for begin/end fragments */ 1834 /* extra commands for begin/end fragments */
1835 ncmds = 2 * adev->vm_manager.fragment_size;
1837 if (vm->root.base.bo->shadow) 1836 if (vm->root.base.bo->shadow)
1838 ndw += 2 * 10 * adev->vm_manager.fragment_size * 2; 1837 ncmds *= 2;
1839 else 1838
1840 ndw += 2 * 10 * adev->vm_manager.fragment_size; 1839 ndw += 10 * ncmds;
1841 1840
1842 params.func = amdgpu_vm_do_set_ptes; 1841 params.func = amdgpu_vm_do_set_ptes;
1843 } 1842 }