aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
diff options
context:
space:
mode:
authorpding <Pixel.Ding@amd.com>2017-10-23 05:22:09 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-12-04 16:33:14 -0500
commit8840a3878d40c9318b08932376fa31e763780dfe (patch)
treede5336b6e3257806425fd3511232ba104249e50f /drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
parentb59142384ed6e2652004d2089bfd8f238bf7f0b9 (diff)
drm/amdgpu: retry init if it fails due to exclusive mode timeout (v3)
The exclusive mode has real-time limitation in reality, such like being done in 300ms. It's easy observed if running many VF/VMs in single host with heavy CPU workload. If we find the init fails due to exclusive mode timeout, try it again. v2: - rewrite the condition for readable value. v3: - fix typo, add comments for sleep Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: pding <Pixel.Ding@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 720139e182a3..f313eee60c4a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -86,7 +86,7 @@ done_free:
86int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) 86int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
87{ 87{
88 struct amdgpu_device *adev; 88 struct amdgpu_device *adev;
89 int r, acpi_status; 89 int r, acpi_status, retry = 0;
90 90
91#ifdef CONFIG_DRM_AMDGPU_SI 91#ifdef CONFIG_DRM_AMDGPU_SI
92 if (!amdgpu_si_support) { 92 if (!amdgpu_si_support) {
@@ -122,6 +122,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
122 } 122 }
123 } 123 }
124#endif 124#endif
125retry_init:
125 126
126 adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL); 127 adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL);
127 if (adev == NULL) { 128 if (adev == NULL) {
@@ -144,7 +145,17 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
144 * VRAM allocation 145 * VRAM allocation
145 */ 146 */
146 r = amdgpu_device_init(adev, dev, dev->pdev, flags); 147 r = amdgpu_device_init(adev, dev, dev->pdev, flags);
147 if (r) { 148 if (r == -EAGAIN && ++retry <= 3) {
149 adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
150 adev->virt.ops = NULL;
151 amdgpu_device_fini(adev);
152 kfree(adev);
153 dev->dev_private = NULL;
154 /* Don't request EX mode too frequently which is attacking */
155 msleep(5000);
156 dev_err(&dev->pdev->dev, "retry init %d\n", retry);
157 goto retry_init;
158 } else if (r) {
148 dev_err(&dev->pdev->dev, "Fatal error during GPU init\n"); 159 dev_err(&dev->pdev->dev, "Fatal error during GPU init\n");
149 goto out; 160 goto out;
150 } 161 }