aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
Commit message (Collapse)AuthorAgeFilesLines
* drm/amdgpu: Encapsulate some VM table update parameters (v2)Harish Kasiviswanathan2016-05-111-49/+62
| | | | | | | | | | | | Bundle some VM table parameters into amdgpu_vm_update_params structure, so that number of function parameters can be reduced. Only structural change, no logic change. v2: agd: squash in fix from Harish Signed-off-by: Harish Kasiviswanathan <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove define for reserved client IDChristian König2016-05-111-1/+1
| | | | | | | | Just set it to zero instead. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove owner cleanup v2Christian König2016-05-111-13/+0
| | | | | | | | | | The client ID is now unique, so no need to resert the owner fields any more. v2: remove unused variables as well Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> (v1) Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: make the VMID owner always 64bitChristian König2016-05-111-2/+2
| | | | | | | | Otherwise we could (in theory) run into problems on 32bit systems. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add pipeline sync for compute jobChunming Zhou2016-05-111-1/+2
| | | | | | | | | | | | | hardware ring is async processed, the job is executed in parallel. In some case, this will result vm fault, like jobs with different vmids. This works around a CPC hw issue which will eventually be fixed in fw. Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]> Reviewed-by: Monk Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: keep vm in job instead of ib (v2)Monk Liu2016-05-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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/amdgpu: make vmid owner be client_idChunming Zhou2016-05-111-3/+3
| | | | | | | | | Using the pointer is not adequate. Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Monk Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add client id for every vmChunming Zhou2016-05-111-0/+2
| | | | | | | | | | This adds a unique id for each vm client so we can properly track them. Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Monk Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix wrong release of vmid ownerChunming Zhou2016-05-111-5/+9
| | | | | | | | | | | The release of the vmid owner was not handled correctly. We need to take the lock and walk the lru list. Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Monk Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix error checking when reuse vmid on same ringChunming Zhou2016-05-051-2/+2
| | | | | | Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: only update last_flush when vmid doesn't have other new ownerChunming Zhou2016-05-051-5/+10
| | | | | | Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: reuse VMIDs already assigned to a processChristian König2016-05-051-30/+45
| | | | | | | | | | If we don't need to flush we can easily use another VMID already assigned to the process. Signed-off-by: Christian König <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add a fence after the VM flushChristian König2016-05-051-5/+21
| | | | | | | | | This way we can track when the flush is done. Signed-off-by: Christian König <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use a sync object for VMID fences v2Christian König2016-05-051-25/+28
| | | | | | | | | | | v2: rebase & cleanup This way we can store more than one fence as user for each VMID. Signed-off-by: Christian König <[email protected]> Acked-by: Alex Deucher <[email protected]> (v1) Reviewed-by: Chunming Zhou <[email protected]> (v1) Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: merge VM manager and VM context ID structureChristian König2016-05-051-67/+70
| | | | | | | | | No need to have two of them any more. Signed-off-by: Christian König <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use BO pages instead of GART arrayChristian König2016-05-021-13/+16
| | | | | | Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: change parameter passing in the VM codeChristian König2016-05-021-46/+54
| | | | | | | | | Make it more flexible by passing src and page addresses directly instead of the structures they contain. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: improve vmid assigment V2Chunming Zhou2016-05-021-0/+14
| | | | | | | V2: the signaled items on the LRU maintain their order Signed-off-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Revert "add mutex for ba_va->valids/invalids"Christian König2016-03-091-11/+6
| | | | | | | | | | | Not needed any more because we need to protect the elements on the list anyway. This reverts commit 38bf516c75b4ef0f5c716e05fa9baab7c52d6c39. 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: Revert "add lock for interval tree in vm"Christian König2016-03-091-14/+2
| | | | | | | | | | | Not needed any more because we need to protect the elements on the list anyway. This reverts commit fe237ed7efec8ac147a4572fdf81173a7f8ddda7. 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: Revert "add spin lock to protect freed list in vm (v3)"Christian König2016-03-091-13/+3
| | | | | | | | | | | Not needed any more because we need to protect the elements on the list anyway. This reverts commit dae6ecf9e6c9b677e577826c3ac665c6dd9c490b. 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: Fix two bugs in amdgpu_vm_bo_split_mappingFelix Kuehling2016-03-091-2/+2
| | | | | | | | | Off-by-one: last is inclusive, so the maximum is start + max_size - 1 Wrong unit: addr is in bytes, max_size is in pages Signed-off-by: Felix Kuehling <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move get_user_pages out of amdgpu_ttm_tt_pin_userptr v6Christian König2016-03-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That avoids lock inversion between the BO reservation lock and the anon_vma lock. v2: * Changed amdgpu_bo_list_entry.user_pages to an array of pointers * Lock mmap_sem only for get_user_pages * Added invalidation of unbound userpointer BOs * Fixed memory leak and page reference leak v3 (chk): * Revert locking mmap_sem only for_get user_pages * Revert adding invalidation of unbound userpointer BOs * Sanitize and fix error handling v4 (chk): * Init userpages pointer everywhere. * Fix error handling when get_user_pages() fails. * Add invalidation of unbound userpointer BOs again. v5 (chk): * Add maximum number of tries. v6 (chk): * Fix error handling when we run out of tries. Signed-off-by: Christian König <[email protected]> Signed-off-by: Felix Kuehling <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> (v4) Acked-by: Alex Deucher <[email protected]>
* drm/amdgpu: if a GDS switch is needed emit a pipeline sync as wellChristian König2016-03-081-10/+12
| | | | | | | | Otherwise we might change the GDS settings while they are still in use. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]>
* drm/amdgpu: split pipeline sync and vm flushChristian König2016-03-081-0/+2
| | | | | | | | This allows us to use the pipeline sync for other tasks as well. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]>
* drm/amdgpu: switch the GDS only on demand v2Christian König2016-03-081-2/+41
| | | | | | | | | | | | Switching the GDS space to often seems to be problematic. This patch together with the following can avoid VM faults on context switch. v2: extend commit message a bit Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> (v1) Reviewed-by: Chunming Zhou <[email protected]> (v1)
* drm/amdgpu: move the GDS switch into vm flush as wellChristian König2016-03-081-5/+13
| | | | | | | | After all it's an operation on the VMID. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]>
* drm/amdgpu: sync to the active user on reusing a VMIDChristian König2016-03-081-0/+7
| | | | | | Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: trace the pd_addr in vm_grab_id as wellChristian König2016-02-291-2/+3
| | | | | | | | | Makes matching it to the flushes much easier. 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: fix VM faults caused by vm_grab_id() v4Christian König2016-02-291-55/+60
| | | | | | | | | | | | | | | 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: use SDMA round robin for VM updates v3Christian König2016-02-121-6/+18
| | | | | | | | | | Distribute the load on both rings. v2: use a loop for the initialization v3: agd: rebase on upstream 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-16/+37
| | | | | | | | | 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-2/+3
| | | | | | | | 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: cleanup in kernel job submissionChristian König2016-02-101-60/+27
| | | | | | | | Add a job_alloc_with_ib helper and proper job submission. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move ring from IBs into jobChristian König2016-02-101-3/+3
| | | | | | | | We can't submit to multiple rings at the same time anyway. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: make pad_ib a ring function v3Christian König2016-02-101-3/+3
| | | | | | | | | | | | The padding depends on the firmware version and we need that for BO moves as well, not only for VM updates. v2: new approach of making pad_ib a ring function v3: fix typo in macro name Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix size estimation for clear IBChristian König2016-02-101-2/+2
| | | | | | | | We only need a few dw here. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: optimize amdgpu_vm_update_ptes a bitChristian König2016-02-101-20/+20
| | | | | | | | Don't calculate the end address multiple times. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: cleanup comments in VM codeChristian König2016-02-101-21/+11
| | | | | | | | | Neither the global nor the local mutex exists any more and amdgpu doesn't support cayman. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: optimize VM fencingChristian König2016-02-101-28/+22
| | | | | | | | | No need to fence every page table, just the page directory is enough. Signed-off-by: Christian König <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: split VM mappings into smaller operations (v3)Christian König2016-02-101-27/+77
| | | | | | | | | | | | If we can't copy entries from the GTT or fill them with one command split up the mapping operation into multiple ones. v2: agd: rebase on upstream v3: squash in Christian's fix Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use BOs GART instance for mapping addresses v4Christian König2016-02-101-46/+68
| | | | | | | | | | | | That allows the VM code to use GART BOs from other driver instances. v2: don't use copy optimization for foreign GARTs, that won't work. v3: some more comment cleanups v4: agd: rebase on upstream Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move more logic into amdgpu_vm_map_gart v3Christian König2016-02-101-12/+24
| | | | | | | | | | | | No need to duplicate that code over and over again. Also stop using the flags to determine if we need to map the addresses. v2: constify the pages_addr v3: rebased, fix typo in commit message Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove nonsense IB size checksChristian König2016-02-101-8/+0
| | | | | | | | | Those are just leftovers from the time we wrote the VM updates directly to the ring. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use a global LRU list for VMIDsChristian König2016-02-101-48/+40
| | | | | | | | | | With the scheduler enabled managing per ring LRUs don't make much sense any more. 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: merge vm_grab_id and vm_fence v2Christian König2016-02-101-32/+25
| | | | | | | | | | | No need for an extra function any more. v2: comment cleanups 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: add VM pointer to id traceChristian König2016-02-101-3/+3
| | | | | | | | | | Because of the scheduler all traces come from the same thread now and can't be distincted otherwise. Signed-off-by: Christian König <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: clean up non-scheduler code path (v2)Chunming Zhou2016-02-101-7/+2
| | | | | | | | | | | Non-scheduler code is longer supported. v2: agd: rebased on upstream Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Ken Wang <[email protected]> Reviewed-by: Monk Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: keep the prefered/allowed domains in the BOChristian König2016-02-101-4/+0
| | | | | | | | Stop copying that to the bo list entry, it doesn't change anyway. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Use drm_calloc_large for VM page_tables arrayMichel Dänzer2016-01-191-4/+3
| | | | | | | | | | | It can be big, depending on the VM address space size, which is tunable via the vm_size module parameter. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93721 Reviewed-by: Christian König <[email protected]> Signed-off-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]