diff options
| author | Dave Airlie <airlied@redhat.com> | 2019-01-10 16:37:56 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2019-01-10 16:38:56 -0500 |
| commit | f34c48e06ddcc197f2cf7cbc006ceb74e28e1ccf (patch) | |
| tree | 0ed9729f815bc281827ca83293bf31c8f1e73ff8 | |
| parent | bd86c9e66c8385fb437c5ad506243304a8814b65 (diff) | |
| parent | 1c1eba86339c8517814863bc7dd21e2661a84e77 (diff) | |
Merge branch 'drm-fixes-5.0' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
- Powerplay fixes
- Virtual display pinning fixes
- Golden register updates for vega
- Pitch and gem size validation fixes
- Fix for error case in sr-iov init
- Disable page tables in system memory on RV due to issues with IOMMU
reported on some platforms
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190109204336.3315-1-alexander.deucher@amd.com
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 38 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 22 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 17 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 48 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 14 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/include/kgd_pp_interface.h | 13 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 24 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 8 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 12 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 34 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 |
15 files changed, 156 insertions, 96 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 8a078f4ae73d..7ff3a28fc903 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
| @@ -1701,8 +1701,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) | |||
| 1701 | amdgpu_xgmi_add_device(adev); | 1701 | amdgpu_xgmi_add_device(adev); |
| 1702 | amdgpu_amdkfd_device_init(adev); | 1702 | amdgpu_amdkfd_device_init(adev); |
| 1703 | 1703 | ||
| 1704 | if (amdgpu_sriov_vf(adev)) | 1704 | if (amdgpu_sriov_vf(adev)) { |
| 1705 | amdgpu_virt_init_data_exchange(adev); | ||
| 1705 | amdgpu_virt_release_full_gpu(adev, true); | 1706 | amdgpu_virt_release_full_gpu(adev, true); |
| 1707 | } | ||
| 1706 | 1708 | ||
| 1707 | return 0; | 1709 | return 0; |
| 1708 | } | 1710 | } |
| @@ -2632,9 +2634,6 @@ fence_driver_init: | |||
| 2632 | goto failed; | 2634 | goto failed; |
| 2633 | } | 2635 | } |
| 2634 | 2636 | ||
| 2635 | if (amdgpu_sriov_vf(adev)) | ||
| 2636 | amdgpu_virt_init_data_exchange(adev); | ||
| 2637 | |||
| 2638 | amdgpu_fbdev_init(adev); | 2637 | amdgpu_fbdev_init(adev); |
| 2639 | 2638 | ||
| 2640 | r = amdgpu_pm_sysfs_init(adev); | 2639 | r = amdgpu_pm_sysfs_init(adev); |
| @@ -2798,7 +2797,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) | |||
| 2798 | struct drm_framebuffer *fb = crtc->primary->fb; | 2797 | struct drm_framebuffer *fb = crtc->primary->fb; |
| 2799 | struct amdgpu_bo *robj; | 2798 | struct amdgpu_bo *robj; |
| 2800 | 2799 | ||
| 2801 | if (amdgpu_crtc->cursor_bo) { | 2800 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { |
| 2802 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | 2801 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); |
| 2803 | r = amdgpu_bo_reserve(aobj, true); | 2802 | r = amdgpu_bo_reserve(aobj, true); |
| 2804 | if (r == 0) { | 2803 | if (r == 0) { |
| @@ -2906,7 +2905,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) | |||
| 2906 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 2905 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
| 2907 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2906 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
| 2908 | 2907 | ||
| 2909 | if (amdgpu_crtc->cursor_bo) { | 2908 | if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) { |
| 2910 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); | 2909 | struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo); |
| 2911 | r = amdgpu_bo_reserve(aobj, true); | 2910 | r = amdgpu_bo_reserve(aobj, true); |
| 2912 | if (r == 0) { | 2911 | if (r == 0) { |
| @@ -3226,6 +3225,7 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev, | |||
| 3226 | r = amdgpu_ib_ring_tests(adev); | 3225 | r = amdgpu_ib_ring_tests(adev); |
| 3227 | 3226 | ||
| 3228 | error: | 3227 | error: |
| 3228 | amdgpu_virt_init_data_exchange(adev); | ||
| 3229 | amdgpu_virt_release_full_gpu(adev, true); | 3229 | amdgpu_virt_release_full_gpu(adev, true); |
| 3230 | if (!r && adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) { | 3230 | if (!r && adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) { |
| 3231 | atomic_inc(&adev->vram_lost_counter); | 3231 | atomic_inc(&adev->vram_lost_counter); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 15ce7e681d67..dafc645b2e4e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | |||
| @@ -188,10 +188,12 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, | |||
| 188 | goto cleanup; | 188 | goto cleanup; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | r = amdgpu_bo_pin(new_abo, amdgpu_display_supported_domains(adev)); | 191 | if (!adev->enable_virtual_display) { |
| 192 | if (unlikely(r != 0)) { | 192 | r = amdgpu_bo_pin(new_abo, amdgpu_display_supported_domains(adev)); |
| 193 | DRM_ERROR("failed to pin new abo buffer before flip\n"); | 193 | if (unlikely(r != 0)) { |
| 194 | goto unreserve; | 194 | DRM_ERROR("failed to pin new abo buffer before flip\n"); |
| 195 | goto unreserve; | ||
| 196 | } | ||
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | r = amdgpu_ttm_alloc_gart(&new_abo->tbo); | 199 | r = amdgpu_ttm_alloc_gart(&new_abo->tbo); |
| @@ -211,7 +213,8 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, | |||
| 211 | amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags); | 213 | amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags); |
| 212 | amdgpu_bo_unreserve(new_abo); | 214 | amdgpu_bo_unreserve(new_abo); |
| 213 | 215 | ||
| 214 | work->base = amdgpu_bo_gpu_offset(new_abo); | 216 | if (!adev->enable_virtual_display) |
| 217 | work->base = amdgpu_bo_gpu_offset(new_abo); | ||
| 215 | work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) + | 218 | work->target_vblank = target - (uint32_t)drm_crtc_vblank_count(crtc) + |
| 216 | amdgpu_get_vblank_counter_kms(dev, work->crtc_id); | 219 | amdgpu_get_vblank_counter_kms(dev, work->crtc_id); |
| 217 | 220 | ||
| @@ -242,9 +245,10 @@ pflip_cleanup: | |||
| 242 | goto cleanup; | 245 | goto cleanup; |
| 243 | } | 246 | } |
| 244 | unpin: | 247 | unpin: |
| 245 | if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) { | 248 | if (!adev->enable_virtual_display) |
| 246 | DRM_ERROR("failed to unpin new abo in error path\n"); | 249 | if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) |
| 247 | } | 250 | DRM_ERROR("failed to unpin new abo in error path\n"); |
| 251 | |||
| 248 | unreserve: | 252 | unreserve: |
| 249 | amdgpu_bo_unreserve(new_abo); | 253 | amdgpu_bo_unreserve(new_abo); |
| 250 | 254 | ||
| @@ -527,6 +531,17 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, | |||
| 527 | struct drm_gem_object *obj; | 531 | struct drm_gem_object *obj; |
| 528 | struct amdgpu_framebuffer *amdgpu_fb; | 532 | struct amdgpu_framebuffer *amdgpu_fb; |
| 529 | int ret; | 533 | int ret; |
| 534 | int height; | ||
| 535 | struct amdgpu_device *adev = dev->dev_private; | ||
| 536 | int cpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0); | ||
| 537 | int pitch = mode_cmd->pitches[0] / cpp; | ||
| 538 | |||
| 539 | pitch = amdgpu_align_pitch(adev, pitch, cpp, false); | ||
| 540 | if (mode_cmd->pitches[0] != pitch) { | ||
| 541 | DRM_DEBUG_KMS("Invalid pitch: expecting %d but got %d\n", | ||
| 542 | pitch, mode_cmd->pitches[0]); | ||
| 543 | return ERR_PTR(-EINVAL); | ||
| 544 | } | ||
| 530 | 545 | ||
| 531 | obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); | 546 | obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); |
| 532 | if (obj == NULL) { | 547 | if (obj == NULL) { |
| @@ -541,6 +556,13 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, | |||
| 541 | return ERR_PTR(-EINVAL); | 556 | return ERR_PTR(-EINVAL); |
| 542 | } | 557 | } |
| 543 | 558 | ||
| 559 | height = ALIGN(mode_cmd->height, 8); | ||
| 560 | if (obj->size < pitch * height) { | ||
| 561 | DRM_DEBUG_KMS("Invalid GEM size: expecting >= %d but got %zu\n", | ||
| 562 | pitch * height, obj->size); | ||
| 563 | return ERR_PTR(-EINVAL); | ||
| 564 | } | ||
| 565 | |||
| 544 | amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL); | 566 | amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL); |
| 545 | if (amdgpu_fb == NULL) { | 567 | if (amdgpu_fb == NULL) { |
| 546 | drm_gem_object_put_unlocked(obj); | 568 | drm_gem_object_put_unlocked(obj); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 1f61ed95727c..6896dec97fc7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |||
| @@ -2008,6 +2008,7 @@ void amdgpu_pm_print_power_states(struct amdgpu_device *adev) | |||
| 2008 | 2008 | ||
| 2009 | int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) | 2009 | int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) |
| 2010 | { | 2010 | { |
| 2011 | struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; | ||
| 2011 | int ret; | 2012 | int ret; |
| 2012 | 2013 | ||
| 2013 | if (adev->pm.sysfs_initialized) | 2014 | if (adev->pm.sysfs_initialized) |
| @@ -2091,12 +2092,14 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) | |||
| 2091 | "pp_power_profile_mode\n"); | 2092 | "pp_power_profile_mode\n"); |
| 2092 | return ret; | 2093 | return ret; |
| 2093 | } | 2094 | } |
| 2094 | ret = device_create_file(adev->dev, | 2095 | if (hwmgr->od_enabled) { |
| 2095 | &dev_attr_pp_od_clk_voltage); | 2096 | ret = device_create_file(adev->dev, |
| 2096 | if (ret) { | 2097 | &dev_attr_pp_od_clk_voltage); |
| 2097 | DRM_ERROR("failed to create device file " | 2098 | if (ret) { |
| 2098 | "pp_od_clk_voltage\n"); | 2099 | DRM_ERROR("failed to create device file " |
| 2099 | return ret; | 2100 | "pp_od_clk_voltage\n"); |
| 2101 | return ret; | ||
| 2102 | } | ||
| 2100 | } | 2103 | } |
| 2101 | ret = device_create_file(adev->dev, | 2104 | ret = device_create_file(adev->dev, |
| 2102 | &dev_attr_gpu_busy_percent); | 2105 | &dev_attr_gpu_busy_percent); |
| @@ -2118,6 +2121,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) | |||
| 2118 | 2121 | ||
| 2119 | void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) | 2122 | void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) |
| 2120 | { | 2123 | { |
| 2124 | struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; | ||
| 2125 | |||
| 2121 | if (adev->pm.dpm_enabled == 0) | 2126 | if (adev->pm.dpm_enabled == 0) |
| 2122 | return; | 2127 | return; |
| 2123 | 2128 | ||
| @@ -2138,8 +2143,9 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) | |||
| 2138 | device_remove_file(adev->dev, &dev_attr_pp_mclk_od); | 2143 | device_remove_file(adev->dev, &dev_attr_pp_mclk_od); |
| 2139 | device_remove_file(adev->dev, | 2144 | device_remove_file(adev->dev, |
| 2140 | &dev_attr_pp_power_profile_mode); | 2145 | &dev_attr_pp_power_profile_mode); |
| 2141 | device_remove_file(adev->dev, | 2146 | if (hwmgr->od_enabled) |
| 2142 | &dev_attr_pp_od_clk_voltage); | 2147 | device_remove_file(adev->dev, |
| 2148 | &dev_attr_pp_od_clk_voltage); | ||
| 2143 | device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); | 2149 | device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); |
| 2144 | } | 2150 | } |
| 2145 | 2151 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index e73d152659a2..d2ea5ce2cefb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
| @@ -847,9 +847,6 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
| 847 | bp->size = amdgpu_vm_bo_size(adev, level); | 847 | bp->size = amdgpu_vm_bo_size(adev, level); |
| 848 | bp->byte_align = AMDGPU_GPU_PAGE_SIZE; | 848 | bp->byte_align = AMDGPU_GPU_PAGE_SIZE; |
| 849 | bp->domain = AMDGPU_GEM_DOMAIN_VRAM; | 849 | bp->domain = AMDGPU_GEM_DOMAIN_VRAM; |
| 850 | if (bp->size <= PAGE_SIZE && adev->asic_type >= CHIP_VEGA10 && | ||
| 851 | adev->flags & AMD_IS_APU) | ||
| 852 | bp->domain |= AMDGPU_GEM_DOMAIN_GTT; | ||
| 853 | bp->domain = amdgpu_bo_get_preferred_pin_domain(adev, bp->domain); | 850 | bp->domain = amdgpu_bo_get_preferred_pin_domain(adev, bp->domain); |
| 854 | bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | | 851 | bp->flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | |
| 855 | AMDGPU_GEM_CREATE_CPU_GTT_USWC; | 852 | AMDGPU_GEM_CREATE_CPU_GTT_USWC; |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c index fdace004544d..e4cc1d48eaab 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c | |||
| @@ -167,19 +167,6 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc) | |||
| 167 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 167 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
| 168 | 168 | ||
| 169 | dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 169 | dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
| 170 | if (crtc->primary->fb) { | ||
| 171 | int r; | ||
| 172 | struct amdgpu_bo *abo; | ||
| 173 | |||
| 174 | abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); | ||
| 175 | r = amdgpu_bo_reserve(abo, true); | ||
| 176 | if (unlikely(r)) | ||
| 177 | DRM_ERROR("failed to reserve abo before unpin\n"); | ||
| 178 | else { | ||
| 179 | amdgpu_bo_unpin(abo); | ||
| 180 | amdgpu_bo_unreserve(abo); | ||
| 181 | } | ||
| 182 | } | ||
| 183 | 170 | ||
| 184 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; | 171 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; |
| 185 | amdgpu_crtc->encoder = NULL; | 172 | amdgpu_crtc->encoder = NULL; |
| @@ -692,7 +679,9 @@ static int dce_virtual_pageflip(struct amdgpu_device *adev, | |||
| 692 | spin_unlock_irqrestore(&adev->ddev->event_lock, flags); | 679 | spin_unlock_irqrestore(&adev->ddev->event_lock, flags); |
| 693 | 680 | ||
| 694 | drm_crtc_vblank_put(&amdgpu_crtc->base); | 681 | drm_crtc_vblank_put(&amdgpu_crtc->base); |
| 695 | schedule_work(&works->unpin_work); | 682 | amdgpu_bo_unref(&works->old_abo); |
| 683 | kfree(works->shared); | ||
| 684 | kfree(works); | ||
| 696 | 685 | ||
| 697 | return 0; | 686 | return 0; |
| 698 | } | 687 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 381f593b0cda..57cb3a51bda7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
| @@ -4233,7 +4233,6 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
| 4233 | u32 tmp; | 4233 | u32 tmp; |
| 4234 | u32 rb_bufsz; | 4234 | u32 rb_bufsz; |
| 4235 | u64 rb_addr, rptr_addr, wptr_gpu_addr; | 4235 | u64 rb_addr, rptr_addr, wptr_gpu_addr; |
| 4236 | int r; | ||
| 4237 | 4236 | ||
| 4238 | /* Set the write pointer delay */ | 4237 | /* Set the write pointer delay */ |
| 4239 | WREG32(mmCP_RB_WPTR_DELAY, 0); | 4238 | WREG32(mmCP_RB_WPTR_DELAY, 0); |
| @@ -4278,9 +4277,8 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
| 4278 | amdgpu_ring_clear_ring(ring); | 4277 | amdgpu_ring_clear_ring(ring); |
| 4279 | gfx_v8_0_cp_gfx_start(adev); | 4278 | gfx_v8_0_cp_gfx_start(adev); |
| 4280 | ring->sched.ready = true; | 4279 | ring->sched.ready = true; |
| 4281 | r = amdgpu_ring_test_helper(ring); | ||
| 4282 | 4280 | ||
| 4283 | return r; | 4281 | return 0; |
| 4284 | } | 4282 | } |
| 4285 | 4283 | ||
| 4286 | static void gfx_v8_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) | 4284 | static void gfx_v8_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) |
| @@ -4369,10 +4367,9 @@ static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev) | |||
| 4369 | amdgpu_ring_write(kiq_ring, upper_32_bits(wptr_addr)); | 4367 | amdgpu_ring_write(kiq_ring, upper_32_bits(wptr_addr)); |
| 4370 | } | 4368 | } |
| 4371 | 4369 | ||
| 4372 | r = amdgpu_ring_test_helper(kiq_ring); | 4370 | amdgpu_ring_commit(kiq_ring); |
| 4373 | if (r) | 4371 | |
| 4374 | DRM_ERROR("KCQ enable failed\n"); | 4372 | return 0; |
| 4375 | return r; | ||
| 4376 | } | 4373 | } |
| 4377 | 4374 | ||
| 4378 | static int gfx_v8_0_deactivate_hqd(struct amdgpu_device *adev, u32 req) | 4375 | static int gfx_v8_0_deactivate_hqd(struct amdgpu_device *adev, u32 req) |
| @@ -4709,16 +4706,32 @@ static int gfx_v8_0_kcq_resume(struct amdgpu_device *adev) | |||
| 4709 | if (r) | 4706 | if (r) |
| 4710 | goto done; | 4707 | goto done; |
| 4711 | 4708 | ||
| 4712 | /* Test KCQs - reversing the order of rings seems to fix ring test failure | 4709 | done: |
| 4713 | * after GPU reset | 4710 | return r; |
| 4714 | */ | 4711 | } |
| 4715 | for (i = adev->gfx.num_compute_rings - 1; i >= 0; i--) { | 4712 | |
| 4713 | static int gfx_v8_0_cp_test_all_rings(struct amdgpu_device *adev) | ||
| 4714 | { | ||
| 4715 | int r, i; | ||
| 4716 | struct amdgpu_ring *ring; | ||
| 4717 | |||
| 4718 | /* collect all the ring_tests here, gfx, kiq, compute */ | ||
| 4719 | ring = &adev->gfx.gfx_ring[0]; | ||
| 4720 | r = amdgpu_ring_test_helper(ring); | ||
| 4721 | if (r) | ||
| 4722 | return r; | ||
| 4723 | |||
| 4724 | ring = &adev->gfx.kiq.ring; | ||
| 4725 | r = amdgpu_ring_test_helper(ring); | ||
| 4726 | if (r) | ||
| 4727 | return r; | ||
| 4728 | |||
| 4729 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { | ||
| 4716 | ring = &adev->gfx.compute_ring[i]; | 4730 | ring = &adev->gfx.compute_ring[i]; |
| 4717 | r = amdgpu_ring_test_helper(ring); | 4731 | amdgpu_ring_test_helper(ring); |
| 4718 | } | 4732 | } |
| 4719 | 4733 | ||
| 4720 | done: | 4734 | return 0; |
| 4721 | return r; | ||
| 4722 | } | 4735 | } |
| 4723 | 4736 | ||
| 4724 | static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) | 4737 | static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) |
| @@ -4739,6 +4752,11 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) | |||
| 4739 | r = gfx_v8_0_kcq_resume(adev); | 4752 | r = gfx_v8_0_kcq_resume(adev); |
| 4740 | if (r) | 4753 | if (r) |
| 4741 | return r; | 4754 | return r; |
| 4755 | |||
| 4756 | r = gfx_v8_0_cp_test_all_rings(adev); | ||
| 4757 | if (r) | ||
| 4758 | return r; | ||
| 4759 | |||
| 4742 | gfx_v8_0_enable_gui_idle_interrupt(adev, true); | 4760 | gfx_v8_0_enable_gui_idle_interrupt(adev, true); |
| 4743 | 4761 | ||
| 4744 | return 0; | 4762 | return 0; |
| @@ -5086,6 +5104,8 @@ static int gfx_v8_0_post_soft_reset(void *handle) | |||
| 5086 | REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_GFX)) | 5104 | REG_GET_FIELD(grbm_soft_reset, GRBM_SOFT_RESET, SOFT_RESET_GFX)) |
| 5087 | gfx_v8_0_cp_gfx_resume(adev); | 5105 | gfx_v8_0_cp_gfx_resume(adev); |
| 5088 | 5106 | ||
| 5107 | gfx_v8_0_cp_test_all_rings(adev); | ||
| 5108 | |||
| 5089 | adev->gfx.rlc.funcs->start(adev); | 5109 | adev->gfx.rlc.funcs->start(adev); |
| 5090 | 5110 | ||
| 5091 | return 0; | 5111 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 7556716038d3..fbca0494f871 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | |||
| @@ -113,7 +113,10 @@ static const struct soc15_reg_golden golden_settings_gc_9_0[] = | |||
| 113 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_HI, 0xffffffff, 0x4a2c0e68), | 113 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_HI, 0xffffffff, 0x4a2c0e68), |
| 114 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_LO, 0xffffffff, 0xb5d3f197), | 114 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTCP_CHAN_STEER_LO, 0xffffffff, 0xb5d3f197), |
| 115 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_CACHE_INVALIDATION, 0x3fff3af3, 0x19200000), | 115 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_CACHE_INVALIDATION, 0x3fff3af3, 0x19200000), |
| 116 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000003ff) | 116 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000003ff), |
| 117 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC1_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 118 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC2_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 119 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_DEBUG, 0x00000000, 0x00008000) | ||
| 117 | }; | 120 | }; |
| 118 | 121 | ||
| 119 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] = | 122 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] = |
| @@ -135,10 +138,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] = | |||
| 135 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_UTCL1_CNTL2, 0x00030000, 0x00020000), | 138 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmRMI_UTCL1_CNTL2, 0x00030000, 0x00020000), |
| 136 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1, 0x0000000f, 0x01000107), | 139 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1, 0x0000000f, 0x01000107), |
| 137 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTD_CNTL, 0x00001800, 0x00000800), | 140 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmTD_CNTL, 0x00001800, 0x00000800), |
| 138 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmWD_UTCL1_CNTL, 0x08000000, 0x08000080), | 141 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmWD_UTCL1_CNTL, 0x08000000, 0x08000080) |
| 139 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC1_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 140 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_MEC2_F32_INT_DIS, 0x00000000, 0x00000800), | ||
| 141 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCP_DEBUG, 0x00000000, 0x00008000) | ||
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] = | 144 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] = |
| @@ -3587,6 +3587,8 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev | |||
| 3587 | { | 3587 | { |
| 3588 | uint32_t data, def; | 3588 | uint32_t data, def; |
| 3589 | 3589 | ||
| 3590 | amdgpu_gfx_rlc_enter_safe_mode(adev); | ||
| 3591 | |||
| 3590 | /* It is disabled by HW by default */ | 3592 | /* It is disabled by HW by default */ |
| 3591 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) { | 3593 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) { |
| 3592 | /* 1 - RLC_CGTT_MGCG_OVERRIDE */ | 3594 | /* 1 - RLC_CGTT_MGCG_OVERRIDE */ |
| @@ -3651,6 +3653,8 @@ static void gfx_v9_0_update_medium_grain_clock_gating(struct amdgpu_device *adev | |||
| 3651 | WREG32_SOC15(GC, 0, mmCP_MEM_SLP_CNTL, data); | 3653 | WREG32_SOC15(GC, 0, mmCP_MEM_SLP_CNTL, data); |
| 3652 | } | 3654 | } |
| 3653 | } | 3655 | } |
| 3656 | |||
| 3657 | amdgpu_gfx_rlc_exit_safe_mode(adev); | ||
| 3654 | } | 3658 | } |
| 3655 | 3659 | ||
| 3656 | static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, | 3660 | static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, |
diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c index 8cbb4655896a..b11a1c17a7f2 100644 --- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | |||
| @@ -174,7 +174,7 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev, | |||
| 174 | return r; | 174 | return r; |
| 175 | } | 175 | } |
| 176 | /* Retrieve checksum from mailbox2 */ | 176 | /* Retrieve checksum from mailbox2 */ |
| 177 | if (req == IDH_REQ_GPU_INIT_ACCESS) { | 177 | if (req == IDH_REQ_GPU_INIT_ACCESS || req == IDH_REQ_GPU_RESET_ACCESS) { |
| 178 | adev->virt.fw_reserve.checksum_key = | 178 | adev->virt.fw_reserve.checksum_key = |
| 179 | RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0, | 179 | RREG32_NO_KIQ(SOC15_REG_OFFSET(NBIO, 0, |
| 180 | mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW2)); | 180 | mmBIF_BX_PF0_MAILBOX_MSGBUF_RCV_DW2)); |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c index fd0bfe140ee0..6811a5d05b27 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | |||
| @@ -78,7 +78,6 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { | |||
| 78 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), | 78 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_RLC1_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), |
| 79 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0), | 79 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_PAGE, 0x000003ff, 0x000003c0), |
| 80 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000), | 80 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_WATERMK, 0xfc000000, 0x00000000), |
| 81 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831f07), | ||
| 82 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100), | 81 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100), |
| 83 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_IB_CNTL, 0x800f0100, 0x00000100), | 82 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_IB_CNTL, 0x800f0100, 0x00000100), |
| 84 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), | 83 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GFX_RB_WPTR_POLL_CNTL, 0x0000fff0, 0x00403000), |
| @@ -96,6 +95,7 @@ static const struct soc15_reg_golden golden_settings_sdma_4[] = { | |||
| 96 | static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { | 95 | static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { |
| 97 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | 96 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), |
| 98 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), | 97 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), |
| 98 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), | ||
| 99 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | 99 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), |
| 100 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002) | 100 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002) |
| 101 | }; | 101 | }; |
| @@ -103,6 +103,7 @@ static const struct soc15_reg_golden golden_settings_sdma_vg10[] = { | |||
| 103 | static const struct soc15_reg_golden golden_settings_sdma_vg12[] = { | 103 | static const struct soc15_reg_golden golden_settings_sdma_vg12[] = { |
| 104 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), | 104 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), |
| 105 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001), | 105 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001), |
| 106 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), | ||
| 106 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), | 107 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104001), |
| 107 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001) | 108 | SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104001) |
| 108 | }; | 109 | }; |
diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h index 1479ea1dc3e7..789c4f288485 100644 --- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h +++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h | |||
| @@ -127,12 +127,13 @@ enum amd_pp_task { | |||
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | enum PP_SMC_POWER_PROFILE { | 129 | enum PP_SMC_POWER_PROFILE { |
| 130 | PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x0, | 130 | PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0, |
| 131 | PP_SMC_POWER_PROFILE_POWERSAVING = 0x1, | 131 | PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1, |
| 132 | PP_SMC_POWER_PROFILE_VIDEO = 0x2, | 132 | PP_SMC_POWER_PROFILE_POWERSAVING = 0x2, |
| 133 | PP_SMC_POWER_PROFILE_VR = 0x3, | 133 | PP_SMC_POWER_PROFILE_VIDEO = 0x3, |
| 134 | PP_SMC_POWER_PROFILE_COMPUTE = 0x4, | 134 | PP_SMC_POWER_PROFILE_VR = 0x4, |
| 135 | PP_SMC_POWER_PROFILE_CUSTOM = 0x5, | 135 | PP_SMC_POWER_PROFILE_COMPUTE = 0x5, |
| 136 | PP_SMC_POWER_PROFILE_CUSTOM = 0x6, | ||
| 136 | }; | 137 | }; |
| 137 | 138 | ||
| 138 | enum { | 139 | enum { |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c index 0173d0480024..310b102a9292 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | |||
| @@ -64,17 +64,19 @@ static int ci_set_asic_special_caps(struct pp_hwmgr *hwmgr); | |||
| 64 | 64 | ||
| 65 | static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr) | 65 | static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr) |
| 66 | { | 66 | { |
| 67 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 2; | 67 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0; |
| 68 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 0; | 68 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 1; |
| 69 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 1; | 69 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 2; |
| 70 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 3; | 70 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 3; |
| 71 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 4; | 71 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 4; |
| 72 | 72 | hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 5; | |
| 73 | hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_POWERSAVING; | 73 | |
| 74 | hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_VIDEO; | 74 | hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 75 | hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_FULLSCREEN3D; | 75 | hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_FULLSCREEN3D; |
| 76 | hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VR; | 76 | hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_POWERSAVING; |
| 77 | hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_COMPUTE; | 77 | hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VIDEO; |
| 78 | hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_VR; | ||
| 79 | hwmgr->workload_setting[5] = PP_SMC_POWER_PROFILE_COMPUTE; | ||
| 78 | } | 80 | } |
| 79 | 81 | ||
| 80 | int hwmgr_early_init(struct pp_hwmgr *hwmgr) | 82 | int hwmgr_early_init(struct pp_hwmgr *hwmgr) |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index d91390459326..c8f5c00dd1e7 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
| @@ -77,8 +77,9 @@ | |||
| 77 | #define PCIE_BUS_CLK 10000 | 77 | #define PCIE_BUS_CLK 10000 |
| 78 | #define TCLK (PCIE_BUS_CLK / 10) | 78 | #define TCLK (PCIE_BUS_CLK / 10) |
| 79 | 79 | ||
| 80 | static const struct profile_mode_setting smu7_profiling[6] = | 80 | static const struct profile_mode_setting smu7_profiling[7] = |
| 81 | {{1, 0, 100, 30, 1, 0, 100, 10}, | 81 | {{0, 0, 0, 0, 0, 0, 0, 0}, |
| 82 | {1, 0, 100, 30, 1, 0, 100, 10}, | ||
| 82 | {1, 10, 0, 30, 0, 0, 0, 0}, | 83 | {1, 10, 0, 30, 0, 0, 0, 0}, |
| 83 | {0, 0, 0, 0, 1, 10, 16, 31}, | 84 | {0, 0, 0, 0, 1, 10, 16, 31}, |
| 84 | {1, 0, 11, 50, 1, 0, 100, 10}, | 85 | {1, 0, 11, 50, 1, 0, 100, 10}, |
| @@ -4889,7 +4890,8 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) | |||
| 4889 | uint32_t i, size = 0; | 4890 | uint32_t i, size = 0; |
| 4890 | uint32_t len; | 4891 | uint32_t len; |
| 4891 | 4892 | ||
| 4892 | static const char *profile_name[6] = {"3D_FULL_SCREEN", | 4893 | static const char *profile_name[7] = {"BOOTUP_DEFAULT", |
| 4894 | "3D_FULL_SCREEN", | ||
| 4893 | "POWER_SAVING", | 4895 | "POWER_SAVING", |
| 4894 | "VIDEO", | 4896 | "VIDEO", |
| 4895 | "VR", | 4897 | "VR", |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c index 79c86247d0ac..91e3bbe6d61d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | |||
| @@ -804,9 +804,9 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
| 804 | 804 | ||
| 805 | hwmgr->backend = data; | 805 | hwmgr->backend = data; |
| 806 | 806 | ||
| 807 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO]; | 807 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT]; |
| 808 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 808 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 809 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 809 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 810 | 810 | ||
| 811 | vega10_set_default_registry_data(hwmgr); | 811 | vega10_set_default_registry_data(hwmgr); |
| 812 | data->disable_dpm_mask = 0xff; | 812 | data->disable_dpm_mask = 0xff; |
| @@ -4668,13 +4668,15 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) | |||
| 4668 | { | 4668 | { |
| 4669 | struct vega10_hwmgr *data = hwmgr->backend; | 4669 | struct vega10_hwmgr *data = hwmgr->backend; |
| 4670 | uint32_t i, size = 0; | 4670 | uint32_t i, size = 0; |
| 4671 | static const uint8_t profile_mode_setting[5][4] = {{70, 60, 1, 3,}, | 4671 | static const uint8_t profile_mode_setting[6][4] = {{70, 60, 0, 0,}, |
| 4672 | {70, 60, 1, 3,}, | ||
| 4672 | {90, 60, 0, 0,}, | 4673 | {90, 60, 0, 0,}, |
| 4673 | {70, 60, 0, 0,}, | 4674 | {70, 60, 0, 0,}, |
| 4674 | {70, 90, 0, 0,}, | 4675 | {70, 90, 0, 0,}, |
| 4675 | {30, 60, 0, 6,}, | 4676 | {30, 60, 0, 6,}, |
| 4676 | }; | 4677 | }; |
| 4677 | static const char *profile_name[6] = {"3D_FULL_SCREEN", | 4678 | static const char *profile_name[7] = {"BOOTUP_DEFAULT", |
| 4679 | "3D_FULL_SCREEN", | ||
| 4678 | "POWER_SAVING", | 4680 | "POWER_SAVING", |
| 4679 | "VIDEO", | 4681 | "VIDEO", |
| 4680 | "VR", | 4682 | "VR", |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c index 26154f9b2178..82935a3bd950 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | |||
| @@ -390,9 +390,9 @@ static int vega20_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
| 390 | 390 | ||
| 391 | hwmgr->backend = data; | 391 | hwmgr->backend = data; |
| 392 | 392 | ||
| 393 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO]; | 393 | hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT]; |
| 394 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 394 | hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 395 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO; | 395 | hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 396 | 396 | ||
| 397 | vega20_set_default_registry_data(hwmgr); | 397 | vega20_set_default_registry_data(hwmgr); |
| 398 | 398 | ||
| @@ -980,6 +980,9 @@ static int vega20_od8_set_feature_capabilities( | |||
| 980 | pp_table->FanZeroRpmEnable) | 980 | pp_table->FanZeroRpmEnable) |
| 981 | od_settings->overdrive8_capabilities |= OD8_FAN_ZERO_RPM_CONTROL; | 981 | od_settings->overdrive8_capabilities |= OD8_FAN_ZERO_RPM_CONTROL; |
| 982 | 982 | ||
| 983 | if (!od_settings->overdrive8_capabilities) | ||
| 984 | hwmgr->od_enabled = false; | ||
| 985 | |||
| 983 | return 0; | 986 | return 0; |
| 984 | } | 987 | } |
| 985 | 988 | ||
| @@ -1689,13 +1692,6 @@ static int vega20_upload_dpm_min_level(struct pp_hwmgr *hwmgr, uint32_t feature_ | |||
| 1689 | (PPCLK_UCLK << 16) | (min_freq & 0xffff))), | 1692 | (PPCLK_UCLK << 16) | (min_freq & 0xffff))), |
| 1690 | "Failed to set soft min memclk !", | 1693 | "Failed to set soft min memclk !", |
| 1691 | return ret); | 1694 | return ret); |
| 1692 | |||
| 1693 | min_freq = data->dpm_table.mem_table.dpm_state.hard_min_level; | ||
| 1694 | PP_ASSERT_WITH_CODE(!(ret = smum_send_msg_to_smc_with_parameter( | ||
| 1695 | hwmgr, PPSMC_MSG_SetHardMinByFreq, | ||
| 1696 | (PPCLK_UCLK << 16) | (min_freq & 0xffff))), | ||
| 1697 | "Failed to set hard min memclk !", | ||
| 1698 | return ret); | ||
| 1699 | } | 1695 | } |
| 1700 | 1696 | ||
| 1701 | if (data->smu_features[GNLD_DPM_UVD].enabled && | 1697 | if (data->smu_features[GNLD_DPM_UVD].enabled && |
| @@ -2248,6 +2244,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, | |||
| 2248 | soft_min_level = mask ? (ffs(mask) - 1) : 0; | 2244 | soft_min_level = mask ? (ffs(mask) - 1) : 0; |
| 2249 | soft_max_level = mask ? (fls(mask) - 1) : 0; | 2245 | soft_max_level = mask ? (fls(mask) - 1) : 0; |
| 2250 | 2246 | ||
| 2247 | if (soft_max_level >= data->dpm_table.gfx_table.count) { | ||
| 2248 | pr_err("Clock level specified %d is over max allowed %d\n", | ||
| 2249 | soft_max_level, | ||
| 2250 | data->dpm_table.gfx_table.count - 1); | ||
| 2251 | return -EINVAL; | ||
| 2252 | } | ||
| 2253 | |||
| 2251 | data->dpm_table.gfx_table.dpm_state.soft_min_level = | 2254 | data->dpm_table.gfx_table.dpm_state.soft_min_level = |
| 2252 | data->dpm_table.gfx_table.dpm_levels[soft_min_level].value; | 2255 | data->dpm_table.gfx_table.dpm_levels[soft_min_level].value; |
| 2253 | data->dpm_table.gfx_table.dpm_state.soft_max_level = | 2256 | data->dpm_table.gfx_table.dpm_state.soft_max_level = |
| @@ -2268,6 +2271,13 @@ static int vega20_force_clock_level(struct pp_hwmgr *hwmgr, | |||
| 2268 | soft_min_level = mask ? (ffs(mask) - 1) : 0; | 2271 | soft_min_level = mask ? (ffs(mask) - 1) : 0; |
| 2269 | soft_max_level = mask ? (fls(mask) - 1) : 0; | 2272 | soft_max_level = mask ? (fls(mask) - 1) : 0; |
| 2270 | 2273 | ||
| 2274 | if (soft_max_level >= data->dpm_table.mem_table.count) { | ||
| 2275 | pr_err("Clock level specified %d is over max allowed %d\n", | ||
| 2276 | soft_max_level, | ||
| 2277 | data->dpm_table.mem_table.count - 1); | ||
| 2278 | return -EINVAL; | ||
| 2279 | } | ||
| 2280 | |||
| 2271 | data->dpm_table.mem_table.dpm_state.soft_min_level = | 2281 | data->dpm_table.mem_table.dpm_state.soft_min_level = |
| 2272 | data->dpm_table.mem_table.dpm_levels[soft_min_level].value; | 2282 | data->dpm_table.mem_table.dpm_levels[soft_min_level].value; |
| 2273 | data->dpm_table.mem_table.dpm_state.soft_max_level = | 2283 | data->dpm_table.mem_table.dpm_state.soft_max_level = |
| @@ -3261,6 +3271,9 @@ static int conv_power_profile_to_pplib_workload(int power_profile) | |||
| 3261 | int pplib_workload = 0; | 3271 | int pplib_workload = 0; |
| 3262 | 3272 | ||
| 3263 | switch (power_profile) { | 3273 | switch (power_profile) { |
| 3274 | case PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT: | ||
| 3275 | pplib_workload = WORKLOAD_DEFAULT_BIT; | ||
| 3276 | break; | ||
| 3264 | case PP_SMC_POWER_PROFILE_FULLSCREEN3D: | 3277 | case PP_SMC_POWER_PROFILE_FULLSCREEN3D: |
| 3265 | pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT; | 3278 | pplib_workload = WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT; |
| 3266 | break; | 3279 | break; |
| @@ -3290,6 +3303,7 @@ static int vega20_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf) | |||
| 3290 | uint32_t i, size = 0; | 3303 | uint32_t i, size = 0; |
| 3291 | uint16_t workload_type = 0; | 3304 | uint16_t workload_type = 0; |
| 3292 | static const char *profile_name[] = { | 3305 | static const char *profile_name[] = { |
| 3306 | "BOOTUP_DEFAULT", | ||
| 3293 | "3D_FULL_SCREEN", | 3307 | "3D_FULL_SCREEN", |
| 3294 | "POWER_SAVING", | 3308 | "POWER_SAVING", |
| 3295 | "VIDEO", | 3309 | "VIDEO", |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h index 0d298a0409f5..8cb831b6a016 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | |||
| @@ -705,7 +705,7 @@ enum PP_TABLE_VERSION { | |||
| 705 | /** | 705 | /** |
| 706 | * The main hardware manager structure. | 706 | * The main hardware manager structure. |
| 707 | */ | 707 | */ |
| 708 | #define Workload_Policy_Max 5 | 708 | #define Workload_Policy_Max 6 |
| 709 | 709 | ||
| 710 | struct pp_hwmgr { | 710 | struct pp_hwmgr { |
| 711 | void *adev; | 711 | void *adev; |
