diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-08-22 14:29:44 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-02 10:35:57 -0400 |
commit | a801abe4773dadcea4be4dc0affcc3a22d41543c (patch) | |
tree | d8fb4f9498204a6456cfeb350ec2ac2f50616988 | |
parent | 61e113067b636fe73d5d0ac877bcfcebe7cfd034 (diff) |
drm/radeon: wire up a pci shutdown callback
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.
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_drv.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index cfb3e4fee24b..8425b1248eaf 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -639,7 +639,7 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
639 | * Used at driver startup. | 639 | * Used at driver startup. |
640 | * Returns true if virtual or false if not. | 640 | * Returns true if virtual or false if not. |
641 | */ | 641 | */ |
642 | static bool radeon_device_is_virtual(void) | 642 | bool radeon_device_is_virtual(void) |
643 | { | 643 | { |
644 | #ifdef CONFIG_X86 | 644 | #ifdef CONFIG_X86 |
645 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); | 645 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index c9e6928e06d4..5fdd48c12b18 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -310,6 +310,8 @@ MODULE_DEVICE_TABLE(pci, pciidlist); | |||
310 | 310 | ||
311 | static struct drm_driver kms_driver; | 311 | static struct drm_driver kms_driver; |
312 | 312 | ||
313 | bool radeon_device_is_virtual(void); | ||
314 | |||
313 | static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) | 315 | static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) |
314 | { | 316 | { |
315 | struct apertures_struct *ap; | 317 | struct apertures_struct *ap; |
@@ -363,6 +365,16 @@ radeon_pci_remove(struct pci_dev *pdev) | |||
363 | drm_put_dev(dev); | 365 | drm_put_dev(dev); |
364 | } | 366 | } |
365 | 367 | ||
368 | static void | ||
369 | radeon_pci_shutdown(struct pci_dev *pdev) | ||
370 | { | ||
371 | /* if we are running in a VM, make sure the device | ||
372 | * torn down properly on reboot/shutdown | ||
373 | */ | ||
374 | if (radeon_device_is_virtual()) | ||
375 | radeon_pci_remove(pdev); | ||
376 | } | ||
377 | |||
366 | static int radeon_pmops_suspend(struct device *dev) | 378 | static int radeon_pmops_suspend(struct device *dev) |
367 | { | 379 | { |
368 | struct pci_dev *pdev = to_pci_dev(dev); | 380 | struct pci_dev *pdev = to_pci_dev(dev); |
@@ -583,6 +595,7 @@ static struct pci_driver radeon_kms_pci_driver = { | |||
583 | .id_table = pciidlist, | 595 | .id_table = pciidlist, |
584 | .probe = radeon_pci_probe, | 596 | .probe = radeon_pci_probe, |
585 | .remove = radeon_pci_remove, | 597 | .remove = radeon_pci_remove, |
598 | .shutdown = radeon_pci_shutdown, | ||
586 | .driver.pm = &radeon_pm_ops, | 599 | .driver.pm = &radeon_pm_ops, |
587 | }; | 600 | }; |
588 | 601 | ||