All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: Alex Deucher
	<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH 1/2] drm/amdgpu: reset the asic when hibernating
Date: Tue, 23 Aug 2016 09:52:42 +0800	[thread overview]
Message-ID: <57BBAC6A.6010803@amd.com> (raw)
In-Reply-To: <1471881925-27757-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>

This series is Reviewed-by: Chunming Zhou <david1.zhou@amd.com>



On 2016年08月23日 00:05, Alex Deucher wrote:
> Some blocks require a reset to properly resume if there
> is no power down of the asic like during various
> hibernation steps.
>
> Port of:
> 274ad65c9d02bdcbee9bae045517864c3521d530
> (drm/radeon: hard reset r600 and newer GPU when hibernating.)
> from radeon.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  3 ++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +++++++---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  6 +++---
>   3 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 6fa8268..d0d0588 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -2436,7 +2436,8 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
>   				 struct drm_file *file_priv);
>   void amdgpu_driver_preclose_kms(struct drm_device *dev,
>   				struct drm_file *file_priv);
> -int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon);
> +int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon,
> +		       bool freeze);
>   int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
>   u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
>   int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 21f4b74..5747e37 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1037,7 +1037,7 @@ static void amdgpu_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero
>   		printk(KERN_INFO "amdgpu: switched off\n");
>   		drm_kms_helper_poll_disable(dev);
>   		dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
> -		amdgpu_suspend_kms(dev, true, true);
> +		amdgpu_suspend_kms(dev, true, true, false);
>   		dev->switch_power_state = DRM_SWITCH_POWER_OFF;
>   	}
>   }
> @@ -1780,7 +1780,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
>    * Returns 0 for success or an error on failure.
>    * Called at driver suspend.
>    */
> -int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
> +int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon,
> +		       bool freeze)
>   {
>   	struct amdgpu_device *adev;
>   	struct drm_crtc *crtc;
> @@ -1844,7 +1845,10 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
>   	amdgpu_bo_evict_vram(adev);
>   
>   	pci_save_state(dev->pdev);
> -	if (suspend) {
> +	if (freeze) {
> +		/* reset the asic during freeze */
> +		r = amdgpu_asic_reset(adev);
> +	} else if (suspend) {
>   		/* Shut down the device */
>   		pci_disable_device(dev->pdev);
>   		pci_set_power_state(dev->pdev, PCI_D3hot);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 58b1db8..eb4c9b0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -395,7 +395,7 @@ static int amdgpu_pmops_suspend(struct device *dev)
>   {
>   	struct pci_dev *pdev = to_pci_dev(dev);
>   	struct drm_device *drm_dev = pci_get_drvdata(pdev);
> -	return amdgpu_suspend_kms(drm_dev, true, true);
> +	return amdgpu_suspend_kms(drm_dev, true, true, false);
>   }
>   
>   static int amdgpu_pmops_resume(struct device *dev)
> @@ -409,7 +409,7 @@ static int amdgpu_pmops_freeze(struct device *dev)
>   {
>   	struct pci_dev *pdev = to_pci_dev(dev);
>   	struct drm_device *drm_dev = pci_get_drvdata(pdev);
> -	return amdgpu_suspend_kms(drm_dev, false, true);
> +	return amdgpu_suspend_kms(drm_dev, false, true, true);
>   }
>   
>   static int amdgpu_pmops_thaw(struct device *dev)
> @@ -434,7 +434,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
>   	drm_kms_helper_poll_disable(drm_dev);
>   	vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
>   
> -	ret = amdgpu_suspend_kms(drm_dev, false, false);
> +	ret = amdgpu_suspend_kms(drm_dev, false, false, false);
>   	pci_save_state(pdev);
>   	pci_disable_device(pdev);
>   	pci_ignore_hotplug(pdev);

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2016-08-23  1:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-22 16:05 [PATCH 1/2] drm/amdgpu: reset the asic when hibernating Alex Deucher
     [not found] ` <1471881925-27757-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-08-22 16:05   ` [PATCH 2/2] drm/amdgpu: reset the asic on shutdown Alex Deucher
2016-08-23  1:52   ` zhoucm1 [this message]
     [not found]     ` <57BBAC6A.6010803-5C7GfCeVMHo@public.gmane.org>
2016-08-23  2:04       ` 答复: [PATCH 1/2] drm/amdgpu: reset the asic when hibernating Qu, Jim
     [not found]         ` <BY2PR12MB0614D30441286DA319B5BB5A99EB0-K//h7OWB4q5SmL+xRiD5tgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-23  2:42           ` Deucher, Alexander
     [not found]             ` <MWHPR12MB169439C210055B00095BA4EEF7EB0-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-23  2:48               ` 答复: " Qu, Jim
2016-08-23  4:18   ` Qu, Jim
     [not found]     ` <BY2PR12MB061454ACDE5467ECE63934A599EB0-K//h7OWB4q5SmL+xRiD5tgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-23  4:41       ` Qu, Jim
2016-08-23  4:46       ` Alex Deucher
     [not found]         ` <CADnq5_NvxFp3Z+wwPfZV2DzBwafyi8HoOGRPey+XNbuD7CFzdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-23  5:34           ` 答复: " Qu, Jim
2016-08-23  8:05   ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57BBAC6A.6010803@amd.com \
    --to=david1.zhou-5c7gfcevmho@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.