drm: Unamp the entire device address space on device unplug
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Mon, 18 Jan 2021 21:01:11 +0000 (16:01 -0500)
committerChristian König <christian.koenig@amd.com>
Tue, 19 Jan 2021 09:22:14 +0000 (10:22 +0100)
Invalidate all BOs CPU mappings once device is removed.

v3: Move the code from TTM into drm_dev_unplug

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/414809/
Signed-off-by: Christian König <christian.koenig@amd.com>
drivers/gpu/drm/drm_drv.c

index d384a5b8119f72d57449af273ebe88971f52d6f7..20d22e41d7ce74d7f7b0698d271dabd64f7ce488 100644 (file)
@@ -469,6 +469,9 @@ void drm_dev_unplug(struct drm_device *dev)
        synchronize_srcu(&drm_unplug_srcu);
 
        drm_dev_unregister(dev);
+
+       /* Clear all CPU mappings pointing to this device */
+       unmap_mapping_range(dev->anon_inode->i_mapping, 0, 0, 1);
 }
 EXPORT_SYMBOL(drm_dev_unplug);