Every open system call for an amdgpu device holds a runtime reference and resumes the device from a BACO/BOCO sleep state even if direct hardware access is not required.
Drop pm_runtime_get_sync() and pm_runtime_put_autosuspend() from open/close KMS to prevent unnecessary resumes. Signed-off-by: Shahyan Soltani <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 14a72a406d37..05406c9ff370 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -1506,7 +1506,6 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) /* Ensure IB tests are run on ring */ flush_delayed_work(&adev->delayed_init_work); - if (amdgpu_ras_intr_triggered()) { DRM_ERROR("RAS Intr triggered, device disabled!!"); return -EHWPOISON; @@ -1514,14 +1513,10 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) file_priv->driver_priv = NULL; - r = pm_runtime_get_sync(dev->dev); - if (r < 0) - goto pm_put; - fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); if (unlikely(!fpriv)) { r = -ENOMEM; - goto out_suspend; + goto out; } r = amdgpu_xcp_open_device(adev, fpriv, file_priv); @@ -1583,7 +1578,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) amdgpu_ctx_mgr_init(&fpriv->ctx_mgr, adev); file_priv->driver_priv = fpriv; - goto out_suspend; + goto out; error_vm: if (pasid) { @@ -1596,10 +1591,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) error_pasid: kfree(fpriv); -out_suspend: -pm_put: - pm_runtime_put_autosuspend(dev->dev); - +out: return r; } @@ -1624,8 +1616,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev, if (!fpriv) return; - pm_runtime_get_sync(dev->dev); - if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_UVD) != NULL) amdgpu_uvd_free_handles(adev, file_priv); if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_VCE) != NULL) @@ -1662,8 +1652,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev, kfree(fpriv); file_priv->driver_priv = NULL; - - pm_runtime_put_autosuspend(dev->dev); } -- 2.56.0
