aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-03-20 21:46:05 -0400
committerDave Airlie <airlied@redhat.com>2018-03-20 21:46:05 -0400
commit287d2ac36b6f2830ea4ef66c110abc0f47a9a658 (patch)
tree04214f156461a95c2f7ca5a8821063cad7fc515e /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent963976cfe9c54d4d9e725e61c90c47a4af6b5ea2 (diff)
parent6da2b9332c572fcda94de9631f8fa514f574388a (diff)
Merge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm-next
- Continued cleanup and restructuring of powerplay - Fetch VRAM type from vbios rather than hardcoding for SOC15 asics - Allow ttm to drop its backing store when drivers don't need it - DC bandwidth calc updates - Enable DC backlight control pre-DCE11 asics - Enable DC on all supported asics - DC Fixes for planes due to the way our hw is ordered vs what drm expects - DC CTM/regamma fixes - Misc cleanup and bug fixes * 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux: (89 commits) amdgpu/dm: Default PRE_VEGA ASIC support to 'y' drm/amd/pp: Remove the cgs wrapper for notify smu version on APU drm/amd/display: fix dereferencing possible ERR_PTR() drm/amd/display: Refine disable VGA drm/amdgpu: Improve documentation of bo_ptr in amdgpu_bo_create_kernel drm/radeon: Don't turn off DP sink when disconnected drm/amd/pp: Rename file name cz_* to smu8_* drm/amd/pp: Replace function/struct name cz_* with smu8_* drm/amd/pp: Remove unneeded void * casts in cz_hwmgr.c/cz_smumgr.c drm/amd/pp: Mv cz uvd/vce pg/dpm functions to cz_hwmgr.c drm/amd/pp: Remove dead header file pp_asicblocks.h drm/amd/pp: Delete dead code on cz_clockpowergating.c drm/amdgpu: Call amdgpu_ucode_fini_bo in amd_powerplay.c drm/amdgpu: Remove wrapper layer of smu ip functions drm/amdgpu: Don't compared ip_block_type with ip_block_index drm/amdgpu: Plus NULL function pointer check drm/amd/pp: Move helper functions to smu_help.c drm/amd/pp: Replace rv_* with smu10_* drm/amd/pp: Fix function parameter not correct drm/amd/pp: Add rv_copy_table_from/to_smc to smu backend function table ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 856378434ea2..690cf77b950e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -87,6 +87,8 @@ static const char *amdgpu_asic_name[] = {
87 "LAST", 87 "LAST",
88}; 88};
89 89
90static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev);
91
90bool amdgpu_device_is_px(struct drm_device *dev) 92bool amdgpu_device_is_px(struct drm_device *dev)
91{ 93{
92 struct amdgpu_device *adev = dev->dev_private; 94 struct amdgpu_device *adev = dev->dev_private;
@@ -121,6 +123,32 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg,
121 return ret; 123 return ret;
122} 124}
123 125
126/*
127 * MMIO register read with bytes helper functions
128 * @offset:bytes offset from MMIO start
129 *
130*/
131
132uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset) {
133 if (offset < adev->rmmio_size)
134 return (readb(adev->rmmio + offset));
135 BUG();
136}
137
138/*
139 * MMIO register write with bytes helper functions
140 * @offset:bytes offset from MMIO start
141 * @value: the value want to be written to the register
142 *
143*/
144void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value) {
145 if (offset < adev->rmmio_size)
146 writeb(value, adev->rmmio + offset);
147 else
148 BUG();
149}
150
151
124void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v, 152void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
125 uint32_t acc_flags) 153 uint32_t acc_flags)
126{ 154{
@@ -830,6 +858,8 @@ static void amdgpu_device_check_arguments(struct amdgpu_device *adev)
830 dev_warn(adev->dev, "lockup_timeout msut be > 0, adjusting to 10000\n"); 858 dev_warn(adev->dev, "lockup_timeout msut be > 0, adjusting to 10000\n");
831 amdgpu_lockup_timeout = 10000; 859 amdgpu_lockup_timeout = 10000;
832 } 860 }
861
862 adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);
833} 863}
834 864
835/** 865/**
@@ -1387,7 +1417,8 @@ static int amdgpu_device_ip_late_set_cg_state(struct amdgpu_device *adev)
1387 continue; 1417 continue;
1388 /* skip CG for VCE/UVD, it's handled specially */ 1418 /* skip CG for VCE/UVD, it's handled specially */
1389 if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && 1419 if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
1390 adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) { 1420 adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE &&
1421 adev->ip_blocks[i].version->funcs->set_clockgating_state) {
1391 /* enable clockgating to save power */ 1422 /* enable clockgating to save power */
1392 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, 1423 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
1393 AMD_CG_STATE_GATE); 1424 AMD_CG_STATE_GATE);
@@ -1436,7 +1467,8 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
1436 for (i = 0; i < adev->num_ip_blocks; i++) { 1467 for (i = 0; i < adev->num_ip_blocks; i++) {
1437 if (!adev->ip_blocks[i].status.hw) 1468 if (!adev->ip_blocks[i].status.hw)
1438 continue; 1469 continue;
1439 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) { 1470 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC &&
1471 adev->ip_blocks[i].version->funcs->set_clockgating_state) {
1440 /* ungate blocks before hw fini so that we can shutdown the blocks safely */ 1472 /* ungate blocks before hw fini so that we can shutdown the blocks safely */
1441 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, 1473 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
1442 AMD_CG_STATE_UNGATE); 1474 AMD_CG_STATE_UNGATE);
@@ -1545,7 +1577,8 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev)
1545 if (!adev->ip_blocks[i].status.valid) 1577 if (!adev->ip_blocks[i].status.valid)
1546 continue; 1578 continue;
1547 /* ungate blocks so that suspend can properly shut them down */ 1579 /* ungate blocks so that suspend can properly shut them down */
1548 if (i != AMD_IP_BLOCK_TYPE_SMC) { 1580 if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_SMC &&
1581 adev->ip_blocks[i].version->funcs->set_clockgating_state) {
1549 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, 1582 r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
1550 AMD_CG_STATE_UNGATE); 1583 AMD_CG_STATE_UNGATE);
1551 if (r) { 1584 if (r) {
@@ -1878,6 +1911,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1878 if (adev->rio_mem == NULL) 1911 if (adev->rio_mem == NULL)
1879 DRM_INFO("PCI I/O BAR is not found.\n"); 1912 DRM_INFO("PCI I/O BAR is not found.\n");
1880 1913
1914 amdgpu_device_get_pcie_info(adev);
1915
1881 /* early init functions */ 1916 /* early init functions */
1882 r = amdgpu_device_ip_early_init(adev); 1917 r = amdgpu_device_ip_early_init(adev);
1883 if (r) 1918 if (r)
@@ -2086,6 +2121,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
2086 2121
2087 amdgpu_ib_pool_fini(adev); 2122 amdgpu_ib_pool_fini(adev);
2088 amdgpu_fence_driver_fini(adev); 2123 amdgpu_fence_driver_fini(adev);
2124 amdgpu_pm_sysfs_fini(adev);
2089 amdgpu_fbdev_fini(adev); 2125 amdgpu_fbdev_fini(adev);
2090 r = amdgpu_device_ip_fini(adev); 2126 r = amdgpu_device_ip_fini(adev);
2091 if (adev->firmware.gpu_info_fw) { 2127 if (adev->firmware.gpu_info_fw) {
@@ -2114,7 +2150,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
2114 iounmap(adev->rmmio); 2150 iounmap(adev->rmmio);
2115 adev->rmmio = NULL; 2151 adev->rmmio = NULL;
2116 amdgpu_device_doorbell_fini(adev); 2152 amdgpu_device_doorbell_fini(adev);
2117 amdgpu_pm_sysfs_fini(adev);
2118 amdgpu_debugfs_regs_cleanup(adev); 2153 amdgpu_debugfs_regs_cleanup(adev);
2119} 2154}
2120 2155
@@ -2755,7 +2790,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
2755 return r; 2790 return r;
2756} 2791}
2757 2792
2758void amdgpu_device_get_pcie_info(struct amdgpu_device *adev) 2793static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)
2759{ 2794{
2760 u32 mask; 2795 u32 mask;
2761 int ret; 2796 int ret;