From b9d4efa8f9a26428d8d9bace9ce0f988ab28431b Mon Sep 17 00:00:00 2001 From: Andrey Grodzovsky Date: Mon, 18 Jan 2021 16:01:11 -0500 Subject: drm: Unamp the entire device address space on device unplug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Invalidate all BOs CPU mappings once device is removed. v3: Move the code from TTM into drm_dev_unplug Signed-off-by: Andrey Grodzovsky Reviewed-by: Christian König Reviewed-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/414809/ Signed-off-by: Christian König --- drivers/gpu/drm/drm_drv.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index d384a5b8119f..20d22e41d7ce 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -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); -- cgit v1.2.3