diff options
author | Dave Airlie <airlied@redhat.com> | 2017-10-08 21:00:16 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-10-08 21:00:16 -0400 |
commit | bb7a9c8d712f37385a706a594d6edf6e6d2669d0 (patch) | |
tree | 701a317ca8ecc2bedc40577b657dcdda3e7428c5 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | 15438ab06515b093d61e2f35bb27d21e5e7f966e (diff) | |
parent | d3f04c98ead2b89887e1e3c09b26e4917bacdd9e (diff) |
Merge branch 'drm-next-4.15' of git://people.freedesktop.org/~agd5f/linux into drm-next
More new stuff for 4.15. Highlights:
- Add clock query interface for raven
- Add new FENCE_TO_HANDLE ioctl
- UVD video encode ring support on polaris
- transparent huge page DMA support
- deadlock fixes
- compute pipe lru tweaks
- powerplay cleanups and regression fixes
- fix duplicate symbol issue with radeon and amdgpu
- misc bug fixes
* 'drm-next-4.15' of git://people.freedesktop.org/~agd5f/linux: (72 commits)
drm/radeon/dp: make radeon_dp_get_dp_link_config static
drm/radeon: move ci_send_msg_to_smc to where it's used
drm/amd/sched: fix deadlock caused by unsignaled fences of deleted jobs
drm/amd/sched: NULL out the s_fence field after run_job
drm/amd/sched: move adding finish callback to amd_sched_job_begin
drm/amd/sched: fix an outdated comment
drm/amd/sched: rename amd_sched_entity_pop_job
drm/amdgpu: minor coding style fix
drm/ttm: add transparent huge page support for DMA allocations v2
drm/ttm: add support for different pool sizes
drm/ttm: remove unsued options from ttm_mem_global_alloc_page
drm/amdgpu: add uvd enc irq
drm/amdgpu: add uvd enc ib test
drm/amdgpu: add uvd enc ring test
drm/amdgpu: add uvd enc vm functions (v2)
drm/amdgpu: add uvd enc into run queue
drm/amdgpu: add uvd enc rings
drm/amdgpu: add new uvd enc ring methods
drm/amdgpu: add uvd enc command in header
drm/amdgpu: add uvd enc registers in header
...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 3e84ddf9e3b5..1949d8aedf49 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "amdgpu_vf_error.h" | 56 | #include "amdgpu_vf_error.h" |
57 | 57 | ||
58 | #include "amdgpu_amdkfd.h" | 58 | #include "amdgpu_amdkfd.h" |
59 | #include "amdgpu_pm.h" | ||
59 | 60 | ||
60 | MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin"); | 61 | MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin"); |
61 | MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin"); | 62 | MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin"); |
@@ -1603,6 +1604,7 @@ static int amdgpu_init(struct amdgpu_device *adev) | |||
1603 | return r; | 1604 | return r; |
1604 | } | 1605 | } |
1605 | adev->ip_blocks[i].status.sw = true; | 1606 | adev->ip_blocks[i].status.sw = true; |
1607 | |||
1606 | /* need to do gmc hw init early so we can allocate gpu mem */ | 1608 | /* need to do gmc hw init early so we can allocate gpu mem */ |
1607 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { | 1609 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { |
1608 | r = amdgpu_vram_scratch_init(adev); | 1610 | r = amdgpu_vram_scratch_init(adev); |
@@ -1633,6 +1635,11 @@ static int amdgpu_init(struct amdgpu_device *adev) | |||
1633 | } | 1635 | } |
1634 | } | 1636 | } |
1635 | 1637 | ||
1638 | mutex_lock(&adev->firmware.mutex); | ||
1639 | if (amdgpu_ucode_init_bo(adev)) | ||
1640 | adev->firmware.load_type = AMDGPU_FW_LOAD_DIRECT; | ||
1641 | mutex_unlock(&adev->firmware.mutex); | ||
1642 | |||
1636 | for (i = 0; i < adev->num_ip_blocks; i++) { | 1643 | for (i = 0; i < adev->num_ip_blocks; i++) { |
1637 | if (!adev->ip_blocks[i].status.sw) | 1644 | if (!adev->ip_blocks[i].status.sw) |
1638 | continue; | 1645 | continue; |
@@ -1768,6 +1775,8 @@ static int amdgpu_fini(struct amdgpu_device *adev) | |||
1768 | 1775 | ||
1769 | adev->ip_blocks[i].status.hw = false; | 1776 | adev->ip_blocks[i].status.hw = false; |
1770 | } | 1777 | } |
1778 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) | ||
1779 | amdgpu_ucode_fini_bo(adev); | ||
1771 | 1780 | ||
1772 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { | 1781 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { |
1773 | if (!adev->ip_blocks[i].status.sw) | 1782 | if (!adev->ip_blocks[i].status.sw) |
@@ -2040,6 +2049,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2040 | mutex_init(&adev->srbm_mutex); | 2049 | mutex_init(&adev->srbm_mutex); |
2041 | mutex_init(&adev->grbm_idx_mutex); | 2050 | mutex_init(&adev->grbm_idx_mutex); |
2042 | mutex_init(&adev->mn_lock); | 2051 | mutex_init(&adev->mn_lock); |
2052 | mutex_init(&adev->virt.vf_errors.lock); | ||
2043 | hash_init(adev->mn_hash); | 2053 | hash_init(adev->mn_hash); |
2044 | 2054 | ||
2045 | amdgpu_check_arguments(adev); | 2055 | amdgpu_check_arguments(adev); |
@@ -2125,7 +2135,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2125 | r = amdgpu_atombios_init(adev); | 2135 | r = amdgpu_atombios_init(adev); |
2126 | if (r) { | 2136 | if (r) { |
2127 | dev_err(adev->dev, "amdgpu_atombios_init failed\n"); | 2137 | dev_err(adev->dev, "amdgpu_atombios_init failed\n"); |
2128 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL, 0, 0); | 2138 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL, 0, 0); |
2129 | goto failed; | 2139 | goto failed; |
2130 | } | 2140 | } |
2131 | 2141 | ||
@@ -2136,7 +2146,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2136 | if (amdgpu_vpost_needed(adev)) { | 2146 | if (amdgpu_vpost_needed(adev)) { |
2137 | if (!adev->bios) { | 2147 | if (!adev->bios) { |
2138 | dev_err(adev->dev, "no vBIOS found\n"); | 2148 | dev_err(adev->dev, "no vBIOS found\n"); |
2139 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_NO_VBIOS, 0, 0); | 2149 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_NO_VBIOS, 0, 0); |
2140 | r = -EINVAL; | 2150 | r = -EINVAL; |
2141 | goto failed; | 2151 | goto failed; |
2142 | } | 2152 | } |
@@ -2144,7 +2154,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2144 | r = amdgpu_atom_asic_init(adev->mode_info.atom_context); | 2154 | r = amdgpu_atom_asic_init(adev->mode_info.atom_context); |
2145 | if (r) { | 2155 | if (r) { |
2146 | dev_err(adev->dev, "gpu post error!\n"); | 2156 | dev_err(adev->dev, "gpu post error!\n"); |
2147 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_GPU_POST_ERROR, 0, 0); | 2157 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_POST_ERROR, 0, 0); |
2148 | goto failed; | 2158 | goto failed; |
2149 | } | 2159 | } |
2150 | } else { | 2160 | } else { |
@@ -2156,7 +2166,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2156 | r = amdgpu_atomfirmware_get_clock_info(adev); | 2166 | r = amdgpu_atomfirmware_get_clock_info(adev); |
2157 | if (r) { | 2167 | if (r) { |
2158 | dev_err(adev->dev, "amdgpu_atomfirmware_get_clock_info failed\n"); | 2168 | dev_err(adev->dev, "amdgpu_atomfirmware_get_clock_info failed\n"); |
2159 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0); | 2169 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0); |
2160 | goto failed; | 2170 | goto failed; |
2161 | } | 2171 | } |
2162 | } else { | 2172 | } else { |
@@ -2164,7 +2174,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2164 | r = amdgpu_atombios_get_clock_info(adev); | 2174 | r = amdgpu_atombios_get_clock_info(adev); |
2165 | if (r) { | 2175 | if (r) { |
2166 | dev_err(adev->dev, "amdgpu_atombios_get_clock_info failed\n"); | 2176 | dev_err(adev->dev, "amdgpu_atombios_get_clock_info failed\n"); |
2167 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0); | 2177 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL, 0, 0); |
2168 | goto failed; | 2178 | goto failed; |
2169 | } | 2179 | } |
2170 | /* init i2c buses */ | 2180 | /* init i2c buses */ |
@@ -2175,7 +2185,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2175 | r = amdgpu_fence_driver_init(adev); | 2185 | r = amdgpu_fence_driver_init(adev); |
2176 | if (r) { | 2186 | if (r) { |
2177 | dev_err(adev->dev, "amdgpu_fence_driver_init failed\n"); | 2187 | dev_err(adev->dev, "amdgpu_fence_driver_init failed\n"); |
2178 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_FENCE_INIT_FAIL, 0, 0); | 2188 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_FENCE_INIT_FAIL, 0, 0); |
2179 | goto failed; | 2189 | goto failed; |
2180 | } | 2190 | } |
2181 | 2191 | ||
@@ -2185,7 +2195,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2185 | r = amdgpu_init(adev); | 2195 | r = amdgpu_init(adev); |
2186 | if (r) { | 2196 | if (r) { |
2187 | dev_err(adev->dev, "amdgpu_init failed\n"); | 2197 | dev_err(adev->dev, "amdgpu_init failed\n"); |
2188 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL, 0, 0); | 2198 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL, 0, 0); |
2189 | amdgpu_fini(adev); | 2199 | amdgpu_fini(adev); |
2190 | goto failed; | 2200 | goto failed; |
2191 | } | 2201 | } |
@@ -2205,7 +2215,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2205 | r = amdgpu_ib_pool_init(adev); | 2215 | r = amdgpu_ib_pool_init(adev); |
2206 | if (r) { | 2216 | if (r) { |
2207 | dev_err(adev->dev, "IB initialization failed (%d).\n", r); | 2217 | dev_err(adev->dev, "IB initialization failed (%d).\n", r); |
2208 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_IB_INIT_FAIL, 0, r); | 2218 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_IB_INIT_FAIL, 0, r); |
2209 | goto failed; | 2219 | goto failed; |
2210 | } | 2220 | } |
2211 | 2221 | ||
@@ -2215,6 +2225,10 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2215 | 2225 | ||
2216 | amdgpu_fbdev_init(adev); | 2226 | amdgpu_fbdev_init(adev); |
2217 | 2227 | ||
2228 | r = amdgpu_pm_sysfs_init(adev); | ||
2229 | if (r) | ||
2230 | DRM_ERROR("registering pm debugfs failed (%d).\n", r); | ||
2231 | |||
2218 | r = amdgpu_gem_debugfs_init(adev); | 2232 | r = amdgpu_gem_debugfs_init(adev); |
2219 | if (r) | 2233 | if (r) |
2220 | DRM_ERROR("registering gem debugfs failed (%d).\n", r); | 2234 | DRM_ERROR("registering gem debugfs failed (%d).\n", r); |
@@ -2254,7 +2268,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2254 | r = amdgpu_late_init(adev); | 2268 | r = amdgpu_late_init(adev); |
2255 | if (r) { | 2269 | if (r) { |
2256 | dev_err(adev->dev, "amdgpu_late_init failed\n"); | 2270 | dev_err(adev->dev, "amdgpu_late_init failed\n"); |
2257 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_AMDGPU_LATE_INIT_FAIL, 0, r); | 2271 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_LATE_INIT_FAIL, 0, r); |
2258 | goto failed; | 2272 | goto failed; |
2259 | } | 2273 | } |
2260 | 2274 | ||
@@ -2311,6 +2325,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev) | |||
2311 | iounmap(adev->rmmio); | 2325 | iounmap(adev->rmmio); |
2312 | adev->rmmio = NULL; | 2326 | adev->rmmio = NULL; |
2313 | amdgpu_doorbell_fini(adev); | 2327 | amdgpu_doorbell_fini(adev); |
2328 | amdgpu_pm_sysfs_fini(adev); | ||
2314 | amdgpu_debugfs_regs_cleanup(adev); | 2329 | amdgpu_debugfs_regs_cleanup(adev); |
2315 | } | 2330 | } |
2316 | 2331 | ||
@@ -2936,7 +2951,7 @@ out: | |||
2936 | } | 2951 | } |
2937 | } else { | 2952 | } else { |
2938 | dev_err(adev->dev, "asic resume failed (%d).\n", r); | 2953 | dev_err(adev->dev, "asic resume failed (%d).\n", r); |
2939 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_ASIC_RESUME_FAIL, 0, r); | 2954 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ASIC_RESUME_FAIL, 0, r); |
2940 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 2955 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
2941 | if (adev->rings[i] && adev->rings[i]->sched.thread) { | 2956 | if (adev->rings[i] && adev->rings[i]->sched.thread) { |
2942 | kthread_unpark(adev->rings[i]->sched.thread); | 2957 | kthread_unpark(adev->rings[i]->sched.thread); |
@@ -2950,7 +2965,7 @@ out: | |||
2950 | if (r) { | 2965 | if (r) { |
2951 | /* bad news, how to tell it to userspace ? */ | 2966 | /* bad news, how to tell it to userspace ? */ |
2952 | dev_info(adev->dev, "GPU reset failed\n"); | 2967 | dev_info(adev->dev, "GPU reset failed\n"); |
2953 | amdgpu_vf_error_put(AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r); | 2968 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r); |
2954 | } | 2969 | } |
2955 | else { | 2970 | else { |
2956 | dev_info(adev->dev, "GPU reset successed!\n"); | 2971 | dev_info(adev->dev, "GPU reset successed!\n"); |