typedef uint32_t (*amdgpu_block_rreg_t)(struct amdgpu_device*, uint32_t, uint32_t);
typedef void (*amdgpu_block_wreg_t)(struct amdgpu_device*, uint32_t, uint32_t, uint32_t);
+#define AMDGPU_RESET_MAGIC_NUM 64
struct amdgpu_device {
struct device *dev;
struct drm_device *ddev;
/* record hw reset is performed */
bool has_hw_reset;
+ u8 reset_magic[AMDGPU_RESET_MAGIC_NUM];
};
return 0;
}
+static void amdgpu_fill_reset_magic(struct amdgpu_device *adev)
+{
+ memcpy(adev->reset_magic, adev->gart.ptr, AMDGPU_RESET_MAGIC_NUM);
+}
+
+static bool amdgpu_check_vram_lost(struct amdgpu_device *adev)
+{
+ return !!memcmp(adev->gart.ptr, adev->reset_magic,
+ AMDGPU_RESET_MAGIC_NUM);
+}
+
static int amdgpu_late_init(struct amdgpu_device *adev)
{
int i = 0, r;
}
}
+ amdgpu_fill_reset_magic(adev);
+
return 0;
}
{
int i, r;
int resched;
- bool need_full_reset;
+ bool need_full_reset, vram_lost = false;
if (!amdgpu_check_soft_reset(adev)) {
DRM_INFO("No hardware hang detected. Did some blocks stall?\n");
r = amdgpu_resume_phase1(adev);
if (r)
goto out;
+ vram_lost = amdgpu_check_vram_lost(adev);
+ if (vram_lost)
+ DRM_ERROR("VRAM is lost!\n");
r = amdgpu_ttm_recover_gart(adev);
if (r)
goto out;
r = amdgpu_resume_phase2(adev);
if (r)
goto out;
+ if (vram_lost)
+ amdgpu_fill_reset_magic(adev);
}
}
out: