Re: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend

2019-10-11 Thread Alex Deucher
Thanks.  I'll make note of this in the commit message.

On Fri, Oct 11, 2019 at 9:42 PM Quan, Evan  wrote:
>
> Thanks for the clarification. That will be fine then.
> Reviewed-by: Evan Quan 
>
> -Original Message-
> From: Alex Deucher 
> Sent: Friday, October 11, 2019 9:25 PM
> To: Quan, Evan 
> Cc: amd-gfx@lists.freedesktop.org; Deucher, Alexander 
> 
> 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  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  On Behalf Of
> > Alex Deucher
> > Sent: Thursday, October 10, 2019 11:26 PM
> > To: amd-gfx@lists.freedesktop.org
> > Cc: Deucher, Alexander 
> > 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 
> > ---
> >  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

RE: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend

2019-10-11 Thread Quan, Evan
Thanks for the clarification. That will be fine then.
Reviewed-by: Evan Quan 

-Original Message-
From: Alex Deucher  
Sent: Friday, October 11, 2019 9:25 PM
To: Quan, Evan 
Cc: amd-gfx@lists.freedesktop.org; Deucher, Alexander 

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  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  On Behalf Of 
> Alex Deucher
> Sent: Thursday, October 10, 2019 11:26 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander 
> 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 
> ---
>  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

Re: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend

2019-10-11 Thread Alex Deucher
On Fri, Oct 11, 2019 at 12:07 AM Quan, Evan  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  On Behalf Of Alex 
> Deucher
> Sent: Thursday, October 10, 2019 11:26 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander 
> 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 
> ---
>  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

RE: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend

2019-10-10 Thread Quan, Evan
> 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 ; amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander 
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  On Behalf Of Alex Deucher
Sent: Thursday, October 10, 2019 11:26 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander 
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 
---
 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

RE: [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend

2019-10-10 Thread Quan, Evan
It seems amdgpu_pmops_runtime_suspend() needs to be updated accordingly also.

-Original Message-
From: amd-gfx  On Behalf Of Alex Deucher
Sent: Thursday, October 10, 2019 11:26 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander 
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 
---
 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

[PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend

2019-10-10 Thread 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 
---
 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