@@ -1145,7 +1145,11 @@ amdgpu_pci_remove(struct pci_dev *pdev)
drm_dev_unplug(dev);
+ /* Will trigger SIGBUS on all subsequent CPU accesses */
amdgpu_force_unmap_user_space_mappings(dev);
+
+ /* Will trigger VMFAULTs on all subsequent GPU successes */
+ amdgpu_bo_destroy_mms(adev);
wait_event(adev->user_clients_done,
!atomic_read(&dev->open_count) &&
!atomic_read(&adev->exported_dma_bufs_count));
@@ -1049,6 +1049,17 @@ int amdgpu_bo_evict_vram(struct amdgpu_device *adev)
return ttm_bo_evict_mm(&adev->mman.bdev, TTM_PL_VRAM, false);
}
+int amdgpu_bo_destroy_mms(struct amdgpu_device *adev)
+{
+ int r;
+
+ r = ttm_bo_evict_mm(&adev->mman.bdev, TTM_PL_VRAM, true);
+ if (!r)
+ return ttm_bo_evict_mm(&adev->mman.bdev, TTM_PL_TT, true);
+
+ return r;
+}
+
static const char *amdgpu_vram_names[] = {
"UNKNOWN",
"GDDR1",
@@ -269,6 +269,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
u64 min_offset, u64 max_offset);
int amdgpu_bo_unpin(struct amdgpu_bo *bo);
int amdgpu_bo_evict_vram(struct amdgpu_device *adev);
+int amdgpu_bo_destroy_mms(struct amdgpu_device *adev);
int amdgpu_bo_init(struct amdgpu_device *adev);
int amdgpu_bo_late_init(struct amdgpu_device *adev);
void amdgpu_bo_fini(struct amdgpu_device *adev);
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + 3 files changed, 16 insertions(+)