aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
Commit message (Collapse)AuthorAgeFilesLines
* dma-buf: Rename struct fence to dma_fenceChris Wilson2016-10-251-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I plan to usurp the short name of struct fence for a core kernel struct, and so I need to rename the specialised fence/timeline for DMA operations to make room. A consensus was reached in https://lists.freedesktop.org/archives/dri-devel/2016-July/113083.html that making clear this fence applies to DMA operations was a good thing. Since then the patch has grown a bit as usage increases, so hopefully it remains a good thing! (v2...: rebase, rerun spatch) v3: Compile on msm, spotted a manual fixup that I broke. v4: Try again for msm, sorry Daniel coccinelle script: @@ @@ - struct fence + struct dma_fence @@ @@ - struct fence_ops + struct dma_fence_ops @@ @@ - struct fence_cb + struct dma_fence_cb @@ @@ - struct fence_array + struct dma_fence_array @@ @@ - enum fence_flag_bits + enum dma_fence_flag_bits @@ @@ ( - fence_init + dma_fence_init | - fence_release + dma_fence_release | - fence_free + dma_fence_free | - fence_get + dma_fence_get | - fence_get_rcu + dma_fence_get_rcu | - fence_put + dma_fence_put | - fence_signal + dma_fence_signal | - fence_signal_locked + dma_fence_signal_locked | - fence_default_wait + dma_fence_default_wait | - fence_add_callback + dma_fence_add_callback | - fence_remove_callback + dma_fence_remove_callback | - fence_enable_sw_signaling + dma_fence_enable_sw_signaling | - fence_is_signaled_locked + dma_fence_is_signaled_locked | - fence_is_signaled + dma_fence_is_signaled | - fence_is_later + dma_fence_is_later | - fence_later + dma_fence_later | - fence_wait_timeout + dma_fence_wait_timeout | - fence_wait_any_timeout + dma_fence_wait_any_timeout | - fence_wait + dma_fence_wait | - fence_context_alloc + dma_fence_context_alloc | - fence_array_create + dma_fence_array_create | - to_fence_array + to_dma_fence_array | - fence_is_array + dma_fence_is_array | - trace_fence_emit + trace_dma_fence_emit | - FENCE_TRACE + DMA_FENCE_TRACE | - FENCE_WARN + DMA_FENCE_WARN | - FENCE_ERR + DMA_FENCE_ERR ) ( ... ) Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Gustavo Padovan <[email protected]> Acked-by: Sumit Semwal <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/amdgpu: mark symbols static where possibleBaoyou Xie2016-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | We get a few warnings when building kernel with W=1: drivers/gpu/drm/amd/amdgpu/cz_smc.c:51:5: warning: no previous prototype for 'cz_send_msg_to_smc_async' [-Wmissing-prototypes] drivers/gpu/drm/amd/amdgpu/cz_smc.c:143:5: warning: no previous prototype for 'cz_write_smc_sram_dword' [-Wmissing-prototypes] drivers/gpu/drm/amd/amdgpu/iceland_smc.c:124:6: warning: no previous prototype for 'iceland_start_smc' [-Wmissing-prototypes] drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:3926:6: warning: no previous prototype for 'gfx_v8_0_rlc_stop' [-Wmissing-prototypes] drivers/gpu/drm/amd/amdgpu/amdgpu_job.c:94:6: warning: no previous prototype for 'amdgpu_job_free_cb' [-Wmissing-prototypes] .... In fact, these functions are only used in the file in which they are declared and don't need a declaration, but can be made static. So this patch marks these functions with 'static'. Reviewed-by: Christian König <[email protected]> Acked-by: Huang Rui <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Signed-off-by: Baoyou Xie <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: change job->ctx field nameMonk Liu2016-09-121-1/+1
| | | | | | | | | | | job->ctx actually is a fence_context of the entity it belongs to, naming it as ctx is too vague, and we'll need add amdgpu_ctx into the job structure later. Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: cleanup hw reference handling in the IB testsChristian König2016-07-141-5/+3
| | | | | | | | Reference should be taken when we make the assignment, not anywhere else. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add a bool to specify if needing vm flush V2Chunming Zhou2016-07-071-1/+1
| | | | | | | | | | which avoids job->vm_pd_addr be changed. V2: pass job structure to amdgpu_vm_grab_id and amdgpu_vm_flush directly. Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: put old hw fence of job if gpu resetChunming Zhou2016-07-071-0/+2
| | | | | | Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove fence parameter from amd_sched_job_initChristian König2016-07-071-3/+2
| | | | | | | | | We return the fence as part of the job structur anyway, no need to do this twice. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: earlier free SA resourcesChristian König2016-07-071-2/+2
| | | | | | | | Keep the time we don't have a fence associated with the resource smaller. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: shorten amdgpu_job_free_resourcesChristian König2016-07-071-3/+5
| | | | | | | | The fence and the sync object are not hardware resources. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix user fence handling once moreChristian König2016-07-071-1/+0
| | | | | | | | | | | | Same problem as with the VM page tables. The user fence address must be determined before the job is scheduled, not when the IB is executed. This fixes a security problem where user fences could be used to overwrite any part of VRAM. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use a fence array for VMID managementChristian König2016-07-071-1/+1
| | | | | | | | | | Just wait for any fence to become available, instead of waiting for the last entry of the LRU. Acked-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Acked-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add optional ring to amdgpu_sync_is_idleChristian König2016-07-071-1/+1
| | | | | | | | | Check if the sync object is idle depending on the ring a submission works with. Acked-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Acked-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove amdgpu_sync_waitChristian König2016-07-071-5/+1
| | | | | | | | | | Stop hiding bugs, instead print a proper error when the scheduler doesn't handle all dependencies. Acked-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Acked-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: generalize the scheduler fenceChristian König2016-07-071-2/+2
| | | | | | | | | Make it two events, one for the job being scheduled and one when it is finished. Acked-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Acked-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add gpu reset to timeout handlerChunming Zhou2016-07-071-0/+1
| | | | | | | | so that we could actually reset the GPU when it hangs. Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Junwei Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix and cleanup job destructionChristian König2016-07-071-13/+5
| | | | | | | | | Remove the job reference counting and just properly destroy it from a work item which blocks on any potential running timeout handler. Signed-off-by: Christian König <[email protected]> Reviewed-by: Monk.Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: properly abstract scheduler timeout handlingChristian König2016-07-071-7/+8
| | | | | | | | The driver shouldn't mess with the scheduler internals. Signed-off-by: Christian König <[email protected]> Reviewed-by: Monk.Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove use_shed hack in job cleanupChristian König2016-07-071-5/+8
| | | | | | | | | Remembering the code path in a variable to cleanup differently is usually not a good idea at all. Signed-off-by: Christian König <[email protected]> Reviewed-by: Monk.Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix coding style in amdgpu_job_freeChristian König2016-07-071-3/+4
| | | | | | | | | Ther should be a new line between code and decleration. Also use amdgpu_ib_free() instead of releasing the member manually. Signed-off-by: Christian König <[email protected]> Reviewed-by: Monk.Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove begin_job/finish_jobChristian König2016-07-071-2/+0
| | | | | | | | | Completely pointless and confusing to use a callback to call into the same code file. Signed-off-by: Christian König <[email protected]> Reviewed-by: Monk.Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix and cleanup user fence handling v2Christian König2016-05-111-1/+1
| | | | | | | | | | | We leaked the BO in the error pass, additional to that we only have one user fence for all IBs in a job. v2: remove white space changes Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move VM fields into jobChristian König2016-05-111-10/+2
| | | | | | | | They are the same for all IBs. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move the context from the IBs into the jobChristian König2016-05-111-4/+3
| | | | | | | | We only have one context for all IBs. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: keep vm in job instead of ib (v2)Monk Liu2016-05-111-4/+5
| | | | | | | | | | | | | | | | | | | | | | ib.vm is a legacy way to get vm, after scheduler implemented vm should be get from job, and all ibs from one job share the same vm, no need to keep ib.vm just move vm field to job. this patch as well add job as paramter to ib_schedule so it can get vm from job->vm. v2: agd: sqaush in: drm/amdgpu: check if ring emit_vm_flush exists in vm flush No vm flush on engines that don't support VM. bug: https://bugs.freedesktop.org/show_bug.cgi?id=95195 Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amd/scheduler: Mark amdgpu_sched_ops constNils Wallménius2016-05-051-1/+1
| | | | | | | | | | | This marks the struct amdgpu_sched_ops const and adjusts amd_sched_init to take a const pointer for the ops param. The ops member of struct amd_gpu_scheduler is also changed to const. Reviewed-by: Christian König <[email protected]> Signed-off-by: Nils Wallménius <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use ref to keep job aliveMonk Liu2016-05-021-3/+12
| | | | | | | | | | | | this is to fix fatal page fault error that occured if: job is signaled/released after its timeout work is already put to the global queue (in this case the cancel_delayed_work will return false), which will lead to NX-protection error page fault during job_timeout_func. Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: rework TDR in scheduler (v2)Monk Liu2016-05-021-1/+15
| | | | | | | | | | | | | Add two callbacks to scheduler to maintain jobs, and invoked for job timeout calculations. Now TDR measures time gap from job is processed by hw. v2: fix typo Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: delay job free to when it's finished (v2)Monk Liu2016-05-021-1/+10
| | | | | | | | | | | | | | | | | for those jobs submitted through scheduler, do not free it immediately after scheduled, instead free it in global workqueue by its sched fence signaling callback function. v2: call uf's bo_undef after job_run() call job's sync free after job_run() no static inline __amdgpu_job_free() anymore, just use kfree(job) to replace it. Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use sched_job_init to initialize sched_jobMonk Liu2016-05-021-6/+9
| | | | | | | | Consolidate job initialization in one place rather than duplicating it in multiple places. Signed-off-by: Monk Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use sched fence if possibleMonk Liu2016-03-171-1/+4
| | | | | | | | | | when preemption feature lands, the SA bo should rely on sched fence, because hw fence will be invalid after its job preempted or skipped. Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move ib.fence to job.fenceMonk Liu2016-03-171-2/+3
| | | | | | Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: give a fence param to ib_freeMonk Liu2016-03-171-1/+2
| | | | | | | | | | | | | thus amdgpu_ib_free() can hook sched fence to SA manager in later patches. BTW: for amdgpu_free_job(), it should only fence_put() the fence of the last ib once, so fix it as well in this patch. Signed-off-by: Monk Liu <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove HW fence ownerChristian König2016-03-081-1/+1
| | | | | | | | Not used any more since we now always use the sheduler. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]>
* drm/amdgpu: fix VM faults caused by vm_grab_id() v4Christian König2016-02-291-4/+11
| | | | | | | | | | | | | | | The owner must be per ring as long as we don't support sharing VMIDs per process. Also move the assigned VMID and page directory address into the IB structure. v3: assign the VMID to all IBs, not just the first one. v4: use correct pointer for owner Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: nuke the kernel contextChristian König2016-02-121-5/+0
| | | | | | | Not used any more. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
* drm/amdgpu: use per VM entity for page table updates (v2)Christian König2016-02-121-2/+6
| | | | | | | | | Updates from different VMs can be processed independently. v2: agd: rebase on upstream Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
* drm/amdgpu: move sync into job objectChristian König2016-02-101-6/+15
| | | | | | | | No need to keep that for every IB. Signed-off-by: Christian König <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: rename amdgpu_sched.c to amdgpu_job.cChristian König2016-02-101-0/+151
That's probably a better matching name. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>