Re: [PATCH 2/6] drm/amdgpu: Force unmap all user VMAs on device removal.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 09.05.20 um 20:51 schrieb Andrey Grodzovsky:
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  4 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 14 ++++++++++----
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |  4 ++++
  3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index e6978a2..4da52b7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1374,8 +1374,10 @@ amdgpu_device_ip_get_ip_block(struct amdgpu_device *adev,
  			      enum amd_ip_block_type type)
  {
  	int i;
-
  	for (i = 0; i < adev->num_ip_blocks; i++)
+
+
+

Unrelated whitespace change.

  		if (adev->ip_blocks[i].version->type == type)
  			return &adev->ip_blocks[i];
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 76a6198..ea2b47e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1130,16 +1130,22 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
  	return ret;
  }
+static void amdgpu_force_unmap_user_space_mappings(struct drm_device *dev)
+{
+	struct amdgpu_device *adev = dev->dev_private;
+
+	ttm_bo_unmap_virtual_address_space(&adev->mman.bdev);
+}
+

If we really add a function for this we should probably put it into amdgpu_ttm.c

  static void
  amdgpu_pci_remove(struct pci_dev *pdev)
  {
  	struct drm_device *dev = pci_get_drvdata(pdev);
-#ifdef MODULE
-	if (THIS_MODULE->state != MODULE_STATE_GOING)
-#endif
-		DRM_ERROR("Hotplug removal is not supported\n");

Keep the warning for now, there is a lot of stuff we need to fix first before removing that one.

Christian.

  	drm_dev_unplug(dev);
+
+	amdgpu_force_unmap_user_space_mappings(dev);
+
  	amdgpu_driver_unload_kms(dev);
  	pci_disable_device(pdev);
  	pci_set_drvdata(pdev, NULL);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 3d822eb..22afd11 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -35,6 +35,7 @@
#include <drm/amdgpu_drm.h>
  #include <drm/drm_cache.h>
+#include <drm/drm_drv.h>
  #include "amdgpu.h"
  #include "amdgpu_trace.h"
  #include "amdgpu_amdkfd.h"
@@ -1361,6 +1362,9 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
  	if (!amdgpu_bo_is_amdgpu_bo(bo))
  		return 0;
+ if (drm_dev_is_unplugged(adev->ddev))
+		return -ENODEV;
+
  	abo = ttm_to_amdgpu_bo(bo);
/* Remember that this BO was accessed by the CPU */

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux