[PATCH v2] drm/amdgpu: implement more ib pools
Pan, Xinhui
Xinhui.Pan at amd.com
Fri Mar 27 09:44:25 UTC 2020
> 2020年3月27日 16:24,Koenig, Christian <Christian.Koenig at amd.com> 写道:
>
> Am 27.03.20 um 04:08 schrieb xinhui pan:
>> We have three ib pools, they are normal, VM, direct pools.
>>
>> Any jobs which schedule IBs without dependence on gpu scheduler should
>> use DIRECT pool.
>>
>> Any jobs schedule direct VM update IBs should use VM pool.
>>
>> Any other jobs use NORMAL pool.
>>
>> Signed-off-by: xinhui pan <xinhui.pan at amd.com>
>
> Two more coding style suggestions below, with those fixed feel free to add a Reviewed-by: Christian König <christian.koenig at amd.com>.
>
> But in general your function parameter indentation is sometimes off. Not much of an issue, but what editor and settings are you using?
I use vim with
set tabstop=4
set shiftwidth=4
But this now I use sed to replace some code.
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 +++++-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 41 +++++++++++++++------
>> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 ++-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 4 +-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++--
>> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 6 ++-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 +++--
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 6 ++-
>> drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 ++-
>> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 6 ++-
>> drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +-
>> drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/si_dma.c | 3 +-
>> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 6 ++-
>> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 ++-
>> 25 files changed, 103 insertions(+), 49 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 7dd74253e7b6..649bf5b8ea4e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -390,6 +390,13 @@ struct amdgpu_sa_bo {
>> int amdgpu_fence_slab_init(void);
>> void amdgpu_fence_slab_fini(void);
>> +enum amdgpu_ib_pool_type {
>> + AMDGPU_IB_POOL_NORMAL = 0,
>> + AMDGPU_IB_POOL_VM,
>> + AMDGPU_IB_POOL_DIRECT,
>> +
>> + AMDGPU_IB_POOL_MAX
>> +};
>> /*
>> * IRQS.
>> */
>> @@ -441,7 +448,8 @@ struct amdgpu_fpriv {
>> int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv);
>> int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>> - unsigned size, struct amdgpu_ib *ib);
>> + unsigned size, struct amdgpu_ib *ib,
>> + enum amdgpu_ib_pool_type pool);
>> void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib,
>> struct dma_fence *f);
>> int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
>> @@ -848,7 +856,7 @@ struct amdgpu_device {
>> unsigned num_rings;
>> struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];
>> bool ib_pool_ready;
>> - struct amdgpu_sa_manager ring_tmp_bo;
>> + struct amdgpu_sa_manager ring_tmp_bo[AMDGPU_IB_POOL_MAX];
>> /* interrupts */
>> struct amdgpu_irq irq;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 59ec5e2be211..0f26668ae6f7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -921,7 +921,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
>> ring = to_amdgpu_ring(entity->rq->sched);
>> r = amdgpu_ib_get(adev, vm, ring->funcs->parse_cs ?
>> - chunk_ib->ib_bytes : 0, ib);
>> + chunk_ib->ib_bytes : 0, ib, AMDGPU_IB_POOL_NORMAL);
>> if (r) {
>> DRM_ERROR("Failed to get ib !\n");
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> index bece01f1cf09..0bfcd30df051 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
>> @@ -61,12 +61,13 @@
>> * Returns 0 on success, error on failure.
>> */
>> int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>> - unsigned size, struct amdgpu_ib *ib)
>> + unsigned size, struct amdgpu_ib *ib,
>> + enum amdgpu_ib_pool_type pool_type)
>
> I would put the ib last in the parameter list since it is the resulting object.
>
>> {
>> int r;
>> if (size) {
>> - r = amdgpu_sa_bo_new(&adev->ring_tmp_bo,
>> + r = amdgpu_sa_bo_new(&adev->ring_tmp_bo[pool_type],
>> &ib->sa_bo, size, 256);
>> if (r) {
>> dev_err(adev->dev, "failed to get a new IB (%d)\n", r);
>> @@ -297,19 +298,27 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
>> */
>> int amdgpu_ib_pool_init(struct amdgpu_device *adev)
>> {
>> - int r;
>> + int r, i;
>> + unsigned size;
>> if (adev->ib_pool_ready) {
>> return 0;
>> }
>> - r = amdgpu_sa_bo_manager_init(adev, &adev->ring_tmp_bo,
>> - AMDGPU_IB_POOL_SIZE*64*1024,
>> - AMDGPU_GPU_PAGE_SIZE,
>> - AMDGPU_GEM_DOMAIN_GTT);
>> - if (r) {
>> - return r;
>> + for (i = 0; i < AMDGPU_IB_POOL_MAX; i++) {
>> + if (i == AMDGPU_IB_POOL_DIRECT)
>> + size = PAGE_SIZE * 2;
>> + else
>> + size = AMDGPU_IB_POOL_SIZE*64*1024;
>> + r = amdgpu_sa_bo_manager_init(adev, &adev->ring_tmp_bo[i],
>> + size,
>> + AMDGPU_GPU_PAGE_SIZE,
>> + AMDGPU_GEM_DOMAIN_GTT);
>> + if (r) {
>> + for (i--; i >= 0; i--)
>> + amdgpu_sa_bo_manager_fini(adev, &adev->ring_tmp_bo[i]);
>> + return r;
>> + }
>> }
>> -
>> adev->ib_pool_ready = true;
>> return 0;
>> @@ -325,8 +334,11 @@ int amdgpu_ib_pool_init(struct amdgpu_device *adev)
>> */
>> void amdgpu_ib_pool_fini(struct amdgpu_device *adev)
>> {
>> + int i;
>> +
>> if (adev->ib_pool_ready) {
>> - amdgpu_sa_bo_manager_fini(adev, &adev->ring_tmp_bo);
>> + for (i = 0; i < AMDGPU_IB_POOL_MAX; i++)
>> + amdgpu_sa_bo_manager_fini(adev, &adev->ring_tmp_bo[i]);
>> adev->ib_pool_ready = false;
>> }
>> }
>> @@ -423,7 +435,12 @@ static int amdgpu_debugfs_sa_info(struct seq_file *m, void *data)
>> struct drm_device *dev = node->minor->dev;
>> struct amdgpu_device *adev = dev->dev_private;
>> - amdgpu_sa_bo_dump_debug_info(&adev->ring_tmp_bo, m);
>> + seq_printf(m, "-------------------- NORMAL -------------------- \n");
>> + amdgpu_sa_bo_dump_debug_info(&adev->ring_tmp_bo[AMDGPU_IB_POOL_NORMAL], m);
>> + seq_printf(m, "---------------------- VM ---------------------- \n");
>> + amdgpu_sa_bo_dump_debug_info(&adev->ring_tmp_bo[AMDGPU_IB_POOL_VM], m);
>> + seq_printf(m, "-------------------- DIRECT--------------------- \n");
>> + amdgpu_sa_bo_dump_debug_info(&adev->ring_tmp_bo[AMDGPU_IB_POOL_DIRECT], m);
>> return 0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> index 4981e443a884..ad427d4de5e0 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
>> @@ -87,7 +87,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
>> }
>> int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,
>> - struct amdgpu_job **job)
>> + struct amdgpu_job **job,
>> + enum amdgpu_ib_pool_type pool_type)
>
> Same here, job is the resulting object and should come last in the parameter list.
>
>> {
>> int r;
>> @@ -95,7 +96,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,
>> if (r)
>> return r;
>> - r = amdgpu_ib_get(adev, NULL, size, &(*job)->ibs[0]);
>> + r = amdgpu_ib_get(adev, NULL, size, &(*job)->ibs[0], pool_type);
>> if (r)
>> kfree(*job);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
>> index 2e2110dddb76..6295f49c35a6 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
>> @@ -38,6 +38,7 @@
>> #define AMDGPU_JOB_GET_VMID(job) ((job) ? (job)->vmid : 0)
>> struct amdgpu_fence;
>> +enum amdgpu_ib_pool_type;
>> struct amdgpu_job {
>> struct drm_sched_job base;
>> @@ -66,8 +67,7 @@ struct amdgpu_job {
>> 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,
>> - struct amdgpu_job **job);
>> -
>> + struct amdgpu_job **job, enum amdgpu_ib_pool_type pool);
>> 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,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
>> index 5727f00afc8e..07af4ddae9e9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
>> @@ -144,7 +144,8 @@ static int amdgpu_jpeg_dec_set_reg(struct amdgpu_ring *ring, uint32_t handle,
>> const unsigned ib_size_dw = 16;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index e192557db421..be74bfa2fc05 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -2062,7 +2062,8 @@ static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
>> num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
>> num_bytes = num_pages * 8;
>> - r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes, &job);
>> + r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes, &job,
>> + AMDGPU_IB_POOL_NORMAL);
>> if (r)
>> return r;
>> @@ -2124,7 +2125,8 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
>> num_loops = DIV_ROUND_UP(byte_count, max_bytes);
>> num_dw = ALIGN(num_loops * adev->mman.buffer_funcs->copy_num_dw, 8);
>> - r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job,
>> + direct_submit ? AMDGPU_IB_POOL_DIRECT : AMDGPU_IB_POOL_NORMAL);
>> if (r)
>> return r;
>> @@ -2213,7 +2215,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
>> /* for IB padding */
>> num_dw += 64;
>> - r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(adev, num_dw * 4, &job, AMDGPU_IB_POOL_NORMAL);
>> if (r)
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> index 5fd32ad1c575..55b2e3dc6abb 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> @@ -1056,7 +1056,8 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
>> goto err;
>> }
>> - r = amdgpu_job_alloc_with_ib(adev, 64, &job);
>> + r = amdgpu_job_alloc_with_ib(adev, 64, &job,
>> + direct ? AMDGPU_IB_POOL_DIRECT : AMDGPU_IB_POOL_NORMAL);
>> if (r)
>> goto err;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> index 59ddba137946..deaf253743ec 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> @@ -446,7 +446,8 @@ static int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>> @@ -524,7 +525,8 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
>> struct dma_fence *f = NULL;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + direct ? AMDGPU_IB_POOL_DIRECT : AMDGPU_IB_POOL_NORMAL);
>> if (r)
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> index a41272fbcba2..c3006a9efa73 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
>> @@ -390,7 +390,8 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(adev, 64, &job);
>> + r = amdgpu_job_alloc_with_ib(adev, 64, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err;
>> @@ -557,7 +558,8 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>> @@ -610,7 +612,8 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
>> index d30d103e48a2..7ebbe869c28c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
>> @@ -64,7 +64,8 @@ static int amdgpu_vm_sdma_prepare(struct amdgpu_vm_update_params *p,
>> unsigned int ndw = AMDGPU_VM_SDMA_MIN_NUM_DW;
>> int r;
>> - r = amdgpu_job_alloc_with_ib(p->adev, ndw * 4, &p->job);
>> + r = amdgpu_job_alloc_with_ib(p->adev, ndw * 4, &p->job,
>> + p->direct ? AMDGPU_IB_POOL_VM : AMDGPU_IB_POOL_NORMAL);
>> if (r)
>> return r;
>> @@ -225,7 +226,8 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,
>> ndw = max(ndw, AMDGPU_VM_SDMA_MIN_NUM_DW);
>> ndw = min(ndw, AMDGPU_VM_SDMA_MAX_NUM_DW);
>> - r = amdgpu_job_alloc_with_ib(p->adev, ndw * 4, &p->job);
>> + r = amdgpu_job_alloc_with_ib(p->adev, ndw * 4, &p->job,
>> + p->direct ? AMDGPU_IB_POOL_VM : AMDGPU_IB_POOL_NORMAL);
>> if (r)
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
>> index 4274ccf765de..dfa8a9613c35 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
>> @@ -679,7 +679,8 @@ static int cik_sdma_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> tmp = 0xCAFEDEAD;
>> adev->wb.wb[index] = cpu_to_le32(tmp);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
>> index 1d37db0d4595..dcd4680ee56b 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
>> @@ -557,7 +557,8 @@ static int gfx_v10_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> gpu_addr = adev->wb.gpu_addr + (index * 4);
>> adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 16, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 16, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err1;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
>> index 31f44d05e606..194694cc43be 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
>> @@ -1914,7 +1914,8 @@ static int gfx_v6_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> WREG32(scratch, 0xCAFEDEAD);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err1;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
>> index 733d398c61cc..3db2bda2393e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
>> @@ -2364,7 +2364,8 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> WREG32(scratch, 0xCAFEDEAD);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err1;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
>> index fc32586ef80b..e3c107827fe9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
>> @@ -888,7 +888,8 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> gpu_addr = adev->wb.gpu_addr + (index * 4);
>> adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 16, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 16, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err1;
>> @@ -1550,7 +1551,8 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
>> /* allocate an indirect buffer to put the commands in */
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, total_size, &ib);
>> + r = amdgpu_ib_get(adev, NULL, total_size, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r) {
>> DRM_ERROR("amdgpu: failed to get ib (%d).\n", r);
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> index fb567cf5671b..b76e34ac6a74 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> @@ -1082,7 +1082,8 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> gpu_addr = adev->wb.gpu_addr + (index * 4);
>> adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 16, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 16, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err1;
>> @@ -4485,7 +4486,8 @@ static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
>> /* allocate an indirect buffer to put the commands in */
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, total_size, &ib);
>> + r = amdgpu_ib_get(adev, NULL, total_size, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r) {
>> DRM_ERROR("amdgpu: failed to get ib (%d).\n", r);
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
>> index 9775eca6fe43..91c50c0d7081 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
>> @@ -369,7 +369,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
>> * translation. Avoid this by doing the invalidation from the SDMA
>> * itself.
>> */
>> - r = amdgpu_job_alloc_with_ib(adev, 16 * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(adev, 16 * 4, &job, AMDGPU_IB_POOL_VM);
>> if (r)
>> goto error_alloc;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
>> index fd7fa6082563..01b3d6c7720d 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
>> @@ -614,7 +614,8 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> tmp = 0xCAFEDEAD;
>> adev->wb.wb[index] = cpu_to_le32(tmp);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
>> index 4a8a7f0f3a9c..5c3cf7426193 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
>> @@ -886,7 +886,8 @@ static int sdma_v3_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> tmp = 0xCAFEDEAD;
>> adev->wb.wb[index] = cpu_to_le32(tmp);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
>> index fc664ec6b5fd..9096a835027e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
>> @@ -1539,7 +1539,8 @@ static int sdma_v4_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> tmp = 0xCAFEDEAD;
>> adev->wb.wb[index] = cpu_to_le32(tmp);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
>> index 013e9c05bba5..d6b997472972 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
>> @@ -948,7 +948,8 @@ static int sdma_v5_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> tmp = 0xCAFEDEAD;
>> adev->wb.wb[index] = cpu_to_le32(tmp);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r) {
>> DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
>> goto err0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c
>> index 7f64d73043cf..20dedcb0ddcc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/si_dma.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c
>> @@ -267,7 +267,8 @@ static int si_dma_ring_test_ib(struct amdgpu_ring *ring, long timeout)
>> tmp = 0xCAFEDEAD;
>> adev->wb.wb[index] = cpu_to_le32(tmp);
>> memset(&ib, 0, sizeof(ib));
>> - r = amdgpu_ib_get(adev, NULL, 256, &ib);
>> + r = amdgpu_ib_get(adev, NULL, 256, &ib,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> goto err0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
>> index e0aadcaf6c8b..fbddac3fdb38 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
>> @@ -216,7 +216,8 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>> @@ -279,7 +280,8 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
>> index 20f10a5617ca..a3da9ac7c511 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
>> @@ -224,7 +224,8 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>> @@ -286,7 +287,8 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handl
>> uint64_t addr;
>> int i, r;
>> - r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
>> + r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job,
>> + AMDGPU_IB_POOL_DIRECT);
>> if (r)
>> return r;
>>
>
More information about the amd-gfx
mailing list