[PATCH 7/9] drm/amdgpu: Add csa mc address into job structure

Rex Zhu
2018-12-06T11:32:35Z

save csa mc address in the job, so can patch the
address to pm4 when emit_ib even the ctx was freed.

suggested by Christian.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 6f7a2dd..13f0d7c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -230,6 +230,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
goto free_all_kdata;
}

+ p->job->csa_mc_addr = amdgpu_csa_vaddr(p->adev, p->ctx->resv_space_id) & AMDGPU_GMC_HOLE_MASK;
+
if (p->uf_entry.tv.bo)
p->job->uf_addr = uf_offset;
kfree(chunk_array);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
index e1b46a6..42c959d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
@@ -34,6 +34,7 @@
container_of((sched_job), struct amdgpu_job, base)

#define AMDGPU_JOB_GET_VMID(job) ((job) ? (job)->vmid : 0)
+#define AMDGPU_JOB_GET_CSA_MC_ADDR(job) ((job) ? (job)->csa_mc_addr : 0)

struct amdgpu_fence;

@@ -56,10 +57,11 @@ struct amdgpu_job {
uint32_t oa_base, oa_size;
uint32_t vram_lost_counter;

+ /* csa buffer mc address */
+ uint64_t csa_mc_addr;
/* user fence handling */
uint64_t uf_addr;
uint64_t uf_sequence;
-
};

int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,