[PATCH 1/2] drm/amdgpu: wire up a pci shutdown callback

Edward O'Callaghan funfunctor at folklore1984.net
Tue Aug 23 01:27:28 UTC 2016


This series is,

Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 08/23/2016 04:30 AM, Alex Deucher wrote:
> Normally on shutdown or reboot we don't care about necessarily
> making sure the hw is in a good state because the system is about
> to be powered down or reset.  However, after a shutdown or reboot
> in a VM, it's best to tear down the hw properly otherwise there
> can be problems with the next VM use.
> 
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 5c7a77b..0da4336 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -392,6 +392,19 @@ amdgpu_pci_remove(struct pci_dev *pdev)
>  	drm_put_dev(dev);
>  }
>  
> +static void
> +amdgpu_pci_shutdown(struct pci_dev *pdev)
> +{
> +	struct drm_device *dev = pci_get_drvdata(pdev);
> +	struct amdgpu_device *adev = dev->dev_private;
> +
> +	/* if we are running in a VM, make sure the device
> +	 * torn down properly on reboot/shutdown
> +	 */
> +	if (adev->virtualization.is_virtual)
> +		amdgpu_pci_remove(pdev);
> +}
> +
>  static int amdgpu_pmops_suspend(struct device *dev)
>  {
>  	struct pci_dev *pdev = to_pci_dev(dev);
> @@ -605,6 +618,7 @@ static struct pci_driver amdgpu_kms_pci_driver = {
>  	.id_table = pciidlist,
>  	.probe = amdgpu_pci_probe,
>  	.remove = amdgpu_pci_remove,
> +	.shutdown = amdgpu_pci_shutdown,
>  	.driver.pm = &amdgpu_pm_ops,
>  };
>  
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160823/9b4a6e68/attachment-0001.sig>


More information about the amd-gfx mailing list