[PATCH 07/10] drm/amdgpu: move setting the job resources
Luben Tuikov
luben.tuikov at amd.com
Thu Jul 14 15:40:35 UTC 2022
Reviewed-by: Luben Tuikov <luben.tuikov at amd.com>
On 2022-07-14 06:38, Christian König wrote:
> Move setting the job resources into amdgpu_job.c
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 21 ++-------------------
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 17 +++++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++
> 3 files changed, 21 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index dfb7b4f46bc3..88f491dc7ca2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -828,9 +828,6 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
> struct amdgpu_vm *vm = &fpriv->vm;
> struct amdgpu_bo_list_entry *e;
> struct list_head duplicates;
> - struct amdgpu_bo *gds;
> - struct amdgpu_bo *gws;
> - struct amdgpu_bo *oa;
> int r;
>
> INIT_LIST_HEAD(&p->validated);
> @@ -947,22 +944,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
> amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
> p->bytes_moved_vis);
>
> - gds = p->bo_list->gds_obj;
> - gws = p->bo_list->gws_obj;
> - oa = p->bo_list->oa_obj;
> -
> - if (gds) {
> - p->job->gds_base = amdgpu_bo_gpu_offset(gds) >> PAGE_SHIFT;
> - p->job->gds_size = amdgpu_bo_size(gds) >> PAGE_SHIFT;
> - }
> - if (gws) {
> - p->job->gws_base = amdgpu_bo_gpu_offset(gws) >> PAGE_SHIFT;
> - p->job->gws_size = amdgpu_bo_size(gws) >> PAGE_SHIFT;
> - }
> - if (oa) {
> - p->job->oa_base = amdgpu_bo_gpu_offset(oa) >> PAGE_SHIFT;
> - p->job->oa_size = amdgpu_bo_size(oa) >> PAGE_SHIFT;
> - }
> + amdgpu_job_set_resources(p->job, p->bo_list->gds_obj,
> + p->bo_list->gws_obj, p->bo_list->oa_obj);
>
> if (p->uf_entry.tv.bo) {
> struct amdgpu_bo *uf = ttm_to_amdgpu_bo(p->uf_entry.tv.bo);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 36c1be77bf8f..3255b2fca611 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -129,6 +129,23 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,
> return r;
> }
>
> +void amdgpu_job_set_resources(struct amdgpu_job *job, struct amdgpu_bo *gds,
> + struct amdgpu_bo *gws, struct amdgpu_bo *oa)
> +{
> + if (gds) {
> + job->gds_base = amdgpu_bo_gpu_offset(gds) >> PAGE_SHIFT;
> + job->gds_size = amdgpu_bo_size(gds) >> PAGE_SHIFT;
> + }
> + if (gws) {
> + job->gws_base = amdgpu_bo_gpu_offset(gws) >> PAGE_SHIFT;
> + job->gws_size = amdgpu_bo_size(gws) >> PAGE_SHIFT;
> + }
> + if (oa) {
> + job->oa_base = amdgpu_bo_gpu_offset(oa) >> PAGE_SHIFT;
> + job->oa_size = amdgpu_bo_size(oa) >> PAGE_SHIFT;
> + }
> +}
> +
> void amdgpu_job_free_resources(struct amdgpu_job *job)
> {
> struct amdgpu_ring *ring = to_amdgpu_ring(job->base.sched);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
> index d599c0540b46..0bab8fe0d419 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
> @@ -77,6 +77,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
> struct amdgpu_job **job, struct amdgpu_vm *vm);
> int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,
> enum amdgpu_ib_pool_type pool, struct amdgpu_job **job);
> +void amdgpu_job_set_resources(struct amdgpu_job *job, struct amdgpu_bo *gds,
> + struct amdgpu_bo *gws, struct amdgpu_bo *oa);
> void amdgpu_job_free_resources(struct amdgpu_job *job);
> void amdgpu_job_free(struct amdgpu_job *job);
> int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,
Regards,
--
Luben
More information about the amd-gfx
mailing list