Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-next-2023-09-08' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Dave Airlie:
"Regular rounds of rc1 fixes, a large bunch for amdgpu since it's three
weeks in one go, one i915, one nouveau and one ivpu.

I think there might be a few more fixes in misc that I haven't pulled
in yet, but we should get them all for rc2.

amdgpu:
- Display replay fixes
- Fixes for headless boards
- Fix documentation breakage
- RAS fixes
- Handle newer IP discovery tables
- SMU 13.0.6 fixes
- SR-IOV fixes
- Display vstartup fixes
- NBIO 7.9 fixes
- Display scaling mode fixes
- Debugfs power reporting fix
- GC 9.4.3 fixes
- Dirty framebuffer fixes for fbcon
- eDP fixes
- DCN 3.1.5 fix
- Display ODM fixes
- GPU core dump fix
- Re-enable zops property now that IGT test is fixed
- Fix possible UAF in CS code
- Cursor degamma fix

amdkfd:
- HMM fixes
- Interrupt masking fix
- GFX11 MQD fixes

i915:
- Mark requests for GuC virtual engines to avoid use-after-free

nouveau:
- Fix fence state in nouveau_fence_emit()

ivpu:
- replace strncpy"

* tag 'drm-next-2023-09-08' of git://anongit.freedesktop.org/drm/drm: (51 commits)
drm/amdgpu: Restrict bootloader wait to SMUv13.0.6
drm/amd/display: prevent potential division by zero errors
drm/amd/display: enable cursor degamma for DCN3+ DRM legacy gamma
drm/amd/display: limit the v_startup workaround to ASICs older than DCN3.1
Revert "drm/amd/display: Remove v_startup workaround for dcn3+"
drm/amdgpu: fix amdgpu_cs_p1_user_fence
Revert "Revert "drm/amd/display: Implement zpos property""
drm/amdkfd: Add missing gfx11 MQD manager callbacks
drm/amdgpu: Free ras cmd input buffer properly
drm/amdgpu: Hide xcp partition sysfs under SRIOV
drm/amdgpu: use read-modify-write mode for gfx v9_4_3 SQ setting
drm/amdkfd: use mask to get v9 interrupt sq data bits correctly
drm/amdgpu: Allocate coredump memory in a nonblocking way
drm/amdgpu: Support query ecc cap for aqua_vanjaram
drm/amdgpu: Add umc_info v4_0 structure
drm/amd/display: always switch off ODM before committing more streams
drm/amd/display: Remove wait while locked
drm/amd/display: update blank state on ODM changes
drm/amd/display: Add smu write msg id fail retry process
drm/amdgpu: Add SMU v13.0.6 default reset methods
...

