* [PATCH 0/5] Misc runpm and baco fixes @ 2019-10-10 15:26 Alex Deucher [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Alex Deucher @ 2019-10-10 15:26 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher While cleaning up the runtime pm code in amdgpu, I came across a few things. These patches fix them up. Please review! Alex Deucher (5): drm/amdgpu: move pci_save_state into suspend path drm/amdgpu: move gpu reset out of amdgpu_device_suspend drm/amdgpu: simplify ATPX detection drm/amdgpu: remove in_baco_reset hack drm/amdgpu/soc15: add support for baco reset with swSMU drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 - .../gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 12 +---- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++- drivers/gpu/drm/amd/amdgpu/soc15.c | 53 ++++++++++++------- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 4 +- 6 files changed, 43 insertions(+), 41 deletions(-) -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>]
* [PATCH 1/5] drm/amdgpu: move pci_save_state into suspend path [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org> @ 2019-10-10 15:26 ` Alex Deucher 2019-10-10 15:26 ` [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend Alex Deucher ` (3 subsequent siblings) 4 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2019-10-10 15:26 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher for amdgpu_device_suspend. This follows the logic in the resume path. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index f25275abf408..9b9b15360194 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3168,8 +3168,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) */ amdgpu_bo_evict_vram(adev); - pci_save_state(dev->pdev); if (suspend) { + pci_save_state(dev->pdev); /* Shut down the device */ pci_disable_device(dev->pdev); pci_set_power_state(dev->pdev, PCI_D3hot); -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 2019-10-10 15:26 ` [PATCH 1/5] drm/amdgpu: move pci_save_state into suspend path Alex Deucher @ 2019-10-10 15:26 ` Alex Deucher [not found] ` <20191010152619.31011-3-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 2019-10-10 15:26 ` [PATCH 3/5] drm/amdgpu: simplify ATPX detection Alex Deucher ` (2 subsequent siblings) 4 siblings, 1 reply; 12+ messages in thread From: Alex Deucher @ 2019-10-10 15:26 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher Move it into the caller. There are cases were we don't want it. We need it for hibernation, but we don't need it for runtime pm. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 9b9b15360194..91bdb246e405 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3173,10 +3173,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* Shut down the device */ pci_disable_device(dev->pdev); pci_set_power_state(dev->pdev, PCI_D3hot); - } else { - r = amdgpu_asic_reset(adev); - if (r) - DRM_ERROR("amdgpu asic reset failed\n"); } return 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index d43c46de7807..64141386e603 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1118,8 +1118,13 @@ static int amdgpu_pmops_resume(struct device *dev) static int amdgpu_pmops_freeze(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); + struct amdgpu_device *adev = drm_dev->dev_private; + int r; - return amdgpu_device_suspend(drm_dev, false, true); + r = amdgpu_device_suspend(drm_dev, false, true); + if (r) + return r; + return amdgpu_asic_reset(adev); } static int amdgpu_pmops_thaw(struct device *dev) -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <20191010152619.31011-3-alexander.deucher-5C7GfCeVMHo@public.gmane.org>]
* RE: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend [not found] ` <20191010152619.31011-3-alexander.deucher-5C7GfCeVMHo@public.gmane.org> @ 2019-10-11 4:07 ` Quan, Evan [not found] ` <BN8PR12MB3329E4B5DE6B027D43B38F5AE4970-h6+T2+wrnx3WSNCBJ7MpiAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Quan, Evan @ 2019-10-11 4:07 UTC (permalink / raw) To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Deucher, Alexander It seems amdgpu_pmops_runtime_suspend() needs to be updated accordingly also. -----Original Message----- From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher Sent: Thursday, October 10, 2019 11:26 PM To: amd-gfx@lists.freedesktop.org Cc: Deucher, Alexander <Alexander.Deucher@amd.com> Subject: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend Move it into the caller. There are cases were we don't want it. We need it for hibernation, but we don't need it for runtime pm. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 9b9b15360194..91bdb246e405 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3173,10 +3173,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* Shut down the device */ pci_disable_device(dev->pdev); pci_set_power_state(dev->pdev, PCI_D3hot); - } else { - r = amdgpu_asic_reset(adev); - if (r) - DRM_ERROR("amdgpu asic reset failed\n"); } return 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index d43c46de7807..64141386e603 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1118,8 +1118,13 @@ static int amdgpu_pmops_resume(struct device *dev) static int amdgpu_pmops_freeze(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); + struct amdgpu_device *adev = drm_dev->dev_private; + int r; - return amdgpu_device_suspend(drm_dev, false, true); + r = amdgpu_device_suspend(drm_dev, false, true); + if (r) + return r; + return amdgpu_asic_reset(adev); } static int amdgpu_pmops_thaw(struct device *dev) -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <BN8PR12MB3329E4B5DE6B027D43B38F5AE4970-h6+T2+wrnx3WSNCBJ7MpiAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>]
* RE: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend [not found] ` <BN8PR12MB3329E4B5DE6B027D43B38F5AE4970-h6+T2+wrnx3WSNCBJ7MpiAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> @ 2019-10-11 4:09 ` Quan, Evan 2019-10-11 13:25 ` Alex Deucher 1 sibling, 0 replies; 12+ messages in thread From: Quan, Evan @ 2019-10-11 4:09 UTC (permalink / raw) To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Deucher, Alexander > There are cases were we don't want it. Typo: were -> where? -----Original Message----- From: Quan, Evan Sent: Friday, October 11, 2019 12:07 PM To: Alex Deucher <alexdeucher@gmail.com>; amd-gfx@lists.freedesktop.org Cc: Deucher, Alexander <Alexander.Deucher@amd.com> Subject: RE: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend It seems amdgpu_pmops_runtime_suspend() needs to be updated accordingly also. -----Original Message----- From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher Sent: Thursday, October 10, 2019 11:26 PM To: amd-gfx@lists.freedesktop.org Cc: Deucher, Alexander <Alexander.Deucher@amd.com> Subject: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend Move it into the caller. There are cases were we don't want it. We need it for hibernation, but we don't need it for runtime pm. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 9b9b15360194..91bdb246e405 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3173,10 +3173,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* Shut down the device */ pci_disable_device(dev->pdev); pci_set_power_state(dev->pdev, PCI_D3hot); - } else { - r = amdgpu_asic_reset(adev); - if (r) - DRM_ERROR("amdgpu asic reset failed\n"); } return 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index d43c46de7807..64141386e603 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1118,8 +1118,13 @@ static int amdgpu_pmops_resume(struct device *dev) static int amdgpu_pmops_freeze(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); + struct amdgpu_device *adev = drm_dev->dev_private; + int r; - return amdgpu_device_suspend(drm_dev, false, true); + r = amdgpu_device_suspend(drm_dev, false, true); + if (r) + return r; + return amdgpu_asic_reset(adev); } static int amdgpu_pmops_thaw(struct device *dev) -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend [not found] ` <BN8PR12MB3329E4B5DE6B027D43B38F5AE4970-h6+T2+wrnx3WSNCBJ7MpiAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 2019-10-11 4:09 ` Quan, Evan @ 2019-10-11 13:25 ` Alex Deucher [not found] ` <CADnq5_Pbi+K=62tY0sJdOARy74wpnh+Owfq3wQb0tcyXE2XtFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 12+ messages in thread From: Alex Deucher @ 2019-10-11 13:25 UTC (permalink / raw) To: Quan, Evan; +Cc: Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW On Fri, Oct 11, 2019 at 12:07 AM Quan, Evan <Evan.Quan@amd.com> wrote: > > It seems amdgpu_pmops_runtime_suspend() needs to be updated accordingly also. I purposely left that out. I think that is a bug. We don't need to reset the GPU for runtime suspend. We only need it for hibernation because of the whole freeze/thaw dance. Alex > > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher > Sent: Thursday, October 10, 2019 11:26 PM > To: amd-gfx@lists.freedesktop.org > Cc: Deucher, Alexander <Alexander.Deucher@amd.com> > Subject: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend > > Move it into the caller. There are cases were we don't > want it. We need it for hibernation, but we don't need > it for runtime pm. > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ---- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- > 2 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 9b9b15360194..91bdb246e405 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -3173,10 +3173,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) > /* Shut down the device */ > pci_disable_device(dev->pdev); > pci_set_power_state(dev->pdev, PCI_D3hot); > - } else { > - r = amdgpu_asic_reset(adev); > - if (r) > - DRM_ERROR("amdgpu asic reset failed\n"); > } > > return 0; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index d43c46de7807..64141386e603 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -1118,8 +1118,13 @@ static int amdgpu_pmops_resume(struct device *dev) > static int amdgpu_pmops_freeze(struct device *dev) > { > struct drm_device *drm_dev = dev_get_drvdata(dev); > + struct amdgpu_device *adev = drm_dev->dev_private; > + int r; > > - return amdgpu_device_suspend(drm_dev, false, true); > + r = amdgpu_device_suspend(drm_dev, false, true); > + if (r) > + return r; > + return amdgpu_asic_reset(adev); > } > > static int amdgpu_pmops_thaw(struct device *dev) > -- > 2.20.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <CADnq5_Pbi+K=62tY0sJdOARy74wpnh+Owfq3wQb0tcyXE2XtFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend [not found] ` <CADnq5_Pbi+K=62tY0sJdOARy74wpnh+Owfq3wQb0tcyXE2XtFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2019-10-12 1:42 ` Quan, Evan [not found] ` <MN2PR12MB3344923284A5FF12F631B634E4960-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Quan, Evan @ 2019-10-12 1:42 UTC (permalink / raw) To: Alex Deucher; +Cc: Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Thanks for the clarification. That will be fine then. Reviewed-by: Evan Quan <evan.quan@amd.com> -----Original Message----- From: Alex Deucher <alexdeucher@gmail.com> Sent: Friday, October 11, 2019 9:25 PM To: Quan, Evan <Evan.Quan@amd.com> Cc: amd-gfx@lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher@amd.com> Subject: Re: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend On Fri, Oct 11, 2019 at 12:07 AM Quan, Evan <Evan.Quan@amd.com> wrote: > > It seems amdgpu_pmops_runtime_suspend() needs to be updated accordingly also. I purposely left that out. I think that is a bug. We don't need to reset the GPU for runtime suspend. We only need it for hibernation because of the whole freeze/thaw dance. Alex > > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of > Alex Deucher > Sent: Thursday, October 10, 2019 11:26 PM > To: amd-gfx@lists.freedesktop.org > Cc: Deucher, Alexander <Alexander.Deucher@amd.com> > Subject: [PATCH 2/5] drm/amdgpu: move gpu reset out of > amdgpu_device_suspend > > Move it into the caller. There are cases were we don't want it. We > need it for hibernation, but we don't need it for runtime pm. > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ---- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- > 2 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 9b9b15360194..91bdb246e405 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -3173,10 +3173,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) > /* Shut down the device */ > pci_disable_device(dev->pdev); > pci_set_power_state(dev->pdev, PCI_D3hot); > - } else { > - r = amdgpu_asic_reset(adev); > - if (r) > - DRM_ERROR("amdgpu asic reset failed\n"); > } > > return 0; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index d43c46de7807..64141386e603 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -1118,8 +1118,13 @@ static int amdgpu_pmops_resume(struct device > *dev) static int amdgpu_pmops_freeze(struct device *dev) { > struct drm_device *drm_dev = dev_get_drvdata(dev); > + struct amdgpu_device *adev = drm_dev->dev_private; > + int r; > > - return amdgpu_device_suspend(drm_dev, false, true); > + r = amdgpu_device_suspend(drm_dev, false, true); > + if (r) > + return r; > + return amdgpu_asic_reset(adev); > } > > static int amdgpu_pmops_thaw(struct device *dev) > -- > 2.20.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <MN2PR12MB3344923284A5FF12F631B634E4960-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>]
* Re: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend [not found] ` <MN2PR12MB3344923284A5FF12F631B634E4960-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> @ 2019-10-12 1:49 ` Alex Deucher 0 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2019-10-12 1:49 UTC (permalink / raw) To: Quan, Evan; +Cc: Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Thanks. I'll make note of this in the commit message. On Fri, Oct 11, 2019 at 9:42 PM Quan, Evan <Evan.Quan@amd.com> wrote: > > Thanks for the clarification. That will be fine then. > Reviewed-by: Evan Quan <evan.quan@amd.com> > > -----Original Message----- > From: Alex Deucher <alexdeucher@gmail.com> > Sent: Friday, October 11, 2019 9:25 PM > To: Quan, Evan <Evan.Quan@amd.com> > Cc: amd-gfx@lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher@amd.com> > Subject: Re: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend > > On Fri, Oct 11, 2019 at 12:07 AM Quan, Evan <Evan.Quan@amd.com> wrote: > > > > It seems amdgpu_pmops_runtime_suspend() needs to be updated accordingly also. > > I purposely left that out. I think that is a bug. We don't need to reset the GPU for runtime suspend. We only need it for hibernation because of the whole freeze/thaw dance. > > Alex > > > > > -----Original Message----- > > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of > > Alex Deucher > > Sent: Thursday, October 10, 2019 11:26 PM > > To: amd-gfx@lists.freedesktop.org > > Cc: Deucher, Alexander <Alexander.Deucher@amd.com> > > Subject: [PATCH 2/5] drm/amdgpu: move gpu reset out of > > amdgpu_device_suspend > > > > Move it into the caller. There are cases were we don't want it. We > > need it for hibernation, but we don't need it for runtime pm. > > > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ---- > > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 ++++++- > > 2 files changed, 6 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > index 9b9b15360194..91bdb246e405 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > @@ -3173,10 +3173,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) > > /* Shut down the device */ > > pci_disable_device(dev->pdev); > > pci_set_power_state(dev->pdev, PCI_D3hot); > > - } else { > > - r = amdgpu_asic_reset(adev); > > - if (r) > > - DRM_ERROR("amdgpu asic reset failed\n"); > > } > > > > return 0; > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > index d43c46de7807..64141386e603 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > @@ -1118,8 +1118,13 @@ static int amdgpu_pmops_resume(struct device > > *dev) static int amdgpu_pmops_freeze(struct device *dev) { > > struct drm_device *drm_dev = dev_get_drvdata(dev); > > + struct amdgpu_device *adev = drm_dev->dev_private; > > + int r; > > > > - return amdgpu_device_suspend(drm_dev, false, true); > > + r = amdgpu_device_suspend(drm_dev, false, true); > > + if (r) > > + return r; > > + return amdgpu_asic_reset(adev); > > } > > > > static int amdgpu_pmops_thaw(struct device *dev) > > -- > > 2.20.1 > > > > _______________________________________________ > > amd-gfx mailing list > > amd-gfx@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/5] drm/amdgpu: simplify ATPX detection [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 2019-10-10 15:26 ` [PATCH 1/5] drm/amdgpu: move pci_save_state into suspend path Alex Deucher 2019-10-10 15:26 ` [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend Alex Deucher @ 2019-10-10 15:26 ` Alex Deucher 2019-10-10 15:26 ` [PATCH 4/5] drm/amdgpu: remove in_baco_reset hack Alex Deucher 2019-10-10 15:26 ` [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU Alex Deucher 4 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2019-10-10 15:26 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher Use the base class rather than the specific class and drop the second loop. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 3e35a8f2c5e5..a97fb759e2f4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c @@ -613,17 +613,7 @@ static bool amdgpu_atpx_detect(void) bool d3_supported = false; struct pci_dev *parent_pdev; - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { - vga_count++; - - has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true); - - parent_pdev = pci_upstream_bridge(pdev); - d3_supported |= parent_pdev && parent_pdev->bridge_d3; - amdgpu_atpx_get_quirks(pdev); - } - - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { + while ((pdev = pci_get_class(PCI_BASE_CLASS_DISPLAY << 16, pdev)) != NULL) { vga_count++; has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true); -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/5] drm/amdgpu: remove in_baco_reset hack [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org> ` (2 preceding siblings ...) 2019-10-10 15:26 ` [PATCH 3/5] drm/amdgpu: simplify ATPX detection Alex Deucher @ 2019-10-10 15:26 ` Alex Deucher 2019-10-10 15:26 ` [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU Alex Deucher 4 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2019-10-10 15:26 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher It was a vega20 specific hack. Check if we are in reset and what reset method we are using. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 -- drivers/gpu/drm/amd/amdgpu/soc15.c | 2 -- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 4 ++-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index c82579c93265..438775d54a6a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -959,8 +959,6 @@ struct amdgpu_device { int asic_reset_res; struct work_struct xgmi_reset_work; - bool in_baco_reset; - long gfx_timeout; long sdma_timeout; long video_timeout; diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index fc6cfbced170..d17568dd9e87 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -507,8 +507,6 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev) dev_info(adev->dev, "GPU BACO reset\n"); - adev->in_baco_reset = 1; - return 0; } diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c index f5915308e643..892f9f5389b9 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c @@ -490,8 +490,8 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr) "Failed to init sclk threshold!", return ret); - if (adev->in_baco_reset) { - adev->in_baco_reset = 0; + if (adev->in_gpu_reset && + (amdgpu_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)) { ret = vega20_baco_apply_vdci_flush_workaround(hwmgr); if (ret) -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org> ` (3 preceding siblings ...) 2019-10-10 15:26 ` [PATCH 4/5] drm/amdgpu: remove in_baco_reset hack Alex Deucher @ 2019-10-10 15:26 ` Alex Deucher [not found] ` <20191010152619.31011-6-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 4 siblings, 1 reply; 12+ messages in thread From: Alex Deucher @ 2019-10-10 15:26 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher Add support for vega20 when the swSMU path is used. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/soc15.c | 53 +++++++++++++++++++----------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index d17568dd9e87..b3291a19a771 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -478,36 +478,51 @@ static int soc15_asic_mode1_reset(struct amdgpu_device *adev) static int soc15_asic_get_baco_capability(struct amdgpu_device *adev, bool *cap) { - void *pp_handle = adev->powerplay.pp_handle; - const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + if (is_support_sw_smu(adev)) { + struct smu_context *smu = &adev->smu; - if (!pp_funcs || !pp_funcs->get_asic_baco_capability) { - *cap = false; - return -ENOENT; - } + *cap = smu_baco_is_support(smu); + return 0; + } else { + void *pp_handle = adev->powerplay.pp_handle; + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; - return pp_funcs->get_asic_baco_capability(pp_handle, cap); + if (!pp_funcs || !pp_funcs->get_asic_baco_capability) { + *cap = false; + return -ENOENT; + } + + return pp_funcs->get_asic_baco_capability(pp_handle, cap); + } } static int soc15_asic_baco_reset(struct amdgpu_device *adev) { - void *pp_handle = adev->powerplay.pp_handle; - const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + if (is_support_sw_smu(adev)) { + struct smu_context *smu = &adev->smu; - if (!pp_funcs ||!pp_funcs->get_asic_baco_state ||!pp_funcs->set_asic_baco_state) - return -ENOENT; + dev_info(adev->dev, "GPU BACO reset\n"); + + return smu_baco_reset(smu); + } else { + void *pp_handle = adev->powerplay.pp_handle; + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; - /* enter BACO state */ - if (pp_funcs->set_asic_baco_state(pp_handle, 1)) - return -EIO; + if (!pp_funcs ||!pp_funcs->get_asic_baco_state ||!pp_funcs->set_asic_baco_state) + return -ENOENT; - /* exit BACO state */ - if (pp_funcs->set_asic_baco_state(pp_handle, 0)) - return -EIO; + /* enter BACO state */ + if (pp_funcs->set_asic_baco_state(pp_handle, 1)) + return -EIO; - dev_info(adev->dev, "GPU BACO reset\n"); + /* exit BACO state */ + if (pp_funcs->set_asic_baco_state(pp_handle, 0)) + return -EIO; - return 0; + dev_info(adev->dev, "GPU BACO reset\n"); + + return 0; + } } static int soc15_mode2_reset(struct amdgpu_device *adev) -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <20191010152619.31011-6-alexander.deucher-5C7GfCeVMHo@public.gmane.org>]
* RE: [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU [not found] ` <20191010152619.31011-6-alexander.deucher-5C7GfCeVMHo@public.gmane.org> @ 2019-10-11 4:09 ` Quan, Evan 0 siblings, 0 replies; 12+ messages in thread From: Quan, Evan @ 2019-10-11 4:09 UTC (permalink / raw) To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Deucher, Alexander Except patch2, series is reviewed-by: Evan Quan <evan.quan@amd.com> -----Original Message----- From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher Sent: Thursday, October 10, 2019 11:26 PM To: amd-gfx@lists.freedesktop.org Cc: Deucher, Alexander <Alexander.Deucher@amd.com> Subject: [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU Add support for vega20 when the swSMU path is used. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/amd/amdgpu/soc15.c | 53 +++++++++++++++++++----------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index d17568dd9e87..b3291a19a771 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -478,36 +478,51 @@ static int soc15_asic_mode1_reset(struct amdgpu_device *adev) static int soc15_asic_get_baco_capability(struct amdgpu_device *adev, bool *cap) { - void *pp_handle = adev->powerplay.pp_handle; - const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + if (is_support_sw_smu(adev)) { + struct smu_context *smu = &adev->smu; - if (!pp_funcs || !pp_funcs->get_asic_baco_capability) { - *cap = false; - return -ENOENT; - } + *cap = smu_baco_is_support(smu); + return 0; + } else { + void *pp_handle = adev->powerplay.pp_handle; + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; - return pp_funcs->get_asic_baco_capability(pp_handle, cap); + if (!pp_funcs || !pp_funcs->get_asic_baco_capability) { + *cap = false; + return -ENOENT; + } + + return pp_funcs->get_asic_baco_capability(pp_handle, cap); + } } static int soc15_asic_baco_reset(struct amdgpu_device *adev) { - void *pp_handle = adev->powerplay.pp_handle; - const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + if (is_support_sw_smu(adev)) { + struct smu_context *smu = &adev->smu; - if (!pp_funcs ||!pp_funcs->get_asic_baco_state ||!pp_funcs->set_asic_baco_state) - return -ENOENT; + dev_info(adev->dev, "GPU BACO reset\n"); + + return smu_baco_reset(smu); + } else { + void *pp_handle = adev->powerplay.pp_handle; + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; - /* enter BACO state */ - if (pp_funcs->set_asic_baco_state(pp_handle, 1)) - return -EIO; + if (!pp_funcs ||!pp_funcs->get_asic_baco_state ||!pp_funcs->set_asic_baco_state) + return -ENOENT; - /* exit BACO state */ - if (pp_funcs->set_asic_baco_state(pp_handle, 0)) - return -EIO; + /* enter BACO state */ + if (pp_funcs->set_asic_baco_state(pp_handle, 1)) + return -EIO; - dev_info(adev->dev, "GPU BACO reset\n"); + /* exit BACO state */ + if (pp_funcs->set_asic_baco_state(pp_handle, 0)) + return -EIO; - return 0; + dev_info(adev->dev, "GPU BACO reset\n"); + + return 0; + } } static int soc15_mode2_reset(struct amdgpu_device *adev) -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-10-12 1:49 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-10 15:26 [PATCH 0/5] Misc runpm and baco fixes Alex Deucher [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 2019-10-10 15:26 ` [PATCH 1/5] drm/amdgpu: move pci_save_state into suspend path Alex Deucher 2019-10-10 15:26 ` [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend Alex Deucher [not found] ` <20191010152619.31011-3-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 2019-10-11 4:07 ` Quan, Evan [not found] ` <BN8PR12MB3329E4B5DE6B027D43B38F5AE4970-h6+T2+wrnx3WSNCBJ7MpiAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 2019-10-11 4:09 ` Quan, Evan 2019-10-11 13:25 ` Alex Deucher [not found] ` <CADnq5_Pbi+K=62tY0sJdOARy74wpnh+Owfq3wQb0tcyXE2XtFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2019-10-12 1:42 ` Quan, Evan [not found] ` <MN2PR12MB3344923284A5FF12F631B634E4960-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 2019-10-12 1:49 ` Alex Deucher 2019-10-10 15:26 ` [PATCH 3/5] drm/amdgpu: simplify ATPX detection Alex Deucher 2019-10-10 15:26 ` [PATCH 4/5] drm/amdgpu: remove in_baco_reset hack Alex Deucher 2019-10-10 15:26 ` [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU Alex Deucher [not found] ` <20191010152619.31011-6-alexander.deucher-5C7GfCeVMHo@public.gmane.org> 2019-10-11 4:09 ` Quan, Evan
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.