Commit 1daee8b4 authored by Pixel Ding's avatar Pixel Ding Committed by Alex Deucher

drm/amdgpu: revise retry init to fully cleanup driver

Retry at drm_dev_register instead of amdgpu_device_init.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarPixel Ding <Pixel.Ding@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent baef9a19
...@@ -2390,6 +2390,9 @@ int amdgpu_device_init(struct amdgpu_device *adev, ...@@ -2390,6 +2390,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
amdgpu_virt_mmio_blocked(adev) && amdgpu_virt_mmio_blocked(adev) &&
!amdgpu_virt_wait_reset(adev)) { !amdgpu_virt_wait_reset(adev)) {
dev_err(adev->dev, "VF exclusive mode timeout\n"); dev_err(adev->dev, "VF exclusive mode timeout\n");
/* Don't send request since VF is inactive. */
adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
adev->virt.ops = NULL;
r = -EAGAIN; r = -EAGAIN;
goto failed; goto failed;
} }
......
...@@ -565,12 +565,13 @@ static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev) ...@@ -565,12 +565,13 @@ static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev)
return 0; return 0;
} }
static int amdgpu_pci_probe(struct pci_dev *pdev, static int amdgpu_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct drm_device *dev; struct drm_device *dev;
unsigned long flags = ent->driver_data; unsigned long flags = ent->driver_data;
int ret; int ret, retry = 0;
if ((flags & AMD_EXP_HW_SUPPORT) && !amdgpu_exp_hw_support) { if ((flags & AMD_EXP_HW_SUPPORT) && !amdgpu_exp_hw_support) {
DRM_INFO("This hardware requires experimental hardware support.\n" DRM_INFO("This hardware requires experimental hardware support.\n"
...@@ -603,8 +604,14 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, ...@@ -603,8 +604,14 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
retry_init:
ret = drm_dev_register(dev, ent->driver_data); ret = drm_dev_register(dev, ent->driver_data);
if (ret) if (ret == -EAGAIN && ++retry <= 3) {
DRM_INFO("retry init %d\n", retry);
/* Don't request EX mode too frequently which is attacking */
msleep(5000);
goto retry_init;
} else if (ret)
goto err_pci; goto err_pci;
return 0; return 0;
......
...@@ -84,7 +84,7 @@ void amdgpu_driver_unload_kms(struct drm_device *dev) ...@@ -84,7 +84,7 @@ void amdgpu_driver_unload_kms(struct drm_device *dev)
int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
{ {
struct amdgpu_device *adev; struct amdgpu_device *adev;
int r, acpi_status, retry = 0; int r, acpi_status;
#ifdef CONFIG_DRM_AMDGPU_SI #ifdef CONFIG_DRM_AMDGPU_SI
if (!amdgpu_si_support) { if (!amdgpu_si_support) {
...@@ -120,7 +120,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) ...@@ -120,7 +120,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
} }
} }
#endif #endif
retry_init:
adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL); adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL);
if (adev == NULL) { if (adev == NULL) {
...@@ -143,17 +142,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) ...@@ -143,17 +142,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
* VRAM allocation * VRAM allocation
*/ */
r = amdgpu_device_init(adev, dev, dev->pdev, flags); r = amdgpu_device_init(adev, dev, dev->pdev, flags);
if (r == -EAGAIN && ++retry <= 3) { if (r) {
adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
adev->virt.ops = NULL;
amdgpu_device_fini(adev);
kfree(adev);
dev->dev_private = NULL;
/* Don't request EX mode too frequently which is attacking */
msleep(5000);
dev_err(&dev->pdev->dev, "retry init %d\n", retry);
goto retry_init;
} else if (r) {
dev_err(&dev->pdev->dev, "Fatal error during GPU init\n"); dev_err(&dev->pdev->dev, "Fatal error during GPU init\n");
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment