drm/amdgpu: move job parameter to the end in amdgpu_job_alloc() and *_with_ib()

Move the job output parameter to be the last parameter in the
amdgpu_job_alloc() and amdgpu_job_alloc_with_ib() function signature. This
aligns with the common kernel coding convention where output parameters
typically come last.

Assisted-by: Claude:Sonnet 4
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Christian König
2026-05-08 21:00:08 +02:00
committed by Alex Deucher
parent fa99528ce5
commit ba4af3ca26
15 changed files with 57 additions and 42 deletions

View File

@@ -711,7 +711,7 @@ int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
goto err;
}
ret = amdgpu_job_alloc(adev, NULL, NULL, NULL, 1, &job, 0);
ret = amdgpu_job_alloc(adev, NULL, NULL, NULL, 1, 0, &job);
if (ret)
goto err;

View File

@@ -267,8 +267,8 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
for (i = 0; i < p->gang_size; ++i) {
ret = amdgpu_job_alloc(p->adev, vm, p->entities[i], vm,
num_ibs[i], &p->jobs[i],
p->filp->client_id);
num_ibs[i], p->filp->client_id,
&p->jobs[i]);
if (ret)
goto free_all_kdata;
switch (p->adev->enforce_isolation[fpriv->xcp_id]) {

View File

@@ -1713,8 +1713,9 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
owner = (void *)(unsigned long)atomic_inc_return(&counter);
r = amdgpu_job_alloc_with_ib(ring->adev, &entity, owner,
ib_size_dw * sizeof(uint32_t), 0, &job,
AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER);
ib_size_dw * sizeof(uint32_t), 0,
AMDGPU_KERNEL_JOB_ID_CLEANER_SHADER,
&job);
if (r)
goto err;

View File

@@ -761,7 +761,8 @@ void amdgpu_gmc_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
r = amdgpu_job_alloc_with_ib(ring->adev, &adev->mman.default_entity.base,
AMDGPU_FENCE_OWNER_UNDEFINED,
16 * 4, AMDGPU_IB_POOL_IMMEDIATE,
&job, AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB);
AMDGPU_KERNEL_JOB_ID_FLUSH_GPU_TLB,
&job);
if (r)
goto error_alloc;

View File

@@ -198,8 +198,8 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)
int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct drm_sched_entity *entity, void *owner,
unsigned int num_ibs, struct amdgpu_job **job,
u64 drm_client_id)
unsigned int num_ibs, u64 drm_client_id,
struct amdgpu_job **job)
{
struct amdgpu_fence *af;
int r;
@@ -252,12 +252,12 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev,
struct drm_sched_entity *entity, void *owner,
size_t size, enum amdgpu_ib_pool_type pool_type,
struct amdgpu_job **job, u64 k_job_id)
u64 k_job_id, struct amdgpu_job **job)
{
int r;
r = amdgpu_job_alloc(adev, NULL, entity, owner, 1, job,
k_job_id);
r = amdgpu_job_alloc(adev, NULL, entity, owner, 1, k_job_id,
job);
if (r)
return r;

View File

@@ -115,13 +115,13 @@ static inline struct amdgpu_ring *amdgpu_job_ring(struct amdgpu_job *job)
int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
struct drm_sched_entity *entity, void *owner,
unsigned int num_ibs, struct amdgpu_job **job,
u64 drm_client_id);
unsigned int num_ibs, u64 drm_client_id,
struct amdgpu_job **job);
int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev,
struct drm_sched_entity *entity, void *owner,
size_t size, enum amdgpu_ib_pool_type pool_type,
struct amdgpu_job **job,
u64 k_job_id);
u64 k_job_id,
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);

View File

