drm/amdgpu: forward pasid to backend flush implementations
authorChristian König <christian.koenig@amd.com>
Mon, 8 Jan 2018 13:48:11 +0000 (14:48 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:17:47 +0000 (14:17 -0500)
rd the pasid from the VM code to the emit_vm_flush function and update
all implementations with the new parameter.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.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
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c

index 3cb0707e9893bb1cb6e1e045d533d25b0527624d..20b17160bf22e83174f661c2fdfdf052c23041da 100644 (file)
@@ -1056,8 +1056,9 @@ struct amdgpu_job {
        void                    *owner;
        uint64_t                fence_ctx; /* the fence_context this job uses */
        bool                    vm_needs_flush;
-       unsigned                vmid;
        uint64_t                vm_pd_addr;
+       unsigned                vmid;
+       unsigned                pasid;
        uint32_t                gds_base, gds_size;
        uint32_t                gws_base, gws_size;
        uint32_t                oa_base, oa_size;
@@ -1790,7 +1791,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_ring_set_wptr(r) (r)->funcs->set_wptr((r))
 #define amdgpu_ring_emit_ib(r, ib, vmid, c) (r)->funcs->emit_ib((r), (ib), (vmid), (c))
 #define amdgpu_ring_emit_pipeline_sync(r) (r)->funcs->emit_pipeline_sync((r))
-#define amdgpu_ring_emit_vm_flush(r, vmid, addr) (r)->funcs->emit_vm_flush((r), (vmid), (addr))
+#define amdgpu_ring_emit_vm_flush(r, vmid, pasid, addr) (r)->funcs->emit_vm_flush((r), (vmid), (pasid), (addr))
 #define amdgpu_ring_emit_fence(r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags))
 #define amdgpu_ring_emit_gds_switch(r, v, db, ds, wb, ws, ab, as) (r)->funcs->emit_gds_switch((r), (v), (db), (ds), (wb), (ws), (ab), (as))
 #define amdgpu_ring_emit_hdp_flush(r) (r)->funcs->emit_hdp_flush((r))
index 3b9d318cf166043fcf2d6216a5c13504ced17f93..c13cf7e79b2ef445337afea20bc18e73c43ecc70 100644 (file)
@@ -237,6 +237,7 @@ static int amdgpu_vmid_grab_reserved_locked(struct amdgpu_vm *vm,
                id->last_flush = NULL;
        }
        job->vmid = id - id_mgr->ids;
+       job->pasid = vm->pasid;
        trace_amdgpu_vm_grab_id(vm, ring, job);
 out:
        return r;
@@ -388,6 +389,7 @@ no_flush_needed:
        list_move_tail(&id->list, &id_mgr->ids_lru);
 
        job->vmid = id - id_mgr->ids;
+       job->pasid = vm->pasid;
        trace_amdgpu_vm_grab_id(vm, ring, job);
 
 error:
index 102dad3edf6a44be8462ea1d9303ad0be2fdd68b..12b9a06f4d21adc09ce4ab7a33c2fcf856bb0a03 100644 (file)
@@ -126,7 +126,7 @@ struct amdgpu_ring_funcs {
                           uint64_t seq, unsigned flags);
        void (*emit_pipeline_sync)(struct amdgpu_ring *ring);
        void (*emit_vm_flush)(struct amdgpu_ring *ring, unsigned vmid,
-                             uint64_t pd_addr);
+                             unsigned pasid, uint64_t pd_addr);
        void (*emit_hdp_flush)(struct amdgpu_ring *ring);
        void (*emit_hdp_invalidate)(struct amdgpu_ring *ring);
        void (*emit_gds_switch)(struct amdgpu_ring *ring, uint32_t vmid,
index 21b3915bfec195f34521ac27df2911715e2b3522..2dca47ad4f0947df872565acbe248437c8d474de 100644 (file)
@@ -513,7 +513,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_
                struct dma_fence *fence;
 
                trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
-               amdgpu_ring_emit_vm_flush(ring, job->vmid, job->vm_pd_addr);
+               amdgpu_ring_emit_vm_flush(ring, job->vmid, job->pasid,
+                                         job->vm_pd_addr);
 
                r = amdgpu_fence_emit(ring, &fence);
                if (r)
index 1836ae1b7505330bc2fba41ef9ec49842a5739fc..66d9b5f85d6e8eeb74a588c80d645ac12e674ec7 100644 (file)
@@ -880,7 +880,8 @@ static void cik_sdma_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
  * using sDMA (CIK).
  */
 static void cik_sdma_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                       unsigned vmid, uint64_t pd_addr)
+                                       unsigned vmid, unsigned pasid,
+                                       uint64_t pd_addr)
 {
        u32 extra_bits = (SDMA_POLL_REG_MEM_EXTRA_OP(0) |
                          SDMA_POLL_REG_MEM_EXTRA_FUNC(0)); /* always */
index 9870d83b68c17448df2df0ba770801d4c2329132..39acafbc84d6fa64475788023cb10a8a21a5a139 100644 (file)
@@ -2354,7 +2354,8 @@ static void gfx_v6_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 }
 
 static void gfx_v6_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                       unsigned vmid, uint64_t pd_addr)
