diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2013-08-14 01:03:41 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-08-30 16:30:29 -0400 |
commit | cc8dbbb4f62aa53e604e7c61dedc03ee4e8dfed4 (patch) | |
tree | e346ae250ed7c00644b883cbe024695fe8c40524 /drivers/gpu/drm/radeon/cik.c | |
parent | 41a524abff2630dce0f9c38eb7340fbf2dc5bf27 (diff) |
drm/radeon: add dpm support for CI dGPUs (v2)
This adds dpm support for btc asics. This includes:
- dynamic engine clock scaling
- dynamic memory clock scaling
- dynamic voltage scaling
- dynamic pcie gen switching
Set radeon.dpm=1 to enable.
v2: remove unused radeon_atombios.c changes,
make missing smc ucode non-fatal
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/cik.c')
-rw-r--r-- | drivers/gpu/drm/radeon/cik.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 87e5aeed6e88..736a416b51a7 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -40,6 +40,7 @@ MODULE_FIRMWARE("radeon/BONAIRE_mec.bin"); | |||
40 | MODULE_FIRMWARE("radeon/BONAIRE_mc.bin"); | 40 | MODULE_FIRMWARE("radeon/BONAIRE_mc.bin"); |
41 | MODULE_FIRMWARE("radeon/BONAIRE_rlc.bin"); | 41 | MODULE_FIRMWARE("radeon/BONAIRE_rlc.bin"); |
42 | MODULE_FIRMWARE("radeon/BONAIRE_sdma.bin"); | 42 | MODULE_FIRMWARE("radeon/BONAIRE_sdma.bin"); |
43 | MODULE_FIRMWARE("radeon/BONAIRE_smc.bin"); | ||
43 | MODULE_FIRMWARE("radeon/KAVERI_pfp.bin"); | 44 | MODULE_FIRMWARE("radeon/KAVERI_pfp.bin"); |
44 | MODULE_FIRMWARE("radeon/KAVERI_me.bin"); | 45 | MODULE_FIRMWARE("radeon/KAVERI_me.bin"); |
45 | MODULE_FIRMWARE("radeon/KAVERI_ce.bin"); | 46 | MODULE_FIRMWARE("radeon/KAVERI_ce.bin"); |
@@ -1545,7 +1546,7 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1545 | const char *chip_name; | 1546 | const char *chip_name; |
1546 | size_t pfp_req_size, me_req_size, ce_req_size, | 1547 | size_t pfp_req_size, me_req_size, ce_req_size, |
1547 | mec_req_size, rlc_req_size, mc_req_size, | 1548 | mec_req_size, rlc_req_size, mc_req_size, |
1548 | sdma_req_size; | 1549 | sdma_req_size, smc_req_size; |
1549 | char fw_name[30]; | 1550 | char fw_name[30]; |
1550 | int err; | 1551 | int err; |
1551 | 1552 | ||
@@ -1561,6 +1562,7 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1561 | rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; | 1562 | rlc_req_size = BONAIRE_RLC_UCODE_SIZE * 4; |
1562 | mc_req_size = CIK_MC_UCODE_SIZE * 4; | 1563 | mc_req_size = CIK_MC_UCODE_SIZE * 4; |
1563 | sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; | 1564 | sdma_req_size = CIK_SDMA_UCODE_SIZE * 4; |
1565 | smc_req_size = ALIGN(BONAIRE_SMC_UCODE_SIZE, 4); | ||
1564 | break; | 1566 | break; |
1565 | case CHIP_KAVERI: | 1567 | case CHIP_KAVERI: |
1566 | chip_name = "KAVERI"; | 1568 | chip_name = "KAVERI"; |
@@ -1652,7 +1654,7 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1652 | err = -EINVAL; | 1654 | err = -EINVAL; |
1653 | } | 1655 | } |
1654 | 1656 | ||
1655 | /* No MC ucode on APUs */ | 1657 | /* No SMC, MC ucode on APUs */ |
1656 | if (!(rdev->flags & RADEON_IS_IGP)) { | 1658 | if (!(rdev->flags & RADEON_IS_IGP)) { |
1657 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); | 1659 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); |
1658 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); | 1660 | err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev); |
@@ -1664,6 +1666,21 @@ static int cik_init_microcode(struct radeon_device *rdev) | |||
1664 | rdev->mc_fw->size, fw_name); | 1666 | rdev->mc_fw->size, fw_name); |
1665 | err = -EINVAL; | 1667 | err = -EINVAL; |
1666 | } | 1668 | } |
1669 | |||
1670 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | ||
1671 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | ||
1672 | if (err) { | ||
1673 | printk(KERN_ERR | ||
1674 | "smc: error loading firmware \"%s\"\n", | ||
1675 | fw_name); | ||
1676 | release_firmware(rdev->smc_fw); | ||
1677 | rdev->smc_fw = NULL; | ||
1678 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
1679 | printk(KERN_ERR | ||
1680 | "cik_smc: Bogus length %zu in firmware \"%s\"\n", | ||
1681 | rdev->smc_fw->size, fw_name); | ||
1682 | err = -EINVAL; | ||
1683 | } | ||
1667 | } | 1684 | } |
1668 | 1685 | ||
1669 | out: | 1686 | out: |
@@ -1682,6 +1699,8 @@ out: | |||
1682 | rdev->rlc_fw = NULL; | 1699 | rdev->rlc_fw = NULL; |
1683 | release_firmware(rdev->mc_fw); | 1700 | release_firmware(rdev->mc_fw); |
1684 | rdev->mc_fw = NULL; | 1701 | rdev->mc_fw = NULL; |
1702 | release_firmware(rdev->smc_fw); | ||
1703 | rdev->smc_fw = NULL; | ||
1685 | } | 1704 | } |
1686 | return err; | 1705 | return err; |
1687 | } | 1706 | } |
@@ -6626,8 +6645,12 @@ int cik_irq_set(struct radeon_device *rdev) | |||
6626 | cp_m2p2 = RREG32(CP_ME2_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; | 6645 | cp_m2p2 = RREG32(CP_ME2_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
6627 | cp_m2p3 = RREG32(CP_ME2_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; | 6646 | cp_m2p3 = RREG32(CP_ME2_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
6628 | 6647 | ||
6629 | thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL) & | 6648 | if (rdev->flags & RADEON_IS_IGP) |
6630 | ~(THERM_INTH_MASK | THERM_INTL_MASK); | 6649 | thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL) & |
6650 | ~(THERM_INTH_MASK | THERM_INTL_MASK); | ||
6651 | else | ||
6652 | thermal_int = RREG32_SMC(CG_THERMAL_INT) & | ||
6653 | ~(THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW); | ||
6631 | 6654 | ||
6632 | /* enable CP interrupts on all rings */ | 6655 | /* enable CP interrupts on all rings */ |
6633 | if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) { | 6656 | if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) { |
@@ -6788,7 +6811,10 @@ int cik_irq_set(struct radeon_device *rdev) | |||
6788 | 6811 | ||
6789 | if (rdev->irq.dpm_thermal) { | 6812 | if (rdev->irq.dpm_thermal) { |
6790 | DRM_DEBUG("dpm thermal\n"); | 6813 | DRM_DEBUG("dpm thermal\n"); |
6791 | thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK; | 6814 | if (rdev->flags & RADEON_IS_IGP) |
6815 | thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK; | ||
6816 | else | ||
6817 | thermal_int |= THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW; | ||
6792 | } | 6818 | } |
6793 | 6819 | ||
6794 | WREG32(CP_INT_CNTL_RING0, cp_int_cntl); | 6820 | WREG32(CP_INT_CNTL_RING0, cp_int_cntl); |
@@ -6825,7 +6851,10 @@ int cik_irq_set(struct radeon_device *rdev) | |||
6825 | WREG32(DC_HPD5_INT_CONTROL, hpd5); | 6851 | WREG32(DC_HPD5_INT_CONTROL, hpd5); |
6826 | WREG32(DC_HPD6_INT_CONTROL, hpd6); | 6852 | WREG32(DC_HPD6_INT_CONTROL, hpd6); |
6827 | 6853 | ||
6828 | WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int); | 6854 | if (rdev->flags & RADEON_IS_IGP) |
6855 | WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int); | ||
6856 | else | ||
6857 | WREG32_SMC(CG_THERMAL_INT, thermal_int); | ||
6829 | 6858 | ||
6830 | return 0; | 6859 | return 0; |
6831 | } | 6860 | } |