drm/amdgpu: lock and unlock console only for amdgpu_fbdev_set_suspend [V5]
[Why]
While the console_lock is held, console output will be buffered, till
its unlocked it wont be emitted, hence its ideal to unlock sooner to enable
debugging/detecting/fixing of any issue in the remaining sequence of events
in resume path.
The concern here is about consoles other than fbcon on the device,
e.g. a serial console
[How]
This patch restructures the console_lock, console_unlock around
amdgpu_fbdev_set_suspend() and moves this new block appropriately.
V2: Kept amdgpu_fbdev_set_suspend after pci_set_power_state
V3: Updated the commit message to clarify the real concern that this patch
addresses.
V4: code clean-up.
V5: fixed return value
Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -2720,15 +2720,12 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
|
|||||||
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
|
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (fbcon)
|
|
||||||
console_lock();
|
|
||||||
|
|
||||||
if (resume) {
|
if (resume) {
|
||||||
pci_set_power_state(dev->pdev, PCI_D0);
|
pci_set_power_state(dev->pdev, PCI_D0);
|
||||||
pci_restore_state(dev->pdev);
|
pci_restore_state(dev->pdev);
|
||||||
r = pci_enable_device(dev->pdev);
|
r = pci_enable_device(dev->pdev);
|
||||||
if (r)
|
if (r)
|
||||||
goto unlock;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* post card */
|
/* post card */
|
||||||
@@ -2741,14 +2738,14 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
|
|||||||
r = amdgpu_device_ip_resume(adev);
|
r = amdgpu_device_ip_resume(adev);
|
||||||
if (r) {
|
if (r) {
|
||||||
DRM_ERROR("amdgpu_device_ip_resume failed (%d).\n", r);
|
DRM_ERROR("amdgpu_device_ip_resume failed (%d).\n", r);
|
||||||
goto unlock;
|
return r;
|
||||||
}
|
}
|
||||||
amdgpu_fence_driver_resume(adev);
|
amdgpu_fence_driver_resume(adev);
|
||||||
|
|
||||||
|
|
||||||
r = amdgpu_device_ip_late_init(adev);
|
r = amdgpu_device_ip_late_init(adev);
|
||||||
if (r)
|
if (r)
|
||||||
goto unlock;
|
return r;
|
||||||
|
|
||||||
/* pin cursors */
|
/* pin cursors */
|
||||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||||
@@ -2783,6 +2780,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
|
|||||||
}
|
}
|
||||||
drm_modeset_unlock_all(dev);
|
drm_modeset_unlock_all(dev);
|
||||||
}
|
}
|
||||||
|
console_lock();
|
||||||
|
amdgpu_fbdev_set_suspend(adev, 0);
|
||||||
|
console_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_kms_helper_poll_enable(dev);
|
drm_kms_helper_poll_enable(dev);
|
||||||
@@ -2806,15 +2806,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
|
|||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
dev->dev->power.disable_depth--;
|
dev->dev->power.disable_depth--;
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
if (fbcon)
|
|
||||||
amdgpu_fbdev_set_suspend(adev, 0);
|
|
||||||
|
|
||||||
unlock:
|
|
||||||
if (fbcon)
|
|
||||||
console_unlock();
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user