@@ -197,8 +197,9 @@ static int amdgpu_jpeg_dec_set_reg(struct amdgpu_ring *ring, uint32_t handle,
int i, r;
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL, ib_size_dw * 4,
AMDGPU_IB_POOL_DIRECT, &job,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_IB_POOL_DIRECT,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;

View File

@@ -244,8 +244,9 @@ static int amdgpu_ttm_map_buffer(struct amdgpu_ttm_buffer_entity *entity,
r = amdgpu_job_alloc_with_ib(adev, &entity->base,
AMDGPU_FENCE_OWNER_UNDEFINED,
num_dw * 4 + num_bytes,
AMDGPU_IB_POOL_DELAYED, &job,
AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER);
AMDGPU_IB_POOL_DELAYED,
AMDGPU_KERNEL_JOB_ID_TTM_MAP_BUFFER,
&job);
if (r)
return r;
@@ -1592,8 +1593,8 @@ static int amdgpu_ttm_access_memory_sdma(struct ttm_buffer_object *bo,
r = amdgpu_job_alloc_with_ib(adev, &adev->mman.default_entity.base,
AMDGPU_FENCE_OWNER_UNDEFINED,
num_dw * 4, AMDGPU_IB_POOL_DELAYED,
&job,
AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA);
AMDGPU_KERNEL_JOB_ID_TTM_ACCESS_MEMORY_SDMA,
&job);
if (r)
goto out;
@@ -2443,7 +2444,7 @@ static int amdgpu_ttm_prepare_job(struct amdgpu_device *adev,
int r;
r = amdgpu_job_alloc_with_ib(adev, &entity->base,
AMDGPU_FENCE_OWNER_UNDEFINED,
num_dw * 4, pool, job, k_job_id);
num_dw * 4, pool, k_job_id, job);
if (r)
return r;

View File

@@ -1165,8 +1165,9 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
r = amdgpu_job_alloc_with_ib(ring->adev, &adev->uvd.entity,
AMDGPU_FENCE_OWNER_UNDEFINED,
64, direct ? AMDGPU_IB_POOL_DIRECT :
AMDGPU_IB_POOL_DELAYED, &job,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_IB_POOL_DELAYED,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;

View File

@@ -473,7 +473,8 @@ static int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
r = amdgpu_job_alloc_with_ib(ring->adev, &ring->adev->vce.entity,
AMDGPU_FENCE_OWNER_UNDEFINED,
ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
&job, AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;
@@ -564,8 +565,9 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
AMDGPU_FENCE_OWNER_UNDEFINED,
ib_size_dw * 4,
direct ? AMDGPU_IB_POOL_DIRECT :
AMDGPU_IB_POOL_DELAYED, &job,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_IB_POOL_DELAYED,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;

View File

@@ -629,7 +629,8 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
64, AMDGPU_IB_POOL_DIRECT,
&job, AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
goto err;
@@ -809,7 +810,8 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring,
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
&job, AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
goto err;
@@ -939,7 +941,8 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
&job, AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;
@@ -1006,7 +1009,8 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
&job, AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;

View File

@@ -56,7 +56,7 @@ static int amdgpu_vm_sdma_alloc_job(struct amdgpu_vm_update_params *p,
ndw = min(ndw, AMDGPU_VM_SDMA_MAX_NUM_DW);
r = amdgpu_job_alloc_with_ib(p->adev, entity, AMDGPU_FENCE_OWNER_VM,
ndw * 4, pool, &p->job, k_job_id);
ndw * 4, pool, k_job_id, &p->job);
if (r)
return r;

View File

@@ -217,8 +217,9 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
int i, r;
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL, ib_size_dw * 4,
AMDGPU_IB_POOL_DIRECT, &job,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_IB_POOL_DIRECT,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;
@@ -282,8 +283,9 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
int i, r;
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL, ib_size_dw * 4,
AMDGPU_IB_POOL_DIRECT, &job,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_IB_POOL_DIRECT,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;

View File

@@ -225,8 +225,9 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, u32 handle,
int i, r;
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL, ib_size_dw * 4,
AMDGPU_IB_POOL_DIRECT, &job,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_IB_POOL_DIRECT,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;
@@ -289,8 +290,9 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, u32 handle,
int i, r;
r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL, ib_size_dw * 4,
AMDGPU_IB_POOL_DIRECT, &job,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST);
AMDGPU_IB_POOL_DIRECT,
AMDGPU_KERNEL_JOB_ID_VCN_RING_TEST,
&job);
if (r)
return r;

View File

@@ -68,8 +68,8 @@ svm_migrate_gart_map(struct amdgpu_ring *ring,
AMDGPU_FENCE_OWNER_UNDEFINED,
num_dw * 4 + num_bytes,
AMDGPU_IB_POOL_DELAYED,
&job,
AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP);
AMDGPU_KERNEL_JOB_ID_KFD_GART_MAP,
&job);
if (r)
return r;