aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/evergreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/evergreen.c')
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c58
1 files changed, 42 insertions, 16 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 488c36c8f5e6..7b337c361a12 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -748,6 +748,8 @@ void evergreen_pcie_gart_tlb_flush(struct radeon_device *rdev)
748 unsigned i; 748 unsigned i;
749 u32 tmp; 749 u32 tmp;
750 750
751 WREG32(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
752
751 WREG32(VM_CONTEXT0_REQUEST_RESPONSE, REQUEST_TYPE(1)); 753 WREG32(VM_CONTEXT0_REQUEST_RESPONSE, REQUEST_TYPE(1));
752 for (i = 0; i < rdev->usec_timeout; i++) { 754 for (i = 0; i < rdev->usec_timeout; i++) {
753 /* read MC_STATUS */ 755 /* read MC_STATUS */
@@ -1650,7 +1652,36 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1650 } 1652 }
1651 } 1653 }
1652 1654
1653 rdev->config.evergreen.tile_config = gb_addr_config; 1655 /* setup tiling info dword. gb_addr_config is not adequate since it does
1656 * not have bank info, so create a custom tiling dword.
1657 * bits 3:0 num_pipes
1658 * bits 7:4 num_banks
1659 * bits 11:8 group_size
1660 * bits 15:12 row_size
1661 */
1662 rdev->config.evergreen.tile_config = 0;
1663 switch (rdev->config.evergreen.max_tile_pipes) {
1664 case 1:
1665 default:
1666 rdev->config.evergreen.tile_config |= (0 << 0);
1667 break;
1668 case 2:
1669 rdev->config.evergreen.tile_config |= (1 << 0);
1670 break;
1671 case 4:
1672 rdev->config.evergreen.tile_config |= (2 << 0);
1673 break;
1674 case 8:
1675 rdev->config.evergreen.tile_config |= (3 << 0);
1676 break;
1677 }
1678 rdev->config.evergreen.tile_config |=
1679 ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) << 4;
1680 rdev->config.evergreen.tile_config |=
1681 ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) << 8;
1682 rdev->config.evergreen.tile_config |=
1683 ((gb_addr_config & 0x30000000) >> 28) << 12;
1684
1654 WREG32(GB_BACKEND_MAP, gb_backend_map); 1685 WREG32(GB_BACKEND_MAP, gb_backend_map);
1655 WREG32(GB_ADDR_CONFIG, gb_addr_config); 1686 WREG32(GB_ADDR_CONFIG, gb_addr_config);
1656 WREG32(DMIF_ADDR_CONFIG, gb_addr_config); 1687 WREG32(DMIF_ADDR_CONFIG, gb_addr_config);
@@ -1893,7 +1924,6 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev)
1893static int evergreen_gpu_soft_reset(struct radeon_device *rdev) 1924static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1894{ 1925{
1895 struct evergreen_mc_save save; 1926 struct evergreen_mc_save save;
1896 u32 srbm_reset = 0;
1897 u32 grbm_reset = 0; 1927 u32 grbm_reset = 0;
1898 1928
1899 dev_info(rdev->dev, "GPU softreset \n"); 1929 dev_info(rdev->dev, "GPU softreset \n");
@@ -1932,16 +1962,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1932 udelay(50); 1962 udelay(50);
1933 WREG32(GRBM_SOFT_RESET, 0); 1963 WREG32(GRBM_SOFT_RESET, 0);
1934 (void)RREG32(GRBM_SOFT_RESET); 1964 (void)RREG32(GRBM_SOFT_RESET);
1935
1936 /* reset all the system blocks */
1937 srbm_reset = SRBM_SOFT_RESET_ALL_MASK;
1938
1939 dev_info(rdev->dev, " SRBM_SOFT_RESET=0x%08X\n", srbm_reset);
1940 WREG32(SRBM_SOFT_RESET, srbm_reset);
1941 (void)RREG32(SRBM_SOFT_RESET);
1942 udelay(50);
1943 WREG32(SRBM_SOFT_RESET, 0);
1944 (void)RREG32(SRBM_SOFT_RESET);
1945 /* Wait a little for things to settle down */ 1965 /* Wait a little for things to settle down */
1946 udelay(50); 1966 udelay(50);
1947 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 1967 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
@@ -1952,10 +1972,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1952 RREG32(GRBM_STATUS_SE1)); 1972 RREG32(GRBM_STATUS_SE1));
1953 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 1973 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n",
1954 RREG32(SRBM_STATUS)); 1974 RREG32(SRBM_STATUS));
1955 /* After reset we need to reinit the asic as GPU often endup in an
1956 * incoherent state.
1957 */
1958 atom_asic_init(rdev->mode_info.atom_context);
1959 evergreen_mc_resume(rdev, &save); 1975 evergreen_mc_resume(rdev, &save);
1960 return 0; 1976 return 0;
1961} 1977}
@@ -2567,6 +2583,11 @@ int evergreen_resume(struct radeon_device *rdev)
2567{ 2583{
2568 int r; 2584 int r;
2569 2585
2586 /* reset the asic, the gfx blocks are often in a bad state
2587 * after the driver is unloaded or after a resume
2588 */
2589 if (radeon_asic_reset(rdev))
2590 dev_warn(rdev->dev, "GPU reset failed !\n");
2570 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, 2591 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw,
2571 * posting will perform necessary task to bring back GPU into good 2592 * posting will perform necessary task to bring back GPU into good
2572 * shape. 2593 * shape.
@@ -2683,6 +2704,11 @@ int evergreen_init(struct radeon_device *rdev)
2683 r = radeon_atombios_init(rdev); 2704 r = radeon_atombios_init(rdev);
2684 if (r) 2705 if (r)
2685 return r; 2706 return r;
2707 /* reset the asic, the gfx blocks are often in a bad state
2708 * after the driver is unloaded or after a resume
2709 */
2710 if (radeon_asic_reset(rdev))
2711 dev_warn(rdev->dev, "GPU reset failed !\n");
2686 /* Post card if necessary */ 2712 /* Post card if necessary */
2687 if (!evergreen_card_posted(rdev)) { 2713 if (!evergreen_card_posted(rdev)) {
2688 if (!rdev->bios) { 2714 if (!rdev->bios) {