+                                       unsigned vmid, unsigned pasid,
+                                       uint64_t pd_addr)
 {
        int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 
index 133245cd31aea487bf35b65139f0eafbcca1b8c7..e29c22a72764bf626606b2db399aa3bfbc88269d 100644 (file)
@@ -3239,7 +3239,8 @@ static void gfx_v7_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
  * using the CP (CIK).
  */
 static void gfx_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                       unsigned vmid, uint64_t pd_addr)
+                                       unsigned vmid, unsigned pasid,
+                                       uint64_t pd_addr)
 {
        int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 
index a4820edb1fdf0ad68f562bfa5dabcfa747fe7d70..3fd7eb2a9a7b0a31777c853a3ce9112f44c4e20f 100644 (file)
@@ -6328,7 +6328,8 @@ static void gfx_v8_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 }
 
 static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                       unsigned vmid, uint64_t pd_addr)
+                                       unsigned vmid, unsigned pasid,
+                                       uint64_t pd_addr)
 {
        int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 
index aaa990c5c0bb0ad77adc7fe6e4cb42b98da8b306..1f580328f571c2938bf545412437c413400530cd 100644 (file)
@@ -3684,7 +3684,8 @@ static void gfx_v9_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 }
 
 static void gfx_v9_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                       unsigned vmid, uint64_t pd_addr)
+                                       unsigned vmid, unsigned pasid,
+                                       uint64_t pd_addr)
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
index e9c74641ac0157e99eb20b1a6fcbdf91338e9d8e..c4de1c18bf7789d240f3d6c7631e13535fe14db0 100644 (file)
@@ -859,7 +859,8 @@ static void sdma_v2_4_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
  * using sDMA (VI).
  */
 static void sdma_v2_4_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                        unsigned vmid, uint64_t pd_addr)
+                                        unsigned vmid, unsigned pasid,
+                                        uint64_t pd_addr)
 {
        amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_SRBM_WRITE) |
                          SDMA_PKT_SRBM_WRITE_HEADER_BYTE_EN(0xf));
index b56f8dd93a4d2851d94061dd981aa6132d433493..3e22ae4c380224015a30e8a9f46b8e621f7860ac 100644 (file)
@@ -1125,7 +1125,8 @@ static void sdma_v3_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
  * using sDMA (VI).
  */
 static void sdma_v3_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                        unsigned vmid, uint64_t pd_addr)
+                                        unsigned vmid, unsigned pasid,
+                                        uint64_t pd_addr)
 {
        amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_SRBM_WRITE) |
                          SDMA_PKT_SRBM_WRITE_HEADER_BYTE_EN(0xf));
index 892ec22142aec487706af66214a90e04d6ade272..f0b10cb6394037bae594b769ac545e3261d409ac 100644 (file)
@@ -1133,7 +1133,8 @@ static void sdma_v4_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
  * using sDMA (VEGA10).
  */
 static void sdma_v4_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                        unsigned vmid, uint64_t pd_addr)
+                                        unsigned vmid, unsigned pasid,
+                                        uint64_t pd_addr)
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gmc.gmc_funcs->get_invalidate_req(vmid);
index 54e7a12eb50ee5a6c744276ece60cfedc8a9b632..697475a257498135f230bc88be738c426305ce96 100644 (file)
@@ -473,7 +473,8 @@ static void si_dma_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
  * using sDMA (VI).
  */
 static void si_dma_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                     unsigned vmid, uint64_t pd_addr)
+                                     unsigned vmid, unsigned pasid,
+                                     uint64_t pd_addr)
 {
        amdgpu_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0, 0));
        if (vmid < 8)
