drm/amdgpu: add need backup function V2
authorChunming Zhou <David1.Zhou@amd.com>
Fri, 5 Aug 2016 09:30:17 +0000 (17:30 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 19 Aug 2016 16:33:22 +0000 (12:33 -0400)
V2:
add checking if need backup in amdgpu_bo_create.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index 06a7cab3bcc73d183b410c18569127cc67c1f328..6fa826846e6ddfca7df1d446e3d63d1032c7950b 100644 (file)
@@ -2376,6 +2376,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 
 /* Common functions */
 int amdgpu_gpu_reset(struct amdgpu_device *adev);
+bool amdgpu_need_backup(struct amdgpu_device *adev);
 void amdgpu_pci_config_reset(struct amdgpu_device *adev);
 bool amdgpu_card_posted(struct amdgpu_device *adev);
 void amdgpu_update_display_priority(struct amdgpu_device *adev);
index c356bb538b43d3cbb0b11295a02c2eb8004c1a16..21f4b748aff0fdb7a330a9ee6a41eccaf75612a3 100644 (file)
@@ -2049,6 +2049,14 @@ static int amdgpu_post_soft_reset(struct amdgpu_device *adev)
        return 0;
 }
 
+bool amdgpu_need_backup(struct amdgpu_device *adev)
+{
+       if (adev->flags & AMD_IS_APU)
+               return false;
+
+       return amdgpu_lockup_timeout > 0 ? true : false;
+}
+
 /**
  * amdgpu_gpu_reset - reset the asic
  *
index 2c08e1b38656b2be0eef6a74f23ec92d41b4aed9..60acbd22174e811ae657ae8c7a50ca3da8e1969e 100644 (file)
@@ -436,7 +436,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
        if (r)
                return r;
 
-       if (flags & AMDGPU_GEM_CREATE_SHADOW) {
+       if (amdgpu_need_backup(adev) && (flags & AMDGPU_GEM_CREATE_SHADOW)) {
                r = amdgpu_bo_create_shadow(adev, size, byte_align, (*bo_ptr));
                if (r)
                        amdgpu_bo_unref(bo_ptr);