aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
Commit message (Collapse)AuthorAgeFilesLines
* drm/amdgpu: Add GPUVM memory management functions for KFDFelix Kuehling2018-02-071-0/+4
| | | | | | | | | | | | | v2: * Removed unused flags from struct kgd_mem * Updated some comments * Added a check to unmap_memory_from_gpu whether BO was mapped v3: add mutex_destroy in relevant places Signed-off-by: Felix Kuehling <[email protected]> Acked-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
* drm/ttm: drop persistent_swap_storage from ttm_bo_init and coChristian König2018-02-271-2/+2
| | | | | | | | | Never used as parameter, the only driver actually using this is nouveau and there it is initialized after the BO is initialized. Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctxRoger He2018-02-271-2/+2
| | | | | | | | for saving memory and more bit flag can be used in future Signed-off-by: Roger He <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use drm_gem_private_object_initChristian König2018-02-201-5/+1
| | | | | | | | We use our own backing store and don't need the shmem file. Signed-off-by: Christian König <[email protected]> Acked-by: Daniel Vetter <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: revert "Add a parameter to amdgpu_bo_create()"Christian König2018-02-191-9/+4
| | | | | | | | | | This reverts commit 2046d46db9166bddc84778f0b3477f6d1e9068ea. Not needed any more. Signed-off-by: Christian König <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move struct amdgpu_mc into amdgpu_gmc.hChristian König2018-02-191-15/+15
| | | | | | | | And rename it to amdgpu_gmc as well. Signed-off-by: Christian König <[email protected]> Reviewed-by: Samuel Li <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix test for shadow page tablesChristian König2017-12-201-1/+5
| | | | | | | | They don't work 100% correctly at the moment. Reviewed-and-Tested-by: Michel Dänzer <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move amdgpu_need_backup to amdgpu_object.cAlex Deucher2017-12-181-0/+8
| | | | | | | It's the only place it's used. Acked-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: set allow_reserved_eviction and resv when bo allocation and csRoger He2017-12-151-1/+6
| | | | | | | | | | enable eviction of other per VM BOs during allocation and allows reaping of deleted BOs during CS. Reviewed-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Roger He <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use the new TTM bytes moved counter v2Christian König2017-12-061-7/+3
| | | | | | | | | | | | | | Instead of the global statistics use the per context bytes moved counter. v2: rebased Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Michel Dänzer <[email protected]> Acked-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/ttm: use an operation ctx for ttm_bo_init_reservedChristian König2017-12-061-1/+2
| | | | | | | | | | | | Instead of specifying if sleeping should be interruptible. Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Michel Dänzer <[email protected]> Acked-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/ttm: add operation ctx to ttm_bo_validate v2Christian König2017-12-061-4/+8
| | | | | | | | | | | | | | Give moving a BO into place an operation context to work with. v2: rebased Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Michel Dänzer <[email protected]> Acked-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* amdgpu: Don't use DRM_ERROR when failing to allocate a BOMichel Dänzer2017-12-061-2/+2
| | | | | | | | | | | | This can be triggered by userspace, e.g. trying to allocate too large a BO, so it shouldn't log anything by default. Callers need to handle failure anyway. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Implement BO size validation V2Andrey Grodzovsky2017-12-061-0/+41
| | | | | | | | | | | | Validates BO size against each requested domain's total memory. v2: Make GTT size check a MUST to allow fall back to GTT. Rmove redundant NULL check. Signed-off-by: Andrey Grodzovsky <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: rename amdgpu_ttm_bind to amdgpu_ttm_alloc_gartChristian König2017-12-041-1/+1
| | | | | | | | We actually don't bind here, but rather allocate GART space if necessary. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: nuke amdgpu_ttm_is_bound() v2Christian König2017-12-041-1/+1
| | | | | | | | | | | Rename amdgpu_gtt_mgr_is_allocated() to amdgpu_gtt_mgr_has_gart_addr() and use that instead. v2: rename the function as well. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove extra parameter from amdgpu_ttm_bind() v2Christian König2017-12-041-1/+1
| | | | | | | | | | We always use the BO mem now. v2: minor rebase Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix pin domain compatibility checkChristian König2017-12-041-1/+1
| | | | | | | | We need to test if any domain fits, not all of them. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: always bind pinned BOsChristian König2017-12-041-7/+7
| | | | | | | | | We always need to bind pinned BOs, not just when the caller requested the address. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use the actual placement for pin accountingChristian König2017-12-041-0/+2
| | | | | | | | This allows us to specify multiple possible placements again. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: change redundant init logs to debug levelpding2017-12-041-2/+2
| | | | | | | | | | | | | When this VF stays in exclusive mode for long, other VFs will be impacted. The redundant messages causes exclusive mode timeout when they're redirected. That is a normal use case for cloud service to redirect guest log to virtual serial port. Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: pding <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix error handling in amdgpu_bo_do_createChristian König2017-10-311-3/+3
| | | | | | | | | | The bo structure is freed up in case of an error, so we can't do any accounting if that happens. Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> CC: [email protected] Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add helper to convert a ttm bo to amdgpu_boAndres Rodriguez2017-10-091-5/+3
| | | | | | Reviewed-by: Christian König <[email protected]> Signed-off-by: Andres Rodriguez <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: simplify pinning into visible VRAMChristian König2017-09-261-15/+8
| | | | | | | | Just set the CPU access required flag when we pin it. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix and cleanup amdgpu_bo_create v2Christian König2017-09-131-60/+23
| | | | | | | | | | | | We adjusted the BO flags for USWC handling, but those never took effect because the placement was passed in instead of generated inside this function. v2: better 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: track evicted page tables v2Christian König2017-08-291-1/+1
| | | | | | | | | | | | Instead of validating all page tables when one was evicted, track which one needs a validation. v2: simplify amdgpu_vm_ready as well Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> (v1) Reviewed-by: Chunming Zhou <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: fix and cleanup shadow handlingChristian König2017-08-291-23/+23
| | | | | | | | | | | | | | Set the shadow flag on the shadow and not the parent, always bind shadow BOs during allocation instead of manually, use the reservation_object wrappers to grab the lock. This fixes a couple of issues with binding the shadow BOs as well as correctly evicting them when memory becomes tight. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chunming Zhou <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move vram usage tracking into the vram manager v2Christian König2017-08-171-50/+0
| | | | | | | | | | Looks like a better place for this. v2: use atomic64_t members instead Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: move gtt usage tracking into the gtt manager v2Christian König2017-08-171-2/+0
| | | | | | | | | | It doesn't make much sense to count those numbers twice. v2: use and atomic64_t instead Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Fix preferred typoKent Russell2017-08-151-3/+3
| | | | | | | | Change "prefered" to "preferred" Signed-off-by: Kent Russell <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Add a parameter to amdgpu_bo_create()Yong Zhao2017-08-151-3/+9
| | | | | | | | | The parameter init_value contains the value to which we initialized VRAM bo when AMDGPU_GEM_CREATE_VRAM_CLEARED flag is set. Signed-off-by: Yong Zhao <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: add amdgpu_bo_create_reservedChristian König2017-08-151-8/+40
| | | | | | | | Same as amdgpu_bo_create_kernel, but keeps the BO reserved. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: improve amdgpu_bo_create_kernelChristian König2017-08-151-8/+14
| | | | | | | | Make allocating the new BO optional. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: cleanup kptr handlingChristian König2017-08-151-11/+15
| | | | | | | | Don't keep around the same pointer twice. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: ttm_bind only when user needs gpu_addr in bo pinChunming Zhou2017-07-251-6/+7
| | | | | | Signed-off-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: make sure BOs are always kunmappedChristian König2017-07-141-0/+3
| | | | | | | | When a BO is moved or destroyed it shouldn't be kmapped any more. Signed-off-by: Christian König <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Don't force BOs into visible VRAM for page faultsJohn Brooks2017-07-141-7/+10
| | | | | | | | | | | | | | There is no need for page faults to force BOs into visible VRAM if it's full, and the time it takes to do so is great enough to cause noticeable stuttering. Add GTT as a possible placement so that if visible VRAM is full, page faults move BOs to GTT instead of evicting other BOs from VRAM. Suggested-by: Michel Dänzer <[email protected]> Signed-off-by: John Brooks <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Set/clear CPU_ACCESS flag on page fault and move to VRAMJohn Brooks2017-07-141-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | When a BO is moved to VRAM, clear AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED. This allows it to potentially later move to invisible VRAM if the CPU does not access it again. Setting the CPU_ACCESS flag in amdgpu_bo_fault_reserve_notify() also means that we can remove the loop to restrict lpfn to the end of visible VRAM, because amdgpu_ttm_placement_init() will do it for us. v3 [Michel Dänzer] * Use AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED instead of a new flag (Christian König) * Clear flag in amdgpu_bo_move instead of amdgpu_move_ram_vram (Christian) * Explicitly mention amdgpu_bo_fault_reserve_notify in amdgpu_bo_move * Also clear flag in amdgpu_bo_create_restricted Suggested-by: Michel Dänzer <[email protected]> Signed-off-by: John Brooks <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Throttle visible VRAM moves separatelyJohn Brooks2017-07-141-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BO move throttling code is designed to allow VRAM to fill quickly if it is relatively empty. However, this does not take into account situations where the visible VRAM is smaller than total VRAM, and total VRAM may not be close to full but the visible VRAM segment is under pressure. In such situations, visible VRAM would experience unrestricted swapping and performance would drop. Add a separate counter specifically for moves involving visible VRAM, and check it before moving BOs there. v2: Only perform calculations for separate counter if visible VRAM is smaller than total VRAM. (Michel Dänzer) v3: [Michel Dänzer] * Use BO's location rather than the AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED flag to determine whether to account a move for visible VRAM in most cases. * Use a single if (adev->mc.visible_vram_size < adev->mc.real_vram_size) { block in amdgpu_cs_get_threshold_for_moves. Fixes: 95844d20ae02 (drm/amdgpu: throttle buffer migrations at CS using a fixed MBps limit (v2)) Signed-off-by: John Brooks <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Michel Dänzer <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: remove stale TODO commentChristian König2017-07-141-1/+0
| | | | | | | That is already fixed. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
* drm/amdgpu: add vm_needs_flush parameter to amdgpu_copy_bufferChristian König2017-07-141-2/+2
| | | | | | | | This allows us to flush the system VM here. Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Acked-by: Felix Kuehling <[email protected]>
* drm/amdgpu: add an INFO query for monitoring VRAM CPU page faultsMarek Olšák2017-05-241-0/+1
| | | | | | | | v2: bump the DRM version Signed-off-by: Marek Olšák <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: validate shadow before restoring from itRoger.He2017-04-281-0/+21
| | | | | | | Reviewed-by: Chunming Zhou <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Roger.He <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Fix use of interruptible waitingAlex Xie2017-04-281-1/+1
| | | | | | | | | 1. The signal interrupt can affect the expected behaviour. 2. There is no good mechanism to handle the corresponding error. Signed-off-by: Alex Xie <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: Refuse to pin or change acceptable domains of prime BOs to VRAM. ↵Christopher James Halse Rogers2017-04-071-0/+4
| | | | | | | | | | | | | (v2) Migration to VRAM will break the sharing, resulting in rendering on the exporting GPU never becoming visible on the importing GPU. v2: Don't pin BOs to GTT. Instead, refuse to migrate them out of GTT. Reviewed-by: Christian König <[email protected]> Signed-off-by: Christopher James Halse Rogers <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: handle CPU access for split VRAM buffers (v2)Christian König2017-04-061-3/+1
| | | | | | | | | | | This avoids merging them together on page fault. v2: squash in 64-bit division fix Signed-off-by: Christian König <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: use TTM_PL_FLAG_CONTIGUOUS v2Christian König2017-04-051-6/+5
| | | | | | | | | | | | | Implement AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS using TTM_PL_FLAG_CONTIGUOUS instead of a placement limit. That allows us to better handle CPU accessible placements. v2: prevent virtual BO start address from overflowing Signed-off-by: Christian König <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amd/amdgpu: fix performance drop when VRAM pressureRoger.He2017-03-301-3/+1
| | | | | | | | | | When VRAM pressue and trigger huge evictions there is performance drop, this patch fix it. Signed-off-by: Roger.He <[email protected]> Reviewed-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: don't validate TILE_SPLIT on GFX9Marek Olšák2017-03-301-1/+4
| | | | | | | Signed-off-by: Marek Olšák <[email protected]> Acked-by: Alex Deucher <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* drm/amdgpu: simplify reservation handling during buffer creationNicolai Hähnle2017-03-301-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | By using ttm_bo_init_reserved instead of the manual initialization of the reservation object, the reservation lock will be properly unlocked and destroyed when the TTM BO initialization fails. Actual deadlocks caused by the missing unlock should have been fixed by "drm/ttm: never add BO that failed to validate to the LRU list", superseding the flawed fix in commit 38fc4856ad98 ("drm/amdgpu: fix a potential deadlock in amdgpu_bo_create_restricted()"). This change fixes remaining recursive locking errors that can be seen with lock debugging enabled, and avoids the error of freeing a locked mutex. As an additional minor bonus, buffers created with resv == NULL and the AMDGPU_GEM_CREATE_VRAM_CLEARED flag are now only added to the global LRU list after the fill commands have been issued. v2: use amdgpu_bo_unreserve instead of ttm_bo_unreserve Fixes: 12a852219583 ("drm/amdgpu: improve AMDGPU_GEM_CREATE_VRAM_CLEARED handling (v2)") Signed-off-by: Nicolai Hähnle <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>