* [PATCH 1/2] drm/amdgpu: wire up a pci shutdown callback
@ 2016-08-22 18:30 Alex Deucher
[not found] ` <1471890641-4759-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2016-08-22 18:30 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher
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@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,
};
--
2.5.5
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/radeon: wire up a pci shutdown callback
[not found] ` <1471890641-4759-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2016-08-22 18:30 ` Alex Deucher
2016-08-23 1:27 ` [PATCH 1/2] drm/amdgpu: " Edward O'Callaghan
2016-08-23 8:07 ` Christian König
2 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2016-08-22 18:30 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher
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@amd.com>
---
drivers/gpu/drm/radeon/radeon_device.c | 2 +-
drivers/gpu/drm/radeon/radeon_drv.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index a00dd2f..6b0d26f 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)
* Used at driver startup.
* Returns true if virtual or false if not.
*/
-static bool radeon_device_is_virtual(void)
+bool radeon_device_is_virtual(void)
{
#ifdef CONFIG_X86
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 c01a7c6ab..40e5335 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -309,6 +309,8 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
static struct drm_driver kms_driver;
+bool radeon_device_is_virtual(void);
+
static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
{
struct apertures_struct *ap;
@@ -362,6 +364,16 @@ radeon_pci_remove(struct pci_dev *pdev)
drm_put_dev(dev);
}
+static void
+radeon_pci_shutdown(struct pci_dev *pdev)
+{
+ /* if we are running in a VM, make sure the device
+ * torn down properly on reboot/shutdown
+ */
+ if (radeon_device_is_virtual())
+ radeon_pci_remove(pdev);
+}
+
static int radeon_pmops_suspend(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
@@ -574,6 +586,7 @@ static struct pci_driver radeon_kms_pci_driver = {
.id_table = pciidlist,
.probe = radeon_pci_probe,
.remove = radeon_pci_remove,
+ .shutdown = radeon_pci_shutdown,
.driver.pm = &radeon_pm_ops,
};
--
2.5.5
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu: wire up a pci shutdown callback
[not found] ` <1471890641-4759-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-08-22 18:30 ` [PATCH 2/2] drm/radeon: " Alex Deucher
@ 2016-08-23 1:27 ` Edward O'Callaghan
2016-08-23 8:07 ` Christian König
2 siblings, 0 replies; 4+ messages in thread
From: Edward O'Callaghan @ 2016-08-23 1:27 UTC (permalink / raw)
To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher
[-- Attachment #1.1.1: Type: text/plain, Size: 1725 bytes --]
This series is,
Reviewed-by: Edward O'Callaghan <funfunctor-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
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-5C7GfCeVMHo@public.gmane.org>
> ---
> 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,
> };
>
>
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 154 bytes --]
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu: wire up a pci shutdown callback
[not found] ` <1471890641-4759-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-08-22 18:30 ` [PATCH 2/2] drm/radeon: " Alex Deucher
2016-08-23 1:27 ` [PATCH 1/2] drm/amdgpu: " Edward O'Callaghan
@ 2016-08-23 8:07 ` Christian König
2 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2016-08-23 8:07 UTC (permalink / raw)
To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher
Am 22.08.2016 um 20:30 schrieb Alex Deucher:
> 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@amd.com>
Both patches are Reviewed-by: Christian König <christian.koenig@amd.com>
Regards,
Christian.
> ---
> 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,
> };
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-23 8:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22 18:30 [PATCH 1/2] drm/amdgpu: wire up a pci shutdown callback Alex Deucher
[not found] ` <1471890641-4759-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-08-22 18:30 ` [PATCH 2/2] drm/radeon: " Alex Deucher
2016-08-23 1:27 ` [PATCH 1/2] drm/amdgpu: " Edward O'Callaghan
2016-08-23 8:07 ` Christian König
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.