]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: assign VM invalidation engine manually v2
authorChristian König <christian.koenig@amd.com>
Fri, 31 Mar 2017 09:03:50 +0000 (11:03 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 28 Apr 2017 21:32:19 +0000 (17:32 -0400)
For Vega10 we have 18 VM invalidation engines for each VMHUB.

Start to assign them manually to the rings.

v2: add a BUG_ON if we use to many engines

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

index de12f7549e6d9c6c7287c0de9a17fdccabdf143b..944443c5b90a20018f3f804c163ac5ef10fe32c2 100644 (file)
@@ -179,6 +179,7 @@ struct amdgpu_ring {
        unsigned                cond_exe_offs;
        u64                     cond_exe_gpu_addr;
        volatile u32            *cond_exe_cpu_addr;
+       unsigned                vm_inv_eng;
 #if defined(CONFIG_DEBUG_FS)
        struct dentry *ent;
 #endif
index 1badd294ff1860e17fc175c2435eaad0bca87aa1..87596e48f65d221a11c3002aa30275850df0f703 100644 (file)
@@ -2959,7 +2959,7 @@ static void gfx_v9_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
        uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
-       unsigned eng = ring->idx;
+       unsigned eng = ring->vm_inv_eng;
 
        pd_addr = pd_addr | 0x1; /* valid bit */
        /* now only use physical base address of PDE and valid */
index 7f5cc75f0da5dee7ba977811f4a4f2095a3286e7..a71521e10763522f9a808ab6f7043b03240b823b 100644 (file)
@@ -386,6 +386,22 @@ static int gmc_v9_0_early_init(void *handle)
 static int gmc_v9_0_late_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 0 };
+       unsigned i;
+
+       for(i = 0; i < adev->num_rings; ++i) {
+               struct amdgpu_ring *ring = adev->rings[i];
+               unsigned vmhub = ring->funcs->vmhub;
+
+               ring->vm_inv_eng = vm_inv_eng[vmhub]++;
+               dev_info(adev->dev, "ring %u uses VM inv eng %u on hub %u\n",
+                        ring->idx, ring->vm_inv_eng, ring->funcs->vmhub);
+       }
+
+       /* Engine 17 is used for GART flushes */
+       for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i)
+               BUG_ON(vm_inv_eng[i] > 17);
+
        return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
 }
 
index c3cf6bcadc60fdcd6a2d8a6b3ebb8c3375482725..88c5d8f6f414ce3cf4aaef758439ac042564623b 100644 (file)
@@ -1041,7 +1041,7 @@ static void sdma_v4_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
-       unsigned eng = ring->idx;
+       unsigned eng = ring->vm_inv_eng;
 
        pd_addr = pd_addr | 0x1; /* valid bit */
        /* now only use physical base address of PDE and valid */
index dc3a2145a4528f6352a1f81389cc85f381b69f29..c646570d14210390e29f0f3562eb3b5dcc516e27 100644 (file)
@@ -1037,7 +1037,7 @@ static void uvd_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
        uint32_t data0, data1, mask;
-       unsigned eng = ring->idx;
+       unsigned eng = ring->vm_inv_eng;
 
        pd_addr = pd_addr | 0x1; /* valid bit */
        /* now only use physical base address of PDE and valid */
@@ -1078,7 +1078,7 @@ static void uvd_v7_0_enc_ring_emit_vm_flush(struct amdgpu_ring *ring,
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
-       unsigned eng = ring->idx;
+       unsigned eng = ring->vm_inv_eng;
 
        pd_addr = pd_addr | 0x1; /* valid bit */
        /* now only use physical base address of PDE and valid */
index 2ffafbe6cd80f050f9b438b306eb6d2602b7ceca..72d0edb9bc39397ef8ca9faf80ffdc3b62d02300 100644 (file)
@@ -970,7 +970,7 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
-       unsigned eng = ring->idx;
+       unsigned eng = ring->vm_inv_eng;
 
        pd_addr = pd_addr | 0x1; /* valid bit */
        /* now only use physical base address of PDE and valid */