diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-06-03 18:21:41 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-07 14:51:14 -0400 |
commit | 83ba126a9be318ca4f66b066faadd2c728d1568c (patch) | |
tree | ea5e59922d2bf8d31b658064b519c12fce185019 /drivers/gpu/drm | |
parent | bdfb76040068d960cb9e226876be8a508d741c4a (diff) |
drm/amdgpu: properly clean up runtime pm
Was missing the calls to fini.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 6e920086af46..aa146452b4f6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1511,17 +1511,20 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1511 | vga_switcheroo_init_domain_pm_ops(adev->dev, &adev->vga_pm_domain); | 1511 | vga_switcheroo_init_domain_pm_ops(adev->dev, &adev->vga_pm_domain); |
1512 | 1512 | ||
1513 | /* Read BIOS */ | 1513 | /* Read BIOS */ |
1514 | if (!amdgpu_get_bios(adev)) | 1514 | if (!amdgpu_get_bios(adev)) { |
1515 | return -EINVAL; | 1515 | r = -EINVAL; |
1516 | goto failed; | ||
1517 | } | ||
1516 | /* Must be an ATOMBIOS */ | 1518 | /* Must be an ATOMBIOS */ |
1517 | if (!adev->is_atom_bios) { | 1519 | if (!adev->is_atom_bios) { |
1518 | dev_err(adev->dev, "Expecting atombios for GPU\n"); | 1520 | dev_err(adev->dev, "Expecting atombios for GPU\n"); |
1519 | return -EINVAL; | 1521 | r = -EINVAL; |
1522 | goto failed; | ||
1520 | } | 1523 | } |
1521 | r = amdgpu_atombios_init(adev); | 1524 | r = amdgpu_atombios_init(adev); |
1522 | if (r) { | 1525 | if (r) { |
1523 | dev_err(adev->dev, "amdgpu_atombios_init failed\n"); | 1526 | dev_err(adev->dev, "amdgpu_atombios_init failed\n"); |
1524 | return r; | 1527 | goto failed; |
1525 | } | 1528 | } |
1526 | 1529 | ||
1527 | /* See if the asic supports SR-IOV */ | 1530 | /* See if the asic supports SR-IOV */ |
@@ -1538,7 +1541,8 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1538 | !(adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN))) { | 1541 | !(adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN))) { |
1539 | if (!adev->bios) { | 1542 | if (!adev->bios) { |
1540 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); | 1543 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); |
1541 | return -EINVAL; | 1544 | r = -EINVAL; |
1545 | goto failed; | ||
1542 | } | 1546 | } |
1543 | DRM_INFO("GPU not posted. posting now...\n"); | 1547 | DRM_INFO("GPU not posted. posting now...\n"); |
1544 | amdgpu_atom_asic_init(adev->mode_info.atom_context); | 1548 | amdgpu_atom_asic_init(adev->mode_info.atom_context); |
@@ -1548,7 +1552,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1548 | r = amdgpu_atombios_get_clock_info(adev); | 1552 | r = amdgpu_atombios_get_clock_info(adev); |
1549 | if (r) { | 1553 | if (r) { |
1550 | dev_err(adev->dev, "amdgpu_atombios_get_clock_info failed\n"); | 1554 | dev_err(adev->dev, "amdgpu_atombios_get_clock_info failed\n"); |
1551 | return r; | 1555 | goto failed; |
1552 | } | 1556 | } |
1553 | /* init i2c buses */ | 1557 | /* init i2c buses */ |
1554 | amdgpu_atombios_i2c_init(adev); | 1558 | amdgpu_atombios_i2c_init(adev); |
@@ -1557,7 +1561,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1557 | r = amdgpu_fence_driver_init(adev); | 1561 | r = amdgpu_fence_driver_init(adev); |
1558 | if (r) { | 1562 | if (r) { |
1559 | dev_err(adev->dev, "amdgpu_fence_driver_init failed\n"); | 1563 | dev_err(adev->dev, "amdgpu_fence_driver_init failed\n"); |
1560 | return r; | 1564 | goto failed; |
1561 | } | 1565 | } |
1562 | 1566 | ||
1563 | /* init the mode config */ | 1567 | /* init the mode config */ |
@@ -1567,7 +1571,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1567 | if (r) { | 1571 | if (r) { |
1568 | dev_err(adev->dev, "amdgpu_init failed\n"); | 1572 | dev_err(adev->dev, "amdgpu_init failed\n"); |
1569 | amdgpu_fini(adev); | 1573 | amdgpu_fini(adev); |
1570 | return r; | 1574 | goto failed; |
1571 | } | 1575 | } |
1572 | 1576 | ||
1573 | adev->accel_working = true; | 1577 | adev->accel_working = true; |
@@ -1577,7 +1581,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1577 | r = amdgpu_ib_pool_init(adev); | 1581 | r = amdgpu_ib_pool_init(adev); |
1578 | if (r) { | 1582 | if (r) { |
1579 | dev_err(adev->dev, "IB initialization failed (%d).\n", r); | 1583 | dev_err(adev->dev, "IB initialization failed (%d).\n", r); |
1580 | return r; | 1584 | goto failed; |
1581 | } | 1585 | } |
1582 | 1586 | ||
1583 | r = amdgpu_ib_ring_tests(adev); | 1587 | r = amdgpu_ib_ring_tests(adev); |
@@ -1619,10 +1623,15 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1619 | r = amdgpu_late_init(adev); | 1623 | r = amdgpu_late_init(adev); |
1620 | if (r) { | 1624 | if (r) { |
1621 | dev_err(adev->dev, "amdgpu_late_init failed\n"); | 1625 | dev_err(adev->dev, "amdgpu_late_init failed\n"); |
1622 | return r; | 1626 | goto failed; |
1623 | } | 1627 | } |
1624 | 1628 | ||
1625 | return 0; | 1629 | return 0; |
1630 | |||
1631 | failed: | ||
1632 | if (runtime) | ||
1633 | vga_switcheroo_fini_domain_pm_ops(adev->dev); | ||
1634 | return r; | ||
1626 | } | 1635 | } |
1627 | 1636 | ||
1628 | static void amdgpu_debugfs_remove_files(struct amdgpu_device *adev); | 1637 | static void amdgpu_debugfs_remove_files(struct amdgpu_device *adev); |
@@ -1656,6 +1665,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev) | |||
1656 | kfree(adev->bios); | 1665 | kfree(adev->bios); |
1657 | adev->bios = NULL; | 1666 | adev->bios = NULL; |
1658 | vga_switcheroo_unregister_client(adev->pdev); | 1667 | vga_switcheroo_unregister_client(adev->pdev); |
1668 | if (adev->flags & AMD_IS_PX) | ||
1669 | vga_switcheroo_fini_domain_pm_ops(adev->dev); | ||
1659 | vga_client_register(adev->pdev, NULL, NULL, NULL); | 1670 | vga_client_register(adev->pdev, NULL, NULL, NULL); |
1660 | if (adev->rio_mem) | 1671 | if (adev->rio_mem) |
1661 | pci_iounmap(adev->pdev, adev->rio_mem); | 1672 | pci_iounmap(adev->pdev, adev->rio_mem); |