]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: Add copy_pte_num_dw member in amdgpu_vm_pte_funcs
authorYong Zhao <yong.zhao@amd.com>
Tue, 19 Sep 2017 16:58:15 +0000 (12:58 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 19:14:22 +0000 (15:14 -0400)
Use it to replace the hard coded value in amdgpu_vm_bo_update_mapping().

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/si_dma.c

index 1bf42a8ef23e2dc51b1c11939ae786bfed0da5ed..7c43add4e44447e6f1ee2eb77e2c56658640e61b 100644 (file)
@@ -294,10 +294,14 @@ struct amdgpu_buffer_funcs {
 
 /* provided by hw blocks that can write ptes, e.g., sdma */
 struct amdgpu_vm_pte_funcs {
+       /* number of dw to reserve per operation */
+       unsigned        copy_pte_num_dw;
+
        /* copy pte entries from GART */
        void (*copy_pte)(struct amdgpu_ib *ib,
                         uint64_t pe, uint64_t src,
                         unsigned count);
+
        /* write pte one entry at a time with addr mapping */
        void (*write_pte)(struct amdgpu_ib *ib, uint64_t pe,
                          uint64_t value, unsigned count,
index 28d16781377f678ba782ff57556b2c71dc2c9547..8fcc743dfa8675393dd2385147b0a797e41a62a9 100644 (file)
@@ -1597,7 +1597,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 
        if (pages_addr) {
                /* copy commands needed */
-               ndw += ncmds * 7;
+               ndw += ncmds * adev->vm_manager.vm_pte_funcs->copy_pte_num_dw;
 
                /* and also PTEs */
                ndw += nptes * 2;
index c64dcd1883b5d87394c93099bd2ac07179db36ef..60cecd117705b53f785376806af275968f1fa89d 100644 (file)
@@ -1387,7 +1387,9 @@ static void cik_sdma_set_buffer_funcs(struct amdgpu_device *adev)
 }
 
 static const struct amdgpu_vm_pte_funcs cik_sdma_vm_pte_funcs = {
+       .copy_pte_num_dw = 7,
        .copy_pte = cik_sdma_vm_copy_pte,
+
        .write_pte = cik_sdma_vm_write_pte,
 
        .set_max_nums_pte_pde = 0x1fffff >> 3,
index c05eb74d3404c0cd5b32bf3ca0d09b72552a7092..acdee3a4602c2cd2d3bcc8882b61e9348394c91e 100644 (file)
@@ -1324,7 +1324,9 @@ static void sdma_v2_4_set_buffer_funcs(struct amdgpu_device *adev)
 }
 
 static const struct amdgpu_vm_pte_funcs sdma_v2_4_vm_pte_funcs = {
+       .copy_pte_num_dw = 7,
        .copy_pte = sdma_v2_4_vm_copy_pte,
+
        .write_pte = sdma_v2_4_vm_write_pte,
 
        .set_max_nums_pte_pde = 0x1fffff >> 3,
index 2079340656d21f34c847aa06d9ce142e59829bb1..72f31cc7df00e6dadf9a865f097ce1bfdd083ebc 100644 (file)
@@ -1748,7 +1748,9 @@ static void sdma_v3_0_set_buffer_funcs(struct amdgpu_device *adev)
 }
 
 static const struct amdgpu_vm_pte_funcs sdma_v3_0_vm_pte_funcs = {
+       .copy_pte_num_dw = 7,
        .copy_pte = sdma_v3_0_vm_copy_pte,
+
        .write_pte = sdma_v3_0_vm_write_pte,
 
        /* not 0x3fffff due to HW limitation */
index 2605faf56dff7f4bbc7c9c0ecac44bd6198a64e3..61572c5d19efd15f1e28cedf543f3715d3b417a8 100644 (file)
@@ -1714,7 +1714,9 @@ static void sdma_v4_0_set_buffer_funcs(struct amdgpu_device *adev)
 }
 
 static const struct amdgpu_vm_pte_funcs sdma_v4_0_vm_pte_funcs = {
+       .copy_pte_num_dw = 7,
        .copy_pte = sdma_v4_0_vm_copy_pte,
+
        .write_pte = sdma_v4_0_vm_write_pte,
 
        .set_max_nums_pte_pde = 0x400000 >> 3,
index adb6ae7d63ef05d7f82daefe02d32f2b5b206746..3fa2fbf8c9a189921f933ed5fc7fe0064a0bf695 100644 (file)
@@ -887,7 +887,9 @@ static void si_dma_set_buffer_funcs(struct amdgpu_device *adev)
 }
 
 static const struct amdgpu_vm_pte_funcs si_dma_vm_pte_funcs = {
+       .copy_pte_num_dw = 5,
        .copy_pte = si_dma_vm_copy_pte,
+
        .write_pte = si_dma_vm_write_pte,
 
        .set_max_nums_pte_pde = 0xffff8 >> 3,