drm/amdgpu: remove variable vm in function amdgpu_ib_schedule
Subsystems (2)
PATCH 1/1 drm/amdgpu: remove variable vm in function amdgpu_ib_schedule
use job && job->vm to check ib has vmid and use job && job->vmid to check if switch buffer should be emitted
Signed-off-by Lin.Cao <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -5
@@ -129,7 +129,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,struct amdgpu_ib *ib = &ibs[0 ];struct dma_fence *tmp =NULL ;bool need_ctx_switch; -struct amdgpu_vm *vm;uint64_t fence_ctx;uint32_t status =0 , alloc_size;unsigned int fence_flags =0 ;
@@ -147,7 +146,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,/* ring tests don't use a job */ if (job) { - vm = job->vm; fence_ctx = job->base.s_fence ? job->base.s_fence->scheduled.context :0 ; shadow_va = job->shadow_va;
@@ -155,7 +153,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs, gds_va = job->gds_va; init_shadow = job->init_shadow; }else { - vm =NULL ; fence_ctx =0 ; shadow_va =0 ; csa_va =0 ;
@@ -168,7 +165,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,return -EINVAL ; } -if (vm && !job->vmid && !ring->is_mes_queue) { +if (job && job->vm && !job->vmid && !ring->is_mes_queue) {dev_err (adev->dev,"VM IB without ID\n" );return -EINVAL ; }
@@ -297,7 +294,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,amdgpu_ring_patch_cond_exec (ring, cond_exec); ring->current_ctx = fence_ctx; -if (job && ring->funcs->emit_switch_buffer) +if (job && job->vmid && ring->funcs->emit_switch_buffer)amdgpu_ring_emit_switch_buffer (ring); if (ring->funcs->emit_wave_limit &&
Signature · 1 line
2.46.1
Christian König
maintainerAm 21.01.25 um 07:50 schrieb Lin.Cao:
Quoted 37 lines
use job &&
job->vmto check ib has vmid and use job &&job->vmidto check if switch buffer should be emittedSigned-off-by Lin.Cao <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-3@@ -129,7 +129,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,struct amdgpu_ib *ib = &ibs[0 ];struct dma_fence *tmp =NULL ;bool need_ctx_switch; -struct amdgpu_vm *vm;uint64_t fence_ctx;uint32_t status =0 , alloc_size;unsigned int fence_flags =0 ;@@ -147,7 +146,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,/* ring tests don't use a job */ if (job) { - vm = job->vm; fence_ctx = job->base.s_fence ? job->base.s_fence->scheduled.context :0 ; shadow_va = job->shadow_va;@@ -155,7 +153,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs, gds_va = job->gds_va; init_shadow = job->init_shadow; }else { - vm =NULL ; fence_ctx =0 ; shadow_va =0 ; csa_va =0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs, · line 168
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1@@ -168,7 +165,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,return -EINVAL ; } -if (vm && !job->vmid && !ring->is_mes_queue) { +if (job && job->vm && !job->vmid && !ring->is_mes_queue) {
That check here makes no sense any more since the VM is already cleared when that function is called.
Please completely remove this check since it is superfluous in the first place as far as I can see.
Regards,
Christian.
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1dev_err (adev->dev,"VM IB without ID\n" );return -EINVAL ; }@@ -297,7 +294,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,amdgpu_ring_patch_cond_exec (ring, cond_exec); ring->current_ctx = fence_ctx; -if (job && ring->funcs->emit_switch_buffer) +if (job && job->vmid && ring->funcs->emit_switch_buffer)amdgpu_ring_emit_switch_buffer (ring); if (ring->funcs->emit_wave_limit &&