index b2bfedaf57f197b38e98dce034d12c1d3359ca64..8c4f1f402395db5e60dfcb3c03d4837e8ac88bb7 100644 (file)
@@ -1073,7 +1073,8 @@ static void uvd_v6_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
 }
 
 static void uvd_v6_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                        unsigned vmid, uint64_t pd_addr)
+                                       unsigned vmid, unsigned pasid,
+                                       uint64_t pd_addr)
 {
        uint32_t reg;
 
@@ -1140,7 +1141,8 @@ static void uvd_v6_0_enc_ring_insert_end(struct amdgpu_ring *ring)
 }
 
 static void uvd_v6_0_enc_ring_emit_vm_flush(struct amdgpu_ring *ring,
-        unsigned int vmid, uint64_t pd_addr)
+                                           unsigned int vmid, unsigned pasid,
+                                           uint64_t pd_addr)
 {
        amdgpu_ring_write(ring, HEVC_ENC_CMD_UPDATE_PTB);
        amdgpu_ring_write(ring, vmid);
index 4c19c96a8e59bab579b0d8ac60372c561dcdfdc7..44f1a3dde4d60b1828066b4c734b598e9cdcb95f 100644 (file)
@@ -1291,7 +1291,8 @@ static void uvd_v7_0_vm_reg_wait(struct amdgpu_ring *ring,
 }
 
 static void uvd_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                       unsigned vmid, uint64_t pd_addr)
+                                       unsigned vmid, unsigned pasid,
+                                       uint64_t pd_addr)
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gmc.gmc_funcs->get_invalidate_req(vmid);
@@ -1343,7 +1344,8 @@ static void uvd_v7_0_enc_ring_insert_end(struct amdgpu_ring *ring)
 }
 
 static void uvd_v7_0_enc_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                        unsigned int vmid, uint64_t pd_addr)
+                                           unsigned int vmid, unsigned pasid,
+                                           uint64_t pd_addr)
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gmc.gmc_funcs->get_invalidate_req(vmid);
index a5355eb689f145a81ec8296d8cfdcc27600b0012..6d616015085bd410f19c6085137d24ab33d2c907 100644 (file)
@@ -844,7 +844,8 @@ static void vce_v3_0_ring_emit_ib(struct amdgpu_ring *ring,
 }
 
 static void vce_v3_0_emit_vm_flush(struct amdgpu_ring *ring,
-                        unsigned int vmid, uint64_t pd_addr)
+                                  unsigned int vmid, unsigned pasid,
+                                  uint64_t pd_addr)
 {
        amdgpu_ring_write(ring, VCE_CMD_UPDATE_PTB);
        amdgpu_ring_write(ring, vmid);
index 071fb17810d846c7f8d0d1a24154543950a63b78..a54e88821de3a86a32e8d7070173362a76701f35 100755 (executable)
@@ -965,7 +965,8 @@ static void vce_v4_0_ring_insert_end(struct amdgpu_ring *ring)
 }
 
 static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
-                        unsigned int vmid, uint64_t pd_addr)
+                                  unsigned int vmid, unsigned pasid,
+                                  uint64_t pd_addr)
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gmc.gmc_funcs->get_invalidate_req(vmid);
index 659a8f2d9bf8b8e35b44c573fa6dcadf34649b8f..85a0ecaba3e3ffb792f065a939bf014155e7386d 100644 (file)
@@ -888,7 +888,8 @@ static void vcn_v1_0_dec_vm_reg_wait(struct amdgpu_ring *ring,
 }
 
 static void vcn_v1_0_dec_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                                       unsigned vmid, uint64_t pd_addr)
+                                           unsigned vmid, unsigned pasid,
+                                           uint64_t pd_addr)
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gmc.gmc_funcs->get_invalidate_req(vmid);
@@ -1021,7 +1022,8 @@ static void vcn_v1_0_enc_ring_emit_ib(struct amdgpu_ring *ring,
 }
 
 static void vcn_v1_0_enc_ring_emit_vm_flush(struct amdgpu_ring *ring,
-                        unsigned int vmid, uint64_t pd_addr)
+                                           unsigned int vmid, unsigned pasid,
+                                           uint64_t pd_addr)
 {
        struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->funcs->vmhub];
        uint32_t req = ring->adev->gmc.gmc_funcs->get_invalidate_req(vmid);