+684 -227
+4 -4
Documentation/gpu/amdgpu/driver-misc.rst
··· 11 11 product_name 12 12 ------------ 13 13 14 - .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 14 + .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c 15 15 :doc: product_name 16 16 17 17 product_number 18 18 -------------- 19 19 20 - .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 21 - :doc: product_name 20 + .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c 21 + :doc: product_number 22 22 23 23 serial_number 24 24 ------------- 25 25 26 - .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 26 + .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c 27 27 :doc: serial_number 28 28 29 29 unique_id
+1 -2
drivers/accel/ivpu/ivpu_jsm_msg.c
··· 118 118 struct vpu_jsm_msg resp; 119 119 int ret; 120 120 121 - if (!strncpy(req.payload.dyndbg_control.dyndbg_cmd, command, VPU_DYNDBG_CMD_MAX_LEN - 1)) 122 - return -ENOMEM; 121 + strscpy(req.payload.dyndbg_control.dyndbg_cmd, command, VPU_DYNDBG_CMD_MAX_LEN); 123 122 124 123 ret = ivpu_ipc_send_receive(vdev, &req, VPU_JSM_MSG_DYNDBG_CONTROL_RSP, &resp, 125 124 VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
+2 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
··· 442 442 mem_info->local_mem_size_public, 443 443 mem_info->local_mem_size_private); 444 444 445 - if (amdgpu_sriov_vf(adev)) 446 - mem_info->mem_clk_max = adev->clock.default_mclk / 100; 447 - else if (adev->pm.dpm_enabled) { 445 + if (adev->pm.dpm_enabled) { 448 446 if (amdgpu_emu_mode == 1) 449 447 mem_info->mem_clk_max = 0; 450 448 else ··· 461 463 uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz(struct amdgpu_device *adev) 462 464 { 463 465 /* the sclk is in quantas of 10kHz */ 464 - if (amdgpu_sriov_vf(adev)) 465 - return adev->clock.default_sclk / 100; 466 - else if (adev->pm.dpm_enabled) 466 + if (adev->pm.dpm_enabled) 467 467 return amdgpu_dpm_get_sclk(adev, false) / 100; 468 468 else 469 469 return 100;
+16 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
··· 217 217 struct atom_umc_info_v3_1 v31; 218 218 struct atom_umc_info_v3_2 v32; 219 219 struct atom_umc_info_v3_3 v33; 220 + struct atom_umc_info_v4_0 v40; 220 221 }; 221 222 222 223 union vram_info { ··· 509 508 510 509 if (amdgpu_atom_parse_data_header(mode_info->atom_context, 511 510 index, &size, &frev, &crev, &data_offset)) { 511 + umc_info = (union umc_info *)(mode_info->atom_context->bios + data_offset); 512 512 if (frev == 3) { 513 - umc_info = (union umc_info *) 514 - (mode_info->atom_context->bios + data_offset); 515 513 switch (crev) { 516 514 case 1: 517 515 umc_config = le32_to_cpu(umc_info->v31.umc_config); ··· 533 533 /* unsupported crev */ 534 534 return false; 535 535 } 536 + } else if (frev == 4) { 537 + switch (crev) { 538 + case 0: 539 + umc_config1 = le32_to_cpu(umc_info->v40.umc_config1); 540 + ecc_default_enabled = 541 + (umc_config1 & UMC_CONFIG1__ENABLE_ECC_CAPABLE) ? true : false; 542 + break; 543 + default: 544 + /* unsupported crev */ 545 + return false; 546 + } 547 + } else { 548 + /* unsupported frev */ 549 + return false; 536 550 } 537 551 } 538 552
+4 -14
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
··· 127 127 { 128 128 struct drm_gem_object *gobj; 129 129 unsigned long size; 130 - int r; 131 130 132 131 gobj = drm_gem_object_lookup(p->filp, data->handle); 133 132 if (gobj == NULL) ··· 136 137 drm_gem_object_put(gobj); 137 138 138 139 size = amdgpu_bo_size(p->uf_bo); 139 - if (size != PAGE_SIZE || (data->offset + 8) > size) { 140 - r = -EINVAL; 141 - goto error_unref; 142 - } 140 + if (size != PAGE_SIZE || data->offset > (size - 8)) 141 + return -EINVAL; 143 142 144 - if (amdgpu_ttm_tt_get_usermm(p->uf_bo->tbo.ttm)) { 145 - r = -EINVAL; 146 - goto error_unref; 147 - } 143 + if (amdgpu_ttm_tt_get_usermm(p->uf_bo->tbo.ttm)) 144 + return -EINVAL; 148 145 149 146 *offset = data->offset; 150 - 151 147 return 0; 152 - 153 - error_unref: 154 - amdgpu_bo_unref(&p->uf_bo); 155 - return r; 156 148 } 157 149 158 150 static int amdgpu_cs_p1_bo_handles(struct amdgpu_cs_parser *p,
+25 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 885 885 */ 886 886 static int amdgpu_device_asic_init(struct amdgpu_device *adev) 887 887 { 888 + int ret; 889 + 888 890 amdgpu_asic_pre_asic_init(adev); 889 891 890 892 if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3) || 891 - adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0)) 892 - return amdgpu_atomfirmware_asic_init(adev, true); 893 - else 893 + adev->ip_versions[GC_HWIP][0] >= IP_VERSION(11, 0, 0)) { 894 + amdgpu_psp_wait_for_bootloader(adev); 895 + ret = amdgpu_atomfirmware_asic_init(adev, true); 896 + return ret; 897 + } else { 894 898 return amdgpu_atom_asic_init(adev->mode_info.atom_context); 899 + } 900 + 901 + return 0; 895 902 } 896 903 897 904 /** ··· 4701 4694 } 4702 4695 4703 4696 if (ret) 4704 - dev_err(adev->dev, "GPU mode1 reset failed\n"); 4697 + goto mode1_reset_failed; 4705 4698 4706 4699 amdgpu_device_load_pci_state(adev->pdev); 4700 + ret = amdgpu_psp_wait_for_bootloader(adev); 4701 + if (ret) 4702 + goto mode1_reset_failed; 4707 4703 4708 4704 /* wait for asic to come out of reset */ 4709 4705 for (i = 0; i < adev->usec_timeout; i++) { ··· 4717 4707 udelay(1); 4718 4708 } 4719 4709 4710 + if (i >= adev->usec_timeout) { 4711 + ret = -ETIMEDOUT; 4712 + goto mode1_reset_failed; 4713 + } 4714 + 4720 4715 amdgpu_atombios_scratch_regs_engine_hung(adev, false); 4716 + 4717 + return 0; 4718 + 4719 + mode1_reset_failed: 4720 + dev_err(adev->dev, "GPU mode1 reset failed\n"); 4721 4721 return ret; 4722 4722 } 4723 4723 ··· 4869 4849 struct drm_device *dev = adev_to_drm(adev); 4870 4850 4871 4851 ktime_get_ts64(&adev->reset_time); 4872 - dev_coredumpm(dev->dev, THIS_MODULE, adev, 0, GFP_KERNEL, 4852 + dev_coredumpm(dev->dev, THIS_MODULE, adev, 0, GFP_NOWAIT, 4873 4853 amdgpu_devcoredump_read, amdgpu_devcoredump_free); 4874 4854 } 4875 4855 #endif
+15
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
··· 1390 1390 struct gc_info_v1_1 v1_1; 1391 1391 struct gc_info_v1_2 v1_2; 1392 1392 struct gc_info_v2_0 v2; 1393 + struct gc_info_v2_1 v2_1; 1393 1394 }; 1394 1395 1395 1396 static int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev) ··· 1466 1465 adev->gfx.config.num_sc_per_sh = le32_to_cpu(gc_info->v2.gc_num_sc_per_se) / 1467 1466 le32_to_cpu(gc_info->v2.gc_num_sh_per_se); 1468 1467 adev->gfx.config.num_packer_per_sc = le32_to_cpu(gc_info->v2.gc_num_packer_per_sc); 1468 + if (gc_info->v2.header.version_minor == 1) { 1469 + adev->gfx.config.gc_num_tcp_per_sa = le32_to_cpu(gc_info->v2_1.gc_num_tcp_per_sh); 1470 + adev->gfx.config.gc_tcp_size_per_cu = le32_to_cpu(gc_info->v2_1.gc_tcp_size_per_cu); 1471 + adev->gfx.config.gc_num_sdp_interface = le32_to_cpu(gc_info->v2_1.gc_num_sdp_interface); /* per XCD */ 1472 + adev->gfx.config.gc_num_cu_per_sqc = le32_to_cpu(gc_info->v2_1.gc_num_cu_per_sqc); 1473 + adev->gfx.config.gc_l1_instruction_cache_size_per_sqc = le32_to_cpu(gc_info->v2_1.gc_instruction_cache_size_per_sqc); 1474 + adev->gfx.config.gc_l1_data_cache_size_per_sqc = le32_to_cpu(gc_info->v2_1.gc_scalar_data_cache_size_per_sqc); 1475 + adev->gfx.config.gc_tcc_size = le32_to_cpu(gc_info->v2_1.gc_tcc_size); /* per XCD */ 1476 + } 1469 1477 break; 1470 1478 default: 1471 1479 dev_err(adev->dev, ··· 1488 1478 1489 1479 union mall_info { 1490 1480 struct mall_info_v1_0 v1; 1481 + struct mall_info_v2_0 v2; 1491 1482 }; 1492 1483 1493 1484 static int amdgpu_discovery_get_mall_info(struct amdgpu_device *adev) ··· 1528 1517 } 1529 1518 adev->gmc.mall_size = mall_size; 1530 1519 adev->gmc.m_half_use = half_use; 1520 + break; 1521 + case 2: 1522 + mall_size_per_umc = le32_to_cpu(mall_info->v2.mall_size_per_umc); 1523 + adev->gmc.mall_size = mall_size_per_umc * adev->gmc.num_umc; 1531 1524 break; 1532 1525 default: 1533 1526 dev_err(adev->dev,
+25 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
··· 38 38 #include <linux/pci.h> 39 39 #include <linux/pm_runtime.h> 40 40 #include <drm/drm_crtc_helper.h> 41 + #include <drm/drm_damage_helper.h> 42 + #include <drm/drm_drv.h> 41 43 #include <drm/drm_edid.h> 42 44 #include <drm/drm_fb_helper.h> 43 45 #include <drm/drm_gem_framebuffer_helper.h> ··· 534 532 return true; 535 533 } 536 534 535 + static int amdgpu_dirtyfb(struct drm_framebuffer *fb, struct drm_file *file, 536 + unsigned int flags, unsigned int color, 537 + struct drm_clip_rect *clips, unsigned int num_clips) 538 + { 539 + 540 + if (file) 541 + return -ENOSYS; 542 + 543 + return drm_atomic_helper_dirtyfb(fb, file, flags, color, clips, 544 + num_clips); 545 + } 546 + 537 547 static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { 538 548 .destroy = drm_gem_fb_destroy, 539 549 .create_handle = drm_gem_fb_create_handle, 550 + }; 551 + 552 + static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { 553 + .destroy = drm_gem_fb_destroy, 554 + .create_handle = drm_gem_fb_create_handle, 555 + .dirty = amdgpu_dirtyfb 540 556 }; 541 557 542 558 uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, ··· 1159 1139 if (ret) 1160 1140 goto err; 1161 1141 1162 - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); 1142 + if (drm_drv_uses_atomic_modeset(dev)) 1143 + ret = drm_framebuffer_init(dev, &rfb->base, 1144 + &amdgpu_fb_funcs_atomic); 1145 + else 1146 + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); 1163 1147 1164 1148 if (ret) 1165 1149 goto err;
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
··· 241 241 uint32_t gc_gl1c_per_sa; 242 242 uint32_t gc_gl1c_size_per_instance; 243 243 uint32_t gc_gl2c_per_gpu; 244 + uint32_t gc_tcp_size_per_cu; 245 + uint32_t gc_num_cu_per_sqc; 246 + uint32_t gc_tcc_size; 244 247 }; 245 248 246 249 struct amdgpu_cu_info {
+11
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 2078 2078 } 2079 2079 /* SECUREDISPLAY end */ 2080 2080 2081 + int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev) 2082 + { 2083 + struct psp_context *psp = &adev->psp; 2084 + int ret = 0; 2085 + 2086 + if (!amdgpu_sriov_vf(adev) && psp->funcs && psp->funcs->wait_for_bootloader != NULL) 2087 + ret = psp->funcs->wait_for_bootloader(psp); 2088 + 2089 + return ret; 2090 + } 2091 + 2081 2092 static int psp_hw_start(struct psp_context *psp) 2082 2093 { 2083 2094 struct amdgpu_device *adev = psp->adev;
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
··· 109 109 110 110 struct psp_funcs { 111 111 int (*init_microcode)(struct psp_context *psp); 112 + int (*wait_for_bootloader)(struct psp_context *psp); 112 113 int (*bootloader_load_kdb)(struct psp_context *psp); 113 114 int (*bootloader_load_spl)(struct psp_context *psp); 114 115 int (*bootloader_load_sysdrv)(struct psp_context *psp); ··· 533 532 int psp_spatial_partition(struct psp_context *psp, int mode); 534 533 535 534 int is_psp_fw_valid(struct psp_bin_desc bin); 535 + 536 + int amdgpu_psp_wait_for_bootloader(struct amdgpu_device *adev); 536 537 537 538 #endif
+8 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
··· 764 764 { 765 765 struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 766 766 union ta_ras_cmd_input *info; 767 - int ret = 0; 767 + int ret; 768 768 769 769 if (!con) 770 770 return -EINVAL; ··· 773 773 if (enable && 774 774 head->block != AMDGPU_RAS_BLOCK__GFX && 775 775 !amdgpu_ras_is_feature_allowed(adev, head)) 776 - goto out; 776 + return 0; 777 777 778 778 /* Only enable gfx ras feature from host side */ 779 779 if (head->block == AMDGPU_RAS_BLOCK__GFX && ··· 801 801 enable ? "enable":"disable", 802 802 get_ras_block_str(head), 803 803 amdgpu_ras_is_poison_mode_supported(adev), ret); 804 - goto out; 804 + return ret; 805 805 } 806 + 807 + kfree(info); 806 808 } 807 809 808 810 /* setup the obj */ 809 811 __amdgpu_ras_feature_enable(adev, head, enable); 810 - out: 811 - if (head->block == AMDGPU_RAS_BLOCK__GFX) 812 - kfree(info); 813 - return ret; 812 + 813 + return 0; 814 814 } 815 815 816 816 /* Only used in device probe stage and called only once. */ ··· 2399 2399 if (amdgpu_sriov_vf(adev)) { 2400 2400 switch (adev->ip_versions[MP0_HWIP][0]) { 2401 2401 case IP_VERSION(13, 0, 2): 2402 + case IP_VERSION(13, 0, 6): 2402 2403 return true; 2403 2404 default: 2404 2405 return false;
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
··· 158 158 case IP_VERSION(11, 0, 7): /* Sienna cichlid */ 159 159 case IP_VERSION(13, 0, 0): 160 160 case IP_VERSION(13, 0, 2): /* Aldebaran */ 161 - case IP_VERSION(13, 0, 6): 162 161 case IP_VERSION(13, 0, 10): 163 162 return true; 163 + case IP_VERSION(13, 0, 6): 164 + return (adev->gmc.is_app_apu) ? false : true; 164 165 default: 165 166 return false; 166 167 }
+13 -13
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
··· 203 203 if (adev->rev_id == 0) { 204 204 WREG32_FIELD15_PREREG(GC, dev_inst, TCP_UTCL1_CNTL1, 205 205 REDUCE_FIFO_DEPTH_BY_2, 2); 206 + } else { 207 + WREG32_FIELD15_PREREG(GC, dev_inst, TCP_UTCL1_CNTL2, 208 + SPARE, 0x1); 206 209 } 207 210 } 208 211 } ··· 863 860 if (r) 864 861 return r; 865 862 866 - r = amdgpu_gfx_sysfs_init(adev); 863 + r = amdgpu_gfx_ras_sw_init(adev); 867 864 if (r) 868 865 return r; 869 866 870 - return amdgpu_gfx_ras_sw_init(adev); 867 + 868 + if (!amdgpu_sriov_vf(adev)) 869 + r = amdgpu_gfx_sysfs_init(adev); 870 + 871 + return r; 871 872 } 872 873 873 874 static int gfx_v9_4_3_sw_fini(void *handle) ··· 892 885 gfx_v9_4_3_mec_fini(adev); 893 886 amdgpu_bo_unref(&adev->gfx.rlc.clear_state_obj); 894 887 gfx_v9_4_3_free_microcode(adev); 895 - amdgpu_gfx_sysfs_fini(adev); 888 + if (!amdgpu_sriov_vf(adev)) 889 + amdgpu_gfx_sysfs_fini(adev); 896 890 897 891 return 0; 898 892 } ··· 2227 2219 WREG32_SOC15(GC, GET_INST(GC, xcc_id), 2228 2220 regRLC_CGTT_MGCG_OVERRIDE, data); 2229 2221 2230 - def = data = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regRLC_CLK_CNTL); 2231 - 2232 - if (enable) 2233 - data &= ~RLC_CLK_CNTL__RLC_SRAM_CLK_GATER_OVERRIDE_MASK; 2234 - else 2235 - data |= RLC_CLK_CNTL__RLC_SRAM_CLK_GATER_OVERRIDE_MASK; 2236 - 2237 - if (def != data) 2238 - WREG32_SOC15(GC, GET_INST(GC, xcc_id), regRLC_CLK_CNTL, data); 2239 2222 } 2240 2223 2241 2224 static void gfx_v9_4_3_xcc_update_repeater_fgcg(struct amdgpu_device *adev, ··· 4047 4048 uint32_t i; 4048 4049 uint32_t data; 4049 4050 4050 - data = REG_SET_FIELD(0, SQ_TIMEOUT_CONFIG, TIMEOUT_FATAL_DISABLE, 4051 + data = RREG32_SOC15(GC, GET_INST(GC, 0), regSQ_TIMEOUT_CONFIG); 4052 + data = REG_SET_FIELD(data, SQ_TIMEOUT_CONFIG, TIMEOUT_FATAL_DISABLE, 4051 4053 amdgpu_watchdog_timer.timeout_fatal_disable ? 1 : 0); 4052 4054 4053 4055 if (amdgpu_watchdog_timer.timeout_fatal_disable &&
+4 -2
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c
··· 360 360 361 361 cancel_delayed_work_sync(&adev->jpeg.idle_work); 362 362 363 - if (adev->jpeg.cur_state != AMD_PG_STATE_GATE) 364 - ret = jpeg_v4_0_3_set_powergating_state(adev, AMD_PG_STATE_GATE); 363 + if (!amdgpu_sriov_vf(adev)) { 364 + if (adev->jpeg.cur_state != AMD_PG_STATE_GATE) 365 + ret = jpeg_v4_0_3_set_powergating_state(adev, AMD_PG_STATE_GATE); 366 + } 365 367 366 368 return ret; 367 369 }
+18
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c
··· 437 437 XCC_DOORBELL_FENCE__SHUB_SLV_MODE_MASK); 438 438 439 439 } 440 + 441 + if (!amdgpu_sriov_vf(adev)) { 442 + u32 baco_cntl; 443 + for_each_inst(i, adev->aid_mask) { 444 + baco_cntl = RREG32_SOC15(NBIO, i, regBIF_BX0_BACO_CNTL); 445 + if (baco_cntl & (BIF_BX0_BACO_CNTL__BACO_DUMMY_EN_MASK | 446 + BIF_BX0_BACO_CNTL__BACO_EN_MASK)) { 447 + baco_cntl &= ~( 448 + BIF_BX0_BACO_CNTL__BACO_DUMMY_EN_MASK | 449 + BIF_BX0_BACO_CNTL__BACO_EN_MASK); 450 + dev_dbg(adev->dev, 451 + "Unsetting baco dummy mode %x", 452 + baco_cntl); 453 + WREG32_SOC15(NBIO, i, regBIF_BX0_BACO_CNTL, 454 + baco_cntl); 455 + } 456 + } 457 + } 440 458 } 441 459 442 460 static u64 nbio_v7_9_get_pcie_replay_count(struct amdgpu_device *adev)
+37 -3
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
··· 133 133 return sol_reg != 0x0; 134 134 } 135 135 136 + static int psp_v13_0_wait_for_vmbx_ready(struct psp_context *psp) 137 + { 138 + struct amdgpu_device *adev = psp->adev; 139 + int retry_loop, ret; 140 + 141 + for (retry_loop = 0; retry_loop < 70; retry_loop++) { 142 + /* Wait for bootloader to signify that is 143 + ready having bit 31 of C2PMSG_33 set to 1 */ 144 + ret = psp_wait_for( 145 + psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_33), 146 + 0x80000000, 0xffffffff, false); 147 + 148 + if (ret == 0) 149 + break; 150 + } 151 + 152 + if (ret) 153 + dev_warn(adev->dev, "Bootloader wait timed out"); 154 + 155 + return ret; 156 + } 157 + 136 158 static int psp_v13_0_wait_for_bootloader(struct psp_context *psp) 137 159 { 138 160 struct amdgpu_device *adev = psp->adev; 139 - 140 - int ret; 141 - int retry_loop; 161 + int retry_loop, ret; 142 162 143 163 /* Wait for bootloader to signify that it is ready having bit 31 of 144 164 * C2PMSG_35 set to 1. All other bits are expected to be cleared. ··· 175 155 } 176 156 177 157 return ret; 158 + } 159 + 160 + static int psp_v13_0_wait_for_bootloader_steady_state(struct psp_context *psp) 161 + { 162 + struct amdgpu_device *adev = psp->adev; 163 + 164 + if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 6)) { 165 + psp_v13_0_wait_for_vmbx_ready(psp); 166 + 167 + return psp_v13_0_wait_for_bootloader(psp); 168 + } 169 + 170 + return 0; 178 171 } 179 172 180 173 static int psp_v13_0_bootloader_load_component(struct psp_context *psp, ··· 747 714 748 715 static const struct psp_funcs psp_v13_0_funcs = { 749 716 .init_microcode = psp_v13_0_init_microcode, 717 + .wait_for_bootloader = psp_v13_0_wait_for_bootloader_steady_state, 750 718 .bootloader_load_kdb = psp_v13_0_bootloader_load_kdb, 751 719 .bootloader_load_spl = psp_v13_0_bootloader_load_spl, 752 720 .bootloader_load_sysdrv = psp_v13_0_bootloader_load_sysdrv,
+3 -1
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 559 559 */ 560 560 if (amdgpu_gpu_recovery == 4 || amdgpu_gpu_recovery == 5) 561 561 return AMD_RESET_METHOD_MODE2; 562 + else if (!(adev->flags & AMD_IS_APU)) 563 + return AMD_RESET_METHOD_MODE1; 562 564 else 563 - return AMD_RESET_METHOD_NONE; 565 + return AMD_RESET_METHOD_MODE2; 564 566 default: 565 567 break; 566 568 }
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c
··· 384 384 default: 385 385 break; 386 386 } 387 - kfd_signal_event_interrupt(pasid, context_id0 & 0xffffff, 24); 387 + kfd_signal_event_interrupt(pasid, sq_int_data, 24); 388 388 } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) { 389 389 kfd_set_dbg_ev_from_interrupt(dev, pasid, 390 390 KFD_DEBUG_DOORBELL_ID(context_id0),
+3
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
··· 457 457 mqd->is_occupied = kfd_is_occupied_cp; 458 458 mqd->mqd_size = sizeof(struct v11_compute_mqd); 459 459 mqd->get_wave_state = get_wave_state; 460 + mqd->mqd_stride = kfd_mqd_stride; 460 461 #if defined(CONFIG_DEBUG_FS) 461 462 mqd->debugfs_show_mqd = debugfs_show_mqd; 462 463 #endif ··· 473 472 mqd->destroy_mqd = destroy_hiq_mqd; 474 473 mqd->is_occupied = kfd_is_occupied_cp; 475 474 mqd->mqd_size = sizeof(struct v11_compute_mqd); 475 + mqd->mqd_stride = kfd_mqd_stride; 476 476 #if defined(CONFIG_DEBUG_FS) 477 477 mqd->debugfs_show_mqd = debugfs_show_mqd; 478 478 #endif ··· 503 501 mqd->destroy_mqd = kfd_destroy_mqd_sdma; 504 502 mqd->is_occupied = kfd_is_occupied_sdma; 505 503 mqd->mqd_size = sizeof(struct v11_sdma_mqd); 504 + mqd->mqd_stride = kfd_mqd_stride; 506 505 #if defined(CONFIG_DEBUG_FS) 507 506 mqd->debugfs_show_mqd = debugfs_show_mqd_sdma; 508 507 #endif
+2
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
··· 1686 1686 WRITE_ONCE(p->svms.faulting_task, NULL); 1687 1687 if (r) { 1688 1688 pr_debug("failed %d to get svm range pages\n", r); 1689 + if (r == -EBUSY) 1690 + r = -EAGAIN; 1689 1691 goto unreserve_out; 1690 1692 } 1691 1693
+23 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 65 65 #include "amdgpu_dm_debugfs.h" 66 66 #endif 67 67 #include "amdgpu_dm_psr.h" 68 + #include "amdgpu_dm_replay.h" 68 69 69 70 #include "ivsrcid/ivsrcid_vislands30.h" 70 71 ··· 4266 4265 enum dc_connection_type new_connection_type = dc_connection_none; 4267 4266 const struct dc_plane_cap *plane; 4268 4267 bool psr_feature_enabled = false; 4268 + bool replay_feature_enabled = false; 4269 4269 int max_overlay = dm->dc->caps.max_slave_planes; 4270 4270 4271 4271 dm->display_indexes_num = dm->dc->caps.max_streams; ··· 4376 4374 } 4377 4375 } 4378 4376 4377 + if (!(amdgpu_dc_debug_mask & DC_DISABLE_REPLAY)) { 4378 + switch (adev->ip_versions[DCE_HWIP][0]) { 4379 + case IP_VERSION(3, 1, 4): 4380 + case IP_VERSION(3, 1, 5): 4381 + case IP_VERSION(3, 1, 6): 4382 + case IP_VERSION(3, 2, 0): 4383 + case IP_VERSION(3, 2, 1): 4384 + replay_feature_enabled = true; 4385 + break; 4386 + default: 4387 + replay_feature_enabled = amdgpu_dc_feature_mask & DC_REPLAY_MASK; 4388 + break; 4389 + } 4390 + } 4379 4391 /* loops over all connectors on the board */ 4380 4392 for (i = 0; i < link_cnt; i++) { 4381 4393 struct dc_link *link = NULL; ··· 4437 4421 if (ret) { 4438 4422 amdgpu_dm_update_connector_after_detect(aconnector); 4439 4423 setup_backlight_device(dm, aconnector); 4424 + 4425 + /* 4426 + * Disable psr if replay can be enabled 4427 + */ 4428 + if (replay_feature_enabled && amdgpu_dm_setup_replay(link, aconnector)) 4429 + psr_feature_enabled = false; 4440 4430 4441 4431 if (psr_feature_enabled) 4442 4432 amdgpu_dm_set_psr_caps(link); ··· 6026 6004 6027 6005 if (recalculate_timing) 6028 6006 drm_mode_set_crtcinfo(&saved_mode, 0); 6029 - else 6007 + else if (!old_stream) 6030 6008 drm_mode_set_crtcinfo(&mode, 0); 6031 6009 6032 6010 /*
+8 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
··· 29 29 #include "dc.h" 30 30 #include "amdgpu.h" 31 31 #include "amdgpu_dm_psr.h" 32 + #include "amdgpu_dm_replay.h" 32 33 #include "amdgpu_dm_crtc.h" 33 34 #include "amdgpu_dm_plane.h" 34 35 #include "amdgpu_dm_trace.h" ··· 124 123 * fill_dc_dirty_rects(). 125 124 */ 126 125 if (vblank_work->stream && vblank_work->stream->link) { 127 - if (vblank_work->enable) { 126 + /* 127 + * Prioritize replay, instead of psr 128 + */ 129 + if (vblank_work->stream->link->replay_settings.replay_feature_enabled) 130 + amdgpu_dm_replay_enable(vblank_work->stream, false); 131 + else if (vblank_work->enable) { 128 132 if (vblank_work->stream->link->psr_settings.psr_version < DC_PSR_VERSION_SU_1 && 129 133 vblank_work->stream->link->psr_settings.psr_allow_active) 130 134 amdgpu_dm_psr_disable(vblank_work->stream); ··· 138 132 #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY 139 133 !amdgpu_dm_crc_window_is_activated(&vblank_work->acrtc->base) && 140 134 #endif 135 + vblank_work->stream->link->panel_config.psr.disallow_replay && 141 136 vblank_work->acrtc->dm_irq_params.allow_psr_entry) { 142 137 amdgpu_dm_psr_enable(vblank_work->stream); 143 138 }
+16
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
··· 1269 1269 attributes.rotation_angle = 0; 1270 1270 attributes.attribute_flags.value = 0; 1271 1271 1272 + /* Enable cursor degamma ROM on DCN3+ for implicit sRGB degamma in DRM 1273 + * legacy gamma setup. 1274 + */ 1275 + if (crtc_state->cm_is_degamma_srgb && 1276 + adev->dm.dc->caps.color.dpp.gamma_corr) 1277 + attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA = 1; 1278 + 1272 1279 attributes.pitch = afb->base.pitches[0] / afb->base.format->cpp[0]; 1273 1280 1274 1281 if (crtc_state->stream) { ··· 1473 1466 1474 1467 drm_plane_create_alpha_property(plane); 1475 1468 drm_plane_create_blend_mode_property(plane, blend_caps); 1469 + } 1470 + 1471 + if (plane->type == DRM_PLANE_TYPE_PRIMARY) { 1472 + drm_plane_create_zpos_immutable_property(plane, 0); 1473 + } else if (plane->type == DRM_PLANE_TYPE_OVERLAY) { 1474 + unsigned int zpos = 1 + drm_plane_index(plane); 1475 + drm_plane_create_zpos_property(plane, zpos, 1, 254); 1476 + } else if (plane->type == DRM_PLANE_TYPE_CURSOR) { 1477 + drm_plane_create_zpos_immutable_property(plane, 255); 1476 1478 } 1477 1479 1478 1480 if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
+1
drivers/gpu/drm/amd/display/dc/Makefile
··· 78 78 AMD_DISPLAY_DMUB = $(addprefix $(AMDDALPATH)/dc/,$(DC_DMUB)) 79 79 AMD_DISPLAY_EDID = $(addprefix $(AMDDALPATH)/dc/,$(DC_EDID)) 80 80 AMD_DISPLAY_FILES += $(AMD_DISPLAY_DMUB) $(AMD_DISPLAY_EDID) 81 +
+16 -4
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c
··· 32 32 33 33 #define MAX_INSTANCE 6 34 34 #define MAX_SEGMENT 6 35 + #define SMU_REGISTER_WRITE_RETRY_COUNT 5 35 36 36 37 struct IP_BASE_INSTANCE { 37 38 unsigned int segment[MAX_SEGMENT]; ··· 133 132 unsigned int msg_id, unsigned int param) 134 133 { 135 134 uint32_t result; 135 + uint32_t i = 0; 136 + uint32_t read_back_data; 136 137 137 138 result = dcn315_smu_wait_for_response(clk_mgr, 10, 200000); 138 139 ··· 151 148 /* Set the parameter register for the SMU message, unit is Mhz */ 152 149 REG_WRITE(MP1_SMN_C2PMSG_37, param); 153 150 154 - /* Trigger the message transaction by writing the message ID */ 155 - generic_write_indirect_reg(CTX, 156 - REG_NBIO(RSMU_INDEX), REG_NBIO(RSMU_DATA), 157 - mmMP1_C2PMSG_3, msg_id); 151 + for (i = 0; i < SMU_REGISTER_WRITE_RETRY_COUNT; i++) { 152 + /* Trigger the message transaction by writing the message ID */ 153 + generic_write_indirect_reg(CTX, 154 + REG_NBIO(RSMU_INDEX), REG_NBIO(RSMU_DATA), 155 + mmMP1_C2PMSG_3, msg_id); 156 + read_back_data = generic_read_indirect_reg(CTX, 157 + REG_NBIO(RSMU_INDEX), REG_NBIO(RSMU_DATA), 158 + mmMP1_C2PMSG_3); 159 + if (read_back_data == msg_id) 160 + break; 161 + udelay(2); 162 + smu_print("SMU msg id write fail %x times. \n", i + 1); 163 + } 158 164 159 165 result = dcn315_smu_wait_for_response(clk_mgr, 10, 200000); 160 166
+46 -22
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 2073 2073 } 2074 2074 } 2075 2075 2076 - /* Check for case where we are going from odm 2:1 to max 2077 - * pipe scenario. For these cases, we will call 2078 - * commit_minimal_transition_state() to exit out of odm 2:1 2079 - * first before processing new streams 2076 + /* ODM Combine 2:1 power optimization is only applied for single stream 2077 + * scenario, it uses extra pipes than needed to reduce power consumption 2078 + * We need to switch off this feature to make room for new streams. 2080 2079 */ 2081 - if (stream_count == dc->res_pool->pipe_count) { 2080 + if (stream_count > dc->current_state->stream_count && 2081 + dc->current_state->stream_count == 1) { 2082 2082 for (i = 0; i < dc->res_pool->pipe_count; i++) { 2083 2083 pipe = &dc->current_state->res_ctx.pipe_ctx[i]; 2084 2084 if (pipe->next_odm_pipe) ··· 3501 3501 top_pipe_to_program->stream->update_flags.raw = 0; 3502 3502 } 3503 3503 3504 + static void wait_for_outstanding_hw_updates(struct dc *dc, const struct dc_state *dc_context) 3505 + { 3506 + /* 3507 + * This function calls HWSS to wait for any potentially double buffered 3508 + * operations to complete. It should be invoked as a pre-amble prior 3509 + * to full update programming before asserting any HW locks. 3510 + */ 3511 + int pipe_idx; 3512 + int opp_inst; 3513 + int opp_count = dc->res_pool->pipe_count; 3514 + struct hubp *hubp; 3515 + int mpcc_inst; 3516 + const struct pipe_ctx *pipe_ctx; 3517 + 3518 + for (pipe_idx = 0; pipe_idx < dc->res_pool->pipe_count; pipe_idx++) { 3519 + pipe_ctx = &dc_context->res_ctx.pipe_ctx[pipe_idx]; 3520 + 3521 + if (!pipe_ctx->stream) 3522 + continue; 3523 + 3524 + if (pipe_ctx->stream_res.tg->funcs->wait_drr_doublebuffer_pending_clear) 3525 + pipe_ctx->stream_res.tg->funcs->wait_drr_doublebuffer_pending_clear(pipe_ctx->stream_res.tg); 3526 + 3527 + hubp = pipe_ctx->plane_res.hubp; 3528 + if (!hubp) 3529 + continue; 3530 + 3531 + mpcc_inst = hubp->inst; 3532 + // MPCC inst is equal to pipe index in practice 3533 + for (opp_inst = 0; opp_inst < opp_count; opp_inst++) { 3534 + if (dc->res_pool->opps[opp_inst]->mpcc_disconnect_pending[mpcc_inst]) { 3535 + dc->res_pool->mpc->funcs->wait_for_idle(dc->res_pool->mpc, mpcc_inst); 3536 + dc->res_pool->opps[opp_inst]->mpcc_disconnect_pending[mpcc_inst] = false; 3537 + break; 3538 + } 3539 + } 3540 + } 3541 + } 3542 + 3504 3543 static void commit_planes_for_stream(struct dc *dc, 3505 3544 struct dc_surface_update *srf_updates, 3506 3545 int surface_count, ··· 3558 3519 // dc->current_state anymore, so we have to cache it before we apply 3559 3520 // the new SubVP context 3560 3521 subvp_prev_use = false; 3561 - 3562 - 3563 3522 dc_z10_restore(dc); 3564 - 3565 - if (update_type == UPDATE_TYPE_FULL) { 3566 - /* wait for all double-buffer activity to clear on all pipes */ 3567 - int pipe_idx; 3568 - 3569 - for (pipe_idx = 0; pipe_idx < dc->res_pool->pipe_count; pipe_idx++) { 3570 - struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[pipe_idx]; 3571 - 3572 - if (!pipe_ctx->stream) 3573 - continue; 3574 - 3575 - if (pipe_ctx->stream_res.tg->funcs->wait_drr_doublebuffer_pending_clear) 3576 - pipe_ctx->stream_res.tg->funcs->wait_drr_doublebuffer_pending_clear(pipe_ctx->stream_res.tg); 3577 - } 3578 - } 3523 + if (update_type == UPDATE_TYPE_FULL) 3524 + wait_for_outstanding_hw_updates(dc, context); 3579 3525 3580 3526 if (update_type == UPDATE_TYPE_FULL) { 3581 3527 dc_allow_idle_optimizations(dc, false);
+9 -38
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
··· 1106 1106 v_active, 1107 1107 offset); 1108 1108 1109 - if (!blank && dc->debug.enable_single_display_2to1_odm_policy) { 1110 - /* when exiting dynamic ODM need to reinit DPG state for unused pipes */ 1111 - struct pipe_ctx *old_odm_pipe = dc->current_state->res_ctx.pipe_ctx[pipe_ctx->pipe_idx].next_odm_pipe; 1112 - 1113 - odm_pipe = pipe_ctx->next_odm_pipe; 1114 - 1115 - while (old_odm_pipe) { 1116 - if (!odm_pipe || old_odm_pipe->pipe_idx != odm_pipe->pipe_idx) 1117 - dc->hwss.set_disp_pattern_generator(dc, 1118 - old_odm_pipe, 1119 - CONTROLLER_DP_TEST_PATTERN_VIDEOMODE, 1120 - CONTROLLER_DP_COLOR_SPACE_UDEFINED, 1121 - COLOR_DEPTH_888, 1122 - NULL, 1123 - 0, 1124 - 0, 1125 - 0); 1126 - old_odm_pipe = old_odm_pipe->next_odm_pipe; 1127 - if (odm_pipe) 1128 - odm_pipe = odm_pipe->next_odm_pipe; 1129 - } 1130 - } 1131 - 1132 1109 if (!blank) 1133 1110 if (stream_res->abm) { 1134 1111 dc->hwss.set_pipe(pipe_ctx); ··· 1561 1584 || plane_state->update_flags.bits.global_alpha_change 1562 1585 || plane_state->update_flags.bits.per_pixel_alpha_change) { 1563 1586 // MPCC inst is equal to pipe index in practice 1564 - int mpcc_inst = hubp->inst; 1565 - int opp_inst; 1566 - int opp_count = dc->res_pool->pipe_count; 1567 - 1568 - for (opp_inst = 0; opp_inst < opp_count; opp_inst++) { 1569 - if (dc->res_pool->opps[opp_inst]->mpcc_disconnect_pending[mpcc_inst]) { 1570 - dc->res_pool->mpc->funcs->wait_for_idle(dc->res_pool->mpc, mpcc_inst); 1571 - dc->res_pool->opps[opp_inst]->mpcc_disconnect_pending[mpcc_inst] = false; 1572 - break; 1573 - } 1574 - } 1575 1587 hws->funcs.update_mpcc(dc, pipe_ctx); 1576 1588 } 1577 1589 ··· 1688 1722 struct dc_state *context) 1689 1723 { 1690 1724 struct dce_hwseq *hws = dc->hwseq; 1691 - /* Only need to unblank on top pipe */ 1692 1725 1693 - if ((pipe_ctx->update_flags.bits.enable || pipe_ctx->stream->update_flags.bits.abm_level) 1694 - && !pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe) 1695 - hws->funcs.blank_pixel_data(dc, pipe_ctx, !pipe_ctx->plane_state->visible); 1726 + /* Only need to unblank on top pipe */ 1727 + if (resource_is_pipe_type(pipe_ctx, OTG_MASTER)) { 1728 + if (pipe_ctx->update_flags.bits.enable || 1729 + pipe_ctx->update_flags.bits.odm || 1730 + pipe_ctx->stream->update_flags.bits.abm_level) 1731 + hws->funcs.blank_pixel_data(dc, pipe_ctx, 1732 + !pipe_ctx->plane_state || 1733 + !pipe_ctx->plane_state->visible); 1734 + } 1696 1735 1697 1736 /* Only update TG on top pipe */ 1698 1737 if (pipe_ctx->update_flags.bits.global_sync && !pipe_ctx->top_pipe
+17
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
··· 987 987 } 988 988 } 989 989 990 + void dcn30_set_static_screen_control(struct pipe_ctx **pipe_ctx, 991 + int num_pipes, const struct dc_static_screen_params *params) 992 + { 993 + unsigned int i; 994 + unsigned int triggers = 0; 995 + 996 + if (params->triggers.surface_update) 997 + triggers |= 0x100; 998 + if (params->triggers.cursor_update) 999 + triggers |= 0x8; 1000 + if (params->triggers.force_trigger) 1001 + triggers |= 0x1; 1002 + 1003 + for (i = 0; i < num_pipes; i++) 1004 + pipe_ctx[i]->stream_res.tg->funcs->set_static_screen_control(pipe_ctx[i]->stream_res.tg, 1005 + triggers, params->num_frames); 1006 + }
+2
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.h
··· 87 87 void dcn30_prepare_bandwidth(struct dc *dc, 88 88 struct dc_state *context); 89 89 90 + void dcn30_set_static_screen_control(struct pipe_ctx **pipe_ctx, 91 + int num_pipes, const struct dc_static_screen_params *params); 90 92 91 93 #endif /* __DC_HWSS_DCN30_H__ */
+1 -1
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_init.c
··· 64 64 .update_bandwidth = dcn20_update_bandwidth, 65 65 .set_drr = dcn10_set_drr, 66 66 .get_position = dcn10_get_position, 67 - .set_static_screen_control = dcn10_set_static_screen_control, 67 + .set_static_screen_control = dcn30_set_static_screen_control, 68 68 .setup_stereo = dcn10_setup_stereo, 69 69 .set_avmute = dcn30_set_avmute, 70 70 .log_hw_state = dcn10_log_hw_state,
+1
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
··· 75 75 .get_hw_state = dcn10_get_hw_state, 76 76 .clear_status_bits = dcn10_clear_status_bits, 77 77 .wait_for_mpcc_disconnect = dcn10_wait_for_mpcc_disconnect, 78 + .edp_backlight_control = dce110_edp_backlight_control, 78 79 .edp_power_control = dce110_edp_power_control, 79 80 .edp_wait_for_hpd_ready = dce110_edp_wait_for_hpd_ready, 80 81 .set_cursor_position = dcn10_set_cursor_position,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c
··· 67 67 .update_bandwidth = dcn20_update_bandwidth, 68 68 .set_drr = dcn10_set_drr, 69 69 .get_position = dcn10_get_position, 70 - .set_static_screen_control = dcn10_set_static_screen_control, 70 + .set_static_screen_control = dcn30_set_static_screen_control, 71 71 .setup_stereo = dcn10_setup_stereo, 72 72 .set_avmute = dcn30_set_avmute, 73 73 .log_hw_state = dcn10_log_hw_state,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c
··· 69 69 .update_bandwidth = dcn20_update_bandwidth, 70 70 .set_drr = dcn10_set_drr, 71 71 .get_position = dcn10_get_position, 72 - .set_static_screen_control = dcn10_set_static_screen_control, 72 + .set_static_screen_control = dcn30_set_static_screen_control, 73 73 .setup_stereo = dcn10_setup_stereo, 74 74 .set_avmute = dcn30_set_avmute, 75 75 .log_hw_state = dcn10_log_hw_state,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c
··· 65 65 .update_bandwidth = dcn20_update_bandwidth, 66 66 .set_drr = dcn10_set_drr, 67 67 .get_position = dcn10_get_position, 68 - .set_static_screen_control = dcn10_set_static_screen_control, 68 + .set_static_screen_control = dcn30_set_static_screen_control, 69 69 .setup_stereo = dcn10_setup_stereo, 70 70 .set_avmute = dcn30_set_avmute, 71 71 .log_hw_state = dcn10_log_hw_state,
+114 -4
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
··· 2564 2564 return free_pipe_idx; 2565 2565 } 2566 2566 2567 + static struct pipe_ctx *find_idle_secondary_pipe_check_mpo( 2568 + struct resource_context *res_ctx, 2569 + const struct resource_pool *pool, 2570 + const struct pipe_ctx *primary_pipe) 2571 + { 2572 + int i; 2573 + struct pipe_ctx *secondary_pipe = NULL; 2574 + struct pipe_ctx *next_odm_mpo_pipe = NULL; 2575 + int primary_index, preferred_pipe_idx; 2576 + struct pipe_ctx *old_primary_pipe = NULL; 2577 + 2578 + /* 2579 + * Modified from find_idle_secondary_pipe 2580 + * With windowed MPO and ODM, we want to avoid the case where we want a 2581 + * free pipe for the left side but the free pipe is being used on the 2582 + * right side. 2583 + * Add check on current_state if the primary_pipe is the left side, 2584 + * to check the right side ( primary_pipe->next_odm_pipe ) to see if 2585 + * it is using a pipe for MPO ( primary_pipe->next_odm_pipe->bottom_pipe ) 2586 + * - If so, then don't use this pipe 2587 + * EXCEPTION - 3 plane ( 2 MPO plane ) case 2588 + * - in this case, the primary pipe has already gotten a free pipe for the 2589 + * MPO window in the left 2590 + * - when it tries to get a free pipe for the MPO window on the right, 2591 + * it will see that it is already assigned to the right side 2592 + * ( primary_pipe->next_odm_pipe ). But in this case, we want this 2593 + * free pipe, since it will be for the right side. So add an 2594 + * additional condition, that skipping the free pipe on the right only 2595 + * applies if the primary pipe has no bottom pipe currently assigned 2596 + */ 2597 + if (primary_pipe) { 2598 + primary_index = primary_pipe->pipe_idx; 2599 + old_primary_pipe = &primary_pipe->stream->ctx->dc->current_state->res_ctx.pipe_ctx[primary_index]; 2600 + if ((old_primary_pipe->next_odm_pipe) && (old_primary_pipe->next_odm_pipe->bottom_pipe) 2601 + && (!primary_pipe->bottom_pipe)) 2602 + next_odm_mpo_pipe = old_primary_pipe->next_odm_pipe->bottom_pipe; 2603 + 2604 + preferred_pipe_idx = (pool->pipe_count - 1) - primary_pipe->pipe_idx; 2605 + if ((res_ctx->pipe_ctx[preferred_pipe_idx].stream == NULL) && 2606 + !(next_odm_mpo_pipe && next_odm_mpo_pipe->pipe_idx == preferred_pipe_idx)) { 2607 + secondary_pipe = &res_ctx->pipe_ctx[preferred_pipe_idx]; 2608 + secondary_pipe->pipe_idx = preferred_pipe_idx; 2609 + } 2610 + } 2611 + 2612 + /* 2613 + * search backwards for the second pipe to keep pipe 2614 + * assignment more consistent 2615 + */ 2616 + if (!secondary_pipe) 2617 + for (i = pool->pipe_count - 1; i >= 0; i--) { 2618 + if ((res_ctx->pipe_ctx[i].stream == NULL) && 2619 + !(next_odm_mpo_pipe && next_odm_mpo_pipe->pipe_idx == i)) { 2620 + secondary_pipe = &res_ctx->pipe_ctx[i]; 2621 + secondary_pipe->pipe_idx = i; 2622 + break; 2623 + } 2624 + } 2625 + 2626 + return secondary_pipe; 2627 + } 2628 + 2629 + static struct pipe_ctx *dcn32_acquire_idle_pipe_for_head_pipe_in_layer( 2630 + struct dc_state *state, 2631 + const struct resource_pool *pool, 2632 + struct dc_stream_state *stream, 2633 + const struct pipe_ctx *head_pipe) 2634 + { 2635 + struct resource_context *res_ctx = &state->res_ctx; 2636 + struct pipe_ctx *idle_pipe, *pipe; 2637 + struct resource_context *old_ctx = &stream->ctx->dc->current_state->res_ctx; 2638 + int head_index; 2639 + 2640 + if (!head_pipe) 2641 + ASSERT(0); 2642 + 2643 + /* 2644 + * Modified from dcn20_acquire_idle_pipe_for_layer 2645 + * Check if head_pipe in old_context already has bottom_pipe allocated. 2646 + * - If so, check if that pipe is available in the current context. 2647 + * -- If so, reuse pipe from old_context 2648 + */ 2649 + head_index = head_pipe->pipe_idx; 2650 + pipe = &old_ctx->pipe_ctx[head_index]; 2651 + if (pipe->bottom_pipe && res_ctx->pipe_ctx[pipe->bottom_pipe->pipe_idx].stream == NULL) { 2652 + idle_pipe = &res_ctx->pipe_ctx[pipe->bottom_pipe->pipe_idx]; 2653 + idle_pipe->pipe_idx = pipe->bottom_pipe->pipe_idx; 2654 + } else { 2655 + idle_pipe = find_idle_secondary_pipe_check_mpo(res_ctx, pool, head_pipe); 2656 + if (!idle_pipe) 2657 + return NULL; 2658 + } 2659 + 2660 + idle_pipe->stream = head_pipe->stream; 2661 + idle_pipe->stream_res.tg = head_pipe->stream_res.tg; 2662 + idle_pipe->stream_res.opp = head_pipe->stream_res.opp; 2663 + 2664 + idle_pipe->plane_res.hubp = pool->hubps[idle_pipe->pipe_idx]; 2665 + idle_pipe->plane_res.ipp = pool->ipps[idle_pipe->pipe_idx]; 2666 + idle_pipe->plane_res.dpp = pool->dpps[idle_pipe->pipe_idx]; 2667 + idle_pipe->plane_res.mpcc_inst = pool->dpps[idle_pipe->pipe_idx]->inst; 2668 + 2669 + return idle_pipe; 2670 + } 2671 + 2567 2672 struct pipe_ctx *dcn32_acquire_free_pipe_as_secondary_dpp_pipe( 2568 2673 const struct dc_state *cur_ctx, 2569 2674 struct dc_state *new_ctx, 2570 2675 const struct resource_pool *pool, 2571 2676 const struct pipe_ctx *opp_head_pipe) 2572 2677 { 2573 - int free_pipe_idx = 2574 - find_optimal_free_pipe_as_secondary_dpp_pipe( 2575 - &cur_ctx->res_ctx, &new_ctx->res_ctx, 2576 - pool, opp_head_pipe); 2678 + 2679 + int free_pipe_idx; 2577 2680 struct pipe_ctx *free_pipe; 2578 2681 2682 + if (!opp_head_pipe->stream->ctx->dc->config.enable_windowed_mpo_odm) 2683 + return dcn32_acquire_idle_pipe_for_head_pipe_in_layer( 2684 + new_ctx, pool, opp_head_pipe->stream, opp_head_pipe); 2685 + 2686 + free_pipe_idx = find_optimal_free_pipe_as_secondary_dpp_pipe( 2687 + &cur_ctx->res_ctx, &new_ctx->res_ctx, 2688 + pool, opp_head_pipe); 2579 2689 if (free_pipe_idx >= 0) { 2580 2690 free_pipe = &new_ctx->res_ctx.pipe_ctx[free_pipe_idx]; 2581 2691 free_pipe->pipe_idx = free_pipe_idx;
+5 -20
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
··· 1099 1099 context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz = 1100 1100 pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000; 1101 1101 context->res_ctx.pipe_ctx[i].pipe_dlg_param = pipes[pipe_idx].pipe.dest; 1102 + if (dc->ctx->dce_version < DCN_VERSION_3_1 && 1103 + context->res_ctx.pipe_ctx[i].stream->adaptive_sync_infopacket.valid) 1104 + dcn20_adjust_freesync_v_startup( 1105 + &context->res_ctx.pipe_ctx[i].stream->timing, 1106 + &context->res_ctx.pipe_ctx[i].pipe_dlg_param.vstartup_start); 1102 1107 1103 1108 pipe_idx++; 1104 1109 } ··· 1932 1927 int vlevel = 0; 1933 1928 int pipe_split_from[MAX_PIPES]; 1934 1929 int pipe_cnt = 0; 1935 - int i = 0; 1936 1930 display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC); 1937 1931 DC_LOGGER_INIT(dc->ctx->logger); 1938 1932 ··· 1954 1950 1955 1951 dcn20_calculate_wm(dc, context, pipes, &pipe_cnt, pipe_split_from, vlevel, fast_validate); 1956 1952 dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel); 1957 - 1958 - for (i = 0; i < dc->res_pool->pipe_count; i++) { 1959 - if (!context->res_ctx.pipe_ctx[i].stream) 1960 - continue; 1961 - if (context->res_ctx.pipe_ctx[i].stream->adaptive_sync_infopacket.valid) 1962 - dcn20_adjust_freesync_v_startup( 1963 - &context->res_ctx.pipe_ctx[i].stream->timing, 1964 - &context->res_ctx.pipe_ctx[i].pipe_dlg_param.vstartup_start); 1965 - } 1966 1953 1967 1954 BW_VAL_TRACE_END_WATERMARKS(); 1968 1955 ··· 2227 2232 int vlevel = 0; 2228 2233 int pipe_split_from[MAX_PIPES]; 2229 2234 int pipe_cnt = 0; 2230 - int i = 0; 2231 2235 display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC); 2232 2236 DC_LOGGER_INIT(dc->ctx->logger); 2233 2237 ··· 2254 2260 2255 2261 dcn21_calculate_wm(dc, context, pipes, &pipe_cnt, pipe_split_from, vlevel, fast_validate); 2256 2262 dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel); 2257 - 2258 - for (i = 0; i < dc->res_pool->pipe_count; i++) { 2259 - if (!context->res_ctx.pipe_ctx[i].stream) 2260 - continue; 2261 - if (context->res_ctx.pipe_ctx[i].stream->adaptive_sync_infopacket.valid) 2262 - dcn20_adjust_freesync_v_startup( 2263 - &context->res_ctx.pipe_ctx[i].stream->timing, 2264 - &context->res_ctx.pipe_ctx[i].pipe_dlg_param.vstartup_start); 2265 - } 2266 2263 2267 2264 BW_VAL_TRACE_END_WATERMARKS(); 2268 2265
+20 -1
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c
··· 293 293 return num_lines; 294 294 } 295 295 296 + static unsigned int get_vertical_back_porch(struct dc_crtc_timing *timing) 297 + { 298 + unsigned int v_active = 0, v_blank = 0, v_back_porch = 0; 299 + 300 + v_active = timing->v_border_top + timing->v_addressable + timing->v_border_bottom; 301 + v_blank = timing->v_total - v_active; 302 + v_back_porch = v_blank - timing->v_front_porch - timing->v_sync_width; 303 + 304 + return v_back_porch; 305 + } 306 + 296 307 int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *context, 297 308 display_e2e_pipe_params_st *pipes, 298 309 bool fast_validate) ··· 321 310 for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) { 322 311 struct dc_crtc_timing *timing; 323 312 unsigned int num_lines = 0; 313 + unsigned int v_back_porch = 0; 324 314 325 315 if (!res_ctx->pipe_ctx[i].stream) 326 316 continue; ··· 335 323 else 336 324 pipes[pipe_cnt].pipe.dest.vtotal = timing->v_total; 337 325 326 + v_back_porch = get_vertical_back_porch(timing); 327 + 338 328 pipes[pipe_cnt].pipe.dest.vblank_nom = timing->v_total - pipes[pipe_cnt].pipe.dest.vactive; 339 329 pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, num_lines); 340 - pipes[pipe_cnt].pipe.dest.vblank_nom = max(pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width); 330 + // vblank_nom should not smaller than (VSync (timing->v_sync_width + v_back_porch) + 2) 331 + // + 2 is because 332 + // 1 -> VStartup_start should be 1 line before VSync 333 + // 1 -> always reserve 1 line between start of vblank to vstartup signal 334 + pipes[pipe_cnt].pipe.dest.vblank_nom = 335 + max(pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width + v_back_porch + 2); 341 336 pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, max_allowed_vblank_nom); 342 337 343 338 if (pipe->plane_state &&
+6 -3
drivers/gpu/drm/amd/display/modules/freesync/freesync.c
··· 338 338 * - Delta for CEIL: delta_from_mid_point_in_us_1 339 339 * - Delta for FLOOR: delta_from_mid_point_in_us_2 340 340 */ 341 - if ((last_render_time_in_us / mid_point_frames_ceil) < in_out_vrr->min_duration_in_us) { 341 + if (mid_point_frames_ceil && 342 + (last_render_time_in_us / mid_point_frames_ceil) < 343 + in_out_vrr->min_duration_in_us) { 342 344 /* Check for out of range. 343 345 * If using CEIL produces a value that is out of range, 344 346 * then we are forced to use FLOOR. ··· 387 385 /* Either we've calculated the number of frames to insert, 388 386 * or we need to insert min duration frames 389 387 */ 390 - if (last_render_time_in_us / frames_to_insert < 391 - in_out_vrr->min_duration_in_us){ 388 + if (frames_to_insert && 389 + (last_render_time_in_us / frames_to_insert) < 390 + in_out_vrr->min_duration_in_us){ 392 391 frames_to_insert -= (frames_to_insert > 1) ? 393 392 1 : 0; 394 393 }
+2
drivers/gpu/drm/amd/include/amd_shared.h
··· 240 240 DC_DISABLE_LTTPR_DP2_0 = (1 << 6), //0x40, disabled by default 241 241 DC_PSR_ALLOW_SMU_OPT = (1 << 7), //0x80, disabled by default 242 242 DC_PSR_ALLOW_MULTI_DISP_OPT = (1 << 8), //0x100, disabled by default 243 + DC_REPLAY_MASK = (1 << 9), //0x200, disabled by default for dcn < 3.1.4 243 244 }; 244 245 245 246 enum DC_DEBUG_MASK { ··· 251 250 DC_DISABLE_PSR = 0x10, 252 251 DC_FORCE_SUBVP_MCLK_SWITCH = 0x20, 253 252 DC_DISABLE_MPO = 0x40, 253 + DC_DISABLE_REPLAY = 0x50, 254 254 DC_ENABLE_DPIA_TRACE = 0x80, 255 255 }; 256 256
+18
drivers/gpu/drm/amd/include/atomfirmware.h
··· 3117 3117 UMC_CONFIG1__ENABLE_ECC_CAPABLE = 0x00010000, 3118 3118 }; 3119 3119 3120 + struct atom_umc_info_v4_0 { 3121 + struct atom_common_table_header table_header; 3122 + uint32_t ucode_reserved[5]; 3123 + uint8_t umcip_min_ver; 3124 + uint8_t umcip_max_ver; 3125 + uint8_t vram_type; 3126 + uint8_t umc_config; 3127 + uint32_t mem_refclk_10khz; 3128 + uint32_t clk_reserved[4]; 3129 + uint32_t golden_reserved; 3130 + uint32_t umc_config1; 3131 + uint32_t reserved[2]; 3132 + uint8_t channel_num; 3133 + uint8_t channel_width; 3134 + uint8_t channel_reserve[2]; 3135 + uint8_t umc_info_reserved[16]; 3136 + }; 3137 + 3120 3138 /* 3121 3139 *************************************************************************** 3122 3140 Data Table vram_info structure
+37 -1
drivers/gpu/drm/amd/include/discovery.h
··· 30 30 #define GC_TABLE_ID 0x4347 31 31 #define HARVEST_TABLE_SIGNATURE 0x56524148 32 32 #define VCN_INFO_TABLE_ID 0x004E4356 33 - #define MALL_INFO_TABLE_ID 0x4D414C4C 33 + #define MALL_INFO_TABLE_ID 0x4C4C414D 34 34 35 35 typedef enum 36 36 { ··· 280 280 uint32_t gc_num_packer_per_sc; 281 281 }; 282 282 283 + struct gc_info_v2_1 { 284 + struct gpu_info_header header; 285 + 286 + uint32_t gc_num_se; 287 + uint32_t gc_num_cu_per_sh; 288 + uint32_t gc_num_sh_per_se; 289 + uint32_t gc_num_rb_per_se; 290 + uint32_t gc_num_tccs; 291 + uint32_t gc_num_gprs; 292 + uint32_t gc_num_max_gs_thds; 293 + uint32_t gc_gs_table_depth; 294 + uint32_t gc_gsprim_buff_depth; 295 + uint32_t gc_parameter_cache_depth; 296 + uint32_t gc_double_offchip_lds_buffer; 297 + uint32_t gc_wave_size; 298 + uint32_t gc_max_waves_per_simd; 299 + uint32_t gc_max_scratch_slots_per_cu; 300 + uint32_t gc_lds_size; 301 + uint32_t gc_num_sc_per_se; 302 + uint32_t gc_num_packer_per_sc; 303 + /* new for v2_1 */ 304 + uint32_t gc_num_tcp_per_sh; 305 + uint32_t gc_tcp_size_per_cu; 306 + uint32_t gc_num_sdp_interface; 307 + uint32_t gc_num_cu_per_sqc; 308 + uint32_t gc_instruction_cache_size_per_sqc; 309 + uint32_t gc_scalar_data_cache_size_per_sqc; 310 + uint32_t gc_tcc_size; 311 + }; 312 + 283 313 typedef struct harvest_info_header { 284 314 uint32_t signature; /* Table Signature */ 285 315 uint32_t version; /* Table Version */ ··· 340 310 uint32_t m_half_use; 341 311 uint32_t m_mall_config; 342 312 uint32_t reserved[5]; 313 + }; 314 + 315 + struct mall_info_v2_0 { 316 + struct mall_info_header header; 317 + uint32_t mall_size_per_umc; 318 + uint32_t reserved[8]; 343 319 }; 344 320 345 321 #define VCN_INFO_TABLE_MAX_NUM_INSTANCES 4
+7 -4
drivers/gpu/drm/amd/pm/amdgpu_pm.c
··· 3311 3311 (gc_ver != IP_VERSION(9, 4, 3)) && 3312 3312 (attr == &sensor_dev_attr_temp2_input.dev_attr.attr || 3313 3313 attr == &sensor_dev_attr_temp2_label.dev_attr.attr || 3314 + attr == &sensor_dev_attr_temp2_crit.dev_attr.attr || 3314 3315 attr == &sensor_dev_attr_temp3_input.dev_attr.attr || 3315 - attr == &sensor_dev_attr_temp3_label.dev_attr.attr)) 3316 + attr == &sensor_dev_attr_temp3_label.dev_attr.attr || 3317 + attr == &sensor_dev_attr_temp3_crit.dev_attr.attr)) 3316 3318 return 0; 3317 3319 3318 3320 /* hotspot temperature for gc 9,4,3*/ ··· 3326 3324 /* only SOC15 dGPUs support hotspot and mem temperatures */ 3327 3325 if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0) || 3328 3326 (gc_ver == IP_VERSION(9, 4, 3))) && 3329 - (attr == &sensor_dev_attr_temp2_crit.dev_attr.attr || 3330 - attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr || 3331 - attr == &sensor_dev_attr_temp3_crit.dev_attr.attr || 3327 + (attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr || 3332 3328 attr == &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr || 3333 3329 attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr || 3334 3330 attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr || ··· 3471 3471 size = sizeof(uint32_t); 3472 3472 if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_AVG_POWER, (void *)&query, &size)) 3473 3473 seq_printf(m, "\t%u.%u W (average GPU)\n", query >> 8, query & 0xff); 3474 + size = sizeof(uint32_t); 3475 + if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER, (void *)&query, &size)) 3476 + seq_printf(m, "\t%u.%u W (current GPU)\n", query >> 8, query & 0xff); 3474 3477 size = sizeof(value); 3475 3478 seq_printf(m, "\n"); 3476 3479
+1 -4
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
··· 1031 1031 enum smu_feature_mask mask); 1032 1032 1033 1033 /** 1034 - * @notify_display_change: Enable fast memory clock switching. 1035 - * 1036 - * Allows for fine grained memory clock switching but has more stringent 1037 - * timing requirements. 1034 + * @notify_display_change: General interface call to let SMU know about DC change 1038 1035 */ 1039 1036 int (*notify_display_change)(struct smu_context *smu); 1040 1037
+4 -1
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
··· 138 138 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A 139 139 #define PPSMC_MSG_SetPriorityDeltaGain 0x4B 140 140 #define PPSMC_MSG_AllowIHHostInterrupt 0x4C 141 - #define PPSMC_Message_Count 0x4D 141 + 142 + #define PPSMC_MSG_DALNotPresent 0x4E 143 + 144 + #define PPSMC_Message_Count 0x4F 142 145 143 146 //Debug Dump Message 144 147 #define DEBUGSMC_MSG_TestMessage 0x1
+2 -2
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_pmfw.h
··· 123 123 VOLTAGE_GUARDBAND_COUNT 124 124 } GFX_GUARDBAND_e; 125 125 126 - #define SMU_METRICS_TABLE_VERSION 0x5 126 + #define SMU_METRICS_TABLE_VERSION 0x7 127 127 128 128 typedef struct __attribute__((packed, aligned(4))) { 129 129 uint32_t AccumulationCounter; ··· 198 198 uint32_t SocketThmResidencyAcc; 199 199 uint32_t VrThmResidencyAcc; 200 200 uint32_t HbmThmResidencyAcc; 201 - uint32_t spare; 201 + uint32_t GfxLockXCDMak; 202 202 203 203 // New Items at end to maintain driver compatibility 204 204 uint32_t GfxclkFrequency[8];
+15 -1
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_ppsmc.h
··· 83 83 #define PPSMC_MSG_GetMinGfxDpmFreq 0x32 84 84 #define PPSMC_MSG_GetMaxGfxDpmFreq 0x33 85 85 #define PPSMC_MSG_PrepareForDriverUnload 0x34 86 - #define PPSMC_Message_Count 0x35 86 + #define PPSMC_MSG_ReadThrottlerLimit 0x35 87 + #define PPSMC_MSG_QueryValidMcaCount 0x36 88 + #define PPSMC_MSG_McaBankDumpDW 0x37 89 + #define PPSMC_MSG_GetCTFLimit 0x38 90 + #define PPSMC_Message_Count 0x39 87 91 88 92 //PPSMC Reset Types for driver msg argument 89 93 #define PPSMC_RESET_TYPE_DRIVER_MODE_1_RESET 0x1 90 94 #define PPSMC_RESET_TYPE_DRIVER_MODE_2_RESET 0x2 91 95 #define PPSMC_RESET_TYPE_DRIVER_MODE_3_RESET 0x3 96 + 97 + //PPSMC Reset Types for driver msg argument 98 + #define PPSMC_THROTTLING_LIMIT_TYPE_SOCKET 0x1 99 + #define PPSMC_THROTTLING_LIMIT_TYPE_HBM 0x2 100 + 101 + //CTF/Throttle Limit types 102 + #define PPSMC_AID_THM_TYPE 0x1 103 + #define PPSMC_CCD_THM_TYPE 0x2 104 + #define PPSMC_XCD_THM_TYPE 0x3 105 + #define PPSMC_HBM_THM_TYPE 0x4 92 106 93 107 typedef uint32_t PPSMC_Result; 94 108 typedef uint32_t PPSMC_MSG;
+3 -1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
··· 84 84 __SMU_DUMMY_MAP(SetTjMax), \ 85 85 __SMU_DUMMY_MAP(SetFanTemperatureTarget), \ 86 86 __SMU_DUMMY_MAP(PrepareMp1ForUnload), \ 87 + __SMU_DUMMY_MAP(GetCTFLimit), \ 87 88 __SMU_DUMMY_MAP(DramLogSetDramAddrHigh), \ 88 89 __SMU_DUMMY_MAP(DramLogSetDramAddrLow), \ 89 90 __SMU_DUMMY_MAP(DramLogSetDramSize), \ ··· 246 245 __SMU_DUMMY_MAP(AllowGpo), \ 247 246 __SMU_DUMMY_MAP(Mode2Reset), \ 248 247 __SMU_DUMMY_MAP(RequestI2cTransaction), \ 249 - __SMU_DUMMY_MAP(GetMetricsTable), 248 + __SMU_DUMMY_MAP(GetMetricsTable), \ 249 + __SMU_DUMMY_MAP(DALNotPresent), 250 250 251 251 #undef __SMU_DUMMY_MAP 252 252 #define __SMU_DUMMY_MAP(type) SMU_MSG_##type
+2 -6
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
··· 837 837 { 838 838 int ret = 0; 839 839 840 - if (!smu->pm_enabled) 841 - return ret; 842 - 843 - if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_UCLK_BIT) && 844 - smu->adev->gmc.vram_type == AMDGPU_VRAM_TYPE_HBM) 845 - ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetUclkFastSwitch, 1, NULL); 840 + if (!amdgpu_device_has_dc_support(smu->adev)) 841 + ret = smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent, NULL); 846 842 847 843 return ret; 848 844 }
+2
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 162 162 MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow, 0), 163 163 MSG_MAP(AllowIHHostInterrupt, PPSMC_MSG_AllowIHHostInterrupt, 0), 164 164 MSG_MAP(ReenableAcDcInterrupt, PPSMC_MSG_ReenableAcDcInterrupt, 0), 165 + MSG_MAP(DALNotPresent, PPSMC_MSG_DALNotPresent, 0), 165 166 }; 166 167 167 168 static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = { ··· 2688 2687 .send_hbm_bad_channel_flag = smu_v13_0_0_send_bad_mem_channel_flag, 2689 2688 .gpo_control = smu_v13_0_gpo_control, 2690 2689 .get_ecc_info = smu_v13_0_0_get_ecc_info, 2690 + .notify_display_change = smu_v13_0_notify_display_change, 2691 2691 }; 2692 2692 2693 2693 void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
+52 -2
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
··· 132 132 MSG_MAP(SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxClk, 0), 133 133 MSG_MAP(SetSoftMaxGfxClk, PPSMC_MSG_SetSoftMaxGfxClk, 0), 134 134 MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareForDriverUnload, 0), 135 + MSG_MAP(GetCTFLimit, PPSMC_MSG_GetCTFLimit, 0), 135 136 }; 136 137 137 138 static const struct cmn2asic_mapping smu_v13_0_6_clk_map[SMU_CLK_COUNT] = { ··· 2082 2081 return ret; 2083 2082 } 2084 2083 2084 + static int smu_v13_0_6_get_thermal_temperature_range(struct smu_context *smu, 2085 + struct smu_temperature_range *range) 2086 + { 2087 + struct amdgpu_device *adev = smu->adev; 2088 + u32 aid_temp, xcd_temp, mem_temp; 2089 + uint32_t smu_version; 2090 + u32 ccd_temp = 0; 2091 + int ret; 2092 + 2093 + if (amdgpu_sriov_vf(smu->adev)) 2094 + return 0; 2095 + 2096 + if (!range) 2097 + return -EINVAL; 2098 + 2099 + /*Check smu version, GetCtfLimit message only supported for smu version 85.69 or higher */ 2100 + smu_cmn_get_smc_version(smu, NULL, &smu_version); 2101 + if (smu_version < 0x554500) 2102 + return 0; 2103 + 2104 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GetCTFLimit, 2105 + PPSMC_AID_THM_TYPE, &aid_temp); 2106 + if (ret) 2107 + goto failed; 2108 + 2109 + if (adev->flags & AMD_IS_APU) { 2110 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GetCTFLimit, 2111 + PPSMC_CCD_THM_TYPE, &ccd_temp); 2112 + if (ret) 2113 + goto failed; 2114 + } 2115 + 2116 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GetCTFLimit, 2117 + PPSMC_XCD_THM_TYPE, &xcd_temp); 2118 + if (ret) 2119 + goto failed; 2120 + 2121 + range->hotspot_crit_max = max3(aid_temp, xcd_temp, ccd_temp) * 2122 + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; 2123 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GetCTFLimit, 2124 + PPSMC_HBM_THM_TYPE, &mem_temp); 2125 + if (ret) 2126 + goto failed; 2127 + 2128 + range->mem_crit_max = mem_temp * SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; 2129 + failed: 2130 + return ret; 2131 + } 2132 + 2085 2133 static int smu_v13_0_6_mode1_reset(struct smu_context *smu) 2086 2134 { 2087 2135 struct amdgpu_device *adev = smu->adev; ··· 2158 2108 2159 2109 static bool smu_v13_0_6_is_mode1_reset_supported(struct smu_context *smu) 2160 2110 { 2161 - /* TODO: Enable this when FW support is added */ 2162 - return false; 2111 + return true; 2163 2112 } 2164 2113 2165 2114 static bool smu_v13_0_6_is_mode2_reset_supported(struct smu_context *smu) ··· 2226 2177 .get_pp_feature_mask = smu_cmn_get_pp_feature_mask, 2227 2178 .set_pp_feature_mask = smu_cmn_set_pp_feature_mask, 2228 2179 .get_gpu_metrics = smu_v13_0_6_get_gpu_metrics, 2180 + .get_thermal_temperature_range = smu_v13_0_6_get_thermal_temperature_range, 2229 2181 .mode1_reset_is_support = smu_v13_0_6_is_mode1_reset_supported, 2230 2182 .mode2_reset_is_support = smu_v13_0_6_is_mode2_reset_supported, 2231 2183 .mode1_reset = smu_v13_0_6_mode1_reset,
+1
drivers/gpu/drm/i915/gt/intel_engine_types.h
··· 58 58 59 59 typedef u32 intel_engine_mask_t; 60 60 #define ALL_ENGINES ((intel_engine_mask_t)~0ul) 61 + #define VIRTUAL_ENGINES BIT(BITS_PER_TYPE(intel_engine_mask_t) - 1) 61 62 62 63 struct intel_hw_status_page { 63 64 struct list_head timelines;
+3
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
··· 5470 5470 5471 5471 ve->base.flags = I915_ENGINE_IS_VIRTUAL; 5472 5472 5473 + BUILD_BUG_ON(ilog2(VIRTUAL_ENGINES) < I915_NUM_ENGINES); 5474 + ve->base.mask = VIRTUAL_ENGINES; 5475 + 5473 5476 intel_context_init(&ve->context, &ve->base); 5474 5477 5475 5478 for (n = 0; n < count; n++) {
+2 -5
drivers/gpu/drm/i915/i915_request.c
··· 134 134 i915_sw_fence_fini(&rq->semaphore); 135 135 136 136 /* 137 - * Keep one request on each engine for reserved use under mempressure 138 - * do not use with virtual engines as this really is only needed for 139 - * kernel contexts. 137 + * Keep one request on each engine for reserved use under mempressure. 140 138 * 141 139 * We do not hold a reference to the engine here and so have to be 142 140 * very careful in what rq->engine we poke. The virtual engine is ··· 164 166 * know that if the rq->execution_mask is a single bit, rq->engine 165 167 * can be a physical engine with the exact corresponding mask. 166 168 */ 167 - if (!intel_engine_is_virtual(rq->engine) && 168 - is_power_of_2(rq->execution_mask) && 169 + if (is_power_of_2(rq->execution_mask) && 169 170 !cmpxchg(&rq->engine->request_pool, NULL, rq)) 170 171 return; 171 172
+1 -8
drivers/gpu/drm/nouveau/dispnv04/crtc.c
··· 1122 1122 PUSH_NVSQ(push, NV_SW, NV_SW_PAGE_FLIP, 0x00000000); 1123 1123 PUSH_KICK(push); 1124 1124 1125 - ret = nouveau_fence_new(pfence); 1125 + ret = nouveau_fence_new(pfence, chan); 1126 1126 if (ret) 1127 1127 goto fail; 1128 1128 1129 - ret = nouveau_fence_emit(*pfence, chan); 1130 - if (ret) 1131 - goto fail_fence_unref; 1132 - 1133 1129 return 0; 1134 - 1135 - fail_fence_unref: 1136 - nouveau_fence_unref(pfence); 1137 1130 fail: 1138 1131 spin_lock_irqsave(&dev->event_lock, flags); 1139 1132 list_del(&s->head);
+1 -7
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 875 875 if (ret) 876 876 goto out_unlock; 877 877 878 - ret = nouveau_fence_new(&fence); 878 + ret = nouveau_fence_new(&fence, chan); 879 879 if (ret) 880 880 goto out_unlock; 881 - 882 - ret = nouveau_fence_emit(fence, chan); 883 - if (ret) { 884 - nouveau_fence_unref(&fence); 885 - goto out_unlock; 886 - } 887 881 888 882 /* TODO: figure out a better solution here 889 883 *
+2 -4
drivers/gpu/drm/nouveau/nouveau_chan.c
··· 70 70 struct nouveau_fence *fence = NULL; 71 71 int ret; 72 72 73 - ret = nouveau_fence_new(&fence); 73 + ret = nouveau_fence_new(&fence, chan); 74 74 if (!ret) { 75 - ret = nouveau_fence_emit(fence, chan); 76 - if (!ret) 77 - ret = nouveau_fence_wait(fence, false, false); 75 + ret = nouveau_fence_wait(fence, false, false); 78 76 nouveau_fence_unref(&fence); 79 77 } 80 78
+3 -6
drivers/gpu/drm/nouveau/nouveau_dmem.c
··· 209 209 goto done; 210 210 } 211 211 212 - if (!nouveau_fence_new(&fence)) 213 - nouveau_fence_emit(fence, dmem->migrate.chan); 212 + nouveau_fence_new(&fence, dmem->migrate.chan); 214 213 migrate_vma_pages(&args); 215 214 nouveau_dmem_fence_done(&fence); 216 215 dma_unmap_page(drm->dev->dev, dma_addr, PAGE_SIZE, DMA_BIDIRECTIONAL); ··· 402 403 } 403 404 } 404 405 405 - if (!nouveau_fence_new(&fence)) 406 - nouveau_fence_emit(fence, chunk->drm->dmem->migrate.chan); 406 + nouveau_fence_new(&fence, chunk->drm->dmem->migrate.chan); 407 407 migrate_device_pages(src_pfns, dst_pfns, npages); 408 408 nouveau_dmem_fence_done(&fence); 409 409 migrate_device_finalize(src_pfns, dst_pfns, npages); ··· 675 677 addr += PAGE_SIZE; 676 678 } 677 679 678 - if (!nouveau_fence_new(&fence)) 679 - nouveau_fence_emit(fence, drm->dmem->migrate.chan); 680 + nouveau_fence_new(&fence, drm->dmem->migrate.chan); 680 681 migrate_vma_pages(args); 681 682 nouveau_dmem_fence_done(&fence); 682 683 nouveau_pfns_map(svmm, args->vma->vm_mm, args->start, pfns, i);
+8 -3
drivers/gpu/drm/nouveau/nouveau_exec.c
··· 96 96 unsigned long index; 97 97 int ret; 98 98 99 - ret = nouveau_fence_new(&exec_job->fence); 99 + /* Create a new fence, but do not emit yet. */ 100 + ret = nouveau_fence_create(&exec_job->fence, exec_job->chan); 100 101 if (ret) 101 102 return ret; 102 103 ··· 171 170 nv50_dma_push(chan, p->va, p->va_len, no_prefetch); 172 171 } 173 172 174 - ret = nouveau_fence_emit(fence, chan); 173 + ret = nouveau_fence_emit(fence); 175 174 if (ret) { 175 + nouveau_fence_unref(&exec_job->fence); 176 176 NV_PRINTK(err, job->cli, "error fencing pushbuf: %d\n", ret); 177 177 WIND_RING(chan); 178 178 return ERR_PTR(ret); 179 179 } 180 180 181 + /* The fence was emitted successfully, set the job's fence pointer to 182 + * NULL in order to avoid freeing it up when the job is cleaned up. 183 + */ 181 184 exec_job->fence = NULL; 182 185 183 186 return &fence->base; ··· 194 189 195 190 nouveau_job_free(job); 196 191 197 - nouveau_fence_unref(&exec_job->fence); 192 + kfree(exec_job->fence); 198 193 kfree(exec_job->push.s); 199 194 kfree(exec_job); 200 195 }
+26 -6
drivers/gpu/drm/nouveau/nouveau_fence.c
··· 205 205 } 206 206 207 207 int 208 - nouveau_fence_emit(struct nouveau_fence *fence, struct nouveau_channel *chan) 208 + nouveau_fence_emit(struct nouveau_fence *fence) 209 209 { 210 + struct nouveau_channel *chan = fence->channel; 210 211 struct nouveau_fence_chan *fctx = chan->fence; 211 212 struct nouveau_fence_priv *priv = (void*)chan->drm->fence; 212 213 int ret; 213 214 214 - if (unlikely(!chan->fence)) 215 - return -ENODEV; 216 - 217 - fence->channel = chan; 218 215 fence->timeout = jiffies + (15 * HZ); 219 216 220 217 if (priv->uevent) ··· 403 406 } 404 407 405 408 int 406 - nouveau_fence_new(struct nouveau_fence **pfence) 409 + nouveau_fence_create(struct nouveau_fence **pfence, 410 + struct nouveau_channel *chan) 407 411 { 408 412 struct nouveau_fence *fence; 413 + 414 + if (unlikely(!chan->fence)) 415 + return -ENODEV; 409 416 410 417 fence = kzalloc(sizeof(*fence), GFP_KERNEL); 411 418 if (!fence) 412 419 return -ENOMEM; 413 420 421 + fence->channel = chan; 422 + 414 423 *pfence = fence; 415 424 return 0; 425 + } 426 + 427 + int 428 + nouveau_fence_new(struct nouveau_fence **pfence, 429 + struct nouveau_channel *chan) 430 + { 431 + int ret = 0; 432 + 433 + ret = nouveau_fence_create(pfence, chan); 434 + if (ret) 435 + return ret; 436 + 437 + ret = nouveau_fence_emit(*pfence); 438 + if (ret) 439 + nouveau_fence_unref(pfence); 440 + 441 + return ret; 416 442 } 417 443 418 444 static const char *nouveau_fence_get_get_driver_name(struct dma_fence *fence)
+3 -2
drivers/gpu/drm/nouveau/nouveau_fence.h
··· 17 17 unsigned long timeout; 18 18 }; 19 19 20 - int nouveau_fence_new(struct nouveau_fence **); 20 + int nouveau_fence_create(struct nouveau_fence **, struct nouveau_channel *); 21 + int nouveau_fence_new(struct nouveau_fence **, struct nouveau_channel *); 21 22 void nouveau_fence_unref(struct nouveau_fence **); 22 23 23 - int nouveau_fence_emit(struct nouveau_fence *, struct nouveau_channel *); 24 + int nouveau_fence_emit(struct nouveau_fence *); 24 25 bool nouveau_fence_done(struct nouveau_fence *); 25 26 int nouveau_fence_wait(struct nouveau_fence *, bool lazy, bool intr); 26 27 int nouveau_fence_sync(struct nouveau_bo *, struct nouveau_channel *, bool exclusive, bool intr);
+1 -4
drivers/gpu/drm/nouveau/nouveau_gem.c
··· 914 914 } 915 915 } 916 916 917 - ret = nouveau_fence_new(&fence); 918 - if (!ret) 919 - ret = nouveau_fence_emit(fence, chan); 917 + ret = nouveau_fence_new(&fence, chan); 920 918 if (ret) { 921 - nouveau_fence_unref(&fence); 922 919 NV_PRINTK(err, cli, "error fencing pushbuf: %d\n", ret); 923 920 WIND_RING(chan); 924 921 goto out;