amd-drm-next-5.13-2021-03-23: amdgpu: - Debugfs cleanup - Various cleanups and spelling fixes - Flexible array cleanups - Initial AMD Freesync HDMI - Display fixes - 10bpc dithering improvements - Display ASSR support - Clean up and unify powerplay and swsmu interfaces - Vangogh fixes - Add SMU gfx busy queues for RV/PCO - PCIE DPM fixes - S0ix fixes - GPU metrics data fixes - DCN secure display support - Backlight type override - Add initial support for Aldebaran - RAS fixes - Prime fixes for A+A systems - Reset fixes - Initial resource cursor support - Drop legacy IO BAR requirements - Various power fixes amdkfd: - MMU notifier fixes - APU fixes radeon: - Debugfs cleanups - Flexible array cleanups UAPI: - amdgpu: Add a new INFO ioctl interface to query video capabilities rather than hardcoding them in userspace. This allows us to provide fine grained asic capabilities (e.g., if a particular part is bandwidth limited, we can limit the capabilities). Proposed userspace: https://gitlab.freedesktop.org/leoliu/drm/-/commits/info_video_caps https://gitlab.freedesktop.org/leoliu/mesa/-/commits/info_video_caps - amdkfd: bump the driver version. There was a problem with reporting some RAS features on older versions of the driver. Proposed userspace: https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/commit/7cdd63475c36bb9f49bb960f90f9a8cdb7e80a21 Danvet: A bunch of conflicts all over, but it seems to compile ... I did put the call to dc_allow_idle_optimizations() on a single line since it looked a bit too jarring to be left alone.
Unified · Split
| @@ -34,15 +34,6 @@ config DRM_AMDGPU_USERPTR · 33 unmodified lines | ||
| 34 | 34 | This option selects CONFIG_HMM and CONFIG_HMM_MIRROR if it |
| 35 | 35 | isn't already selected to enabled full userptr support. |
| 36 | 36 | |
| 37 | −config DRM_AMDGPU_GART_DEBUGFS | |
| 38 | − bool "Allow GART access through debugfs" | |
| 39 | − depends on DRM_AMDGPU | |
| 40 | − depends on DEBUG_FS | |
| 41 | − default n | |
| 42 | − help | |
| 43 | − Selecting this option creates a debugfs file to inspect the mapped | |
| 44 | − pages. Uses more memory for housekeeping, enable only for debugging. | |
| 45 | − | |
| 46 | 37 | source "drivers/gpu/drm/amd/acp/Kconfig" |
| 47 | 38 | source "drivers/gpu/drm/amd/display/Kconfig" |
| 48 | 39 | source "drivers/gpu/drm/amd/amdkfd/Kconfig" |
| @@ -71,7 +71,7 @@ amdgpu-y += \ · 70 unmodified lines | ||
| 71 | 71 | vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ |
| 72 | 72 | vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o navi10_reg_init.o navi14_reg_init.o \ |
| 73 | 73 | arct_reg_init.o navi12_reg_init.o mxgpu_nv.o sienna_cichlid_reg_init.o vangogh_reg_init.o \ |
| 74 | − nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o hdp_v5_0.o | |
| 74 | + nbio_v7_2.o dimgrey_cavefish_reg_init.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o | |
| 75 | 75 | |
| 76 | 76 | # add DF block |
| 77 | 77 | amdgpu-y += \ |
| @@ -83,7 +83,8 @@ amdgpu-y += \ · 5 unmodified lines | ||
| 83 | 83 | gmc_v7_0.o \ |
| 84 | 84 | gmc_v8_0.o \ |
| 85 | 85 | gfxhub_v1_0.o mmhub_v1_0.o gmc_v9_0.o gfxhub_v1_1.o mmhub_v9_4.o \ |
| 86 | − gfxhub_v2_0.o mmhub_v2_0.o gmc_v10_0.o gfxhub_v2_1.o mmhub_v2_3.o | |
| 86 | + gfxhub_v2_0.o mmhub_v2_0.o gmc_v10_0.o gfxhub_v2_1.o mmhub_v2_3.o \ | |
| 87 | + mmhub_v1_7.o | |
| 87 | 88 | |
| 88 | 89 | # add UMC block |
| 89 | 90 | amdgpu-y += \ |
| @@ -106,7 +107,8 @@ amdgpu-y += \ · 16 unmodified lines | ||
| 106 | 107 | psp_v3_1.o \ |
| 107 | 108 | psp_v10_0.o \ |
| 108 | 109 | psp_v11_0.o \ |
| 109 | − psp_v12_0.o | |
| 110 | + psp_v12_0.o \ | |
| 111 | + psp_v13_0.o | |
| 110 | 112 | |
| 111 | 113 | # add DCE block |
| 112 | 114 | amdgpu-y += \ |
| @@ -121,6 +123,7 @@ amdgpu-y += \ · 8 unmodified lines | ||
| 121 | 123 | gfx_v8_0.o \ |
| 122 | 124 | gfx_v9_0.o \ |
| 123 | 125 | gfx_v9_4.o \ |
| 126 | + gfx_v9_4_2.o \ | |
| 124 | 127 | gfx_v10_0.o |
| 125 | 128 | |
| 126 | 129 | # add async DMA block |
| @@ -129,6 +132,7 @@ amdgpu-y += \ · 2 unmodified lines | ||
| 129 | 132 | sdma_v2_4.o \ |
| 130 | 133 | sdma_v3_0.o \ |
| 131 | 134 | sdma_v4_0.o \ |
| 135 | + sdma_v4_4.o \ | |
| 132 | 136 | sdma_v5_0.o \ |
| 133 | 137 | sdma_v5_2.o |
| 134 | 138 | |
| @@ -172,7 +176,8 @@ amdgpu-y += \ · 37 unmodified lines | ||
| 172 | 176 | amdgpu-y += \ |
| 173 | 177 | smuio_v9_0.o \ |
| 174 | 178 | smuio_v11_0.o \ |
| 175 | − smuio_v11_0_6.o | |
| 179 | + smuio_v11_0_6.o \ | |
| 180 | + smuio_v13_0.o | |
| 176 | 181 | |
| 177 | 182 | # add amdkfd interfaces |
| 178 | 183 | amdgpu-y += amdgpu_amdkfd.o |
| @@ -187,6 +192,7 @@ amdgpu-y += \ · 8 unmodified lines | ||
| 187 | 192 | amdgpu_amdkfd_gfx_v8.o \ |
| 188 | 193 | amdgpu_amdkfd_gfx_v9.o \ |
| 189 | 194 | amdgpu_amdkfd_arcturus.o \ |
| 195 | + amdgpu_amdkfd_aldebaran.o \ | |
| 190 | 196 | amdgpu_amdkfd_gfx_v10.o \ |
| 191 | 197 | amdgpu_amdkfd_gfx_v10_3.o |
| 192 | 198 | |
| @@ -0,0 +1,54 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#include "amdgpu.h" | |
| 24 | +#include "soc15.h" | |
| 25 | + | |
| 26 | +#include "soc15_common.h" | |
| 27 | +#include "aldebaran_ip_offset.h" | |
| 28 | + | |
| 29 | +int aldebaran_reg_base_init(struct amdgpu_device *adev) | |
| 30 | +{ | |
| 31 | + /* HW has more IP blocks, only initialized the block needed by our driver */ | |
| 32 | + uint32_t i; | |
| 33 | + for (i = 0 ; i < MAX_INSTANCE ; ++i) { | |
| 34 | + adev->reg_offset[GC_HWIP][i] = (uint32_t *)(&(GC_BASE.instance[i])); | |
| 35 | + adev->reg_offset[HDP_HWIP][i] = (uint32_t *)(&(HDP_BASE.instance[i])); | |
| 36 | + adev->reg_offset[MMHUB_HWIP][i] = (uint32_t *)(&(MMHUB_BASE.instance[i])); | |
| 37 | + adev->reg_offset[ATHUB_HWIP][i] = (uint32_t *)(&(ATHUB_BASE.instance[i])); | |
| 38 | + adev->reg_offset[NBIO_HWIP][i] = (uint32_t *)(&(NBIO_BASE.instance[i])); | |
| 39 | + adev->reg_offset[MP0_HWIP][i] = (uint32_t *)(&(MP0_BASE.instance[i])); | |
| 40 | + adev->reg_offset[MP1_HWIP][i] = (uint32_t *)(&(MP1_BASE.instance[i])); | |
| 41 | + adev->reg_offset[DF_HWIP][i] = (uint32_t *)(&(DF_BASE.instance[i])); | |
| 42 | + adev->reg_offset[OSSSYS_HWIP][i] = (uint32_t *)(&(OSSSYS_BASE.instance[i])); | |
| 43 | + adev->reg_offset[SDMA0_HWIP][i] = (uint32_t *)(&(SDMA0_BASE.instance[i])); | |
| 44 | + adev->reg_offset[SDMA1_HWIP][i] = (uint32_t *)(&(SDMA1_BASE.instance[i])); | |
| 45 | + adev->reg_offset[SDMA2_HWIP][i] = (uint32_t *)(&(SDMA2_BASE.instance[i])); | |
| 46 | + adev->reg_offset[SDMA3_HWIP][i] = (uint32_t *)(&(SDMA3_BASE.instance[i])); | |
| 47 | + adev->reg_offset[SDMA4_HWIP][i] = (uint32_t *)(&(SDMA4_BASE.instance[i])); | |
| 48 | + adev->reg_offset[SMUIO_HWIP][i] = (uint32_t *)(&(SMUIO_BASE.instance[i])); | |
| 49 | + adev->reg_offset[THM_HWIP][i] = (uint32_t *)(&(THM_BASE.instance[i])); | |
| 50 | + adev->reg_offset[UMC_HWIP][i] = (uint32_t *)(&(UMC_BASE.instance[i])); | |
| 51 | + adev->reg_offset[VCN_HWIP][i] = (uint32_t *)(&(VCN_BASE.instance[i])); | |
| 52 | + } | |
| 53 | + return 0; | |
| 54 | +} | |
| @@ -124,6 +124,16 @@ struct amdgpu_mgpu_info · 123 unmodified lines | ||
| 124 | 124 | uint32_t num_gpu; |
| 125 | 125 | uint32_t num_dgpu; |
| 126 | 126 | uint32_t num_apu; |
| 127 | + | |
| 128 | + /* delayed reset_func for XGMI configuration if necessary */ | |
| 129 | + struct delayed_work delayed_reset_work; | |
| 130 | + bool pending_reset; | |
| 131 | +}; | |
| 132 | + | |
| 133 | +struct amdgpu_watchdog_timer | |
| 134 | +{ | |
| 135 | + bool timeout_fatal_disable; | |
| 136 | + uint32_t period; /* maxCycles = (1 << period), the number of cycles before a timeout */ | |
| 127 | 137 | }; |
| 128 | 138 | |
| 129 | 139 | #define AMDGPU_MAX_TIMEOUT_PARAM_LENGTH 256 |
| @@ -177,7 +187,9 @@ extern int amdgpu_compute_multipipe; · 47 unmodified lines | ||
| 177 | 187 | extern int amdgpu_gpu_recovery; |
| 178 | 188 | extern int amdgpu_emu_mode; |
| 179 | 189 | extern uint amdgpu_smu_memory_pool_size; |
| 190 | +extern int amdgpu_smu_pptable_id; | |
| 180 | 191 | extern uint amdgpu_dc_feature_mask; |
| 192 | +extern uint amdgpu_freesync_vid_mode; | |
| 181 | 193 | extern uint amdgpu_dc_debug_mask; |
| 182 | 194 | extern uint amdgpu_dm_abm_level; |
| 183 | 195 | extern int amdgpu_backlight; |
| @@ -185,6 +197,7 @@ extern struct amdgpu_mgpu_info mgpu_info; · 1 unmodified line | ||
| 185 | 197 | extern int amdgpu_ras_enable; |
| 186 | 198 | extern uint amdgpu_ras_mask; |
| 187 | 199 | extern int amdgpu_bad_page_threshold; |
| 200 | +extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer; | |
| 188 | 201 | extern int amdgpu_async_gfx_ring; |
| 189 | 202 | extern int amdgpu_mcbp; |
| 190 | 203 | extern int amdgpu_discovery; |
| @@ -584,6 +597,19 @@ enum amd_reset_method { · 393 unmodified lines | ||
| 584 | 597 | AMD_RESET_METHOD_PCI, |
| 585 | 598 | }; |
| 586 | 599 | |
| 600 | +struct amdgpu_video_codec_info { | |
| 601 | + u32 codec_type; | |
| 602 | + u32 max_width; | |
| 603 | + u32 max_height; | |
| 604 | + u32 max_pixels_per_frame; | |
| 605 | + u32 max_level; | |
| 606 | +}; | |
| 607 | + | |
| 608 | +struct amdgpu_video_codecs { | |
| 609 | + const u32 codec_count; | |
| 610 | + const struct amdgpu_video_codec_info *codec_array; | |
| 611 | +}; | |
| 612 | + | |
| 587 | 613 | /* |
| 588 | 614 | * ASIC specific functions. |
| 589 | 615 | */ |
| @@ -628,6 +654,9 @@ struct amdgpu_asic_funcs { · 38 unmodified lines | ||
| 628 | 654 | void (*pre_asic_init)(struct amdgpu_device *adev); |
| 629 | 655 | /* enter/exit umd stable pstate */ |
| 630 | 656 | int (*update_umd_stable_pstate)(struct amdgpu_device *adev, bool enter); |
| 657 | + /* query video codecs */ | |
| 658 | + int (*query_video_codecs)(struct amdgpu_device *adev, bool encode, | |
| 659 | + const struct amdgpu_video_codecs **codecs); | |
| 631 | 660 | }; |
| 632 | 661 | |
| 633 | 662 | /* |
| @@ -792,12 +821,7 @@ struct amdgpu_device { · 158 unmodified lines | ||
| 792 | 821 | bool accel_working; |
| 793 | 822 | struct notifier_block acpi_nb; |
| 794 | 823 | struct amdgpu_i2c_chan *i2c_bus[AMDGPU_MAX_I2C_BUS]; |
| 795 | − struct amdgpu_debugfs debugfs[AMDGPU_DEBUGFS_MAX_COMPONENTS]; | |
| 796 | − unsigned debugfs_count; | |
| 797 | −#if defined(CONFIG_DEBUG_FS) | |
| 798 | − struct dentry *debugfs_preempt; | |
| 799 | − struct dentry *debugfs_regs[AMDGPU_DEBUGFS_MAX_COMPONENTS]; | |
| 800 | −#endif | |
| 824 | + struct debugfs_blob_wrapper debugfs_vbios_blob; | |
| 801 | 825 | struct amdgpu_atif *atif; |
| 802 | 826 | struct amdgpu_atcs atcs; |
| 803 | 827 | struct mutex srbm_mutex; |
| @@ -853,8 +877,6 @@ struct amdgpu_device { · 49 unmodified lines | ||
| 853 | 877 | spinlock_t audio_endpt_idx_lock; |
| 854 | 878 | amdgpu_block_rreg_t audio_endpt_rreg; |
| 855 | 879 | amdgpu_block_wreg_t audio_endpt_wreg; |
| 856 | − void __iomem *rio_mem; | |
| 857 | − resource_size_t rio_mem_size; | |
| 858 | 880 | struct amdgpu_doorbell doorbell; |
| 859 | 881 | |
| 860 | 882 | /* clock/pll info */ |
| @@ -897,6 +919,7 @@ struct amdgpu_device { · 36 unmodified lines | ||
| 897 | 919 | struct amdgpu_irq_src vupdate_irq; |
| 898 | 920 | struct amdgpu_irq_src pageflip_irq; |
| 899 | 921 | struct amdgpu_irq_src hpd_irq; |
| 922 | + struct amdgpu_irq_src dmub_trace_irq; | |
| 900 | 923 | |
| 901 | 924 | /* rings */ |
| 902 | 925 | u64 fence_context; |
| @@ -1024,6 +1047,7 @@ struct amdgpu_device { · 121 unmodified lines | ||
| 1024 | 1047 | |
| 1025 | 1048 | int asic_reset_res; |
| 1026 | 1049 | struct work_struct xgmi_reset_work; |
| 1050 | + struct list_head reset_list; | |
| 1027 | 1051 | |
| 1028 | 1052 | long gfx_timeout; |
| 1029 | 1053 | long sdma_timeout; |
| @@ -1088,9 +1112,6 @@ void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev, · 58 unmodified lines | ||
| 1088 | 1112 | void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value); |
| 1089 | 1113 | uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset); |
| 1090 | 1114 | |
| 1091 | −u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg); | |
| 1092 | −void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v); | |
| 1093 | − | |
| 1094 | 1115 | u32 amdgpu_device_indirect_rreg(struct amdgpu_device *adev, |
| 1095 | 1116 | u32 pcie_index, u32 pcie_data, |
| 1096 | 1117 | u32 reg_addr); |
| @@ -1107,6 +1128,15 @@ void amdgpu_device_indirect_wreg64(struct amdgpu_device *adev, · 10 unmodified lines | ||
| 1107 | 1128 | bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type); |
| 1108 | 1129 | bool amdgpu_device_has_dc_support(struct amdgpu_device *adev); |
| 1109 | 1130 | |
| 1131 | +int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, | |
| 1132 | + struct amdgpu_job *job, | |
| 1133 | + bool *need_full_reset_arg); | |
| 1134 | + | |
| 1135 | +int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, | |
| 1136 | + struct list_head *device_list_handle, | |
| 1137 | + bool *need_full_reset_arg, | |
| 1138 | + bool skip_hw_reset); | |
| 1139 | + | |
| 1110 | 1140 | int emu_soc_asic_init(struct amdgpu_device *adev); |
| 1111 | 1141 | |
| 1112 | 1142 | /* |
| @@ -1172,8 +1202,6 @@ int emu_soc_asic_init(struct amdgpu_device *adev); · 59 unmodified lines | ||
| 1172 | 1202 | } while (0) |
| 1173 | 1203 | |
| 1174 | 1204 | #define DREG32_SYS(sqf, adev, reg) seq_printf((sqf), #reg " : 0x%08X\n", amdgpu_device_rreg((adev), (reg), false)) |
| 1175 | −#define RREG32_IO(reg) amdgpu_io_rreg(adev, (reg)) | |
| 1176 | −#define WREG32_IO(reg, v) amdgpu_io_wreg(adev, (reg), (v)) | |
| 1177 | 1205 | |
| 1178 | 1206 | #define REG_FIELD_SHIFT(reg, field) reg##__##field##__SHIFT |
| 1179 | 1207 | #define REG_FIELD_MASK(reg, field) reg##__##field##_MASK |
| @@ -1227,6 +1255,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev); · 47 unmodified lines | ||
| 1227 | 1255 | #define amdgpu_asic_pre_asic_init(adev) (adev)->asic_funcs->pre_asic_init((adev)) |
| 1228 | 1256 | #define amdgpu_asic_update_umd_stable_pstate(adev, enter) \ |
| 1229 | 1257 | ((adev)->asic_funcs->update_umd_stable_pstate ? (adev)->asic_funcs->update_umd_stable_pstate((adev), (enter)) : 0) |
| 1258 | +#define amdgpu_asic_query_video_codecs(adev, e, c) (adev)->asic_funcs->query_video_codecs((adev), (e), (c)) | |
| 1230 | 1259 | |
| 1231 | 1260 | #define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter)); |
| 1232 | 1261 | |
| @@ -1247,6 +1276,7 @@ void amdgpu_device_program_register_sequence(struct amdgpu_device *adev, · 14 unmodified lines | ||
| 1247 | 1276 | const u32 array_size); |
| 1248 | 1277 | |
| 1249 | 1278 | bool amdgpu_device_supports_atpx(struct drm_device *dev); |
| 1279 | +int amdgpu_device_mode1_reset(struct amdgpu_device *adev); | |
| 1250 | 1280 | bool amdgpu_device_supports_boco(struct drm_device *dev); |
| 1251 | 1281 | bool amdgpu_device_supports_baco(struct drm_device *dev); |
| 1252 | 1282 | bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev, |
| @@ -44,7 +44,7 @@ int amdgpu_amdkfd_init(void) · 43 unmodified lines | ||
| 44 | 44 | int ret; |
| 45 | 45 | |
| 46 | 46 | si_meminfo(&si); |
| 47 | − amdgpu_amdkfd_total_mem_size = si.totalram - si.totalhigh; | |
| 47 | + amdgpu_amdkfd_total_mem_size = si.freeram - si.freehigh; | |
| 48 | 48 | amdgpu_amdkfd_total_mem_size *= si.mem_unit; |
| 49 | 49 | |
| 50 | 50 | ret = kgd2kfd_init(); |
| @@ -165,7 +165,8 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) · 114 unmodified lines | ||
| 165 | 165 | adev->doorbell_index.last_non_cp; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | − kgd2kfd_device_init(adev->kfd.dev, adev_to_drm(adev), &gpu_resources); | |
| 168 | + adev->kfd.init_complete = kgd2kfd_device_init(adev->kfd.dev, | |
| 169 | + adev_to_drm(adev), &gpu_resources); | |
| 169 | 170 | } |
| 170 | 171 | } |
| 171 | 172 | |
| @@ -638,13 +639,6 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle) · 466 unmodified lines | ||
| 638 | 639 | { |
| 639 | 640 | struct amdgpu_device *adev = (struct amdgpu_device *)kgd; |
| 640 | 641 | |
| 641 | − /* Temp workaround to fix the soft hang observed in certain compute | |
| 642 | − * applications if GFXOFF is enabled. | |
| 643 | − */ | |
| 644 | − if (adev->asic_type == CHIP_SIENNA_CICHLID) { | |
| 645 | − pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled"); | |
| 646 | − amdgpu_gfx_off_ctrl(adev, idle); | |
| 647 | − } | |
| 648 | 642 | amdgpu_dpm_switch_power_profile(adev, |
| 649 | 643 | PP_SMC_POWER_PROFILE_COMPUTE, |
| 650 | 644 | !idle); |
| @@ -80,6 +80,7 @@ struct amdgpu_amdkfd_fence { · 79 unmodified lines | ||
| 80 | 80 | struct amdgpu_kfd_dev { |
| 81 | 81 | struct kfd_dev *dev; |
| 82 | 82 | uint64_t vram_used; |
| 83 | + bool init_complete; | |
| 83 | 84 | }; |
| 84 | 85 | |
| 85 | 86 | enum kgd_engine_type { |
| @@ -0,0 +1,47 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + */ | |
| 22 | +#include "amdgpu.h" | |
| 23 | +#include "amdgpu_amdkfd.h" | |
| 24 | +#include "amdgpu_amdkfd_arcturus.h" | |
| 25 | +#include "amdgpu_amdkfd_gfx_v9.h" | |
| 26 | + | |
| 27 | +const struct kfd2kgd_calls aldebaran_kfd2kgd = { | |
| 28 | + .program_sh_mem_settings = kgd_gfx_v9_program_sh_mem_settings, | |
| 29 | + .set_pasid_vmid_mapping = kgd_gfx_v9_set_pasid_vmid_mapping, | |
| 30 | + .init_interrupts = kgd_gfx_v9_init_interrupts, | |
| 31 | + .hqd_load = kgd_gfx_v9_hqd_load, | |
| 32 | + .hiq_mqd_load = kgd_gfx_v9_hiq_mqd_load, | |
| 33 | + .hqd_sdma_load = kgd_arcturus_hqd_sdma_load, | |
| 34 | + .hqd_dump = kgd_gfx_v9_hqd_dump, | |
| 35 | + .hqd_sdma_dump = kgd_arcturus_hqd_sdma_dump, | |
| 36 | + .hqd_is_occupied = kgd_gfx_v9_hqd_is_occupied, | |
| 37 | + .hqd_sdma_is_occupied = kgd_arcturus_hqd_sdma_is_occupied, | |
| 38 | + .hqd_destroy = kgd_gfx_v9_hqd_destroy, | |
| 39 | + .hqd_sdma_destroy = kgd_arcturus_hqd_sdma_destroy, | |
| 40 | + .address_watch_disable = kgd_gfx_v9_address_watch_disable, | |
| 41 | + .address_watch_execute = kgd_gfx_v9_address_watch_execute, | |
| 42 | + .wave_control_execute = kgd_gfx_v9_wave_control_execute, | |
| 43 | + .address_watch_get_offset = kgd_gfx_v9_address_watch_get_offset, | |
| 44 | + .get_atc_vmid_pasid_mapping_info = | |
| 45 | + kgd_gfx_v9_get_atc_vmid_pasid_mapping_info, | |
| 46 | + .set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base, | |
| 47 | +}; | |
| @@ -122,7 +122,7 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev, · 121 unmodified lines | ||
| 122 | 122 | return sdma_rlc_reg_offset; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | −static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, | |
| 125 | +int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, | |
| 126 | 126 | uint32_t __user *wptr, struct mm_struct *mm) |
| 127 | 127 | { |
| 128 | 128 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
| @@ -192,7 +192,7 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, · 63 unmodified lines | ||
| 192 | 192 | return 0; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | −static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, | |
| 195 | +int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd, | |
| 196 | 196 | uint32_t engine_id, uint32_t queue_id, |
| 197 | 197 | uint32_t (**dump)[2], uint32_t *n_regs) |
| 198 | 198 | { |
| @@ -224,7 +224,7 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, · 25 unmodified lines | ||
| 224 | 224 | return 0; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | −static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) | |
| 227 | +bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) | |
| 228 | 228 | { |
| 229 | 229 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
| 230 | 230 | struct v9_sdma_mqd *m; |
| @@ -243,7 +243,7 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) · 12 unmodified lines | ||
| 243 | 243 | return false; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | −static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | |
| 246 | +int kgd_arcturus_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | |
| 247 | 247 | unsigned int utimeout) |
| 248 | 248 | { |
| 249 | 249 | struct amdgpu_device *adev = get_amdgpu_device(kgd); |
| @@ -289,13 +289,13 @@ const struct kfd2kgd_calls arcturus_kfd2kgd = { · 39 unmodified lines | ||
| 289 | 289 | .init_interrupts = kgd_gfx_v9_init_interrupts, |
| 290 | 290 | .hqd_load = kgd_gfx_v9_hqd_load, |
| 291 | 291 | .hiq_mqd_load = kgd_gfx_v9_hiq_mqd_load, |
| 292 | − .hqd_sdma_load = kgd_hqd_sdma_load, | |
| 292 | + .hqd_sdma_load = kgd_arcturus_hqd_sdma_load, | |
| 293 | 293 | .hqd_dump = kgd_gfx_v9_hqd_dump, |
| 294 | − .hqd_sdma_dump = kgd_hqd_sdma_dump, | |
| 294 | + .hqd_sdma_dump = kgd_arcturus_hqd_sdma_dump, | |
| 295 | 295 | .hqd_is_occupied = kgd_gfx_v9_hqd_is_occupied, |
| 296 | − .hqd_sdma_is_occupied = kgd_hqd_sdma_is_occupied, | |
| 296 | + .hqd_sdma_is_occupied = kgd_arcturus_hqd_sdma_is_occupied, | |
| 297 | 297 | .hqd_destroy = kgd_gfx_v9_hqd_destroy, |
| 298 | − .hqd_sdma_destroy = kgd_hqd_sdma_destroy, | |
| 298 | + .hqd_sdma_destroy = kgd_arcturus_hqd_sdma_destroy, | |
| 299 | 299 | .address_watch_disable = kgd_gfx_v9_address_watch_disable, |
| 300 | 300 | .address_watch_execute = kgd_gfx_v9_address_watch_execute, |
| 301 | 301 | .wave_control_execute = kgd_gfx_v9_wave_control_execute, |
| @@ -0,0 +1,30 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + */ | |
| 22 | + | |
| 23 | +int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, | |
| 24 | + uint32_t __user *wptr, struct mm_struct *mm); | |
| 25 | +int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd, | |
| 26 | + uint32_t engine_id, uint32_t queue_id, | |
| 27 | + uint32_t (**dump)[2], uint32_t *n_regs); | |
| 28 | +bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd); | |
| 29 | +int kgd_arcturus_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, | |
| 30 | + unsigned int utimeout); | |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | #include "amdgpu_amdkfd.h" |
| 32 | 32 | #include "amdgpu_dma_buf.h" |
| 33 | 33 | #include <uapi/linux/kfd_ioctl.h> |
| 34 | +#include "amdgpu_xgmi.h" | |
| 34 | 35 | |
| 35 | 36 | /* BO flag to indicate a KFD userptr BO */ |
| 36 | 37 | #define AMDGPU_AMDKFD_USERPTR_BO (1ULL << 63) |
| @@ -96,7 +97,7 @@ void amdgpu_amdkfd_gpuvm_init_mem_limits(void) · 59 unmodified lines | ||
| 96 | 97 | uint64_t mem; |
| 97 | 98 | |
| 98 | 99 | si_meminfo(&si); |
| 99 | − mem = si.totalram - si.totalhigh; | |
| 100 | + mem = si.freeram - si.freehigh; | |
| 100 | 101 | mem *= si.mem_unit; |
| 101 | 102 | |
| 102 | 103 | spin_lock_init(&kfd_mem_limit.mem_limit_lock); |
| @@ -412,7 +413,10 @@ static uint64_t get_pte_flags(struct amdgpu_device *adev, struct kgd_mem *mem) · 309 unmodified lines | ||
| 412 | 413 | { |
| 413 | 414 | struct amdgpu_device *bo_adev = amdgpu_ttm_adev(mem->bo->tbo.bdev); |
| 414 | 415 | bool coherent = mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_COHERENT; |
| 416 | + bool uncached = mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED; | |
| 415 | 417 | uint32_t mapping_flags; |
| 418 | + uint64_t pte_flags; | |
| 419 | + bool snoop = false; | |
| 416 | 420 | |
| 417 | 421 | mapping_flags = AMDGPU_VM_PAGE_READABLE; |
| 418 | 422 | if (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE) |
| @@ -433,12 +437,41 @@ static uint64_t get_pte_flags(struct amdgpu_device *adev, struct kgd_mem *mem) · 14 unmodified lines | ||
| 433 | 437 | AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC; |
| 434 | 438 | } |
| 435 | 439 | break; |
| 440 | + case CHIP_ALDEBARAN: | |
| 441 | + if (coherent && uncached) { | |
| 442 | + if (adev->gmc.xgmi.connected_to_cpu || | |
| 443 | + !(mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)) | |
| 444 | + snoop = true; | |
| 445 | + mapping_flags |= AMDGPU_VM_MTYPE_UC; | |
| 446 | + } else if (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) { | |
| 447 | + if (bo_adev == adev) { | |
| 448 | + mapping_flags |= AMDGPU_VM_MTYPE_RW; | |
| 449 | + if (adev->gmc.xgmi.connected_to_cpu) | |
| 450 | + snoop = true; | |
| 451 | + } else { | |
| 452 | + mapping_flags |= AMDGPU_VM_MTYPE_NC; | |
| 453 | + if (amdgpu_xgmi_same_hive(adev, bo_adev)) | |
| 454 | + snoop = true; | |
| 455 | + } | |
| 456 | + } else { | |
| 457 | + snoop = true; | |
| 458 | + if (adev->gmc.xgmi.connected_to_cpu) | |
| 459 | + /* system memory uses NC on A+A */ | |
| 460 | + mapping_flags |= AMDGPU_VM_MTYPE_NC; | |
| 461 | + else | |
| 462 | + mapping_flags |= coherent ? | |
| 463 | + AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC; | |
| 464 | + } | |
| 465 | + break; | |
| 436 | 466 | default: |
| 437 | 467 | mapping_flags |= coherent ? |
| 438 | 468 | AMDGPU_VM_MTYPE_UC : AMDGPU_VM_MTYPE_NC; |
| 439 | 469 | } |
| 440 | 470 | |
| 441 | − return amdgpu_gem_va_map_flags(adev, mapping_flags); | |
| 471 | + pte_flags = amdgpu_gem_va_map_flags(adev, mapping_flags); | |
| 472 | + pte_flags |= snoop ? AMDGPU_PTE_SNOOPED : 0; | |
| 473 | + | |
| 474 | + return pte_flags; | |
| 442 | 475 | } |
| 443 | 476 | |
| 444 | 477 | /* add_bo_to_vm - Add a BO to a VM |
| @@ -1905,40 +1905,6 @@ static uint32_t cail_reg_read(struct card_info *info, uint32_t reg) · 1904 unmodified lines | ||
| 1905 | 1905 | return r; |
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | −/** | |
| 1909 | − * cail_ioreg_write - write IO register | |
| 1910 | − * | |
| 1911 | − * @info: atom card_info pointer | |
| 1912 | − * @reg: IO register offset | |
| 1913 | − * @val: value to write to the pll register | |
| 1914 | − * | |
| 1915 | − * Provides a IO register accessor for the atom interpreter (r4xx+). | |
| 1916 | − */ | |
| 1917 | −static void cail_ioreg_write(struct card_info *info, uint32_t reg, uint32_t val) | |
| 1918 | −{ | |
| 1919 | − struct amdgpu_device *adev = drm_to_adev(info->dev); | |
| 1920 | − | |
| 1921 | − WREG32_IO(reg, val); | |
| 1922 | −} | |
| 1923 | − | |
| 1924 | −/** | |
| 1925 | − * cail_ioreg_read - read IO register | |
| 1926 | − * | |
| 1927 | − * @info: atom card_info pointer | |
| 1928 | − * @reg: IO register offset | |
| 1929 | − * | |
| 1930 | − * Provides an IO register accessor for the atom interpreter (r4xx+). | |
| 1931 | − * Returns the value of the IO register. | |
| 1932 | − */ | |
| 1933 | −static uint32_t cail_ioreg_read(struct card_info *info, uint32_t reg) | |
| 1934 | −{ | |
| 1935 | − struct amdgpu_device *adev = drm_to_adev(info->dev); | |
| 1936 | − uint32_t r; | |
| 1937 | − | |
| 1938 | − r = RREG32_IO(reg); | |
| 1939 | − return r; | |
| 1940 | −} | |
| 1941 | − | |
| 1942 | 1908 | static ssize_t amdgpu_atombios_get_vbios_version(struct device *dev, |
| 1943 | 1909 | struct device_attribute *attr, |
| 1944 | 1910 | char *buf) |
| @@ -1998,15 +1964,6 @@ int amdgpu_atombios_init(struct amdgpu_device *adev) · 53 unmodified lines | ||
| 1998 | 1964 | atom_card_info->dev = adev_to_drm(adev); |
| 1999 | 1965 | atom_card_info->reg_read = cail_reg_read; |
| 2000 | 1966 | atom_card_info->reg_write = cail_reg_write; |
| 2001 | − /* needed for iio ops */ | |
| 2002 | − if (adev->rio_mem) { | |
| 2003 | − atom_card_info->ioreg_read = cail_ioreg_read; | |
| 2004 | − atom_card_info->ioreg_write = cail_ioreg_write; | |
| 2005 | − } else { | |
| 2006 | − DRM_DEBUG("PCI I/O BAR is not found. Using MMIO to access ATOM BIOS\n"); | |
| 2007 | − atom_card_info->ioreg_read = cail_reg_read; | |
| 2008 | − atom_card_info->ioreg_write = cail_reg_write; | |
| 2009 | − } | |
| 2010 | 1967 | atom_card_info->mc_read = cail_mc_read; |
| 2011 | 1968 | atom_card_info->mc_write = cail_mc_write; |
| 2012 | 1969 | atom_card_info->pll_read = cail_pll_read; |
| @@ -117,12 +117,15 @@ union igp_info { · 116 unmodified lines | ||
| 117 | 117 | |
| 118 | 118 | union umc_info { |
| 119 | 119 | struct atom_umc_info_v3_1 v31; |
| 120 | + struct atom_umc_info_v3_2 v32; | |
| 121 | + struct atom_umc_info_v3_3 v33; | |
| 120 | 122 | }; |
| 121 | 123 | |
| 122 | 124 | union vram_info { |
| 123 | 125 | struct atom_vram_info_header_v2_3 v23; |
| 124 | 126 | struct atom_vram_info_header_v2_4 v24; |
| 125 | 127 | struct atom_vram_info_header_v2_5 v25; |
| 128 | + struct atom_vram_info_header_v2_6 v26; | |
| 126 | 129 | }; |
| 127 | 130 | |
| 128 | 131 | union vram_module { |
| @@ -164,6 +167,7 @@ static int convert_atom_mem_type_to_vram_type(struct amdgpu_device *adev, · 35 unmodified lines | ||
| 164 | 167 | vram_type = AMDGPU_VRAM_TYPE_GDDR5; |
| 165 | 168 | break; |
| 166 | 169 | case ATOM_DGPU_VRAM_TYPE_HBM2: |
| 170 | + case ATOM_DGPU_VRAM_TYPE_HBM2E: | |
| 167 | 171 | vram_type = AMDGPU_VRAM_TYPE_HBM; |
| 168 | 172 | break; |
| 169 | 173 | case ATOM_DGPU_VRAM_TYPE_GDDR6: |
| @@ -315,6 +319,26 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev, · 145 unmodified lines | ||
| 315 | 319 | if (vram_vendor) |
| 316 | 320 | *vram_vendor = mem_vendor; |
| 317 | 321 | break; |
| 322 | + case 6: | |
| 323 | + if (module_id > vram_info->v26.vram_module_num) | |
| 324 | + module_id = 0; | |
| 325 | + vram_module = (union vram_module *)vram_info->v26.vram_module; | |
| 326 | + while (i < module_id) { | |
| 327 | + vram_module = (union vram_module *) | |
| 328 | + ((u8 *)vram_module + vram_module->v9.vram_module_size); | |
| 329 | + i++; | |
| 330 | + } | |
| 331 | + mem_type = vram_module->v9.memory_type; | |
| 332 | + if (vram_type) | |
| 333 | + *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type); | |
| 334 | + mem_channel_number = vram_module->v9.channel_num; | |
| 335 | + mem_channel_width = vram_module->v9.channel_width; | |
| 336 | + if (vram_width) | |
| 337 | + *vram_width = mem_channel_number * (1 << mem_channel_width); | |
| 338 | + mem_vendor = (vram_module->v9.vender_rev_id) & 0xF; | |
| 339 | + if (vram_vendor) | |
| 340 | + *vram_vendor = mem_vendor; | |
| 341 | + break; | |
| 318 | 342 | default: |
| 319 | 343 | return -EINVAL; |
| 320 | 344 | } |
| @@ -337,19 +361,39 @@ bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev) · 16 unmodified lines | ||
| 337 | 361 | union umc_info *umc_info; |
| 338 | 362 | u8 frev, crev; |
| 339 | 363 | bool ecc_default_enabled = false; |
| 364 | + u8 umc_config; | |
| 365 | + u32 umc_config1; | |
| 340 | 366 | |
| 341 | 367 | index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, |
| 342 | 368 | umc_info); |
| 343 | 369 | |
| 344 | 370 | if (amdgpu_atom_parse_data_header(mode_info->atom_context, |
| 345 | 371 | index, &size, &frev, &crev, &data_offset)) { |
| 346 | − /* support umc_info 3.1+ */ | |
| 347 | − if ((frev == 3 && crev >= 1) || (frev > 3)) { | |
| 372 | + if (frev == 3) { | |
| 348 | 373 | umc_info = (union umc_info *) |
| 349 | 374 | (mode_info->atom_context->bios + data_offset); |
| 350 | − ecc_default_enabled = | |
| 351 | − (le32_to_cpu(umc_info->v31.umc_config) & | |
| 352 | − UMC_CONFIG__DEFAULT_MEM_ECC_ENABLE) ? true : false; | |
| 375 | + switch (crev) { | |
| 376 | + case 1: | |
| 377 | + umc_config = le32_to_cpu(umc_info->v31.umc_config); | |
| 378 | + ecc_default_enabled = | |
| 379 | + (umc_config & UMC_CONFIG__DEFAULT_MEM_ECC_ENABLE) ? true : false; | |
| 380 | + break; | |
| 381 | + case 2: | |
| 382 | + umc_config = le32_to_cpu(umc_info->v32.umc_config); | |
| 383 | + ecc_default_enabled = | |
| 384 | + (umc_config & UMC_CONFIG__DEFAULT_MEM_ECC_ENABLE) ? true : false; | |
| 385 | + break; | |
| 386 | + case 3: | |
| 387 | + umc_config = le32_to_cpu(umc_info->v33.umc_config); | |
| 388 | + umc_config1 = le32_to_cpu(umc_info->v33.umc_config1); | |
| 389 | + ecc_default_enabled = | |
| 390 | + ((umc_config & UMC_CONFIG__DEFAULT_MEM_ECC_ENABLE) || | |
| 391 | + (umc_config1 & UMC_CONFIG1__ENABLE_ECC_CAPABLE)) ? true : false; | |
| 392 | + break; | |
| 393 | + default: | |
| 394 | + /* unsupported crev */ | |
| 395 | + return false; | |
| 396 | + } | |
| 353 | 397 | } |
| 354 | 398 | } |
| 355 | 399 | |
| @@ -479,7 +523,8 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev) · 123 unmodified lines | ||
| 479 | 523 | } |
| 480 | 524 | |
| 481 | 525 | union gfx_info { |
| 482 | − struct atom_gfx_info_v2_4 v24; | |
| 526 | + struct atom_gfx_info_v2_4 v24; | |
| 527 | + struct atom_gfx_info_v2_7 v27; | |
| 483 | 528 | }; |
| 484 | 529 | |
| 485 | 530 | int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev) |
| @@ -514,6 +559,22 @@ int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev) · 28 unmodified lines | ||
| 514 | 559 | adev->gfx.cu_info.max_scratch_slots_per_cu = gfx_info->v24.gc_max_scratch_slots_per_cu; |
| 515 | 560 | adev->gfx.cu_info.lds_size = le16_to_cpu(gfx_info->v24.gc_lds_size); |
| 516 | 561 | return 0; |
| 562 | + case 7: | |
| 563 | + adev->gfx.config.max_shader_engines = gfx_info->v27.max_shader_engines; | |
| 564 | + adev->gfx.config.max_cu_per_sh = gfx_info->v27.max_cu_per_sh; | |
| 565 | + adev->gfx.config.max_sh_per_se = gfx_info->v27.max_sh_per_se; | |
| 566 | + adev->gfx.config.max_backends_per_se = gfx_info->v27.max_backends_per_se; | |
| 567 | + adev->gfx.config.max_texture_channel_caches = gfx_info->v27.max_texture_channel_caches; | |
| 568 | + adev->gfx.config.max_gprs = le16_to_cpu(gfx_info->v27.gc_num_gprs); | |
| 569 | + adev->gfx.config.max_gs_threads = gfx_info->v27.gc_num_max_gs_thds; | |
| 570 | + adev->gfx.config.gs_vgt_table_depth = gfx_info->v27.gc_gs_table_depth; | |
| 571 | + adev->gfx.config.gs_prim_buffer_depth = le16_to_cpu(gfx_info->v27.gc_gsprim_buff_depth); | |
| 572 | + adev->gfx.config.double_offchip_lds_buf = gfx_info->v27.gc_double_offchip_lds_buffer; | |
| 573 | + adev->gfx.cu_info.wave_front_size = le16_to_cpu(gfx_info->v27.gc_wave_size); | |
| 574 | + adev->gfx.cu_info.max_waves_per_simd = le16_to_cpu(gfx_info->v27.gc_max_waves_per_simd); | |
| 575 | + adev->gfx.cu_info.max_scratch_slots_per_cu = gfx_info->v27.gc_max_scratch_slots_per_cu; | |
| 576 | + adev->gfx.cu_info.lds_size = le16_to_cpu(gfx_info->v27.gc_lds_size); | |
| 577 | + return 0; | |
| 517 | 578 | default: |
| 518 | 579 | return -EINVAL; |
| 519 | 580 | } |
| @@ -97,6 +97,10 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev) · 96 unmodified lines | ||
| 97 | 97 | if (amdgpu_device_need_post(adev)) |
| 98 | 98 | return false; |
| 99 | 99 | |
| 100 | + /* FB BAR not enabled */ | |
| 101 | + if (pci_resource_len(adev->pdev, 0) == 0) | |
| 102 | + return false; | |
| 103 | + | |
| 100 | 104 | adev->bios = NULL; |
| 101 | 105 | vram_base = pci_resource_start(adev->pdev, 0); |
| 102 | 106 | bios = ioremap_wc(vram_base, size); |
| @@ -316,7 +320,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev) · 213 unmodified lines | ||
| 316 | 320 | |
| 317 | 321 | adev->bios = kmalloc(size, GFP_KERNEL); |
| 318 | 322 | if (!adev->bios) { |
| 319 | − DRM_ERROR("Unable to allocate bios\n"); | |
| 323 | + dev_err(adev->dev, "Unable to allocate bios\n"); | |
| 320 | 324 | return false; |
| 321 | 325 | } |
| 322 | 326 | |
| @@ -364,7 +368,7 @@ static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) · 41 unmodified lines | ||
| 364 | 368 | return false; |
| 365 | 369 | tbl_size = hdr->length; |
| 366 | 370 | if (tbl_size < sizeof(UEFI_ACPI_VFCT)) { |
| 367 | − DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n"); | |
| 371 | + dev_info(adev->dev, "ACPI VFCT table present but broken (too short #1),skipping\n"); | |
| 368 | 372 | return false; |
| 369 | 373 | } |
| 370 | 374 | |
| @@ -377,13 +381,13 @@ static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) · 6 unmodified lines | ||
| 377 | 381 | |
| 378 | 382 | offset += sizeof(VFCT_IMAGE_HEADER); |
| 379 | 383 | if (offset > tbl_size) { |
| 380 | − DRM_ERROR("ACPI VFCT image header truncated\n"); | |
| 384 | + dev_info(adev->dev, "ACPI VFCT image header truncated,skipping\n"); | |
| 381 | 385 | return false; |
| 382 | 386 | } |
| 383 | 387 | |
| 384 | 388 | offset += vhdr->ImageLength; |
| 385 | 389 | if (offset > tbl_size) { |
| 386 | − DRM_ERROR("ACPI VFCT image truncated\n"); | |
| 390 | + dev_info(adev->dev, "ACPI VFCT image truncated,skipping\n"); | |
| 387 | 391 | return false; |
| 388 | 392 | } |
| 389 | 393 | |
| @@ -406,7 +410,7 @@ static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) · 16 unmodified lines | ||
| 406 | 410 | } |
| 407 | 411 | } |
| 408 | 412 | |
| 409 | − DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n"); | |
| 413 | + dev_info(adev->dev, "ACPI VFCT table present but broken (too short #2),skipping\n"); | |
| 410 | 414 | return false; |
| 411 | 415 | } |
| 412 | 416 | #else |
| @@ -453,7 +457,7 @@ bool amdgpu_get_bios(struct amdgpu_device *adev) · 40 unmodified lines | ||
| 453 | 457 | goto success; |
| 454 | 458 | } |
| 455 | 459 | |
| 456 | − DRM_ERROR("Unable to locate a BIOS ROM\n"); | |
| 460 | + dev_err(adev->dev, "Unable to locate a BIOS ROM\n"); | |
| 457 | 461 | return false; |
| 458 | 462 | |
| 459 | 463 | success: |
| @@ -117,7 +117,7 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs · 116 unmodified lines | ||
| 117 | 117 | if (cs->in.num_chunks == 0) |
| 118 | 118 | return 0; |
| 119 | 119 | |
| 120 | − chunk_array = kmalloc_array(cs->in.num_chunks, sizeof(uint64_t), GFP_KERNEL); | |
| 120 | + chunk_array = kvmalloc_array(cs->in.num_chunks, sizeof(uint64_t), GFP_KERNEL); | |
| 121 | 121 | if (!chunk_array) |
| 122 | 122 | return -ENOMEM; |
| 123 | 123 | |
| @@ -144,7 +144,7 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs · 20 unmodified lines | ||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | p->nchunks = cs->in.num_chunks; |
| 147 | − p->chunks = kmalloc_array(p->nchunks, sizeof(struct amdgpu_cs_chunk), | |
| 147 | + p->chunks = kvmalloc_array(p->nchunks, sizeof(struct amdgpu_cs_chunk), | |
| 148 | 148 | GFP_KERNEL); |
| 149 | 149 | if (!p->chunks) { |
| 150 | 150 | ret = -ENOMEM; |
| @@ -238,7 +238,7 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs · 87 unmodified lines | ||
| 238 | 238 | |
| 239 | 239 | if (p->uf_entry.tv.bo) |
| 240 | 240 | p->job->uf_addr = uf_offset; |
| 241 | − kfree(chunk_array); | |
| 241 | + kvfree(chunk_array); | |
| 242 | 242 | |
| 243 | 243 | /* Use this opportunity to fill in task info for the vm */ |
| 244 | 244 | amdgpu_vm_set_task_info(vm); |
| @@ -250,11 +250,11 @@ free_all_kdata: · 5 unmodified lines | ||
| 250 | 250 | free_partial_kdata: |
| 251 | 251 | for (; i >= 0; i--) |
| 252 | 252 | kvfree(p->chunks[i].kdata); |
| 253 | − kfree(p->chunks); | |
| 253 | + kvfree(p->chunks); | |
| 254 | 254 | p->chunks = NULL; |
| 255 | 255 | p->nchunks = 0; |
| 256 | 256 | free_chunk: |
| 257 | − kfree(chunk_array); | |
| 257 | + kvfree(chunk_array); | |
| 258 | 258 | |
| 259 | 259 | return ret; |
| 260 | 260 | } |
| @@ -559,7 +559,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · 298 unmodified lines | ||
| 559 | 559 | sizeof(struct page *), |
| 560 | 560 | GFP_KERNEL | __GFP_ZERO); |
| 561 | 561 | if (!e->user_pages) { |
| 562 | − DRM_ERROR("calloc failure\n"); | |
| 562 | + DRM_ERROR("kvmalloc_array failure\n"); | |
| 563 | 563 | return -ENOMEM; |
| 564 | 564 | } |
| 565 | 565 | |
| @@ -706,7 +706,7 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, · 140 unmodified lines | ||
| 706 | 706 | |
| 707 | 707 | for (i = 0; i < parser->nchunks; i++) |
| 708 | 708 | kvfree(parser->chunks[i].kdata); |
| 709 | − kfree(parser->chunks); | |
| 709 | + kvfree(parser->chunks); | |
| 710 | 710 | if (parser->job) |
| 711 | 711 | amdgpu_job_free(parser->job); |
| 712 | 712 | if (parser->uf_entry.tv.bo) { |
| @@ -28,7 +28,6 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <linux/uaccess.h> |
| 29 | 29 | #include <linux/pm_runtime.h> |
| 30 | 30 | #include <linux/poll.h> |
| 31 | −#include <drm/drm_debugfs.h> | |
| 32 | 31 | |
| 33 | 32 | #include "amdgpu.h" |
| 34 | 33 | #include "amdgpu_pm.h" |
| @@ -38,45 +37,6 @@ · 3 unmodified lines | ||
| 38 | 37 | #include "amdgpu_securedisplay.h" |
| 39 | 38 | #include "amdgpu_fw_attestation.h" |
| 40 | 39 | |
| 41 | −/** | |
| 42 | − * amdgpu_debugfs_add_files - Add simple debugfs entries | |
| 43 | − * | |
| 44 | − * @adev: Device to attach debugfs entries to | |
| 45 | − * @files: Array of function callbacks that respond to reads | |
| 46 | − * @nfiles: Number of callbacks to register | |
| 47 | − * | |
| 48 | − */ | |
| 49 | −int amdgpu_debugfs_add_files(struct amdgpu_device *adev, | |
| 50 | − const struct drm_info_list *files, | |
| 51 | − unsigned nfiles) | |
| 52 | −{ | |
| 53 | − unsigned i; | |
| 54 | − | |
| 55 | − for (i = 0; i < adev->debugfs_count; i++) { | |
| 56 | − if (adev->debugfs[i].files == files) { | |
| 57 | − /* Already registered */ | |
| 58 | − return 0; | |
| 59 | − } | |
| 60 | − } | |
| 61 | − | |
| 62 | − i = adev->debugfs_count + 1; | |
| 63 | − if (i > AMDGPU_DEBUGFS_MAX_COMPONENTS) { | |
| 64 | − DRM_ERROR("Reached maximum number of debugfs components.\n"); | |
| 65 | − DRM_ERROR("Report so we increase " | |
| 66 | − "AMDGPU_DEBUGFS_MAX_COMPONENTS.\n"); | |
| 67 | − return -EINVAL; | |
| 68 | − } | |
| 69 | − adev->debugfs[adev->debugfs_count].files = files; | |
| 70 | − adev->debugfs[adev->debugfs_count].num_files = nfiles; | |
| 71 | − adev->debugfs_count = i; | |
| 72 | −#if defined(CONFIG_DEBUG_FS) | |
| 73 | − drm_debugfs_create_files(files, nfiles, | |
| 74 | − adev_to_drm(adev)->primary->debugfs_root, | |
| 75 | − adev_to_drm(adev)->primary); | |
| 76 | −#endif | |
| 77 | − return 0; | |
| 78 | −} | |
| 79 | − | |
| 80 | 40 | int amdgpu_debugfs_wait_dump(struct amdgpu_device *adev) |
| 81 | 41 | { |
| 82 | 42 | #if defined(CONFIG_DEBUG_FS) |
| @@ -1228,22 +1188,20 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) · 1145 unmodified lines | ||
| 1228 | 1188 | adev, debugfs_regs[i]); |
| 1229 | 1189 | if (!i && !IS_ERR_OR_NULL(ent)) |
| 1230 | 1190 | i_size_write(ent->d_inode, adev->rmmio_size); |
| 1231 | − adev->debugfs_regs[i] = ent; | |
| 1232 | 1191 | } |
| 1233 | 1192 | |
| 1234 | 1193 | return 0; |
| 1235 | 1194 | } |
| 1236 | 1195 | |
| 1237 | −static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data) | |
| 1196 | +static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused) | |
| 1238 | 1197 | { |
| 1239 | − struct drm_info_node *node = (struct drm_info_node *) m->private; | |
| 1240 | − struct drm_device *dev = node->minor->dev; | |
| 1241 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 1198 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 1199 | + struct drm_device *dev = adev_to_drm(adev); | |
| 1242 | 1200 | int r = 0, i; |
| 1243 | 1201 | |
| 1244 | 1202 | r = pm_runtime_get_sync(dev->dev); |
| 1245 | 1203 | if (r < 0) { |
| 1246 | − pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 1204 | + pm_runtime_put_autosuspend(dev->dev); | |
| 1247 | 1205 | return r; |
| 1248 | 1206 | } |
| 1249 | 1207 | |
| @@ -1285,30 +1243,19 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data) · 35 unmodified lines | ||
| 1285 | 1243 | return 0; |
| 1286 | 1244 | } |
| 1287 | 1245 | |
| 1288 | −static int amdgpu_debugfs_get_vbios_dump(struct seq_file *m, void *data) | |
| 1246 | +static int amdgpu_debugfs_evict_vram(void *data, u64 *val) | |
| 1289 | 1247 | { |
| 1290 | − struct drm_info_node *node = (struct drm_info_node *) m->private; | |
| 1291 | − struct drm_device *dev = node->minor->dev; | |
| 1292 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 1293 | − | |
| 1294 | − seq_write(m, adev->bios, adev->bios_size); | |
| 1295 | − return 0; | |
| 1296 | −} | |
| 1297 | − | |
| 1298 | −static int amdgpu_debugfs_evict_vram(struct seq_file *m, void *data) | |
| 1299 | −{ | |
| 1300 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 1301 | − struct drm_device *dev = node->minor->dev; | |
| 1302 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 1248 | + struct amdgpu_device *adev = (struct amdgpu_device *)data; | |
| 1249 | + struct drm_device *dev = adev_to_drm(adev); | |
| 1303 | 1250 | int r; |
| 1304 | 1251 | |
| 1305 | 1252 | r = pm_runtime_get_sync(dev->dev); |
| 1306 | 1253 | if (r < 0) { |
| 1307 | − pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 1254 | + pm_runtime_put_autosuspend(dev->dev); | |
| 1308 | 1255 | return r; |
| 1309 | 1256 | } |
| 1310 | 1257 | |
| 1311 | − seq_printf(m, "(%d)\n", amdgpu_bo_evict_vram(adev)); | |
| 1258 | + *val = amdgpu_bo_evict_vram(adev); | |
| 1312 | 1259 | |
| 1313 | 1260 | pm_runtime_mark_last_busy(dev->dev); |
| 1314 | 1261 | pm_runtime_put_autosuspend(dev->dev); |
| @@ -1316,11 +1263,11 @@ static int amdgpu_debugfs_evict_vram(struct seq_file *m, void *data) · 1 unmodified line | ||
| 1316 | 1263 | return 0; |
| 1317 | 1264 | } |
| 1318 | 1265 | |
| 1319 | −static int amdgpu_debugfs_evict_gtt(struct seq_file *m, void *data) | |
| 1266 | + | |
| 1267 | +static int amdgpu_debugfs_evict_gtt(void *data, u64 *val) | |
| 1320 | 1268 | { |
| 1321 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 1322 | − struct drm_device *dev = node->minor->dev; | |
| 1323 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 1269 | + struct amdgpu_device *adev = (struct amdgpu_device *)data; | |
| 1270 | + struct drm_device *dev = adev_to_drm(adev); | |
| 1324 | 1271 | struct ttm_resource_manager *man; |
| 1325 | 1272 | int r; |
| 1326 | 1273 | |
| @@ -1331,8 +1278,7 @@ static int amdgpu_debugfs_evict_gtt(struct seq_file *m, void *data) · 4 unmodified lines | ||
| 1331 | 1278 | } |
| 1332 | 1279 | |
| 1333 | 1280 | man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT); |
| 1334 | − r = ttm_resource_manager_evict_all(&adev->mman.bdev, man); | |
| 1335 | − seq_printf(m, "(%d)\n", r); | |
| 1281 | + *val = ttm_resource_manager_evict_all(&adev->mman.bdev, man); | |
| 1336 | 1282 | |
| 1337 | 1283 | pm_runtime_mark_last_busy(dev->dev); |
| 1338 | 1284 | pm_runtime_put_autosuspend(dev->dev); |
| @@ -1340,10 +1286,11 @@ static int amdgpu_debugfs_evict_gtt(struct seq_file *m, void *data) · 1 unmodified line | ||
| 1340 | 1286 | return 0; |
| 1341 | 1287 | } |
| 1342 | 1288 | |
| 1343 | −static int amdgpu_debugfs_vm_info(struct seq_file *m, void *data) | |
| 1289 | + | |
| 1290 | +static int amdgpu_debugfs_vm_info_show(struct seq_file *m, void *unused) | |
| 1344 | 1291 | { |
| 1345 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 1346 | − struct drm_device *dev = node->minor->dev; | |
| 1292 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 1293 | + struct drm_device *dev = adev_to_drm(adev); | |
| 1347 | 1294 | struct drm_file *file; |
| 1348 | 1295 | int r; |
| 1349 | 1296 | |
| @@ -1369,13 +1316,12 @@ static int amdgpu_debugfs_vm_info(struct seq_file *m, void *data) · 19 unmodified lines | ||
| 1369 | 1316 | return r; |
| 1370 | 1317 | } |
| 1371 | 1318 | |
| 1372 | −static const struct drm_info_list amdgpu_debugfs_list[] = { | |
| 1373 | − {"amdgpu_vbios", amdgpu_debugfs_get_vbios_dump}, | |
| 1374 | − {"amdgpu_test_ib", &amdgpu_debugfs_test_ib}, | |
| 1375 | − {"amdgpu_evict_vram", &amdgpu_debugfs_evict_vram}, | |
| 1376 | − {"amdgpu_evict_gtt", &amdgpu_debugfs_evict_gtt}, | |
| 1377 | − {"amdgpu_vm_info", &amdgpu_debugfs_vm_info}, | |
| 1378 | −}; | |
| 1319 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_test_ib); | |
| 1320 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_vm_info); | |
| 1321 | +DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_evict_vram_fops, amdgpu_debugfs_evict_vram, | |
| 1322 | + NULL, "%lld\n"); | |
| 1323 | +DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_evict_gtt_fops, amdgpu_debugfs_evict_gtt, | |
| 1324 | + NULL, "%lld\n"); | |
| 1379 | 1325 | |
| 1380 | 1326 | static void amdgpu_ib_preempt_fences_swap(struct amdgpu_ring *ring, |
| 1381 | 1327 | struct dma_fence **fences) |
| @@ -1586,71 +1532,50 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val) · 204 unmodified lines | ||
| 1586 | 1532 | return 0; |
| 1587 | 1533 | } |
| 1588 | 1534 | |
| 1589 | −DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL, | |
| 1535 | +DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL, | |
| 1590 | 1536 | amdgpu_debugfs_ib_preempt, "%llu\n"); |
| 1591 | 1537 | |
| 1592 | −DEFINE_SIMPLE_ATTRIBUTE(fops_sclk_set, NULL, | |
| 1538 | +DEFINE_DEBUGFS_ATTRIBUTE(fops_sclk_set, NULL, | |
| 1593 | 1539 | amdgpu_debugfs_sclk_set, "%llu\n"); |
| 1594 | 1540 | |
| 1595 | 1541 | int amdgpu_debugfs_init(struct amdgpu_device *adev) |
| 1596 | 1542 | { |
| 1543 | + struct dentry *root = adev_to_drm(adev)->primary->debugfs_root; | |
| 1544 | + struct dentry *ent; | |
| 1597 | 1545 | int r, i; |
| 1598 | 1546 | |
| 1599 | − adev->debugfs_preempt = | |
| 1600 | − debugfs_create_file("amdgpu_preempt_ib", 0600, | |
| 1601 | − adev_to_drm(adev)->primary->debugfs_root, adev, | |
| 1602 | − &fops_ib_preempt); | |
| 1603 | − if (!(adev->debugfs_preempt)) { | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev, | |
| 1550 | + &fops_ib_preempt); | |
| 1551 | + if (!ent) { | |
| 1604 | 1552 | DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n"); |
| 1605 | 1553 | return -EIO; |
| 1606 | 1554 | } |
| 1607 | 1555 | |
| 1608 | − adev->smu.debugfs_sclk = | |
| 1609 | − debugfs_create_file("amdgpu_force_sclk", 0200, | |
| 1610 | − adev_to_drm(adev)->primary->debugfs_root, adev, | |
| 1611 | − &fops_sclk_set); | |
| 1612 | − if (!(adev->smu.debugfs_sclk)) { | |
| 1556 | + ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev, | |
| 1557 | + &fops_sclk_set); | |
| 1558 | + if (!ent) { | |
| 1613 | 1559 | DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n"); |
| 1614 | 1560 | return -EIO; |
| 1615 | 1561 | } |
| 1616 | 1562 | |
| 1617 | 1563 | /* Register debugfs entries for amdgpu_ttm */ |
| 1618 | − r = amdgpu_ttm_debugfs_init(adev); | |
| 1619 | − if (r) { | |
| 1620 | − DRM_ERROR("Failed to init debugfs\n"); | |
| 1621 | − return r; | |
| 1622 | − } | |
| 1623 | − | |
| 1624 | − r = amdgpu_debugfs_pm_init(adev); | |
| 1625 | − if (r) { | |
| 1626 | − DRM_ERROR("Failed to register debugfs file for dpm!\n"); | |
| 1627 | − return r; | |
| 1628 | − } | |
| 1629 | − | |
| 1630 | − if (amdgpu_debugfs_sa_init(adev)) { | |
| 1631 | − dev_err(adev->dev, "failed to register debugfs file for SA\n"); | |
| 1632 | − } | |
| 1633 | − | |
| 1634 | − if (amdgpu_debugfs_fence_init(adev)) | |
| 1635 | − dev_err(adev->dev, "fence debugfs file creation failed\n"); | |
| 1636 | − | |
| 1637 | − r = amdgpu_debugfs_gem_init(adev); | |
| 1638 | − if (r) | |
| 1639 | − DRM_ERROR("registering gem debugfs failed (%d).\n", r); | |
| 1564 | + amdgpu_ttm_debugfs_init(adev); | |
| 1565 | + amdgpu_debugfs_pm_init(adev); | |
| 1566 | + amdgpu_debugfs_sa_init(adev); | |
| 1567 | + amdgpu_debugfs_fence_init(adev); | |
| 1568 | + amdgpu_debugfs_gem_init(adev); | |
| 1640 | 1569 | |
| 1641 | 1570 | r = amdgpu_debugfs_regs_init(adev); |
| 1642 | 1571 | if (r) |
| 1643 | 1572 | DRM_ERROR("registering register debugfs failed (%d).\n", r); |
| 1644 | 1573 | |
| 1645 | − r = amdgpu_debugfs_firmware_init(adev); | |
| 1646 | − if (r) | |
| 1647 | − DRM_ERROR("registering firmware debugfs failed (%d).\n", r); | |
| 1574 | + amdgpu_debugfs_firmware_init(adev); | |
| 1648 | 1575 | |
| 1649 | 1576 | #if defined(CONFIG_DRM_AMD_DC) |
| 1650 | − if (amdgpu_device_has_dc_support(adev)) { | |
| 1651 | − if (dtn_debugfs_init(adev)) | |
| 1652 | − DRM_ERROR("amdgpu: failed initialize dtn debugfs support.\n"); | |
| 1653 | − } | |
| 1577 | + if (amdgpu_device_has_dc_support(adev)) | |
| 1578 | + dtn_debugfs_init(adev); | |
| 1654 | 1579 | #endif |
| 1655 | 1580 | |
| 1656 | 1581 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
| @@ -1665,17 +1590,26 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev) · 8 unmodified lines | ||
| 1665 | 1590 | } |
| 1666 | 1591 | |
| 1667 | 1592 | amdgpu_ras_debugfs_create_all(adev); |
| 1668 | − | |
| 1669 | 1593 | amdgpu_debugfs_autodump_init(adev); |
| 1670 | − | |
| 1671 | 1594 | amdgpu_rap_debugfs_init(adev); |
| 1672 | − | |
| 1673 | 1595 | amdgpu_securedisplay_debugfs_init(adev); |
| 1674 | − | |
| 1675 | 1596 | amdgpu_fw_attestation_debugfs_init(adev); |
| 1676 | 1597 | |
| 1677 | − return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list, | |
| 1678 | − ARRAY_SIZE(amdgpu_debugfs_list)); | |
| 1598 | + debugfs_create_file("amdgpu_evict_vram", 0444, root, adev, | |
| 1599 | + &amdgpu_evict_vram_fops); | |
| 1600 | + debugfs_create_file("amdgpu_evict_gtt", 0444, root, adev, | |
| 1601 | + &amdgpu_evict_gtt_fops); | |
| 1602 | + debugfs_create_file("amdgpu_test_ib", 0444, root, adev, | |
| 1603 | + &amdgpu_debugfs_test_ib_fops); | |
| 1604 | + debugfs_create_file("amdgpu_vm_info", 0444, root, adev, | |
| 1605 | + &amdgpu_debugfs_vm_info_fops); | |
| 1606 | + | |
| 1607 | + adev->debugfs_vbios_blob.data = adev->bios; | |
| 1608 | + adev->debugfs_vbios_blob.size = adev->bios_size; | |
| 1609 | + debugfs_create_blob("amdgpu_vbios", 0444, root, | |
| 1610 | + &adev->debugfs_vbios_blob); | |
| 1611 | + | |
| 1612 | + return 0; | |
| 1679 | 1613 | } |
| 1680 | 1614 | |
| 1681 | 1615 | #else |
| @@ -26,11 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | /* |
| 27 | 27 | * Debugfs |
| 28 | 28 | */ |
| 29 | −struct amdgpu_debugfs { | |
| 30 | − const struct drm_info_list *files; | |
| 31 | − unsigned num_files; | |
| 32 | −}; | |
| 33 | − | |
| 34 | 29 | struct amdgpu_autodump { |
| 35 | 30 | struct completion dumping; |
| 36 | 31 | struct wait_queue_head gpu_hang; |
| @@ -39,10 +34,7 @@ struct amdgpu_autodump { · 2 unmodified lines | ||
| 39 | 34 | int amdgpu_debugfs_regs_init(struct amdgpu_device *adev); |
| 40 | 35 | int amdgpu_debugfs_init(struct amdgpu_device *adev); |
| 41 | 36 | void amdgpu_debugfs_fini(struct amdgpu_device *adev); |
| 42 | −int amdgpu_debugfs_add_files(struct amdgpu_device *adev, | |
| 43 | − const struct drm_info_list *files, | |
| 44 | − unsigned nfiles); | |
| 45 | −int amdgpu_debugfs_fence_init(struct amdgpu_device *adev); | |
| 46 | −int amdgpu_debugfs_firmware_init(struct amdgpu_device *adev); | |
| 47 | −int amdgpu_debugfs_gem_init(struct amdgpu_device *adev); | |
| 37 | +void amdgpu_debugfs_fence_init(struct amdgpu_device *adev); | |
| 38 | +void amdgpu_debugfs_firmware_init(struct amdgpu_device *adev); | |
| 39 | +void amdgpu_debugfs_gem_init(struct amdgpu_device *adev); | |
| 48 | 40 | int amdgpu_debugfs_wait_dump(struct amdgpu_device *adev); |
| @@ -110,6 +110,7 @@ const char *amdgpu_asic_name[] = { · 109 unmodified lines | ||
| 110 | 110 | "RAVEN", |
| 111 | 111 | "ARCTURUS", |
| 112 | 112 | "RENOIR", |
| 113 | + "ALDEBARAN", | |
| 113 | 114 | "NAVI10", |
| 114 | 115 | "NAVI14", |
| 115 | 116 | "NAVI12", |
| @@ -464,49 +465,6 @@ void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev, · 348 unmodified lines | ||
| 464 | 465 | } |
| 465 | 466 | } |
| 466 | 467 | |
| 467 | −/** | |
| 468 | − * amdgpu_io_rreg - read an IO register | |
| 469 | − * | |
| 470 | − * @adev: amdgpu_device pointer | |
| 471 | − * @reg: dword aligned register offset | |
| 472 | − * | |
| 473 | − * Returns the 32 bit value from the offset specified. | |
| 474 | − */ | |
| 475 | −u32 amdgpu_io_rreg(struct amdgpu_device *adev, u32 reg) | |
| 476 | −{ | |
| 477 | − if (adev->in_pci_err_recovery) | |
| 478 | − return 0; | |
| 479 | − | |
| 480 | − if ((reg * 4) < adev->rio_mem_size) | |
| 481 | − return ioread32(adev->rio_mem + (reg * 4)); | |
| 482 | − else { | |
| 483 | − iowrite32((reg * 4), adev->rio_mem + (mmMM_INDEX * 4)); | |
| 484 | − return ioread32(adev->rio_mem + (mmMM_DATA * 4)); | |
| 485 | − } | |
| 486 | −} | |
| 487 | − | |
| 488 | −/** | |
| 489 | − * amdgpu_io_wreg - write to an IO register | |
| 490 | − * | |
| 491 | − * @adev: amdgpu_device pointer | |
| 492 | − * @reg: dword aligned register offset | |
| 493 | − * @v: 32 bit value to write to the register | |
| 494 | − * | |
| 495 | − * Writes the value specified to the offset specified. | |
| 496 | − */ | |
| 497 | −void amdgpu_io_wreg(struct amdgpu_device *adev, u32 reg, u32 v) | |
| 498 | −{ | |
| 499 | − if (adev->in_pci_err_recovery) | |
| 500 | − return; | |
| 501 | − | |
| 502 | − if ((reg * 4) < adev->rio_mem_size) | |
| 503 | − iowrite32(v, adev->rio_mem + (reg * 4)); | |
| 504 | − else { | |
| 505 | − iowrite32((reg * 4), adev->rio_mem + (mmMM_INDEX * 4)); | |
| 506 | − iowrite32(v, adev->rio_mem + (mmMM_DATA * 4)); | |
| 507 | − } | |
| 508 | −} | |
| 509 | − | |
| 510 | 468 | /** |
| 511 | 469 | * amdgpu_mm_rdoorbell - read a doorbell dword |
| 512 | 470 | * |
| @@ -1223,6 +1181,10 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev) · 710 unmodified lines | ||
| 1223 | 1181 | } |
| 1224 | 1182 | } |
| 1225 | 1183 | |
| 1184 | + /* Don't post if we need to reset whole hive on init */ | |
| 1185 | + if (adev->gmc.xgmi.pending_reset) | |
| 1186 | + return false; | |
| 1187 | + | |
| 1226 | 1188 | if (adev->has_hw_reset) { |
| 1227 | 1189 | adev->has_hw_reset = false; |
| 1228 | 1190 | return true; |
| @@ -1810,6 +1772,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev) · 581 unmodified lines | ||
| 1810 | 1772 | case CHIP_CARRIZO: |
| 1811 | 1773 | case CHIP_STONEY: |
| 1812 | 1774 | case CHIP_VEGA20: |
| 1775 | + case CHIP_ALDEBARAN: | |
| 1813 | 1776 | case CHIP_SIENNA_CICHLID: |
| 1814 | 1777 | case CHIP_NAVY_FLOUNDER: |
| 1815 | 1778 | case CHIP_DIMGREY_CAVEFISH: |
| @@ -2010,6 +1973,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) · 194 unmodified lines | ||
| 2010 | 1973 | case CHIP_RAVEN: |
| 2011 | 1974 | case CHIP_ARCTURUS: |
| 2012 | 1975 | case CHIP_RENOIR: |
| 1976 | + case CHIP_ALDEBARAN: | |
| 2013 | 1977 | if (adev->flags & AMD_IS_APU) |
| 2014 | 1978 | adev->family = AMDGPU_FAMILY_RV; |
| 2015 | 1979 | else |
| @@ -2045,6 +2009,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) · 29 unmodified lines | ||
| 2045 | 2009 | adev->pm.pp_feature = amdgpu_pp_feature_mask; |
| 2046 | 2010 | if (amdgpu_sriov_vf(adev) || sched_policy == KFD_SCHED_POLICY_NO_HWS) |
| 2047 | 2011 | adev->pm.pp_feature &= ~PP_GFXOFF_MASK; |
| 2012 | + if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID) | |
| 2013 | + adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK; | |
| 2048 | 2014 | |
| 2049 | 2015 | for (i = 0; i < adev->num_ip_blocks; i++) { |
| 2050 | 2016 | if ((amdgpu_ip_block_mask & (1 << i)) == 0) { |
| @@ -2149,6 +2115,9 @@ static int amdgpu_device_fw_loading(struct amdgpu_device *adev) · 98 unmodified lines | ||
| 2149 | 2115 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_PSP) |
| 2150 | 2116 | continue; |
| 2151 | 2117 | |
| 2118 | + if (!adev->ip_blocks[i].status.sw) | |
| 2119 | + continue; | |
| 2120 | + | |
| 2152 | 2121 | /* no need to do the fw loading again if already done*/ |
| 2153 | 2122 | if (adev->ip_blocks[i].status.hw == true) |
| 2154 | 2123 | break; |
| @@ -2289,7 +2258,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) · 134 unmodified lines | ||
| 2289 | 2258 | |
| 2290 | 2259 | if (adev->gmc.xgmi.num_physical_nodes > 1) |
| 2291 | 2260 | amdgpu_xgmi_add_device(adev); |
| 2292 | − amdgpu_amdkfd_device_init(adev); | |
| 2261 | + | |
| 2262 | + /* Don't init kfd if whole hive need to be reset during init */ | |
| 2263 | + if (!adev->gmc.xgmi.pending_reset) | |
| 2264 | + amdgpu_amdkfd_device_init(adev); | |
| 2293 | 2265 | |
| 2294 | 2266 | amdgpu_fru_get_product_info(adev); |
| 2295 | 2267 | |
| @@ -2498,6 +2470,11 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) · 202 unmodified lines | ||
| 2498 | 2470 | if (r) |
| 2499 | 2471 | DRM_ERROR("enable mgpu fan boost failed (%d).\n", r); |
| 2500 | 2472 | |
| 2473 | + /* For XGMI + passthrough configuration on arcturus, enable light SBR */ | |
| 2474 | + if (adev->asic_type == CHIP_ARCTURUS && | |
| 2475 | + amdgpu_passthrough(adev) && | |
| 2476 | + adev->gmc.xgmi.num_physical_nodes > 1) | |
| 2477 | + smu_set_light_sbr(&adev->smu, true); | |
| 2501 | 2478 | |
| 2502 | 2479 | if (adev->gmc.xgmi.num_physical_nodes > 1) { |
| 2503 | 2480 | mutex_lock(&mgpu_info.mutex); |
| @@ -2734,6 +2711,16 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · 230 unmodified lines | ||
| 2734 | 2711 | adev->ip_blocks[i].status.hw = false; |
| 2735 | 2712 | continue; |
| 2736 | 2713 | } |
| 2714 | + | |
| 2715 | + /* skip unnecessary suspend if we do not initialize them yet */ | |
| 2716 | + if (adev->gmc.xgmi.pending_reset && | |
| 2717 | + !(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC || | |
| 2718 | + adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC || | |
| 2719 | + adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON || | |
| 2720 | + adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH)) { | |
| 2721 | + adev->ip_blocks[i].status.hw = false; | |
| 2722 | + continue; | |
| 2723 | + } | |
| 2737 | 2724 | /* XXX handle errors */ |
| 2738 | 2725 | r = adev->ip_blocks[i].version->funcs->suspend(adev); |
| 2739 | 2726 | /* XXX handle errors */ |
| @@ -2753,7 +2740,6 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · 13 unmodified lines | ||
| 2753 | 2740 | } |
| 2754 | 2741 | } |
| 2755 | 2742 | } |
| 2756 | − adev->ip_blocks[i].status.hw = false; | |
| 2757 | 2743 | } |
| 2758 | 2744 | |
| 2759 | 2745 | return 0; |
| @@ -2774,8 +2760,10 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev) · 14 unmodified lines | ||
| 2774 | 2760 | { |
| 2775 | 2761 | int r; |
| 2776 | 2762 | |
| 2777 | − if (amdgpu_sriov_vf(adev)) | |
| 2763 | + if (amdgpu_sriov_vf(adev)) { | |
| 2764 | + amdgpu_virt_fini_data_exchange(adev); | |
| 2778 | 2765 | amdgpu_virt_request_full_gpu(adev, false); |
| 2766 | + } | |
| 2779 | 2767 | |
| 2780 | 2768 | r = amdgpu_device_ip_suspend_phase1(adev); |
| 2781 | 2769 | if (r) |
| @@ -3257,7 +3245,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 475 unmodified lines | ||
| 3257 | 3245 | |
| 3258 | 3246 | /* mutex initialization are all done here so we |
| 3259 | 3247 | * can recall function without having locking issues */ |
| 3260 | − atomic_set(&adev->irq.ih.lock, 0); | |
| 3261 | 3248 | mutex_init(&adev->firmware.mutex); |
| 3262 | 3249 | mutex_init(&adev->pm.mutex); |
| 3263 | 3250 | mutex_init(&adev->gfx.gpu_clock_mutex); |
| @@ -3290,6 +3277,8 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 26 unmodified lines | ||
| 3290 | 3277 | INIT_LIST_HEAD(&adev->shadow_list); |
| 3291 | 3278 | mutex_init(&adev->shadow_list_lock); |
| 3292 | 3279 | |
| 3280 | + INIT_LIST_HEAD(&adev->reset_list); | |
| 3281 | + | |
| 3293 | 3282 | INIT_DELAYED_WORK(&adev->delayed_init_work, |
| 3294 | 3283 | amdgpu_device_delayed_init_work_handler); |
| 3295 | 3284 | INIT_DELAYED_WORK(&adev->gfx.gfx_off_delay_work, |
| @@ -3328,17 +3317,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 32 unmodified lines | ||
| 3328 | 3317 | DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base); |
| 3329 | 3318 | DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size); |
| 3330 | 3319 | |
| 3331 | − /* io port mapping */ | |
| 3332 | − for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | |
| 3333 | − if (pci_resource_flags(adev->pdev, i) & IORESOURCE_IO) { | |
| 3334 | − adev->rio_mem_size = pci_resource_len(adev->pdev, i); | |
| 3335 | − adev->rio_mem = pci_iomap(adev->pdev, i, adev->rio_mem_size); | |
| 3336 | − break; | |
| 3337 | − } | |
| 3338 | − } | |
| 3339 | − if (adev->rio_mem == NULL) | |
| 3340 | − DRM_INFO("PCI I/O BAR is not found.\n"); | |
| 3341 | − | |
| 3342 | 3320 | /* enable PCIE atomic ops */ |
| 3343 | 3321 | r = pci_enable_atomic_ops_to_root(adev->pdev, |
| 3344 | 3322 | PCI_EXP_DEVCAP2_ATOMIC_COMP32 | |
| @@ -3405,10 +3383,28 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 60 unmodified lines | ||
| 3405 | 3383 | * E.g., driver was not cleanly unloaded previously, etc. |
| 3406 | 3384 | */ |
| 3407 | 3385 | if (!amdgpu_sriov_vf(adev) && amdgpu_asic_need_reset_on_init(adev)) { |
| 3408 | − r = amdgpu_asic_reset(adev); | |
| 3409 | − if (r) { | |
| 3410 | − dev_err(adev->dev, "asic reset on init failed\n"); | |
| 3411 | − goto failed; | |
| 3386 | + if (adev->gmc.xgmi.num_physical_nodes) { | |
| 3387 | + dev_info(adev->dev, "Pending hive reset.\n"); | |
| 3388 | + adev->gmc.xgmi.pending_reset = true; | |
| 3389 | + /* Only need to init necessary block for SMU to handle the reset */ | |
| 3390 | + for (i = 0; i < adev->num_ip_blocks; i++) { | |
| 3391 | + if (!adev->ip_blocks[i].status.valid) | |
| 3392 | + continue; | |
| 3393 | + if (!(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC || | |
| 3394 | + adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON || | |
| 3395 | + adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH || | |
| 3396 | + adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC)) { | |
| 3397 | + DRM_DEBUG("IP %s disabled for hw_init.\n", | |
| 3398 | + adev->ip_blocks[i].version->funcs->name); | |
| 3399 | + adev->ip_blocks[i].status.hw = true; | |
| 3400 | + } | |
| 3401 | + } | |
| 3402 | + } else { | |
| 3403 | + r = amdgpu_asic_reset(adev); | |
| 3404 | + if (r) { | |
| 3405 | + dev_err(adev->dev, "asic reset on init failed\n"); | |
| 3406 | + goto failed; | |
| 3407 | + } | |
| 3412 | 3408 | } |
| 3413 | 3409 | } |
| 3414 | 3410 | |
| @@ -3474,11 +3470,11 @@ fence_driver_init: · 59 unmodified lines | ||
| 3474 | 3470 | adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME; |
| 3475 | 3471 | adev->virt.ops = NULL; |
| 3476 | 3472 | r = -EAGAIN; |
| 3477 | − goto failed; | |
| 3473 | + goto release_ras_con; | |
| 3478 | 3474 | } |
| 3479 | 3475 | dev_err(adev->dev, "amdgpu_device_ip_init failed\n"); |
| 3480 | 3476 | amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL, 0, 0); |
| 3481 | − goto failed; | |
| 3477 | + goto release_ras_con; | |
| 3482 | 3478 | } |
| 3483 | 3479 | |
| 3484 | 3480 | dev_info(adev->dev, |
| @@ -3539,19 +3535,19 @@ fence_driver_init: · 54 unmodified lines | ||
| 3539 | 3535 | /* enable clockgating, etc. after ib tests, etc. since some blocks require |
| 3540 | 3536 | * explicit gating rather than handling it automatically. |
| 3541 | 3537 | */ |
| 3542 | − r = amdgpu_device_ip_late_init(adev); | |
| 3543 | − if (r) { | |
| 3544 | − dev_err(adev->dev, "amdgpu_device_ip_late_init failed\n"); | |
| 3545 | − amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_LATE_INIT_FAIL, 0, r); | |
| 3546 | − goto failed; | |
| 3538 | + if (!adev->gmc.xgmi.pending_reset) { | |
| 3539 | + r = amdgpu_device_ip_late_init(adev); | |
| 3540 | + if (r) { | |
| 3541 | + dev_err(adev->dev, "amdgpu_device_ip_late_init failed\n"); | |
| 3542 | + amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_LATE_INIT_FAIL, 0, r); | |
| 3543 | + goto release_ras_con; | |
| 3544 | + } | |
| 3545 | + /* must succeed. */ | |
| 3546 | + amdgpu_ras_resume(adev); | |
| 3547 | + queue_delayed_work(system_wq, &adev->delayed_init_work, | |
| 3548 | + msecs_to_jiffies(AMDGPU_RESUME_MS)); | |
| 3547 | 3549 | } |
| 3548 | 3550 | |
| 3549 | − /* must succeed. */ | |
| 3550 | − amdgpu_ras_resume(adev); | |
| 3551 | − | |
| 3552 | − queue_delayed_work(system_wq, &adev->delayed_init_work, | |
| 3553 | − msecs_to_jiffies(AMDGPU_RESUME_MS)); | |
| 3554 | − | |
| 3555 | 3551 | if (amdgpu_sriov_vf(adev)) |
| 3556 | 3552 | flush_delayed_work(&adev->delayed_init_work); |
| 3557 | 3553 | |
| @@ -3568,8 +3564,15 @@ fence_driver_init: · 10 unmodified lines | ||
| 3568 | 3564 | if (amdgpu_device_cache_pci_state(adev->pdev)) |
| 3569 | 3565 | pci_restore_state(pdev); |
| 3570 | 3566 | |
| 3567 | + if (adev->gmc.xgmi.pending_reset) | |
| 3568 | + queue_delayed_work(system_wq, &mgpu_info.delayed_reset_work, | |
| 3569 | + msecs_to_jiffies(AMDGPU_RESUME_MS)); | |
| 3570 | + | |
| 3571 | 3571 | return 0; |
| 3572 | 3572 | |
| 3573 | +release_ras_con: | |
| 3574 | + amdgpu_release_ras_context(adev); | |
| 3575 | + | |
| 3573 | 3576 | failed: |
| 3574 | 3577 | amdgpu_vf_error_trans_all(adev); |
| 3575 | 3578 | if (atpx) |
| @@ -3594,6 +3597,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev) · 18 unmodified lines | ||
| 3594 | 3597 | { |
| 3595 | 3598 | dev_info(adev->dev, "amdgpu: finishing device.\n"); |
| 3596 | 3599 | flush_delayed_work(&adev->delayed_init_work); |
| 3600 | + ttm_bo_lock_delayed_workqueue(&adev->mman.bdev); | |
| 3597 | 3601 | adev->shutdown = true; |
| 3598 | 3602 | |
| 3599 | 3603 | kfree(adev->pci_state); |
| @@ -3640,9 +3644,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev) · 40 unmodified lines | ||
| 3640 | 3644 | vga_switcheroo_fini_domain_pm_ops(adev->dev); |
| 3641 | 3645 | if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) |
| 3642 | 3646 | vga_client_register(adev->pdev, NULL, NULL, NULL); |
| 3643 | − if (adev->rio_mem) | |
| 3644 | − pci_iounmap(adev->pdev, adev->rio_mem); | |
| 3645 | − adev->rio_mem = NULL; | |
| 3646 | 3647 | iounmap(adev->rmmio); |
| 3647 | 3648 | adev->rmmio = NULL; |
| 3648 | 3649 | amdgpu_device_doorbell_fini(adev); |
| @@ -4237,15 +4238,56 @@ disabled: · 588 unmodified lines | ||
| 4237 | 4238 | return false; |
| 4238 | 4239 | } |
| 4239 | 4240 | |
| 4241 | +int amdgpu_device_mode1_reset(struct amdgpu_device *adev) | |
| 4242 | +{ | |
| 4243 | + u32 i; | |
| 4244 | + int ret = 0; | |
| 4245 | + | |
| 4246 | + amdgpu_atombios_scratch_regs_engine_hung(adev, true); | |
| 4247 | + | |
| 4248 | + dev_info(adev->dev, "GPU mode1 reset\n"); | |
| 4249 | + | |
| 4250 | + /* disable BM */ | |
| 4251 | + pci_clear_master(adev->pdev); | |
| 4252 | + | |
| 4253 | + amdgpu_device_cache_pci_state(adev->pdev); | |
| 4254 | + | |
| 4255 | + if (amdgpu_dpm_is_mode1_reset_supported(adev)) { | |
| 4256 | + dev_info(adev->dev, "GPU smu mode1 reset\n"); | |
| 4257 | + ret = amdgpu_dpm_mode1_reset(adev); | |
| 4258 | + } else { | |
| 4259 | + dev_info(adev->dev, "GPU psp mode1 reset\n"); | |
| 4260 | + ret = psp_gpu_reset(adev); | |
| 4261 | + } | |
| 4262 | + | |
| 4263 | + if (ret) | |
| 4264 | + dev_err(adev->dev, "GPU mode1 reset failed\n"); | |
| 4265 | + | |
| 4266 | + amdgpu_device_load_pci_state(adev->pdev); | |
| 4267 | + | |
| 4268 | + /* wait for asic to come out of reset */ | |
| 4269 | + for (i = 0; i < adev->usec_timeout; i++) { | |
| 4270 | + u32 memsize = adev->nbio.funcs->get_memsize(adev); | |
| 4240 | 4271 | |
| 4241 | −static int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, | |
| 4242 | − struct amdgpu_job *job, | |
| 4243 | − bool *need_full_reset_arg) | |
| 4272 | + if (memsize != 0xffffffff) | |
| 4273 | + break; | |
| 4274 | + udelay(1); | |
| 4275 | + } | |
| 4276 | + | |
| 4277 | + amdgpu_atombios_scratch_regs_engine_hung(adev, false); | |
| 4278 | + return ret; | |
| 4279 | +} | |
| 4280 | + | |
| 4281 | +int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, | |
| 4282 | + struct amdgpu_job *job, | |
| 4283 | + bool *need_full_reset_arg) | |
| 4244 | 4284 | { |
| 4245 | 4285 | int i, r = 0; |
| 4246 | 4286 | bool need_full_reset = *need_full_reset_arg; |
| 4247 | 4287 | |
| 4248 | − amdgpu_debugfs_wait_dump(adev); | |
| 4288 | + /* no need to dump if device is not in good state during probe period */ | |
| 4289 | + if (!adev->gmc.xgmi.pending_reset) | |
| 4290 | + amdgpu_debugfs_wait_dump(adev); | |
| 4249 | 4291 | |
| 4250 | 4292 | if (amdgpu_sriov_vf(adev)) { |
| 4251 | 4293 | /* stop the data exchange thread */ |
| @@ -4291,23 +4333,24 @@ static int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, · 39 unmodified lines | ||
| 4291 | 4333 | return r; |
| 4292 | 4334 | } |
| 4293 | 4335 | |
| 4294 | −static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, | |
| 4295 | − struct list_head *device_list_handle, | |
| 4296 | − bool *need_full_reset_arg, | |
| 4297 | − bool skip_hw_reset) | |
| 4336 | +int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, | |
| 4337 | + struct list_head *device_list_handle, | |
| 4338 | + bool *need_full_reset_arg, | |
| 4339 | + bool skip_hw_reset) | |
| 4298 | 4340 | { |
| 4299 | 4341 | struct amdgpu_device *tmp_adev = NULL; |
| 4300 | 4342 | bool need_full_reset = *need_full_reset_arg, vram_lost = false; |
| 4301 | 4343 | int r = 0; |
| 4302 | 4344 | |
| 4303 | 4345 | /* |
| 4304 | − * ASIC reset has to be done on all HGMI hive nodes ASAP | |
| 4346 | + * ASIC reset has to be done on all XGMI hive nodes ASAP | |
| 4305 | 4347 | * to allow proper links negotiation in FW (within 1 sec) |
| 4306 | 4348 | */ |
| 4307 | 4349 | if (!skip_hw_reset && need_full_reset) { |
| 4308 | − list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) { | |
| 4350 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4309 | 4351 | /* For XGMI run all resets in parallel to speed up the process */ |
| 4310 | 4352 | if (tmp_adev->gmc.xgmi.num_physical_nodes > 1) { |
| 4353 | + tmp_adev->gmc.xgmi.pending_reset = false; | |
| 4311 | 4354 | if (!queue_work(system_unbound_wq, &tmp_adev->xgmi_reset_work)) |
| 4312 | 4355 | r = -EALREADY; |
| 4313 | 4356 | } else |
| @@ -4322,8 +4365,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, · 8 unmodified lines | ||
| 4322 | 4365 | |
| 4323 | 4366 | /* For XGMI wait for all resets to complete before proceed */ |
| 4324 | 4367 | if (!r) { |
| 4325 | − list_for_each_entry(tmp_adev, device_list_handle, | |
| 4326 | − gmc.xgmi.head) { | |
| 4368 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4327 | 4369 | if (tmp_adev->gmc.xgmi.num_physical_nodes > 1) { |
| 4328 | 4370 | flush_work(&tmp_adev->xgmi_reset_work); |
| 4329 | 4371 | r = tmp_adev->asic_reset_res; |
| @@ -4335,7 +4377,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, · 5 unmodified lines | ||
| 4335 | 4377 | } |
| 4336 | 4378 | |
| 4337 | 4379 | if (!r && amdgpu_ras_intr_triggered()) { |
| 4338 | − list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) { | |
| 4380 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4339 | 4381 | if (tmp_adev->mmhub.funcs && |
| 4340 | 4382 | tmp_adev->mmhub.funcs->reset_ras_error_count) |
| 4341 | 4383 | tmp_adev->mmhub.funcs->reset_ras_error_count(tmp_adev); |
| @@ -4344,13 +4386,13 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, · 2 unmodified lines | ||
| 4344 | 4386 | amdgpu_ras_intr_cleared(); |
| 4345 | 4387 | } |
| 4346 | 4388 | |
| 4347 | − list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) { | |
| 4389 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4348 | 4390 | if (need_full_reset) { |
| 4349 | 4391 | /* post card */ |
| 4350 | − if (amdgpu_device_asic_init(tmp_adev)) | |
| 4392 | + r = amdgpu_device_asic_init(tmp_adev); | |
| 4393 | + if (r) { | |
| 4351 | 4394 | dev_warn(tmp_adev->dev, "asic atom init failed!"); |
| 4352 | − | |
| 4353 | − if (!r) { | |
| 4395 | + } else { | |
| 4354 | 4396 | dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n"); |
| 4355 | 4397 | r = amdgpu_device_ip_resume_phase1(tmp_adev); |
| 4356 | 4398 | if (r) |
| @@ -4383,6 +4425,9 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, · 26 unmodified lines | ||
| 4383 | 4425 | */ |
| 4384 | 4426 | amdgpu_register_gpu_instance(tmp_adev); |
| 4385 | 4427 | |
| 4428 | + if (!hive && tmp_adev->gmc.xgmi.num_physical_nodes > 1) | |
| 4429 | + amdgpu_xgmi_add_device(tmp_adev); | |
| 4430 | + | |
| 4386 | 4431 | r = amdgpu_device_ip_late_init(tmp_adev); |
| 4387 | 4432 | if (r) |
| 4388 | 4433 | goto out; |
| @@ -4399,7 +4444,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, · 10 unmodified lines | ||
| 4399 | 4444 | * bad_page_threshold value to fix this once |
| 4400 | 4445 | * probing driver again. |
| 4401 | 4446 | */ |
| 4402 | − if (!amdgpu_ras_check_err_threshold(tmp_adev)) { | |
| 4447 | + if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev)) { | |
| 4403 | 4448 | /* must succeed. */ |
| 4404 | 4449 | amdgpu_ras_resume(tmp_adev); |
| 4405 | 4450 | } else { |
| @@ -4449,7 +4494,6 @@ static bool amdgpu_device_lock_adev(struct amdgpu_device *adev, · 43 unmodified lines | ||
| 4449 | 4494 | down_write(&adev->reset_sem); |
| 4450 | 4495 | } |
| 4451 | 4496 | |
| 4452 | − atomic_inc(&adev->gpu_reset_counter); | |
| 4453 | 4497 | switch (amdgpu_asic_reset_method(adev)) { |
| 4454 | 4498 | case AMD_RESET_METHOD_MODE1: |
| 4455 | 4499 | adev->mp1_state = PP_MP1_STATE_SHUTDOWN; |
| @@ -4656,16 +4700,18 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 200 unmodified lines | ||
| 4656 | 4700 | */ |
| 4657 | 4701 | INIT_LIST_HEAD(&device_list); |
| 4658 | 4702 | if (adev->gmc.xgmi.num_physical_nodes > 1) { |
| 4659 | − if (!list_is_first(&adev->gmc.xgmi.head, &hive->device_list)) | |
| 4660 | − list_rotate_to_front(&adev->gmc.xgmi.head, &hive->device_list); | |
| 4661 | − device_list_handle = &hive->device_list; | |
| 4703 | + list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) | |
| 4704 | + list_add_tail(&tmp_adev->reset_list, &device_list); | |
| 4705 | + if (!list_is_first(&adev->reset_list, &device_list)) | |
| 4706 | + list_rotate_to_front(&adev->reset_list, &device_list); | |
| 4707 | + device_list_handle = &device_list; | |
| 4662 | 4708 | } else { |
| 4663 | − list_add_tail(&adev->gmc.xgmi.head, &device_list); | |
| 4709 | + list_add_tail(&adev->reset_list, &device_list); | |
| 4664 | 4710 | device_list_handle = &device_list; |
| 4665 | 4711 | } |
| 4666 | 4712 | |
| 4667 | 4713 | /* block all schedulers and reset given job's ring */ |
| 4668 | − list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) { | |
| 4714 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4669 | 4715 | /* |
| 4670 | 4716 | * Try to put the audio codec into suspend state |
| 4671 | 4717 | * before gpu reset started. |
| @@ -4710,6 +4756,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 38 unmodified lines | ||
| 4710 | 4756 | if (need_emergency_restart) |
| 4711 | 4757 | amdgpu_job_stop_all_jobs_on_sched(&ring->sched); |
| 4712 | 4758 | } |
| 4759 | + atomic_inc(&tmp_adev->gpu_reset_counter); | |
| 4713 | 4760 | } |
| 4714 | 4761 | |
| 4715 | 4762 | if (need_emergency_restart) |
| @@ -4729,7 +4776,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 13 unmodified lines | ||
| 4729 | 4776 | } |
| 4730 | 4777 | |
| 4731 | 4778 | retry: /* Rest of adevs pre asic reset from XGMI hive. */ |
| 4732 | − list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) { | |
| 4779 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4733 | 4780 | r = amdgpu_device_pre_asic_reset(tmp_adev, |
| 4734 | 4781 | (tmp_adev == adev) ? job : NULL, |
| 4735 | 4782 | &need_full_reset); |
| @@ -4756,7 +4803,7 @@ retry: /* Rest of adevs pre asic reset from XGMI hive. */ · 20 unmodified lines | ||
| 4756 | 4803 | skip_hw_reset: |
| 4757 | 4804 | |
| 4758 | 4805 | /* Post ASIC reset for all devs .*/ |
| 4759 | − list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) { | |
| 4806 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4760 | 4807 | |
| 4761 | 4808 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
| 4762 | 4809 | struct amdgpu_ring *ring = tmp_adev->rings[i]; |
| @@ -4787,10 +4834,17 @@ skip_hw_reset: · 24 unmodified lines | ||
| 4787 | 4834 | } |
| 4788 | 4835 | |
| 4789 | 4836 | skip_sched_resume: |
| 4790 | − list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) { | |
| 4791 | − /*unlock kfd: SRIOV would do it separately */ | |
| 4837 | + list_for_each_entry(tmp_adev, device_list_handle, reset_list) { | |
| 4838 | + /* unlock kfd: SRIOV would do it separately */ | |
| 4792 | 4839 | if (!need_emergency_restart && !amdgpu_sriov_vf(tmp_adev)) |
| 4793 | 4840 | amdgpu_amdkfd_post_reset(tmp_adev); |
| 4841 | + | |
| 4842 | + /* kfd_post_reset will do nothing if kfd device is not initialized, | |
| 4843 | + * need to bring up kfd here if it's not be initialized before | |
| 4844 | + */ | |
| 4845 | + if (!adev->kfd.init_complete) | |
| 4846 | + amdgpu_amdkfd_device_init(adev); | |
| 4847 | + | |
| 4794 | 4848 | if (audio_suspended) |
| 4795 | 4849 | amdgpu_device_resume_display_audio(tmp_adev); |
| 4796 | 4850 | amdgpu_device_unlock_adev(tmp_adev); |
| @@ -5052,6 +5106,7 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta · 255 unmodified lines | ||
| 5052 | 5106 | |
| 5053 | 5107 | drm_sched_stop(&ring->sched, NULL); |
| 5054 | 5108 | } |
| 5109 | + atomic_inc(&adev->gpu_reset_counter); | |
| 5055 | 5110 | return PCI_ERS_RESULT_NEED_RESET; |
| 5056 | 5111 | case pci_channel_io_perm_failure: |
| 5057 | 5112 | /* Permanent error, prepare for device removal */ |
| @@ -5100,7 +5155,7 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev) · 42 unmodified lines | ||
| 5100 | 5155 | DRM_INFO("PCI error: slot reset callback!!\n"); |
| 5101 | 5156 | |
| 5102 | 5157 | INIT_LIST_HEAD(&device_list); |
| 5103 | − list_add_tail(&adev->gmc.xgmi.head, &device_list); | |
| 5158 | + list_add_tail(&adev->reset_list, &device_list); | |
| 5104 | 5159 | |
| 5105 | 5160 | /* wait for asic to come out of reset */ |
| 5106 | 5161 | msleep(500); |
| @@ -870,17 +870,62 @@ static int amdgpu_display_get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb · 869 unmodified lines | ||
| 870 | 870 | return r; |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | +int amdgpu_display_gem_fb_init(struct drm_device *dev, | |
| 874 | + struct amdgpu_framebuffer *rfb, | |
| 875 | + const struct drm_mode_fb_cmd2 *mode_cmd, | |
| 876 | + struct drm_gem_object *obj) | |
| 877 | +{ | |
| 878 | + int ret; | |
| 879 | + | |
| 880 | + rfb->base.obj[0] = obj; | |
| 881 | + drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd); | |
| 882 | + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); | |
| 883 | + if (ret) | |
| 884 | + goto err; | |
| 885 | + | |
| 886 | + ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj); | |
| 887 | + if (ret) | |
| 888 | + goto err; | |
| 889 | + | |
| 890 | + return 0; | |
| 891 | +err: | |
| 892 | + drm_err(dev, "Failed to init gem fb: %d\n", ret); | |
| 893 | + rfb->base.obj[0] = NULL; | |
| 894 | + return ret; | |
| 895 | +} | |
| 896 | + | |
| 897 | +int amdgpu_display_gem_fb_verify_and_init( | |
| 898 | + struct drm_device *dev, struct amdgpu_framebuffer *rfb, | |
| 899 | + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, | |
| 900 | + struct drm_gem_object *obj) | |
| 901 | +{ | |
| 902 | + int ret; | |
| 903 | + | |
| 904 | + rfb->base.obj[0] = obj; | |
| 905 | + | |
| 906 | + /* Verify that bo size can fit the fb size. */ | |
| 907 | + ret = drm_gem_fb_init_with_funcs(dev, &rfb->base, file_priv, mode_cmd, | |
| 908 | + &amdgpu_fb_funcs); | |
| 909 | + if (ret) | |
| 910 | + goto err; | |
| 911 | + | |
| 912 | + ret = amdgpu_display_framebuffer_init(dev, rfb, mode_cmd, obj); | |
| 913 | + if (ret) | |
| 914 | + goto err; | |
| 915 | + | |
| 916 | + return 0; | |
| 917 | +err: | |
| 918 | + drm_err(dev, "Failed to verify and init gem fb: %d\n", ret); | |
| 919 | + rfb->base.obj[0] = NULL; | |
| 920 | + return ret; | |
| 921 | +} | |
| 922 | + | |
| 873 | 923 | int amdgpu_display_framebuffer_init(struct drm_device *dev, |
| 874 | 924 | struct amdgpu_framebuffer *rfb, |
| 875 | 925 | const struct drm_mode_fb_cmd2 *mode_cmd, |
| 876 | 926 | struct drm_gem_object *obj) |
| 877 | 927 | { |
| 878 | 928 | int ret, i; |
| 879 | − rfb->base.obj[0] = obj; | |
| 880 | − drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd); | |
| 881 | − ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); | |
| 882 | − if (ret) | |
| 883 | − goto fail; | |
| 884 | 929 | |
| 885 | 930 | /* |
| 886 | 931 | * This needs to happen before modifier conversion as that might change |
| @@ -891,13 +936,13 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, · 4 unmodified lines | ||
| 891 | 936 | drm_dbg_kms(dev, "Plane 0 and %d have different BOs: %u vs. %u\n", |
| 892 | 937 | i, mode_cmd->handles[0], mode_cmd->handles[i]); |
| 893 | 938 | ret = -EINVAL; |
| 894 | − goto fail; | |
| 939 | + return ret; | |
| 895 | 940 | } |
| 896 | 941 | } |
| 897 | 942 | |
| 898 | 943 | ret = amdgpu_display_get_fb_info(rfb, &rfb->tiling_flags, &rfb->tmz_surface); |
| 899 | 944 | if (ret) |
| 900 | − goto fail; | |
| 945 | + return ret; | |
| 901 | 946 | |
| 902 | 947 | if (dev->mode_config.allow_fb_modifiers && |
| 903 | 948 | !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) { |
| @@ -905,20 +950,17 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, · 1 unmodified line | ||
| 905 | 950 | if (ret) { |
| 906 | 951 | drm_dbg_kms(dev, "Failed to convert tiling flags 0x%llX to a modifier", |
| 907 | 952 | rfb->tiling_flags); |
| 908 | − goto fail; | |
| 953 | + return ret; | |
| 909 | 954 | } |
| 910 | 955 | } |
| 911 | 956 | |
| 912 | 957 | for (i = 1; i < rfb->base.format->num_planes; ++i) { |
| 958 | + drm_gem_object_get(rfb->base.obj[0]); | |
| 959 | + drm_gem_object_put(rfb->base.obj[i]); | |
| 913 | 960 | rfb->base.obj[i] = rfb->base.obj[0]; |
| 914 | − drm_gem_object_get(rfb->base.obj[i]); | |
| 915 | 961 | } |
| 916 | 962 | |
| 917 | 963 | return 0; |
| 918 | − | |
| 919 | −fail: | |
| 920 | − rfb->base.obj[0] = NULL; | |
| 921 | − return ret; | |
| 922 | 964 | } |
| 923 | 965 | |
| 924 | 966 | struct drm_framebuffer * |
| @@ -953,13 +995,15 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, · 28 unmodified lines | ||
| 953 | 995 | return ERR_PTR(-ENOMEM); |
| 954 | 996 | } |
| 955 | 997 | |
| 956 | − ret = amdgpu_display_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj); | |
| 998 | + ret = amdgpu_display_gem_fb_verify_and_init(dev, amdgpu_fb, file_priv, | |
| 999 | + mode_cmd, obj); | |
| 957 | 1000 | if (ret) { |
| 958 | 1001 | kfree(amdgpu_fb); |
| 959 | 1002 | drm_gem_object_put(obj); |
| 960 | 1003 | return ERR_PTR(ret); |
| 961 | 1004 | } |
| 962 | 1005 | |
| 1006 | + drm_gem_object_put(obj); | |
| 963 | 1007 | return &amdgpu_fb->base; |
| 964 | 1008 | } |
| 965 | 1009 | |
| @@ -321,17 +321,12 @@ static void amdgpu_dma_buf_unmap(struct dma_buf_attachment *attach, · 320 unmodified lines | ||
| 321 | 321 | struct sg_table *sgt, |
| 322 | 322 | enum dma_data_direction dir) |
| 323 | 323 | { |
| 324 | − struct dma_buf *dma_buf = attach->dmabuf; | |
| 325 | − struct drm_gem_object *obj = dma_buf->priv; | |
| 326 | − struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); | |
| 327 | − struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | |
| 328 | − | |
| 329 | 324 | if (sgt->sgl->page_link) { |
| 330 | 325 | dma_unmap_sgtable(attach->dev, sgt, dir, 0); |
| 331 | 326 | sg_free_table(sgt); |
| 332 | 327 | kfree(sgt); |
| 333 | 328 | } else { |
| 334 | − amdgpu_vram_mgr_free_sgt(adev, attach->dev, dir, sgt); | |
| 329 | + amdgpu_vram_mgr_free_sgt(attach->dev, dir, sgt); | |
| 335 | 330 | } |
| 336 | 331 | } |
| 337 | 332 | |
| @@ -434,22 +429,22 @@ amdgpu_dma_buf_create_obj(struct drm_device *dev, struct dma_buf *dma_buf) · 96 unmodified lines | ||
| 434 | 429 | { |
| 435 | 430 | struct dma_resv *resv = dma_buf->resv; |
| 436 | 431 | struct amdgpu_device *adev = drm_to_adev(dev); |
| 437 | − struct amdgpu_bo *bo; | |
| 438 | − struct amdgpu_bo_param bp; | |
| 439 | 432 | struct drm_gem_object *gobj; |
| 433 | + struct amdgpu_bo *bo; | |
| 434 | + uint64_t flags = 0; | |
| 440 | 435 | int ret; |
| 441 | 436 | |
| 442 | − memset(&bp, 0, sizeof(bp)); | |
| 443 | − bp.size = dma_buf->size; | |
| 444 | − bp.byte_align = PAGE_SIZE; | |
| 445 | − bp.domain = AMDGPU_GEM_DOMAIN_CPU; | |
| 446 | − bp.flags = 0; | |
| 447 | − bp.type = ttm_bo_type_sg; | |
| 448 | − bp.resv = resv; | |
| 449 | 437 | dma_resv_lock(resv, NULL); |
| 438 | + | |
| 439 | + if (dma_buf->ops == &amdgpu_dmabuf_ops) { | |
| 440 | + struct amdgpu_bo *other = gem_to_amdgpu_bo(dma_buf->priv); | |
| 441 | + | |
| 442 | + flags |= other->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC; | |
| 443 | + } | |
| 444 | + | |
| 450 | 445 | ret = amdgpu_gem_object_create(adev, dma_buf->size, PAGE_SIZE, |
| 451 | − AMDGPU_GEM_DOMAIN_CPU, | |
| 452 | − 0, ttm_bo_type_sg, resv, &gobj); | |
| 446 | + AMDGPU_GEM_DOMAIN_CPU, flags, | |
| 447 | + ttm_bo_type_sg, resv, &gobj); | |
| 453 | 448 | if (ret) |
| 454 | 449 | goto error; |
| 455 | 450 | |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #include "amdgpu_amdkfd.h" |
| 46 | 46 | |
| 47 | 47 | #include "amdgpu_ras.h" |
| 48 | +#include "amdgpu_xgmi.h" | |
| 48 | 49 | |
| 49 | 50 | /* |
| 50 | 51 | * KMS wrapper. |
| @@ -90,9 +91,10 @@ · 39 unmodified lines | ||
| 90 | 91 | * - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC |
| 91 | 92 | * - 3.39.0 - DMABUF implicit sync does a full pipeline sync |
| 92 | 93 | * - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ |
| 94 | + * - 3.41.0 - Add video codec query | |
| 93 | 95 | */ |
| 94 | 96 | #define KMS_DRIVER_MAJOR 3 |
| 95 | −#define KMS_DRIVER_MINOR 40 | |
| 97 | +#define KMS_DRIVER_MINOR 41 | |
| 96 | 98 | #define KMS_DRIVER_PATCHLEVEL 0 |
| 97 | 99 | |
| 98 | 100 | int amdgpu_vram_limit; |
| @@ -145,6 +147,7 @@ int amdgpu_compute_multipipe = -1; · 46 unmodified lines | ||
| 145 | 147 | int amdgpu_gpu_recovery = -1; /* auto */ |
| 146 | 148 | int amdgpu_emu_mode; |
| 147 | 149 | uint amdgpu_smu_memory_pool_size; |
| 150 | +int amdgpu_smu_pptable_id = -1; | |
| 148 | 151 | /* |
| 149 | 152 | * FBC (bit 0) disabled by default |
| 150 | 153 | * MULTI_MON_PP_MCLK_SWITCH (bit 1) enabled by default |
| @@ -162,16 +165,26 @@ int amdgpu_discovery = -1; · 11 unmodified lines | ||
| 162 | 165 | int amdgpu_mes; |
| 163 | 166 | int amdgpu_noretry = -1; |
| 164 | 167 | int amdgpu_force_asic_type = -1; |
| 165 | −int amdgpu_tmz; | |
| 168 | +int amdgpu_tmz = -1; /* auto */ | |
| 169 | +uint amdgpu_freesync_vid_mode; | |
| 166 | 170 | int amdgpu_reset_method = -1; /* auto */ |
| 167 | 171 | int amdgpu_num_kcq = -1; |
| 168 | 172 | |
| 173 | +static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); | |
| 174 | + | |
| 169 | 175 | struct amdgpu_mgpu_info mgpu_info = { |
| 170 | 176 | .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), |
| 177 | + .delayed_reset_work = __DELAYED_WORK_INITIALIZER( | |
| 178 | + mgpu_info.delayed_reset_work, | |
| 179 | + amdgpu_drv_delayed_reset_work_handler, 0), | |
| 171 | 180 | }; |
| 172 | 181 | int amdgpu_ras_enable = -1; |
| 173 | 182 | uint amdgpu_ras_mask = 0xffffffff; |
| 174 | 183 | int amdgpu_bad_page_threshold = -1; |
| 184 | +struct amdgpu_watchdog_timer amdgpu_watchdog_timer = { | |
| 185 | + .timeout_fatal_disable = false, | |
| 186 | + .period = 0x23, /* default to max. timeout = 1 << 0x23 cycles */ | |
| 187 | +}; | |
| 175 | 188 | |
| 176 | 189 | /** |
| 177 | 190 | * DOC: vramlimit (int) |
| @@ -527,6 +540,20 @@ module_param_named(ras_enable, amdgpu_ras_enable, int, 0444); · 349 unmodified lines | ||
| 527 | 540 | MODULE_PARM_DESC(ras_mask, "Mask of RAS features to enable (default 0xffffffff), only valid when ras_enable == 1"); |
| 528 | 541 | module_param_named(ras_mask, amdgpu_ras_mask, uint, 0444); |
| 529 | 542 | |
| 543 | +/** | |
| 544 | + * DOC: timeout_fatal_disable (bool) | |
| 545 | + * Disable Watchdog timeout fatal error event | |
| 546 | + */ | |
| 547 | +MODULE_PARM_DESC(timeout_fatal_disable, "disable watchdog timeout fatal error (false = default)"); | |
| 548 | +module_param_named(timeout_fatal_disable, amdgpu_watchdog_timer.timeout_fatal_disable, bool, 0644); | |
| 549 | + | |
| 550 | +/** | |
| 551 | + * DOC: timeout_period (uint) | |
| 552 | + * Modify the watchdog timeout max_cycles as (1 << period) | |
| 553 | + */ | |
| 554 | +MODULE_PARM_DESC(timeout_period, "watchdog timeout period (1 to 0x23(default), timeout maxCycles = (1 << period)"); | |
| 555 | +module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644); | |
| 556 | + | |
| 530 | 557 | /** |
| 531 | 558 | * DOC: si_support (int) |
| 532 | 559 | * Set SI support driver. This parameter works after set config CONFIG_DRM_AMDGPU_SI. For SI asic, when radeon driver is enabled, |
| @@ -748,6 +775,13 @@ bool no_system_mem_limit; · 215 unmodified lines | ||
| 748 | 775 | module_param(no_system_mem_limit, bool, 0644); |
| 749 | 776 | MODULE_PARM_DESC(no_system_mem_limit, "disable system memory limit (false = default)"); |
| 750 | 777 | |
| 778 | +/** | |
| 779 | + * DOC: no_queue_eviction_on_vm_fault (int) | |
| 780 | + * If set, process queues will not be evicted on gpuvm fault. This is to keep the wavefront context for debugging (0 = queue eviction, 1 = no queue eviction). The default is 0 (queue eviction). | |
| 781 | + */ | |
| 782 | +int amdgpu_no_queue_eviction_on_vm_fault = 0; | |
| 783 | +MODULE_PARM_DESC(no_queue_eviction_on_vm_fault, "No queue eviction on VM fault (0 = queue eviction, 1 = no queue eviction)"); | |
| 784 | +module_param_named(no_queue_eviction_on_vm_fault, amdgpu_no_queue_eviction_on_vm_fault, int, 0444); | |
| 751 | 785 | #endif |
| 752 | 786 | |
| 753 | 787 | /** |
| @@ -792,9 +826,20 @@ module_param_named(backlight, amdgpu_backlight, bint, 0444); · 38 unmodified lines | ||
| 792 | 826 | * |
| 793 | 827 | * The default value: 0 (off). TODO: change to auto till it is completed. |
| 794 | 828 | */ |
| 795 | −MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto, 0 = off (default), 1 = on)"); | |
| 829 | +MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto (default), 0 = off, 1 = on)"); | |
| 796 | 830 | module_param_named(tmz, amdgpu_tmz, int, 0444); |
| 797 | 831 | |
| 832 | +/** | |
| 833 | + * DOC: freesync_video (uint) | |
| 834 | + * Enabled the optimization to adjust front porch timing to achieve seamless mode change experience | |
| 835 | + * when setting a freesync supported mode for which full modeset is not needed. | |
| 836 | + * The default value: 0 (off). | |
| 837 | + */ | |
| 838 | +MODULE_PARM_DESC( | |
| 839 | + freesync_video, | |
| 840 | + "Enable freesync modesetting optimization feature (0 = off (default), 1 = on)"); | |
| 841 | +module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444); | |
| 842 | + | |
| 798 | 843 | /** |
| 799 | 844 | * DOC: reset_method (int) |
| 800 | 845 | * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco, 5 = pci) |
| @@ -815,6 +860,15 @@ module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444); · 14 unmodified lines | ||
| 815 | 860 | MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup (8 if set to greater than 8 or less than 0, only affect gfx 8+)"); |
| 816 | 861 | module_param_named(num_kcq, amdgpu_num_kcq, int, 0444); |
| 817 | 862 | |
| 863 | +/** | |
| 864 | + * DOC: smu_pptable_id (int) | |
| 865 | + * Used to override pptable id. id = 0 use VBIOS pptable. | |
| 866 | + * id > 0 use the soft pptable with specicfied id. | |
| 867 | + */ | |
| 868 | +MODULE_PARM_DESC(smu_pptable_id, | |
| 869 | + "specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)"); | |
| 870 | +module_param_named(smu_pptable_id, amdgpu_smu_pptable_id, int, 0444); | |
| 871 | + | |
| 818 | 872 | static const struct pci_device_id pciidlist[] = { |
| 819 | 873 | #ifdef CONFIG_DRM_AMDGPU_SI |
| 820 | 874 | {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI}, |
| @@ -1124,6 +1178,11 @@ static const struct pci_device_id pciidlist[] = { · 303 unmodified lines | ||
| 1124 | 1178 | {0x1002, 0x73E2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_DIMGREY_CAVEFISH}, |
| 1125 | 1179 | {0x1002, 0x73FF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_DIMGREY_CAVEFISH}, |
| 1126 | 1180 | |
| 1181 | + /* Aldebaran */ | |
| 1182 | + {0x1002, 0x7408, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT}, | |
| 1183 | + {0x1002, 0x740C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT}, | |
| 1184 | + {0x1002, 0x740F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ALDEBARAN|AMD_EXP_HW_SUPPORT}, | |
| 1185 | + | |
| 1127 | 1186 | {0, 0, 0} |
| 1128 | 1187 | }; |
| 1129 | 1188 | |
| @@ -1280,6 +1339,69 @@ amdgpu_pci_shutdown(struct pci_dev *pdev) · 150 unmodified lines | ||
| 1280 | 1339 | adev->mp1_state = PP_MP1_STATE_NONE; |
| 1281 | 1340 | } |
| 1282 | 1341 | |
| 1342 | +/** | |
| 1343 | + * amdgpu_drv_delayed_reset_work_handler - work handler for reset | |
| 1344 | + * | |
| 1345 | + * @work: work_struct. | |
| 1346 | + */ | |
| 1347 | +static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work) | |
| 1348 | +{ | |
| 1349 | + struct list_head device_list; | |
| 1350 | + struct amdgpu_device *adev; | |
| 1351 | + int i, r; | |
| 1352 | + bool need_full_reset = true; | |
| 1353 | + | |
| 1354 | + mutex_lock(&mgpu_info.mutex); | |
| 1355 | + if (mgpu_info.pending_reset == true) { | |
| 1356 | + mutex_unlock(&mgpu_info.mutex); | |
| 1357 | + return; | |
| 1358 | + } | |
| 1359 | + mgpu_info.pending_reset = true; | |
| 1360 | + mutex_unlock(&mgpu_info.mutex); | |
| 1361 | + | |
| 1362 | + for (i = 0; i < mgpu_info.num_dgpu; i++) { | |
| 1363 | + adev = mgpu_info.gpu_ins[i].adev; | |
| 1364 | + r = amdgpu_device_pre_asic_reset(adev, NULL, &need_full_reset); | |
| 1365 | + if (r) { | |
| 1366 | + dev_err(adev->dev, "GPU pre asic reset failed with err, %d for drm dev, %s ", | |
| 1367 | + r, adev_to_drm(adev)->unique); | |
| 1368 | + } | |
| 1369 | + if (!queue_work(system_unbound_wq, &adev->xgmi_reset_work)) | |
| 1370 | + r = -EALREADY; | |
| 1371 | + } | |
| 1372 | + for (i = 0; i < mgpu_info.num_dgpu; i++) { | |
| 1373 | + adev = mgpu_info.gpu_ins[i].adev; | |
| 1374 | + flush_work(&adev->xgmi_reset_work); | |
| 1375 | + adev->gmc.xgmi.pending_reset = false; | |
| 1376 | + } | |
| 1377 | + | |
| 1378 | + /* reset function will rebuild the xgmi hive info , clear it now */ | |
| 1379 | + for (i = 0; i < mgpu_info.num_dgpu; i++) | |
| 1380 | + amdgpu_xgmi_remove_device(mgpu_info.gpu_ins[i].adev); | |
| 1381 | + | |
| 1382 | + INIT_LIST_HEAD(&device_list); | |
| 1383 | + | |
| 1384 | + for (i = 0; i < mgpu_info.num_dgpu; i++) | |
| 1385 | + list_add_tail(&mgpu_info.gpu_ins[i].adev->reset_list, &device_list); | |
| 1386 | + | |
| 1387 | + /* unregister the GPU first, reset function will add them back */ | |
| 1388 | + list_for_each_entry(adev, &device_list, reset_list) | |
| 1389 | + amdgpu_unregister_gpu_instance(adev); | |
| 1390 | + | |
| 1391 | + r = amdgpu_do_asic_reset(NULL, &device_list, &need_full_reset, true); | |
| 1392 | + if (r) { | |
| 1393 | + DRM_ERROR("reinit gpus failure"); | |
| 1394 | + return; | |
| 1395 | + } | |
| 1396 | + for (i = 0; i < mgpu_info.num_dgpu; i++) { | |
| 1397 | + adev = mgpu_info.gpu_ins[i].adev; | |
| 1398 | + if (!adev->kfd.init_complete) | |
| 1399 | + amdgpu_amdkfd_device_init(adev); | |
| 1400 | + amdgpu_ttm_set_buffer_funcs_status(adev, true); | |
| 1401 | + } | |
| 1402 | + return; | |
| 1403 | +} | |
| 1404 | + | |
| 1283 | 1405 | static int amdgpu_pmops_suspend(struct device *dev) |
| 1284 | 1406 | { |
| 1285 | 1407 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
| @@ -232,8 +232,8 @@ static int amdgpufb_create(struct drm_fb_helper *helper, · 231 unmodified lines | ||
| 232 | 232 | goto out; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | − ret = amdgpu_display_framebuffer_init(adev_to_drm(adev), &rfbdev->rfb, | |
| 236 | − &mode_cmd, gobj); | |
| 235 | + ret = amdgpu_display_gem_fb_init(adev_to_drm(adev), &rfbdev->rfb, | |
| 236 | + &mode_cmd, gobj); | |
| 237 | 237 | if (ret) { |
| 238 | 238 | DRM_ERROR("failed to initialize framebuffer %d\n", ret); |
| 239 | 239 | goto out; |
| @@ -36,8 +36,6 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <linux/firmware.h> |
| 37 | 37 | #include <linux/pm_runtime.h> |
| 38 | 38 | |
| 39 | −#include <drm/drm_debugfs.h> | |
| 40 | − | |
| 41 | 39 | #include "amdgpu.h" |
| 42 | 40 | #include "amdgpu_trace.h" |
| 43 | 41 | |
| @@ -533,6 +531,8 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) · 489 unmodified lines | ||
| 533 | 531 | |
| 534 | 532 | if (!ring || !ring->fence_drv.initialized) |
| 535 | 533 | continue; |
| 534 | + if (!ring->no_scheduler) | |
| 535 | + drm_sched_fini(&ring->sched); | |
| 536 | 536 | r = amdgpu_fence_wait_empty(ring); |
| 537 | 537 | if (r) { |
| 538 | 538 | /* no need to trigger GPU reset as we are unloading */ |
| @@ -541,8 +541,7 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) · 2 unmodified lines | ||
| 541 | 541 | if (ring->fence_drv.irq_src) |
| 542 | 542 | amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
| 543 | 543 | ring->fence_drv.irq_type); |
| 544 | − if (!ring->no_scheduler) | |
| 545 | − drm_sched_fini(&ring->sched); | |
| 544 | + | |
| 546 | 545 | del_timer_sync(&ring->fence_drv.fallback_timer); |
| 547 | 546 | for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) |
| 548 | 547 | dma_fence_put(ring->fence_drv.fences[j]); |
| @@ -697,11 +696,9 @@ static const struct dma_fence_ops amdgpu_fence_ops = { · 148 unmodified lines | ||
| 697 | 696 | * Fence debugfs |
| 698 | 697 | */ |
| 699 | 698 | #if defined(CONFIG_DEBUG_FS) |
| 700 | −static int amdgpu_debugfs_fence_info(struct seq_file *m, void *data) | |
| 699 | +static int amdgpu_debugfs_fence_info_show(struct seq_file *m, void *unused) | |
| 701 | 700 | { |
| 702 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 703 | − struct drm_device *dev = node->minor->dev; | |
| 704 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 701 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 705 | 702 | int i; |
| 706 | 703 | |
| 707 | 704 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
| @@ -746,11 +743,10 @@ static int amdgpu_debugfs_fence_info(struct seq_file *m, void *data) · 38 unmodified lines | ||
| 746 | 743 | * |
| 747 | 744 | * Manually trigger a gpu reset at the next fence wait. |
| 748 | 745 | */ |
| 749 | −static int amdgpu_debugfs_gpu_recover(struct seq_file *m, void *data) | |
| 746 | +static int gpu_recover_get(void *data, u64 *val) | |
| 750 | 747 | { |
| 751 | − struct drm_info_node *node = (struct drm_info_node *) m->private; | |
| 752 | − struct drm_device *dev = node->minor->dev; | |
| 753 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 748 | + struct amdgpu_device *adev = (struct amdgpu_device *)data; | |
| 749 | + struct drm_device *dev = adev_to_drm(adev); | |
| 754 | 750 | int r; |
| 755 | 751 | |
| 756 | 752 | r = pm_runtime_get_sync(dev->dev); |
| @@ -759,8 +755,7 @@ static int amdgpu_debugfs_gpu_recover(struct seq_file *m, void *data) · 2 unmodified lines | ||
| 759 | 755 | return 0; |
| 760 | 756 | } |
| 761 | 757 | |
| 762 | − seq_printf(m, "gpu recover\n"); | |
| 763 | − amdgpu_device_gpu_recover(adev, NULL); | |
| 758 | + *val = amdgpu_device_gpu_recover(adev, NULL); | |
| 764 | 759 | |
| 765 | 760 | pm_runtime_mark_last_busy(dev->dev); |
| 766 | 761 | pm_runtime_put_autosuspend(dev->dev); |
| @@ -768,26 +763,24 @@ static int amdgpu_debugfs_gpu_recover(struct seq_file *m, void *data) · 1 unmodified line | ||
| 768 | 763 | return 0; |
| 769 | 764 | } |
| 770 | 765 | |
| 771 | −static const struct drm_info_list amdgpu_debugfs_fence_list[] = { | |
| 772 | − {"amdgpu_fence_info", &amdgpu_debugfs_fence_info, 0, NULL}, | |
| 773 | − {"amdgpu_gpu_recover", &amdgpu_debugfs_gpu_recover, 0, NULL} | |
| 774 | −}; | |
| 766 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_fence_info); | |
| 767 | +DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_debugfs_gpu_recover_fops, gpu_recover_get, NULL, | |
| 768 | + "%lld\n"); | |
| 775 | 769 | |
| 776 | −static const struct drm_info_list amdgpu_debugfs_fence_list_sriov[] = { | |
| 777 | − {"amdgpu_fence_info", &amdgpu_debugfs_fence_info, 0, NULL}, | |
| 778 | −}; | |
| 779 | 770 | #endif |
| 780 | 771 | |
| 781 | −int amdgpu_debugfs_fence_init(struct amdgpu_device *adev) | |
| 772 | +void amdgpu_debugfs_fence_init(struct amdgpu_device *adev) | |
| 782 | 773 | { |
| 783 | 774 | #if defined(CONFIG_DEBUG_FS) |
| 784 | − if (amdgpu_sriov_vf(adev)) | |
| 785 | − return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_fence_list_sriov, | |
| 786 | − ARRAY_SIZE(amdgpu_debugfs_fence_list_sriov)); | |
| 787 | − return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_fence_list, | |
| 788 | − ARRAY_SIZE(amdgpu_debugfs_fence_list)); | |
| 789 | −#else | |
| 790 | − return 0; | |
| 775 | + struct drm_minor *minor = adev_to_drm(adev)->primary; | |
| 776 | + struct dentry *root = minor->debugfs_root; | |
| 777 | + | |
| 778 | + debugfs_create_file("amdgpu_fence_info", 0444, root, adev, | |
| 779 | + &amdgpu_debugfs_fence_info_fops); | |
| 780 | + | |
| 781 | + if (!amdgpu_sriov_vf(adev)) | |
| 782 | + debugfs_create_file("amdgpu_gpu_recover", 0444, root, adev, | |
| 783 | + &amdgpu_debugfs_gpu_recover_fops); | |
| 791 | 784 | #endif |
| 792 | 785 | } |
| 793 | 786 | |
| @@ -202,6 +202,7 @@ void amdgpu_gart_table_vram_free(struct amdgpu_device *adev) · 201 unmodified lines | ||
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | amdgpu_bo_unref(&adev->gart.bo); |
| 205 | + adev->gart.ptr = NULL; | |
| 205 | 206 | } |
| 206 | 207 | |
| 207 | 208 | /* |
| @@ -236,9 +237,6 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset, · 28 unmodified lines | ||
| 236 | 237 | t = offset / AMDGPU_GPU_PAGE_SIZE; |
| 237 | 238 | p = t / AMDGPU_GPU_PAGES_IN_CPU_PAGE; |
| 238 | 239 | for (i = 0; i < pages; i++, p++) { |
| 239 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 240 | − adev->gart.pages[p] = NULL; | |
| 241 | −#endif | |
| 242 | 240 | page_base = adev->dummy_page_addr; |
| 243 | 241 | if (!adev->gart.ptr) |
| 244 | 242 | continue; |
| @@ -312,9 +310,6 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset, · 67 unmodified lines | ||
| 312 | 310 | int pages, struct page **pagelist, dma_addr_t *dma_addr, |
| 313 | 311 | uint64_t flags) |
| 314 | 312 | { |
| 315 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 316 | − unsigned t,p; | |
| 317 | −#endif | |
| 318 | 313 | int r, i; |
| 319 | 314 | |
| 320 | 315 | if (!adev->gart.ready) { |
| @@ -322,13 +317,6 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset, · 1 unmodified line | ||
| 322 | 317 | return -EINVAL; |
| 323 | 318 | } |
| 324 | 319 | |
| 325 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 326 | − t = offset / AMDGPU_GPU_PAGE_SIZE; | |
| 327 | − p = t / AMDGPU_GPU_PAGES_IN_CPU_PAGE; | |
| 328 | − for (i = 0; i < pages; i++, p++) | |
| 329 | − adev->gart.pages[p] = pagelist ? pagelist[i] : NULL; | |
| 330 | −#endif | |
| 331 | − | |
| 332 | 320 | if (!adev->gart.ptr) |
| 333 | 321 | return 0; |
| 334 | 322 | |
| @@ -373,14 +361,6 @@ int amdgpu_gart_init(struct amdgpu_device *adev) · 38 unmodified lines | ||
| 373 | 361 | DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n", |
| 374 | 362 | adev->gart.num_cpu_pages, adev->gart.num_gpu_pages); |
| 375 | 363 | |
| 376 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 377 | − /* Allocate pages table */ | |
| 378 | − adev->gart.pages = vzalloc(array_size(sizeof(void *), | |
| 379 | − adev->gart.num_cpu_pages)); | |
| 380 | − if (adev->gart.pages == NULL) | |
| 381 | − return -ENOMEM; | |
| 382 | −#endif | |
| 383 | − | |
| 384 | 364 | return 0; |
| 385 | 365 | } |
| 386 | 366 | |
| @@ -393,9 +373,5 @@ int amdgpu_gart_init(struct amdgpu_device *adev) · 6 unmodified lines | ||
| 393 | 373 | */ |
| 394 | 374 | void amdgpu_gart_fini(struct amdgpu_device *adev) |
| 395 | 375 | { |
| 396 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 397 | − vfree(adev->gart.pages); | |
| 398 | − adev->gart.pages = NULL; | |
| 399 | −#endif | |
| 400 | 376 | amdgpu_gart_dummy_page_fini(adev); |
| 401 | 377 | } |
| @@ -46,9 +46,6 @@ struct amdgpu_gart { · 45 unmodified lines | ||
| 46 | 46 | unsigned num_gpu_pages; |
| 47 | 47 | unsigned num_cpu_pages; |
| 48 | 48 | unsigned table_size; |
| 49 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 50 | − struct page **pages; | |
| 51 | −#endif | |
| 52 | 49 | bool ready; |
| 53 | 50 | |
| 54 | 51 | /* Asic default pte flags */ |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | ||
| 32 | 32 | #include <linux/dma-buf.h> |
| 33 | 33 | |
| 34 | 34 | #include <drm/amdgpu_drm.h> |
| 35 | −#include <drm/drm_debugfs.h> | |
| 36 | 35 | #include <drm/drm_gem_ttm_helper.h> |
| 37 | 36 | |
| 38 | 37 | #include "amdgpu.h" |
| @@ -855,10 +854,10 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, · 816 unmodified lines | ||
| 855 | 854 | } |
| 856 | 855 | |
| 857 | 856 | #if defined(CONFIG_DEBUG_FS) |
| 858 | −static int amdgpu_debugfs_gem_info(struct seq_file *m, void *data) | |
| 857 | +static int amdgpu_debugfs_gem_info_show(struct seq_file *m, void *unused) | |
| 859 | 858 | { |
| 860 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 861 | − struct drm_device *dev = node->minor->dev; | |
| 859 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 860 | + struct drm_device *dev = adev_to_drm(adev); | |
| 862 | 861 | struct drm_file *file; |
| 863 | 862 | int r; |
| 864 | 863 | |
| @@ -896,16 +895,17 @@ static int amdgpu_debugfs_gem_info(struct seq_file *m, void *data) · 31 unmodified lines | ||
| 896 | 895 | return 0; |
| 897 | 896 | } |
| 898 | 897 | |
| 899 | −static const struct drm_info_list amdgpu_debugfs_gem_list[] = { | |
| 900 | − {"amdgpu_gem_info", &amdgpu_debugfs_gem_info, 0, NULL}, | |
| 901 | −}; | |
| 898 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_gem_info); | |
| 899 | + | |
| 902 | 900 | #endif |
| 903 | 901 | |
| 904 | −int amdgpu_debugfs_gem_init(struct amdgpu_device *adev) | |
| 902 | +void amdgpu_debugfs_gem_init(struct amdgpu_device *adev) | |
| 905 | 903 | { |
| 906 | 904 | #if defined(CONFIG_DEBUG_FS) |
| 907 | − return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_gem_list, | |
| 908 | − ARRAY_SIZE(amdgpu_debugfs_gem_list)); | |
| 905 | + struct drm_minor *minor = adev_to_drm(adev)->primary; | |
| 906 | + struct dentry *root = minor->debugfs_root; | |
| 907 | + | |
| 908 | + debugfs_create_file("amdgpu_gem_info", 0444, root, adev, | |
| 909 | + &amdgpu_debugfs_gem_info_fops); | |
| 909 | 910 | #endif |
| 910 | − return 0; | |
| 911 | 911 | } |
| @@ -601,6 +601,7 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev) · 600 unmodified lines | ||
| 601 | 601 | struct ras_ih_if ih_info = { |
| 602 | 602 | .cb = amdgpu_gfx_process_ras_data_cb, |
| 603 | 603 | }; |
| 604 | + struct ras_query_if info = { 0 }; | |
| 604 | 605 | |
| 605 | 606 | if (!adev->gfx.ras_if) { |
| 606 | 607 | adev->gfx.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL); |
| @@ -612,13 +613,19 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev) · 5 unmodified lines | ||
| 612 | 613 | strcpy(adev->gfx.ras_if->name, "gfx"); |
| 613 | 614 | } |
| 614 | 615 | fs_info.head = ih_info.head = *adev->gfx.ras_if; |
| 615 | − | |
| 616 | 616 | r = amdgpu_ras_late_init(adev, adev->gfx.ras_if, |
| 617 | 617 | &fs_info, &ih_info); |
| 618 | 618 | if (r) |
| 619 | 619 | goto free; |
| 620 | 620 | |
| 621 | 621 | if (amdgpu_ras_is_supported(adev, adev->gfx.ras_if->block)) { |
| 622 | + if (adev->gmc.xgmi.connected_to_cpu) { | |
| 623 | + info.head = *adev->gfx.ras_if; | |
| 624 | + amdgpu_ras_query_error_status(adev, &info); | |
| 625 | + } else { | |
| 626 | + amdgpu_ras_reset_error_status(adev, AMDGPU_RAS_BLOCK__GFX); | |
| 627 | + } | |
| 628 | + | |
| 622 | 629 | r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0); |
| 623 | 630 | if (r) |
| 624 | 631 | goto late_fini; |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "clearstate_defs.h" |
| 31 | 31 | #include "amdgpu_ring.h" |
| 32 | 32 | #include "amdgpu_rlc.h" |
| 33 | +#include "soc15.h" | |
| 33 | 34 | |
| 34 | 35 | /* GFX current status */ |
| 35 | 36 | #define AMDGPU_GFX_NORMAL_MODE 0x00000000L |
| @@ -224,7 +225,9 @@ struct amdgpu_gfx_funcs { · 188 unmodified lines | ||
| 224 | 225 | void (*reset_ras_error_count) (struct amdgpu_device *adev); |
| 225 | 226 | void (*init_spm_golden)(struct amdgpu_device *adev); |
| 226 | 227 | void (*query_ras_error_status) (struct amdgpu_device *adev); |
| 228 | + void (*reset_ras_error_status) (struct amdgpu_device *adev); | |
| 227 | 229 | void (*update_perfmon_mgcg)(struct amdgpu_device *adev, bool enable); |
| 230 | + void (*enable_watchdog_timer)(struct amdgpu_device *adev); | |
| 228 | 231 | }; |
| 229 | 232 | |
| 230 | 233 | struct sq_work { |
| @@ -31,6 +31,57 @@ · 30 unmodified lines | ||
| 31 | 31 | #include "amdgpu_ras.h" |
| 32 | 32 | #include "amdgpu_xgmi.h" |
| 33 | 33 | |
| 34 | +/** | |
| 35 | + * amdgpu_gmc_pdb0_alloc - allocate vram for pdb0 | |
| 36 | + * | |
| 37 | + * @adev: amdgpu_device pointer | |
| 38 | + * | |
| 39 | + * Allocate video memory for pdb0 and map it for CPU access | |
| 40 | + * Returns 0 for success, error for failure. | |
| 41 | + */ | |
| 42 | +int amdgpu_gmc_pdb0_alloc(struct amdgpu_device *adev) | |
| 43 | +{ | |
| 44 | + int r; | |
| 45 | + struct amdgpu_bo_param bp; | |
| 46 | + u64 vram_size = adev->gmc.xgmi.node_segment_size * adev->gmc.xgmi.num_physical_nodes; | |
| 47 | + uint32_t pde0_page_shift = adev->gmc.vmid0_page_table_block_size + 21; | |
| 48 | + uint32_t npdes = (vram_size + (1ULL << pde0_page_shift) -1) >> pde0_page_shift; | |
| 49 | + | |
| 50 | + memset(&bp, 0, sizeof(bp)); | |
| 51 | + bp.size = PAGE_ALIGN((npdes + 1) * 8); | |
| 52 | + bp.byte_align = PAGE_SIZE; | |
| 53 | + bp.domain = AMDGPU_GEM_DOMAIN_VRAM; | |
| 54 | + bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | |
| 55 | + AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS; | |
| 56 | + bp.type = ttm_bo_type_kernel; | |
| 57 | + bp.resv = NULL; | |
| 58 | + r = amdgpu_bo_create(adev, &bp, &adev->gmc.pdb0_bo); | |
| 59 | + if (r) | |
| 60 | + return r; | |
| 61 | + | |
| 62 | + r = amdgpu_bo_reserve(adev->gmc.pdb0_bo, false); | |
| 63 | + if (unlikely(r != 0)) | |
| 64 | + goto bo_reserve_failure; | |
| 65 | + | |
| 66 | + r = amdgpu_bo_pin(adev->gmc.pdb0_bo, AMDGPU_GEM_DOMAIN_VRAM); | |
| 67 | + if (r) | |
| 68 | + goto bo_pin_failure; | |
| 69 | + r = amdgpu_bo_kmap(adev->gmc.pdb0_bo, &adev->gmc.ptr_pdb0); | |
| 70 | + if (r) | |
| 71 | + goto bo_kmap_failure; | |
| 72 | + | |
| 73 | + amdgpu_bo_unreserve(adev->gmc.pdb0_bo); | |
| 74 | + return 0; | |
| 75 | + | |
| 76 | +bo_kmap_failure: | |
| 77 | + amdgpu_bo_unpin(adev->gmc.pdb0_bo); | |
| 78 | +bo_pin_failure: | |
| 79 | + amdgpu_bo_unreserve(adev->gmc.pdb0_bo); | |
| 80 | +bo_reserve_failure: | |
| 81 | + amdgpu_bo_unref(&adev->gmc.pdb0_bo); | |
| 82 | + return r; | |
| 83 | +} | |
| 84 | + | |
| 34 | 85 | /** |
| 35 | 86 | * amdgpu_gmc_get_pde_for_bo - get the PDE for a BO |
| 36 | 87 | * |
| @@ -158,6 +209,39 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc, · 121 unmodified lines | ||
| 158 | 209 | mc->vram_end, mc->real_vram_size >> 20); |
| 159 | 210 | } |
| 160 | 211 | |
| 212 | +/** amdgpu_gmc_sysvm_location - place vram and gart in sysvm aperture | |
| 213 | + * | |
| 214 | + * @adev: amdgpu device structure holding all necessary information | |
| 215 | + * @mc: memory controller structure holding memory information | |
| 216 | + * | |
| 217 | + * This function is only used if use GART for FB translation. In such | |
| 218 | + * case, we use sysvm aperture (vmid0 page tables) for both vram | |
| 219 | + * and gart (aka system memory) access. | |
| 220 | + * | |
| 221 | + * GPUVM (and our organization of vmid0 page tables) require sysvm | |
| 222 | + * aperture to be placed at a location aligned with 8 times of native | |
| 223 | + * page size. For example, if vm_context0_cntl.page_table_block_size | |
| 224 | + * is 12, then native page size is 8G (2M*2^12), sysvm should start | |
| 225 | + * with a 64G aligned address. For simplicity, we just put sysvm at | |
| 226 | + * address 0. So vram start at address 0 and gart is right after vram. | |
| 227 | + */ | |
| 228 | +void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) | |
| 229 | +{ | |
| 230 | + u64 hive_vram_start = 0; | |
| 231 | + u64 hive_vram_end = mc->xgmi.node_segment_size * mc->xgmi.num_physical_nodes - 1; | |
| 232 | + mc->vram_start = mc->xgmi.node_segment_size * mc->xgmi.physical_node_id; | |
| 233 | + mc->vram_end = mc->vram_start + mc->xgmi.node_segment_size - 1; | |
| 234 | + mc->gart_start = hive_vram_end + 1; | |
| 235 | + mc->gart_end = mc->gart_start + mc->gart_size - 1; | |
| 236 | + mc->fb_start = hive_vram_start; | |
| 237 | + mc->fb_end = hive_vram_end; | |
| 238 | + dev_info(adev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", | |
| 239 | + mc->mc_vram_size >> 20, mc->vram_start, | |
| 240 | + mc->vram_end, mc->real_vram_size >> 20); | |
| 241 | + dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n", | |
| 242 | + mc->gart_size >> 20, mc->gart_start, mc->gart_end); | |
| 243 | +} | |
| 244 | + | |
| 161 | 245 | /** |
| 162 | 246 | * amdgpu_gmc_gart_location - try to find GART location |
| 163 | 247 | * |
| @@ -165,7 +249,6 @@ void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc, · 1 unmodified line | ||
| 165 | 249 | * @mc: memory controller structure holding memory information |
| 166 | 250 | * |
| 167 | 251 | * Function will place try to place GART before or after VRAM. |
| 168 | − * | |
| 169 | 252 | * If GART size is bigger than space left then we ajust GART size. |
| 170 | 253 | * Thus function will never fails. |
| 171 | 254 | */ |
| @@ -176,8 +259,6 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) · 4 unmodified lines | ||
| 176 | 259 | /*To avoid the hole, limit the max mc address to AMDGPU_GMC_HOLE_START*/ |
| 177 | 260 | u64 max_mc_address = min(adev->gmc.mc_mask, AMDGPU_GMC_HOLE_START - 1); |
| 178 | 261 | |
| 179 | − mc->gart_size += adev->pm.smu_prv_buffer_size; | |
| 180 | − | |
| 181 | 262 | /* VCE doesn't like it when BOs cross a 4GB segment, so align |
| 182 | 263 | * the GART base on a 4GB boundary as well. |
| 183 | 264 | */ |
| @@ -384,6 +465,16 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev) · 200 unmodified lines | ||
| 384 | 465 | { |
| 385 | 466 | switch (adev->asic_type) { |
| 386 | 467 | case CHIP_RAVEN: |
| 468 | + if (amdgpu_tmz == 0) { | |
| 469 | + adev->gmc.tmz_enabled = false; | |
| 470 | + dev_info(adev->dev, | |
| 471 | + "Trusted Memory Zone (TMZ) feature disabled (cmd line)\n"); | |
| 472 | + } else { | |
| 473 | + adev->gmc.tmz_enabled = true; | |
| 474 | + dev_info(adev->dev, | |
| 475 | + "Trusted Memory Zone (TMZ) feature enabled\n"); | |
| 476 | + } | |
| 477 | + break; | |
| 387 | 478 | case CHIP_RENOIR: |
| 388 | 479 | case CHIP_NAVI10: |
| 389 | 480 | case CHIP_NAVI14: |
| @@ -423,6 +514,7 @@ void amdgpu_gmc_noretry_set(struct amdgpu_device *adev) · 33 unmodified lines | ||
| 423 | 514 | switch (adev->asic_type) { |
| 424 | 515 | case CHIP_VEGA10: |
| 425 | 516 | case CHIP_VEGA20: |
| 517 | + case CHIP_ALDEBARAN: | |
| 426 | 518 | /* |
| 427 | 519 | * noretry = 0 will cause kfd page fault tests fail |
| 428 | 520 | * for some ASICs, so set default to 1 for these ASICs. |
| @@ -518,3 +610,55 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) · 89 unmodified lines | ||
| 518 | 610 | adev->mman.stolen_extended_size = 0; |
| 519 | 611 | } |
| 520 | 612 | } |
| 613 | + | |
| 614 | +/** | |
| 615 | + * amdgpu_gmc_init_pdb0 - initialize PDB0 | |
| 616 | + * | |
| 617 | + * @adev: amdgpu_device pointer | |
| 618 | + * | |
| 619 | + * This function is only used when GART page table is used | |
| 620 | + * for FB address translatioin. In such a case, we construct | |
| 621 | + * a 2-level system VM page table: PDB0->PTB, to cover both | |
| 622 | + * VRAM of the hive and system memory. | |
| 623 | + * | |
| 624 | + * PDB0 is static, initialized once on driver initialization. | |
| 625 | + * The first n entries of PDB0 are used as PTE by setting | |
| 626 | + * P bit to 1, pointing to VRAM. The n+1'th entry points | |
| 627 | + * to a big PTB covering system memory. | |
| 628 | + * | |
| 629 | + */ | |
| 630 | +void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev) | |
| 631 | +{ | |
| 632 | + int i; | |
| 633 | + uint64_t flags = adev->gart.gart_pte_flags; //TODO it is UC. explore NC/RW? | |
| 634 | + /* Each PDE0 (used as PTE) covers (2^vmid0_page_table_block_size)*2M | |
| 635 | + */ | |
| 636 | + u64 vram_size = adev->gmc.xgmi.node_segment_size * adev->gmc.xgmi.num_physical_nodes; | |
| 637 | + u64 pde0_page_size = (1ULL<<adev->gmc.vmid0_page_table_block_size)<<21; | |
| 638 | + u64 vram_addr = adev->vm_manager.vram_base_offset - | |
| 639 | + adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; | |
| 640 | + u64 vram_end = vram_addr + vram_size; | |
| 641 | + u64 gart_ptb_gpu_pa = amdgpu_bo_gpu_offset(adev->gart.bo) + | |
| 642 | + adev->vm_manager.vram_base_offset - adev->gmc.vram_start; | |
| 643 | + | |
| 644 | + flags |= AMDGPU_PTE_VALID | AMDGPU_PTE_READABLE; | |
| 645 | + flags |= AMDGPU_PTE_WRITEABLE; | |
| 646 | + flags |= AMDGPU_PTE_SNOOPED; | |
| 647 | + flags |= AMDGPU_PTE_FRAG((adev->gmc.vmid0_page_table_block_size + 9*1)); | |
| 648 | + flags |= AMDGPU_PDE_PTE; | |
| 649 | + | |
| 650 | + /* The first n PDE0 entries are used as PTE, | |
| 651 | + * pointing to vram | |
| 652 | + */ | |
| 653 | + for (i = 0; vram_addr < vram_end; i++, vram_addr += pde0_page_size) | |
| 654 | + amdgpu_gmc_set_pte_pde(adev, adev->gmc.ptr_pdb0, i, vram_addr, flags); | |
| 655 | + | |
| 656 | + /* The n+1'th PDE0 entry points to a huge | |
| 657 | + * PTB who has more than 512 entries each | |
| 658 | + * pointing to a 4K system page | |
| 659 | + */ | |
| 660 | + flags = AMDGPU_PTE_VALID; | |
| 661 | + flags |= AMDGPU_PDE_BFS(0) | AMDGPU_PTE_SNOOPED; | |
| 662 | + /* Requires gart_ptb_gpu_pa to be 4K aligned */ | |
| 663 | + amdgpu_gmc_set_pte_pde(adev, adev->gmc.ptr_pdb0, i, gart_ptb_gpu_pa, flags); | |
| 664 | +} | |
| @@ -149,6 +149,8 @@ struct amdgpu_xgmi { · 148 unmodified lines | ||
| 149 | 149 | struct list_head head; |
| 150 | 150 | bool supported; |
| 151 | 151 | struct ras_common_if *ras_if; |
| 152 | + bool connected_to_cpu; | |
| 153 | + bool pending_reset; | |
| 152 | 154 | }; |
| 153 | 155 | |
| 154 | 156 | struct amdgpu_gmc { |
| @@ -189,10 +191,13 @@ struct amdgpu_gmc { · 34 unmodified lines | ||
| 189 | 191 | u64 gart_end; |
| 190 | 192 | /* Frame buffer aperture of this GPU device. Different from |
| 191 | 193 | * fb_start (see below), this only covers the local GPU device. |
| 192 | − * Driver get fb_start from MC_VM_FB_LOCATION_BASE (set by vbios) | |
| 193 | − * and calculate vram_start of this local device by adding an | |
| 194 | − * offset inside the XGMI hive. | |
| 195 | − * Under VMID0, logical address == MC address | |
| 194 | + * If driver uses FB aperture to access FB, driver get fb_start from | |
| 195 | + * MC_VM_FB_LOCATION_BASE (set by vbios) and calculate vram_start | |
| 196 | + * of this local device by adding an offset inside the XGMI hive. | |
| 197 | + * If driver uses GART table for VMID0 FB access, driver finds a hole in | |
| 198 | + * VMID0's virtual address space to place the SYSVM aperture inside | |
| 199 | + * which the first part is vram and the second part is gart (covering | |
| 200 | + * system ram). | |
| 196 | 201 | */ |
| 197 | 202 | u64 vram_start; |
| 198 | 203 | u64 vram_end; |
| @@ -204,6 +209,15 @@ struct amdgpu_gmc { · 5 unmodified lines | ||
| 204 | 209 | */ |
| 205 | 210 | u64 fb_start; |
| 206 | 211 | u64 fb_end; |
| 212 | + /* In the case of use GART table for vmid0 FB access, [fb_start, fb_end] | |
| 213 | + * will be squeezed to GART aperture. But we have a PSP FW issue to fix | |
| 214 | + * for now. To temporarily workaround the PSP FW issue, added below two | |
| 215 | + * variables to remember the original fb_start/end to re-enable FB | |
| 216 | + * aperture to workaround the PSP FW issue. Will delete it after we | |
| 217 | + * get a proper PSP FW fix. | |
| 218 | + */ | |
| 219 | + u64 fb_start_original; | |
| 220 | + u64 fb_end_original; | |
| 207 | 221 | unsigned vram_width; |
| 208 | 222 | u64 real_vram_size; |
| 209 | 223 | int vram_mtrr; |
| @@ -240,6 +254,12 @@ struct amdgpu_gmc { · 30 unmodified lines | ||
| 240 | 254 | struct amdgpu_xgmi xgmi; |
| 241 | 255 | struct amdgpu_irq_src ecc_irq; |
| 242 | 256 | int noretry; |
| 257 | + | |
| 258 | + uint32_t vmid0_page_table_block_size; | |
| 259 | + uint32_t vmid0_page_table_depth; | |
| 260 | + struct amdgpu_bo *pdb0_bo; | |
| 261 | + /* CPU kmapped address of pdb0*/ | |
| 262 | + void *ptr_pdb0; | |
| 243 | 263 | }; |
| 244 | 264 | |
| 245 | 265 | #define amdgpu_gmc_flush_gpu_tlb(adev, vmid, vmhub, type) ((adev)->gmc.gmc_funcs->flush_gpu_tlb((adev), (vmid), (vmhub), (type))) |
| @@ -281,6 +301,7 @@ static inline uint64_t amdgpu_gmc_sign_extend(uint64_t addr) · 35 unmodified lines | ||
| 281 | 301 | return addr; |
| 282 | 302 | } |
| 283 | 303 | |
| 304 | +int amdgpu_gmc_pdb0_alloc(struct amdgpu_device *adev); | |
| 284 | 305 | void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level, |
| 285 | 306 | uint64_t *addr, uint64_t *flags); |
| 286 | 307 | int amdgpu_gmc_set_pte_pde(struct amdgpu_device *adev, void *cpu_pt_addr, |
| @@ -288,6 +309,7 @@ int amdgpu_gmc_set_pte_pde(struct amdgpu_device *adev, void *cpu_pt_addr, · 1 unmodified line | ||
| 288 | 309 | uint64_t flags); |
| 289 | 310 | uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo); |
| 290 | 311 | uint64_t amdgpu_gmc_agp_addr(struct ttm_buffer_object *bo); |
| 312 | +void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc); | |
| 291 | 313 | void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc, |
| 292 | 314 | u64 base); |
| 293 | 315 | void amdgpu_gmc_gart_location(struct amdgpu_device *adev, |
| @@ -309,4 +331,5 @@ amdgpu_gmc_set_vm_fault_masks(struct amdgpu_device *adev, int hub_type, · 15 unmodified lines | ||
| 309 | 331 | |
| 310 | 332 | void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev); |
| 311 | 333 | |
| 334 | +void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev); | |
| 312 | 335 | #endif |
| @@ -30,7 +30,6 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <linux/slab.h> |
| 31 | 31 | |
| 32 | 32 | #include <drm/amdgpu_drm.h> |
| 33 | −#include <drm/drm_debugfs.h> | |
| 34 | 33 | |
| 35 | 34 | #include "amdgpu.h" |
| 36 | 35 | #include "atom.h" |
| @@ -453,11 +452,9 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev) · 416 unmodified lines | ||
| 453 | 452 | */ |
| 454 | 453 | #if defined(CONFIG_DEBUG_FS) |
| 455 | 454 | |
| 456 | −static int amdgpu_debugfs_sa_info(struct seq_file *m, void *data) | |
| 455 | +static int amdgpu_debugfs_sa_info_show(struct seq_file *m, void *unused) | |
| 457 | 456 | { |
| 458 | − struct drm_info_node *node = (struct drm_info_node *) m->private; | |
| 459 | − struct drm_device *dev = node->minor->dev; | |
| 460 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 457 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 461 | 458 | |
| 462 | 459 | seq_printf(m, "--------------------- DELAYED --------------------- \n"); |
| 463 | 460 | amdgpu_sa_bo_dump_debug_info(&adev->ib_pools[AMDGPU_IB_POOL_DELAYED], |
| @@ -471,18 +468,18 @@ static int amdgpu_debugfs_sa_info(struct seq_file *m, void *data) · 7 unmodified lines | ||
| 471 | 468 | return 0; |
| 472 | 469 | } |
| 473 | 470 | |
| 474 | −static const struct drm_info_list amdgpu_debugfs_sa_list[] = { | |
| 475 | − {"amdgpu_sa_info", &amdgpu_debugfs_sa_info, 0, NULL}, | |
| 476 | −}; | |
| 471 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_sa_info); | |
| 477 | 472 | |
| 478 | 473 | #endif |
| 479 | 474 | |
| 480 | −int amdgpu_debugfs_sa_init(struct amdgpu_device *adev) | |
| 475 | +void amdgpu_debugfs_sa_init(struct amdgpu_device *adev) | |
| 481 | 476 | { |
| 482 | 477 | #if defined(CONFIG_DEBUG_FS) |
| 483 | − return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_sa_list, | |
| 484 | − ARRAY_SIZE(amdgpu_debugfs_sa_list)); | |
| 485 | −#else | |
| 486 | − return 0; | |
| 478 | + struct drm_minor *minor = adev_to_drm(adev)->primary; | |
| 479 | + struct dentry *root = minor->debugfs_root; | |
| 480 | + | |
| 481 | + debugfs_create_file("amdgpu_sa_info", 0444, root, adev, | |
| 482 | + &amdgpu_debugfs_sa_info_fops); | |
| 483 | + | |
| 487 | 484 | #endif |
| 488 | 485 | } |
| @@ -99,6 +99,8 @@ int amdgpu_ih_ring_init(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih, · 98 unmodified lines | ||
| 99 | 99 | ih->rptr_addr = adev->wb.gpu_addr + rptr_offs * 4; |
| 100 | 100 | ih->rptr_cpu = &adev->wb.wb[rptr_offs]; |
| 101 | 101 | } |
| 102 | + | |
| 103 | + init_waitqueue_head(&ih->wait_process); | |
| 102 | 104 | return 0; |
| 103 | 105 | } |
| 104 | 106 | |
| @@ -160,6 +162,52 @@ void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv, · 55 unmodified lines | ||
| 160 | 162 | } |
| 161 | 163 | } |
| 162 | 164 | |
| 165 | +/* Waiter helper that checks current rptr matches or passes checkpoint wptr */ | |
| 166 | +static bool amdgpu_ih_has_checkpoint_processed(struct amdgpu_device *adev, | |
| 167 | + struct amdgpu_ih_ring *ih, | |
| 168 | + uint32_t checkpoint_wptr, | |
| 169 | + uint32_t *prev_rptr) | |
| 170 | +{ | |
| 171 | + uint32_t cur_rptr = ih->rptr | (*prev_rptr & ~ih->ptr_mask); | |
| 172 | + | |
| 173 | + /* rptr has wrapped. */ | |
| 174 | + if (cur_rptr < *prev_rptr) | |
| 175 | + cur_rptr += ih->ptr_mask + 1; | |
| 176 | + *prev_rptr = cur_rptr; | |
| 177 | + | |
| 178 | + return cur_rptr >= checkpoint_wptr; | |
| 179 | +} | |
| 180 | + | |
| 181 | +/** | |
| 182 | + * amdgpu_ih_wait_on_checkpoint_process - wait to process IVs up to checkpoint | |
| 183 | + * | |
| 184 | + * @adev: amdgpu_device pointer | |
| 185 | + * @ih: ih ring to process | |
| 186 | + * | |
| 187 | + * Used to ensure ring has processed IVs up to the checkpoint write pointer. | |
| 188 | + */ | |
| 189 | +int amdgpu_ih_wait_on_checkpoint_process(struct amdgpu_device *adev, | |
| 190 | + struct amdgpu_ih_ring *ih) | |
| 191 | +{ | |
| 192 | + uint32_t checkpoint_wptr, rptr; | |
| 193 | + | |
| 194 | + if (!ih->enabled || adev->shutdown) | |
| 195 | + return -ENODEV; | |
| 196 | + | |
| 197 | + checkpoint_wptr = amdgpu_ih_get_wptr(adev, ih); | |
| 198 | + /* Order wptr with rptr. */ | |
| 199 | + rmb(); | |
| 200 | + rptr = READ_ONCE(ih->rptr); | |
| 201 | + | |
| 202 | + /* wptr has wrapped. */ | |
| 203 | + if (rptr > checkpoint_wptr) | |
| 204 | + checkpoint_wptr += ih->ptr_mask + 1; | |
| 205 | + | |
| 206 | + return wait_event_interruptible(ih->wait_process, | |
| 207 | + amdgpu_ih_has_checkpoint_processed(adev, ih, | |
| 208 | + checkpoint_wptr, &rptr)); | |
| 209 | +} | |
| 210 | + | |
| 163 | 211 | /** |
| 164 | 212 | * amdgpu_ih_process - interrupt handler |
| 165 | 213 | * |
| @@ -180,10 +228,6 @@ int amdgpu_ih_process(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih) · 14 unmodified lines | ||
| 180 | 228 | wptr = amdgpu_ih_get_wptr(adev, ih); |
| 181 | 229 | |
| 182 | 230 | restart_ih: |
| 183 | − /* is somebody else already processing irqs? */ | |
| 184 | − if (atomic_xchg(&ih->lock, 1)) | |
| 185 | − return IRQ_NONE; | |
| 186 | − | |
| 187 | 231 | DRM_DEBUG("%s: rptr %d, wptr %d\n", __func__, ih->rptr, wptr); |
| 188 | 232 | |
| 189 | 233 | /* Order reading of wptr vs. reading of IH ring data */ |
| @@ -195,7 +239,7 @@ restart_ih: · 5 unmodified lines | ||
| 195 | 239 | } |
| 196 | 240 | |
| 197 | 241 | amdgpu_ih_set_rptr(adev, ih); |
| 198 | − atomic_set(&ih->lock, 0); | |
| 242 | + wake_up_all(&ih->wait_process); | |
| 199 | 243 | |
| 200 | 244 | /* make sure wptr hasn't changed while processing */ |
| 201 | 245 | wptr = amdgpu_ih_get_wptr(adev, ih); |
| @@ -64,8 +64,10 @@ struct amdgpu_ih_ring { · 63 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | bool enabled; |
| 66 | 66 | unsigned rptr; |
| 67 | − atomic_t lock; | |
| 68 | 67 | struct amdgpu_ih_regs ih_regs; |
| 68 | + | |
| 69 | + /* For waiting on IH processing at checkpoint. */ | |
| 70 | + wait_queue_head_t wait_process; | |
| 69 | 71 | }; |
| 70 | 72 | |
| 71 | 73 | /* provided by the ih block */ |
| @@ -87,6 +89,8 @@ int amdgpu_ih_ring_init(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih, · 15 unmodified lines | ||
| 87 | 89 | void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih); |
| 88 | 90 | void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv, |
| 89 | 91 | unsigned int num_dw); |
| 92 | +int amdgpu_ih_wait_on_checkpoint_process(struct amdgpu_device *adev, | |
| 93 | + struct amdgpu_ih_ring *ih); | |
| 90 | 94 | int amdgpu_ih_process(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih); |
| 91 | 95 | void amdgpu_ih_decode_iv_helper(struct amdgpu_device *adev, |
| 92 | 96 | struct amdgpu_ih_ring *ih, |
| @@ -65,6 +65,41 @@ · 64 unmodified lines | ||
| 65 | 65 | |
| 66 | 66 | #define AMDGPU_WAIT_IDLE_TIMEOUT 200 |
| 67 | 67 | |
| 68 | +const char *soc15_ih_clientid_name[] = { | |
| 69 | + "IH", | |
| 70 | + "SDMA2 or ACP", | |
| 71 | + "ATHUB", | |
| 72 | + "BIF", | |
| 73 | + "SDMA3 or DCE", | |
| 74 | + "SDMA4 or ISP", | |
| 75 | + "VMC1 or PCIE0", | |
| 76 | + "RLC", | |
| 77 | + "SDMA0", | |
| 78 | + "SDMA1", | |
| 79 | + "SE0SH", | |
| 80 | + "SE1SH", | |
| 81 | + "SE2SH", | |
| 82 | + "SE3SH", | |
| 83 | + "VCN1 or UVD1", | |
| 84 | + "THM", | |
| 85 | + "VCN or UVD", | |
| 86 | + "SDMA5 or VCE0", | |
| 87 | + "VMC", | |
| 88 | + "SDMA6 or XDMA", | |
| 89 | + "GRBM_CP", | |
| 90 | + "ATS", | |
| 91 | + "ROM_SMUIO", | |
| 92 | + "DF", | |
| 93 | + "SDMA7 or VCE1", | |
| 94 | + "PWR", | |
| 95 | + "reserved", | |
| 96 | + "UTCL2", | |
| 97 | + "EA", | |
| 98 | + "UTCL2LOG", | |
| 99 | + "MP0", | |
| 100 | + "MP1" | |
| 101 | +}; | |
| 102 | + | |
| 68 | 103 | /** |
| 69 | 104 | * amdgpu_hotplug_work_func - work handler for display hotplug event |
| 70 | 105 | * |
| @@ -535,7 +570,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) · 464 unmodified lines | ||
| 535 | 570 | for (j = 0; j < AMDGPU_MAX_IRQ_SRC_ID; ++j) { |
| 536 | 571 | struct amdgpu_irq_src *src = adev->irq.client[i].sources[j]; |
| 537 | 572 | |
| 538 | − if (!src) | |
| 573 | + if (!src || !src->funcs || !src->funcs->set) | |
| 539 | 574 | continue; |
| 540 | 575 | for (k = 0; k < src->num_types; k++) |
| 541 | 576 | amdgpu_irq_update(adev, src, k); |
| @@ -27,7 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | #include "amdgpu.h" |
| 30 | −#include <drm/drm_debugfs.h> | |
| 31 | 30 | #include <drm/amdgpu_drm.h> |
| 32 | 31 | #include "amdgpu_uvd.h" |
| 33 | 32 | #include "amdgpu_vce.h" |
| @@ -287,22 +286,30 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info, · 253 unmodified lines | ||
| 287 | 286 | break; |
| 288 | 287 | case AMDGPU_INFO_FW_TA: |
| 289 | 288 | switch (query_fw->index) { |
| 290 | − case 0: | |
| 289 | + case TA_FW_TYPE_PSP_XGMI: | |
| 291 | 290 | fw_info->ver = adev->psp.ta_fw_version; |
| 292 | 291 | fw_info->feature = adev->psp.ta_xgmi_ucode_version; |
| 293 | 292 | break; |
| 294 | − case 1: | |
| 293 | + case TA_FW_TYPE_PSP_RAS: | |
| 295 | 294 | fw_info->ver = adev->psp.ta_fw_version; |
| 296 | 295 | fw_info->feature = adev->psp.ta_ras_ucode_version; |
| 297 | 296 | break; |
| 298 | − case 2: | |
| 297 | + case TA_FW_TYPE_PSP_HDCP: | |
| 299 | 298 | fw_info->ver = adev->psp.ta_fw_version; |
| 300 | 299 | fw_info->feature = adev->psp.ta_hdcp_ucode_version; |
| 301 | 300 | break; |
| 302 | − case 3: | |
| 301 | + case TA_FW_TYPE_PSP_DTM: | |
| 303 | 302 | fw_info->ver = adev->psp.ta_fw_version; |
| 304 | 303 | fw_info->feature = adev->psp.ta_dtm_ucode_version; |
| 305 | 304 | break; |
| 305 | + case TA_FW_TYPE_PSP_RAP: | |
| 306 | + fw_info->ver = adev->psp.ta_fw_version; | |
| 307 | + fw_info->feature = adev->psp.ta_rap_ucode_version; | |
| 308 | + break; | |
| 309 | + case TA_FW_TYPE_PSP_SECUREDISPLAY: | |
| 310 | + fw_info->ver = adev->psp.ta_fw_version; | |
| 311 | + fw_info->feature = adev->psp.ta_securedisplay_ucode_version; | |
| 312 | + break; | |
| 306 | 313 | default: |
| 307 | 314 | return -EINVAL; |
| 308 | 315 | } |
| @@ -981,6 +988,63 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 672 unmodified lines | ||
| 981 | 988 | min_t(u64, size, sizeof(ras_mask))) ? |
| 982 | 989 | -EFAULT : 0; |
| 983 | 990 | } |
| 991 | + case AMDGPU_INFO_VIDEO_CAPS: { | |
| 992 | + const struct amdgpu_video_codecs *codecs; | |
| 993 | + struct drm_amdgpu_info_video_caps *caps; | |
| 994 | + int r; | |
| 995 | + | |
| 996 | + switch (info->video_cap.type) { | |
| 997 | + case AMDGPU_INFO_VIDEO_CAPS_DECODE: | |
| 998 | + r = amdgpu_asic_query_video_codecs(adev, false, &codecs); | |
| 999 | + if (r) | |
| 1000 | + return -EINVAL; | |
| 1001 | + break; | |
| 1002 | + case AMDGPU_INFO_VIDEO_CAPS_ENCODE: | |
| 1003 | + r = amdgpu_asic_query_video_codecs(adev, true, &codecs); | |
| 1004 | + if (r) | |
| 1005 | + return -EINVAL; | |
| 1006 | + break; | |
| 1007 | + default: | |
| 1008 | + DRM_DEBUG_KMS("Invalid request %d\n", | |
| 1009 | + info->video_cap.type); | |
| 1010 | + return -EINVAL; | |
| 1011 | + } | |
| 1012 | + | |
| 1013 | + caps = kzalloc(sizeof(*caps), GFP_KERNEL); | |
| 1014 | + if (!caps) | |
| 1015 | + return -ENOMEM; | |
| 1016 | + | |
| 1017 | + for (i = 0; i < codecs->codec_count; i++) { | |
| 1018 | + int idx = codecs->codec_array[i].codec_type; | |
| 1019 | + | |
| 1020 | + switch (idx) { | |
| 1021 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2: | |
| 1022 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4: | |
| 1023 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1: | |
| 1024 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC: | |
| 1025 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC: | |
| 1026 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG: | |
| 1027 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9: | |
| 1028 | + case AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1: | |
| 1029 | + caps->codec_info[idx].valid = 1; | |
| 1030 | + caps->codec_info[idx].max_width = | |
| 1031 | + codecs->codec_array[i].max_width; | |
| 1032 | + caps->codec_info[idx].max_height = | |
| 1033 | + codecs->codec_array[i].max_height; | |
| 1034 | + caps->codec_info[idx].max_pixels_per_frame = | |
| 1035 | + codecs->codec_array[i].max_pixels_per_frame; | |
| 1036 | + caps->codec_info[idx].max_level = | |
| 1037 | + codecs->codec_array[i].max_level; | |
| 1038 | + break; | |
| 1039 | + default: | |
| 1040 | + break; | |
| 1041 | + } | |
| 1042 | + } | |
| 1043 | + r = copy_to_user(out, caps, | |
| 1044 | + min((size_t)size, sizeof(*caps))) ? -EFAULT : 0; | |
| 1045 | + kfree(caps); | |
| 1046 | + return r; | |
| 1047 | + } | |
| 984 | 1048 | default: |
| 985 | 1049 | DRM_DEBUG_KMS("Invalid request %d\n", info->query); |
| 986 | 1050 | return -EINVAL; |
| @@ -1262,16 +1326,25 @@ void amdgpu_disable_vblank_kms(struct drm_crtc *crtc) · 275 unmodified lines | ||
| 1262 | 1326 | */ |
| 1263 | 1327 | #if defined(CONFIG_DEBUG_FS) |
| 1264 | 1328 | |
| 1265 | −static int amdgpu_debugfs_firmware_info(struct seq_file *m, void *data) | |
| 1329 | +static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused) | |
| 1266 | 1330 | { |
| 1267 | − struct drm_info_node *node = (struct drm_info_node *) m->private; | |
| 1268 | − struct drm_device *dev = node->minor->dev; | |
| 1269 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 1331 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 1270 | 1332 | struct drm_amdgpu_info_firmware fw_info; |
| 1271 | 1333 | struct drm_amdgpu_query_fw query_fw; |
| 1272 | 1334 | struct atom_context *ctx = adev->mode_info.atom_context; |
| 1273 | 1335 | int ret, i; |
| 1274 | 1336 | |
| 1337 | + static const char *ta_fw_name[TA_FW_TYPE_MAX_INDEX] = { | |
| 1338 | +#define TA_FW_NAME(type) [TA_FW_TYPE_PSP_##type] = #type | |
| 1339 | + TA_FW_NAME(XGMI), | |
| 1340 | + TA_FW_NAME(RAS), | |
| 1341 | + TA_FW_NAME(HDCP), | |
| 1342 | + TA_FW_NAME(DTM), | |
| 1343 | + TA_FW_NAME(RAP), | |
| 1344 | + TA_FW_NAME(SECUREDISPLAY), | |
| 1345 | +#undef TA_FW_NAME | |
| 1346 | + }; | |
| 1347 | + | |
| 1275 | 1348 | /* VCE */ |
| 1276 | 1349 | query_fw.fw_type = AMDGPU_INFO_FW_VCE; |
| 1277 | 1350 | ret = amdgpu_firmware_info(&fw_info, &query_fw, adev); |
| @@ -1389,31 +1462,14 @@ static int amdgpu_debugfs_firmware_info(struct seq_file *m, void *data) · 111 unmodified lines | ||
| 1389 | 1462 | fw_info.feature, fw_info.ver); |
| 1390 | 1463 | |
| 1391 | 1464 | query_fw.fw_type = AMDGPU_INFO_FW_TA; |
| 1392 | − for (i = 0; i < 4; i++) { | |
| 1465 | + for (i = TA_FW_TYPE_PSP_XGMI; i < TA_FW_TYPE_MAX_INDEX; i++) { | |
| 1393 | 1466 | query_fw.index = i; |
| 1394 | 1467 | ret = amdgpu_firmware_info(&fw_info, &query_fw, adev); |
| 1395 | 1468 | if (ret) |
| 1396 | 1469 | continue; |
| 1397 | − switch (query_fw.index) { | |
| 1398 | − case 0: | |
| 1399 | − seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n", | |
| 1400 | − "RAS", fw_info.feature, fw_info.ver); | |
| 1401 | − break; | |
| 1402 | − case 1: | |
| 1403 | − seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n", | |
| 1404 | − "XGMI", fw_info.feature, fw_info.ver); | |
| 1405 | − break; | |
| 1406 | − case 2: | |
| 1407 | − seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n", | |
| 1408 | − "HDCP", fw_info.feature, fw_info.ver); | |
| 1409 | − break; | |
| 1410 | − case 3: | |
| 1411 | − seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n", | |
| 1412 | − "DTM", fw_info.feature, fw_info.ver); | |
| 1413 | − break; | |
| 1414 | − default: | |
| 1415 | − return -EINVAL; | |
| 1416 | − } | |
| 1470 | + | |
| 1471 | + seq_printf(m, "TA %s feature version: 0x%08x, firmware version: 0x%08x\n", | |
| 1472 | + ta_fw_name[i], fw_info.feature, fw_info.ver); | |
| 1417 | 1473 | } |
| 1418 | 1474 | |
| 1419 | 1475 | /* SMC */ |
| @@ -1472,17 +1528,18 @@ static int amdgpu_debugfs_firmware_info(struct seq_file *m, void *data) · 52 unmodified lines | ||
| 1472 | 1528 | return 0; |
| 1473 | 1529 | } |
| 1474 | 1530 | |
| 1475 | −static const struct drm_info_list amdgpu_firmware_info_list[] = { | |
| 1476 | − {"amdgpu_firmware_info", amdgpu_debugfs_firmware_info, 0, NULL}, | |
| 1477 | −}; | |
| 1531 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_firmware_info); | |
| 1532 | + | |
| 1478 | 1533 | #endif |
| 1479 | 1534 | |
| 1480 | −int amdgpu_debugfs_firmware_init(struct amdgpu_device *adev) | |
| 1535 | +void amdgpu_debugfs_firmware_init(struct amdgpu_device *adev) | |
| 1481 | 1536 | { |
| 1482 | 1537 | #if defined(CONFIG_DEBUG_FS) |
| 1483 | − return amdgpu_debugfs_add_files(adev, amdgpu_firmware_info_list, | |
| 1484 | − ARRAY_SIZE(amdgpu_firmware_info_list)); | |
| 1485 | −#else | |
| 1486 | − return 0; | |
| 1538 | + struct drm_minor *minor = adev_to_drm(adev)->primary; | |
| 1539 | + struct dentry *root = minor->debugfs_root; | |
| 1540 | + | |
| 1541 | + debugfs_create_file("amdgpu_firmware_info", 0444, root, | |
| 1542 | + adev, &amdgpu_debugfs_firmware_info_fops); | |
| 1543 | + | |
| 1487 | 1544 | #endif |
| 1488 | 1545 | } |
| @@ -602,6 +602,14 @@ int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev, · 601 unmodified lines | ||
| 602 | 602 | int *hpos, ktime_t *stime, ktime_t *etime, |
| 603 | 603 | const struct drm_display_mode *mode); |
| 604 | 604 | |
| 605 | +int amdgpu_display_gem_fb_init(struct drm_device *dev, | |
| 606 | + struct amdgpu_framebuffer *rfb, | |
| 607 | + const struct drm_mode_fb_cmd2 *mode_cmd, | |
| 608 | + struct drm_gem_object *obj); | |
| 609 | +int amdgpu_display_gem_fb_verify_and_init( | |
| 610 | + struct drm_device *dev, struct amdgpu_framebuffer *rfb, | |
| 611 | + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd, | |
| 612 | + struct drm_gem_object *obj); | |
| 605 | 613 | int amdgpu_display_framebuffer_init(struct drm_device *dev, |
| 606 | 614 | struct amdgpu_framebuffer *rfb, |
| 607 | 615 | const struct drm_mode_fb_cmd2 *mode_cmd, |
| @@ -1061,13 +1061,17 @@ static const char *amdgpu_vram_names[] = { · 1060 unmodified lines | ||
| 1061 | 1061 | */ |
| 1062 | 1062 | int amdgpu_bo_init(struct amdgpu_device *adev) |
| 1063 | 1063 | { |
| 1064 | − /* reserve PAT memory space to WC for VRAM */ | |
| 1065 | − arch_io_reserve_memtype_wc(adev->gmc.aper_base, | |
| 1066 | − adev->gmc.aper_size); | |
| 1064 | + /* On A+A platform, VRAM can be mapped as WB */ | |
| 1065 | + if (!adev->gmc.xgmi.connected_to_cpu) { | |
| 1066 | + /* reserve PAT memory space to WC for VRAM */ | |
| 1067 | + arch_io_reserve_memtype_wc(adev->gmc.aper_base, | |
| 1068 | + adev->gmc.aper_size); | |
| 1069 | + | |
| 1070 | + /* Add an MTRR for the VRAM */ | |
| 1071 | + adev->gmc.vram_mtrr = arch_phys_wc_add(adev->gmc.aper_base, | |
| 1072 | + adev->gmc.aper_size); | |
| 1073 | + } | |
| 1067 | 1074 | |
| 1068 | − /* Add an MTRR for the VRAM */ | |
| 1069 | − adev->gmc.vram_mtrr = arch_phys_wc_add(adev->gmc.aper_base, | |
| 1070 | − adev->gmc.aper_size); | |
| 1071 | 1075 | DRM_INFO("Detected VRAM RAM=%lluM, BAR=%lluM\n", |
| 1072 | 1076 | adev->gmc.mc_vram_size >> 20, |
| 1073 | 1077 | (unsigned long long)adev->gmc.aper_size >> 20); |
| @@ -1085,8 +1089,10 @@ int amdgpu_bo_init(struct amdgpu_device *adev) · 11 unmodified lines | ||
| 1085 | 1089 | void amdgpu_bo_fini(struct amdgpu_device *adev) |
| 1086 | 1090 | { |
| 1087 | 1091 | amdgpu_ttm_fini(adev); |
| 1088 | − arch_phys_wc_del(adev->gmc.vram_mtrr); | |
| 1089 | − arch_io_free_memtype_wc(adev->gmc.aper_base, adev->gmc.aper_size); | |
| 1092 | + if (!adev->gmc.xgmi.connected_to_cpu) { | |
| 1093 | + arch_phys_wc_del(adev->gmc.vram_mtrr); | |
| 1094 | + arch_io_free_memtype_wc(adev->gmc.aper_base, adev->gmc.aper_size); | |
| 1095 | + } | |
| 1090 | 1096 | } |
| 1091 | 1097 | |
| 1092 | 1098 | /** |
| @@ -100,7 +100,6 @@ struct amdgpu_bo { · 99 unmodified lines | ||
| 100 | 100 | struct amdgpu_bo *parent; |
| 101 | 101 | struct amdgpu_bo *shadow; |
| 102 | 102 | |
| 103 | − struct amdgpu_mn *mn; | |
| 104 | 103 | |
| 105 | 104 | |
| 106 | 105 | #ifdef CONFIG_MMU_NOTIFIER |
| @@ -329,7 +328,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, · 222 unmodified lines | ||
| 329 | 328 | struct seq_file *m); |
| 330 | 329 | u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m); |
| 331 | 330 | #endif |
| 332 | −int amdgpu_debugfs_sa_init(struct amdgpu_device *adev); | |
| 331 | +void amdgpu_debugfs_sa_init(struct amdgpu_device *adev); | |
| 333 | 332 | |
| 334 | 333 | bool amdgpu_bo_support_uswc(u64 bo_flags); |
| 335 | 334 | |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "psp_v10_0.h" |
| 35 | 35 | #include "psp_v11_0.h" |
| 36 | 36 | #include "psp_v12_0.h" |
| 37 | +#include "psp_v13_0.h" | |
| 37 | 38 | |
| 38 | 39 | #include "amdgpu_ras.h" |
| 39 | 40 | #include "amdgpu_securedisplay.h" |
| @@ -56,7 +57,7 @@ static int psp_load_smu_fw(struct psp_context *psp); · 16 unmodified lines | ||
| 56 | 57 | * - Load XGMI/RAS/HDCP/DTM TA if any |
| 57 | 58 | * |
| 58 | 59 | * This new sequence is required for |
| 59 | − * - Arcturus | |
| 60 | + * - Arcturus and onwards | |
| 60 | 61 | * - Navi12 and onwards |
| 61 | 62 | */ |
| 62 | 63 | static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp) |
| @@ -71,7 +72,7 @@ static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp · 8 unmodified lines | ||
| 71 | 72 | if (adev->flags & AMD_IS_APU) |
| 72 | 73 | return; |
| 73 | 74 | |
| 74 | − if ((adev->asic_type == CHIP_ARCTURUS) || | |
| 75 | + if ((adev->asic_type >= CHIP_ARCTURUS) || | |
| 75 | 76 | (adev->asic_type >= CHIP_NAVI12)) |
| 76 | 77 | psp->pmfw_centralized_cstate_management = true; |
| 77 | 78 | } |
| @@ -109,6 +110,9 @@ static int psp_early_init(void *handle) · 31 unmodified lines | ||
| 109 | 110 | case CHIP_RENOIR: |
| 110 | 111 | psp_v12_0_set_psp_funcs(psp); |
| 111 | 112 | break; |
| 113 | + case CHIP_ALDEBARAN: | |
| 114 | + psp_v13_0_set_psp_funcs(psp); | |
| 115 | + break; | |
| 112 | 116 | default: |
| 113 | 117 | return -EINVAL; |
| 114 | 118 | } |
| @@ -383,7 +387,7 @@ static int psp_tmr_init(struct psp_context *psp) · 268 unmodified lines | ||
| 383 | 387 | * Note: this memory need be reserved till the driver |
| 384 | 388 | * uninitializes. |
| 385 | 389 | */ |
| 386 | − tmr_size = PSP_TMR_SIZE; | |
| 390 | + tmr_size = PSP_TMR_SIZE(psp->adev); | |
| 387 | 391 | |
| 388 | 392 | /* For ASICs support RLC autoload, psp will parse the toc |
| 389 | 393 | * and calculate the total size of TMR needed */ |
| @@ -399,10 +403,20 @@ static int psp_tmr_init(struct psp_context *psp) · 9 unmodified lines | ||
| 399 | 403 | } |
| 400 | 404 | |
| 401 | 405 | pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; |
| 402 | − ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE, | |
| 406 | + ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE(psp->adev), | |
| 403 | 407 | AMDGPU_GEM_DOMAIN_VRAM, |
| 404 | 408 | &psp->tmr_bo, &psp->tmr_mc_addr, pptr); |
| 405 | 409 | |
| 410 | + /* workaround the tmr_mc_addr: | |
| 411 | + * PSP requires an address in FB aperture. Right now driver produce | |
| 412 | + * tmr_mc_addr in the GART aperture. Convert it back to FB aperture | |
| 413 | + * for PSP. Will revert it after we get a fix from PSP FW. | |
| 414 | + */ | |
| 415 | + if (psp->adev->asic_type == CHIP_ALDEBARAN) { | |
| 416 | + psp->tmr_mc_addr -= psp->adev->gmc.fb_start; | |
| 417 | + psp->tmr_mc_addr += psp->adev->gmc.fb_start_original; | |
| 418 | + } | |
| 419 | + | |
| 406 | 420 | return ret; |
| 407 | 421 | } |
| 408 | 422 | |
| @@ -542,6 +556,28 @@ int psp_get_fw_attestation_records_addr(struct psp_context *psp, · 133 unmodified lines | ||
| 542 | 556 | return ret; |
| 543 | 557 | } |
| 544 | 558 | |
| 559 | +static int psp_rl_load(struct amdgpu_device *adev) | |
| 560 | +{ | |
| 561 | + struct psp_context *psp = &adev->psp; | |
| 562 | + struct psp_gfx_cmd_resp *cmd = psp->cmd; | |
| 563 | + | |
| 564 | + if (psp->rl_bin_size == 0) | |
| 565 | + return 0; | |
| 566 | + | |
| 567 | + memset(psp->fw_pri_buf, 0, PSP_1_MEG); | |
| 568 | + memcpy(psp->fw_pri_buf, psp->rl_start_addr, psp->rl_bin_size); | |
| 569 | + | |
| 570 | + memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp)); | |
| 571 | + | |
| 572 | + cmd->cmd_id = GFX_CMD_ID_LOAD_IP_FW; | |
| 573 | + cmd->cmd.cmd_load_ip_fw.fw_phy_addr_lo = lower_32_bits(psp->fw_pri_mc_addr); | |
| 574 | + cmd->cmd.cmd_load_ip_fw.fw_phy_addr_hi = upper_32_bits(psp->fw_pri_mc_addr); | |
| 575 | + cmd->cmd.cmd_load_ip_fw.fw_size = psp->rl_bin_size; | |
| 576 | + cmd->cmd.cmd_load_ip_fw.fw_type = GFX_FW_TYPE_REG_LIST; | |
| 577 | + | |
| 578 | + return psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr); | |
| 579 | +} | |
| 580 | + | |
| 545 | 581 | static void psp_prep_asd_load_cmd_buf(struct psp_gfx_cmd_resp *cmd, |
| 546 | 582 | uint64_t asd_mc, uint32_t size) |
| 547 | 583 | { |
| @@ -755,8 +791,9 @@ static int psp_xgmi_unload(struct psp_context *psp) · 207 unmodified lines | ||
| 755 | 791 | struct psp_gfx_cmd_resp *cmd; |
| 756 | 792 | struct amdgpu_device *adev = psp->adev; |
| 757 | 793 | |
| 758 | − /* XGMI TA unload currently is not supported on Arcturus */ | |
| 759 | − if (adev->asic_type == CHIP_ARCTURUS) | |
| 794 | + /* XGMI TA unload currently is not supported on Arcturus/Aldebaran A+A */ | |
| 795 | + if (adev->asic_type == CHIP_ARCTURUS || | |
| 796 | + (adev->asic_type == CHIP_ALDEBARAN && adev->gmc.xgmi.connected_to_cpu)) | |
| 760 | 797 | return 0; |
| 761 | 798 | |
| 762 | 799 | /* |
| @@ -1561,6 +1598,7 @@ static int psp_rap_unload(struct psp_context *psp) · 798 unmodified lines | ||
| 1561 | 1598 | static int psp_rap_initialize(struct psp_context *psp) |
| 1562 | 1599 | { |
| 1563 | 1600 | int ret; |
| 1601 | + enum ta_rap_status status = TA_RAP_STATUS__SUCCESS; | |
| 1564 | 1602 | |
| 1565 | 1603 | /* |
| 1566 | 1604 | * TODO: bypass the initialize in sriov for now |
| @@ -1584,8 +1622,8 @@ static int psp_rap_initialize(struct psp_context *psp) · 17 unmodified lines | ||
| 1584 | 1622 | if (ret) |
| 1585 | 1623 | return ret; |
| 1586 | 1624 | |
| 1587 | − ret = psp_rap_invoke(psp, TA_CMD_RAP__INITIALIZE); | |
| 1588 | − if (ret != TA_RAP_STATUS__SUCCESS) { | |
| 1625 | + ret = psp_rap_invoke(psp, TA_CMD_RAP__INITIALIZE, &status); | |
| 1626 | + if (ret || status != TA_RAP_STATUS__SUCCESS) { | |
| 1589 | 1627 | psp_rap_unload(psp); |
| 1590 | 1628 | |
| 1591 | 1629 | amdgpu_bo_free_kernel(&psp->rap_context.rap_shared_bo, |
| @@ -1594,8 +1632,10 @@ static int psp_rap_initialize(struct psp_context *psp) · 2 unmodified lines | ||
| 1594 | 1632 | |
| 1595 | 1633 | psp->rap_context.rap_initialized = false; |
| 1596 | 1634 | |
| 1597 | − dev_warn(psp->adev->dev, "RAP TA initialize fail.\n"); | |
| 1598 | − return -EINVAL; | |
| 1635 | + dev_warn(psp->adev->dev, "RAP TA initialize fail (%d) status %d.\n", | |
| 1636 | + ret, status); | |
| 1637 | + | |
| 1638 | + return ret; | |
| 1599 | 1639 | } |
| 1600 | 1640 | |
| 1601 | 1641 | return 0; |
| @@ -1620,13 +1660,13 @@ static int psp_rap_terminate(struct psp_context *psp) · 18 unmodified lines | ||
| 1620 | 1660 | return ret; |
| 1621 | 1661 | } |
| 1622 | 1662 | |
| 1623 | −int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id) | |
| 1663 | +int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id, enum ta_rap_status *status) | |
| 1624 | 1664 | { |
| 1625 | 1665 | struct ta_rap_shared_memory *rap_cmd; |
| 1626 | − int ret; | |
| 1666 | + int ret = 0; | |
| 1627 | 1667 | |
| 1628 | 1668 | if (!psp->rap_context.rap_initialized) |
| 1629 | − return -EINVAL; | |
| 1669 | + return 0; | |
| 1630 | 1670 | |
| 1631 | 1671 | if (ta_cmd_id != TA_CMD_RAP__INITIALIZE && |
| 1632 | 1672 | ta_cmd_id != TA_CMD_RAP__VALIDATE_L0) |
| @@ -1642,14 +1682,16 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id) · 9 unmodified lines | ||
| 1642 | 1682 | rap_cmd->validation_method_id = METHOD_A; |
| 1643 | 1683 | |
| 1644 | 1684 | ret = psp_ta_invoke(psp, rap_cmd->cmd_id, psp->rap_context.session_id); |
| 1645 | − if (ret) { | |
| 1646 | − mutex_unlock(&psp->rap_context.mutex); | |
| 1647 | − return ret; | |
| 1648 | − } | |
| 1685 | + if (ret) | |
| 1686 | + goto out_unlock; | |
| 1649 | 1687 | |
| 1688 | + if (status) | |
| 1689 | + *status = rap_cmd->rap_status; | |
| 1690 | + | |
| 1691 | +out_unlock: | |
| 1650 | 1692 | mutex_unlock(&psp->rap_context.mutex); |
| 1651 | 1693 | |
| 1652 | − return rap_cmd->rap_status; | |
| 1694 | + return ret; | |
| 1653 | 1695 | } |
| 1654 | 1696 | // RAP end |
| 1655 | 1697 | |
| @@ -2276,6 +2318,12 @@ skip_memalloc: · 620 unmodified lines | ||
| 2276 | 2318 | return ret; |
| 2277 | 2319 | } |
| 2278 | 2320 | |
| 2321 | + ret = psp_rl_load(adev); | |
| 2322 | + if (ret) { | |
| 2323 | + DRM_ERROR("PSP load RL failed!\n"); | |
| 2324 | + return ret; | |
| 2325 | + } | |
| 2326 | + | |
| 2279 | 2327 | if (psp->adev->psp.ta_fw) { |
| 2280 | 2328 | ret = psp_ras_initialize(psp); |
| 2281 | 2329 | if (ret) |
| @@ -2751,6 +2799,9 @@ int psp_init_sos_microcode(struct psp_context *psp, · 469 unmodified lines | ||
| 2751 | 2799 | adev->psp.spl_bin_size = le32_to_cpu(sos_hdr_v1_3->spl_size_bytes); |
| 2752 | 2800 | adev->psp.spl_start_addr = (uint8_t *)adev->psp.sys_start_addr + |
| 2753 | 2801 | le32_to_cpu(sos_hdr_v1_3->spl_offset_bytes); |
| 2802 | + adev->psp.rl_bin_size = le32_to_cpu(sos_hdr_v1_3->rl_size_bytes); | |
| 2803 | + adev->psp.rl_start_addr = (uint8_t *)adev->psp.sys_start_addr + | |
| 2804 | + le32_to_cpu(sos_hdr_v1_3->rl_offset_bytes); | |
| 2754 | 2805 | } |
| 2755 | 2806 | break; |
| 2756 | 2807 | default: |
| @@ -3052,3 +3103,11 @@ const struct amdgpu_ip_block_version psp_v12_0_ip_block = · 295 unmodified lines | ||
| 3052 | 3103 | .rev = 0, |
| 3053 | 3104 | .funcs = &psp_ip_funcs, |
| 3054 | 3105 | }; |
| 3106 | + | |
| 3107 | +const struct amdgpu_ip_block_version psp_v13_0_ip_block = { | |
| 3108 | + .type = AMD_IP_BLOCK_TYPE_PSP, | |
| 3109 | + .major = 13, | |
| 3110 | + .minor = 0, | |
| 3111 | + .rev = 0, | |
| 3112 | + .funcs = &psp_ip_funcs, | |
| 3113 | +}; | |
| @@ -37,7 +37,7 @@ · 36 unmodified lines | ||
| 37 | 37 | #define PSP_XGMI_SHARED_MEM_SIZE 0x4000 |
| 38 | 38 | #define PSP_RAS_SHARED_MEM_SIZE 0x4000 |
| 39 | 39 | #define PSP_1_MEG 0x100000 |
| 40 | −#define PSP_TMR_SIZE 0x400000 | |
| 40 | +#define PSP_TMR_SIZE(adev) ((adev)->asic_type == CHIP_ALDEBARAN ? 0x800000 : 0x400000) | |
| 41 | 41 | #define PSP_HDCP_SHARED_MEM_SIZE 0x4000 |
| 42 | 42 | #define PSP_DTM_SHARED_MEM_SIZE 0x4000 |
| 43 | 43 | #define PSP_RAP_SHARED_MEM_SIZE 0x4000 |
| @@ -248,11 +248,13 @@ struct psp_context · 204 unmodified lines | ||
| 248 | 248 | uint32_t toc_bin_size; |
| 249 | 249 | uint32_t kdb_bin_size; |
| 250 | 250 | uint32_t spl_bin_size; |
| 251 | + uint32_t rl_bin_size; | |
| 251 | 252 | uint8_t *sys_start_addr; |
| 252 | 253 | uint8_t *sos_start_addr; |
| 253 | 254 | uint8_t *toc_start_addr; |
| 254 | 255 | uint8_t *kdb_start_addr; |
| 255 | 256 | uint8_t *spl_start_addr; |
| 257 | + uint8_t *rl_start_addr; | |
| 256 | 258 | |
| 257 | 259 | /* tmr buffer */ |
| 258 | 260 | struct amdgpu_bo *tmr_bo; |
| @@ -365,11 +367,13 @@ struct amdgpu_psp_funcs { · 106 unmodified lines | ||
| 365 | 367 | extern const struct amd_ip_funcs psp_ip_funcs; |
| 366 | 368 | |
| 367 | 369 | extern const struct amdgpu_ip_block_version psp_v3_1_ip_block; |
| 368 | −extern int psp_wait_for(struct psp_context *psp, uint32_t reg_index, | |
| 369 | − uint32_t field_val, uint32_t mask, bool check_changed); | |
| 370 | − | |
| 371 | 370 | extern const struct amdgpu_ip_block_version psp_v10_0_ip_block; |
| 371 | +extern const struct amdgpu_ip_block_version psp_v11_0_ip_block; | |
| 372 | 372 | extern const struct amdgpu_ip_block_version psp_v12_0_ip_block; |
| 373 | +extern const struct amdgpu_ip_block_version psp_v13_0_ip_block; | |
| 374 | + | |
| 375 | +extern int psp_wait_for(struct psp_context *psp, uint32_t reg_index, | |
| 376 | + uint32_t field_val, uint32_t mask, bool check_changed); | |
| 373 | 377 | |
| 374 | 378 | int psp_gpu_reset(struct amdgpu_device *adev); |
| 375 | 379 | int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx, |
| @@ -395,12 +399,11 @@ int psp_ras_trigger_error(struct psp_context *psp, · 19 unmodified lines | ||
| 395 | 399 | |
| 396 | 400 | int psp_hdcp_invoke(struct psp_context *psp, uint32_t ta_cmd_id); |
| 397 | 401 | int psp_dtm_invoke(struct psp_context *psp, uint32_t ta_cmd_id); |
| 398 | −int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id); | |
| 402 | +int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id, enum ta_rap_status *status); | |
| 399 | 403 | int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id); |
| 400 | 404 | |
| 401 | 405 | int psp_rlc_autoload_start(struct psp_context *psp); |
| 402 | 406 | |
| 403 | −extern const struct amdgpu_ip_block_version psp_v11_0_ip_block; | |
| 404 | 407 | int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg, |
| 405 | 408 | uint32_t value); |
| 406 | 409 | int psp_ring_cmd_submit(struct psp_context *psp, |
| @@ -48,6 +48,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf, · 47 unmodified lines | ||
| 48 | 48 | struct ta_rap_cmd_output_data *rap_cmd_output; |
| 49 | 49 | struct drm_device *dev = adev_to_drm(adev); |
| 50 | 50 | uint32_t op; |
| 51 | + enum ta_rap_status status; | |
| 51 | 52 | int ret; |
| 52 | 53 | |
| 53 | 54 | if (*pos || size != 2) |
| @@ -70,9 +71,8 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf, · 16 unmodified lines | ||
| 70 | 71 | |
| 71 | 72 | switch (op) { |
| 72 | 73 | case 2: |
| 73 | − ret = psp_rap_invoke(&adev->psp, op); | |
| 74 | − | |
| 75 | − if (ret == TA_RAP_STATUS__SUCCESS) { | |
| 74 | + ret = psp_rap_invoke(&adev->psp, op, &status); | |
| 75 | + if (!ret && status == TA_RAP_STATUS__SUCCESS) { | |
| 76 | 76 | dev_info(adev->dev, "RAP L0 validate test success.\n"); |
| 77 | 77 | } else { |
| 78 | 78 | rap_shared_mem = (struct ta_rap_shared_memory *) |
| @@ -97,6 +97,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf, · 18 unmodified lines | ||
| 97 | 97 | default: |
| 98 | 98 | dev_info(adev->dev, "Unsupported op id: %d, ", op); |
| 99 | 99 | dev_info(adev->dev, "Only support op 2(L0 validate test).\n"); |
| 100 | + break; | |
| 100 | 101 | } |
| 101 | 102 | |
| 102 | 103 | amdgpu_gfx_off_ctrl(adev, true); |
| @@ -109,7 +109,7 @@ static ssize_t amdgpu_ras_debugfs_read(struct file *f, char __user *buf, · 108 unmodified lines | ||
| 109 | 109 | ssize_t s; |
| 110 | 110 | char val[128]; |
| 111 | 111 | |
| 112 | − if (amdgpu_ras_error_query(obj->adev, &info)) | |
| 112 | + if (amdgpu_ras_query_error_status(obj->adev, &info)) | |
| 113 | 113 | return -EINVAL; |
| 114 | 114 | |
| 115 | 115 | s = snprintf(val, sizeof(val), "%s: %lu\n%s: %lu\n", |
| @@ -434,7 +434,7 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *dev, · 318 unmodified lines | ||
| 434 | 434 | return snprintf(buf, PAGE_SIZE, |
| 435 | 435 | "Query currently inaccessible\n"); |
| 436 | 436 | |
| 437 | − if (amdgpu_ras_error_query(obj->adev, &info)) | |
| 437 | + if (amdgpu_ras_query_error_status(obj->adev, &info)) | |
| 438 | 438 | return -EINVAL; |
| 439 | 439 | |
| 440 | 440 | return snprintf(buf, PAGE_SIZE, "%s: %lu\n%s: %lu\n", |
| @@ -463,7 +463,7 @@ static struct ras_manager *amdgpu_ras_create_obj(struct amdgpu_device *adev, · 22 unmodified lines | ||
| 463 | 463 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 464 | 464 | struct ras_manager *obj; |
| 465 | 465 | |
| 466 | − if (!con) | |
| 466 | + if (!adev->ras_features || !con) | |
| 467 | 467 | return NULL; |
| 468 | 468 | |
| 469 | 469 | if (head->block >= AMDGPU_RAS_BLOCK_COUNT) |
| @@ -490,7 +490,7 @@ struct ras_manager *amdgpu_ras_find_obj(struct amdgpu_device *adev, · 20 unmodified lines | ||
| 490 | 490 | struct ras_manager *obj; |
| 491 | 491 | int i; |
| 492 | 492 | |
| 493 | − if (!con) | |
| 493 | + if (!adev->ras_features || !con) | |
| 494 | 494 | return NULL; |
| 495 | 495 | |
| 496 | 496 | if (head) { |
| @@ -590,7 +590,11 @@ static int __amdgpu_ras_feature_enable(struct amdgpu_device *adev, · 93 unmodified lines | ||
| 590 | 590 | con->features |= BIT(head->block); |
| 591 | 591 | } else { |
| 592 | 592 | if (obj && amdgpu_ras_is_feature_enabled(adev, head)) { |
| 593 | − con->features &= ~BIT(head->block); | |
| 593 | + /* skip clean gfx ras context feature for VEGA20 Gaming. | |
| 594 | + * will clean later | |
| 595 | + */ | |
| 596 | + if (!(!adev->ras_features && con->features & BIT(AMDGPU_RAS_BLOCK__GFX))) | |
| 597 | + con->features &= ~BIT(head->block); | |
| 594 | 598 | put_obj(obj); |
| 595 | 599 | } |
| 596 | 600 | } |
| @@ -693,6 +697,10 @@ int amdgpu_ras_feature_enable_on_boot(struct amdgpu_device *adev, · 96 unmodified lines | ||
| 693 | 697 | if (ret) |
| 694 | 698 | return ret; |
| 695 | 699 | |
| 700 | + /* gfx block ras dsiable cmd must send to ras-ta */ | |
| 701 | + if (head->block == AMDGPU_RAS_BLOCK__GFX) | |
| 702 | + con->features |= BIT(head->block); | |
| 703 | + | |
| 696 | 704 | ret = amdgpu_ras_feature_enable(adev, head, 0); |
| 697 | 705 | } |
| 698 | 706 | } else |
| @@ -757,8 +765,8 @@ static int amdgpu_ras_enable_all_features(struct amdgpu_device *adev, · 58 unmodified lines | ||
| 757 | 765 | /* feature ctl end */ |
| 758 | 766 | |
| 759 | 767 | /* query/inject/cure begin */ |
| 760 | −int amdgpu_ras_error_query(struct amdgpu_device *adev, | |
| 761 | − struct ras_query_if *info) | |
| 768 | +int amdgpu_ras_query_error_status(struct amdgpu_device *adev, | |
| 769 | + struct ras_query_if *info) | |
| 762 | 770 | { |
| 763 | 771 | struct ras_manager *obj = amdgpu_ras_find_obj(adev, &info->head); |
| 764 | 772 | struct ras_err_data err_data = {0, 0, 0, NULL}; |
| @@ -787,10 +795,16 @@ int amdgpu_ras_error_query(struct amdgpu_device *adev, · 22 unmodified lines | ||
| 787 | 795 | case AMDGPU_RAS_BLOCK__GFX: |
| 788 | 796 | if (adev->gfx.funcs->query_ras_error_count) |
| 789 | 797 | adev->gfx.funcs->query_ras_error_count(adev, &err_data); |
| 798 | + | |
| 799 | + if (adev->gfx.funcs->query_ras_error_status) | |
| 800 | + adev->gfx.funcs->query_ras_error_status(adev); | |
| 790 | 801 | break; |
| 791 | 802 | case AMDGPU_RAS_BLOCK__MMHUB: |
| 792 | 803 | if (adev->mmhub.funcs->query_ras_error_count) |
| 793 | 804 | adev->mmhub.funcs->query_ras_error_count(adev, &err_data); |
| 805 | + | |
| 806 | + if (adev->mmhub.funcs->query_ras_error_status) | |
| 807 | + adev->mmhub.funcs->query_ras_error_status(adev); | |
| 794 | 808 | break; |
| 795 | 809 | case AMDGPU_RAS_BLOCK__PCIE_BIF: |
| 796 | 810 | if (adev->nbio.funcs->query_ras_error_count) |
| @@ -826,6 +840,35 @@ int amdgpu_ras_error_query(struct amdgpu_device *adev, · 29 unmodified lines | ||
| 826 | 840 | return 0; |
| 827 | 841 | } |
| 828 | 842 | |
| 843 | +int amdgpu_ras_reset_error_status(struct amdgpu_device *adev, | |
| 844 | + enum amdgpu_ras_block block) | |
| 845 | +{ | |
| 846 | + if (!amdgpu_ras_is_supported(adev, block)) | |
| 847 | + return -EINVAL; | |
| 848 | + | |
| 849 | + switch (block) { | |
| 850 | + case AMDGPU_RAS_BLOCK__GFX: | |
| 851 | + if (adev->gfx.funcs->reset_ras_error_count) | |
| 852 | + adev->gfx.funcs->reset_ras_error_count(adev); | |
| 853 | + | |
| 854 | + if (adev->gfx.funcs->reset_ras_error_status) | |
| 855 | + adev->gfx.funcs->reset_ras_error_status(adev); | |
| 856 | + break; | |
| 857 | + case AMDGPU_RAS_BLOCK__MMHUB: | |
| 858 | + if (adev->mmhub.funcs->reset_ras_error_count) | |
| 859 | + adev->mmhub.funcs->reset_ras_error_count(adev); | |
| 860 | + break; | |
| 861 | + case AMDGPU_RAS_BLOCK__SDMA: | |
| 862 | + if (adev->sdma.funcs->reset_ras_error_count) | |
| 863 | + adev->sdma.funcs->reset_ras_error_count(adev); | |
| 864 | + break; | |
| 865 | + default: | |
| 866 | + break; | |
| 867 | + } | |
| 868 | + | |
| 869 | + return 0; | |
| 870 | +} | |
| 871 | + | |
| 829 | 872 | /* Trigger XGMI/WAFL error */ |
| 830 | 873 | static int amdgpu_ras_error_inject_xgmi(struct amdgpu_device *adev, |
| 831 | 874 | struct ta_ras_trigger_error_input *block_info) |
| @@ -913,7 +956,7 @@ unsigned long amdgpu_ras_query_error_count(struct amdgpu_device *adev, · 81 unmodified lines | ||
| 913 | 956 | struct ras_manager *obj; |
| 914 | 957 | struct ras_err_data data = {0, 0}; |
| 915 | 958 | |
| 916 | − if (!con) | |
| 959 | + if (!adev->ras_features || !con) | |
| 917 | 960 | return 0; |
| 918 | 961 | |
| 919 | 962 | list_for_each_entry(obj, &con->head, node) { |
| @@ -921,7 +964,7 @@ unsigned long amdgpu_ras_query_error_count(struct amdgpu_device *adev, · 1 unmodified line | ||
| 921 | 964 | .head = obj->head, |
| 922 | 965 | }; |
| 923 | 966 | |
| 924 | − if (amdgpu_ras_error_query(adev, &info)) | |
| 967 | + if (amdgpu_ras_query_error_status(adev, &info)) | |
| 925 | 968 | return 0; |
| 926 | 969 | |
| 927 | 970 | data.ce_count += info.ce_count; |
| @@ -1137,16 +1180,17 @@ static int amdgpu_ras_sysfs_remove_all(struct amdgpu_device *adev) · 209 unmodified lines | ||
| 1137 | 1180 | * |
| 1138 | 1181 | */ |
| 1139 | 1182 | /* debugfs begin */ |
| 1140 | −static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev) | |
| 1183 | +static struct dentry *amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev) | |
| 1141 | 1184 | { |
| 1142 | 1185 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 1186 | + struct dentry *dir; | |
| 1143 | 1187 | struct drm_minor *minor = adev_to_drm(adev)->primary; |
| 1144 | 1188 | |
| 1145 | − con->dir = debugfs_create_dir(RAS_FS_NAME, minor->debugfs_root); | |
| 1146 | − debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, con->dir, | |
| 1147 | − adev, &amdgpu_ras_debugfs_ctrl_ops); | |
| 1148 | − debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir, | |
| 1149 | − adev, &amdgpu_ras_debugfs_eeprom_ops); | |
| 1189 | + dir = debugfs_create_dir(RAS_FS_NAME, minor->debugfs_root); | |
| 1190 | + debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, dir, adev, | |
| 1191 | + &amdgpu_ras_debugfs_ctrl_ops); | |
| 1192 | + debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, dir, adev, | |
| 1193 | + &amdgpu_ras_debugfs_eeprom_ops); | |
| 1150 | 1194 | |
| 1151 | 1195 | /* |
| 1152 | 1196 | * After one uncorrectable error happens, usually GPU recovery will |
| @@ -1156,24 +1200,24 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev) · 3 unmodified lines | ||
| 1156 | 1200 | * ERREVENT_ATHUB_INTERRUPT generated. Normal GPU recovery routine |
| 1157 | 1201 | * will never be called. |
| 1158 | 1202 | */ |
| 1159 | − debugfs_create_bool("auto_reboot", S_IWUGO | S_IRUGO, con->dir, | |
| 1160 | − &con->reboot); | |
| 1203 | + debugfs_create_bool("auto_reboot", S_IWUGO | S_IRUGO, dir, &con->reboot); | |
| 1161 | 1204 | |
| 1162 | 1205 | /* |
| 1163 | 1206 | * User could set this not to clean up hardware's error count register |
| 1164 | 1207 | * of RAS IPs during ras recovery. |
| 1165 | 1208 | */ |
| 1166 | − debugfs_create_bool("disable_ras_err_cnt_harvest", 0644, | |
| 1167 | − con->dir, &con->disable_ras_err_cnt_harvest); | |
| 1209 | + debugfs_create_bool("disable_ras_err_cnt_harvest", 0644, dir, | |
| 1210 | + &con->disable_ras_err_cnt_harvest); | |
| 1211 | + return dir; | |
| 1168 | 1212 | } |
| 1169 | 1213 | |
| 1170 | 1214 | static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev, |
| 1171 | − struct ras_fs_if *head) | |
| 1215 | + struct ras_fs_if *head, | |
| 1216 | + struct dentry *dir) | |
| 1172 | 1217 | { |
| 1173 | − struct amdgpu_ras *con = amdgpu_ras_get_context(adev); | |
| 1174 | 1218 | struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head->head); |
| 1175 | 1219 | |
| 1176 | − if (!obj || obj->ent) | |
| 1220 | + if (!obj || !dir) | |
| 1177 | 1221 | return; |
| 1178 | 1222 | |
| 1179 | 1223 | get_obj(obj); |
| @@ -1182,14 +1226,14 @@ static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev, · 2 unmodified lines | ||
| 1182 | 1226 | head->debugfs_name, |
| 1183 | 1227 | sizeof(obj->fs_data.debugfs_name)); |
| 1184 | 1228 | |
| 1185 | − obj->ent = debugfs_create_file(obj->fs_data.debugfs_name, | |
| 1186 | − S_IWUGO | S_IRUGO, con->dir, obj, | |
| 1187 | − &amdgpu_ras_debugfs_ops); | |
| 1229 | + debugfs_create_file(obj->fs_data.debugfs_name, S_IWUGO | S_IRUGO, dir, | |
| 1230 | + obj, &amdgpu_ras_debugfs_ops); | |
| 1188 | 1231 | } |
| 1189 | 1232 | |
| 1190 | 1233 | void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) |
| 1191 | 1234 | { |
| 1192 | 1235 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 1236 | + struct dentry *dir; | |
| 1193 | 1237 | struct ras_manager *obj; |
| 1194 | 1238 | struct ras_fs_if fs_info; |
| 1195 | 1239 | |
| @@ -1200,7 +1244,7 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) · 4 unmodified lines | ||
| 1200 | 1244 | if (!IS_ENABLED(CONFIG_DEBUG_FS) || !con) |
| 1201 | 1245 | return; |
| 1202 | 1246 | |
| 1203 | − amdgpu_ras_debugfs_create_ctrl_node(adev); | |
| 1247 | + dir = amdgpu_ras_debugfs_create_ctrl_node(adev); | |
| 1204 | 1248 | |
| 1205 | 1249 | list_for_each_entry(obj, &con->head, node) { |
| 1206 | 1250 | if (amdgpu_ras_is_supported(adev, obj->head.block) && |
| @@ -1208,34 +1252,11 @@ void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev) · 1 unmodified line | ||
| 1208 | 1252 | sprintf(fs_info.debugfs_name, "%s_err_inject", |
| 1209 | 1253 | ras_block_str(obj->head.block)); |
| 1210 | 1254 | fs_info.head = obj->head; |
| 1211 | − amdgpu_ras_debugfs_create(adev, &fs_info); | |
| 1255 | + amdgpu_ras_debugfs_create(adev, &fs_info, dir); | |
| 1212 | 1256 | } |
| 1213 | 1257 | } |
| 1214 | 1258 | } |
| 1215 | 1259 | |
| 1216 | −static void amdgpu_ras_debugfs_remove(struct amdgpu_device *adev, | |
| 1217 | − struct ras_common_if *head) | |
| 1218 | −{ | |
| 1219 | − struct ras_manager *obj = amdgpu_ras_find_obj(adev, head); | |
| 1220 | − | |
| 1221 | − if (!obj || !obj->ent) | |
| 1222 | − return; | |
| 1223 | − | |
| 1224 | − obj->ent = NULL; | |
| 1225 | − put_obj(obj); | |
| 1226 | −} | |
| 1227 | − | |
| 1228 | −static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev) | |
| 1229 | −{ | |
| 1230 | − struct amdgpu_ras *con = amdgpu_ras_get_context(adev); | |
| 1231 | − struct ras_manager *obj, *tmp; | |
| 1232 | − | |
| 1233 | − list_for_each_entry_safe(obj, tmp, &con->head, node) { | |
| 1234 | − amdgpu_ras_debugfs_remove(adev, &obj->head); | |
| 1235 | − } | |
| 1236 | − | |
| 1237 | − con->dir = NULL; | |
| 1238 | −} | |
| 1239 | 1260 | /* debugfs end */ |
| 1240 | 1261 | |
| 1241 | 1262 | /* ras fs */ |
| @@ -1282,8 +1303,17 @@ static int amdgpu_ras_fs_init(struct amdgpu_device *adev) · 40 unmodified lines | ||
| 1282 | 1303 | |
| 1283 | 1304 | static int amdgpu_ras_fs_fini(struct amdgpu_device *adev) |
| 1284 | 1305 | { |
| 1285 | − if (IS_ENABLED(CONFIG_DEBUG_FS)) | |
| 1286 | − amdgpu_ras_debugfs_remove_all(adev); | |
| 1306 | + struct amdgpu_ras *con = amdgpu_ras_get_context(adev); | |
| 1307 | + struct ras_manager *con_obj, *ip_obj, *tmp; | |
| 1308 | + | |
| 1309 | + if (IS_ENABLED(CONFIG_DEBUG_FS)) { | |
| 1310 | + list_for_each_entry_safe(con_obj, tmp, &con->head, node) { | |
| 1311 | + ip_obj = amdgpu_ras_find_obj(adev, &con_obj->head); | |
| 1312 | + if (ip_obj) | |
| 1313 | + put_obj(ip_obj); | |
| 1314 | + } | |
| 1315 | + } | |
| 1316 | + | |
| 1287 | 1317 | amdgpu_ras_sysfs_remove_all(adev); |
| 1288 | 1318 | return 0; |
| 1289 | 1319 | } |
| @@ -1447,7 +1477,7 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev) · 157 unmodified lines | ||
| 1447 | 1477 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 1448 | 1478 | struct ras_manager *obj; |
| 1449 | 1479 | |
| 1450 | − if (!con) | |
| 1480 | + if (!adev->ras_features || !con) | |
| 1451 | 1481 | return; |
| 1452 | 1482 | |
| 1453 | 1483 | list_for_each_entry(obj, &con->head, node) { |
| @@ -1464,7 +1494,7 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev) · 10 unmodified lines | ||
| 1464 | 1494 | if (info.head.block == AMDGPU_RAS_BLOCK__PCIE_BIF) |
| 1465 | 1495 | continue; |
| 1466 | 1496 | |
| 1467 | − amdgpu_ras_error_query(adev, &info); | |
| 1497 | + amdgpu_ras_query_error_status(adev, &info); | |
| 1468 | 1498 | } |
| 1469 | 1499 | } |
| 1470 | 1500 | |
| @@ -1495,7 +1525,7 @@ static void amdgpu_ras_query_err_status(struct amdgpu_device *adev) · 24 unmodified lines | ||
| 1495 | 1525 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 1496 | 1526 | struct ras_manager *obj; |
| 1497 | 1527 | |
| 1498 | − if (!con) | |
| 1528 | + if (!adev->ras_features || !con) | |
| 1499 | 1529 | return; |
| 1500 | 1530 | |
| 1501 | 1531 | list_for_each_entry(obj, &con->head, node) { |
| @@ -1809,7 +1839,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) · 307 unmodified lines | ||
| 1809 | 1839 | bool exc_err_limit = false; |
| 1810 | 1840 | int ret; |
| 1811 | 1841 | |
| 1812 | − if (con) | |
| 1842 | + if (adev->ras_features && con) | |
| 1813 | 1843 | data = &con->eh_data; |
| 1814 | 1844 | else |
| 1815 | 1845 | return 0; |
| @@ -1828,6 +1858,12 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev) · 12 unmodified lines | ||
| 1828 | 1858 | max_eeprom_records_len = amdgpu_ras_eeprom_get_record_max_length(); |
| 1829 | 1859 | amdgpu_ras_validate_threshold(adev, max_eeprom_records_len); |
| 1830 | 1860 | |
| 1861 | + /* Todo: During test the SMU might fail to read the eeprom through I2C | |
| 1862 | + * when the GPU is pending on XGMI reset during probe time | |
| 1863 | + * (Mostly after second bus reset), skip it now | |
| 1864 | + */ | |
| 1865 | + if (adev->gmc.xgmi.pending_reset) | |
| 1866 | + return 0; | |
| 1831 | 1867 | ret = amdgpu_ras_eeprom_init(&con->eeprom_control, &exc_err_limit); |
| 1832 | 1868 | /* |
| 1833 | 1869 | * This calling fails when exc_err_limit is true or |
| @@ -1928,11 +1964,11 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev, · 94 unmodified lines | ||
| 1928 | 1964 | return; |
| 1929 | 1965 | |
| 1930 | 1966 | if (amdgpu_atomfirmware_mem_ecc_supported(adev)) { |
| 1931 | − dev_info(adev->dev, "HBM ECC is active.\n"); | |
| 1967 | + dev_info(adev->dev, "MEM ECC is active.\n"); | |
| 1932 | 1968 | *hw_supported |= (1 << AMDGPU_RAS_BLOCK__UMC | |
| 1933 | 1969 | 1 << AMDGPU_RAS_BLOCK__DF); |
| 1934 | 1970 | } else |
| 1935 | − dev_info(adev->dev, "HBM ECC is not presented.\n"); | |
| 1971 | + dev_info(adev->dev, "MEM ECC is not presented.\n"); | |
| 1936 | 1972 | |
| 1937 | 1973 | if (amdgpu_atomfirmware_sram_ecc_supported(adev)) { |
| 1938 | 1974 | dev_info(adev->dev, "SRAM ECC is active.\n"); |
| @@ -1970,6 +2006,15 @@ int amdgpu_ras_init(struct amdgpu_device *adev) · 31 unmodified lines | ||
| 1970 | 2006 | amdgpu_ras_check_supported(adev, &con->hw_supported, |
| 1971 | 2007 | &con->supported); |
| 1972 | 2008 | if (!con->hw_supported || (adev->asic_type == CHIP_VEGA10)) { |
| 2009 | + /* set gfx block ras context feature for VEGA20 Gaming | |
| 2010 | + * send ras disable cmd to ras ta during ras late init. | |
| 2011 | + */ | |
| 2012 | + if (!adev->ras_features && adev->asic_type == CHIP_VEGA20) { | |
| 2013 | + con->features |= BIT(AMDGPU_RAS_BLOCK__GFX); | |
| 2014 | + | |
| 2015 | + return 0; | |
| 2016 | + } | |
| 2017 | + | |
| 1973 | 2018 | r = 0; |
| 1974 | 2019 | goto release_con; |
| 1975 | 2020 | } |
| @@ -2083,8 +2128,12 @@ void amdgpu_ras_resume(struct amdgpu_device *adev) · 107 unmodified lines | ||
| 2083 | 2128 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 2084 | 2129 | struct ras_manager *obj, *tmp; |
| 2085 | 2130 | |
| 2086 | − if (!con) | |
| 2131 | + if (!adev->ras_features || !con) { | |
| 2132 | + /* clean ras context for VEGA20 Gaming after send ras disable cmd */ | |
| 2133 | + amdgpu_release_ras_context(adev); | |
| 2134 | + | |
| 2087 | 2135 | return; |
| 2136 | + } | |
| 2088 | 2137 | |
| 2089 | 2138 | if (con->flags & AMDGPU_RAS_FLAG_INIT_BY_VBIOS) { |
| 2090 | 2139 | /* Set up all other IPs which are not implemented. There is a |
| @@ -2125,7 +2174,7 @@ void amdgpu_ras_suspend(struct amdgpu_device *adev) · 34 unmodified lines | ||
| 2125 | 2174 | { |
| 2126 | 2175 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 2127 | 2176 | |
| 2128 | − if (!con) | |
| 2177 | + if (!adev->ras_features || !con) | |
| 2129 | 2178 | return; |
| 2130 | 2179 | |
| 2131 | 2180 | amdgpu_ras_disable_all_features(adev, 0); |
| @@ -2139,7 +2188,7 @@ int amdgpu_ras_pre_fini(struct amdgpu_device *adev) · 7 unmodified lines | ||
| 2139 | 2188 | { |
| 2140 | 2189 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 2141 | 2190 | |
| 2142 | − if (!con) | |
| 2191 | + if (!adev->ras_features || !con) | |
| 2143 | 2192 | return 0; |
| 2144 | 2193 | |
| 2145 | 2194 | /* Need disable ras on all IPs here before ip [hw/sw]fini */ |
| @@ -2152,7 +2201,7 @@ int amdgpu_ras_fini(struct amdgpu_device *adev) · 6 unmodified lines | ||
| 2152 | 2201 | { |
| 2153 | 2202 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 2154 | 2203 | |
| 2155 | − if (!con) | |
| 2204 | + if (!adev->ras_features || !con) | |
| 2156 | 2205 | return 0; |
| 2157 | 2206 | |
| 2158 | 2207 | amdgpu_ras_fs_fini(adev); |
| @@ -2196,18 +2245,16 @@ bool amdgpu_ras_need_emergency_restart(struct amdgpu_device *adev) · 37 unmodified lines | ||
| 2196 | 2245 | return false; |
| 2197 | 2246 | } |
| 2198 | 2247 | |
| 2199 | −bool amdgpu_ras_check_err_threshold(struct amdgpu_device *adev) | |
| 2248 | +void amdgpu_release_ras_context(struct amdgpu_device *adev) | |
| 2200 | 2249 | { |
| 2201 | 2250 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| 2202 | − bool exc_err_limit = false; | |
| 2203 | 2251 | |
| 2204 | − if (con && (amdgpu_bad_page_threshold != 0)) | |
| 2205 | − amdgpu_ras_eeprom_check_err_threshold(&con->eeprom_control, | |
| 2206 | − &exc_err_limit); | |
| 2252 | + if (!con) | |
| 2253 | + return; | |
| 2207 | 2254 | |
| 2208 | − /* | |
| 2209 | − * We are only interested in variable exc_err_limit, | |
| 2210 | − * as it says if GPU is in bad state or not. | |
| 2211 | − */ | |
| 2212 | − return exc_err_limit; | |
| 2255 | + if (!adev->ras_features && con->features & BIT(AMDGPU_RAS_BLOCK__GFX)) { | |
| 2256 | + con->features &= ~BIT(AMDGPU_RAS_BLOCK__GFX); | |
| 2257 | + amdgpu_ras_set_context(adev, NULL); | |
| 2258 | + kfree(con); | |
| 2259 | + } | |
| 2213 | 2260 | } |
| @@ -318,8 +318,6 @@ struct amdgpu_ras { · 317 unmodified lines | ||
| 318 | 318 | uint32_t supported; |
| 319 | 319 | uint32_t features; |
| 320 | 320 | struct list_head head; |
| 321 | − /* debugfs */ | |
| 322 | − struct dentry *dir; | |
| 323 | 321 | /* sysfs */ |
| 324 | 322 | struct device_attribute features_attr; |
| 325 | 323 | struct bin_attribute badpages_attr; |
| @@ -395,8 +393,6 @@ struct ras_manager { · 69 unmodified lines | ||
| 395 | 393 | struct list_head node; |
| 396 | 394 | /* the device */ |
| 397 | 395 | struct amdgpu_device *adev; |
| 398 | − /* debugfs */ | |
| 399 | − struct dentry *ent; | |
| 400 | 396 | /* sysfs */ |
| 401 | 397 | struct device_attribute sysfs_attr; |
| 402 | 398 | int attr_inuse; |
| @@ -495,8 +491,6 @@ void amdgpu_ras_suspend(struct amdgpu_device *adev); · 92 unmodified lines | ||
| 495 | 491 | unsigned long amdgpu_ras_query_error_count(struct amdgpu_device *adev, |
| 496 | 492 | bool is_ce); |
| 497 | 493 | |
| 498 | −bool amdgpu_ras_check_err_threshold(struct amdgpu_device *adev); | |
| 499 | − | |
| 500 | 494 | /* error handling functions */ |
| 501 | 495 | int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev, |
| 502 | 496 | struct eeprom_table_record *bps, int pages); |
| @@ -594,9 +588,12 @@ int amdgpu_ras_sysfs_remove(struct amdgpu_device *adev, · 91 unmodified lines | ||
| 594 | 588 | |
| 595 | 589 | void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev); |
| 596 | 590 | |
| 597 | −int amdgpu_ras_error_query(struct amdgpu_device *adev, | |
| 591 | +int amdgpu_ras_query_error_status(struct amdgpu_device *adev, | |
| 598 | 592 | struct ras_query_if *info); |
| 599 | 593 | |
| 594 | +int amdgpu_ras_reset_error_status(struct amdgpu_device *adev, | |
| 595 | + enum amdgpu_ras_block block); | |
| 596 | + | |
| 600 | 597 | int amdgpu_ras_error_inject(struct amdgpu_device *adev, |
| 601 | 598 | struct ras_inject_if *info); |
| 602 | 599 | |
| @@ -629,4 +626,6 @@ void amdgpu_ras_global_ras_isr(struct amdgpu_device *adev); · 26 unmodified lines | ||
| 629 | 626 | void amdgpu_ras_set_error_query_ready(struct amdgpu_device *adev, bool ready); |
| 630 | 627 | |
| 631 | 628 | bool amdgpu_ras_need_emergency_restart(struct amdgpu_device *adev); |
| 629 | + | |
| 630 | +void amdgpu_release_ras_context(struct amdgpu_device *adev); | |
| 632 | 631 | #endif |
| @@ -434,47 +434,28 @@ static uint32_t __correct_eeprom_dest_address(uint32_t curr_address) · 433 unmodified lines | ||
| 434 | 434 | return curr_address; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | −int amdgpu_ras_eeprom_check_err_threshold( | |
| 438 | − struct amdgpu_ras_eeprom_control *control, | |
| 439 | − bool *exceed_err_limit) | |
| 437 | +bool amdgpu_ras_eeprom_check_err_threshold(struct amdgpu_device *adev) | |
| 440 | 438 | { |
| 441 | − struct amdgpu_device *adev = to_amdgpu_device(control); | |
| 442 | − unsigned char buff[EEPROM_ADDRESS_SIZE + | |
| 443 | − EEPROM_TABLE_HEADER_SIZE] = { 0 }; | |
| 444 | − struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr; | |
| 445 | − struct i2c_msg msg = { | |
| 446 | − .addr = control->i2c_address, | |
| 447 | − .flags = I2C_M_RD, | |
| 448 | − .len = EEPROM_ADDRESS_SIZE + EEPROM_TABLE_HEADER_SIZE, | |
| 449 | − .buf = buff, | |
| 450 | − }; | |
| 451 | − int ret; | |
| 452 | − | |
| 453 | − *exceed_err_limit = false; | |
| 439 | + struct amdgpu_ras *con = amdgpu_ras_get_context(adev); | |
| 454 | 440 | |
| 455 | 441 | if (!__is_ras_eeprom_supported(adev)) |
| 456 | − return 0; | |
| 457 | − | |
| 458 | − /* read EEPROM table header */ | |
| 459 | − mutex_lock(&control->tbl_mutex); | |
| 460 | − ret = i2c_transfer(&adev->pm.smu_i2c, &msg, 1); | |
| 461 | − if (ret < 1) { | |
| 462 | − dev_err(adev->dev, "Failed to read EEPROM table header.\n"); | |
| 463 | − goto err; | |
| 464 | − } | |
| 442 | + return false; | |
| 465 | 443 | |
| 466 | − __decode_table_header_from_buff(hdr, &buff[2]); | |
| 444 | + /* skip check eeprom table for VEGA20 Gaming */ | |
| 445 | + if (!con) | |
| 446 | + return false; | |
| 447 | + else | |
| 448 | + if (!(con->features & BIT(AMDGPU_RAS_BLOCK__UMC))) | |
| 449 | + return false; | |
| 467 | 450 | |
| 468 | − if (hdr->header == EEPROM_TABLE_HDR_BAD) { | |
| 451 | + if (con->eeprom_control.tbl_hdr.header == EEPROM_TABLE_HDR_BAD) { | |
| 469 | 452 | dev_warn(adev->dev, "This GPU is in BAD status."); |
| 470 | 453 | dev_warn(adev->dev, "Please retire it or setting one bigger " |
| 471 | 454 | "threshold value when reloading driver.\n"); |
| 472 | − *exceed_err_limit = true; | |
| 455 | + return true; | |
| 473 | 456 | } |
| 474 | 457 | |
| 475 | −err: | |
| 476 | − mutex_unlock(&control->tbl_mutex); | |
| 477 | − return 0; | |
| 458 | + return false; | |
| 478 | 459 | } |
| 479 | 460 | |
| 480 | 461 | int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control, |
| @@ -80,9 +80,7 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · 79 unmodified lines | ||
| 80 | 80 | bool *exceed_err_limit); |
| 81 | 81 | int amdgpu_ras_eeprom_reset_table(struct amdgpu_ras_eeprom_control *control); |
| 82 | 82 | |
| 83 | −int amdgpu_ras_eeprom_check_err_threshold( | |
| 84 | − struct amdgpu_ras_eeprom_control *control, | |
| 85 | − bool *exceed_err_limit); | |
| 83 | +bool amdgpu_ras_eeprom_check_err_threshold(struct amdgpu_device *adev); | |
| 86 | 84 | |
| 87 | 85 | int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control, |
| 88 | 86 | struct eeprom_table_record *records, |
| @@ -0,0 +1,105 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 OR MIT | |
| 2 | +/* | |
| 3 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 4 | + * | |
| 5 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 6 | + * copy of this software and associated documentation files (the "Software"), | |
| 7 | + * to deal in the Software without restriction, including without limitation | |
| 8 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 9 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 10 | + * Software is furnished to do so, subject to the following conditions: | |
| 11 | + * | |
| 12 | + * The above copyright notice and this permission notice shall be included in | |
| 13 | + * all copies or substantial portions of the Software. | |
| 14 | + * | |
| 15 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 18 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 19 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 20 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 21 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 22 | + * | |
| 23 | + * Authors: Christian König | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#ifndef __AMDGPU_RES_CURSOR_H__ | |
| 27 | +#define __AMDGPU_RES_CURSOR_H__ | |
| 28 | + | |
| 29 | +#include <drm/drm_mm.h> | |
| 30 | +#include <drm/ttm/ttm_resource.h> | |
| 31 | + | |
| 32 | +/* state back for walking over vram_mgr and gtt_mgr allocations */ | |
| 33 | +struct amdgpu_res_cursor { | |
| 34 | + uint64_t start; | |
| 35 | + uint64_t size; | |
| 36 | + uint64_t remaining; | |
| 37 | + struct drm_mm_node *node; | |
| 38 | +}; | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * amdgpu_res_first - initialize a amdgpu_res_cursor | |
| 42 | + * | |
| 43 | + * @res: TTM resource object to walk | |
| 44 | + * @start: Start of the range | |
| 45 | + * @size: Size of the range | |
| 46 | + * @cur: cursor object to initialize | |
| 47 | + * | |
| 48 | + * Start walking over the range of allocations between @start and @size. | |
| 49 | + */ | |
| 50 | +static inline void amdgpu_res_first(struct ttm_resource *res, | |
| 51 | + uint64_t start, uint64_t size, | |
| 52 | + struct amdgpu_res_cursor *cur) | |
| 53 | +{ | |
| 54 | + struct drm_mm_node *node; | |
| 55 | + | |
| 56 | + if (!res || !res->mm_node) { | |
| 57 | + cur->start = start; | |
| 58 | + cur->size = size; | |
| 59 | + cur->remaining = size; | |
| 60 | + cur->node = NULL; | |
| 61 | + return; | |
| 62 | + } | |
| 63 | + | |
| 64 | + BUG_ON(start + size > res->num_pages << PAGE_SHIFT); | |
| 65 | + | |
| 66 | + node = res->mm_node; | |
| 67 | + while (start > node->size << PAGE_SHIFT) | |
| 68 | + start -= node++->size << PAGE_SHIFT; | |
| 69 | + | |
| 70 | + cur->start = (node->start << PAGE_SHIFT) + start; | |
| 71 | + cur->size = min((node->size << PAGE_SHIFT) - start, size); | |
| 72 | + cur->remaining = size; | |
| 73 | + cur->node = node; | |
| 74 | +} | |
| 75 | + | |
| 76 | +/** | |
| 77 | + * amdgpu_res_next - advance the cursor | |
| 78 | + * | |
| 79 | + * @cur: the cursor to advance | |
| 80 | + * @size: number of bytes to move forward | |
| 81 | + * | |
| 82 | + * Move the cursor @size bytes forwrad, walking to the next node if necessary. | |
| 83 | + */ | |
| 84 | +static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size) | |
| 85 | +{ | |
| 86 | + struct drm_mm_node *node = cur->node; | |
| 87 | + | |
| 88 | + BUG_ON(size > cur->remaining); | |
| 89 | + | |
| 90 | + cur->remaining -= size; | |
| 91 | + if (!cur->remaining) | |
| 92 | + return; | |
| 93 | + | |
| 94 | + cur->size -= size; | |
| 95 | + if (cur->size) { | |
| 96 | + cur->start += size; | |
| 97 | + return; | |
| 98 | + } | |
| 99 | + | |
| 100 | + cur->node = ++node; | |
| 101 | + cur->start = node->start << PAGE_SHIFT; | |
| 102 | + cur->size = min(node->size << PAGE_SHIFT, cur->remaining); | |
| 103 | +} | |
| 104 | + | |
| 105 | +#endif | |
| @@ -64,6 +64,11 @@ struct amdgpu_sdma { · 63 unmodified lines | ||
| 64 | 64 | struct amdgpu_irq_src trap_irq; |
| 65 | 65 | struct amdgpu_irq_src illegal_inst_irq; |
| 66 | 66 | struct amdgpu_irq_src ecc_irq; |
| 67 | + struct amdgpu_irq_src vm_hole_irq; | |
| 68 | + struct amdgpu_irq_src doorbell_invalid_irq; | |
| 69 | + struct amdgpu_irq_src pool_timeout_irq; | |
| 70 | + struct amdgpu_irq_src srbm_write_irq; | |
| 71 | + | |
| 67 | 72 | int num_instances; |
| 68 | 73 | uint32_t srbm_soft_reset; |
| 69 | 74 | bool has_page_queue; |
| @@ -69,6 +69,9 @@ void psp_securedisplay_parse_resp_status(struct psp_context *psp, · 68 unmodified lines | ||
| 69 | 69 | case TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR: |
| 70 | 70 | dev_err(psp->adev->dev, "Secure display: Failed to Read CRC"); |
| 71 | 71 | break; |
| 72 | + case TA_SECUREDISPLAY_STATUS__I2C_INIT_ERROR: | |
| 73 | + dev_err(psp->adev->dev, "Secure display: Failed to initialize I2C."); | |
| 74 | + break; | |
| 72 | 75 | default: |
| 73 | 76 | dev_err(psp->adev->dev, "Secure display: Failed to parse status: %d\n", status); |
| 74 | 77 | } |
| @@ -28,6 +28,8 @@ struct amdgpu_smuio_funcs { · 27 unmodified lines | ||
| 28 | 28 | u32 (*get_rom_data_offset)(struct amdgpu_device *adev); |
| 29 | 29 | void (*update_rom_clock_gating)(struct amdgpu_device *adev, bool enable); |
| 30 | 30 | void (*get_clock_gating_state)(struct amdgpu_device *adev, u32 *flags); |
| 31 | + u32 (*get_die_id)(struct amdgpu_device *adev); | |
| 32 | + bool (*is_host_gpu_xgmi_supported)(struct amdgpu_device *adev); | |
| 31 | 33 | }; |
| 32 | 34 | |
| 33 | 35 | struct amdgpu_smuio { |
| @@ -47,7 +47,6 @@ · 46 unmodified lines | ||
| 47 | 47 | #include <drm/ttm/ttm_bo_driver.h> |
| 48 | 48 | #include <drm/ttm/ttm_placement.h> |
| 49 | 49 | |
| 50 | −#include <drm/drm_debugfs.h> | |
| 51 | 50 | #include <drm/amdgpu_drm.h> |
| 52 | 51 | |
| 53 | 52 | #include "amdgpu.h" |
| @@ -57,6 +56,7 @@ · 3 unmodified lines | ||
| 57 | 56 | #include "amdgpu_sdma.h" |
| 58 | 57 | #include "amdgpu_ras.h" |
| 59 | 58 | #include "amdgpu_atomfirmware.h" |
| 59 | +#include "amdgpu_res_cursor.h" | |
| 60 | 60 | #include "bif/bif_4_1_d.h" |
| 61 | 61 | |
| 62 | 62 | #define AMDGPU_TTM_VRAM_MAX_DW_READ (size_t)128 |
| @@ -178,55 +178,12 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp) · 115 unmodified lines | ||
| 178 | 178 | filp->private_data); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | −/** | |
| 182 | − * amdgpu_mm_node_addr - Compute the GPU relative offset of a GTT buffer. | |
| 183 | − * | |
| 184 | − * @bo: The bo to assign the memory to. | |
| 185 | − * @mm_node: Memory manager node for drm allocator. | |
| 186 | − * @mem: The region where the bo resides. | |
| 187 | − * | |
| 188 | − */ | |
| 189 | −static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo, | |
| 190 | − struct drm_mm_node *mm_node, | |
| 191 | − struct ttm_resource *mem) | |
| 192 | −{ | |
| 193 | − uint64_t addr = 0; | |
| 194 | − | |
| 195 | − if (mm_node->start != AMDGPU_BO_INVALID_OFFSET) { | |
| 196 | − addr = mm_node->start << PAGE_SHIFT; | |
| 197 | − addr += amdgpu_ttm_domain_start(amdgpu_ttm_adev(bo->bdev), | |
| 198 | − mem->mem_type); | |
| 199 | − } | |
| 200 | − return addr; | |
| 201 | −} | |
| 202 | − | |
| 203 | −/** | |
| 204 | − * amdgpu_find_mm_node - Helper function finds the drm_mm_node corresponding to | |
| 205 | − * @offset. It also modifies the offset to be within the drm_mm_node returned | |
| 206 | − * | |
| 207 | − * @mem: The region where the bo resides. | |
| 208 | − * @offset: The offset that drm_mm_node is used for finding. | |
| 209 | − * | |
| 210 | − */ | |
| 211 | −static struct drm_mm_node *amdgpu_find_mm_node(struct ttm_resource *mem, | |
| 212 | − uint64_t *offset) | |
| 213 | −{ | |
| 214 | − struct drm_mm_node *mm_node = mem->mm_node; | |
| 215 | − | |
| 216 | − while (*offset >= (mm_node->size << PAGE_SHIFT)) { | |
| 217 | − *offset -= (mm_node->size << PAGE_SHIFT); | |
| 218 | − ++mm_node; | |
| 219 | − } | |
| 220 | − return mm_node; | |
| 221 | −} | |
| 222 | − | |
| 223 | 181 | /** |
| 224 | 182 | * amdgpu_ttm_map_buffer - Map memory into the GART windows |
| 225 | 183 | * @bo: buffer object to map |
| 226 | 184 | * @mem: memory object to map |
| 227 | − * @mm_node: drm_mm node object to map | |
| 185 | + * @mm_cur: range to map | |
| 228 | 186 | * @num_pages: number of pages to map |
| 229 | − * @offset: offset into @mm_node where to start | |
| 230 | 187 | * @window: which GART window to use |
| 231 | 188 | * @ring: DMA ring to use for the copy |
| 232 | 189 | * @tmz: if we should setup a TMZ enabled mapping |
| @@ -237,10 +194,10 @@ static struct drm_mm_node *amdgpu_find_mm_node(struct ttm_resource *mem, · 4 unmodified lines | ||
| 237 | 194 | */ |
| 238 | 195 | static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, |
| 239 | 196 | struct ttm_resource *mem, |
| 240 | − struct drm_mm_node *mm_node, | |
| 241 | − unsigned num_pages, uint64_t offset, | |
| 242 | − unsigned window, struct amdgpu_ring *ring, | |
| 243 | − bool tmz, uint64_t *addr) | |
| 197 | + struct amdgpu_res_cursor *mm_cur, | |
| 198 | + unsigned num_pages, unsigned window, | |
| 199 | + struct amdgpu_ring *ring, bool tmz, | |
| 200 | + uint64_t *addr) | |
| 244 | 201 | { |
| 245 | 202 | struct amdgpu_device *adev = ring->adev; |
| 246 | 203 | struct amdgpu_job *job; |
| @@ -257,14 +214,15 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · 10 unmodified lines | ||
| 257 | 214 | |
| 258 | 215 | /* Map only what can't be accessed directly */ |
| 259 | 216 | if (!tmz && mem->start != AMDGPU_BO_INVALID_OFFSET) { |
| 260 | − *addr = amdgpu_mm_node_addr(bo, mm_node, mem) + offset; | |
| 217 | + *addr = amdgpu_ttm_domain_start(adev, mem->mem_type) + | |
| 218 | + mm_cur->start; | |
| 261 | 219 | return 0; |
| 262 | 220 | } |
| 263 | 221 | |
| 264 | 222 | *addr = adev->gmc.gart_start; |
| 265 | 223 | *addr += (u64)window * AMDGPU_GTT_MAX_TRANSFER_SIZE * |
| 266 | 224 | AMDGPU_GPU_PAGE_SIZE; |
| 267 | − *addr += offset & ~PAGE_MASK; | |
| 225 | + *addr += mm_cur->start & ~PAGE_MASK; | |
| 268 | 226 | |
| 269 | 227 | num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8); |
| 270 | 228 | num_bytes = num_pages * 8; |
| @@ -292,17 +250,17 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo, · 21 unmodified lines | ||
| 292 | 250 | cpu_addr = &job->ibs[0].ptr[num_dw]; |
| 293 | 251 | |
| 294 | 252 | if (mem->mem_type == TTM_PL_TT) { |
| 295 | − dma_addr_t *dma_address; | |
| 253 | + dma_addr_t *dma_addr; | |
| 296 | 254 | |
| 297 | − dma_address = &bo->ttm->dma_address[offset >> PAGE_SHIFT]; | |
| 298 | − r = amdgpu_gart_map(adev, 0, num_pages, dma_address, flags, | |
| 255 | + dma_addr = &bo->ttm->dma_address[mm_cur->start >> PAGE_SHIFT]; | |
| 256 | + r = amdgpu_gart_map(adev, 0, num_pages, dma_addr, flags, | |
| 299 | 257 | cpu_addr); |
| 300 | 258 | if (r) |
| 301 | 259 | goto error_free; |
| 302 | 260 | } else { |
| 303 | 261 | dma_addr_t dma_address; |
| 304 | 262 | |
| 305 | − dma_address = (mm_node->start << PAGE_SHIFT) + offset; | |
| 263 | + dma_address = mm_cur->start; | |
| 306 | 264 | dma_address += adev->vm_manager.vram_base_offset; |
| 307 | 265 | |
| 308 | 266 | for (i = 0; i < num_pages; ++i) { |
| @@ -354,9 +312,8 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 45 unmodified lines | ||
| 354 | 312 | const uint32_t GTT_MAX_BYTES = (AMDGPU_GTT_MAX_TRANSFER_SIZE * |
| 355 | 313 | AMDGPU_GPU_PAGE_SIZE); |
| 356 | 314 | |
| 357 | − uint64_t src_node_size, dst_node_size, src_offset, dst_offset; | |
| 358 | 315 | struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring; |
| 359 | − struct drm_mm_node *src_mm, *dst_mm; | |
| 316 | + struct amdgpu_res_cursor src_mm, dst_mm; | |
| 360 | 317 | struct dma_fence *fence = NULL; |
| 361 | 318 | int r = 0; |
| 362 | 319 | |
| @@ -365,29 +322,13 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 2 unmodified lines | ||
| 365 | 322 | return -EINVAL; |
| 366 | 323 | } |
| 367 | 324 | |
| 368 | − src_offset = src->offset; | |
| 369 | − if (src->mem->mm_node) { | |
| 370 | − src_mm = amdgpu_find_mm_node(src->mem, &src_offset); | |
| 371 | − src_node_size = (src_mm->size << PAGE_SHIFT) - src_offset; | |
| 372 | − } else { | |
| 373 | − src_mm = NULL; | |
| 374 | − src_node_size = ULLONG_MAX; | |
| 375 | − } | |
| 376 | − | |
| 377 | − dst_offset = dst->offset; | |
| 378 | − if (dst->mem->mm_node) { | |
| 379 | − dst_mm = amdgpu_find_mm_node(dst->mem, &dst_offset); | |
| 380 | − dst_node_size = (dst_mm->size << PAGE_SHIFT) - dst_offset; | |
| 381 | − } else { | |
| 382 | − dst_mm = NULL; | |
| 383 | − dst_node_size = ULLONG_MAX; | |
| 384 | − } | |
| 325 | + amdgpu_res_first(src->mem, src->offset, size, &src_mm); | |
| 326 | + amdgpu_res_first(dst->mem, dst->offset, size, &dst_mm); | |
| 385 | 327 | |
| 386 | 328 | mutex_lock(&adev->mman.gtt_window_lock); |
| 387 | − | |
| 388 | − while (size) { | |
| 389 | − uint32_t src_page_offset = src_offset & ~PAGE_MASK; | |
| 390 | − uint32_t dst_page_offset = dst_offset & ~PAGE_MASK; | |
| 329 | + while (src_mm.remaining) { | |
| 330 | + uint32_t src_page_offset = src_mm.start & ~PAGE_MASK; | |
| 331 | + uint32_t dst_page_offset = dst_mm.start & ~PAGE_MASK; | |
| 391 | 332 | struct dma_fence *next; |
| 392 | 333 | uint32_t cur_size; |
| 393 | 334 | uint64_t from, to; |
| @@ -396,19 +337,19 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 2 unmodified lines | ||
| 396 | 337 | * begins at an offset, then adjust the size accordingly |
| 397 | 338 | */ |
| 398 | 339 | cur_size = max(src_page_offset, dst_page_offset); |
| 399 | − cur_size = min(min3(src_node_size, dst_node_size, size), | |
| 340 | + cur_size = min(min3(src_mm.size, dst_mm.size, size), | |
| 400 | 341 | (uint64_t)(GTT_MAX_BYTES - cur_size)); |
| 401 | 342 | |
| 402 | 343 | /* Map src to window 0 and dst to window 1. */ |
| 403 | − r = amdgpu_ttm_map_buffer(src->bo, src->mem, src_mm, | |
| 344 | + r = amdgpu_ttm_map_buffer(src->bo, src->mem, &src_mm, | |
| 404 | 345 | PFN_UP(cur_size + src_page_offset), |
| 405 | − src_offset, 0, ring, tmz, &from); | |
| 346 | + 0, ring, tmz, &from); | |
| 406 | 347 | if (r) |
| 407 | 348 | goto error; |
| 408 | 349 | |
| 409 | − r = amdgpu_ttm_map_buffer(dst->bo, dst->mem, dst_mm, | |
| 350 | + r = amdgpu_ttm_map_buffer(dst->bo, dst->mem, &dst_mm, | |
| 410 | 351 | PFN_UP(cur_size + dst_page_offset), |
| 411 | − dst_offset, 1, ring, tmz, &to); | |
| 352 | + 1, ring, tmz, &to); | |
| 412 | 353 | if (r) |
| 413 | 354 | goto error; |
| 414 | 355 | |
| @@ -420,27 +361,8 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 5 unmodified lines | ||
| 420 | 361 | dma_fence_put(fence); |
| 421 | 362 | fence = next; |
| 422 | 363 | |
| 423 | − size -= cur_size; | |
| 424 | − if (!size) | |
| 425 | − break; | |
| 426 | − | |
| 427 | − src_node_size -= cur_size; | |
| 428 | − if (!src_node_size) { | |
| 429 | − ++src_mm; | |
| 430 | − src_node_size = src_mm->size << PAGE_SHIFT; | |
| 431 | − src_offset = 0; | |
| 432 | − } else { | |
| 433 | − src_offset += cur_size; | |
| 434 | − } | |
| 435 | − | |
| 436 | − dst_node_size -= cur_size; | |
| 437 | − if (!dst_node_size) { | |
| 438 | − ++dst_mm; | |
| 439 | − dst_node_size = dst_mm->size << PAGE_SHIFT; | |
| 440 | − dst_offset = 0; | |
| 441 | − } else { | |
| 442 | − dst_offset += cur_size; | |
| 443 | − } | |
| 364 | + amdgpu_res_next(&src_mm, cur_size); | |
| 365 | + amdgpu_res_next(&dst_mm, cur_size); | |
| 444 | 366 | } |
| 445 | 367 | error: |
| 446 | 368 | mutex_unlock(&adev->mman.gtt_window_lock); |
| @@ -519,7 +441,8 @@ error: · 72 unmodified lines | ||
| 519 | 441 | static bool amdgpu_mem_visible(struct amdgpu_device *adev, |
| 520 | 442 | struct ttm_resource *mem) |
| 521 | 443 | { |
| 522 | − struct drm_mm_node *nodes = mem->mm_node; | |
| 444 | + uint64_t mem_size = (u64)mem->num_pages << PAGE_SHIFT; | |
| 445 | + struct amdgpu_res_cursor cursor; | |
| 523 | 446 | |
| 524 | 447 | if (mem->mem_type == TTM_PL_SYSTEM || |
| 525 | 448 | mem->mem_type == TTM_PL_TT) |
| @@ -527,12 +450,13 @@ static bool amdgpu_mem_visible(struct amdgpu_device *adev, · 1 unmodified line | ||
| 527 | 450 | if (mem->mem_type != TTM_PL_VRAM) |
| 528 | 451 | return false; |
| 529 | 452 | |
| 453 | + amdgpu_res_first(mem, 0, mem_size, &cursor); | |
| 454 | + | |
| 530 | 455 | /* ttm_resource_ioremap only supports contiguous memory */ |
| 531 | − if (nodes->size != mem->num_pages) | |
| 456 | + if (cursor.size != mem_size) | |
| 532 | 457 | return false; |
| 533 | 458 | |
| 534 | − return ((nodes->start + nodes->size) << PAGE_SHIFT) | |
| 535 | − <= adev->gmc.visible_vram_size; | |
| 459 | + return cursor.start + cursor.size <= adev->gmc.visible_vram_size; | |
| 536 | 460 | } |
| 537 | 461 | |
| 538 | 462 | /* |
| @@ -674,7 +598,10 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resourc · 135 unmodified lines | ||
| 674 | 598 | |
| 675 | 599 | mem->bus.offset += adev->gmc.aper_base; |
| 676 | 600 | mem->bus.is_iomem = true; |
| 677 | − mem->bus.caching = ttm_write_combined; | |
| 601 | + if (adev->gmc.xgmi.connected_to_cpu) | |
| 602 | + mem->bus.caching = ttm_cached; | |
| 603 | + else | |
| 604 | + mem->bus.caching = ttm_write_combined; | |
| 678 | 605 | break; |
| 679 | 606 | default: |
| 680 | 607 | return -EINVAL; |
| @@ -686,12 +613,10 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo, · 5 unmodified lines | ||
| 686 | 613 | unsigned long page_offset) |
| 687 | 614 | { |
| 688 | 615 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); |
| 689 | − uint64_t offset = (page_offset << PAGE_SHIFT); | |
| 690 | − struct drm_mm_node *mm; | |
| 616 | + struct amdgpu_res_cursor cursor; | |
| 691 | 617 | |
| 692 | − mm = amdgpu_find_mm_node(&bo->mem, &offset); | |
| 693 | − offset += adev->gmc.aper_base; | |
| 694 | − return mm->start + (offset >> PAGE_SHIFT); | |
| 618 | + amdgpu_res_first(&bo->mem, (u64)page_offset << PAGE_SHIFT, 0, &cursor); | |
| 619 | + return (adev->gmc.aper_base + cursor.start) >> PAGE_SHIFT; | |
| 695 | 620 | } |
| 696 | 621 | |
| 697 | 622 | /** |
| @@ -1430,6 +1355,10 @@ uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem) · 732 unmodified lines | ||
| 1430 | 1355 | flags |= AMDGPU_PTE_SNOOPED; |
| 1431 | 1356 | } |
| 1432 | 1357 | |
| 1358 | + if (mem && mem->mem_type == TTM_PL_VRAM && | |
| 1359 | + mem->bus.caching == ttm_cached) | |
| 1360 | + flags |= AMDGPU_PTE_SNOOPED; | |
| 1361 | + | |
| 1433 | 1362 | return flags; |
| 1434 | 1363 | } |
| 1435 | 1364 | |
| @@ -1469,7 +1398,7 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, · 33 unmodified lines | ||
| 1469 | 1398 | const struct ttm_place *place) |
| 1470 | 1399 | { |
| 1471 | 1400 | unsigned long num_pages = bo->mem.num_pages; |
| 1472 | − struct drm_mm_node *node = bo->mem.mm_node; | |
| 1401 | + struct amdgpu_res_cursor cursor; | |
| 1473 | 1402 | struct dma_resv_list *flist; |
| 1474 | 1403 | struct dma_fence *f; |
| 1475 | 1404 | int i; |
| @@ -1501,13 +1430,15 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, · 25 unmodified lines | ||
| 1501 | 1430 | |
| 1502 | 1431 | case TTM_PL_VRAM: |
| 1503 | 1432 | /* Check each drm MM node individually */ |
| 1504 | − while (num_pages) { | |
| 1505 | − if (place->fpfn < (node->start + node->size) && | |
| 1506 | − !(place->lpfn && place->lpfn <= node->start)) | |
| 1433 | + amdgpu_res_first(&bo->mem, 0, (u64)num_pages << PAGE_SHIFT, | |
| 1434 | + &cursor); | |
| 1435 | + while (cursor.remaining) { | |
| 1436 | + if (place->fpfn < PFN_DOWN(cursor.start + cursor.size) | |
| 1437 | + && !(place->lpfn && | |
| 1438 | + place->lpfn <= PFN_DOWN(cursor.start))) | |
| 1507 | 1439 | return true; |
| 1508 | 1440 | |
| 1509 | − num_pages -= node->size; | |
| 1510 | − ++node; | |
| 1441 | + amdgpu_res_next(&cursor, cursor.size); | |
| 1511 | 1442 | } |
| 1512 | 1443 | return false; |
| 1513 | 1444 | |
| @@ -1531,41 +1462,36 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, · 17 unmodified lines | ||
| 1531 | 1462 | * access for debugging purposes. |
| 1532 | 1463 | */ |
| 1533 | 1464 | static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, |
| 1534 | − unsigned long offset, | |
| 1535 | − void *buf, int len, int write) | |
| 1465 | + unsigned long offset, void *buf, int len, | |
| 1466 | + int write) | |
| 1536 | 1467 | { |
| 1537 | 1468 | struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo); |
| 1538 | 1469 | struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev); |
| 1539 | − struct drm_mm_node *nodes; | |
| 1470 | + struct amdgpu_res_cursor cursor; | |
| 1471 | + unsigned long flags; | |
| 1540 | 1472 | uint32_t value = 0; |
| 1541 | 1473 | int ret = 0; |
| 1542 | − uint64_t pos; | |
| 1543 | − unsigned long flags; | |
| 1544 | 1474 | |
| 1545 | 1475 | if (bo->mem.mem_type != TTM_PL_VRAM) |
| 1546 | 1476 | return -EIO; |
| 1547 | 1477 | |
| 1548 | − pos = offset; | |
| 1549 | − nodes = amdgpu_find_mm_node(&abo->tbo.mem, &pos); | |
| 1550 | − pos += (nodes->start << PAGE_SHIFT); | |
| 1551 | − | |
| 1552 | − while (len && pos < adev->gmc.mc_vram_size) { | |
| 1553 | − uint64_t aligned_pos = pos & ~(uint64_t)3; | |
| 1554 | − uint64_t bytes = 4 - (pos & 3); | |
| 1555 | − uint32_t shift = (pos & 3) * 8; | |
| 1478 | + amdgpu_res_first(&bo->mem, offset, len, &cursor); | |
| 1479 | + while (cursor.remaining) { | |
| 1480 | + uint64_t aligned_pos = cursor.start & ~(uint64_t)3; | |
| 1481 | + uint64_t bytes = 4 - (cursor.start & 3); | |
| 1482 | + uint32_t shift = (cursor.start & 3) * 8; | |
| 1556 | 1483 | uint32_t mask = 0xffffffff << shift; |
| 1557 | 1484 | |
| 1558 | − if (len < bytes) { | |
| 1559 | − mask &= 0xffffffff >> (bytes - len) * 8; | |
| 1560 | − bytes = len; | |
| 1485 | + if (cursor.size < bytes) { | |
| 1486 | + mask &= 0xffffffff >> (bytes - cursor.size) * 8; | |
| 1487 | + bytes = cursor.size; | |
| 1561 | 1488 | } |
| 1562 | 1489 | |
| 1563 | 1490 | if (mask != 0xffffffff) { |
| 1564 | 1491 | spin_lock_irqsave(&adev->mmio_idx_lock, flags); |
| 1565 | 1492 | WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)aligned_pos) | 0x80000000); |
| 1566 | 1493 | WREG32_NO_KIQ(mmMM_INDEX_HI, aligned_pos >> 31); |
| 1567 | − if (!write || mask != 0xffffffff) | |
| 1568 | − value = RREG32_NO_KIQ(mmMM_DATA); | |
| 1494 | + value = RREG32_NO_KIQ(mmMM_DATA); | |
| 1569 | 1495 | if (write) { |
| 1570 | 1496 | value &= ~mask; |
| 1571 | 1497 | value |= (*(uint32_t *)buf << shift) & mask; |
| @@ -1577,21 +1503,15 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, · 5 unmodified lines | ||
| 1577 | 1503 | memcpy(buf, &value, bytes); |
| 1578 | 1504 | } |
| 1579 | 1505 | } else { |
| 1580 | − bytes = (nodes->start + nodes->size) << PAGE_SHIFT; | |
| 1581 | − bytes = min(bytes - pos, (uint64_t)len & ~0x3ull); | |
| 1582 | − | |
| 1583 | − amdgpu_device_vram_access(adev, pos, (uint32_t *)buf, | |
| 1584 | − bytes, write); | |
| 1506 | + bytes = cursor.size & 0x3ull; | |
| 1507 | + amdgpu_device_vram_access(adev, cursor.start, | |
| 1508 | + (uint32_t *)buf, bytes, | |
| 1509 | + write); | |
| 1585 | 1510 | } |
| 1586 | 1511 | |
| 1587 | 1512 | ret += bytes; |
| 1588 | 1513 | buf = (uint8_t *)buf + bytes; |
| 1589 | − pos += bytes; | |
| 1590 | − len -= bytes; | |
| 1591 | − if (pos >= (nodes->start + nodes->size) << PAGE_SHIFT) { | |
| 1592 | − ++nodes; | |
| 1593 | − pos = (nodes->start << PAGE_SHIFT); | |
| 1594 | − } | |
| 1514 | + amdgpu_res_next(&cursor, bytes); | |
| 1595 | 1515 | } |
| 1596 | 1516 | |
| 1597 | 1517 | return ret; |
| @@ -1696,7 +1616,7 @@ static void amdgpu_ttm_training_data_block_init(struct amdgpu_device *adev) · 98 unmodified lines | ||
| 1696 | 1616 | (adev->gmc.mc_vram_size - GDDR6_MEM_TRAINING_OFFSET); |
| 1697 | 1617 | ctx->train_data_size = |
| 1698 | 1618 | GDDR6_MEM_TRAINING_DATA_SIZE_IN_BYTES; |
| 1699 | − | |
| 1619 | + | |
| 1700 | 1620 | DRM_DEBUG("train_data_size:%llx,p2c_train_data_offset:%llx,c2p_train_data_offset:%llx.\n", |
| 1701 | 1621 | ctx->train_data_size, |
| 1702 | 1622 | ctx->p2c_train_data_offset, |
| @@ -1812,8 +1732,15 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) · 109 unmodified lines | ||
| 1812 | 1732 | /* Change the size here instead of the init above so only lpfn is affected */ |
| 1813 | 1733 | amdgpu_ttm_set_buffer_funcs_status(adev, false); |
| 1814 | 1734 | #ifdef CONFIG_64BIT |
| 1815 | − adev->mman.aper_base_kaddr = ioremap_wc(adev->gmc.aper_base, | |
| 1816 | − adev->gmc.visible_vram_size); | |
| 1735 | +#ifdef CONFIG_X86 | |
| 1736 | + if (adev->gmc.xgmi.connected_to_cpu) | |
| 1737 | + adev->mman.aper_base_kaddr = ioremap_cache(adev->gmc.aper_base, | |
| 1738 | + adev->gmc.visible_vram_size); | |
| 1739 | + | |
| 1740 | + else | |
| 1741 | +#endif | |
| 1742 | + adev->mman.aper_base_kaddr = ioremap_wc(adev->gmc.aper_base, | |
| 1743 | + adev->gmc.visible_vram_size); | |
| 1817 | 1744 | #endif |
| 1818 | 1745 | |
| 1819 | 1746 | /* |
| @@ -2053,7 +1980,8 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, · 233 unmodified lines | ||
| 2053 | 1980 | return r; |
| 2054 | 1981 | |
| 2055 | 1982 | if (vm_needs_flush) { |
| 2056 | − job->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gart.bo); | |
| 1983 | + job->vm_pd_addr = amdgpu_gmc_pd_addr(adev->gmc.pdb0_bo ? | |
| 1984 | + adev->gmc.pdb0_bo : adev->gart.bo); | |
| 2057 | 1985 | job->vm_needs_flush = true; |
| 2058 | 1986 | } |
| 2059 | 1987 | if (resv) { |
| @@ -2104,9 +2032,9 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, · 44 unmodified lines | ||
| 2104 | 2032 | uint32_t max_bytes = adev->mman.buffer_funcs->fill_max_bytes; |
| 2105 | 2033 | struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring; |
| 2106 | 2034 | |
| 2107 | − struct drm_mm_node *mm_node; | |
| 2108 | − unsigned long num_pages; | |
| 2035 | + struct amdgpu_res_cursor cursor; | |
| 2109 | 2036 | unsigned int num_loops, num_dw; |
| 2037 | + uint64_t num_bytes; | |
| 2110 | 2038 | |
| 2111 | 2039 | struct amdgpu_job *job; |
| 2112 | 2040 | int r; |
| @@ -2122,15 +2050,13 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, · 9 unmodified lines | ||
| 2122 | 2050 | return r; |
| 2123 | 2051 | } |
| 2124 | 2052 | |
| 2125 | − num_pages = bo->tbo.mem.num_pages; | |
| 2126 | − mm_node = bo->tbo.mem.mm_node; | |
| 2053 | + num_bytes = bo->tbo.mem.num_pages << PAGE_SHIFT; | |
| 2127 | 2054 | num_loops = 0; |
| 2128 | − while (num_pages) { | |
| 2129 | − uint64_t byte_count = mm_node->size << PAGE_SHIFT; | |
| 2130 | 2055 | |
| 2131 | − num_loops += DIV_ROUND_UP_ULL(byte_count, max_bytes); | |
| 2132 | − num_pages -= mm_node->size; | |
| 2133 | − ++mm_node; | |
| 2056 | + amdgpu_res_first(&bo->tbo.mem, 0, num_bytes, &cursor); | |
| 2057 | + while (cursor.remaining) { | |
| 2058 | + num_loops += DIV_ROUND_UP_ULL(cursor.size, max_bytes); | |
| 2059 | + amdgpu_res_next(&cursor, cursor.size); | |
| 2134 | 2060 | } |
| 2135 | 2061 | num_dw = num_loops * adev->mman.buffer_funcs->fill_num_dw; |
| 2136 | 2062 | |
| @@ -2152,27 +2078,16 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, · 15 unmodified lines | ||
| 2152 | 2078 | } |
| 2153 | 2079 | } |
| 2154 | 2080 | |
| 2155 | − num_pages = bo->tbo.mem.num_pages; | |
| 2156 | − mm_node = bo->tbo.mem.mm_node; | |
| 2157 | − | |
| 2158 | − while (num_pages) { | |
| 2159 | − uint64_t byte_count = mm_node->size << PAGE_SHIFT; | |
| 2160 | − uint64_t dst_addr; | |
| 2161 | − | |
| 2162 | − dst_addr = amdgpu_mm_node_addr(&bo->tbo, mm_node, &bo->tbo.mem); | |
| 2163 | − while (byte_count) { | |
| 2164 | − uint32_t cur_size_in_bytes = min_t(uint64_t, byte_count, | |
| 2165 | − max_bytes); | |
| 2081 | + amdgpu_res_first(&bo->tbo.mem, 0, num_bytes, &cursor); | |
| 2082 | + while (cursor.remaining) { | |
| 2083 | + uint32_t cur_size = min_t(uint64_t, cursor.size, max_bytes); | |
| 2084 | + uint64_t dst_addr = cursor.start; | |
| 2166 | 2085 | |
| 2167 | − amdgpu_emit_fill_buffer(adev, &job->ibs[0], src_data, | |
| 2168 | − dst_addr, cur_size_in_bytes); | |
| 2086 | + dst_addr += amdgpu_ttm_domain_start(adev, bo->tbo.mem.mem_type); | |
| 2087 | + amdgpu_emit_fill_buffer(adev, &job->ibs[0], src_data, dst_addr, | |
| 2088 | + cur_size); | |
| 2169 | 2089 | |
| 2170 | − dst_addr += cur_size_in_bytes; | |
| 2171 | − byte_count -= cur_size_in_bytes; | |
| 2172 | − } | |
| 2173 | − | |
| 2174 | − num_pages -= mm_node->size; | |
| 2175 | − ++mm_node; | |
| 2090 | + amdgpu_res_next(&cursor, cur_size); | |
| 2176 | 2091 | } |
| 2177 | 2092 | |
| 2178 | 2093 | amdgpu_ring_pad_ib(ring, &job->ibs[0]); |
| @@ -2191,36 +2106,74 @@ error_free: · 12 unmodified lines | ||
| 2191 | 2106 | |
| 2192 | 2107 | #if defined(CONFIG_DEBUG_FS) |
| 2193 | 2108 | |
| 2194 | −static int amdgpu_mm_dump_table(struct seq_file *m, void *data) | |
| 2109 | +static int amdgpu_mm_vram_table_show(struct seq_file *m, void *unused) | |
| 2195 | 2110 | { |
| 2196 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 2197 | − unsigned ttm_pl = (uintptr_t)node->info_ent->data; | |
| 2198 | − struct drm_device *dev = node->minor->dev; | |
| 2199 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 2200 | − struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, ttm_pl); | |
| 2111 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2112 | + struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, | |
| 2113 | + TTM_PL_VRAM); | |
| 2201 | 2114 | struct drm_printer p = drm_seq_file_printer(m); |
| 2202 | 2115 | |
| 2203 | 2116 | man->func->debug(man, &p); |
| 2204 | 2117 | return 0; |
| 2205 | 2118 | } |
| 2206 | 2119 | |
| 2207 | −static int amdgpu_ttm_pool_debugfs(struct seq_file *m, void *data) | |
| 2120 | +static int amdgpu_ttm_page_pool_show(struct seq_file *m, void *unused) | |
| 2208 | 2121 | { |
| 2209 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 2210 | − struct drm_device *dev = node->minor->dev; | |
| 2211 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 2122 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2212 | 2123 | |
| 2213 | 2124 | return ttm_pool_debugfs(&adev->mman.bdev.pool, m); |
| 2214 | 2125 | } |
| 2215 | 2126 | |
| 2216 | −static const struct drm_info_list amdgpu_ttm_debugfs_list[] = { | |
| 2217 | − {"amdgpu_vram_mm", amdgpu_mm_dump_table, 0, (void *)TTM_PL_VRAM}, | |
| 2218 | − {"amdgpu_gtt_mm", amdgpu_mm_dump_table, 0, (void *)TTM_PL_TT}, | |
| 2219 | − {"amdgpu_gds_mm", amdgpu_mm_dump_table, 0, (void *)AMDGPU_PL_GDS}, | |
| 2220 | − {"amdgpu_gws_mm", amdgpu_mm_dump_table, 0, (void *)AMDGPU_PL_GWS}, | |
| 2221 | − {"amdgpu_oa_mm", amdgpu_mm_dump_table, 0, (void *)AMDGPU_PL_OA}, | |
| 2222 | − {"ttm_page_pool", amdgpu_ttm_pool_debugfs, 0, NULL}, | |
| 2223 | −}; | |
| 2127 | +static int amdgpu_mm_tt_table_show(struct seq_file *m, void *unused) | |
| 2128 | +{ | |
| 2129 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2130 | + struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, | |
| 2131 | + TTM_PL_TT); | |
| 2132 | + struct drm_printer p = drm_seq_file_printer(m); | |
| 2133 | + | |
| 2134 | + man->func->debug(man, &p); | |
| 2135 | + return 0; | |
| 2136 | +} | |
| 2137 | + | |
| 2138 | +static int amdgpu_mm_gds_table_show(struct seq_file *m, void *unused) | |
| 2139 | +{ | |
| 2140 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2141 | + struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, | |
| 2142 | + AMDGPU_PL_GDS); | |
| 2143 | + struct drm_printer p = drm_seq_file_printer(m); | |
| 2144 | + | |
| 2145 | + man->func->debug(man, &p); | |
| 2146 | + return 0; | |
| 2147 | +} | |
| 2148 | + | |
| 2149 | +static int amdgpu_mm_gws_table_show(struct seq_file *m, void *unused) | |
| 2150 | +{ | |
| 2151 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2152 | + struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, | |
| 2153 | + AMDGPU_PL_GWS); | |
| 2154 | + struct drm_printer p = drm_seq_file_printer(m); | |
| 2155 | + | |
| 2156 | + man->func->debug(man, &p); | |
| 2157 | + return 0; | |
| 2158 | +} | |
| 2159 | + | |
| 2160 | +static int amdgpu_mm_oa_table_show(struct seq_file *m, void *unused) | |
| 2161 | +{ | |
| 2162 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2163 | + struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, | |
| 2164 | + AMDGPU_PL_OA); | |
| 2165 | + struct drm_printer p = drm_seq_file_printer(m); | |
| 2166 | + | |
| 2167 | + man->func->debug(man, &p); | |
| 2168 | + return 0; | |
| 2169 | +} | |
| 2170 | + | |
| 2171 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_mm_vram_table); | |
| 2172 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_mm_tt_table); | |
| 2173 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_mm_gds_table); | |
| 2174 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_mm_gws_table); | |
| 2175 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_mm_oa_table); | |
| 2176 | +DEFINE_SHOW_ATTRIBUTE(amdgpu_ttm_page_pool); | |
| 2224 | 2177 | |
| 2225 | 2178 | /* |
| 2226 | 2179 | * amdgpu_ttm_vram_read - Linear read access to VRAM |
| @@ -2308,58 +2261,6 @@ static const struct file_operations amdgpu_ttm_vram_fops = { · 81 unmodified lines | ||
| 2308 | 2261 | .llseek = default_llseek, |
| 2309 | 2262 | }; |
| 2310 | 2263 | |
| 2311 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 2312 | − | |
| 2313 | −/* | |
| 2314 | − * amdgpu_ttm_gtt_read - Linear read access to GTT memory | |
| 2315 | − */ | |
| 2316 | −static ssize_t amdgpu_ttm_gtt_read(struct file *f, char __user *buf, | |
| 2317 | − size_t size, loff_t *pos) | |
| 2318 | −{ | |
| 2319 | − struct amdgpu_device *adev = file_inode(f)->i_private; | |
| 2320 | − ssize_t result = 0; | |
| 2321 | − int r; | |
| 2322 | − | |
| 2323 | − while (size) { | |
| 2324 | − loff_t p = *pos / PAGE_SIZE; | |
| 2325 | − unsigned off = *pos & ~PAGE_MASK; | |
| 2326 | − size_t cur_size = min_t(size_t, size, PAGE_SIZE - off); | |
| 2327 | − struct page *page; | |
| 2328 | − void *ptr; | |
| 2329 | − | |
| 2330 | − if (p >= adev->gart.num_cpu_pages) | |
| 2331 | − return result; | |
| 2332 | − | |
| 2333 | − page = adev->gart.pages[p]; | |
| 2334 | − if (page) { | |
| 2335 | − ptr = kmap(page); | |
| 2336 | − ptr += off; | |
| 2337 | − | |
| 2338 | − r = copy_to_user(buf, ptr, cur_size); | |
| 2339 | − kunmap(adev->gart.pages[p]); | |
| 2340 | − } else | |
| 2341 | − r = clear_user(buf, cur_size); | |
| 2342 | − | |
| 2343 | − if (r) | |
| 2344 | − return -EFAULT; | |
| 2345 | − | |
| 2346 | − result += cur_size; | |
| 2347 | − buf += cur_size; | |
| 2348 | − *pos += cur_size; | |
| 2349 | − size -= cur_size; | |
| 2350 | − } | |
| 2351 | − | |
| 2352 | − return result; | |
| 2353 | −} | |
| 2354 | − | |
| 2355 | −static const struct file_operations amdgpu_ttm_gtt_fops = { | |
| 2356 | − .owner = THIS_MODULE, | |
| 2357 | − .read = amdgpu_ttm_gtt_read, | |
| 2358 | − .llseek = default_llseek | |
| 2359 | −}; | |
| 2360 | − | |
| 2361 | −#endif | |
| 2362 | − | |
| 2363 | 2264 | /* |
| 2364 | 2265 | * amdgpu_iomem_read - Virtual read access to GPU mapped memory |
| 2365 | 2266 | * |
| @@ -2474,46 +2375,29 @@ static const struct file_operations amdgpu_ttm_iomem_fops = { · 108 unmodified lines | ||
| 2474 | 2375 | .llseek = default_llseek |
| 2475 | 2376 | }; |
| 2476 | 2377 | |
| 2477 | −static const struct { | |
| 2478 | − char *name; | |
| 2479 | − const struct file_operations *fops; | |
| 2480 | − int domain; | |
| 2481 | −} ttm_debugfs_entries[] = { | |
| 2482 | − { "amdgpu_vram", &amdgpu_ttm_vram_fops, TTM_PL_VRAM }, | |
| 2483 | −#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS | |
| 2484 | − { "amdgpu_gtt", &amdgpu_ttm_gtt_fops, TTM_PL_TT }, | |
| 2485 | −#endif | |
| 2486 | − { "amdgpu_iomem", &amdgpu_ttm_iomem_fops, TTM_PL_SYSTEM }, | |
| 2487 | −}; | |
| 2488 | − | |
| 2489 | 2378 | #endif |
| 2490 | 2379 | |
| 2491 | −int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) | |
| 2380 | +void amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) | |
| 2492 | 2381 | { |
| 2493 | 2382 | #if defined(CONFIG_DEBUG_FS) |
| 2494 | − unsigned count; | |
| 2495 | − | |
| 2496 | 2383 | struct drm_minor *minor = adev_to_drm(adev)->primary; |
| 2497 | − struct dentry *ent, *root = minor->debugfs_root; | |
| 2498 | − | |
| 2499 | − for (count = 0; count < ARRAY_SIZE(ttm_debugfs_entries); count++) { | |
| 2500 | − ent = debugfs_create_file( | |
| 2501 | − ttm_debugfs_entries[count].name, | |
| 2502 | − S_IFREG | S_IRUGO, root, | |
| 2503 | − adev, | |
| 2504 | − ttm_debugfs_entries[count].fops); | |
| 2505 | − if (IS_ERR(ent)) | |
| 2506 | − return PTR_ERR(ent); | |
| 2507 | − if (ttm_debugfs_entries[count].domain == TTM_PL_VRAM) | |
| 2508 | − i_size_write(ent->d_inode, adev->gmc.mc_vram_size); | |
| 2509 | − else if (ttm_debugfs_entries[count].domain == TTM_PL_TT) | |
| 2510 | − i_size_write(ent->d_inode, adev->gmc.gart_size); | |
| 2511 | − adev->mman.debugfs_entries[count] = ent; | |
| 2512 | − } | |
| 2513 | − | |
| 2514 | − count = ARRAY_SIZE(amdgpu_ttm_debugfs_list); | |
| 2515 | − return amdgpu_debugfs_add_files(adev, amdgpu_ttm_debugfs_list, count); | |
| 2516 | −#else | |
| 2517 | − return 0; | |
| 2384 | + struct dentry *root = minor->debugfs_root; | |
| 2385 | + | |
| 2386 | + debugfs_create_file_size("amdgpu_vram", 0444, root, adev, | |
| 2387 | + &amdgpu_ttm_vram_fops, adev->gmc.mc_vram_size); | |
| 2388 | + debugfs_create_file("amdgpu_iomem", 0444, root, adev, | |
| 2389 | + &amdgpu_ttm_iomem_fops); | |
| 2390 | + debugfs_create_file("amdgpu_vram_mm", 0444, root, adev, | |
| 2391 | + &amdgpu_mm_vram_table_fops); | |
| 2392 | + debugfs_create_file("amdgpu_gtt_mm", 0444, root, adev, | |
| 2393 | + &amdgpu_mm_tt_table_fops); | |
| 2394 | + debugfs_create_file("amdgpu_gds_mm", 0444, root, adev, | |
| 2395 | + &amdgpu_mm_gds_table_fops); | |
| 2396 | + debugfs_create_file("amdgpu_gws_mm", 0444, root, adev, | |
| 2397 | + &amdgpu_mm_gws_table_fops); | |
| 2398 | + debugfs_create_file("amdgpu_oa_mm", 0444, root, adev, | |
| 2399 | + &amdgpu_mm_oa_table_fops); | |
| 2400 | + debugfs_create_file("ttm_page_pool", 0444, root, adev, | |
| 2401 | + &amdgpu_ttm_page_pool_fops); | |
| 2518 | 2402 | #endif |
| 2519 | 2403 | } |
| @@ -64,10 +64,6 @@ struct amdgpu_mman { · 63 unmodified lines | ||
| 64 | 64 | bool initialized; |
| 65 | 65 | void __iomem *aper_base_kaddr; |
| 66 | 66 | |
| 67 | −#if defined(CONFIG_DEBUG_FS) | |
| 68 | − struct dentry *debugfs_entries[8]; | |
| 69 | −#endif | |
| 70 | − | |
| 71 | 67 | /* buffer handling */ |
| 72 | 68 | const struct amdgpu_buffer_funcs *buffer_funcs; |
| 73 | 69 | struct amdgpu_ring *buffer_funcs_ring; |
| @@ -119,8 +115,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev, · 45 unmodified lines | ||
| 119 | 115 | struct device *dev, |
| 120 | 116 | enum dma_data_direction dir, |
| 121 | 117 | struct sg_table **sgt); |
| 122 | −void amdgpu_vram_mgr_free_sgt(struct amdgpu_device *adev, | |
| 123 | − struct device *dev, | |
| 118 | +void amdgpu_vram_mgr_free_sgt(struct device *dev, | |
| 124 | 119 | enum dma_data_direction dir, |
| 125 | 120 | struct sg_table *sgt); |
| 126 | 121 | uint64_t amdgpu_vram_mgr_usage(struct ttm_resource_manager *man); |
| @@ -186,6 +181,6 @@ uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem); · 59 unmodified lines | ||
| 186 | 181 | uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, |
| 187 | 182 | struct ttm_resource *mem); |
| 188 | 183 | |
| 189 | −int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev); | |
| 184 | +void amdgpu_ttm_debugfs_init(struct amdgpu_device *adev); | |
| 190 | 185 | |
| 191 | 186 | #endif |
| @@ -402,6 +402,7 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type) · 401 unmodified lines | ||
| 402 | 402 | case CHIP_NAVY_FLOUNDER: |
| 403 | 403 | case CHIP_VANGOGH: |
| 404 | 404 | case CHIP_DIMGREY_CAVEFISH: |
| 405 | + case CHIP_ALDEBARAN: | |
| 405 | 406 | if (!load_type) |
| 406 | 407 | return AMDGPU_FW_LOAD_DIRECT; |
| 407 | 408 | else |
| @@ -105,6 +105,9 @@ struct psp_firmware_header_v1_3 { · 104 unmodified lines | ||
| 105 | 105 | uint32_t spl_header_version; |
| 106 | 106 | uint32_t spl_offset_bytes; |
| 107 | 107 | uint32_t spl_size_bytes; |
| 108 | + uint32_t rl_header_version; | |
| 109 | + uint32_t rl_offset_bytes; | |
| 110 | + uint32_t rl_size_bytes; | |
| 108 | 111 | }; |
| 109 | 112 | |
| 110 | 113 | /* version_major=1, version_minor=0 */ |
| @@ -136,6 +139,7 @@ enum ta_fw_type { · 25 unmodified lines | ||
| 136 | 139 | TA_FW_TYPE_PSP_DTM, |
| 137 | 140 | TA_FW_TYPE_PSP_RAP, |
| 138 | 141 | TA_FW_TYPE_PSP_SECUREDISPLAY, |
| 142 | + TA_FW_TYPE_MAX_INDEX, | |
| 139 | 143 | }; |
| 140 | 144 | |
| 141 | 145 | struct ta_fw_bin_desc { |
| @@ -47,6 +47,7 @@ · 46 unmodified lines | ||
| 47 | 47 | #define FIRMWARE_NAVY_FLOUNDER "amdgpu/navy_flounder_vcn.bin" |
| 48 | 48 | #define FIRMWARE_VANGOGH "amdgpu/vangogh_vcn.bin" |
| 49 | 49 | #define FIRMWARE_DIMGREY_CAVEFISH "amdgpu/dimgrey_cavefish_vcn.bin" |
| 50 | +#define FIRMWARE_ALDEBARAN "amdgpu/aldebaran_vcn.bin" | |
| 50 | 51 | |
| 51 | 52 | MODULE_FIRMWARE(FIRMWARE_RAVEN); |
| 52 | 53 | MODULE_FIRMWARE(FIRMWARE_PICASSO); |
| @@ -54,6 +55,7 @@ MODULE_FIRMWARE(FIRMWARE_RAVEN2); · 1 unmodified line | ||
| 54 | 55 | MODULE_FIRMWARE(FIRMWARE_ARCTURUS); |
| 55 | 56 | MODULE_FIRMWARE(FIRMWARE_RENOIR); |
| 56 | 57 | MODULE_FIRMWARE(FIRMWARE_GREEN_SARDINE); |
| 58 | +MODULE_FIRMWARE(FIRMWARE_ALDEBARAN); | |
| 57 | 59 | MODULE_FIRMWARE(FIRMWARE_NAVI10); |
| 58 | 60 | MODULE_FIRMWARE(FIRMWARE_NAVI14); |
| 59 | 61 | MODULE_FIRMWARE(FIRMWARE_NAVI12); |
| @@ -100,6 +102,12 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · 40 unmodified lines | ||
| 100 | 102 | else |
| 101 | 103 | fw_name = FIRMWARE_GREEN_SARDINE; |
| 102 | 104 | |
| 105 | + if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && | |
| 106 | + (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) | |
| 107 | + adev->vcn.indirect_sram = true; | |
| 108 | + break; | |
| 109 | + case CHIP_ALDEBARAN: | |
| 110 | + fw_name = FIRMWARE_ALDEBARAN; | |
| 103 | 111 | if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) && |
| 104 | 112 | (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)) |
| 105 | 113 | adev->vcn.indirect_sram = true; |
| @@ -155,6 +155,7 @@ · 154 unmodified lines | ||
| 155 | 155 | } \ |
| 156 | 156 | } while (0) |
| 157 | 157 | |
| 158 | +#define AMDGPU_VCN_FW_SHARED_FLAG_0_RB (1 << 6) | |
| 158 | 159 | #define AMDGPU_VCN_MULTI_QUEUE_FLAG (1 << 8) |
| 159 | 160 | #define AMDGPU_VCN_SW_RING_FLAG (1 << 9) |
| 160 | 161 | |
| @@ -243,6 +244,12 @@ struct amdgpu_vcn { · 82 unmodified lines | ||
| 243 | 244 | int inst_idx, struct dpg_pause_state *new_state); |
| 244 | 245 | }; |
| 245 | 246 | |
| 247 | +struct amdgpu_fw_shared_rb_ptrs_struct { | |
| 248 | + /* to WA DPG R/W ptr issues.*/ | |
| 249 | + uint32_t rptr; | |
| 250 | + uint32_t wptr; | |
| 251 | +}; | |
| 252 | + | |
| 246 | 253 | struct amdgpu_fw_shared_multi_queue { |
| 247 | 254 | uint8_t decode_queue_mode; |
| 248 | 255 | uint8_t encode_generalpurpose_queue_mode; |
| @@ -258,10 +265,12 @@ struct amdgpu_fw_shared_sw_ring { · 9 unmodified lines | ||
| 258 | 265 | |
| 259 | 266 | struct amdgpu_fw_shared { |
| 260 | 267 | uint32_t present_flag_0; |
| 261 | − uint8_t pad[53]; | |
| 268 | + uint8_t pad[44]; | |
| 269 | + struct amdgpu_fw_shared_rb_ptrs_struct rb; | |
| 270 | + uint8_t pad1[1]; | |
| 262 | 271 | struct amdgpu_fw_shared_multi_queue multi_queue; |
| 263 | 272 | struct amdgpu_fw_shared_sw_ring sw_ring; |
| 264 | −} __attribute__((__packed__)); | |
| 273 | +}; | |
| 265 | 274 | |
| 266 | 275 | struct amdgpu_vcn_decode_buffer { |
| 267 | 276 | uint32_t valid_buf_flag; |
| @@ -640,6 +640,7 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev) · 639 unmodified lines | ||
| 640 | 640 | case CHIP_NAVI12: |
| 641 | 641 | case CHIP_SIENNA_CICHLID: |
| 642 | 642 | case CHIP_ARCTURUS: |
| 643 | + case CHIP_ALDEBARAN: | |
| 643 | 644 | reg = RREG32(mmRCC_IOV_FUNC_IDENTIFIER); |
| 644 | 645 | break; |
| 645 | 646 | default: /* other chip doesn't support SRIOV */ |
| @@ -92,13 +92,13 @@ struct amdgpu_prt_cb { · 91 unmodified lines | ||
| 92 | 92 | static inline void amdgpu_vm_eviction_lock(struct amdgpu_vm *vm) |
| 93 | 93 | { |
| 94 | 94 | mutex_lock(&vm->eviction_lock); |
| 95 | − vm->saved_flags = memalloc_nofs_save(); | |
| 95 | + vm->saved_flags = memalloc_noreclaim_save(); | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | static inline int amdgpu_vm_eviction_trylock(struct amdgpu_vm *vm) |
| 99 | 99 | { |
| 100 | 100 | if (mutex_trylock(&vm->eviction_lock)) { |
| 101 | − vm->saved_flags = memalloc_nofs_save(); | |
| 101 | + vm->saved_flags = memalloc_noreclaim_save(); | |
| 102 | 102 | return 1; |
| 103 | 103 | } |
| 104 | 104 | return 0; |
| @@ -106,7 +106,7 @@ static inline int amdgpu_vm_eviction_trylock(struct amdgpu_vm *vm) · 1 unmodified line | ||
| 106 | 106 | |
| 107 | 107 | static inline void amdgpu_vm_eviction_unlock(struct amdgpu_vm *vm) |
| 108 | 108 | { |
| 109 | − memalloc_nofs_restore(vm->saved_flags); | |
| 109 | + memalloc_noreclaim_restore(vm->saved_flags); | |
| 110 | 110 | mutex_unlock(&vm->eviction_lock); |
| 111 | 111 | } |
| 112 | 112 | |
| @@ -639,15 +639,13 @@ error_free: · 638 unmodified lines | ||
| 639 | 639 | /** |
| 640 | 640 | * amdgpu_vram_mgr_free_sgt - allocate and fill a sg table |
| 641 | 641 | * |
| 642 | − * @adev: amdgpu device pointer | |
| 643 | 642 | * @dev: device pointer |
| 644 | 643 | * @dir: data direction of resource to unmap |
| 645 | 644 | * @sgt: sg table to free |
| 646 | 645 | * |
| 647 | 646 | * Free a previously allocate sg table. |
| 648 | 647 | */ |
| 649 | −void amdgpu_vram_mgr_free_sgt(struct amdgpu_device *adev, | |
| 650 | − struct device *dev, | |
| 648 | +void amdgpu_vram_mgr_free_sgt(struct device *dev, | |
| 651 | 649 | enum dma_data_direction dir, |
| 652 | 650 | struct sg_table *sgt) |
| 653 | 651 | { |
| @@ -468,15 +468,22 @@ int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_dev · 467 unmodified lines | ||
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | |
| 471 | +/* | |
| 472 | + * NOTE psp_xgmi_node_info.num_hops layout is as follows: | |
| 473 | + * num_hops[7:6] = link type (0 = xGMI2, 1 = xGMI3, 2/3 = reserved) | |
| 474 | + * num_hops[5:3] = reserved | |
| 475 | + * num_hops[2:0] = number of hops | |
| 476 | + */ | |
| 471 | 477 | int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev, |
| 472 | 478 | struct amdgpu_device *peer_adev) |
| 473 | 479 | { |
| 474 | 480 | struct psp_xgmi_topology_info *top = &adev->psp.xgmi_context.top_info; |
| 481 | + uint8_t num_hops_mask = 0x7; | |
| 475 | 482 | int i; |
| 476 | 483 | |
| 477 | 484 | for (i = 0 ; i < top->num_nodes; ++i) |
| 478 | 485 | if (top->nodes[i].node_id == peer_adev->gmc.xgmi.node_id) |
| 479 | − return top->nodes[i].num_hops; | |
| 486 | + return top->nodes[i].num_hops & num_hops_mask; | |
| 480 | 487 | return -EINVAL; |
| 481 | 488 | } |
| 482 | 489 | |
| @@ -492,7 +499,8 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · 9 unmodified lines | ||
| 492 | 499 | if (!adev->gmc.xgmi.supported) |
| 493 | 500 | return 0; |
| 494 | 501 | |
| 495 | − if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) { | |
| 502 | + if (!adev->gmc.xgmi.pending_reset && | |
| 503 | + amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) { | |
| 496 | 504 | ret = psp_xgmi_initialize(&adev->psp); |
| 497 | 505 | if (ret) { |
| 498 | 506 | dev_err(adev->dev, |
| @@ -538,7 +546,8 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · 39 unmodified lines | ||
| 538 | 546 | |
| 539 | 547 | task_barrier_add_task(&hive->tb); |
| 540 | 548 | |
| 541 | − if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) { | |
| 549 | + if (!adev->gmc.xgmi.pending_reset && | |
| 550 | + amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) { | |
| 542 | 551 | list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) { |
| 543 | 552 | /* update node list for other device in the hive */ |
| 544 | 553 | if (tmp_adev != adev) { |
| @@ -567,7 +576,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) · 22 unmodified lines | ||
| 567 | 576 | } |
| 568 | 577 | } |
| 569 | 578 | |
| 570 | − if (!ret) | |
| 579 | + if (!ret && !adev->gmc.xgmi.pending_reset) | |
| 571 | 580 | ret = amdgpu_xgmi_sysfs_add_dev_info(adev, hive); |
| 572 | 581 | |
| 573 | 582 | exit_unlock: |
| @@ -74,10 +74,8 @@ int athub_v2_1_set_clockgating(struct amdgpu_device *adev, · 73 unmodified lines | ||
| 74 | 74 | case CHIP_SIENNA_CICHLID: |
| 75 | 75 | case CHIP_NAVY_FLOUNDER: |
| 76 | 76 | case CHIP_DIMGREY_CAVEFISH: |
| 77 | − athub_v2_1_update_medium_grain_clock_gating(adev, | |
| 78 | − state == AMD_CG_STATE_GATE ? true : false); | |
| 79 | − athub_v2_1_update_medium_grain_light_sleep(adev, | |
| 80 | − state == AMD_CG_STATE_GATE ? true : false); | |
| 77 | + athub_v2_1_update_medium_grain_clock_gating(adev, state == AMD_CG_STATE_GATE); | |
| 78 | + athub_v2_1_update_medium_grain_light_sleep(adev, state == AMD_CG_STATE_GATE); | |
| 81 | 79 | break; |
| 82 | 80 | default: |
| 83 | 81 | break; |
| @@ -114,11 +114,11 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, · 113 unmodified lines | ||
| 114 | 114 | base++; |
| 115 | 115 | break; |
| 116 | 116 | case ATOM_IIO_READ: |
| 117 | − temp = ctx->card->ioreg_read(ctx->card, CU16(base + 1)); | |
| 117 | + temp = ctx->card->reg_read(ctx->card, CU16(base + 1)); | |
| 118 | 118 | base += 3; |
| 119 | 119 | break; |
| 120 | 120 | case ATOM_IIO_WRITE: |
| 121 | − ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); | |
| 121 | + ctx->card->reg_write(ctx->card, CU16(base + 1), temp); | |
| 122 | 122 | base += 3; |
| 123 | 123 | break; |
| 124 | 124 | case ATOM_IIO_CLEAR: |
| @@ -116,8 +116,6 @@ struct card_info { · 115 unmodified lines | ||
| 116 | 116 | struct drm_device *dev; |
| 117 | 117 | void (* reg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ |
| 118 | 118 | uint32_t (* reg_read)(struct card_info *, uint32_t); /* filled by driver */ |
| 119 | − void (* ioreg_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ | |
| 120 | − uint32_t (* ioreg_read)(struct card_info *, uint32_t); /* filled by driver */ | |
| 121 | 119 | void (* mc_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ |
| 122 | 120 | uint32_t (* mc_read)(struct card_info *, uint32_t); /* filled by driver */ |
| 123 | 121 | void (* pll_write)(struct card_info *, uint32_t, uint32_t); /* filled by driver */ |
| @@ -26,6 +26,8 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <linux/module.h> |
| 27 | 27 | #include <linux/pci.h> |
| 28 | 28 | |
| 29 | +#include <drm/amdgpu_drm.h> | |
| 30 | + | |
| 29 | 31 | #include "amdgpu.h" |
| 30 | 32 | #include "amdgpu_atombios.h" |
| 31 | 33 | #include "amdgpu_ih.h" |
| @@ -70,6 +72,80 @@ · 38 unmodified lines | ||
| 70 | 72 | #include "amdgpu_amdkfd.h" |
| 71 | 73 | #include "dce_virtual.h" |
| 72 | 74 | |
| 75 | +static const struct amdgpu_video_codec_info cik_video_codecs_encode_array[] = | |
| 76 | +{ | |
| 77 | + { | |
| 78 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 79 | + .max_width = 2048, | |
| 80 | + .max_height = 1152, | |
| 81 | + .max_pixels_per_frame = 2048 * 1152, | |
| 82 | + .max_level = 0, | |
| 83 | + }, | |
| 84 | +}; | |
| 85 | + | |
| 86 | +static const struct amdgpu_video_codecs cik_video_codecs_encode = | |
| 87 | +{ | |
| 88 | + .codec_count = ARRAY_SIZE(cik_video_codecs_encode_array), | |
| 89 | + .codec_array = cik_video_codecs_encode_array, | |
| 90 | +}; | |
| 91 | + | |
| 92 | +static const struct amdgpu_video_codec_info cik_video_codecs_decode_array[] = | |
| 93 | +{ | |
| 94 | + { | |
| 95 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 96 | + .max_width = 2048, | |
| 97 | + .max_height = 1152, | |
| 98 | + .max_pixels_per_frame = 2048 * 1152, | |
| 99 | + .max_level = 3, | |
| 100 | + }, | |
| 101 | + { | |
| 102 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 103 | + .max_width = 2048, | |
| 104 | + .max_height = 1152, | |
| 105 | + .max_pixels_per_frame = 2048 * 1152, | |
| 106 | + .max_level = 5, | |
| 107 | + }, | |
| 108 | + { | |
| 109 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 110 | + .max_width = 2048, | |
| 111 | + .max_height = 1152, | |
| 112 | + .max_pixels_per_frame = 2048 * 1152, | |
| 113 | + .max_level = 41, | |
| 114 | + }, | |
| 115 | + { | |
| 116 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 117 | + .max_width = 2048, | |
| 118 | + .max_height = 1152, | |
| 119 | + .max_pixels_per_frame = 2048 * 1152, | |
| 120 | + .max_level = 4, | |
| 121 | + }, | |
| 122 | +}; | |
| 123 | + | |
| 124 | +static const struct amdgpu_video_codecs cik_video_codecs_decode = | |
| 125 | +{ | |
| 126 | + .codec_count = ARRAY_SIZE(cik_video_codecs_decode_array), | |
| 127 | + .codec_array = cik_video_codecs_decode_array, | |
| 128 | +}; | |
| 129 | + | |
| 130 | +static int cik_query_video_codecs(struct amdgpu_device *adev, bool encode, | |
| 131 | + const struct amdgpu_video_codecs **codecs) | |
| 132 | +{ | |
| 133 | + switch (adev->asic_type) { | |
| 134 | + case CHIP_BONAIRE: | |
| 135 | + case CHIP_HAWAII: | |
| 136 | + case CHIP_KAVERI: | |
| 137 | + case CHIP_KABINI: | |
| 138 | + case CHIP_MULLINS: | |
| 139 | + if (encode) | |
| 140 | + *codecs = &cik_video_codecs_encode; | |
| 141 | + else | |
| 142 | + *codecs = &cik_video_codecs_decode; | |
| 143 | + return 0; | |
| 144 | + default: | |
| 145 | + return -EINVAL; | |
| 146 | + } | |
| 147 | +} | |
| 148 | + | |
| 73 | 149 | /* |
| 74 | 150 | * Indirect registers accessor |
| 75 | 151 | */ |
| @@ -1933,6 +2009,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = · 1857 unmodified lines | ||
| 1933 | 2009 | .get_pcie_replay_count = &cik_get_pcie_replay_count, |
| 1934 | 2010 | .supports_baco = &cik_asic_supports_baco, |
| 1935 | 2011 | .pre_asic_init = &cik_pre_asic_init, |
| 2012 | + .query_video_codecs = &cik_query_video_codecs, | |
| 1936 | 2013 | }; |
| 1937 | 2014 | |
| 1938 | 2015 | static int cik_common_early_init(void *handle) |
| @@ -568,6 +568,8 @@ static int df_v3_6_pmc_stop(struct amdgpu_device *adev, uint64_t config, · 567 unmodified lines | ||
| 568 | 568 | if (ret) |
| 569 | 569 | return ret; |
| 570 | 570 | |
| 571 | + df_v3_6_perfmon_wreg(adev, lo_base_addr, lo_val, | |
| 572 | + hi_base_addr, hi_val); | |
| 571 | 573 | |
| 572 | 574 | if (is_remove) { |
| 573 | 575 | df_v3_6_reset_perfmon_cntr(adev, config, counter_idx); |
File mode changed from 100755 to 100644.
| @@ -6718,7 +6718,8 @@ static int gfx_v8_0_cp_ecc_error_irq(struct amdgpu_device *adev, · 6717 unmodified lines | ||
| 6718 | 6718 | return 0; |
| 6719 | 6719 | } |
| 6720 | 6720 | |
| 6721 | −static void gfx_v8_0_parse_sq_irq(struct amdgpu_device *adev, unsigned ih_data) | |
| 6721 | +static void gfx_v8_0_parse_sq_irq(struct amdgpu_device *adev, unsigned ih_data, | |
| 6722 | + bool from_wq) | |
| 6722 | 6723 | { |
| 6723 | 6724 | u32 enc, se_id, sh_id, cu_id; |
| 6724 | 6725 | char type[20]; |
| @@ -6756,7 +6757,7 @@ static void gfx_v8_0_parse_sq_irq(struct amdgpu_device *adev, unsigned ih_data) · 31 unmodified lines | ||
| 6756 | 6757 | * or from BH in which case we can access SQ_EDC_INFO |
| 6757 | 6758 | * instance |
| 6758 | 6759 | */ |
| 6759 | − if (in_task()) { | |
| 6760 | + if (from_wq) { | |
| 6760 | 6761 | mutex_lock(&adev->grbm_idx_mutex); |
| 6761 | 6762 | gfx_v8_0_select_se_sh(adev, se_id, sh_id, cu_id); |
| 6762 | 6763 | |
| @@ -6794,7 +6795,7 @@ static void gfx_v8_0_sq_irq_work_func(struct work_struct *work) · 31 unmodified lines | ||
| 6794 | 6795 | struct amdgpu_device *adev = container_of(work, struct amdgpu_device, gfx.sq_work.work); |
| 6795 | 6796 | struct sq_work *sq_work = container_of(work, struct sq_work, work); |
| 6796 | 6797 | |
| 6797 | − gfx_v8_0_parse_sq_irq(adev, sq_work->ih_data); | |
| 6798 | + gfx_v8_0_parse_sq_irq(adev, sq_work->ih_data, true); | |
| 6798 | 6799 | } |
| 6799 | 6800 | |
| 6800 | 6801 | static int gfx_v8_0_sq_irq(struct amdgpu_device *adev, |
| @@ -6809,7 +6810,7 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev, · 8 unmodified lines | ||
| 6809 | 6810 | * just print whatever info is possible directly from the ISR. |
| 6810 | 6811 | */ |
| 6811 | 6812 | if (work_pending(&adev->gfx.sq_work.work)) { |
| 6812 | − gfx_v8_0_parse_sq_irq(adev, ih_data); | |
| 6813 | + gfx_v8_0_parse_sq_irq(adev, ih_data, false); | |
| 6813 | 6814 | } else { |
| 6814 | 6815 | adev->gfx.sq_work.ih_data = ih_data; |
| 6815 | 6816 | schedule_work(&adev->gfx.sq_work.work); |
| @@ -49,6 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | |
| 50 | 50 | #include "gfx_v9_4.h" |
| 51 | 51 | #include "gfx_v9_0.h" |
| 52 | +#include "gfx_v9_4_2.h" | |
| 52 | 53 | |
| 53 | 54 | #include "asic_reg/pwr/pwr_10_0_offset.h" |
| 54 | 55 | #include "asic_reg/pwr/pwr_10_0_sh_mask.h" |
| @@ -107,14 +108,12 @@ MODULE_FIRMWARE("amdgpu/raven2_rlc.bin"); · 52 unmodified lines | ||
| 107 | 108 | MODULE_FIRMWARE("amdgpu/raven_kicker_rlc.bin"); |
| 108 | 109 | |
| 109 | 110 | MODULE_FIRMWARE("amdgpu/arcturus_mec.bin"); |
| 110 | −MODULE_FIRMWARE("amdgpu/arcturus_mec2.bin"); | |
| 111 | 111 | MODULE_FIRMWARE("amdgpu/arcturus_rlc.bin"); |
| 112 | 112 | |
| 113 | 113 | MODULE_FIRMWARE("amdgpu/renoir_ce.bin"); |
| 114 | 114 | MODULE_FIRMWARE("amdgpu/renoir_pfp.bin"); |
| 115 | 115 | MODULE_FIRMWARE("amdgpu/renoir_me.bin"); |
| 116 | 116 | MODULE_FIRMWARE("amdgpu/renoir_mec.bin"); |
| 117 | −MODULE_FIRMWARE("amdgpu/renoir_mec2.bin"); | |
| 118 | 117 | MODULE_FIRMWARE("amdgpu/renoir_rlc.bin"); |
| 119 | 118 | |
| 120 | 119 | MODULE_FIRMWARE("amdgpu/green_sardine_ce.bin"); |
| @@ -124,6 +123,10 @@ MODULE_FIRMWARE("amdgpu/green_sardine_mec.bin"); · 3 unmodified lines | ||
| 124 | 123 | MODULE_FIRMWARE("amdgpu/green_sardine_mec2.bin"); |
| 125 | 124 | MODULE_FIRMWARE("amdgpu/green_sardine_rlc.bin"); |
| 126 | 125 | |
| 126 | +MODULE_FIRMWARE("amdgpu/aldebaran_mec.bin"); | |
| 127 | +MODULE_FIRMWARE("amdgpu/aldebaran_mec2.bin"); | |
| 128 | +MODULE_FIRMWARE("amdgpu/aldebaran_rlc.bin"); | |
| 129 | + | |
| 127 | 130 | #define mmTCP_CHAN_STEER_0_ARCT 0x0b03 |
| 128 | 131 | #define mmTCP_CHAN_STEER_0_ARCT_BASE_IDX 0 |
| 129 | 132 | #define mmTCP_CHAN_STEER_1_ARCT 0x0b04 |
| @@ -981,11 +984,16 @@ static void gfx_v9_0_init_golden_registers(struct amdgpu_device *adev) · 851 unmodified lines | ||
| 981 | 984 | golden_settings_gc_9_1_rn, |
| 982 | 985 | ARRAY_SIZE(golden_settings_gc_9_1_rn)); |
| 983 | 986 | return; /* for renoir, don't need common goldensetting */ |
| 987 | + case CHIP_ALDEBARAN: | |
| 988 | + gfx_v9_4_2_init_golden_registers(adev, | |
| 989 | + adev->smuio.funcs->get_die_id(adev)); | |
| 990 | + break; | |
| 984 | 991 | default: |
| 985 | 992 | break; |
| 986 | 993 | } |
| 987 | 994 | |
| 988 | − if (adev->asic_type != CHIP_ARCTURUS) | |
| 995 | + if ((adev->asic_type != CHIP_ARCTURUS) && | |
| 996 | + (adev->asic_type != CHIP_ALDEBARAN)) | |
| 989 | 997 | soc15_program_register_sequence(adev, golden_settings_gc_9_x_common, |
| 990 | 998 | (const u32)ARRAY_SIZE(golden_settings_gc_9_x_common)); |
| 991 | 999 | } |
| @@ -1517,6 +1525,16 @@ out: · 525 unmodified lines | ||
| 1517 | 1525 | return err; |
| 1518 | 1526 | } |
| 1519 | 1527 | |
| 1528 | +static bool gfx_v9_0_load_mec2_fw_bin_support(struct amdgpu_device *adev) | |
| 1529 | +{ | |
| 1530 | + if (adev->asic_type == CHIP_ALDEBARAN || | |
| 1531 | + adev->asic_type == CHIP_ARCTURUS || | |
| 1532 | + adev->asic_type == CHIP_RENOIR) | |
| 1533 | + return false; | |
| 1534 | + | |
| 1535 | + return true; | |
| 1536 | +} | |
| 1537 | + | |
| 1520 | 1538 | static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, |
| 1521 | 1539 | const char *chip_name) |
| 1522 | 1540 | { |
| @@ -1538,21 +1556,23 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, · 15 unmodified lines | ||
| 1538 | 1556 | adev->gfx.mec_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); |
| 1539 | 1557 | |
| 1540 | 1558 | |
| 1541 | − snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); | |
| 1542 | − err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); | |
| 1543 | − if (!err) { | |
| 1544 | − err = amdgpu_ucode_validate(adev->gfx.mec2_fw); | |
| 1545 | − if (err) | |
| 1546 | − goto out; | |
| 1547 | − cp_hdr = (const struct gfx_firmware_header_v1_0 *) | |
| 1548 | − adev->gfx.mec2_fw->data; | |
| 1549 | − adev->gfx.mec2_fw_version = | |
| 1550 | − le32_to_cpu(cp_hdr->header.ucode_version); | |
| 1551 | − adev->gfx.mec2_feature_version = | |
| 1552 | − le32_to_cpu(cp_hdr->ucode_feature_version); | |
| 1553 | − } else { | |
| 1554 | − err = 0; | |
| 1555 | − adev->gfx.mec2_fw = NULL; | |
| 1559 | + if (gfx_v9_0_load_mec2_fw_bin_support(adev)) { | |
| 1560 | + snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); | |
| 1561 | + err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); | |
| 1562 | + if (!err) { | |
| 1563 | + err = amdgpu_ucode_validate(adev->gfx.mec2_fw); | |
| 1564 | + if (err) | |
| 1565 | + goto out; | |
| 1566 | + cp_hdr = (const struct gfx_firmware_header_v1_0 *) | |
| 1567 | + adev->gfx.mec2_fw->data; | |
| 1568 | + adev->gfx.mec2_fw_version = | |
| 1569 | + le32_to_cpu(cp_hdr->header.ucode_version); | |
| 1570 | + adev->gfx.mec2_feature_version = | |
| 1571 | + le32_to_cpu(cp_hdr->ucode_feature_version); | |
| 1572 | + } else { | |
| 1573 | + err = 0; | |
| 1574 | + adev->gfx.mec2_fw = NULL; | |
| 1575 | + } | |
| 1556 | 1576 | } |
| 1557 | 1577 | |
| 1558 | 1578 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { |
| @@ -1581,8 +1601,7 @@ static int gfx_v9_0_init_cp_compute_microcode(struct amdgpu_device *adev, · 22 unmodified lines | ||
| 1581 | 1601 | |
| 1582 | 1602 | /* TODO: Determine if MEC2 JT FW loading can be removed |
| 1583 | 1603 | for all GFX V9 asic and above */ |
| 1584 | − if (adev->asic_type != CHIP_ARCTURUS && | |
| 1585 | − adev->asic_type != CHIP_RENOIR) { | |
| 1604 | + if (gfx_v9_0_load_mec2_fw_bin_support(adev)) { | |
| 1586 | 1605 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2_JT]; |
| 1587 | 1606 | info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2_JT; |
| 1588 | 1607 | info->fw = adev->gfx.mec2_fw; |
| @@ -1642,6 +1661,9 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev) · 53 unmodified lines | ||
| 1642 | 1661 | else |
| 1643 | 1662 | chip_name = "green_sardine"; |
| 1644 | 1663 | break; |
| 1664 | + case CHIP_ALDEBARAN: | |
| 1665 | + chip_name = "aldebaran"; | |
| 1666 | + break; | |
| 1645 | 1667 | default: |
| 1646 | 1668 | BUG(); |
| 1647 | 1669 | } |
| @@ -1882,7 +1904,10 @@ static void gfx_v9_0_enable_lbpw(struct amdgpu_device *adev, bool enable) · 234 unmodified lines | ||
| 1882 | 1904 | |
| 1883 | 1905 | static int gfx_v9_0_cp_jump_table_num(struct amdgpu_device *adev) |
| 1884 | 1906 | { |
| 1885 | − return 5; | |
| 1907 | + if (gfx_v9_0_load_mec2_fw_bin_support(adev)) | |
| 1908 | + return 5; | |
| 1909 | + else | |
| 1910 | + return 4; | |
| 1886 | 1911 | } |
| 1887 | 1912 | |
| 1888 | 1913 | static int gfx_v9_0_rlc_init(struct amdgpu_device *adev) |
| @@ -2088,6 +2113,21 @@ static const struct amdgpu_gfx_funcs gfx_v9_4_gfx_funcs = { · 199 unmodified lines | ||
| 2088 | 2113 | .query_ras_error_status = &gfx_v9_4_query_ras_error_status, |
| 2089 | 2114 | }; |
| 2090 | 2115 | |
| 2116 | +static const struct amdgpu_gfx_funcs gfx_v9_4_2_gfx_funcs = { | |
| 2117 | + .get_gpu_clock_counter = &gfx_v9_0_get_gpu_clock_counter, | |
| 2118 | + .select_se_sh = &gfx_v9_0_select_se_sh, | |
| 2119 | + .read_wave_data = &gfx_v9_0_read_wave_data, | |
| 2120 | + .read_wave_sgprs = &gfx_v9_0_read_wave_sgprs, | |
| 2121 | + .read_wave_vgprs = &gfx_v9_0_read_wave_vgprs, | |
| 2122 | + .select_me_pipe_q = &gfx_v9_0_select_me_pipe_q, | |
| 2123 | + .ras_error_inject = &gfx_v9_4_2_ras_error_inject, | |
| 2124 | + .query_ras_error_count = &gfx_v9_4_2_query_ras_error_count, | |
| 2125 | + .reset_ras_error_count = &gfx_v9_4_2_reset_ras_error_count, | |
| 2126 | + .query_ras_error_status = &gfx_v9_4_2_query_ras_error_status, | |
| 2127 | + .reset_ras_error_status = &gfx_v9_4_2_reset_ras_error_status, | |
| 2128 | + .enable_watchdog_timer = &gfx_v9_4_2_enable_watchdog_timer, | |
| 2129 | +}; | |
| 2130 | + | |
| 2091 | 2131 | static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev) |
| 2092 | 2132 | { |
| 2093 | 2133 | u32 gb_addr_config; |
| @@ -2159,6 +2199,21 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev) · 65 unmodified lines | ||
| 2159 | 2199 | gb_addr_config &= ~0xf3e777ff; |
| 2160 | 2200 | gb_addr_config |= 0x22010042; |
| 2161 | 2201 | break; |
| 2202 | + case CHIP_ALDEBARAN: | |
| 2203 | + adev->gfx.funcs = &gfx_v9_4_2_gfx_funcs; | |
| 2204 | + adev->gfx.config.max_hw_contexts = 8; | |
| 2205 | + adev->gfx.config.sc_prim_fifo_size_frontend = 0x20; | |
| 2206 | + adev->gfx.config.sc_prim_fifo_size_backend = 0x100; | |
| 2207 | + adev->gfx.config.sc_hiz_tile_fifo_size = 0x30; | |
| 2208 | + adev->gfx.config.sc_earlyz_tile_fifo_size = 0x4C0; | |
| 2209 | + gb_addr_config = RREG32_SOC15(GC, 0, mmGB_ADDR_CONFIG); | |
| 2210 | + gb_addr_config &= ~0xf3e777ff; | |
| 2211 | + gb_addr_config |= 0x22014042; | |
| 2212 | + /* check vbios table if gpu info is not available */ | |
| 2213 | + err = amdgpu_atomfirmware_get_gfx_info(adev); | |
| 2214 | + if (err) | |
| 2215 | + return err; | |
| 2216 | + break; | |
| 2162 | 2217 | default: |
| 2163 | 2218 | BUG(); |
| 2164 | 2219 | break; |
| @@ -2249,6 +2304,7 @@ static int gfx_v9_0_sw_init(void *handle) · 84 unmodified lines | ||
| 2249 | 2304 | case CHIP_RAVEN: |
| 2250 | 2305 | case CHIP_ARCTURUS: |
| 2251 | 2306 | case CHIP_RENOIR: |
| 2307 | + case CHIP_ALDEBARAN: | |
| 2252 | 2308 | adev->gfx.mec.num_mec = 2; |
| 2253 | 2309 | break; |
| 2254 | 2310 | default: |
| @@ -2634,17 +2690,15 @@ static void gfx_v9_0_enable_gui_idle_interrupt(struct amdgpu_device *adev, · 379 unmodified lines | ||
| 2634 | 2690 | { |
| 2635 | 2691 | u32 tmp; |
| 2636 | 2692 | |
| 2637 | − /* don't toggle interrupts that are only applicable | |
| 2638 | − * to me0 pipe0 on AISCs that have me0 removed */ | |
| 2639 | − if (!adev->gfx.num_gfx_rings) | |
| 2640 | − return; | |
| 2693 | + /* These interrupts should be enabled to drive DS clock */ | |
| 2641 | 2694 | |
| 2642 | 2695 | tmp= RREG32_SOC15(GC, 0, mmCP_INT_CNTL_RING0); |
| 2643 | 2696 | |
| 2644 | 2697 | tmp = REG_SET_FIELD(tmp, CP_INT_CNTL_RING0, CNTX_BUSY_INT_ENABLE, enable ? 1 : 0); |
| 2645 | 2698 | tmp = REG_SET_FIELD(tmp, CP_INT_CNTL_RING0, CNTX_EMPTY_INT_ENABLE, enable ? 1 : 0); |
| 2646 | 2699 | tmp = REG_SET_FIELD(tmp, CP_INT_CNTL_RING0, CMP_BUSY_INT_ENABLE, enable ? 1 : 0); |
| 2647 | − tmp = REG_SET_FIELD(tmp, CP_INT_CNTL_RING0, GFX_IDLE_INT_ENABLE, enable ? 1 : 0); | |
| 2700 | + if(adev->gfx.num_gfx_rings) | |
| 2701 | + tmp = REG_SET_FIELD(tmp, CP_INT_CNTL_RING0, GFX_IDLE_INT_ENABLE, enable ? 1 : 0); | |
| 2648 | 2702 | |
| 2649 | 2703 | WREG32_SOC15(GC, 0, mmCP_INT_CNTL_RING0, tmp); |
| 2650 | 2704 | } |
| @@ -3696,11 +3750,18 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring) · 1045 unmodified lines | ||
| 3696 | 3750 | struct amdgpu_device *adev = ring->adev; |
| 3697 | 3751 | struct v9_mqd *mqd = ring->mqd_ptr; |
| 3698 | 3752 | int mqd_idx = AMDGPU_MAX_COMPUTE_RINGS; |
| 3753 | + struct v9_mqd *tmp_mqd; | |
| 3699 | 3754 | |
| 3700 | 3755 | gfx_v9_0_kiq_setting(ring); |
| 3701 | 3756 | |
| 3702 | − if (amdgpu_in_reset(adev)) { /* for GPU_RESET case */ | |
| 3703 | − /* reset MQD to a clean status */ | |
| 3757 | + /* GPU could be in bad state during probe, driver trigger the reset | |
| 3758 | + * after load the SMU, in this case , the mqd is not be initialized. | |
| 3759 | + * driver need to re-init the mqd. | |
| 3760 | + * check mqd->cp_hqd_pq_control since this value should not be 0 | |
| 3761 | + */ | |
| 3762 | + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; | |
| 3763 | + if (amdgpu_in_reset(adev) && tmp_mqd->cp_hqd_pq_control){ | |
| 3764 | + /* for GPU_RESET case , reset MQD to a clean status */ | |
| 3704 | 3765 | if (adev->gfx.mec.mqd_backup[mqd_idx]) |
| 3705 | 3766 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct v9_mqd_allocation)); |
| 3706 | 3767 | |
| @@ -3736,8 +3797,15 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring) · 29 unmodified lines | ||
| 3736 | 3797 | struct amdgpu_device *adev = ring->adev; |
| 3737 | 3798 | struct v9_mqd *mqd = ring->mqd_ptr; |
| 3738 | 3799 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; |
| 3800 | + struct v9_mqd *tmp_mqd; | |
| 3739 | 3801 | |
| 3740 | − if (!amdgpu_in_reset(adev) && !adev->in_suspend) { | |
| 3802 | + /* Same as above kiq init, driver need to re-init the mqd if mqd->cp_hqd_pq_control | |
| 3803 | + * is not be initialized before | |
| 3804 | + */ | |
| 3805 | + tmp_mqd = (struct v9_mqd *)adev->gfx.mec.mqd_backup[mqd_idx]; | |
| 3806 | + | |
| 3807 | + if (!tmp_mqd->cp_hqd_pq_control || | |
| 3808 | + (!amdgpu_in_reset(adev) && !adev->in_suspend)) { | |
| 3741 | 3809 | memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation)); |
| 3742 | 3810 | ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
| 3743 | 3811 | ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
| @@ -3913,6 +3981,9 @@ static int gfx_v9_0_hw_init(void *handle) · 169 unmodified lines | ||
| 3913 | 3981 | if (r) |
| 3914 | 3982 | return r; |
| 3915 | 3983 | |
| 3984 | + if (adev->asic_type == CHIP_ALDEBARAN) | |
| 3985 | + gfx_v9_4_2_set_power_brake_sequence(adev); | |
| 3986 | + | |
| 3916 | 3987 | return r; |
| 3917 | 3988 | } |
| 3918 | 3989 | |
| @@ -4101,7 +4172,7 @@ static uint64_t gfx_v9_0_kiq_read_clock(struct amdgpu_device *adev) · 182 unmodified lines | ||
| 4101 | 4172 | * |
| 4102 | 4173 | * also don't wait anymore for IRQ context |
| 4103 | 4174 | * */ |
| 4104 | − if (r < 1 && (amdgpu_in_reset(adev) || in_interrupt())) | |
| 4175 | + if (r < 1 && (amdgpu_in_reset(adev))) | |
| 4105 | 4176 | goto failed_kiq_read; |
| 4106 | 4177 | |
| 4107 | 4178 | might_sleep(); |
| @@ -4486,7 +4557,8 @@ static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev) · 378 unmodified lines | ||
| 4486 | 4557 | if (!ring->sched.ready) |
| 4487 | 4558 | return 0; |
| 4488 | 4559 | |
| 4489 | − if (adev->asic_type == CHIP_ARCTURUS) { | |
| 4560 | + if (adev->asic_type == CHIP_ARCTURUS || | |
| 4561 | + adev->asic_type == CHIP_ALDEBARAN) { | |
| 4490 | 4562 | vgpr_init_shader_ptr = vgpr_init_compute_shader_arcturus; |
| 4491 | 4563 | vgpr_init_shader_size = sizeof(vgpr_init_compute_shader_arcturus); |
| 4492 | 4564 | vgpr_init_regs_ptr = vgpr_init_regs_arcturus; |
| @@ -4636,7 +4708,8 @@ static int gfx_v9_0_early_init(void *handle) · 143 unmodified lines | ||
| 4636 | 4708 | { |
| 4637 | 4709 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 4638 | 4710 | |
| 4639 | − if (adev->asic_type == CHIP_ARCTURUS) | |
| 4711 | + if (adev->asic_type == CHIP_ARCTURUS || | |
| 4712 | + adev->asic_type == CHIP_ALDEBARAN) | |
| 4640 | 4713 | adev->gfx.num_gfx_rings = 0; |
| 4641 | 4714 | else |
| 4642 | 4715 | adev->gfx.num_gfx_rings = GFX9_NUM_GFX_RINGS; |
| @@ -4662,7 +4735,8 @@ static int gfx_v9_0_ecc_late_init(void *handle) · 19 unmodified lines | ||
| 4662 | 4735 | * to GDS in suspend/resume sequence on several cards. So just |
| 4663 | 4736 | * limit this operation in cold boot sequence. |
| 4664 | 4737 | */ |
| 4665 | − if (!adev->in_suspend) { | |
| 4738 | + if ((!adev->in_suspend) && | |
| 4739 | + (adev->gds.gds_size)) { | |
| 4666 | 4740 | r = gfx_v9_0_do_edc_gds_workarounds(adev); |
| 4667 | 4741 | if (r) |
| 4668 | 4742 | return r; |
| @@ -4673,14 +4747,13 @@ static int gfx_v9_0_ecc_late_init(void *handle) · 4 unmodified lines | ||
| 4673 | 4747 | if (r) |
| 4674 | 4748 | return r; |
| 4675 | 4749 | |
| 4676 | − if (adev->gfx.funcs && | |
| 4677 | − adev->gfx.funcs->reset_ras_error_count) | |
| 4678 | − adev->gfx.funcs->reset_ras_error_count(adev); | |
| 4679 | − | |
| 4680 | 4750 | r = amdgpu_gfx_ras_late_init(adev); |
| 4681 | 4751 | if (r) |
| 4682 | 4752 | return r; |
| 4683 | 4753 | |
| 4754 | + if (adev->gfx.funcs->enable_watchdog_timer) | |
| 4755 | + adev->gfx.funcs->enable_watchdog_timer(adev); | |
| 4756 | + | |
| 4684 | 4757 | return 0; |
| 4685 | 4758 | } |
| 4686 | 4759 | |
| @@ -4858,7 +4931,7 @@ static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, · 171 unmodified lines | ||
| 4858 | 4931 | { |
| 4859 | 4932 | uint32_t data, def; |
| 4860 | 4933 | |
| 4861 | − if (adev->asic_type == CHIP_ARCTURUS) | |
| 4934 | + if (!adev->gfx.num_gfx_rings) | |
| 4862 | 4935 | return; |
| 4863 | 4936 | |
| 4864 | 4937 | amdgpu_gfx_rlc_enter_safe_mode(adev); |
| @@ -5105,6 +5178,7 @@ static int gfx_v9_0_set_clockgating_state(void *handle, · 240 unmodified lines | ||
| 5105 | 5178 | case CHIP_RAVEN: |
| 5106 | 5179 | case CHIP_ARCTURUS: |
| 5107 | 5180 | case CHIP_RENOIR: |
| 5181 | + case CHIP_ALDEBARAN: | |
| 5108 | 5182 | gfx_v9_0_update_gfx_clock_gating(adev, |
| 5109 | 5183 | state == AMD_CG_STATE_GATE); |
| 5110 | 5184 | break; |
| @@ -6924,6 +6998,7 @@ static void gfx_v9_0_set_rlc_funcs(struct amdgpu_device *adev) · 1813 unmodified lines | ||
| 6924 | 6998 | case CHIP_RAVEN: |
| 6925 | 6999 | case CHIP_ARCTURUS: |
| 6926 | 7000 | case CHIP_RENOIR: |
| 7001 | + case CHIP_ALDEBARAN: | |
| 6927 | 7002 | adev->gfx.rlc.funcs = &gfx_v9_0_rlc_funcs; |
| 6928 | 7003 | break; |
| 6929 | 7004 | default: |
| @@ -6944,6 +7019,12 @@ static void gfx_v9_0_set_gds_init(struct amdgpu_device *adev) · 14 unmodified lines | ||
| 6944 | 7019 | case CHIP_ARCTURUS: |
| 6945 | 7020 | adev->gds.gds_size = 0x1000; |
| 6946 | 7021 | break; |
| 7022 | + case CHIP_ALDEBARAN: | |
| 7023 | + /* aldebaran removed all the GDS internal memory, | |
| 7024 | + * only support GWS opcode in kernel, like barrier | |
| 7025 | + * semaphore.etc */ | |
| 7026 | + adev->gds.gds_size = 0; | |
| 7027 | + break; | |
| 6947 | 7028 | default: |
| 6948 | 7029 | adev->gds.gds_size = 0x10000; |
| 6949 | 7030 | break; |
| @@ -6966,6 +7047,10 @@ static void gfx_v9_0_set_gds_init(struct amdgpu_device *adev) · 16 unmodified lines | ||
| 6966 | 7047 | case CHIP_ARCTURUS: |
| 6967 | 7048 | adev->gds.gds_compute_max_wave_id = 0xfff; |
| 6968 | 7049 | break; |
| 7050 | + case CHIP_ALDEBARAN: | |
| 7051 | + /* deprecated for Aldebaran, no usage at all */ | |
| 7052 | + adev->gds.gds_compute_max_wave_id = 0; | |
| 7053 | + break; | |
| 6969 | 7054 | default: |
| 6970 | 7055 | /* this really depends on the chip */ |
| 6971 | 7056 | adev->gds.gds_compute_max_wave_id = 0x7ff; |
| @@ -0,0 +1,1286 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#include "amdgpu.h" | |
| 24 | +#include "soc15.h" | |
| 25 | + | |
| 26 | +#include "gc/gc_9_4_2_offset.h" | |
| 27 | +#include "gc/gc_9_4_2_sh_mask.h" | |
| 28 | +#include "gfx_v9_0.h" | |
| 29 | + | |
| 30 | +#include "gfx_v9_4_2.h" | |
| 31 | +#include "amdgpu_ras.h" | |
| 32 | +#include "amdgpu_gfx.h" | |
| 33 | + | |
| 34 | +enum gfx_v9_4_2_utc_type { | |
| 35 | + VML2_MEM, | |
| 36 | + VML2_WALKER_MEM, | |
| 37 | + UTCL2_MEM, | |
| 38 | + ATC_L2_CACHE_2M, | |
| 39 | + ATC_L2_CACHE_32K, | |
| 40 | + ATC_L2_CACHE_4K | |
| 41 | +}; | |
| 42 | + | |
| 43 | +struct gfx_v9_4_2_utc_block { | |
| 44 | + enum gfx_v9_4_2_utc_type type; | |
| 45 | + uint32_t num_banks; | |
| 46 | + uint32_t num_ways; | |
| 47 | + uint32_t num_mem_blocks; | |
| 48 | + struct soc15_reg idx_reg; | |
| 49 | + struct soc15_reg data_reg; | |
| 50 | + uint32_t sec_count_mask; | |
| 51 | + uint32_t sec_count_shift; | |
| 52 | + uint32_t ded_count_mask; | |
| 53 | + uint32_t ded_count_shift; | |
| 54 | + uint32_t clear; | |
| 55 | +}; | |
| 56 | + | |
| 57 | +static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_0[] = { | |
| 58 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_0, 0x3fffffff, 0x141dc920), | |
| 59 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_1, 0x3fffffff, 0x3b458b93), | |
| 60 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_2, 0x3fffffff, 0x1a4f5583), | |
| 61 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_3, 0x3fffffff, 0x317717f6), | |
| 62 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_4, 0x3fffffff, 0x107cc1e6), | |
| 63 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_5, 0x3ff, 0x351), | |
| 64 | +}; | |
| 65 | + | |
| 66 | +static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde_die_1[] = { | |
| 67 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_0, 0x3fffffff, 0x2591aa38), | |
| 68 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_1, 0x3fffffff, 0xac9e88b), | |
| 69 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_2, 0x3fffffff, 0x2bc3369b), | |
| 70 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_3, 0x3fffffff, 0xfb74ee), | |
| 71 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_4, 0x3fffffff, 0x21f0a2fe), | |
| 72 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CHAN_STEER_5, 0x3ff, 0x49), | |
| 73 | +}; | |
| 74 | + | |
| 75 | +static const struct soc15_reg_golden golden_settings_gc_9_4_2_alde[] = { | |
| 76 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regGB_ADDR_CONFIG, 0xffff77ff, 0x2a114042), | |
| 77 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTA_CNTL_AUX, 0xfffffeef, 0x10b0000), | |
| 78 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_UTCL1_CNTL1, 0xffffffff, 0x30800400), | |
| 79 | + SOC15_REG_GOLDEN_VALUE(GC, 0, regTCI_CNTL_3, 0xff, 0x20), | |
| 80 | +}; | |
| 81 | + | |
| 82 | +static void gfx_v9_4_2_query_sq_timeout_status(struct amdgpu_device *adev); | |
| 83 | +static void gfx_v9_4_2_reset_sq_timeout_status(struct amdgpu_device *adev); | |
| 84 | + | |
| 85 | +void gfx_v9_4_2_init_golden_registers(struct amdgpu_device *adev, | |
| 86 | + uint32_t die_id) | |
| 87 | +{ | |
| 88 | + soc15_program_register_sequence(adev, | |
| 89 | + golden_settings_gc_9_4_2_alde, | |
| 90 | + ARRAY_SIZE(golden_settings_gc_9_4_2_alde)); | |
| 91 | + | |
| 92 | + /* apply golden settings per die */ | |
| 93 | + switch (die_id) { | |
| 94 | + case 0: | |
| 95 | + soc15_program_register_sequence(adev, | |
| 96 | + golden_settings_gc_9_4_2_alde_die_0, | |
| 97 | + ARRAY_SIZE(golden_settings_gc_9_4_2_alde_die_0)); | |
| 98 | + break; | |
| 99 | + case 1: | |
| 100 | + soc15_program_register_sequence(adev, | |
| 101 | + golden_settings_gc_9_4_2_alde_die_1, | |
| 102 | + ARRAY_SIZE(golden_settings_gc_9_4_2_alde_die_1)); | |
| 103 | + break; | |
| 104 | + default: | |
| 105 | + dev_warn(adev->dev, | |
| 106 | + "invalid die id %d, ignore channel fabricid remap settings\n", | |
| 107 | + die_id); | |
| 108 | + break; | |
| 109 | + } | |
| 110 | + | |
| 111 | + return; | |
| 112 | +} | |
| 113 | + | |
| 114 | +void gfx_v9_4_2_debug_trap_config_init(struct amdgpu_device *adev, | |
| 115 | + uint32_t first_vmid, | |
| 116 | + uint32_t last_vmid) | |
| 117 | +{ | |
| 118 | + uint32_t data; | |
| 119 | + int i; | |
| 120 | + | |
| 121 | + mutex_lock(&adev->srbm_mutex); | |
| 122 | + | |
| 123 | + for (i = first_vmid; i < last_vmid; i++) { | |
| 124 | + data = 0; | |
| 125 | + soc15_grbm_select(adev, 0, 0, 0, i); | |
| 126 | + data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, TRAP_EN, 1); | |
| 127 | + data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, EXCP_EN, 0); | |
| 128 | + data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, EXCP_REPLACE, | |
| 129 | + 0); | |
| 130 | + WREG32(SOC15_REG_OFFSET(GC, 0, regSPI_GDBG_PER_VMID_CNTL), data); | |
| 131 | + } | |
| 132 | + | |
| 133 | + soc15_grbm_select(adev, 0, 0, 0, 0); | |
| 134 | + mutex_unlock(&adev->srbm_mutex); | |
| 135 | +} | |
| 136 | + | |
| 137 | +void gfx_v9_4_2_set_power_brake_sequence(struct amdgpu_device *adev) | |
| 138 | +{ | |
| 139 | + u32 tmp; | |
| 140 | + | |
| 141 | + gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | |
| 142 | + | |
| 143 | + tmp = 0; | |
| 144 | + tmp = REG_SET_FIELD(tmp, GC_THROTTLE_CTRL, PATTERN_MODE, 1); | |
| 145 | + WREG32_SOC15(GC, 0, regGC_THROTTLE_CTRL, tmp); | |
| 146 | + | |
| 147 | + tmp = 0; | |
| 148 | + tmp = REG_SET_FIELD(tmp, GC_THROTTLE_CTRL1, PWRBRK_STALL_EN, 1); | |
| 149 | + WREG32_SOC15(GC, 0, regGC_THROTTLE_CTRL1, tmp); | |
| 150 | + | |
| 151 | + WREG32_SOC15(GC, 0, regDIDT_IND_INDEX, ixDIDT_SQ_THROTTLE_CTRL); | |
| 152 | + tmp = 0; | |
| 153 | + tmp = REG_SET_FIELD(tmp, DIDT_SQ_THROTTLE_CTRL, PWRBRK_STALL_EN, 1); | |
| 154 | + WREG32_SOC15(GC, 0, regDIDT_IND_DATA, tmp); | |
| 155 | + | |
| 156 | + WREG32_SOC15(GC, 0, regGC_CAC_IND_INDEX, ixPWRBRK_STALL_PATTERN_CTRL); | |
| 157 | + tmp = 0; | |
| 158 | + tmp = REG_SET_FIELD(tmp, PWRBRK_STALL_PATTERN_CTRL, PWRBRK_END_STEP, 0x12); | |
| 159 | + WREG32_SOC15(GC, 0, regGC_CAC_IND_DATA, tmp); | |
| 160 | +} | |
| 161 | + | |
| 162 | +static const struct soc15_reg_entry gfx_v9_4_2_edc_counter_regs[] = { | |
| 163 | + /* CPF */ | |
| 164 | + { SOC15_REG_ENTRY(GC, 0, regCPF_EDC_ROQ_CNT), 0, 1, 1 }, | |
| 165 | + { SOC15_REG_ENTRY(GC, 0, regCPF_EDC_TAG_CNT), 0, 1, 1 }, | |
| 166 | + /* CPC */ | |
| 167 | + { SOC15_REG_ENTRY(GC, 0, regCPC_EDC_SCRATCH_CNT), 0, 1, 1 }, | |
| 168 | + { SOC15_REG_ENTRY(GC, 0, regCPC_EDC_UCODE_CNT), 0, 1, 1 }, | |
| 169 | + { SOC15_REG_ENTRY(GC, 0, regDC_EDC_STATE_CNT), 0, 1, 1 }, | |
| 170 | + { SOC15_REG_ENTRY(GC, 0, regDC_EDC_CSINVOC_CNT), 0, 1, 1 }, | |
| 171 | + { SOC15_REG_ENTRY(GC, 0, regDC_EDC_RESTORE_CNT), 0, 1, 1 }, | |
| 172 | + /* GDS */ | |
| 173 | + { SOC15_REG_ENTRY(GC, 0, regGDS_EDC_CNT), 0, 1, 1 }, | |
| 174 | + { SOC15_REG_ENTRY(GC, 0, regGDS_EDC_GRBM_CNT), 0, 1, 1 }, | |
| 175 | + { SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 1, 1 }, | |
| 176 | + { SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PHY_CNT), 0, 1, 1 }, | |
| 177 | + { SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PIPE_CNT), 0, 1, 1 }, | |
| 178 | + /* RLC */ | |
| 179 | + { SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), 0, 1, 1 }, | |
| 180 | + { SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), 0, 1, 1 }, | |
| 181 | + /* SPI */ | |
| 182 | + { SOC15_REG_ENTRY(GC, 0, regSPI_EDC_CNT), 0, 8, 1 }, | |
| 183 | + /* SQC */ | |
| 184 | + { SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), 0, 8, 7 }, | |
| 185 | + { SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT2), 0, 8, 7 }, | |
| 186 | + { SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT3), 0, 8, 7 }, | |
| 187 | + { SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), 0, 8, 7 }, | |
| 188 | + /* SQ */ | |
| 189 | + { SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), 0, 8, 14 }, | |
| 190 | + /* TCP */ | |
| 191 | + { SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), 0, 8, 14 }, | |
| 192 | + /* TCI */ | |
| 193 | + { SOC15_REG_ENTRY(GC, 0, regTCI_EDC_CNT), 0, 1, 69 }, | |
| 194 | + /* TCC */ | |
| 195 | + { SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), 0, 1, 16 }, | |
| 196 | + { SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), 0, 1, 16 }, | |
| 197 | + /* TCA */ | |
| 198 | + { SOC15_REG_ENTRY(GC, 0, regTCA_EDC_CNT), 0, 1, 2 }, | |
| 199 | + /* TCX */ | |
| 200 | + { SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), 0, 1, 2 }, | |
| 201 | + { SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT2), 0, 1, 2 }, | |
| 202 | + /* TD */ | |
| 203 | + { SOC15_REG_ENTRY(GC, 0, regTD_EDC_CNT), 0, 8, 14 }, | |
| 204 | + /* TA */ | |
| 205 | + { SOC15_REG_ENTRY(GC, 0, regTA_EDC_CNT), 0, 8, 14 }, | |
| 206 | + /* GCEA */ | |
| 207 | + { SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), 0, 1, 16 }, | |
| 208 | + { SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), 0, 1, 16 }, | |
| 209 | + { SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), 0, 1, 16 }, | |
| 210 | +}; | |
| 211 | + | |
| 212 | +static void gfx_v9_4_2_select_se_sh(struct amdgpu_device *adev, u32 se_num, | |
| 213 | + u32 sh_num, u32 instance) | |
| 214 | +{ | |
| 215 | + u32 data; | |
| 216 | + | |
| 217 | + if (instance == 0xffffffff) | |
| 218 | + data = REG_SET_FIELD(0, GRBM_GFX_INDEX, | |
| 219 | + INSTANCE_BROADCAST_WRITES, 1); | |
| 220 | + else | |
| 221 | + data = REG_SET_FIELD(0, GRBM_GFX_INDEX, INSTANCE_INDEX, | |
| 222 | + instance); | |
| 223 | + | |
| 224 | + if (se_num == 0xffffffff) | |
| 225 | + data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_BROADCAST_WRITES, | |
| 226 | + 1); | |
| 227 | + else | |
| 228 | + data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_INDEX, se_num); | |
| 229 | + | |
| 230 | + if (sh_num == 0xffffffff) | |
| 231 | + data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_BROADCAST_WRITES, | |
| 232 | + 1); | |
| 233 | + else | |
| 234 | + data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_INDEX, sh_num); | |
| 235 | + | |
| 236 | + WREG32_SOC15_RLC_SHADOW_EX(reg, GC, 0, regGRBM_GFX_INDEX, data); | |
| 237 | +} | |
| 238 | + | |
| 239 | +static const struct soc15_ras_field_entry gfx_v9_4_2_ras_fields[] = { | |
| 240 | + /* CPF */ | |
| 241 | + { "CPF_ROQ_ME2", SOC15_REG_ENTRY(GC, 0, regCPF_EDC_ROQ_CNT), | |
| 242 | + SOC15_REG_FIELD(CPF_EDC_ROQ_CNT, SEC_COUNT_ME2), | |
| 243 | + SOC15_REG_FIELD(CPF_EDC_ROQ_CNT, DED_COUNT_ME2) }, | |
| 244 | + { "CPF_ROQ_ME1", SOC15_REG_ENTRY(GC, 0, regCPF_EDC_ROQ_CNT), | |
| 245 | + SOC15_REG_FIELD(CPF_EDC_ROQ_CNT, SEC_COUNT_ME1), | |
| 246 | + SOC15_REG_FIELD(CPF_EDC_ROQ_CNT, DED_COUNT_ME1) }, | |
| 247 | + { "CPF_TCIU_TAG", SOC15_REG_ENTRY(GC, 0, regCPF_EDC_TAG_CNT), | |
| 248 | + SOC15_REG_FIELD(CPF_EDC_TAG_CNT, SEC_COUNT), | |
| 249 | + SOC15_REG_FIELD(CPF_EDC_TAG_CNT, DED_COUNT) }, | |
| 250 | + | |
| 251 | + /* CPC */ | |
| 252 | + { "CPC_SCRATCH", SOC15_REG_ENTRY(GC, 0, regCPC_EDC_SCRATCH_CNT), | |
| 253 | + SOC15_REG_FIELD(CPC_EDC_SCRATCH_CNT, SEC_COUNT), | |
| 254 | + SOC15_REG_FIELD(CPC_EDC_SCRATCH_CNT, DED_COUNT) }, | |
| 255 | + { "CPC_UCODE", SOC15_REG_ENTRY(GC, 0, regCPC_EDC_UCODE_CNT), | |
| 256 | + SOC15_REG_FIELD(CPC_EDC_UCODE_CNT, SEC_COUNT), | |
| 257 | + SOC15_REG_FIELD(CPC_EDC_UCODE_CNT, DED_COUNT) }, | |
| 258 | + { "CPC_DC_STATE_RAM_ME1", SOC15_REG_ENTRY(GC, 0, regDC_EDC_STATE_CNT), | |
| 259 | + SOC15_REG_FIELD(DC_EDC_STATE_CNT, SEC_COUNT_ME1), | |
| 260 | + SOC15_REG_FIELD(DC_EDC_STATE_CNT, DED_COUNT_ME1) }, | |
| 261 | + { "CPC_DC_CSINVOC_RAM_ME1", | |
| 262 | + SOC15_REG_ENTRY(GC, 0, regDC_EDC_CSINVOC_CNT), | |
| 263 | + SOC15_REG_FIELD(DC_EDC_CSINVOC_CNT, SEC_COUNT_ME1), | |
| 264 | + SOC15_REG_FIELD(DC_EDC_CSINVOC_CNT, DED_COUNT_ME1) }, | |
| 265 | + { "CPC_DC_RESTORE_RAM_ME1", | |
| 266 | + SOC15_REG_ENTRY(GC, 0, regDC_EDC_RESTORE_CNT), | |
| 267 | + SOC15_REG_FIELD(DC_EDC_RESTORE_CNT, SEC_COUNT_ME1), | |
| 268 | + SOC15_REG_FIELD(DC_EDC_RESTORE_CNT, DED_COUNT_ME1) }, | |
| 269 | + { "CPC_DC_CSINVOC_RAM1_ME1", | |
| 270 | + SOC15_REG_ENTRY(GC, 0, regDC_EDC_CSINVOC_CNT), | |
| 271 | + SOC15_REG_FIELD(DC_EDC_CSINVOC_CNT, SEC_COUNT1_ME1), | |
| 272 | + SOC15_REG_FIELD(DC_EDC_CSINVOC_CNT, DED_COUNT1_ME1) }, | |
| 273 | + { "CPC_DC_RESTORE_RAM1_ME1", | |
| 274 | + SOC15_REG_ENTRY(GC, 0, regDC_EDC_RESTORE_CNT), | |
| 275 | + SOC15_REG_FIELD(DC_EDC_RESTORE_CNT, SEC_COUNT1_ME1), | |
| 276 | + SOC15_REG_FIELD(DC_EDC_RESTORE_CNT, DED_COUNT1_ME1) }, | |
| 277 | + | |
| 278 | + /* GDS */ | |
| 279 | + { "GDS_GRBM", SOC15_REG_ENTRY(GC, 0, regGDS_EDC_GRBM_CNT), | |
| 280 | + SOC15_REG_FIELD(GDS_EDC_GRBM_CNT, SEC), | |
| 281 | + SOC15_REG_FIELD(GDS_EDC_GRBM_CNT, DED) }, | |
| 282 | + { "GDS_MEM", SOC15_REG_ENTRY(GC, 0, regGDS_EDC_CNT), | |
| 283 | + SOC15_REG_FIELD(GDS_EDC_CNT, GDS_MEM_SEC), | |
| 284 | + SOC15_REG_FIELD(GDS_EDC_CNT, GDS_MEM_DED) }, | |
| 285 | + { "GDS_PHY_CMD_RAM_MEM", SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PHY_CNT), | |
| 286 | + SOC15_REG_FIELD(GDS_EDC_OA_PHY_CNT, PHY_CMD_RAM_MEM_SEC), | |
| 287 | + SOC15_REG_FIELD(GDS_EDC_OA_PHY_CNT, PHY_CMD_RAM_MEM_DED) }, | |
| 288 | + { "GDS_PHY_DATA_RAM_MEM", SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PHY_CNT), | |
| 289 | + SOC15_REG_FIELD(GDS_EDC_OA_PHY_CNT, PHY_DATA_RAM_MEM_SEC), | |
| 290 | + SOC15_REG_FIELD(GDS_EDC_OA_PHY_CNT, PHY_DATA_RAM_MEM_DED) }, | |
| 291 | + { "GDS_ME0_CS_PIPE_MEM", SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PHY_CNT), | |
| 292 | + SOC15_REG_FIELD(GDS_EDC_OA_PHY_CNT, ME0_CS_PIPE_MEM_SEC), | |
| 293 | + SOC15_REG_FIELD(GDS_EDC_OA_PHY_CNT, ME0_CS_PIPE_MEM_DED) }, | |
| 294 | + { "GDS_ME1_PIPE0_PIPE_MEM", | |
| 295 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PIPE_CNT), | |
| 296 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE0_PIPE_MEM_SEC), | |
| 297 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE0_PIPE_MEM_DED) }, | |
| 298 | + { "GDS_ME1_PIPE1_PIPE_MEM", | |
| 299 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PIPE_CNT), | |
| 300 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE1_PIPE_MEM_SEC), | |
| 301 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE1_PIPE_MEM_DED) }, | |
| 302 | + { "GDS_ME1_PIPE2_PIPE_MEM", | |
| 303 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PIPE_CNT), | |
| 304 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE2_PIPE_MEM_SEC), | |
| 305 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE2_PIPE_MEM_DED) }, | |
| 306 | + { "GDS_ME1_PIPE3_PIPE_MEM", | |
| 307 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_PIPE_CNT), | |
| 308 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE3_PIPE_MEM_SEC), | |
| 309 | + SOC15_REG_FIELD(GDS_EDC_OA_PIPE_CNT, ME1_PIPE3_PIPE_MEM_DED) }, | |
| 310 | + { "GDS_ME0_GFXHP3D_PIX_DED", | |
| 311 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 312 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME0_GFXHP3D_PIX_DED) }, | |
| 313 | + { "GDS_ME0_GFXHP3D_VTX_DED", | |
| 314 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 315 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME0_GFXHP3D_VTX_DED) }, | |
| 316 | + { "GDS_ME0_CS_DED", | |
| 317 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 318 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME0_CS_DED) }, | |
| 319 | + { "GDS_ME0_GFXHP3D_GS_DED", | |
| 320 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 321 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME0_GFXHP3D_GS_DED) }, | |
| 322 | + { "GDS_ME1_PIPE0_DED", | |
| 323 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 324 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME1_PIPE0_DED) }, | |
| 325 | + { "GDS_ME1_PIPE1_DED", | |
| 326 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 327 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME1_PIPE1_DED) }, | |
| 328 | + { "GDS_ME1_PIPE2_DED", | |
| 329 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 330 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME1_PIPE2_DED) }, | |
| 331 | + { "GDS_ME1_PIPE3_DED", | |
| 332 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 333 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME1_PIPE3_DED) }, | |
| 334 | + { "GDS_ME2_PIPE0_DED", | |
| 335 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 336 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME2_PIPE0_DED) }, | |
| 337 | + { "GDS_ME2_PIPE1_DED", | |
| 338 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 339 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME2_PIPE1_DED) }, | |
| 340 | + { "GDS_ME2_PIPE2_DED", | |
| 341 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 342 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME2_PIPE2_DED) }, | |
| 343 | + { "GDS_ME2_PIPE3_DED", | |
| 344 | + SOC15_REG_ENTRY(GC, 0, regGDS_EDC_OA_DED), 0, 0, | |
| 345 | + SOC15_REG_FIELD(GDS_EDC_OA_DED, ME2_PIPE3_DED) }, | |
| 346 | + | |
| 347 | + /* RLC */ | |
| 348 | + { "RLCG_INSTR_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 349 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCG_INSTR_RAM_SEC_COUNT), | |
| 350 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCG_INSTR_RAM_DED_COUNT) }, | |
| 351 | + { "RLCG_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 352 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCG_SCRATCH_RAM_SEC_COUNT), | |
| 353 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCG_SCRATCH_RAM_DED_COUNT) }, | |
| 354 | + { "RLCV_INSTR_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 355 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCV_INSTR_RAM_SEC_COUNT), | |
| 356 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCV_INSTR_RAM_DED_COUNT) }, | |
| 357 | + { "RLCV_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 358 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCV_SCRATCH_RAM_SEC_COUNT), | |
| 359 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLCV_SCRATCH_RAM_DED_COUNT) }, | |
| 360 | + { "RLC_TCTAG_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 361 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_TCTAG_RAM_SEC_COUNT), | |
| 362 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_TCTAG_RAM_DED_COUNT) }, | |
| 363 | + { "RLC_SPM_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 364 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_SPM_SCRATCH_RAM_SEC_COUNT), | |
| 365 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_SPM_SCRATCH_RAM_DED_COUNT) }, | |
| 366 | + { "RLC_SRM_DATA_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 367 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_SRM_DATA_RAM_SEC_COUNT), | |
| 368 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_SRM_DATA_RAM_DED_COUNT) }, | |
| 369 | + { "RLC_SRM_ADDR_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT), | |
| 370 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_SRM_ADDR_RAM_SEC_COUNT), | |
| 371 | + SOC15_REG_FIELD(RLC_EDC_CNT, RLC_SRM_ADDR_RAM_DED_COUNT) }, | |
| 372 | + { "RLC_SPM_SE0_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 373 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE0_SCRATCH_RAM_SEC_COUNT), | |
| 374 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE0_SCRATCH_RAM_DED_COUNT) }, | |
| 375 | + { "RLC_SPM_SE1_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 376 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE1_SCRATCH_RAM_SEC_COUNT), | |
| 377 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE1_SCRATCH_RAM_DED_COUNT) }, | |
| 378 | + { "RLC_SPM_SE2_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 379 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE2_SCRATCH_RAM_SEC_COUNT), | |
| 380 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE2_SCRATCH_RAM_DED_COUNT) }, | |
| 381 | + { "RLC_SPM_SE3_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 382 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE3_SCRATCH_RAM_SEC_COUNT), | |
| 383 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE3_SCRATCH_RAM_DED_COUNT) }, | |
| 384 | + { "RLC_SPM_SE4_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 385 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE4_SCRATCH_RAM_SEC_COUNT), | |
| 386 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE4_SCRATCH_RAM_DED_COUNT) }, | |
| 387 | + { "RLC_SPM_SE5_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 388 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE5_SCRATCH_RAM_SEC_COUNT), | |
| 389 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE5_SCRATCH_RAM_DED_COUNT) }, | |
| 390 | + { "RLC_SPM_SE6_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 391 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE6_SCRATCH_RAM_SEC_COUNT), | |
| 392 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE6_SCRATCH_RAM_DED_COUNT) }, | |
| 393 | + { "RLC_SPM_SE7_SCRATCH_RAM", SOC15_REG_ENTRY(GC, 0, regRLC_EDC_CNT2), | |
| 394 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE7_SCRATCH_RAM_SEC_COUNT), | |
| 395 | + SOC15_REG_FIELD(RLC_EDC_CNT2, RLC_SPM_SE7_SCRATCH_RAM_DED_COUNT) }, | |
| 396 | + | |
| 397 | + /* SPI */ | |
| 398 | + { "SPI_SR_MEM", SOC15_REG_ENTRY(GC, 0, regSPI_EDC_CNT), | |
| 399 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_SR_MEM_SEC_COUNT), | |
| 400 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_SR_MEM_DED_COUNT) }, | |
| 401 | + { "SPI_GDS_EXPREQ", SOC15_REG_ENTRY(GC, 0, regSPI_EDC_CNT), | |
| 402 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_GDS_EXPREQ_SEC_COUNT), | |
| 403 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_GDS_EXPREQ_DED_COUNT) }, | |
| 404 | + { "SPI_WB_GRANT_30", SOC15_REG_ENTRY(GC, 0, regSPI_EDC_CNT), | |
| 405 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_WB_GRANT_30_SEC_COUNT), | |
| 406 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_WB_GRANT_30_DED_COUNT) }, | |
| 407 | + { "SPI_LIFE_CNT", SOC15_REG_ENTRY(GC, 0, regSPI_EDC_CNT), | |
| 408 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_LIFE_CNT_SEC_COUNT), | |
| 409 | + SOC15_REG_FIELD(SPI_EDC_CNT, SPI_LIFE_CNT_DED_COUNT) }, | |
| 410 | + | |
| 411 | + /* SQC - regSQC_EDC_CNT */ | |
| 412 | + { "SQC_DATA_CU0_WRITE_DATA_BUF", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 413 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU0_WRITE_DATA_BUF_SEC_COUNT), | |
| 414 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU0_WRITE_DATA_BUF_DED_COUNT) }, | |
| 415 | + { "SQC_DATA_CU0_UTCL1_LFIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 416 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU0_UTCL1_LFIFO_SEC_COUNT), | |
| 417 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU0_UTCL1_LFIFO_DED_COUNT) }, | |
| 418 | + { "SQC_DATA_CU1_WRITE_DATA_BUF", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 419 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU1_WRITE_DATA_BUF_SEC_COUNT), | |
| 420 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU1_WRITE_DATA_BUF_DED_COUNT) }, | |
| 421 | + { "SQC_DATA_CU1_UTCL1_LFIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 422 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU1_UTCL1_LFIFO_SEC_COUNT), | |
| 423 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU1_UTCL1_LFIFO_DED_COUNT) }, | |
| 424 | + { "SQC_DATA_CU2_WRITE_DATA_BUF", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 425 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU2_WRITE_DATA_BUF_SEC_COUNT), | |
| 426 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU2_WRITE_DATA_BUF_DED_COUNT) }, | |
| 427 | + { "SQC_DATA_CU2_UTCL1_LFIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 428 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU2_UTCL1_LFIFO_SEC_COUNT), | |
| 429 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU2_UTCL1_LFIFO_DED_COUNT) }, | |
| 430 | + { "SQC_DATA_CU3_WRITE_DATA_BUF", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 431 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU3_WRITE_DATA_BUF_SEC_COUNT), | |
| 432 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU3_WRITE_DATA_BUF_DED_COUNT) }, | |
| 433 | + { "SQC_DATA_CU3_UTCL1_LFIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT), | |
| 434 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU3_UTCL1_LFIFO_SEC_COUNT), | |
| 435 | + SOC15_REG_FIELD(SQC_EDC_CNT, DATA_CU3_UTCL1_LFIFO_DED_COUNT) }, | |
| 436 | + | |
| 437 | + /* SQC - regSQC_EDC_CNT2 */ | |
| 438 | + { "SQC_INST_BANKA_TAG_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT2), | |
| 439 | + SOC15_REG_FIELD(SQC_EDC_CNT2, INST_BANKA_TAG_RAM_SEC_COUNT), | |
| 440 | + SOC15_REG_FIELD(SQC_EDC_CNT2, INST_BANKA_TAG_RAM_DED_COUNT) }, | |
| 441 | + { "SQC_INST_BANKA_BANK_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT2), | |
| 442 | + SOC15_REG_FIELD(SQC_EDC_CNT2, INST_BANKA_BANK_RAM_SEC_COUNT), | |
| 443 | + SOC15_REG_FIELD(SQC_EDC_CNT2, INST_BANKA_BANK_RAM_DED_COUNT) }, | |
| 444 | + { "SQC_DATA_BANKA_TAG_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT2), | |
| 445 | + SOC15_REG_FIELD(SQC_EDC_CNT2, DATA_BANKA_TAG_RAM_SEC_COUNT), | |
| 446 | + SOC15_REG_FIELD(SQC_EDC_CNT2, DATA_BANKA_TAG_RAM_DED_COUNT) }, | |
| 447 | + { "SQC_DATA_BANKA_BANK_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT2), | |
| 448 | + SOC15_REG_FIELD(SQC_EDC_CNT2, DATA_BANKA_BANK_RAM_SEC_COUNT), | |
| 449 | + SOC15_REG_FIELD(SQC_EDC_CNT2, DATA_BANKA_BANK_RAM_DED_COUNT) }, | |
| 450 | + { "SQC_INST_UTCL1_LFIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT2), | |
| 451 | + SOC15_REG_FIELD(SQC_EDC_CNT2, INST_UTCL1_LFIFO_SEC_COUNT), | |
| 452 | + SOC15_REG_FIELD(SQC_EDC_CNT2, INST_UTCL1_LFIFO_DED_COUNT) }, | |
| 453 | + { "SQC_DATA_BANKA_DIRTY_BIT_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT2), | |
| 454 | + SOC15_REG_FIELD(SQC_EDC_CNT2, DATA_BANKA_DIRTY_BIT_RAM_SEC_COUNT), | |
| 455 | + SOC15_REG_FIELD(SQC_EDC_CNT2, DATA_BANKA_DIRTY_BIT_RAM_DED_COUNT) }, | |
| 456 | + | |
| 457 | + /* SQC - regSQC_EDC_CNT3 */ | |
| 458 | + { "SQC_INST_BANKB_TAG_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT3), | |
| 459 | + SOC15_REG_FIELD(SQC_EDC_CNT3, INST_BANKB_TAG_RAM_SEC_COUNT), | |
| 460 | + SOC15_REG_FIELD(SQC_EDC_CNT3, INST_BANKB_TAG_RAM_DED_COUNT) }, | |
| 461 | + { "SQC_INST_BANKB_BANK_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT3), | |
| 462 | + SOC15_REG_FIELD(SQC_EDC_CNT3, INST_BANKB_BANK_RAM_SEC_COUNT), | |
| 463 | + SOC15_REG_FIELD(SQC_EDC_CNT3, INST_BANKB_BANK_RAM_DED_COUNT) }, | |
| 464 | + { "SQC_DATA_BANKB_TAG_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT3), | |
| 465 | + SOC15_REG_FIELD(SQC_EDC_CNT3, DATA_BANKB_TAG_RAM_SEC_COUNT), | |
| 466 | + SOC15_REG_FIELD(SQC_EDC_CNT3, DATA_BANKB_TAG_RAM_DED_COUNT) }, | |
| 467 | + { "SQC_DATA_BANKB_BANK_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT3), | |
| 468 | + SOC15_REG_FIELD(SQC_EDC_CNT3, DATA_BANKB_BANK_RAM_SEC_COUNT), | |
| 469 | + SOC15_REG_FIELD(SQC_EDC_CNT3, DATA_BANKB_BANK_RAM_DED_COUNT) }, | |
| 470 | + { "SQC_DATA_BANKB_DIRTY_BIT_RAM", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_CNT3), | |
| 471 | + SOC15_REG_FIELD(SQC_EDC_CNT3, DATA_BANKB_DIRTY_BIT_RAM_SEC_COUNT), | |
| 472 | + SOC15_REG_FIELD(SQC_EDC_CNT3, DATA_BANKB_DIRTY_BIT_RAM_DED_COUNT) }, | |
| 473 | + | |
| 474 | + /* SQC - regSQC_EDC_PARITY_CNT3 */ | |
| 475 | + { "SQC_INST_BANKA_UTCL1_MISS_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 476 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKA_UTCL1_MISS_FIFO_SEC_COUNT), | |
| 477 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKA_UTCL1_MISS_FIFO_DED_COUNT) }, | |
| 478 | + { "SQC_INST_BANKA_MISS_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 479 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKA_MISS_FIFO_SEC_COUNT), | |
| 480 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKA_MISS_FIFO_DED_COUNT) }, | |
| 481 | + { "SQC_DATA_BANKA_HIT_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 482 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKA_HIT_FIFO_SEC_COUNT), | |
| 483 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKA_HIT_FIFO_DED_COUNT) }, | |
| 484 | + { "SQC_DATA_BANKA_MISS_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 485 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKA_MISS_FIFO_SEC_COUNT), | |
| 486 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKA_MISS_FIFO_DED_COUNT) }, | |
| 487 | + { "SQC_INST_BANKB_UTCL1_MISS_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 488 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKB_UTCL1_MISS_FIFO_SEC_COUNT), | |
| 489 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKB_UTCL1_MISS_FIFO_DED_COUNT) }, | |
| 490 | + { "SQC_INST_BANKB_MISS_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 491 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKB_MISS_FIFO_SEC_COUNT), | |
| 492 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, INST_BANKB_MISS_FIFO_DED_COUNT) }, | |
| 493 | + { "SQC_DATA_BANKB_HIT_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 494 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKB_HIT_FIFO_SEC_COUNT), | |
| 495 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKB_HIT_FIFO_DED_COUNT) }, | |
| 496 | + { "SQC_DATA_BANKB_MISS_FIFO", SOC15_REG_ENTRY(GC, 0, regSQC_EDC_PARITY_CNT3), | |
| 497 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKB_MISS_FIFO_SEC_COUNT), | |
| 498 | + SOC15_REG_FIELD(SQC_EDC_PARITY_CNT3, DATA_BANKB_MISS_FIFO_DED_COUNT) }, | |
| 499 | + | |
| 500 | + /* SQ */ | |
| 501 | + { "SQ_LDS_D", SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), | |
| 502 | + SOC15_REG_FIELD(SQ_EDC_CNT, LDS_D_SEC_COUNT), | |
| 503 | + SOC15_REG_FIELD(SQ_EDC_CNT, LDS_D_DED_COUNT) }, | |
| 504 | + { "SQ_LDS_I", SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), | |
| 505 | + SOC15_REG_FIELD(SQ_EDC_CNT, LDS_I_SEC_COUNT), | |
| 506 | + SOC15_REG_FIELD(SQ_EDC_CNT, LDS_I_DED_COUNT) }, | |
| 507 | + { "SQ_SGPR", SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), | |
| 508 | + SOC15_REG_FIELD(SQ_EDC_CNT, SGPR_SEC_COUNT), | |
| 509 | + SOC15_REG_FIELD(SQ_EDC_CNT, SGPR_DED_COUNT) }, | |
| 510 | + { "SQ_VGPR0", SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), | |
| 511 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR0_SEC_COUNT), | |
| 512 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR0_DED_COUNT) }, | |
| 513 | + { "SQ_VGPR1", SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), | |
| 514 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR1_SEC_COUNT), | |
| 515 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR1_DED_COUNT) }, | |
| 516 | + { "SQ_VGPR2", SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), | |
| 517 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR2_SEC_COUNT), | |
| 518 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR2_DED_COUNT) }, | |
| 519 | + { "SQ_VGPR3", SOC15_REG_ENTRY(GC, 0, regSQ_EDC_CNT), | |
| 520 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR3_SEC_COUNT), | |
| 521 | + SOC15_REG_FIELD(SQ_EDC_CNT, VGPR3_DED_COUNT) }, | |
| 522 | + | |
| 523 | + /* TCP */ | |
| 524 | + { "TCP_CACHE_RAM", SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), | |
| 525 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, CACHE_RAM_SEC_COUNT), | |
| 526 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, CACHE_RAM_DED_COUNT) }, | |
| 527 | + { "TCP_LFIFO_RAM", SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), | |
| 528 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, LFIFO_RAM_SEC_COUNT), | |
| 529 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, LFIFO_RAM_DED_COUNT) }, | |
| 530 | + { "TCP_CMD_FIFO", SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), | |
| 531 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, CMD_FIFO_SEC_COUNT), | |
| 532 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, CMD_FIFO_DED_COUNT) }, | |
| 533 | + { "TCP_VM_FIFO", SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), | |
| 534 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, VM_FIFO_SEC_COUNT), | |
| 535 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, VM_FIFO_DED_COUNT) }, | |
| 536 | + { "TCP_DB_RAM", SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), | |
| 537 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, DB_RAM_SEC_COUNT), | |
| 538 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, DB_RAM_DED_COUNT) }, | |
| 539 | + { "TCP_UTCL1_LFIFO0", SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), | |
| 540 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, UTCL1_LFIFO0_SEC_COUNT), | |
| 541 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, UTCL1_LFIFO0_DED_COUNT) }, | |
| 542 | + { "TCP_UTCL1_LFIFO1", SOC15_REG_ENTRY(GC, 0, regTCP_EDC_CNT_NEW), | |
| 543 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, UTCL1_LFIFO1_SEC_COUNT), | |
| 544 | + SOC15_REG_FIELD(TCP_EDC_CNT_NEW, UTCL1_LFIFO1_DED_COUNT) }, | |
| 545 | + | |
| 546 | + /* TCI */ | |
| 547 | + { "TCI_WRITE_RAM", SOC15_REG_ENTRY(GC, 0, regTCI_EDC_CNT), | |
| 548 | + SOC15_REG_FIELD(TCI_EDC_CNT, WRITE_RAM_SEC_COUNT), | |
| 549 | + SOC15_REG_FIELD(TCI_EDC_CNT, WRITE_RAM_DED_COUNT) }, | |
| 550 | + | |
| 551 | + /* TCC */ | |
| 552 | + { "TCC_CACHE_DATA", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), | |
| 553 | + SOC15_REG_FIELD(TCC_EDC_CNT, CACHE_DATA_SEC_COUNT), | |
| 554 | + SOC15_REG_FIELD(TCC_EDC_CNT, CACHE_DATA_DED_COUNT) }, | |
| 555 | + { "TCC_CACHE_DIRTY", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), | |
| 556 | + SOC15_REG_FIELD(TCC_EDC_CNT, CACHE_DIRTY_SEC_COUNT), | |
| 557 | + SOC15_REG_FIELD(TCC_EDC_CNT, CACHE_DIRTY_DED_COUNT) }, | |
| 558 | + { "TCC_HIGH_RATE_TAG", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), | |
| 559 | + SOC15_REG_FIELD(TCC_EDC_CNT, HIGH_RATE_TAG_SEC_COUNT), | |
| 560 | + SOC15_REG_FIELD(TCC_EDC_CNT, HIGH_RATE_TAG_DED_COUNT) }, | |
| 561 | + { "TCC_LOW_RATE_TAG", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), | |
| 562 | + SOC15_REG_FIELD(TCC_EDC_CNT, LOW_RATE_TAG_SEC_COUNT), | |
| 563 | + SOC15_REG_FIELD(TCC_EDC_CNT, LOW_RATE_TAG_DED_COUNT) }, | |
| 564 | + { "TCC_SRC_FIFO", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), | |
| 565 | + SOC15_REG_FIELD(TCC_EDC_CNT, SRC_FIFO_SEC_COUNT), | |
| 566 | + SOC15_REG_FIELD(TCC_EDC_CNT, SRC_FIFO_DED_COUNT) }, | |
| 567 | + { "TCC_LATENCY_FIFO", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), | |
| 568 | + SOC15_REG_FIELD(TCC_EDC_CNT, LATENCY_FIFO_SEC_COUNT), | |
| 569 | + SOC15_REG_FIELD(TCC_EDC_CNT, LATENCY_FIFO_DED_COUNT) }, | |
| 570 | + { "TCC_LATENCY_FIFO_NEXT_RAM", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT), | |
| 571 | + SOC15_REG_FIELD(TCC_EDC_CNT, LATENCY_FIFO_NEXT_RAM_SEC_COUNT), | |
| 572 | + SOC15_REG_FIELD(TCC_EDC_CNT, LATENCY_FIFO_NEXT_RAM_DED_COUNT) }, | |
| 573 | + { "TCC_CACHE_TAG_PROBE_FIFO", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 574 | + SOC15_REG_FIELD(TCC_EDC_CNT2, CACHE_TAG_PROBE_FIFO_SEC_COUNT), | |
| 575 | + SOC15_REG_FIELD(TCC_EDC_CNT2, CACHE_TAG_PROBE_FIFO_DED_COUNT) }, | |
| 576 | + { "TCC_UC_ATOMIC_FIFO", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 577 | + SOC15_REG_FIELD(TCC_EDC_CNT2, UC_ATOMIC_FIFO_SEC_COUNT), | |
| 578 | + SOC15_REG_FIELD(TCC_EDC_CNT2, UC_ATOMIC_FIFO_DED_COUNT) }, | |
| 579 | + { "TCC_WRITE_CACHE_READ", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 580 | + SOC15_REG_FIELD(TCC_EDC_CNT2, WRITE_CACHE_READ_SEC_COUNT), | |
| 581 | + SOC15_REG_FIELD(TCC_EDC_CNT2, WRITE_CACHE_READ_DED_COUNT) }, | |
| 582 | + { "TCC_RETURN_CONTROL", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 583 | + SOC15_REG_FIELD(TCC_EDC_CNT2, RETURN_CONTROL_SEC_COUNT), | |
| 584 | + SOC15_REG_FIELD(TCC_EDC_CNT2, RETURN_CONTROL_DED_COUNT) }, | |
| 585 | + { "TCC_IN_USE_TRANSFER", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 586 | + SOC15_REG_FIELD(TCC_EDC_CNT2, IN_USE_TRANSFER_SEC_COUNT), | |
| 587 | + SOC15_REG_FIELD(TCC_EDC_CNT2, IN_USE_TRANSFER_DED_COUNT) }, | |
| 588 | + { "TCC_IN_USE_DEC", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 589 | + SOC15_REG_FIELD(TCC_EDC_CNT2, IN_USE_DEC_SEC_COUNT), | |
| 590 | + SOC15_REG_FIELD(TCC_EDC_CNT2, IN_USE_DEC_DED_COUNT) }, | |
| 591 | + { "TCC_WRITE_RETURN", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 592 | + SOC15_REG_FIELD(TCC_EDC_CNT2, WRITE_RETURN_SEC_COUNT), | |
| 593 | + SOC15_REG_FIELD(TCC_EDC_CNT2, WRITE_RETURN_DED_COUNT) }, | |
| 594 | + { "TCC_RETURN_DATA", SOC15_REG_ENTRY(GC, 0, regTCC_EDC_CNT2), | |
| 595 | + SOC15_REG_FIELD(TCC_EDC_CNT2, RETURN_DATA_SEC_COUNT), | |
| 596 | + SOC15_REG_FIELD(TCC_EDC_CNT2, RETURN_DATA_DED_COUNT) }, | |
| 597 | + | |
| 598 | + /* TCA */ | |
| 599 | + { "TCA_HOLE_FIFO", SOC15_REG_ENTRY(GC, 0, regTCA_EDC_CNT), | |
| 600 | + SOC15_REG_FIELD(TCA_EDC_CNT, HOLE_FIFO_SEC_COUNT), | |
| 601 | + SOC15_REG_FIELD(TCA_EDC_CNT, HOLE_FIFO_DED_COUNT) }, | |
| 602 | + { "TCA_REQ_FIFO", SOC15_REG_ENTRY(GC, 0, regTCA_EDC_CNT), | |
| 603 | + SOC15_REG_FIELD(TCA_EDC_CNT, REQ_FIFO_SEC_COUNT), | |
| 604 | + SOC15_REG_FIELD(TCA_EDC_CNT, REQ_FIFO_DED_COUNT) }, | |
| 605 | + | |
| 606 | + /* TCX */ | |
| 607 | + { "TCX_GROUP0", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 608 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP0_SEC_COUNT), | |
| 609 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP0_DED_COUNT) }, | |
| 610 | + { "TCX_GROUP1", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 611 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP1_SEC_COUNT), | |
| 612 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP1_DED_COUNT) }, | |
| 613 | + { "TCX_GROUP2", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 614 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP2_SEC_COUNT), | |
| 615 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP2_DED_COUNT) }, | |
| 616 | + { "TCX_GROUP3", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 617 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP3_SEC_COUNT), | |
| 618 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP3_DED_COUNT) }, | |
| 619 | + { "TCX_GROUP4", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 620 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP4_SEC_COUNT), | |
| 621 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP4_DED_COUNT) }, | |
| 622 | + { "TCX_GROUP5", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 623 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP5_SED_COUNT), 0, 0 }, | |
| 624 | + { "TCX_GROUP6", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 625 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP6_SED_COUNT), 0, 0 }, | |
| 626 | + { "TCX_GROUP7", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 627 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP7_SED_COUNT), 0, 0 }, | |
| 628 | + { "TCX_GROUP8", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 629 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP8_SED_COUNT), 0, 0 }, | |
| 630 | + { "TCX_GROUP9", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 631 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP9_SED_COUNT), 0, 0 }, | |
| 632 | + { "TCX_GROUP10", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT), | |
| 633 | + SOC15_REG_FIELD(TCX_EDC_CNT, GROUP10_SED_COUNT), 0, 0 }, | |
| 634 | + { "TCX_GROUP11", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT2), | |
| 635 | + SOC15_REG_FIELD(TCX_EDC_CNT2, GROUP11_SED_COUNT), 0, 0 }, | |
| 636 | + { "TCX_GROUP12", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT2), | |
| 637 | + SOC15_REG_FIELD(TCX_EDC_CNT2, GROUP12_SED_COUNT), 0, 0 }, | |
| 638 | + { "TCX_GROUP13", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT2), | |
| 639 | + SOC15_REG_FIELD(TCX_EDC_CNT2, GROUP13_SED_COUNT), 0, 0 }, | |
| 640 | + { "TCX_GROUP14", SOC15_REG_ENTRY(GC, 0, regTCX_EDC_CNT2), | |
| 641 | + SOC15_REG_FIELD(TCX_EDC_CNT2, GROUP14_SED_COUNT), 0, 0 }, | |
| 642 | + | |
| 643 | + /* TD */ | |
| 644 | + { "TD_SS_FIFO_LO", SOC15_REG_ENTRY(GC, 0, regTD_EDC_CNT), | |
| 645 | + SOC15_REG_FIELD(TD_EDC_CNT, SS_FIFO_LO_SEC_COUNT), | |
| 646 | + SOC15_REG_FIELD(TD_EDC_CNT, SS_FIFO_LO_DED_COUNT) }, | |
| 647 | + { "TD_SS_FIFO_HI", SOC15_REG_ENTRY(GC, 0, regTD_EDC_CNT), | |
| 648 | + SOC15_REG_FIELD(TD_EDC_CNT, SS_FIFO_HI_SEC_COUNT), | |
| 649 | + SOC15_REG_FIELD(TD_EDC_CNT, SS_FIFO_HI_DED_COUNT) }, | |
| 650 | + { "TD_CS_FIFO", SOC15_REG_ENTRY(GC, 0, regTD_EDC_CNT), | |
| 651 | + SOC15_REG_FIELD(TD_EDC_CNT, CS_FIFO_SEC_COUNT), | |
| 652 | + SOC15_REG_FIELD(TD_EDC_CNT, CS_FIFO_DED_COUNT) }, | |
| 653 | + | |
| 654 | + /* TA */ | |
| 655 | + { "TA_FS_DFIFO", SOC15_REG_ENTRY(GC, 0, regTA_EDC_CNT), | |
| 656 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_DFIFO_SEC_COUNT), | |
| 657 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_DFIFO_DED_COUNT) }, | |
| 658 | + { "TA_FS_AFIFO_LO", SOC15_REG_ENTRY(GC, 0, regTA_EDC_CNT), | |
| 659 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_AFIFO_LO_SEC_COUNT), | |
| 660 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_AFIFO_LO_DED_COUNT) }, | |
| 661 | + { "TA_FL_LFIFO", SOC15_REG_ENTRY(GC, 0, regTA_EDC_CNT), | |
| 662 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FL_LFIFO_SEC_COUNT), | |
| 663 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FL_LFIFO_DED_COUNT) }, | |
| 664 | + { "TA_FX_LFIFO", SOC15_REG_ENTRY(GC, 0, regTA_EDC_CNT), | |
| 665 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FX_LFIFO_SEC_COUNT), | |
| 666 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FX_LFIFO_DED_COUNT) }, | |
| 667 | + { "TA_FS_CFIFO", SOC15_REG_ENTRY(GC, 0, regTA_EDC_CNT), | |
| 668 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_CFIFO_SEC_COUNT), | |
| 669 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_CFIFO_DED_COUNT) }, | |
| 670 | + { "TA_FS_AFIFO_HI", SOC15_REG_ENTRY(GC, 0, regTA_EDC_CNT), | |
| 671 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_AFIFO_HI_SEC_COUNT), | |
| 672 | + SOC15_REG_FIELD(TA_EDC_CNT, TA_FS_AFIFO_HI_DED_COUNT) }, | |
| 673 | + | |
| 674 | + /* EA - regGCEA_EDC_CNT */ | |
| 675 | + { "EA_DRAMRD_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 676 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMRD_CMDMEM_SEC_COUNT), | |
| 677 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMRD_CMDMEM_DED_COUNT) }, | |
| 678 | + { "EA_DRAMWR_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 679 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMWR_CMDMEM_SEC_COUNT), | |
| 680 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMWR_CMDMEM_DED_COUNT) }, | |
| 681 | + { "EA_DRAMWR_DATAMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 682 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMWR_DATAMEM_SEC_COUNT), | |
| 683 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMWR_DATAMEM_DED_COUNT) }, | |
| 684 | + { "EA_RRET_TAGMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 685 | + SOC15_REG_FIELD(GCEA_EDC_CNT, RRET_TAGMEM_SEC_COUNT), | |
| 686 | + SOC15_REG_FIELD(GCEA_EDC_CNT, RRET_TAGMEM_DED_COUNT) }, | |
| 687 | + { "EA_WRET_TAGMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 688 | + SOC15_REG_FIELD(GCEA_EDC_CNT, WRET_TAGMEM_SEC_COUNT), | |
| 689 | + SOC15_REG_FIELD(GCEA_EDC_CNT, WRET_TAGMEM_DED_COUNT) }, | |
| 690 | + { "EA_IOWR_DATAMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 691 | + SOC15_REG_FIELD(GCEA_EDC_CNT, IOWR_DATAMEM_SEC_COUNT), | |
| 692 | + SOC15_REG_FIELD(GCEA_EDC_CNT, IOWR_DATAMEM_DED_COUNT) }, | |
| 693 | + { "EA_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 694 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMRD_PAGEMEM_SED_COUNT), 0, 0 }, | |
| 695 | + { "EA_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 696 | + SOC15_REG_FIELD(GCEA_EDC_CNT, DRAMWR_PAGEMEM_SED_COUNT), 0, 0 }, | |
| 697 | + { "EA_IORD_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 698 | + SOC15_REG_FIELD(GCEA_EDC_CNT, IORD_CMDMEM_SED_COUNT), 0, 0 }, | |
| 699 | + { "EA_IOWR_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT), | |
| 700 | + SOC15_REG_FIELD(GCEA_EDC_CNT, IOWR_CMDMEM_SED_COUNT), 0, 0 }, | |
| 701 | + | |
| 702 | + /* EA - regGCEA_EDC_CNT2 */ | |
| 703 | + { "EA_GMIRD_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 704 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIRD_CMDMEM_SEC_COUNT), | |
| 705 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIRD_CMDMEM_DED_COUNT) }, | |
| 706 | + { "EA_GMIWR_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 707 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIWR_CMDMEM_SEC_COUNT), | |
| 708 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIWR_CMDMEM_DED_COUNT) }, | |
| 709 | + { "EA_GMIWR_DATAMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 710 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIWR_DATAMEM_SEC_COUNT), | |
| 711 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIWR_DATAMEM_DED_COUNT) }, | |
| 712 | + { "EA_GMIRD_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 713 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIRD_PAGEMEM_SED_COUNT), 0, 0 }, | |
| 714 | + { "EA_GMIWR_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 715 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, GMIWR_PAGEMEM_SED_COUNT), 0, 0 }, | |
| 716 | + { "EA_MAM_D0MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 717 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D0MEM_SED_COUNT), | |
| 718 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D0MEM_DED_COUNT) }, | |
| 719 | + { "EA_MAM_D1MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 720 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D1MEM_SED_COUNT), | |
| 721 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D1MEM_DED_COUNT) }, | |
| 722 | + { "EA_MAM_D2MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 723 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D2MEM_SED_COUNT), | |
| 724 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D2MEM_DED_COUNT) }, | |
| 725 | + { "EA_MAM_D3MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT2), | |
| 726 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D3MEM_SED_COUNT), | |
| 727 | + SOC15_REG_FIELD(GCEA_EDC_CNT2, MAM_D3MEM_DED_COUNT) }, | |
| 728 | + | |
| 729 | + /* EA - regGCEA_EDC_CNT3 */ | |
| 730 | + { "EA_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), 0, 0, | |
| 731 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, DRAMRD_PAGEMEM_DED_COUNT) }, | |
| 732 | + { "EA_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), 0, 0, | |
| 733 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, DRAMWR_PAGEMEM_DED_COUNT) }, | |
| 734 | + { "EA_IORD_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), 0, 0, | |
| 735 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, IORD_CMDMEM_DED_COUNT) }, | |
| 736 | + { "EA_IOWR_CMDMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), 0, 0, | |
| 737 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, IOWR_CMDMEM_DED_COUNT) }, | |
| 738 | + { "EA_GMIRD_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), 0, 0, | |
| 739 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, GMIRD_PAGEMEM_DED_COUNT) }, | |
| 740 | + { "EA_GMIWR_PAGEMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), 0, 0, | |
| 741 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, GMIWR_PAGEMEM_DED_COUNT) }, | |
| 742 | + { "EA_MAM_A0MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), | |
| 743 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A0MEM_SEC_COUNT), | |
| 744 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A0MEM_DED_COUNT) }, | |
| 745 | + { "EA_MAM_A1MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), | |
| 746 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A1MEM_SEC_COUNT), | |
| 747 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A1MEM_DED_COUNT) }, | |
| 748 | + { "EA_MAM_A2MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), | |
| 749 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A2MEM_SEC_COUNT), | |
| 750 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A2MEM_DED_COUNT) }, | |
| 751 | + { "EA_MAM_A3MEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), | |
| 752 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A3MEM_SEC_COUNT), | |
| 753 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_A3MEM_DED_COUNT) }, | |
| 754 | + { "EA_MAM_AFMEM", SOC15_REG_ENTRY(GC, 0, regGCEA_EDC_CNT3), | |
| 755 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_AFMEM_SEC_COUNT), | |
| 756 | + SOC15_REG_FIELD(GCEA_EDC_CNT3, MAM_AFMEM_DED_COUNT) }, | |
| 757 | +}; | |
| 758 | + | |
| 759 | +static const char * const vml2_walker_mems[] = { | |
| 760 | + "UTC_VML2_CACHE_PDE0_MEM0", | |
| 761 | + "UTC_VML2_CACHE_PDE0_MEM1", | |
| 762 | + "UTC_VML2_CACHE_PDE1_MEM0", | |
| 763 | + "UTC_VML2_CACHE_PDE1_MEM1", | |
| 764 | + "UTC_VML2_CACHE_PDE2_MEM0", | |
| 765 | + "UTC_VML2_CACHE_PDE2_MEM1", | |
| 766 | + "UTC_VML2_RDIF_ARADDRS", | |
| 767 | + "UTC_VML2_RDIF_LOG_FIFO", | |
| 768 | + "UTC_VML2_QUEUE_REQ", | |
| 769 | + "UTC_VML2_QUEUE_RET", | |
| 770 | +}; | |
| 771 | + | |
| 772 | +static struct gfx_v9_4_2_utc_block gfx_v9_4_2_utc_blocks[] = { | |
| 773 | + { VML2_MEM, 8, 2, 2, | |
| 774 | + { SOC15_REG_ENTRY(GC, 0, regVML2_MEM_ECC_INDEX) }, | |
| 775 | + { SOC15_REG_ENTRY(GC, 0, regVML2_MEM_ECC_CNTL) }, | |
| 776 | + SOC15_REG_FIELD(VML2_MEM_ECC_CNTL, SEC_COUNT), | |
| 777 | + SOC15_REG_FIELD(VML2_MEM_ECC_CNTL, DED_COUNT), | |
| 778 | + REG_SET_FIELD(0, VML2_MEM_ECC_CNTL, WRITE_COUNTERS, 1) }, | |
| 779 | + { VML2_WALKER_MEM, ARRAY_SIZE(vml2_walker_mems), 1, 1, | |
| 780 | + { SOC15_REG_ENTRY(GC, 0, regVML2_WALKER_MEM_ECC_INDEX) }, | |
| 781 | + { SOC15_REG_ENTRY(GC, 0, regVML2_WALKER_MEM_ECC_CNTL) }, | |
| 782 | + SOC15_REG_FIELD(VML2_WALKER_MEM_ECC_CNTL, SEC_COUNT), | |
| 783 | + SOC15_REG_FIELD(VML2_WALKER_MEM_ECC_CNTL, DED_COUNT), | |
| 784 | + REG_SET_FIELD(0, VML2_WALKER_MEM_ECC_CNTL, WRITE_COUNTERS, 1) }, | |
| 785 | + { UTCL2_MEM, 18, 1, 2, | |
| 786 | + { SOC15_REG_ENTRY(GC, 0, regUTCL2_MEM_ECC_INDEX) }, | |
| 787 | + { SOC15_REG_ENTRY(GC, 0, regUTCL2_MEM_ECC_CNTL) }, | |
| 788 | + SOC15_REG_FIELD(UTCL2_MEM_ECC_CNTL, SEC_COUNT), | |
| 789 | + SOC15_REG_FIELD(UTCL2_MEM_ECC_CNTL, DED_COUNT), | |
| 790 | + REG_SET_FIELD(0, UTCL2_MEM_ECC_CNTL, WRITE_COUNTERS, 1) }, | |
| 791 | + { ATC_L2_CACHE_2M, 8, 2, 1, | |
| 792 | + { SOC15_REG_ENTRY(GC, 0, regATC_L2_CACHE_2M_DSM_INDEX) }, | |
| 793 | + { SOC15_REG_ENTRY(GC, 0, regATC_L2_CACHE_2M_DSM_CNTL) }, | |
| 794 | + SOC15_REG_FIELD(ATC_L2_CACHE_2M_DSM_CNTL, SEC_COUNT), | |
| 795 | + SOC15_REG_FIELD(ATC_L2_CACHE_2M_DSM_CNTL, DED_COUNT), | |
| 796 | + REG_SET_FIELD(0, ATC_L2_CACHE_2M_DSM_CNTL, WRITE_COUNTERS, 1) }, | |
| 797 | + { ATC_L2_CACHE_32K, 8, 2, 2, | |
| 798 | + { SOC15_REG_ENTRY(GC, 0, regATC_L2_CACHE_32K_DSM_INDEX) }, | |
| 799 | + { SOC15_REG_ENTRY(GC, 0, regATC_L2_CACHE_32K_DSM_CNTL) }, | |
| 800 | + SOC15_REG_FIELD(ATC_L2_CACHE_32K_DSM_CNTL, SEC_COUNT), | |
| 801 | + SOC15_REG_FIELD(ATC_L2_CACHE_32K_DSM_CNTL, DED_COUNT), | |
| 802 | + REG_SET_FIELD(0, ATC_L2_CACHE_32K_DSM_CNTL, WRITE_COUNTERS, 1) }, | |
| 803 | + { ATC_L2_CACHE_4K, 8, 2, 8, | |
| 804 | + { SOC15_REG_ENTRY(GC, 0, regATC_L2_CACHE_4K_DSM_INDEX) }, | |
| 805 | + { SOC15_REG_ENTRY(GC, 0, regATC_L2_CACHE_4K_DSM_CNTL) }, | |
| 806 | + SOC15_REG_FIELD(ATC_L2_CACHE_4K_DSM_CNTL, SEC_COUNT), | |
| 807 | + SOC15_REG_FIELD(ATC_L2_CACHE_4K_DSM_CNTL, DED_COUNT), | |
| 808 | + REG_SET_FIELD(0, ATC_L2_CACHE_4K_DSM_CNTL, WRITE_COUNTERS, 1) }, | |
| 809 | +}; | |
| 810 | + | |
| 811 | +static const struct soc15_reg_entry gfx_v9_4_2_rdrsp_status_regs = | |
| 812 | + { SOC15_REG_ENTRY(GC, 0, regGCEA_ERR_STATUS), 0, 1, 16 }; | |
| 813 | + | |
| 814 | +static int gfx_v9_4_2_get_reg_error_count(struct amdgpu_device *adev, | |
| 815 | + const struct soc15_reg_entry *reg, | |
| 816 | + uint32_t se_id, uint32_t inst_id, | |
| 817 | + uint32_t value, uint32_t *sec_count, | |
| 818 | + uint32_t *ded_count) | |
| 819 | +{ | |
| 820 | + uint32_t i; | |
| 821 | + uint32_t sec_cnt, ded_cnt; | |
| 822 | + | |
| 823 | + for (i = 0; i < ARRAY_SIZE(gfx_v9_4_2_ras_fields); i++) { | |
| 824 | + if (gfx_v9_4_2_ras_fields[i].reg_offset != reg->reg_offset || | |
| 825 | + gfx_v9_4_2_ras_fields[i].seg != reg->seg || | |
| 826 | + gfx_v9_4_2_ras_fields[i].inst != reg->inst) | |
| 827 | + continue; | |
| 828 | + | |
| 829 | + sec_cnt = SOC15_RAS_REG_FIELD_VAL( | |
| 830 | + value, gfx_v9_4_2_ras_fields[i], sec); | |
| 831 | + if (sec_cnt) { | |
| 832 | + dev_info(adev->dev, | |
| 833 | + "GFX SubBlock %s, Instance[%d][%d], SEC %d\n", | |
| 834 | + gfx_v9_4_2_ras_fields[i].name, se_id, inst_id, | |
| 835 | + sec_cnt); | |
| 836 | + *sec_count += sec_cnt; | |
| 837 | + } | |
| 838 | + | |
| 839 | + ded_cnt = SOC15_RAS_REG_FIELD_VAL( | |
| 840 | + value, gfx_v9_4_2_ras_fields[i], ded); | |
| 841 | + if (ded_cnt) { | |
| 842 | + dev_info(adev->dev, | |
| 843 | + "GFX SubBlock %s, Instance[%d][%d], DED %d\n", | |
| 844 | + gfx_v9_4_2_ras_fields[i].name, se_id, inst_id, | |
| 845 | + ded_cnt); | |
| 846 | + *ded_count += ded_cnt; | |
| 847 | + } | |
| 848 | + } | |
| 849 | + | |
| 850 | + return 0; | |
| 851 | +} | |
| 852 | + | |
| 853 | +static int gfx_v9_4_2_query_sram_edc_count(struct amdgpu_device *adev, | |
| 854 | + uint32_t *sec_count, uint32_t *ded_count) | |
| 855 | +{ | |
| 856 | + uint32_t i, j, k, data; | |
| 857 | + uint32_t sec_cnt = 0, ded_cnt = 0; | |
| 858 | + | |
| 859 | + if (sec_count && ded_count) { | |
| 860 | + *sec_count = 0; | |
| 861 | + *ded_count = 0; | |
| 862 | + } | |
| 863 | + | |
| 864 | + mutex_lock(&adev->grbm_idx_mutex); | |
| 865 | + | |
| 866 | + for (i = 0; i < ARRAY_SIZE(gfx_v9_4_2_edc_counter_regs); i++) { | |
| 867 | + for (j = 0; j < gfx_v9_4_2_edc_counter_regs[i].se_num; j++) { | |
| 868 | + for (k = 0; k < gfx_v9_4_2_edc_counter_regs[i].instance; | |
| 869 | + k++) { | |
| 870 | + gfx_v9_4_2_select_se_sh(adev, j, 0, k); | |
| 871 | + | |
| 872 | + /* if sec/ded_count is null, just clear counter */ | |
| 873 | + if (!sec_count || !ded_count) { | |
| 874 | + WREG32(SOC15_REG_ENTRY_OFFSET( | |
| 875 | + gfx_v9_4_2_edc_counter_regs[i]), 0); | |
| 876 | + continue; | |
| 877 | + } | |
| 878 | + | |
| 879 | + data = RREG32(SOC15_REG_ENTRY_OFFSET( | |
| 880 | + gfx_v9_4_2_edc_counter_regs[i])); | |
| 881 | + | |
| 882 | + if (!data) | |
| 883 | + continue; | |
| 884 | + | |
| 885 | + gfx_v9_4_2_get_reg_error_count(adev, | |
| 886 | + &gfx_v9_4_2_edc_counter_regs[i], | |
| 887 | + j, k, data, &sec_cnt, &ded_cnt); | |
| 888 | + | |
| 889 | + /* clear counter after read */ | |
| 890 | + WREG32(SOC15_REG_ENTRY_OFFSET( | |
| 891 | + gfx_v9_4_2_edc_counter_regs[i]), 0); | |
| 892 | + } | |
| 893 | + } | |
| 894 | + } | |
| 895 | + | |
| 896 | + if (sec_count && ded_count) { | |
| 897 | + *sec_count += sec_cnt; | |
| 898 | + *ded_count += ded_cnt; | |
| 899 | + } | |
| 900 | + | |
| 901 | + gfx_v9_4_2_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | |
| 902 | + mutex_unlock(&adev->grbm_idx_mutex); | |
| 903 | + | |
| 904 | + return 0; | |
| 905 | +} | |
| 906 | + | |
| 907 | +static void gfx_v9_4_2_log_utc_edc_count(struct amdgpu_device *adev, | |
| 908 | + struct gfx_v9_4_2_utc_block *blk, | |
| 909 | + uint32_t instance, uint32_t sec_cnt, | |
| 910 | + uint32_t ded_cnt) | |
| 911 | +{ | |
| 912 | + uint32_t bank, way, mem; | |
| 913 | + static const char *vml2_way_str[] = { "BIGK", "4K" }; | |
| 914 | + static const char *utcl2_rounter_str[] = { "VMC", "APT" }; | |
| 915 | + | |
| 916 | + mem = instance % blk->num_mem_blocks; | |
| 917 | + way = (instance / blk->num_mem_blocks) % blk->num_ways; | |
| 918 | + bank = instance / (blk->num_mem_blocks * blk->num_ways); | |
| 919 | + | |
| 920 | + switch (blk->type) { | |
| 921 | + case VML2_MEM: | |
| 922 | + dev_info( | |
| 923 | + adev->dev, | |
| 924 | + "GFX SubBlock UTC_VML2_BANK_CACHE_%d_%s_MEM%d, SED %d, DED %d\n", | |
| 925 | + bank, vml2_way_str[way], mem, sec_cnt, ded_cnt); | |
| 926 | + break; | |
| 927 | + case VML2_WALKER_MEM: | |
| 928 | + dev_info(adev->dev, "GFX SubBlock %s, SED %d, DED %d\n", | |
| 929 | + vml2_walker_mems[bank], sec_cnt, ded_cnt); | |
| 930 | + break; | |
| 931 | + case UTCL2_MEM: | |
| 932 | + dev_info( | |
| 933 | + adev->dev, | |
| 934 | + "GFX SubBlock UTCL2_ROUTER_IFIF%d_GROUP0_%s, SED %d, DED %d\n", | |
| 935 | + bank, utcl2_rounter_str[mem], sec_cnt, ded_cnt); | |
| 936 | + break; | |
| 937 | + case ATC_L2_CACHE_2M: | |
| 938 | + dev_info( | |
| 939 | + adev->dev, | |
| 940 | + "GFX SubBlock UTC_ATCL2_CACHE_2M_BANK%d_WAY%d_MEM, SED %d, DED %d\n", | |
| 941 | + bank, way, sec_cnt, ded_cnt); | |
| 942 | + break; | |
| 943 | + case ATC_L2_CACHE_32K: | |
| 944 | + dev_info( | |
| 945 | + adev->dev, | |
| 946 | + "GFX SubBlock UTC_ATCL2_CACHE_32K_BANK%d_WAY%d_MEM%d, SED %d, DED %d\n", | |
| 947 | + bank, way, mem, sec_cnt, ded_cnt); | |
| 948 | + break; | |
| 949 | + case ATC_L2_CACHE_4K: | |
| 950 | + dev_info( | |
| 951 | + adev->dev, | |
| 952 | + "GFX SubBlock UTC_ATCL2_CACHE_4K_BANK%d_WAY%d_MEM%d, SED %d, DED %d\n", | |
| 953 | + bank, way, mem, sec_cnt, ded_cnt); | |
| 954 | + break; | |
| 955 | + } | |
| 956 | +} | |
| 957 | + | |
| 958 | +static int gfx_v9_4_2_query_utc_edc_count(struct amdgpu_device *adev, | |
| 959 | + uint32_t *sec_count, | |
| 960 | + uint32_t *ded_count) | |
| 961 | +{ | |
| 962 | + uint32_t i, j, data; | |
| 963 | + uint32_t sec_cnt, ded_cnt; | |
| 964 | + uint32_t num_instances; | |
| 965 | + struct gfx_v9_4_2_utc_block *blk; | |
| 966 | + | |
| 967 | + if (sec_count && ded_count) { | |
| 968 | + *sec_count = 0; | |
| 969 | + *ded_count = 0; | |
| 970 | + } | |
| 971 | + | |
| 972 | + for (i = 0; i < ARRAY_SIZE(gfx_v9_4_2_utc_blocks); i++) { | |
| 973 | + blk = &gfx_v9_4_2_utc_blocks[i]; | |
| 974 | + num_instances = | |
| 975 | + blk->num_banks * blk->num_ways * blk->num_mem_blocks; | |
| 976 | + for (j = 0; j < num_instances; j++) { | |
| 977 | + WREG32(SOC15_REG_ENTRY_OFFSET(blk->idx_reg), j); | |
| 978 | + | |
| 979 | + /* if sec/ded_count is NULL, just clear counter */ | |
| 980 | + if (!sec_count || !ded_count) { | |
| 981 | + WREG32(SOC15_REG_ENTRY_OFFSET(blk->data_reg), | |
| 982 | + blk->clear); | |
| 983 | + continue; | |
| 984 | + } | |
| 985 | + | |
| 986 | + data = RREG32(SOC15_REG_ENTRY_OFFSET(blk->data_reg)); | |
| 987 | + if (!data) | |
| 988 | + continue; | |
| 989 | + | |
| 990 | + sec_cnt = SOC15_RAS_REG_FIELD_VAL(data, *blk, sec); | |
| 991 | + *sec_count += sec_cnt; | |
| 992 | + ded_cnt = SOC15_RAS_REG_FIELD_VAL(data, *blk, ded); | |
| 993 | + *ded_count += ded_cnt; | |
| 994 | + | |
| 995 | + /* clear counter after read */ | |
| 996 | + WREG32(SOC15_REG_ENTRY_OFFSET(blk->data_reg), | |
| 997 | + blk->clear); | |
| 998 | + | |
| 999 | + /* print the edc count */ | |
| 1000 | + gfx_v9_4_2_log_utc_edc_count(adev, blk, j, sec_cnt, | |
| 1001 | + ded_cnt); | |
| 1002 | + } | |
| 1003 | + } | |
| 1004 | + | |
| 1005 | + return 0; | |
| 1006 | +} | |
| 1007 | + | |
| 1008 | +int gfx_v9_4_2_query_ras_error_count(struct amdgpu_device *adev, | |
| 1009 | + void *ras_error_status) | |
| 1010 | +{ | |
| 1011 | + struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status; | |
| 1012 | + uint32_t sec_count = 0, ded_count = 0; | |
| 1013 | + | |
| 1014 | + if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) | |
| 1015 | + return -EINVAL; | |
| 1016 | + | |
| 1017 | + err_data->ue_count = 0; | |
| 1018 | + err_data->ce_count = 0; | |
| 1019 | + | |
| 1020 | + gfx_v9_4_2_query_sram_edc_count(adev, &sec_count, &ded_count); | |
| 1021 | + err_data->ce_count += sec_count; | |
| 1022 | + err_data->ue_count += ded_count; | |
| 1023 | + | |
| 1024 | + gfx_v9_4_2_query_utc_edc_count(adev, &sec_count, &ded_count); | |
| 1025 | + err_data->ce_count += sec_count; | |
| 1026 | + err_data->ue_count += ded_count; | |
| 1027 | + | |
| 1028 | + return 0; | |
| 1029 | +} | |
| 1030 | + | |
| 1031 | +static void gfx_v9_4_2_reset_utc_err_status(struct amdgpu_device *adev) | |
| 1032 | +{ | |
| 1033 | + WREG32_SOC15(GC, 0, regUTCL2_MEM_ECC_STATUS, 0x3); | |
| 1034 | + WREG32_SOC15(GC, 0, regVML2_MEM_ECC_STATUS, 0x3); | |
| 1035 | + WREG32_SOC15(GC, 0, regVML2_WALKER_MEM_ECC_STATUS, 0x3); | |
| 1036 | +} | |
| 1037 | + | |
| 1038 | +static void gfx_v9_4_2_reset_ea_err_status(struct amdgpu_device *adev) | |
| 1039 | +{ | |
| 1040 | + uint32_t i, j; | |
| 1041 | + | |
| 1042 | + mutex_lock(&adev->grbm_idx_mutex); | |
| 1043 | + for (i = 0; i < gfx_v9_4_2_rdrsp_status_regs.se_num; i++) { | |
| 1044 | + for (j = 0; j < gfx_v9_4_2_rdrsp_status_regs.instance; | |
| 1045 | + j++) { | |
| 1046 | + gfx_v9_4_2_select_se_sh(adev, i, 0, j); | |
| 1047 | + WREG32(SOC15_REG_ENTRY_OFFSET(gfx_v9_4_2_rdrsp_status_regs), 0x10); | |
| 1048 | + } | |
| 1049 | + } | |
| 1050 | + gfx_v9_4_2_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | |
| 1051 | + mutex_unlock(&adev->grbm_idx_mutex); | |
| 1052 | +} | |
| 1053 | + | |
| 1054 | +void gfx_v9_4_2_reset_ras_error_count(struct amdgpu_device *adev) | |
| 1055 | +{ | |
| 1056 | + if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) | |
| 1057 | + return; | |
| 1058 | + | |
| 1059 | + gfx_v9_4_2_query_sram_edc_count(adev, NULL, NULL); | |
| 1060 | + gfx_v9_4_2_query_utc_edc_count(adev, NULL, NULL); | |
| 1061 | +} | |
| 1062 | + | |
| 1063 | +int gfx_v9_4_2_ras_error_inject(struct amdgpu_device *adev, void *inject_if) | |
| 1064 | +{ | |
| 1065 | + struct ras_inject_if *info = (struct ras_inject_if *)inject_if; | |
| 1066 | + int ret; | |
| 1067 | + struct ta_ras_trigger_error_input block_info = { 0 }; | |
| 1068 | + | |
| 1069 | + if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) | |
| 1070 | + return -EINVAL; | |
| 1071 | + | |
| 1072 | + block_info.block_id = amdgpu_ras_block_to_ta(info->head.block); | |
| 1073 | + block_info.sub_block_index = info->head.sub_block_index; | |
| 1074 | + block_info.inject_error_type = amdgpu_ras_error_to_ta(info->head.type); | |
| 1075 | + block_info.address = info->address; | |
| 1076 | + block_info.value = info->value; | |
| 1077 | + | |
| 1078 | + mutex_lock(&adev->grbm_idx_mutex); | |
| 1079 | + ret = psp_ras_trigger_error(&adev->psp, &block_info); | |
| 1080 | + mutex_unlock(&adev->grbm_idx_mutex); | |
| 1081 | + | |
| 1082 | + return ret; | |
| 1083 | +} | |
| 1084 | + | |
| 1085 | +static void gfx_v9_4_2_query_ea_err_status(struct amdgpu_device *adev) | |
| 1086 | +{ | |
| 1087 | + uint32_t i, j; | |
| 1088 | + uint32_t reg_value; | |
| 1089 | + | |
| 1090 | + mutex_lock(&adev->grbm_idx_mutex); | |
| 1091 | + | |
| 1092 | + for (i = 0; i < gfx_v9_4_2_rdrsp_status_regs.se_num; i++) { | |
| 1093 | + for (j = 0; j < gfx_v9_4_2_rdrsp_status_regs.instance; | |
| 1094 | + j++) { | |
| 1095 | + gfx_v9_4_2_select_se_sh(adev, i, 0, j); | |
| 1096 | + reg_value = RREG32(SOC15_REG_ENTRY_OFFSET( | |
| 1097 | + gfx_v9_4_2_rdrsp_status_regs)); | |
| 1098 | + if (reg_value) | |
| 1099 | + dev_warn(adev->dev, "GCEA err detected at instance: %d, status: 0x%x!\n", | |
| 1100 | + j, reg_value); | |
| 1101 | + /* clear after read */ | |
| 1102 | + WREG32(SOC15_REG_ENTRY_OFFSET(gfx_v9_4_2_rdrsp_status_regs), 0x10); | |
| 1103 | + } | |
| 1104 | + } | |
| 1105 | + | |
| 1106 | + gfx_v9_4_2_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | |
| 1107 | + mutex_unlock(&adev->grbm_idx_mutex); | |
| 1108 | +} | |
| 1109 | + | |
| 1110 | +static void gfx_v9_4_2_query_utc_err_status(struct amdgpu_device *adev) | |
| 1111 | +{ | |
| 1112 | + uint32_t data; | |
| 1113 | + | |
| 1114 | + data = RREG32_SOC15(GC, 0, regUTCL2_MEM_ECC_STATUS); | |
| 1115 | + if (!data) { | |
| 1116 | + dev_warn(adev->dev, "GFX UTCL2 Mem Ecc Status: 0x%x!\n", data); | |
| 1117 | + WREG32_SOC15(GC, 0, regUTCL2_MEM_ECC_STATUS, 0x3); | |
| 1118 | + } | |
| 1119 | + | |
| 1120 | + data = RREG32_SOC15(GC, 0, regVML2_MEM_ECC_STATUS); | |
| 1121 | + if (!data) { | |
| 1122 | + dev_warn(adev->dev, "GFX VML2 Mem Ecc Status: 0x%x!\n", data); | |
| 1123 | + WREG32_SOC15(GC, 0, regVML2_MEM_ECC_STATUS, 0x3); | |
| 1124 | + } | |
| 1125 | + | |
| 1126 | + data = RREG32_SOC15(GC, 0, regVML2_WALKER_MEM_ECC_STATUS); | |
| 1127 | + if (!data) { | |
| 1128 | + dev_warn(adev->dev, "GFX VML2 Walker Mem Ecc Status: 0x%x!\n", data); | |
| 1129 | + WREG32_SOC15(GC, 0, regVML2_WALKER_MEM_ECC_STATUS, 0x3); | |
| 1130 | + } | |
| 1131 | +} | |
| 1132 | + | |
| 1133 | +void gfx_v9_4_2_query_ras_error_status(struct amdgpu_device *adev) | |
| 1134 | +{ | |
| 1135 | + if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) | |
| 1136 | + return; | |
| 1137 | + | |
| 1138 | + gfx_v9_4_2_query_ea_err_status(adev); | |
| 1139 | + gfx_v9_4_2_query_utc_err_status(adev); | |
| 1140 | + gfx_v9_4_2_query_sq_timeout_status(adev); | |
| 1141 | +} | |
| 1142 | + | |
| 1143 | +void gfx_v9_4_2_reset_ras_error_status(struct amdgpu_device *adev) | |
| 1144 | +{ | |
| 1145 | + if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX)) | |
| 1146 | + return; | |
| 1147 | + | |
| 1148 | + gfx_v9_4_2_reset_utc_err_status(adev); | |
| 1149 | + gfx_v9_4_2_reset_ea_err_status(adev); | |
| 1150 | + gfx_v9_4_2_reset_sq_timeout_status(adev); | |
| 1151 | +} | |
| 1152 | + | |
| 1153 | +void gfx_v9_4_2_enable_watchdog_timer(struct amdgpu_device *adev) | |
| 1154 | +{ | |
| 1155 | + uint32_t i; | |
| 1156 | + uint32_t data; | |
| 1157 | + | |
| 1158 | + data = REG_SET_FIELD(0, SQ_TIMEOUT_CONFIG, TIMEOUT_FATAL_DISABLE, | |
| 1159 | + amdgpu_watchdog_timer.timeout_fatal_disable ? 1 : | |
| 1160 | + 0); | |
| 1161 | + | |
| 1162 | + if (amdgpu_watchdog_timer.timeout_fatal_disable && | |
| 1163 | + (amdgpu_watchdog_timer.period < 1 || | |
| 1164 | + amdgpu_watchdog_timer.period > 0x23)) { | |
| 1165 | + dev_warn(adev->dev, "Watchdog period range is 1 to 0x23\n"); | |
| 1166 | + amdgpu_watchdog_timer.period = 0x23; | |
| 1167 | + } | |
| 1168 | + data = REG_SET_FIELD(data, SQ_TIMEOUT_CONFIG, PERIOD_SEL, | |
| 1169 | + amdgpu_watchdog_timer.period); | |
| 1170 | + | |
| 1171 | + mutex_lock(&adev->grbm_idx_mutex); | |
| 1172 | + for (i = 0; i < adev->gfx.config.max_shader_engines; i++) { | |
| 1173 | + gfx_v9_4_2_select_se_sh(adev, i, 0xffffffff, 0xffffffff); | |
| 1174 | + WREG32_SOC15(GC, 0, regSQ_TIMEOUT_CONFIG, data); | |
| 1175 | + } | |
| 1176 | + gfx_v9_4_2_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | |
| 1177 | + mutex_unlock(&adev->grbm_idx_mutex); | |
| 1178 | +} | |
| 1179 | + | |
| 1180 | +static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t address) | |
| 1181 | +{ | |
| 1182 | + WREG32_SOC15_RLC_EX(reg, GC, 0, regSQ_IND_INDEX, | |
| 1183 | + (wave << SQ_IND_INDEX__WAVE_ID__SHIFT) | | |
| 1184 | + (simd << SQ_IND_INDEX__SIMD_ID__SHIFT) | | |
| 1185 | + (address << SQ_IND_INDEX__INDEX__SHIFT) | | |
| 1186 | + (SQ_IND_INDEX__FORCE_READ_MASK)); | |
| 1187 | + return RREG32_SOC15(GC, 0, regSQ_IND_DATA); | |
| 1188 | +} | |
| 1189 | + | |
| 1190 | +static void gfx_v9_4_2_log_cu_timeout_status(struct amdgpu_device *adev, | |
| 1191 | + uint32_t status) | |
| 1192 | +{ | |
| 1193 | + struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info; | |
| 1194 | + uint32_t i, simd, wave; | |
| 1195 | + uint32_t wave_status; | |
| 1196 | + uint32_t wave_pc_lo, wave_pc_hi; | |
| 1197 | + uint32_t wave_exec_lo, wave_exec_hi; | |
| 1198 | + uint32_t wave_inst_dw0, wave_inst_dw1; | |
| 1199 | + uint32_t wave_ib_sts; | |
| 1200 | + | |
| 1201 | + for (i = 0; i < 32; i++) { | |
| 1202 | + if (!((i << 1) & status)) | |
| 1203 | + continue; | |
| 1204 | + | |
| 1205 | + simd = i / cu_info->max_waves_per_simd; | |
| 1206 | + wave = i % cu_info->max_waves_per_simd; | |
| 1207 | + | |
| 1208 | + wave_status = wave_read_ind(adev, simd, wave, ixSQ_WAVE_STATUS); | |
| 1209 | + wave_pc_lo = wave_read_ind(adev, simd, wave, ixSQ_WAVE_PC_LO); | |
| 1210 | + wave_pc_hi = wave_read_ind(adev, simd, wave, ixSQ_WAVE_PC_HI); | |
| 1211 | + wave_exec_lo = | |
| 1212 | + wave_read_ind(adev, simd, wave, ixSQ_WAVE_EXEC_LO); | |
| 1213 | + wave_exec_hi = | |
| 1214 | + wave_read_ind(adev, simd, wave, ixSQ_WAVE_EXEC_HI); | |
| 1215 | + wave_inst_dw0 = | |
| 1216 | + wave_read_ind(adev, simd, wave, ixSQ_WAVE_INST_DW0); | |
| 1217 | + wave_inst_dw1 = | |
| 1218 | + wave_read_ind(adev, simd, wave, ixSQ_WAVE_INST_DW1); | |
| 1219 | + wave_ib_sts = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_STS); | |
| 1220 | + | |
| 1221 | + dev_info( | |
| 1222 | + adev->dev, | |
| 1223 | + "\t SIMD %d, Wave %d: status 0x%x, pc 0x%llx, exec 0x%llx, inst 0x%llx, ib_sts 0x%x\n", | |
| 1224 | + simd, wave, wave_status, | |
| 1225 | + ((uint64_t)wave_pc_hi << 32 | wave_pc_lo), | |
| 1226 | + ((uint64_t)wave_exec_hi << 32 | wave_exec_lo), | |
| 1227 | + ((uint64_t)wave_inst_dw1 << 32 | wave_inst_dw0), | |
| 1228 | + wave_ib_sts); | |
| 1229 | + } | |
| 1230 | +} | |
| 1231 | + | |
| 1232 | +static void gfx_v9_4_2_query_sq_timeout_status(struct amdgpu_device *adev) | |
| 1233 | +{ | |
| 1234 | + uint32_t se_idx, sh_idx, cu_idx; | |
| 1235 | + uint32_t status; | |
| 1236 | + | |
| 1237 | + mutex_lock(&adev->grbm_idx_mutex); | |
| 1238 | + for (se_idx = 0; se_idx < adev->gfx.config.max_shader_engines; | |
| 1239 | + se_idx++) { | |
| 1240 | + for (sh_idx = 0; sh_idx < adev->gfx.config.max_sh_per_se; | |
| 1241 | + sh_idx++) { | |
| 1242 | + for (cu_idx = 0; | |
| 1243 | + cu_idx < adev->gfx.config.max_cu_per_sh; | |
| 1244 | + cu_idx++) { | |
| 1245 | + gfx_v9_4_2_select_se_sh(adev, se_idx, sh_idx, | |
| 1246 | + cu_idx); | |
| 1247 | + status = RREG32_SOC15(GC, 0, | |
| 1248 | + regSQ_TIMEOUT_STATUS); | |
| 1249 | + if (status != 0) { | |
| 1250 | + dev_info( | |
| 1251 | + adev->dev, | |
| 1252 | + "GFX Watchdog Timeout: SE %d, SH %d, CU %d\n", | |
| 1253 | + se_idx, sh_idx, cu_idx); | |
| 1254 | + gfx_v9_4_2_log_cu_timeout_status( | |
| 1255 | + adev, status); | |
| 1256 | + } | |
| 1257 | + /* clear old status */ | |
| 1258 | + WREG32_SOC15(GC, 0, regSQ_TIMEOUT_STATUS, 0); | |
| 1259 | + } | |
| 1260 | + } | |
| 1261 | + } | |
| 1262 | + gfx_v9_4_2_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | |
| 1263 | + mutex_unlock(&adev->grbm_idx_mutex); | |
| 1264 | +} | |
| 1265 | + | |
| 1266 | +static void gfx_v9_4_2_reset_sq_timeout_status(struct amdgpu_device *adev) | |
| 1267 | +{ | |
| 1268 | + uint32_t se_idx, sh_idx, cu_idx; | |
| 1269 | + | |
| 1270 | + mutex_lock(&adev->grbm_idx_mutex); | |
| 1271 | + for (se_idx = 0; se_idx < adev->gfx.config.max_shader_engines; | |
| 1272 | + se_idx++) { | |
| 1273 | + for (sh_idx = 0; sh_idx < adev->gfx.config.max_sh_per_se; | |
| 1274 | + sh_idx++) { | |
| 1275 | + for (cu_idx = 0; | |
| 1276 | + cu_idx < adev->gfx.config.max_cu_per_sh; | |
| 1277 | + cu_idx++) { | |
| 1278 | + gfx_v9_4_2_select_se_sh(adev, se_idx, sh_idx, | |
| 1279 | + cu_idx); | |
| 1280 | + WREG32_SOC15(GC, 0, regSQ_TIMEOUT_STATUS, 0); | |
| 1281 | + } | |
| 1282 | + } | |
| 1283 | + } | |
| 1284 | + gfx_v9_4_2_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | |
| 1285 | + mutex_unlock(&adev->grbm_idx_mutex); | |
| 1286 | +} | |
| @@ -0,0 +1,40 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | + | |
| 24 | +#ifndef __GFX_V9_4_2_H__ | |
| 25 | +#define __GFX_V9_4_2_H__ | |
| 26 | + | |
| 27 | +void gfx_v9_4_2_debug_trap_config_init(struct amdgpu_device *adev, | |
| 28 | + uint32_t first_vmid, uint32_t last_vmid); | |
| 29 | +void gfx_v9_4_2_init_golden_registers(struct amdgpu_device *adev, | |
| 30 | + uint32_t die_id); | |
| 31 | +void gfx_v9_4_2_set_power_brake_sequence(struct amdgpu_device *adev); | |
| 32 | + | |
| 33 | +void gfx_v9_4_2_reset_ras_error_count(struct amdgpu_device *adev); | |
| 34 | +int gfx_v9_4_2_ras_error_inject(struct amdgpu_device *adev, void *inject_if); | |
| 35 | +void gfx_v9_4_2_query_ras_error_status(struct amdgpu_device *adev); | |
| 36 | +int gfx_v9_4_2_query_ras_error_count(struct amdgpu_device *adev, | |
| 37 | + void *ras_error_status); | |
| 38 | +void gfx_v9_4_2_reset_ras_error_status(struct amdgpu_device *adev); | |
| 39 | +void gfx_v9_4_2_enable_watchdog_timer(struct amdgpu_device *adev); | |
| 40 | +#endif /* __GFX_V9_4_2_H__ */ | |
| @@ -53,19 +53,39 @@ static void gfxhub_v1_0_setup_vm_pt_regs(struct amdgpu_device *adev, · 52 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | static void gfxhub_v1_0_init_gart_aperture_regs(struct amdgpu_device *adev) |
| 55 | 55 | { |
| 56 | − uint64_t pt_base = amdgpu_gmc_pd_addr(adev->gart.bo); | |
| 56 | + uint64_t pt_base; | |
| 57 | 57 | |
| 58 | − gfxhub_v1_0_setup_vm_pt_regs(adev, 0, pt_base); | |
| 58 | + if (adev->gmc.pdb0_bo) | |
| 59 | + pt_base = amdgpu_gmc_pd_addr(adev->gmc.pdb0_bo); | |
| 60 | + else | |
| 61 | + pt_base = amdgpu_gmc_pd_addr(adev->gart.bo); | |
| 59 | 62 | |
| 60 | − WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, | |
| 61 | − (u32)(adev->gmc.gart_start >> 12)); | |
| 62 | − WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, | |
| 63 | − (u32)(adev->gmc.gart_start >> 44)); | |
| 63 | + gfxhub_v1_0_setup_vm_pt_regs(adev, 0, pt_base); | |
| 64 | 64 | |
| 65 | − WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, | |
| 66 | − (u32)(adev->gmc.gart_end >> 12)); | |
| 67 | − WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, | |
| 68 | − (u32)(adev->gmc.gart_end >> 44)); | |
| 65 | + /* If use GART for FB translation, vmid0 page table covers both | |
| 66 | + * vram and system memory (gart) | |
| 67 | + */ | |
| 68 | + if (adev->gmc.pdb0_bo) { | |
| 69 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, | |
| 70 | + (u32)(adev->gmc.fb_start >> 12)); | |
| 71 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, | |
| 72 | + (u32)(adev->gmc.fb_start >> 44)); | |
| 73 | + | |
| 74 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, | |
| 75 | + (u32)(adev->gmc.gart_end >> 12)); | |
| 76 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, | |
| 77 | + (u32)(adev->gmc.gart_end >> 44)); | |
| 78 | + } else { | |
| 79 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, | |
| 80 | + (u32)(adev->gmc.gart_start >> 12)); | |
| 81 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, | |
| 82 | + (u32)(adev->gmc.gart_start >> 44)); | |
| 83 | + | |
| 84 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, | |
| 85 | + (u32)(adev->gmc.gart_end >> 12)); | |
| 86 | + WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, | |
| 87 | + (u32)(adev->gmc.gart_end >> 44)); | |
| 88 | + } | |
| 69 | 89 | } |
| 70 | 90 | |
| 71 | 91 | static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev) |
| @@ -116,6 +136,27 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev) · 44 unmodified lines | ||
| 116 | 136 | WREG32_FIELD15(GC, 0, VM_L2_PROTECTION_FAULT_CNTL2, |
| 117 | 137 | ACTIVE_PAGE_MIGRATION_PTE_READ_RETRY, 1); |
| 118 | 138 | } |
| 139 | + | |
| 140 | + /* In the case squeezing vram into GART aperture, we don't use | |
| 141 | + * FB aperture and AGP aperture. Disable them. | |
| 142 | + */ | |
| 143 | + if (adev->gmc.pdb0_bo) { | |
| 144 | + if (adev->asic_type == CHIP_ALDEBARAN) { | |
| 145 | + WREG32_SOC15(GC, 0, mmMC_VM_FB_LOCATION_TOP, adev->gmc.fb_end_original >> 24); | |
| 146 | + WREG32_SOC15(GC, 0, mmMC_VM_FB_LOCATION_BASE, adev->gmc.fb_start_original >> 24); | |
| 147 | + WREG32_SOC15(GC, 0, mmMC_VM_AGP_TOP, 0); | |
| 148 | + WREG32_SOC15(GC, 0, mmMC_VM_AGP_BOT, 0xFFFFFF); | |
| 149 | + WREG32_SOC15(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.fb_start_original >> 18); | |
| 150 | + WREG32_SOC15(GC, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR, adev->gmc.fb_end_original >> 18); | |
| 151 | + } else { | |
| 152 | + WREG32_SOC15(GC, 0, mmMC_VM_FB_LOCATION_TOP, 0); | |
| 153 | + WREG32_SOC15(GC, 0, mmMC_VM_FB_LOCATION_BASE, 0x00FFFFFF); | |
| 154 | + WREG32_SOC15(GC, 0, mmMC_VM_AGP_TOP, 0); | |
| 155 | + WREG32_SOC15(GC, 0, mmMC_VM_AGP_BOT, 0xFFFFFF); | |
| 156 | + WREG32_SOC15(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR, 0x3FFFFFFF); | |
| 157 | + WREG32_SOC15(GC, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR, 0); | |
| 158 | + } | |
| 159 | + } | |
| 119 | 160 | } |
| 120 | 161 | |
| 121 | 162 | static void gfxhub_v1_0_init_tlb_regs(struct amdgpu_device *adev) |
| @@ -173,8 +214,13 @@ static void gfxhub_v1_0_init_cache_regs(struct amdgpu_device *adev) · 51 unmodified lines | ||
| 173 | 214 | WREG32_SOC15_RLC(GC, 0, mmVM_L2_CNTL3, tmp); |
| 174 | 215 | |
| 175 | 216 | tmp = mmVM_L2_CNTL4_DEFAULT; |
| 176 | − tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0); | |
| 177 | − tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0); | |
| 217 | + if (adev->gmc.xgmi.connected_to_cpu) { | |
| 218 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 1); | |
| 219 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 1); | |
| 220 | + } else { | |
| 221 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0); | |
| 222 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0); | |
| 223 | + } | |
| 178 | 224 | WREG32_SOC15_RLC(GC, 0, mmVM_L2_CNTL4, tmp); |
| 179 | 225 | } |
| 180 | 226 | |
| @@ -184,7 +230,10 @@ static void gfxhub_v1_0_enable_system_domain(struct amdgpu_device *adev) · 3 unmodified lines | ||
| 184 | 230 | |
| 185 | 231 | tmp = RREG32_SOC15(GC, 0, mmVM_CONTEXT0_CNTL); |
| 186 | 232 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, ENABLE_CONTEXT, 1); |
| 187 | − tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_DEPTH, 0); | |
| 233 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_DEPTH, | |
| 234 | + adev->gmc.vmid0_page_table_depth); | |
| 235 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_BLOCK_SIZE, | |
| 236 | + adev->gmc.vmid0_page_table_block_size); | |
| 188 | 237 | tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, |
| 189 | 238 | RETRY_PERMISSION_OR_INVALID_PAGE_FAULT, 0); |
| 190 | 239 | WREG32_SOC15(GC, 0, mmVM_CONTEXT0_CNTL, tmp); |
| @@ -28,13 +28,42 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #include "soc15_common.h" |
| 30 | 30 | |
| 31 | +#define mmMC_VM_XGMI_LFB_CNTL_ALDE 0x0978 | |
| 32 | +#define mmMC_VM_XGMI_LFB_CNTL_ALDE_BASE_IDX 0 | |
| 33 | +#define mmMC_VM_XGMI_LFB_SIZE_ALDE 0x0979 | |
| 34 | +#define mmMC_VM_XGMI_LFB_SIZE_ALDE_BASE_IDX 0 | |
| 35 | +//MC_VM_XGMI_LFB_CNTL | |
| 36 | +#define MC_VM_XGMI_LFB_CNTL_ALDE__PF_LFB_REGION__SHIFT 0x0 | |
| 37 | +#define MC_VM_XGMI_LFB_CNTL_ALDE__PF_MAX_REGION__SHIFT 0x4 | |
| 38 | +#define MC_VM_XGMI_LFB_CNTL_ALDE__PF_LFB_REGION_MASK 0x0000000FL | |
| 39 | +#define MC_VM_XGMI_LFB_CNTL_ALDE__PF_MAX_REGION_MASK 0x000000F0L | |
| 40 | +//MC_VM_XGMI_LFB_SIZE | |
| 41 | +#define MC_VM_XGMI_LFB_SIZE_ALDE__PF_LFB_SIZE__SHIFT 0x0 | |
| 42 | +#define MC_VM_XGMI_LFB_SIZE_ALDE__PF_LFB_SIZE_MASK 0x0001FFFFL | |
| 43 | + | |
| 31 | 44 | int gfxhub_v1_1_get_xgmi_info(struct amdgpu_device *adev) |
| 32 | 45 | { |
| 33 | − u32 xgmi_lfb_cntl = RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_CNTL); | |
| 34 | − u32 max_region = | |
| 46 | + u32 max_num_physical_nodes; | |
| 47 | + u32 max_physical_node_id; | |
| 48 | + u32 xgmi_lfb_cntl; | |
| 49 | + u32 max_region; | |
| 50 | + u64 seg_size; | |
| 51 | + | |
| 52 | + if (adev->asic_type == CHIP_ALDEBARAN) { | |
| 53 | + xgmi_lfb_cntl = RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_CNTL_ALDE); | |
| 54 | + seg_size = REG_GET_FIELD( | |
| 55 | + RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_SIZE_ALDE), | |
| 56 | + MC_VM_XGMI_LFB_SIZE, PF_LFB_SIZE) << 24; | |
| 57 | + } else { | |
| 58 | + xgmi_lfb_cntl = RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_CNTL); | |
| 59 | + seg_size = REG_GET_FIELD( | |
| 60 | + RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_SIZE), | |
| 61 | + MC_VM_XGMI_LFB_SIZE, PF_LFB_SIZE) << 24; | |
| 62 | + } | |
| 63 | + | |
| 64 | + max_region = | |
| 35 | 65 | REG_GET_FIELD(xgmi_lfb_cntl, MC_VM_XGMI_LFB_CNTL, PF_MAX_REGION); |
| 36 | − u32 max_num_physical_nodes = 0; | |
| 37 | − u32 max_physical_node_id = 0; | |
| 66 | + | |
| 38 | 67 | |
| 39 | 68 | switch (adev->asic_type) { |
| 40 | 69 | case CHIP_VEGA20: |
| @@ -45,23 +74,30 @@ int gfxhub_v1_1_get_xgmi_info(struct amdgpu_device *adev) · 4 unmodified lines | ||
| 45 | 74 | max_num_physical_nodes = 8; |
| 46 | 75 | max_physical_node_id = 7; |
| 47 | 76 | break; |
| 77 | + case CHIP_ALDEBARAN: | |
| 78 | + /* just using duplicates for Aldebaran support, revisit later */ | |
| 79 | + max_num_physical_nodes = 8; | |
| 80 | + max_physical_node_id = 7; | |
| 81 | + break; | |
| 48 | 82 | default: |
| 49 | 83 | return -EINVAL; |
| 50 | 84 | } |
| 51 | 85 | |
| 52 | 86 | /* PF_MAX_REGION=0 means xgmi is disabled */ |
| 53 | − if (max_region) { | |
| 87 | + if (max_region || adev->gmc.xgmi.connected_to_cpu) { | |
| 54 | 88 | adev->gmc.xgmi.num_physical_nodes = max_region + 1; |
| 89 | + | |
| 55 | 90 | if (adev->gmc.xgmi.num_physical_nodes > max_num_physical_nodes) |
| 56 | 91 | return -EINVAL; |
| 57 | 92 | |
| 58 | 93 | adev->gmc.xgmi.physical_node_id = |
| 59 | − REG_GET_FIELD(xgmi_lfb_cntl, MC_VM_XGMI_LFB_CNTL, PF_LFB_REGION); | |
| 94 | + REG_GET_FIELD(xgmi_lfb_cntl, MC_VM_XGMI_LFB_CNTL, | |
| 95 | + PF_LFB_REGION); | |
| 96 | + | |
| 60 | 97 | if (adev->gmc.xgmi.physical_node_id > max_physical_node_id) |
| 61 | 98 | return -EINVAL; |
| 62 | − adev->gmc.xgmi.node_segment_size = REG_GET_FIELD( | |
| 63 | − RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_SIZE), | |
| 64 | − MC_VM_XGMI_LFB_SIZE, PF_LFB_SIZE) << 24; | |
| 99 | + | |
| 100 | + adev->gmc.xgmi.node_segment_size = seg_size; | |
| 65 | 101 | } |
| 66 | 102 | |
| 67 | 103 | return 0; |
| @@ -113,7 +113,7 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, · 112 unmodified lines | ||
| 113 | 113 | /* Delegate it to a different ring if the hardware hasn't |
| 114 | 114 | * already done it. |
| 115 | 115 | */ |
| 116 | − if (in_interrupt()) { | |
| 116 | + if (entry->ih == &adev->irq.ih) { | |
| 117 | 117 | amdgpu_irq_delegate(adev, entry, 8); |
| 118 | 118 | return 1; |
| 119 | 119 | } |
| @@ -152,8 +152,9 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev, · 32 unmodified lines | ||
| 152 | 152 | entry->src_id, entry->ring_id, entry->vmid, |
| 153 | 153 | entry->pasid, task_info.process_name, task_info.tgid, |
| 154 | 154 | task_info.task_name, task_info.pid); |
| 155 | − dev_err(adev->dev, " in page starting at address 0x%012llx from client %d\n", | |
| 156 | − addr, entry->client_id); | |
| 155 | + dev_err(adev->dev, " in page starting at address 0x%016llx from client 0x%x (%s)\n", | |
| 156 | + addr, entry->client_id, | |
| 157 | + soc15_ih_clientid_name[entry->client_id]); | |
| 157 | 158 | |
| 158 | 159 | if (!amdgpu_sriov_vf(adev)) |
| 159 | 160 | hub->vmhub_funcs->print_l2_protection_fault_status(adev, |
| @@ -346,6 +346,7 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev) · 345 unmodified lines | ||
| 346 | 346 | adev->gmc.gart_size = (u64)amdgpu_gart_size << 20; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | + adev->gmc.gart_size += adev->pm.smu_prv_buffer_size; | |
| 349 | 350 | gmc_v6_0_vram_gtt_location(adev, &adev->gmc); |
| 350 | 351 | |
| 351 | 352 | return 0; |
| @@ -414,6 +414,7 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev) · 413 unmodified lines | ||
| 414 | 414 | adev->gmc.gart_size = (u64)amdgpu_gart_size << 20; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | + adev->gmc.gart_size += adev->pm.smu_prv_buffer_size; | |
| 417 | 418 | gmc_v7_0_vram_gtt_location(adev, &adev->gmc); |
| 418 | 419 | |
| 419 | 420 | return 0; |
| @@ -599,6 +599,7 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) · 598 unmodified lines | ||
| 599 | 599 | adev->gmc.gart_size = (u64)amdgpu_gart_size << 20; |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | + adev->gmc.gart_size += adev->pm.smu_prv_buffer_size; | |
| 602 | 603 | gmc_v8_0_vram_gtt_location(adev, &adev->gmc); |
| 603 | 604 | |
| 604 | 605 | return 0; |
| @@ -50,6 +50,7 @@ · 49 unmodified lines | ||
| 50 | 50 | #include "athub_v1_0.h" |
| 51 | 51 | #include "gfxhub_v1_1.h" |
| 52 | 52 | #include "mmhub_v9_4.h" |
| 53 | +#include "mmhub_v1_7.h" | |
| 53 | 54 | #include "umc_v6_1.h" |
| 54 | 55 | #include "umc_v6_0.h" |
| 55 | 56 | |
| @@ -279,6 +280,47 @@ static const char *mmhub_client_ids_arcturus[][2] = { · 223 unmodified lines | ||
| 279 | 280 | [384][1] = "OSS", |
| 280 | 281 | }; |
| 281 | 282 | |
| 283 | +static const char *mmhub_client_ids_aldebaran[][2] = { | |
| 284 | + [2][0] = "MP1", | |
| 285 | + [3][0] = "MP0", | |
| 286 | + [32+1][0] = "DBGU_IO0", | |
| 287 | + [32+2][0] = "DBGU_IO2", | |
| 288 | + [32+4][0] = "MPIO", | |
| 289 | + [96+11][0] = "JPEG0", | |
| 290 | + [96+12][0] = "VCN0", | |
| 291 | + [96+13][0] = "VCNU0", | |
| 292 | + [128+11][0] = "JPEG1", | |
| 293 | + [128+12][0] = "VCN1", | |
| 294 | + [128+13][0] = "VCNU1", | |
| 295 | + [160+1][0] = "XDP", | |
| 296 | + [160+14][0] = "HDP", | |
| 297 | + [256+0][0] = "SDMA0", | |
| 298 | + [256+1][0] = "SDMA1", | |
| 299 | + [256+2][0] = "SDMA2", | |
| 300 | + [256+3][0] = "SDMA3", | |
| 301 | + [256+4][0] = "SDMA4", | |
| 302 | + [384+0][0] = "OSS", | |
| 303 | + [2][1] = "MP1", | |
| 304 | + [3][1] = "MP0", | |
| 305 | + [32+1][1] = "DBGU_IO0", | |
| 306 | + [32+2][1] = "DBGU_IO2", | |
| 307 | + [32+4][1] = "MPIO", | |
| 308 | + [96+11][1] = "JPEG0", | |
| 309 | + [96+12][1] = "VCN0", | |
| 310 | + [96+13][1] = "VCNU0", | |
| 311 | + [128+11][1] = "JPEG1", | |
| 312 | + [128+12][1] = "VCN1", | |
| 313 | + [128+13][1] = "VCNU1", | |
| 314 | + [160+1][1] = "XDP", | |
| 315 | + [160+14][1] = "HDP", | |
| 316 | + [256+0][1] = "SDMA0", | |
| 317 | + [256+1][1] = "SDMA1", | |
| 318 | + [256+2][1] = "SDMA2", | |
| 319 | + [256+3][1] = "SDMA3", | |
| 320 | + [256+4][1] = "SDMA4", | |
| 321 | + [384+0][1] = "OSS", | |
| 322 | +}; | |
| 323 | + | |
| 282 | 324 | static const struct soc15_reg_golden golden_settings_mmhub_1_0_0[] = |
| 283 | 325 | { |
| 284 | 326 | SOC15_REG_GOLDEN_VALUE(MMHUB, 0, mmDAGB1_WRCLI2, 0x00000007, 0xfe5fe0fa), |
| @@ -484,7 +526,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev, · 199 unmodified lines | ||
| 484 | 526 | /* Delegate it to a different ring if the hardware hasn't |
| 485 | 527 | * already done it. |
| 486 | 528 | */ |
| 487 | − if (in_interrupt()) { | |
| 529 | + if (entry->ih == &adev->irq.ih) { | |
| 488 | 530 | amdgpu_irq_delegate(adev, entry, 8); |
| 489 | 531 | return 1; |
| 490 | 532 | } |
| @@ -520,8 +562,9 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev, · 29 unmodified lines | ||
| 520 | 562 | entry->src_id, entry->ring_id, entry->vmid, |
| 521 | 563 | entry->pasid, task_info.process_name, task_info.tgid, |
| 522 | 564 | task_info.task_name, task_info.pid); |
| 523 | − dev_err(adev->dev, " in page starting at address 0x%012llx from client %d\n", | |
| 524 | − addr, entry->client_id); | |
| 565 | + dev_err(adev->dev, " in page starting at address 0x%016llx from IH client 0x%x (%s)\n", | |
| 566 | + addr, entry->client_id, | |
| 567 | + soc15_ih_clientid_name[entry->client_id]); | |
| 525 | 568 | |
| 526 | 569 | if (amdgpu_sriov_vf(adev)) |
| 527 | 570 | return 0; |
| @@ -568,6 +611,9 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev, · 40 unmodified lines | ||
| 568 | 611 | case CHIP_RENOIR: |
| 569 | 612 | mmhub_cid = mmhub_client_ids_renoir[cid][rw]; |
| 570 | 613 | break; |
| 614 | + case CHIP_ALDEBARAN: | |
| 615 | + mmhub_cid = mmhub_client_ids_aldebaran[cid][rw]; | |
| 616 | + break; | |
| 571 | 617 | default: |
| 572 | 618 | mmhub_cid = NULL; |
| 573 | 619 | break; |
| @@ -642,6 +688,9 @@ static uint32_t gmc_v9_0_get_invalidate_req(unsigned int vmid, · 68 unmodified lines | ||
| 642 | 688 | static bool gmc_v9_0_use_invalidate_semaphore(struct amdgpu_device *adev, |
| 643 | 689 | uint32_t vmhub) |
| 644 | 690 | { |
| 691 | + if (adev->asic_type == CHIP_ALDEBARAN) | |
| 692 | + return false; | |
| 693 | + | |
| 645 | 694 | return ((vmhub == AMDGPU_MMHUB_0 || |
| 646 | 695 | vmhub == AMDGPU_MMHUB_1) && |
| 647 | 696 | (!amdgpu_sriov_vf(adev)) && |
| @@ -1033,10 +1082,14 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev, · 385 unmodified lines | ||
| 1033 | 1082 | *flags &= ~AMDGPU_PTE_VALID; |
| 1034 | 1083 | } |
| 1035 | 1084 | |
| 1036 | − if (adev->asic_type == CHIP_ARCTURUS && | |
| 1085 | + if ((adev->asic_type == CHIP_ARCTURUS || | |
| 1086 | + adev->asic_type == CHIP_ALDEBARAN) && | |
| 1037 | 1087 | !(*flags & AMDGPU_PTE_SYSTEM) && |
| 1038 | 1088 | mapping->bo_va->is_xgmi) |
| 1039 | 1089 | *flags |= AMDGPU_PTE_SNOOPED; |
| 1090 | + | |
| 1091 | + if (adev->asic_type == CHIP_ALDEBARAN) | |
| 1092 | + *flags |= mapping->flags & AMDGPU_PTE_SNOOPED; | |
| 1040 | 1093 | } |
| 1041 | 1094 | |
| 1042 | 1095 | static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev) |
| @@ -1123,6 +1176,9 @@ static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev) · 80 unmodified lines | ||
| 1123 | 1176 | case CHIP_ARCTURUS: |
| 1124 | 1177 | adev->mmhub.funcs = &mmhub_v9_4_funcs; |
| 1125 | 1178 | break; |
| 1179 | + case CHIP_ALDEBARAN: | |
| 1180 | + adev->mmhub.funcs = &mmhub_v1_7_funcs; | |
| 1181 | + break; | |
| 1126 | 1182 | default: |
| 1127 | 1183 | adev->mmhub.funcs = &mmhub_v1_0_funcs; |
| 1128 | 1184 | break; |
| @@ -1144,6 +1200,16 @@ static int gmc_v9_0_early_init(void *handle) · 15 unmodified lines | ||
| 1144 | 1200 | gmc_v9_0_set_mmhub_funcs(adev); |
| 1145 | 1201 | gmc_v9_0_set_gfxhub_funcs(adev); |
| 1146 | 1202 | |
| 1203 | + if (adev->asic_type == CHIP_VEGA20 || | |
| 1204 | + adev->asic_type == CHIP_ARCTURUS) | |
| 1205 | + adev->gmc.xgmi.supported = true; | |
| 1206 | + | |
| 1207 | + if (adev->asic_type == CHIP_ALDEBARAN) { | |
| 1208 | + adev->gmc.xgmi.supported = true; | |
| 1209 | + adev->gmc.xgmi.connected_to_cpu = | |
| 1210 | + adev->smuio.funcs->is_host_gpu_xgmi_supported(adev); | |
| 1211 | + } | |
| 1212 | + | |
| 1147 | 1213 | adev->gmc.shared_aperture_start = 0x2000000000000000ULL; |
| 1148 | 1214 | adev->gmc.shared_aperture_end = |
| 1149 | 1215 | adev->gmc.shared_aperture_start + (4ULL << 30) - 1; |
| @@ -1194,9 +1260,13 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev, · 44 unmodified lines | ||
| 1194 | 1260 | |
| 1195 | 1261 | /* add the xgmi offset of the physical node */ |
| 1196 | 1262 | base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; |
| 1197 | − amdgpu_gmc_vram_location(adev, mc, base); | |
| 1198 | − amdgpu_gmc_gart_location(adev, mc); | |
| 1199 | − amdgpu_gmc_agp_location(adev, mc); | |
| 1263 | + if (adev->gmc.xgmi.connected_to_cpu) { | |
| 1264 | + amdgpu_gmc_sysvm_location(adev, mc); | |
| 1265 | + } else { | |
| 1266 | + amdgpu_gmc_vram_location(adev, mc, base); | |
| 1267 | + amdgpu_gmc_gart_location(adev, mc); | |
| 1268 | + amdgpu_gmc_agp_location(adev, mc); | |
| 1269 | + } | |
| 1200 | 1270 | /* base offset of vram pages */ |
| 1201 | 1271 | adev->vm_manager.vram_base_offset = adev->gfxhub.funcs->get_mc_fb_offset(adev); |
| 1202 | 1272 | |
| @@ -1223,7 +1293,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · 20 unmodified lines | ||
| 1223 | 1293 | adev->nbio.funcs->get_memsize(adev) * 1024ULL * 1024ULL; |
| 1224 | 1294 | adev->gmc.real_vram_size = adev->gmc.mc_vram_size; |
| 1225 | 1295 | |
| 1226 | − if (!(adev->flags & AMD_IS_APU)) { | |
| 1296 | + if (!(adev->flags & AMD_IS_APU) && | |
| 1297 | + !adev->gmc.xgmi.connected_to_cpu) { | |
| 1227 | 1298 | r = amdgpu_device_resize_fb_bar(adev); |
| 1228 | 1299 | if (r) |
| 1229 | 1300 | return r; |
| @@ -1232,10 +1303,28 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · 2 unmodified lines | ||
| 1232 | 1303 | adev->gmc.aper_size = pci_resource_len(adev->pdev, 0); |
| 1233 | 1304 | |
| 1234 | 1305 | #ifdef CONFIG_X86_64 |
| 1235 | − if (adev->flags & AMD_IS_APU) { | |
| 1236 | − adev->gmc.aper_base = adev->gfxhub.funcs->get_mc_fb_offset(adev); | |
| 1306 | + /* | |
| 1307 | + * AMD Accelerated Processing Platform (APP) supporting GPU-HOST xgmi | |
| 1308 | + * interface can use VRAM through here as it appears system reserved | |
| 1309 | + * memory in host address space. | |
| 1310 | + * | |
| 1311 | + * For APUs, VRAM is just the stolen system memory and can be accessed | |
| 1312 | + * directly. | |
| 1313 | + * | |
| 1314 | + * Otherwise, use the legacy Host Data Path (HDP) through PCIe BAR. | |
| 1315 | + */ | |
| 1316 | + | |
| 1317 | + /* check whether both host-gpu and gpu-gpu xgmi links exist */ | |
| 1318 | + if ((adev->flags & AMD_IS_APU) || | |
| 1319 | + (adev->gmc.xgmi.supported && | |
| 1320 | + adev->gmc.xgmi.connected_to_cpu)) { | |
| 1321 | + adev->gmc.aper_base = | |
| 1322 | + adev->gfxhub.funcs->get_mc_fb_offset(adev) + | |
| 1323 | + adev->gmc.xgmi.physical_node_id * | |
| 1324 | + adev->gmc.xgmi.node_segment_size; | |
| 1237 | 1325 | adev->gmc.aper_size = adev->gmc.real_vram_size; |
| 1238 | 1326 | } |
| 1327 | + | |
| 1239 | 1328 | #endif |
| 1240 | 1329 | /* In case the PCI BAR is larger than the actual amount of vram */ |
| 1241 | 1330 | adev->gmc.visible_vram_size = adev->gmc.aper_size; |
| @@ -1249,6 +1338,7 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · 7 unmodified lines | ||
| 1249 | 1338 | case CHIP_VEGA12: /* all engines support GPUVM */ |
| 1250 | 1339 | case CHIP_VEGA20: |
| 1251 | 1340 | case CHIP_ARCTURUS: |
| 1341 | + case CHIP_ALDEBARAN: | |
| 1252 | 1342 | default: |
| 1253 | 1343 | adev->gmc.gart_size = 512ULL << 20; |
| 1254 | 1344 | break; |
| @@ -1261,6 +1351,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · 6 unmodified lines | ||
| 1261 | 1351 | adev->gmc.gart_size = (u64)amdgpu_gart_size << 20; |
| 1262 | 1352 | } |
| 1263 | 1353 | |
| 1354 | + adev->gmc.gart_size += adev->pm.smu_prv_buffer_size; | |
| 1355 | + | |
| 1264 | 1356 | gmc_v9_0_vram_gtt_location(adev, &adev->gmc); |
| 1265 | 1357 | |
| 1266 | 1358 | return 0; |
| @@ -1274,6 +1366,15 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev) · 7 unmodified lines | ||
| 1274 | 1366 | WARN(1, "VEGA10 PCIE GART already initialized\n"); |
| 1275 | 1367 | return 0; |
| 1276 | 1368 | } |
| 1369 | + | |
| 1370 | + if (adev->gmc.xgmi.connected_to_cpu) { | |
| 1371 | + adev->gmc.vmid0_page_table_depth = 1; | |
| 1372 | + adev->gmc.vmid0_page_table_block_size = 12; | |
| 1373 | + } else { | |
| 1374 | + adev->gmc.vmid0_page_table_depth = 0; | |
| 1375 | + adev->gmc.vmid0_page_table_block_size = 0; | |
| 1376 | + } | |
| 1377 | + | |
| 1277 | 1378 | /* Initialize common gart structure */ |
| 1278 | 1379 | r = amdgpu_gart_init(adev); |
| 1279 | 1380 | if (r) |
| @@ -1281,7 +1382,16 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev) · 1 unmodified line | ||
| 1281 | 1382 | adev->gart.table_size = adev->gart.num_gpu_pages * 8; |
| 1282 | 1383 | adev->gart.gart_pte_flags = AMDGPU_PTE_MTYPE_VG10(MTYPE_UC) | |
| 1283 | 1384 | AMDGPU_PTE_EXECUTABLE; |
| 1284 | − return amdgpu_gart_table_vram_alloc(adev); | |
| 1385 | + | |
| 1386 | + r = amdgpu_gart_table_vram_alloc(adev); | |
| 1387 | + if (r) | |
| 1388 | + return r; | |
| 1389 | + | |
| 1390 | + if (adev->gmc.xgmi.connected_to_cpu) { | |
| 1391 | + r = amdgpu_gmc_pdb0_alloc(adev); | |
| 1392 | + } | |
| 1393 | + | |
| 1394 | + return r; | |
| 1285 | 1395 | } |
| 1286 | 1396 | |
| 1287 | 1397 | /** |
| @@ -1352,6 +1462,7 @@ static int gmc_v9_0_sw_init(void *handle) · 64 unmodified lines | ||
| 1352 | 1462 | case CHIP_VEGA12: |
| 1353 | 1463 | case CHIP_VEGA20: |
| 1354 | 1464 | case CHIP_RENOIR: |
| 1465 | + case CHIP_ALDEBARAN: | |
| 1355 | 1466 | adev->num_vmhubs = 2; |
| 1356 | 1467 | |
| 1357 | 1468 | |
| @@ -1448,7 +1559,8 @@ static int gmc_v9_0_sw_init(void *handle) · 90 unmodified lines | ||
| 1448 | 1559 | * for video processing. |
| 1449 | 1560 | */ |
| 1450 | 1561 | adev->vm_manager.first_kfd_vmid = |
| 1451 | − adev->asic_type == CHIP_ARCTURUS ? 3 : 8; | |
| 1562 | + (adev->asic_type == CHIP_ARCTURUS || | |
| 1563 | + adev->asic_type == CHIP_ALDEBARAN) ? 3 : 8; | |
| 1452 | 1564 | |
| 1453 | 1565 | amdgpu_vm_manager_init(adev); |
| 1454 | 1566 | |
| @@ -1465,6 +1577,7 @@ static int gmc_v9_0_sw_fini(void *handle) · 10 unmodified lines | ||
| 1465 | 1577 | amdgpu_gem_force_release(adev); |
| 1466 | 1578 | amdgpu_vm_manager_fini(adev); |
| 1467 | 1579 | amdgpu_gart_table_vram_free(adev); |
| 1580 | + amdgpu_bo_unref(&adev->gmc.pdb0_bo); | |
| 1468 | 1581 | amdgpu_bo_fini(adev); |
| 1469 | 1582 | amdgpu_gart_fini(adev); |
| 1470 | 1583 | |
| @@ -1525,10 +1638,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) · 54 unmodified lines | ||
| 1525 | 1638 | { |
| 1526 | 1639 | int r; |
| 1527 | 1640 | |
| 1641 | + if (adev->gmc.xgmi.connected_to_cpu) | |
| 1642 | + amdgpu_gmc_init_pdb0(adev); | |
| 1643 | + | |
| 1528 | 1644 | if (adev->gart.bo == NULL) { |
| 1529 | 1645 | dev_err(adev->dev, "No VRAM object for PCIE GART.\n"); |
| 1530 | 1646 | return -EINVAL; |
| 1531 | 1647 | } |
| 1648 | + | |
| 1532 | 1649 | r = amdgpu_gart_table_vram_pin(adev); |
| 1533 | 1650 | if (r) |
| 1534 | 1651 | return r; |
| @@ -1541,9 +1658,14 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) · 6 unmodified lines | ||
| 1541 | 1658 | if (r) |
| 1542 | 1659 | return r; |
| 1543 | 1660 | |
| 1544 | − DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | |
| 1545 | − (unsigned)(adev->gmc.gart_size >> 20), | |
| 1546 | − (unsigned long long)amdgpu_bo_gpu_offset(adev->gart.bo)); | |
| 1661 | + DRM_INFO("PCIE GART of %uM enabled.\n", | |
| 1662 | + (unsigned)(adev->gmc.gart_size >> 20)); | |
| 1663 | + if (adev->gmc.pdb0_bo) | |
| 1664 | + DRM_INFO("PDB0 located at 0x%016llX\n", | |
| 1665 | + (unsigned long long)amdgpu_bo_gpu_offset(adev->gmc.pdb0_bo)); | |
| 1666 | + DRM_INFO("PTB located at 0x%016llX\n", | |
| 1667 | + (unsigned long long)amdgpu_bo_gpu_offset(adev->gart.bo)); | |
| 1668 | + | |
| 1547 | 1669 | adev->gart.ready = true; |
| 1548 | 1670 | return 0; |
| 1549 | 1671 | } |
| @@ -49,6 +49,9 @@ static void hdp_v4_0_flush_hdp(struct amdgpu_device *adev, · 48 unmodified lines | ||
| 49 | 49 | static void hdp_v4_0_invalidate_hdp(struct amdgpu_device *adev, |
| 50 | 50 | struct amdgpu_ring *ring) |
| 51 | 51 | { |
| 52 | + if (adev->asic_type == CHIP_ALDEBARAN) | |
| 53 | + return; | |
| 54 | + | |
| 52 | 55 | if (!ring || !ring->funcs->emit_wreg) |
| 53 | 56 | WREG32_SOC15_NO_KIQ(HDP, 0, mmHDP_READ_CACHE_INVALIDATE, 1); |
| 54 | 57 | else |
| @@ -565,6 +565,26 @@ static const struct amd_ip_funcs jpeg_v2_5_ip_funcs = { · 564 unmodified lines | ||
| 565 | 565 | .set_powergating_state = jpeg_v2_5_set_powergating_state, |
| 566 | 566 | }; |
| 567 | 567 | |
| 568 | +static const struct amd_ip_funcs jpeg_v2_6_ip_funcs = { | |
| 569 | + .name = "jpeg_v2_6", | |
| 570 | + .early_init = jpeg_v2_5_early_init, | |
| 571 | + .late_init = NULL, | |
| 572 | + .sw_init = jpeg_v2_5_sw_init, | |
| 573 | + .sw_fini = jpeg_v2_5_sw_fini, | |
| 574 | + .hw_init = jpeg_v2_5_hw_init, | |
| 575 | + .hw_fini = jpeg_v2_5_hw_fini, | |
| 576 | + .suspend = jpeg_v2_5_suspend, | |
| 577 | + .resume = jpeg_v2_5_resume, | |
| 578 | + .is_idle = jpeg_v2_5_is_idle, | |
| 579 | + .wait_for_idle = jpeg_v2_5_wait_for_idle, | |
| 580 | + .check_soft_reset = NULL, | |
| 581 | + .pre_soft_reset = NULL, | |
| 582 | + .soft_reset = NULL, | |
| 583 | + .post_soft_reset = NULL, | |
| 584 | + .set_clockgating_state = jpeg_v2_5_set_clockgating_state, | |
| 585 | + .set_powergating_state = jpeg_v2_5_set_powergating_state, | |
| 586 | +}; | |
| 587 | + | |
| 568 | 588 | static const struct amdgpu_ring_funcs jpeg_v2_5_dec_ring_vm_funcs = { |
| 569 | 589 | .type = AMDGPU_RING_TYPE_VCN_JPEG, |
| 570 | 590 | .align_mask = 0xf, |
| @@ -595,6 +615,36 @@ static const struct amdgpu_ring_funcs jpeg_v2_5_dec_ring_vm_funcs = { · 24 unmodified lines | ||
| 595 | 615 | .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, |
| 596 | 616 | }; |
| 597 | 617 | |
| 618 | +static const struct amdgpu_ring_funcs jpeg_v2_6_dec_ring_vm_funcs = { | |
| 619 | + .type = AMDGPU_RING_TYPE_VCN_JPEG, | |
| 620 | + .align_mask = 0xf, | |
| 621 | + .vmhub = AMDGPU_MMHUB_0, | |
| 622 | + .get_rptr = jpeg_v2_5_dec_ring_get_rptr, | |
| 623 | + .get_wptr = jpeg_v2_5_dec_ring_get_wptr, | |
| 624 | + .set_wptr = jpeg_v2_5_dec_ring_set_wptr, | |
| 625 | + .emit_frame_size = | |
| 626 | + SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 + | |
| 627 | + SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 8 + | |
| 628 | + 8 + /* jpeg_v2_5_dec_ring_emit_vm_flush */ | |
| 629 | + 18 + 18 + /* jpeg_v2_5_dec_ring_emit_fence x2 vm fence */ | |
| 630 | + 8 + 16, | |
| 631 | + .emit_ib_size = 22, /* jpeg_v2_5_dec_ring_emit_ib */ | |
| 632 | + .emit_ib = jpeg_v2_0_dec_ring_emit_ib, | |
| 633 | + .emit_fence = jpeg_v2_0_dec_ring_emit_fence, | |
| 634 | + .emit_vm_flush = jpeg_v2_0_dec_ring_emit_vm_flush, | |
| 635 | + .test_ring = amdgpu_jpeg_dec_ring_test_ring, | |
| 636 | + .test_ib = amdgpu_jpeg_dec_ring_test_ib, | |
| 637 | + .insert_nop = jpeg_v2_0_dec_ring_nop, | |
| 638 | + .insert_start = jpeg_v2_0_dec_ring_insert_start, | |
| 639 | + .insert_end = jpeg_v2_0_dec_ring_insert_end, | |
| 640 | + .pad_ib = amdgpu_ring_generic_pad_ib, | |
| 641 | + .begin_use = amdgpu_jpeg_ring_begin_use, | |
| 642 | + .end_use = amdgpu_jpeg_ring_end_use, | |
| 643 | + .emit_wreg = jpeg_v2_0_dec_ring_emit_wreg, | |
| 644 | + .emit_reg_wait = jpeg_v2_0_dec_ring_emit_reg_wait, | |
| 645 | + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, | |
| 646 | +}; | |
| 647 | + | |
| 598 | 648 | static void jpeg_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev) |
| 599 | 649 | { |
| 600 | 650 | int i; |
| @@ -602,8 +652,10 @@ static void jpeg_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev) · 1 unmodified line | ||
| 602 | 652 | for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) { |
| 603 | 653 | if (adev->jpeg.harvest_config & (1 << i)) |
| 604 | 654 | continue; |
| 605 | − | |
| 606 | − adev->jpeg.inst[i].ring_dec.funcs = &jpeg_v2_5_dec_ring_vm_funcs; | |
| 655 | + if (adev->asic_type == CHIP_ARCTURUS) | |
| 656 | + adev->jpeg.inst[i].ring_dec.funcs = &jpeg_v2_5_dec_ring_vm_funcs; | |
| 657 | + else /* CHIP_ALDEBARAN */ | |
| 658 | + adev->jpeg.inst[i].ring_dec.funcs = &jpeg_v2_6_dec_ring_vm_funcs; | |
| 607 | 659 | adev->jpeg.inst[i].ring_dec.me = i; |
| 608 | 660 | DRM_INFO("JPEG(%d) JPEG decode is enabled in VM mode\n", i); |
| 609 | 661 | } |
| @@ -635,3 +687,12 @@ const struct amdgpu_ip_block_version jpeg_v2_5_ip_block = · 25 unmodified lines | ||
| 635 | 687 | .rev = 0, |
| 636 | 688 | .funcs = &jpeg_v2_5_ip_funcs, |
| 637 | 689 | }; |
| 690 | + | |
| 691 | +const struct amdgpu_ip_block_version jpeg_v2_6_ip_block = | |
| 692 | +{ | |
| 693 | + .type = AMD_IP_BLOCK_TYPE_JPEG, | |
| 694 | + .major = 2, | |
| 695 | + .minor = 6, | |
| 696 | + .rev = 0, | |
| 697 | + .funcs = &jpeg_v2_6_ip_funcs, | |
| 698 | +}; | |
| @@ -25,5 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | #define __JPEG_V2_5_H__ |
| 26 | 26 | |
| 27 | 27 | extern const struct amdgpu_ip_block_version jpeg_v2_5_ip_block; |
| 28 | +extern const struct amdgpu_ip_block_version jpeg_v2_6_ip_block; | |
| 28 | 29 | |
| 29 | 30 | #endif /* __JPEG_V2_5_H__ */ |
| @@ -0,0 +1,1329 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2019 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#include "amdgpu.h" | |
| 24 | +#include "amdgpu_ras.h" | |
| 25 | +#include "mmhub_v1_7.h" | |
| 26 | + | |
| 27 | +#include "mmhub/mmhub_1_7_offset.h" | |
| 28 | +#include "mmhub/mmhub_1_7_sh_mask.h" | |
| 29 | +#include "vega10_enum.h" | |
| 30 | + | |
| 31 | +#include "soc15_common.h" | |
| 32 | +#include "soc15.h" | |
| 33 | + | |
| 34 | +#define regVM_L2_CNTL3_DEFAULT 0x80100007 | |
| 35 | +#define regVM_L2_CNTL4_DEFAULT 0x000000c1 | |
| 36 | + | |
| 37 | +static u64 mmhub_v1_7_get_fb_location(struct amdgpu_device *adev) | |
| 38 | +{ | |
| 39 | + u64 base = RREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE); | |
| 40 | + u64 top = RREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP); | |
| 41 | + | |
| 42 | + base &= MC_VM_FB_LOCATION_BASE__FB_BASE_MASK; | |
| 43 | + base <<= 24; | |
| 44 | + | |
| 45 | + top &= MC_VM_FB_LOCATION_TOP__FB_TOP_MASK; | |
| 46 | + top <<= 24; | |
| 47 | + | |
| 48 | + adev->gmc.fb_start = base; | |
| 49 | + adev->gmc.fb_end = top; | |
| 50 | + adev->gmc.fb_start_original = base; | |
| 51 | + adev->gmc.fb_end_original = top; | |
| 52 | + | |
| 53 | + return base; | |
| 54 | +} | |
| 55 | + | |
| 56 | +static void mmhub_v1_7_setup_vm_pt_regs(struct amdgpu_device *adev, uint32_t vmid, | |
| 57 | + uint64_t page_table_base) | |
| 58 | +{ | |
| 59 | + struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0]; | |
| 60 | + | |
| 61 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32, | |
| 62 | + hub->ctx_addr_distance * vmid, lower_32_bits(page_table_base)); | |
| 63 | + | |
| 64 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32, | |
| 65 | + hub->ctx_addr_distance * vmid, upper_32_bits(page_table_base)); | |
| 66 | +} | |
| 67 | + | |
| 68 | +static void mmhub_v1_7_init_gart_aperture_regs(struct amdgpu_device *adev) | |
| 69 | +{ | |
| 70 | + uint64_t pt_base; | |
| 71 | + | |
| 72 | + if (adev->gmc.pdb0_bo) | |
| 73 | + pt_base = amdgpu_gmc_pd_addr(adev->gmc.pdb0_bo); | |
| 74 | + else | |
| 75 | + pt_base = amdgpu_gmc_pd_addr(adev->gart.bo); | |
| 76 | + | |
| 77 | + mmhub_v1_7_setup_vm_pt_regs(adev, 0, pt_base); | |
| 78 | + | |
| 79 | + /* If use GART for FB translation, vmid0 page table covers both | |
| 80 | + * vram and system memory (gart) | |
| 81 | + */ | |
| 82 | + if (adev->gmc.pdb0_bo) { | |
| 83 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, | |
| 84 | + (u32)(adev->gmc.fb_start >> 12)); | |
| 85 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, | |
| 86 | + (u32)(adev->gmc.fb_start >> 44)); | |
| 87 | + | |
| 88 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, | |
| 89 | + (u32)(adev->gmc.gart_end >> 12)); | |
| 90 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, | |
| 91 | + (u32)(adev->gmc.gart_end >> 44)); | |
| 92 | + | |
| 93 | + } else { | |
| 94 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, | |
| 95 | + (u32)(adev->gmc.gart_start >> 12)); | |
| 96 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, | |
| 97 | + (u32)(adev->gmc.gart_start >> 44)); | |
| 98 | + | |
| 99 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, | |
| 100 | + (u32)(adev->gmc.gart_end >> 12)); | |
| 101 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, | |
| 102 | + (u32)(adev->gmc.gart_end >> 44)); | |
| 103 | + } | |
| 104 | +} | |
| 105 | + | |
| 106 | +static void mmhub_v1_7_init_system_aperture_regs(struct amdgpu_device *adev) | |
| 107 | +{ | |
| 108 | + uint64_t value; | |
| 109 | + uint32_t tmp; | |
| 110 | + | |
| 111 | + /* Program the AGP BAR */ | |
| 112 | + WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_BASE, 0); | |
| 113 | + WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_BOT, adev->gmc.agp_start >> 24); | |
| 114 | + WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_TOP, adev->gmc.agp_end >> 24); | |
| 115 | + | |
| 116 | + /* Program the system aperture low logical page number. */ | |
| 117 | + WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_LOW_ADDR, | |
| 118 | + min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18); | |
| 119 | + | |
| 120 | + WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_HIGH_ADDR, | |
| 121 | + max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18); | |
| 122 | + | |
| 123 | + /* In the case squeezing vram into GART aperture, we don't use | |
| 124 | + * FB aperture and AGP aperture. Disable them. | |
| 125 | + */ | |
| 126 | + if (adev->gmc.pdb0_bo) { | |
| 127 | + WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_BOT, 0xFFFFFF); | |
| 128 | + WREG32_SOC15(MMHUB, 0, regMC_VM_AGP_TOP, 0); | |
| 129 | + WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP, adev->gmc.fb_end_original >> 24); | |
| 130 | + WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE, adev->gmc.fb_start_original >> 24); | |
| 131 | + WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.fb_start_original >> 18); | |
| 132 | + WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_HIGH_ADDR, adev->gmc.fb_end_original >> 18); | |
| 133 | + } | |
| 134 | + if (amdgpu_sriov_vf(adev)) | |
| 135 | + return; | |
| 136 | + | |
| 137 | + /* Set default page address. */ | |
| 138 | + value = adev->vram_scratch.gpu_addr - adev->gmc.vram_start + | |
| 139 | + adev->vm_manager.vram_base_offset; | |
| 140 | + WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, | |
| 141 | + (u32)(value >> 12)); | |
| 142 | + WREG32_SOC15(MMHUB, 0, regMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB, | |
| 143 | + (u32)(value >> 44)); | |
| 144 | + | |
| 145 | + /* Program "protection fault". */ | |
| 146 | + WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32, | |
| 147 | + (u32)(adev->dummy_page_addr >> 12)); | |
| 148 | + WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32, | |
| 149 | + (u32)((u64)adev->dummy_page_addr >> 44)); | |
| 150 | + | |
| 151 | + tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL2); | |
| 152 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL2, | |
| 153 | + ACTIVE_PAGE_MIGRATION_PTE_READ_RETRY, 1); | |
| 154 | + WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL2, tmp); | |
| 155 | +} | |
| 156 | + | |
| 157 | +static void mmhub_v1_7_init_tlb_regs(struct amdgpu_device *adev) | |
| 158 | +{ | |
| 159 | + uint32_t tmp; | |
| 160 | + | |
| 161 | + /* Setup TLB control */ | |
| 162 | + tmp = RREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL); | |
| 163 | + | |
| 164 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1); | |
| 165 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, SYSTEM_ACCESS_MODE, 3); | |
| 166 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, | |
| 167 | + ENABLE_ADVANCED_DRIVER_MODEL, 1); | |
| 168 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, | |
| 169 | + SYSTEM_APERTURE_UNMAPPED_ACCESS, 0); | |
| 170 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ECO_BITS, 0); | |
| 171 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, | |
| 172 | + MTYPE, MTYPE_UC);/* XXX for emulation. */ | |
| 173 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ATC_EN, 1); | |
| 174 | + | |
| 175 | + WREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL, tmp); | |
| 176 | +} | |
| 177 | + | |
| 178 | +static void mmhub_v1_7_init_cache_regs(struct amdgpu_device *adev) | |
| 179 | +{ | |
| 180 | + uint32_t tmp; | |
| 181 | + | |
| 182 | + if (amdgpu_sriov_vf(adev)) | |
| 183 | + return; | |
| 184 | + | |
| 185 | + /* Setup L2 cache */ | |
| 186 | + tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_CNTL); | |
| 187 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 1); | |
| 188 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_FRAGMENT_PROCESSING, 1); | |
| 189 | + /* XXX for emulation, Refer to closed source code.*/ | |
| 190 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, L2_PDE0_CACHE_TAG_GENERATION_MODE, | |
| 191 | + 0); | |
| 192 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, PDE_FAULT_CLASSIFICATION, 0); | |
| 193 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1); | |
| 194 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, IDENTITY_MODE_FRAGMENT_SIZE, 0); | |
| 195 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL, tmp); | |
| 196 | + | |
| 197 | + tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_CNTL2); | |
| 198 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1); | |
| 199 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1); | |
| 200 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL2, tmp); | |
| 201 | + | |
| 202 | + tmp = regVM_L2_CNTL3_DEFAULT; | |
| 203 | + if (adev->gmc.translate_further) { | |
| 204 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 12); | |
| 205 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, | |
| 206 | + L2_CACHE_BIGK_FRAGMENT_SIZE, 9); | |
| 207 | + } else { | |
| 208 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 9); | |
| 209 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, | |
| 210 | + L2_CACHE_BIGK_FRAGMENT_SIZE, 6); | |
| 211 | + } | |
| 212 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL3, tmp); | |
| 213 | + | |
| 214 | + tmp = regVM_L2_CNTL4_DEFAULT; | |
| 215 | + if (adev->gmc.xgmi.connected_to_cpu) { | |
| 216 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, | |
| 217 | + VMC_TAP_PDE_REQUEST_PHYSICAL, 1); | |
| 218 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, | |
| 219 | + VMC_TAP_PTE_REQUEST_PHYSICAL, 1); | |
| 220 | + } else { | |
| 221 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, | |
| 222 | + VMC_TAP_PDE_REQUEST_PHYSICAL, 0); | |
| 223 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, | |
| 224 | + VMC_TAP_PTE_REQUEST_PHYSICAL, 0); | |
| 225 | + } | |
| 226 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL4, tmp); | |
| 227 | +} | |
| 228 | + | |
| 229 | +static void mmhub_v1_7_enable_system_domain(struct amdgpu_device *adev) | |
| 230 | +{ | |
| 231 | + uint32_t tmp; | |
| 232 | + | |
| 233 | + tmp = RREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_CNTL); | |
| 234 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, ENABLE_CONTEXT, 1); | |
| 235 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_DEPTH, | |
| 236 | + adev->gmc.vmid0_page_table_depth); | |
| 237 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_BLOCK_SIZE, | |
| 238 | + adev->gmc.vmid0_page_table_block_size); | |
| 239 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, | |
| 240 | + RETRY_PERMISSION_OR_INVALID_PAGE_FAULT, 0); | |
| 241 | + WREG32_SOC15(MMHUB, 0, regVM_CONTEXT0_CNTL, tmp); | |
| 242 | +} | |
| 243 | + | |
| 244 | +static void mmhub_v1_7_disable_identity_aperture(struct amdgpu_device *adev) | |
| 245 | +{ | |
| 246 | + if (amdgpu_sriov_vf(adev)) | |
| 247 | + return; | |
| 248 | + | |
| 249 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32, | |
| 250 | + 0XFFFFFFFF); | |
| 251 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32, | |
| 252 | + 0x0000000F); | |
| 253 | + | |
| 254 | + WREG32_SOC15(MMHUB, 0, | |
| 255 | + regVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_LO32, 0); | |
| 256 | + WREG32_SOC15(MMHUB, 0, | |
| 257 | + regVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_HI32, 0); | |
| 258 | + | |
| 259 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_LO32, | |
| 260 | + 0); | |
| 261 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_HI32, | |
| 262 | + 0); | |
| 263 | +} | |
| 264 | + | |
| 265 | +static void mmhub_v1_7_setup_vmid_config(struct amdgpu_device *adev) | |
| 266 | +{ | |
| 267 | + struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0]; | |
| 268 | + unsigned num_level, block_size; | |
| 269 | + uint32_t tmp; | |
| 270 | + int i; | |
| 271 | + | |
| 272 | + num_level = adev->vm_manager.num_level; | |
| 273 | + block_size = adev->vm_manager.block_size; | |
| 274 | + if (adev->gmc.translate_further) | |
| 275 | + num_level -= 1; | |
| 276 | + else | |
| 277 | + block_size -= 9; | |
| 278 | + | |
| 279 | + for (i = 0; i <= 14; i++) { | |
| 280 | + tmp = RREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_CNTL, i); | |
| 281 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1); | |
| 282 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH, | |
| 283 | + num_level); | |
| 284 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 285 | + RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | |
| 286 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 287 | + DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, | |
| 288 | + 1); | |
| 289 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 290 | + PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | |
| 291 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 292 | + VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | |
| 293 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 294 | + READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | |
| 295 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 296 | + WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | |
| 297 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 298 | + EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); | |
| 299 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 300 | + PAGE_TABLE_BLOCK_SIZE, | |
| 301 | + block_size); | |
| 302 | + /* Send no-retry XNACK on fault to suppress VM fault storm. */ | |
| 303 | + tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, | |
| 304 | + RETRY_PERMISSION_OR_INVALID_PAGE_FAULT, | |
| 305 | + !adev->gmc.noretry); | |
| 306 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_CNTL, | |
| 307 | + i * hub->ctx_distance, tmp); | |
| 308 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32, | |
| 309 | + i * hub->ctx_addr_distance, 0); | |
| 310 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32, | |
| 311 | + i * hub->ctx_addr_distance, 0); | |
| 312 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_END_ADDR_LO32, | |
| 313 | + i * hub->ctx_addr_distance, | |
| 314 | + lower_32_bits(adev->vm_manager.max_pfn - 1)); | |
| 315 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT1_PAGE_TABLE_END_ADDR_HI32, | |
| 316 | + i * hub->ctx_addr_distance, | |
| 317 | + upper_32_bits(adev->vm_manager.max_pfn - 1)); | |
| 318 | + } | |
| 319 | +} | |
| 320 | + | |
| 321 | +static void mmhub_v1_7_program_invalidation(struct amdgpu_device *adev) | |
| 322 | +{ | |
| 323 | + struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0]; | |
| 324 | + unsigned i; | |
| 325 | + | |
| 326 | + for (i = 0; i < 18; ++i) { | |
| 327 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_ADDR_RANGE_LO32, | |
| 328 | + i * hub->eng_addr_distance, 0xffffffff); | |
| 329 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_ADDR_RANGE_HI32, | |
| 330 | + i * hub->eng_addr_distance, 0x1f); | |
| 331 | + } | |
| 332 | +} | |
| 333 | + | |
| 334 | +static int mmhub_v1_7_gart_enable(struct amdgpu_device *adev) | |
| 335 | +{ | |
| 336 | + if (amdgpu_sriov_vf(adev)) { | |
| 337 | + /* | |
| 338 | + * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are | |
| 339 | + * VF copy registers so vbios post doesn't program them, for | |
| 340 | + * SRIOV driver need to program them | |
| 341 | + */ | |
| 342 | + WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE, | |
| 343 | + adev->gmc.vram_start >> 24); | |
| 344 | + WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP, | |
| 345 | + adev->gmc.vram_end >> 24); | |
| 346 | + } | |
| 347 | + | |
| 348 | + /* GART Enable. */ | |
| 349 | + mmhub_v1_7_init_gart_aperture_regs(adev); | |
| 350 | + mmhub_v1_7_init_system_aperture_regs(adev); | |
| 351 | + mmhub_v1_7_init_tlb_regs(adev); | |
| 352 | + mmhub_v1_7_init_cache_regs(adev); | |
| 353 | + | |
| 354 | + mmhub_v1_7_enable_system_domain(adev); | |
| 355 | + mmhub_v1_7_disable_identity_aperture(adev); | |
| 356 | + mmhub_v1_7_setup_vmid_config(adev); | |
| 357 | + mmhub_v1_7_program_invalidation(adev); | |
| 358 | + | |
| 359 | + return 0; | |
| 360 | +} | |
| 361 | + | |
| 362 | +static void mmhub_v1_7_gart_disable(struct amdgpu_device *adev) | |
| 363 | +{ | |
| 364 | + struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0]; | |
| 365 | + u32 tmp; | |
| 366 | + u32 i; | |
| 367 | + | |
| 368 | + /* Disable all tables */ | |
| 369 | + for (i = 0; i < 16; i++) | |
| 370 | + WREG32_SOC15_OFFSET(MMHUB, 0, regVM_CONTEXT0_CNTL, | |
| 371 | + i * hub->ctx_distance, 0); | |
| 372 | + | |
| 373 | + /* Setup TLB control */ | |
| 374 | + tmp = RREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL); | |
| 375 | + tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 0); | |
| 376 | + tmp = REG_SET_FIELD(tmp, | |
| 377 | + MC_VM_MX_L1_TLB_CNTL, | |
| 378 | + ENABLE_ADVANCED_DRIVER_MODEL, | |
| 379 | + 0); | |
| 380 | + WREG32_SOC15(MMHUB, 0, regMC_VM_MX_L1_TLB_CNTL, tmp); | |
| 381 | + | |
| 382 | + if (!amdgpu_sriov_vf(adev)) { | |
| 383 | + /* Setup L2 cache */ | |
| 384 | + tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_CNTL); | |
| 385 | + tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0); | |
| 386 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL, tmp); | |
| 387 | + WREG32_SOC15(MMHUB, 0, regVM_L2_CNTL3, 0); | |
| 388 | + } | |
| 389 | +} | |
| 390 | + | |
| 391 | +/** | |
| 392 | + * mmhub_v1_7_set_fault_enable_default - update GART/VM fault handling | |
| 393 | + * | |
| 394 | + * @adev: amdgpu_device pointer | |
| 395 | + * @value: true redirects VM faults to the default page | |
| 396 | + */ | |
| 397 | +static void mmhub_v1_7_set_fault_enable_default(struct amdgpu_device *adev, bool value) | |
| 398 | +{ | |
| 399 | + u32 tmp; | |
| 400 | + | |
| 401 | + if (amdgpu_sriov_vf(adev)) | |
| 402 | + return; | |
| 403 | + | |
| 404 | + tmp = RREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL); | |
| 405 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 406 | + RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 407 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 408 | + PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 409 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 410 | + PDE1_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 411 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 412 | + PDE2_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 413 | + tmp = REG_SET_FIELD(tmp, | |
| 414 | + VM_L2_PROTECTION_FAULT_CNTL, | |
| 415 | + TRANSLATE_FURTHER_PROTECTION_FAULT_ENABLE_DEFAULT, | |
| 416 | + value); | |
| 417 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 418 | + NACK_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 419 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 420 | + DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 421 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 422 | + VALID_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 423 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 424 | + READ_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 425 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 426 | + WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 427 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 428 | + EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, value); | |
| 429 | + if (!value) { | |
| 430 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 431 | + CRASH_ON_NO_RETRY_FAULT, 1); | |
| 432 | + tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL, | |
| 433 | + CRASH_ON_RETRY_FAULT, 1); | |
| 434 | + } | |
| 435 | + | |
| 436 | + WREG32_SOC15(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL, tmp); | |
| 437 | +} | |
| 438 | + | |
| 439 | +static void mmhub_v1_7_init(struct amdgpu_device *adev) | |
| 440 | +{ | |
| 441 | + struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB_0]; | |
| 442 | + | |
| 443 | + hub->ctx0_ptb_addr_lo32 = | |
| 444 | + SOC15_REG_OFFSET(MMHUB, 0, | |
| 445 | + regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32); | |
| 446 | + hub->ctx0_ptb_addr_hi32 = | |
| 447 | + SOC15_REG_OFFSET(MMHUB, 0, | |
| 448 | + regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32); | |
| 449 | + hub->vm_inv_eng0_req = | |
| 450 | + SOC15_REG_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_REQ); | |
| 451 | + hub->vm_inv_eng0_ack = | |
| 452 | + SOC15_REG_OFFSET(MMHUB, 0, regVM_INVALIDATE_ENG0_ACK); | |
| 453 | + hub->vm_context0_cntl = | |
| 454 | + SOC15_REG_OFFSET(MMHUB, 0, regVM_CONTEXT0_CNTL); | |
| 455 | + hub->vm_l2_pro_fault_status = | |
| 456 | + SOC15_REG_OFFSET(MMHUB, 0, regVM_L2_PROTECTION_FAULT_STATUS); | |
| 457 | + hub->vm_l2_pro_fault_cntl = | |
| 458 | + SOC15_REG_OFFSET(MMHUB, 0, regVM_L2_PROTECTION_FAULT_CNTL); | |
| 459 | + | |
| 460 | + hub->ctx_distance = regVM_CONTEXT1_CNTL - regVM_CONTEXT0_CNTL; | |
| 461 | + hub->ctx_addr_distance = regVM_CONTEXT1_PAGE_TABLE_BASE_ADDR_LO32 - | |
| 462 | + regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32; | |
| 463 | + hub->eng_distance = regVM_INVALIDATE_ENG1_REQ - regVM_INVALIDATE_ENG0_REQ; | |
| 464 | + hub->eng_addr_distance = regVM_INVALIDATE_ENG1_ADDR_RANGE_LO32 - | |
| 465 | + regVM_INVALIDATE_ENG0_ADDR_RANGE_LO32; | |
| 466 | + | |
| 467 | +} | |
| 468 | + | |
| 469 | +static void mmhub_v1_7_update_medium_grain_clock_gating(struct amdgpu_device *adev, | |
| 470 | + bool enable) | |
| 471 | +{ | |
| 472 | + uint32_t def, data, def1, data1, def2 = 0, data2 = 0; | |
| 473 | + | |
| 474 | + def = data = RREG32_SOC15(MMHUB, 0, regATC_L2_MISC_CG); | |
| 475 | + | |
| 476 | + def1 = data1 = RREG32_SOC15(MMHUB, 0, regDAGB0_CNTL_MISC2); | |
| 477 | + def2 = data2 = RREG32_SOC15(MMHUB, 0, regDAGB1_CNTL_MISC2); | |
| 478 | + | |
| 479 | + if (enable) { | |
| 480 | + data |= ATC_L2_MISC_CG__ENABLE_MASK; | |
| 481 | + | |
| 482 | + data1 &= ~(DAGB0_CNTL_MISC2__DISABLE_WRREQ_CG_MASK | | |
| 483 | + DAGB0_CNTL_MISC2__DISABLE_WRRET_CG_MASK | | |
| 484 | + DAGB0_CNTL_MISC2__DISABLE_RDREQ_CG_MASK | | |
| 485 | + DAGB0_CNTL_MISC2__DISABLE_RDRET_CG_MASK | | |
| 486 | + DAGB0_CNTL_MISC2__DISABLE_TLBWR_CG_MASK | | |
| 487 | + DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK); | |
| 488 | + | |
| 489 | + data2 &= ~(DAGB1_CNTL_MISC2__DISABLE_WRREQ_CG_MASK | | |
| 490 | + DAGB1_CNTL_MISC2__DISABLE_WRRET_CG_MASK | | |
| 491 | + DAGB1_CNTL_MISC2__DISABLE_RDREQ_CG_MASK | | |
| 492 | + DAGB1_CNTL_MISC2__DISABLE_RDRET_CG_MASK | | |
| 493 | + DAGB1_CNTL_MISC2__DISABLE_TLBWR_CG_MASK | | |
| 494 | + DAGB1_CNTL_MISC2__DISABLE_TLBRD_CG_MASK); | |
| 495 | + } else { | |
| 496 | + data &= ~ATC_L2_MISC_CG__ENABLE_MASK; | |
| 497 | + | |
| 498 | + data1 |= (DAGB0_CNTL_MISC2__DISABLE_WRREQ_CG_MASK | | |
| 499 | + DAGB0_CNTL_MISC2__DISABLE_WRRET_CG_MASK | | |
| 500 | + DAGB0_CNTL_MISC2__DISABLE_RDREQ_CG_MASK | | |
| 501 | + DAGB0_CNTL_MISC2__DISABLE_RDRET_CG_MASK | | |
| 502 | + DAGB0_CNTL_MISC2__DISABLE_TLBWR_CG_MASK | | |
| 503 | + DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK); | |
| 504 | + | |
| 505 | + data2 |= (DAGB1_CNTL_MISC2__DISABLE_WRREQ_CG_MASK | | |
| 506 | + DAGB1_CNTL_MISC2__DISABLE_WRRET_CG_MASK | | |
| 507 | + DAGB1_CNTL_MISC2__DISABLE_RDREQ_CG_MASK | | |
| 508 | + DAGB1_CNTL_MISC2__DISABLE_RDRET_CG_MASK | | |
| 509 | + DAGB1_CNTL_MISC2__DISABLE_TLBWR_CG_MASK | | |
| 510 | + DAGB1_CNTL_MISC2__DISABLE_TLBRD_CG_MASK); | |
| 511 | + } | |
| 512 | + | |
| 513 | + if (def != data) | |
| 514 | + WREG32_SOC15(MMHUB, 0, regATC_L2_MISC_CG, data); | |
| 515 | + | |
| 516 | + if (def1 != data1) | |
| 517 | + WREG32_SOC15(MMHUB, 0, regDAGB0_CNTL_MISC2, data1); | |
| 518 | + | |
| 519 | + if (def2 != data2) | |
| 520 | + WREG32_SOC15(MMHUB, 0, regDAGB1_CNTL_MISC2, data2); | |
| 521 | +} | |
| 522 | + | |
| 523 | +static void mmhub_v1_7_update_medium_grain_light_sleep(struct amdgpu_device *adev, | |
| 524 | + bool enable) | |
| 525 | +{ | |
| 526 | + uint32_t def, data; | |
| 527 | + | |
| 528 | + def = data = RREG32_SOC15(MMHUB, 0, regATC_L2_MISC_CG); | |
| 529 | + | |
| 530 | + if (enable) | |
| 531 | + data |= ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK; | |
| 532 | + else | |
| 533 | + data &= ~ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK; | |
| 534 | + | |
| 535 | + if (def != data) | |
| 536 | + WREG32_SOC15(MMHUB, 0, regATC_L2_MISC_CG, data); | |
| 537 | +} | |
| 538 | + | |
| 539 | +static int mmhub_v1_7_set_clockgating(struct amdgpu_device *adev, | |
| 540 | + enum amd_clockgating_state state) | |
| 541 | +{ | |
| 542 | + if (amdgpu_sriov_vf(adev)) | |
| 543 | + return 0; | |
| 544 | + | |
| 545 | + /* Change state only if MCCG support is enabled through driver */ | |
| 546 | + if (adev->cg_flags & AMD_CG_SUPPORT_MC_MGCG) | |
| 547 | + mmhub_v1_7_update_medium_grain_clock_gating(adev, | |
| 548 | + state == AMD_CG_STATE_GATE); | |
| 549 | + | |
| 550 | + /* Change state only if LS support is enabled through driver */ | |
| 551 | + if (adev->cg_flags & AMD_CG_SUPPORT_MC_LS) | |
| 552 | + mmhub_v1_7_update_medium_grain_light_sleep(adev, | |
| 553 | + state == AMD_CG_STATE_GATE); | |
| 554 | + | |
| 555 | + return 0; | |
| 556 | +} | |
| 557 | + | |
| 558 | +static void mmhub_v1_7_get_clockgating(struct amdgpu_device *adev, u32 *flags) | |
| 559 | +{ | |
| 560 | + int data, data1; | |
| 561 | + | |
| 562 | + if (amdgpu_sriov_vf(adev)) | |
| 563 | + *flags = 0; | |
| 564 | + | |
| 565 | + data = RREG32_SOC15(MMHUB, 0, regATC_L2_MISC_CG); | |
| 566 | + | |
| 567 | + data1 = RREG32_SOC15(MMHUB, 0, regDAGB0_CNTL_MISC2); | |
| 568 | + | |
| 569 | + /* AMD_CG_SUPPORT_MC_MGCG */ | |
| 570 | + if ((data & ATC_L2_MISC_CG__ENABLE_MASK) && | |
| 571 | + !(data1 & (DAGB0_CNTL_MISC2__DISABLE_WRREQ_CG_MASK | | |
| 572 | + DAGB0_CNTL_MISC2__DISABLE_WRRET_CG_MASK | | |
| 573 | + DAGB0_CNTL_MISC2__DISABLE_RDREQ_CG_MASK | | |
| 574 | + DAGB0_CNTL_MISC2__DISABLE_RDRET_CG_MASK | | |
| 575 | + DAGB0_CNTL_MISC2__DISABLE_TLBWR_CG_MASK | | |
| 576 | + DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK))) | |
| 577 | + *flags |= AMD_CG_SUPPORT_MC_MGCG; | |
| 578 | + | |
| 579 | + /* AMD_CG_SUPPORT_MC_LS */ | |
| 580 | + if (data & ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK) | |
| 581 | + *flags |= AMD_CG_SUPPORT_MC_LS; | |
| 582 | +} | |
| 583 | + | |
| 584 | +static const struct soc15_ras_field_entry mmhub_v1_7_ras_fields[] = { | |
| 585 | + /* MMHUB Range 0 */ | |
| 586 | + { "MMEA0_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 587 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMRD_CMDMEM_SEC_COUNT), | |
| 588 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMRD_CMDMEM_DED_COUNT), | |
| 589 | + }, | |
| 590 | + { "MMEA0_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 591 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMWR_CMDMEM_SEC_COUNT), | |
| 592 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMWR_CMDMEM_DED_COUNT), | |
| 593 | + }, | |
| 594 | + { "MMEA0_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 595 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMWR_DATAMEM_SEC_COUNT), | |
| 596 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMWR_DATAMEM_DED_COUNT), | |
| 597 | + }, | |
| 598 | + { "MMEA0_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 599 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, RRET_TAGMEM_SEC_COUNT), | |
| 600 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, RRET_TAGMEM_DED_COUNT), | |
| 601 | + }, | |
| 602 | + { "MMEA0_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 603 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, WRET_TAGMEM_SEC_COUNT), | |
| 604 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, WRET_TAGMEM_DED_COUNT), | |
| 605 | + }, | |
| 606 | + { "MMEA0_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 607 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, IOWR_DATAMEM_SEC_COUNT), | |
| 608 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, IOWR_DATAMEM_DED_COUNT), | |
| 609 | + }, | |
| 610 | + { "MMEA0_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 611 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMRD_PAGEMEM_SED_COUNT), | |
| 612 | + 0, 0, | |
| 613 | + }, | |
| 614 | + { "MMEA0_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 615 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, DRAMWR_PAGEMEM_SED_COUNT), | |
| 616 | + 0, 0, | |
| 617 | + }, | |
| 618 | + { "MMEA0_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 619 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, IORD_CMDMEM_SED_COUNT), | |
| 620 | + 0, 0, | |
| 621 | + }, | |
| 622 | + { "MMEA0_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), | |
| 623 | + SOC15_REG_FIELD(MMEA0_EDC_CNT, IOWR_CMDMEM_SED_COUNT), | |
| 624 | + 0, 0, | |
| 625 | + }, | |
| 626 | + { "MMEA0_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 627 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIRD_CMDMEM_SEC_COUNT), | |
| 628 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIRD_CMDMEM_DED_COUNT), | |
| 629 | + }, | |
| 630 | + { "MMEA0_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 631 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIWR_CMDMEM_SEC_COUNT), | |
| 632 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIWR_CMDMEM_DED_COUNT), | |
| 633 | + }, | |
| 634 | + { "MMEA0_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 635 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIWR_DATAMEM_SEC_COUNT), | |
| 636 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIWR_DATAMEM_DED_COUNT), | |
| 637 | + }, | |
| 638 | + { "MMEA0_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 639 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIRD_PAGEMEM_SED_COUNT), | |
| 640 | + 0, 0, | |
| 641 | + }, | |
| 642 | + { "MMEA0_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 643 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, GMIWR_PAGEMEM_SED_COUNT), | |
| 644 | + 0, 0, | |
| 645 | + }, | |
| 646 | + { "MMEA0_MAM_D0MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 647 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D0MEM_SED_COUNT), | |
| 648 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D0MEM_DED_COUNT), | |
| 649 | + }, | |
| 650 | + { "MMEA0_MAM_D1MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 651 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D1MEM_SED_COUNT), | |
| 652 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D1MEM_DED_COUNT), | |
| 653 | + }, | |
| 654 | + { "MMEA0_MAM_D2MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 655 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D2MEM_SED_COUNT), | |
| 656 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D2MEM_DED_COUNT), | |
| 657 | + }, | |
| 658 | + { "MMEA0_MAM_D3MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), | |
| 659 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D3MEM_SED_COUNT), | |
| 660 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D3MEM_DED_COUNT), | |
| 661 | + }, | |
| 662 | + { "MMEA0_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT3), | |
| 663 | + 0, 0, | |
| 664 | + SOC15_REG_FIELD(MMEA0_EDC_CNT3, DRAMRD_PAGEMEM_DED_COUNT), | |
| 665 | + }, | |
| 666 | + { "MMEA0_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT3), | |
| 667 | + 0, 0, | |
| 668 | + SOC15_REG_FIELD(MMEA0_EDC_CNT3, DRAMWR_PAGEMEM_DED_COUNT), | |
| 669 | + }, | |
| 670 | + { "MMEA0_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT3), | |
| 671 | + 0, 0, | |
| 672 | + SOC15_REG_FIELD(MMEA0_EDC_CNT3, IORD_CMDMEM_DED_COUNT), | |
| 673 | + }, | |
| 674 | + { "MMEA0_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT3), | |
| 675 | + 0, 0, | |
| 676 | + SOC15_REG_FIELD(MMEA0_EDC_CNT3, IOWR_CMDMEM_DED_COUNT), | |
| 677 | + }, | |
| 678 | + { "MMEA0_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT3), | |
| 679 | + 0, 0, | |
| 680 | + SOC15_REG_FIELD(MMEA0_EDC_CNT3, GMIRD_PAGEMEM_DED_COUNT), | |
| 681 | + }, | |
| 682 | + { "MMEA0_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT3), | |
| 683 | + 0, 0, | |
| 684 | + SOC15_REG_FIELD(MMEA0_EDC_CNT3, GMIWR_PAGEMEM_DED_COUNT), | |
| 685 | + }, | |
| 686 | + | |
| 687 | + /* MMHUB Range 1 */ | |
| 688 | + { "MMEA1_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 689 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMRD_CMDMEM_SEC_COUNT), | |
| 690 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMRD_CMDMEM_DED_COUNT), | |
| 691 | + }, | |
| 692 | + { "MMEA1_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 693 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMWR_CMDMEM_SEC_COUNT), | |
| 694 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMWR_CMDMEM_DED_COUNT), | |
| 695 | + }, | |
| 696 | + { "MMEA1_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 697 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMWR_DATAMEM_SEC_COUNT), | |
| 698 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMWR_DATAMEM_DED_COUNT), | |
| 699 | + }, | |
| 700 | + { "MMEA1_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 701 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, RRET_TAGMEM_SEC_COUNT), | |
| 702 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, RRET_TAGMEM_DED_COUNT), | |
| 703 | + }, | |
| 704 | + { "MMEA1_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 705 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, WRET_TAGMEM_SEC_COUNT), | |
| 706 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, WRET_TAGMEM_DED_COUNT), | |
| 707 | + }, | |
| 708 | + { "MMEA1_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 709 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, IOWR_DATAMEM_SEC_COUNT), | |
| 710 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, IOWR_DATAMEM_DED_COUNT), | |
| 711 | + }, | |
| 712 | + { "MMEA1_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 713 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMRD_PAGEMEM_SED_COUNT), | |
| 714 | + 0, 0, | |
| 715 | + }, | |
| 716 | + { "MMEA1_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 717 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, DRAMWR_PAGEMEM_SED_COUNT), | |
| 718 | + 0, 0, | |
| 719 | + }, | |
| 720 | + { "MMEA1_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 721 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, IORD_CMDMEM_SED_COUNT), | |
| 722 | + 0, 0, | |
| 723 | + }, | |
| 724 | + { "MMEA1_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), | |
| 725 | + SOC15_REG_FIELD(MMEA1_EDC_CNT, IOWR_CMDMEM_SED_COUNT), | |
| 726 | + 0, 0, | |
| 727 | + }, | |
| 728 | + { "MMEA1_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 729 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIRD_CMDMEM_SEC_COUNT), | |
| 730 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIRD_CMDMEM_DED_COUNT), | |
| 731 | + }, | |
| 732 | + { "MMEA1_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 733 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIWR_CMDMEM_SEC_COUNT), | |
| 734 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIWR_CMDMEM_DED_COUNT), | |
| 735 | + }, | |
| 736 | + { "MMEA1_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 737 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIWR_DATAMEM_SEC_COUNT), | |
| 738 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIWR_DATAMEM_DED_COUNT), | |
| 739 | + }, | |
| 740 | + { "MMEA1_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 741 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIRD_PAGEMEM_SED_COUNT), | |
| 742 | + 0, 0, | |
| 743 | + }, | |
| 744 | + { "MMEA1_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 745 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, GMIWR_PAGEMEM_SED_COUNT), | |
| 746 | + 0, 0, | |
| 747 | + }, | |
| 748 | + { "MMEA1_MAM_D0MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 749 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D0MEM_SED_COUNT), | |
| 750 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D0MEM_DED_COUNT), | |
| 751 | + }, | |
| 752 | + { "MMEA1_MAM_D1MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 753 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D1MEM_SED_COUNT), | |
| 754 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D1MEM_DED_COUNT), | |
| 755 | + }, | |
| 756 | + { "MMEA1_MAM_D2MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 757 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D2MEM_SED_COUNT), | |
| 758 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D2MEM_DED_COUNT), | |
| 759 | + }, | |
| 760 | + { "MMEA1_MAM_D3MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), | |
| 761 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D3MEM_SED_COUNT), | |
| 762 | + SOC15_REG_FIELD(MMEA1_EDC_CNT2, MAM_D3MEM_DED_COUNT), | |
| 763 | + }, | |
| 764 | + { "MMEA1_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT3), | |
| 765 | + 0, 0, | |
| 766 | + SOC15_REG_FIELD(MMEA1_EDC_CNT3, DRAMRD_PAGEMEM_DED_COUNT), | |
| 767 | + }, | |
| 768 | + { "MMEA1_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT3), | |
| 769 | + 0, 0, | |
| 770 | + SOC15_REG_FIELD(MMEA1_EDC_CNT3, DRAMWR_PAGEMEM_DED_COUNT), | |
| 771 | + }, | |
| 772 | + { "MMEA1_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT3), | |
| 773 | + 0, 0, | |
| 774 | + SOC15_REG_FIELD(MMEA1_EDC_CNT3, IORD_CMDMEM_DED_COUNT), | |
| 775 | + }, | |
| 776 | + { "MMEA1_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT3), | |
| 777 | + 0, 0, | |
| 778 | + SOC15_REG_FIELD(MMEA1_EDC_CNT3, IOWR_CMDMEM_DED_COUNT), | |
| 779 | + }, | |
| 780 | + { "MMEA1_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT3), | |
| 781 | + 0, 0, | |
| 782 | + SOC15_REG_FIELD(MMEA1_EDC_CNT3, GMIRD_PAGEMEM_DED_COUNT), | |
| 783 | + }, | |
| 784 | + { "MMEA1_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT3), | |
| 785 | + 0, 0, | |
| 786 | + SOC15_REG_FIELD(MMEA1_EDC_CNT3, GMIWR_PAGEMEM_DED_COUNT), | |
| 787 | + }, | |
| 788 | + | |
| 789 | + /* MMHAB Range 2*/ | |
| 790 | + { "MMEA2_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 791 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMRD_CMDMEM_SEC_COUNT), | |
| 792 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMRD_CMDMEM_DED_COUNT), | |
| 793 | + }, | |
| 794 | + { "MMEA2_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 795 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMWR_CMDMEM_SEC_COUNT), | |
| 796 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMWR_CMDMEM_DED_COUNT), | |
| 797 | + }, | |
| 798 | + { "MMEA2_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 799 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMWR_DATAMEM_SEC_COUNT), | |
| 800 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMWR_DATAMEM_DED_COUNT), | |
| 801 | + }, | |
| 802 | + { "MMEA2_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 803 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, RRET_TAGMEM_SEC_COUNT), | |
| 804 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, RRET_TAGMEM_DED_COUNT), | |
| 805 | + }, | |
| 806 | + { "MMEA2_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 807 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, WRET_TAGMEM_SEC_COUNT), | |
| 808 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, WRET_TAGMEM_DED_COUNT), | |
| 809 | + }, | |
| 810 | + { "MMEA2_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 811 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, IOWR_DATAMEM_SEC_COUNT), | |
| 812 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, IOWR_DATAMEM_DED_COUNT), | |
| 813 | + }, | |
| 814 | + { "MMEA2_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 815 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMRD_PAGEMEM_SED_COUNT), | |
| 816 | + 0, 0, | |
| 817 | + }, | |
| 818 | + { "MMEA2_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 819 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, DRAMWR_PAGEMEM_SED_COUNT), | |
| 820 | + 0, 0, | |
| 821 | + }, | |
| 822 | + { "MMEA2_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 823 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, IORD_CMDMEM_SED_COUNT), | |
| 824 | + 0, 0, | |
| 825 | + }, | |
| 826 | + { "MMEA2_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), | |
| 827 | + SOC15_REG_FIELD(MMEA2_EDC_CNT, IOWR_CMDMEM_SED_COUNT), | |
| 828 | + 0, 0, | |
| 829 | + }, | |
| 830 | + { "MMEA2_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 831 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIRD_CMDMEM_SEC_COUNT), | |
| 832 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIRD_CMDMEM_DED_COUNT), | |
| 833 | + }, | |
| 834 | + { "MMEA2_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 835 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIWR_CMDMEM_SEC_COUNT), | |
| 836 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIWR_CMDMEM_DED_COUNT), | |
| 837 | + }, | |
| 838 | + { "MMEA2_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 839 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIWR_DATAMEM_SEC_COUNT), | |
| 840 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIWR_DATAMEM_DED_COUNT), | |
| 841 | + }, | |
| 842 | + { "MMEA2_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 843 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIRD_PAGEMEM_SED_COUNT), | |
| 844 | + 0, 0, | |
| 845 | + }, | |
| 846 | + { "MMEA2_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 847 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, GMIWR_PAGEMEM_SED_COUNT), | |
| 848 | + 0, 0, | |
| 849 | + }, | |
| 850 | + { "MMEA2_MAM_D0MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 851 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D0MEM_SED_COUNT), | |
| 852 | + SOC15_REG_FIELD(MMEA0_EDC_CNT2, MAM_D0MEM_DED_COUNT), | |
| 853 | + }, | |
| 854 | + { "MMEA2_MAM_D1MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 855 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, MAM_D1MEM_SED_COUNT), | |
| 856 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, MAM_D1MEM_DED_COUNT), | |
| 857 | + }, | |
| 858 | + { "MMEA2_MAM_D2MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 859 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, MAM_D2MEM_SED_COUNT), | |
| 860 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, MAM_D2MEM_DED_COUNT), | |
| 861 | + }, | |
| 862 | + { "MMEA2_MAM_D3MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), | |
| 863 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, MAM_D3MEM_SED_COUNT), | |
| 864 | + SOC15_REG_FIELD(MMEA2_EDC_CNT2, MAM_D3MEM_DED_COUNT), | |
| 865 | + }, | |
| 866 | + { "MMEA2_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT3), | |
| 867 | + 0, 0, | |
| 868 | + SOC15_REG_FIELD(MMEA2_EDC_CNT3, DRAMRD_PAGEMEM_DED_COUNT), | |
| 869 | + }, | |
| 870 | + { "MMEA2_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT3), | |
| 871 | + 0, 0, | |
| 872 | + SOC15_REG_FIELD(MMEA2_EDC_CNT3, DRAMWR_PAGEMEM_DED_COUNT), | |
| 873 | + }, | |
| 874 | + { "MMEA2_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT3), | |
| 875 | + 0, 0, | |
| 876 | + SOC15_REG_FIELD(MMEA2_EDC_CNT3, IORD_CMDMEM_DED_COUNT), | |
| 877 | + }, | |
| 878 | + { "MMEA2_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT3), | |
| 879 | + 0, 0, | |
| 880 | + SOC15_REG_FIELD(MMEA2_EDC_CNT3, IOWR_CMDMEM_DED_COUNT), | |
| 881 | + }, | |
| 882 | + { "MMEA2_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT3), | |
| 883 | + 0, 0, | |
| 884 | + SOC15_REG_FIELD(MMEA2_EDC_CNT3, GMIRD_PAGEMEM_DED_COUNT), | |
| 885 | + }, | |
| 886 | + { "MMEA2_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT3), | |
| 887 | + 0, 0, | |
| 888 | + SOC15_REG_FIELD(MMEA2_EDC_CNT3, GMIWR_PAGEMEM_DED_COUNT), | |
| 889 | + }, | |
| 890 | + | |
| 891 | + /* MMHUB Rang 3 */ | |
| 892 | + { "MMEA3_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 893 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMRD_CMDMEM_SEC_COUNT), | |
| 894 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMRD_CMDMEM_DED_COUNT), | |
| 895 | + }, | |
| 896 | + { "MMEA3_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 897 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMWR_CMDMEM_SEC_COUNT), | |
| 898 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMWR_CMDMEM_DED_COUNT), | |
| 899 | + }, | |
| 900 | + { "MMEA3_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 901 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMWR_DATAMEM_SEC_COUNT), | |
| 902 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMWR_DATAMEM_DED_COUNT), | |
| 903 | + }, | |
| 904 | + { "MMEA3_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 905 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, RRET_TAGMEM_SEC_COUNT), | |
| 906 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, RRET_TAGMEM_DED_COUNT), | |
| 907 | + }, | |
| 908 | + { "MMEA3_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 909 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, WRET_TAGMEM_SEC_COUNT), | |
| 910 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, WRET_TAGMEM_DED_COUNT), | |
| 911 | + }, | |
| 912 | + { "MMEA3_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 913 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, IOWR_DATAMEM_SEC_COUNT), | |
| 914 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, IOWR_DATAMEM_DED_COUNT), | |
| 915 | + }, | |
| 916 | + { "MMEA3_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 917 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMRD_PAGEMEM_SED_COUNT), | |
| 918 | + 0, 0, | |
| 919 | + }, | |
| 920 | + { "MMEA3_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 921 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, DRAMWR_PAGEMEM_SED_COUNT), | |
| 922 | + 0, 0, | |
| 923 | + }, | |
| 924 | + { "MMEA3_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 925 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, IORD_CMDMEM_SED_COUNT), | |
| 926 | + 0, 0, | |
| 927 | + }, | |
| 928 | + { "MMEA3_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), | |
| 929 | + SOC15_REG_FIELD(MMEA3_EDC_CNT, IOWR_CMDMEM_SED_COUNT), | |
| 930 | + 0, 0, | |
| 931 | + }, | |
| 932 | + { "MMEA3_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 933 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIRD_CMDMEM_SEC_COUNT), | |
| 934 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIRD_CMDMEM_DED_COUNT), | |
| 935 | + }, | |
| 936 | + { "MMEA3_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 937 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIWR_CMDMEM_SEC_COUNT), | |
| 938 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIWR_CMDMEM_DED_COUNT), | |
| 939 | + }, | |
| 940 | + { "MMEA3_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 941 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIWR_DATAMEM_SEC_COUNT), | |
| 942 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIWR_DATAMEM_DED_COUNT), | |
| 943 | + }, | |
| 944 | + { "MMEA3_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 945 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIRD_PAGEMEM_SED_COUNT), | |
| 946 | + 0, 0, | |
| 947 | + }, | |
| 948 | + { "MMEA3_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 949 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, GMIWR_PAGEMEM_SED_COUNT), | |
| 950 | + 0, 0, | |
| 951 | + }, | |
| 952 | + { "MMEA3_MAM_D0MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 953 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D0MEM_SED_COUNT), | |
| 954 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D0MEM_DED_COUNT), | |
| 955 | + }, | |
| 956 | + { "MMEA3_MAM_D1MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 957 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D1MEM_SED_COUNT), | |
| 958 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D1MEM_DED_COUNT), | |
| 959 | + }, | |
| 960 | + { "MMEA3_MAM_D2MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 961 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D2MEM_SED_COUNT), | |
| 962 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D2MEM_DED_COUNT), | |
| 963 | + }, | |
| 964 | + { "MMEA3_MAM_D3MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), | |
| 965 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D3MEM_SED_COUNT), | |
| 966 | + SOC15_REG_FIELD(MMEA3_EDC_CNT2, MAM_D3MEM_DED_COUNT), | |
| 967 | + }, | |
| 968 | + { "MMEA3_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT3), | |
| 969 | + 0, 0, | |
| 970 | + SOC15_REG_FIELD(MMEA3_EDC_CNT3, DRAMRD_PAGEMEM_DED_COUNT), | |
| 971 | + }, | |
| 972 | + { "MMEA3_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT3), | |
| 973 | + 0, 0, | |
| 974 | + SOC15_REG_FIELD(MMEA3_EDC_CNT3, DRAMWR_PAGEMEM_DED_COUNT), | |
| 975 | + }, | |
| 976 | + { "MMEA3_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT3), | |
| 977 | + 0, 0, | |
| 978 | + SOC15_REG_FIELD(MMEA3_EDC_CNT3, IORD_CMDMEM_DED_COUNT), | |
| 979 | + }, | |
| 980 | + { "MMEA3_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT3), | |
| 981 | + 0, 0, | |
| 982 | + SOC15_REG_FIELD(MMEA3_EDC_CNT3, IOWR_CMDMEM_DED_COUNT), | |
| 983 | + }, | |
| 984 | + { "MMEA3_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT3), | |
| 985 | + 0, 0, | |
| 986 | + SOC15_REG_FIELD(MMEA3_EDC_CNT3, GMIRD_PAGEMEM_DED_COUNT), | |
| 987 | + }, | |
| 988 | + { "MMEA3_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT3), | |
| 989 | + 0, 0, | |
| 990 | + SOC15_REG_FIELD(MMEA3_EDC_CNT3, GMIWR_PAGEMEM_DED_COUNT), | |
| 991 | + }, | |
| 992 | + | |
| 993 | + /* MMHUB Range 4 */ | |
| 994 | + { "MMEA4_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 995 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMRD_CMDMEM_SEC_COUNT), | |
| 996 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMRD_CMDMEM_DED_COUNT), | |
| 997 | + }, | |
| 998 | + { "MMEA4_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 999 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMWR_CMDMEM_SEC_COUNT), | |
| 1000 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMWR_CMDMEM_DED_COUNT), | |
| 1001 | + }, | |
| 1002 | + { "MMEA4_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1003 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMWR_DATAMEM_SEC_COUNT), | |
| 1004 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMWR_DATAMEM_DED_COUNT), | |
| 1005 | + }, | |
| 1006 | + { "MMEA4_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1007 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, RRET_TAGMEM_SEC_COUNT), | |
| 1008 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, RRET_TAGMEM_DED_COUNT), | |
| 1009 | + }, | |
| 1010 | + { "MMEA4_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1011 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, WRET_TAGMEM_SEC_COUNT), | |
| 1012 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, WRET_TAGMEM_DED_COUNT), | |
| 1013 | + }, | |
| 1014 | + { "MMEA4_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1015 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, IOWR_DATAMEM_SEC_COUNT), | |
| 1016 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, IOWR_DATAMEM_DED_COUNT), | |
| 1017 | + }, | |
| 1018 | + { "MMEA4_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1019 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMRD_PAGEMEM_SED_COUNT), | |
| 1020 | + 0, 0, | |
| 1021 | + }, | |
| 1022 | + { "MMEA4_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1023 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, DRAMWR_PAGEMEM_SED_COUNT), | |
| 1024 | + 0, 0, | |
| 1025 | + }, | |
| 1026 | + { "MMEA4_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1027 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, IORD_CMDMEM_SED_COUNT), | |
| 1028 | + 0, 0, | |
| 1029 | + }, | |
| 1030 | + { "MMEA4_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), | |
| 1031 | + SOC15_REG_FIELD(MMEA4_EDC_CNT, IOWR_CMDMEM_SED_COUNT), | |
| 1032 | + 0, 0, | |
| 1033 | + }, | |
| 1034 | + { "MMEA4_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1035 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIRD_CMDMEM_SEC_COUNT), | |
| 1036 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIRD_CMDMEM_DED_COUNT), | |
| 1037 | + }, | |
| 1038 | + { "MMEA4_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1039 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIWR_CMDMEM_SEC_COUNT), | |
| 1040 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIWR_CMDMEM_DED_COUNT), | |
| 1041 | + }, | |
| 1042 | + { "MMEA4_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1043 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIWR_DATAMEM_SEC_COUNT), | |
| 1044 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIWR_DATAMEM_DED_COUNT), | |
| 1045 | + }, | |
| 1046 | + { "MMEA4_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1047 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIRD_PAGEMEM_SED_COUNT), | |
| 1048 | + 0, 0, | |
| 1049 | + }, | |
| 1050 | + { "MMEA4_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1051 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, GMIWR_PAGEMEM_SED_COUNT), | |
| 1052 | + 0, 0, | |
| 1053 | + }, | |
| 1054 | + { "MMEA4_MAM_D0MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1055 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D0MEM_SED_COUNT), | |
| 1056 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D0MEM_DED_COUNT), | |
| 1057 | + }, | |
| 1058 | + { "MMEA4_MAM_D1MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1059 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D1MEM_SED_COUNT), | |
| 1060 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D1MEM_DED_COUNT), | |
| 1061 | + }, | |
| 1062 | + { "MMEA4_MAM_D2MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1063 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D2MEM_SED_COUNT), | |
| 1064 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D2MEM_DED_COUNT), | |
| 1065 | + }, | |
| 1066 | + { "MMEA4_MAM_D3MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), | |
| 1067 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D3MEM_SED_COUNT), | |
| 1068 | + SOC15_REG_FIELD(MMEA4_EDC_CNT2, MAM_D3MEM_DED_COUNT), | |
| 1069 | + }, | |
| 1070 | + { "MMEA4_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT3), | |
| 1071 | + 0, 0, | |
| 1072 | + SOC15_REG_FIELD(MMEA4_EDC_CNT3, DRAMRD_PAGEMEM_DED_COUNT), | |
| 1073 | + }, | |
| 1074 | + { "MMEA4_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT3), | |
| 1075 | + 0, 0, | |
| 1076 | + SOC15_REG_FIELD(MMEA4_EDC_CNT3, DRAMWR_PAGEMEM_DED_COUNT), | |
| 1077 | + }, | |
| 1078 | + { "MMEA4_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT3), | |
| 1079 | + 0, 0, | |
| 1080 | + SOC15_REG_FIELD(MMEA4_EDC_CNT3, IORD_CMDMEM_DED_COUNT), | |
| 1081 | + }, | |
| 1082 | + { "MMEA4_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT3), | |
| 1083 | + 0, 0, | |
| 1084 | + SOC15_REG_FIELD(MMEA4_EDC_CNT3, IOWR_CMDMEM_DED_COUNT), | |
| 1085 | + }, | |
| 1086 | + { "MMEA4_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT3), | |
| 1087 | + 0, 0, | |
| 1088 | + SOC15_REG_FIELD(MMEA4_EDC_CNT3, GMIRD_PAGEMEM_DED_COUNT), | |
| 1089 | + }, | |
| 1090 | + { "MMEA4_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT3), | |
| 1091 | + 0, 0, | |
| 1092 | + SOC15_REG_FIELD(MMEA4_EDC_CNT3, GMIWR_PAGEMEM_DED_COUNT), | |
| 1093 | + }, | |
| 1094 | + | |
| 1095 | + /* MMHUAB Range 5 */ | |
| 1096 | + { "MMEA5_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1097 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMRD_CMDMEM_SEC_COUNT), | |
| 1098 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMRD_CMDMEM_DED_COUNT), | |
| 1099 | + }, | |
| 1100 | + { "MMEA5_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1101 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMWR_CMDMEM_SEC_COUNT), | |
| 1102 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMWR_CMDMEM_DED_COUNT), | |
| 1103 | + }, | |
| 1104 | + { "MMEA5_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1105 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMWR_DATAMEM_SEC_COUNT), | |
| 1106 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMWR_DATAMEM_DED_COUNT), | |
| 1107 | + }, | |
| 1108 | + { "MMEA5_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1109 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, RRET_TAGMEM_SEC_COUNT), | |
| 1110 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, RRET_TAGMEM_DED_COUNT), | |
| 1111 | + }, | |
| 1112 | + { "MMEA5_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1113 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, WRET_TAGMEM_SEC_COUNT), | |
| 1114 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, WRET_TAGMEM_DED_COUNT), | |
| 1115 | + }, | |
| 1116 | + { "MMEA5_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1117 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, IOWR_DATAMEM_SEC_COUNT), | |
| 1118 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, IOWR_DATAMEM_DED_COUNT), | |
| 1119 | + }, | |
| 1120 | + { "MMEA5_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1121 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMRD_PAGEMEM_SED_COUNT), | |
| 1122 | + 0, 0, | |
| 1123 | + }, | |
| 1124 | + { "MMEA5_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1125 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, DRAMWR_PAGEMEM_SED_COUNT), | |
| 1126 | + 0, 0, | |
| 1127 | + }, | |
| 1128 | + { "MMEA5_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1129 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, IORD_CMDMEM_SED_COUNT), | |
| 1130 | + 0, 0, | |
| 1131 | + }, | |
| 1132 | + { "MMEA5_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), | |
| 1133 | + SOC15_REG_FIELD(MMEA5_EDC_CNT, IOWR_CMDMEM_SED_COUNT), | |
| 1134 | + 0, 0, | |
| 1135 | + }, | |
| 1136 | + { "MMEA5_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1137 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIRD_CMDMEM_SEC_COUNT), | |
| 1138 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIRD_CMDMEM_DED_COUNT), | |
| 1139 | + }, | |
| 1140 | + { "MMEA5_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1141 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIWR_CMDMEM_SEC_COUNT), | |
| 1142 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIWR_CMDMEM_DED_COUNT), | |
| 1143 | + }, | |
| 1144 | + { "MMEA5_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1145 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIWR_DATAMEM_SEC_COUNT), | |
| 1146 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIWR_DATAMEM_DED_COUNT), | |
| 1147 | + }, | |
| 1148 | + { "MMEA5_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1149 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIRD_PAGEMEM_SED_COUNT), | |
| 1150 | + 0, 0, | |
| 1151 | + }, | |
| 1152 | + { "MMEA5_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1153 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, GMIWR_PAGEMEM_SED_COUNT), | |
| 1154 | + 0, 0, | |
| 1155 | + }, | |
| 1156 | + { "MMEA5_MAM_D0MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1157 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D0MEM_SED_COUNT), | |
| 1158 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D0MEM_DED_COUNT), | |
| 1159 | + }, | |
| 1160 | + { "MMEA5_MAM_D1MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1161 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D1MEM_SED_COUNT), | |
| 1162 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D1MEM_DED_COUNT), | |
| 1163 | + }, | |
| 1164 | + { "MMEA5_MAM_D2MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1165 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D2MEM_SED_COUNT), | |
| 1166 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D2MEM_DED_COUNT), | |
| 1167 | + }, | |
| 1168 | + { "MMEA5_MAM_D3MEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), | |
| 1169 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D3MEM_SED_COUNT), | |
| 1170 | + SOC15_REG_FIELD(MMEA5_EDC_CNT2, MAM_D3MEM_DED_COUNT), | |
| 1171 | + }, | |
| 1172 | + { "MMEA5_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT3), | |
| 1173 | + 0, 0, | |
| 1174 | + SOC15_REG_FIELD(MMEA5_EDC_CNT3, DRAMRD_PAGEMEM_DED_COUNT), | |
| 1175 | + }, | |
| 1176 | + { "MMEA5_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT3), | |
| 1177 | + 0, 0, | |
| 1178 | + SOC15_REG_FIELD(MMEA5_EDC_CNT3, DRAMWR_PAGEMEM_DED_COUNT), | |
| 1179 | + }, | |
| 1180 | + { "MMEA5_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT3), | |
| 1181 | + 0, 0, | |
| 1182 | + SOC15_REG_FIELD(MMEA5_EDC_CNT3, IORD_CMDMEM_DED_COUNT), | |
| 1183 | + }, | |
| 1184 | + { "MMEA5_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT3), | |
| 1185 | + 0, 0, | |
| 1186 | + SOC15_REG_FIELD(MMEA5_EDC_CNT3, IOWR_CMDMEM_DED_COUNT), | |
| 1187 | + }, | |
| 1188 | + { "MMEA5_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT3), | |
| 1189 | + 0, 0, | |
| 1190 | + SOC15_REG_FIELD(MMEA5_EDC_CNT3, GMIRD_PAGEMEM_DED_COUNT), | |
| 1191 | + }, | |
| 1192 | + { "MMEA5_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT3), | |
| 1193 | + 0, 0, | |
| 1194 | + SOC15_REG_FIELD(MMEA5_EDC_CNT3, GMIWR_PAGEMEM_DED_COUNT), | |
| 1195 | + }, | |
| 1196 | +}; | |
| 1197 | + | |
| 1198 | +static const struct soc15_reg_entry mmhub_v1_7_edc_cnt_regs[] = { | |
| 1199 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT), 0, 0, 0 }, | |
| 1200 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT2), 0, 0, 0 }, | |
| 1201 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_EDC_CNT3), 0, 0, 0 }, | |
| 1202 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT), 0, 0, 0 }, | |
| 1203 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT2), 0, 0, 0 }, | |
| 1204 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_EDC_CNT3), 0, 0, 0 }, | |
| 1205 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT), 0, 0, 0 }, | |
| 1206 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT2), 0, 0, 0 }, | |
| 1207 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_EDC_CNT3), 0, 0, 0 }, | |
| 1208 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT), 0, 0, 0 }, | |
| 1209 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT2), 0, 0, 0 }, | |
| 1210 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_EDC_CNT3), 0, 0, 0 }, | |
| 1211 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT), 0, 0, 0 }, | |
| 1212 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT2), 0, 0, 0 }, | |
| 1213 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_EDC_CNT3), 0, 0, 0 }, | |
| 1214 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT), 0, 0, 0 }, | |
| 1215 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT2), 0, 0, 0 }, | |
| 1216 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_EDC_CNT3), 0, 0, 0 }, | |
| 1217 | +}; | |
| 1218 | + | |
| 1219 | +static int mmhub_v1_7_get_ras_error_count(struct amdgpu_device *adev, | |
| 1220 | + const struct soc15_reg_entry *reg, | |
| 1221 | + uint32_t value, | |
| 1222 | + uint32_t *sec_count, | |
| 1223 | + uint32_t *ded_count) | |
| 1224 | +{ | |
| 1225 | + uint32_t i; | |
| 1226 | + uint32_t sec_cnt, ded_cnt; | |
| 1227 | + | |
| 1228 | + for (i = 0; i < ARRAY_SIZE(mmhub_v1_7_ras_fields); i++) { | |
| 1229 | + if(mmhub_v1_7_ras_fields[i].reg_offset != reg->reg_offset) | |
| 1230 | + continue; | |
| 1231 | + | |
| 1232 | + sec_cnt = (value & | |
| 1233 | + mmhub_v1_7_ras_fields[i].sec_count_mask) >> | |
| 1234 | + mmhub_v1_7_ras_fields[i].sec_count_shift; | |
| 1235 | + if (sec_cnt) { | |
| 1236 | + dev_info(adev->dev, "MMHUB SubBlock %s, SEC %d\n", | |
| 1237 | + mmhub_v1_7_ras_fields[i].name, | |
| 1238 | + sec_cnt); | |
| 1239 | + *sec_count += sec_cnt; | |
| 1240 | + } | |
| 1241 | + | |
| 1242 | + ded_cnt = (value & | |
| 1243 | + mmhub_v1_7_ras_fields[i].ded_count_mask) >> | |
| 1244 | + mmhub_v1_7_ras_fields[i].ded_count_shift; | |
| 1245 | + if (ded_cnt) { | |
| 1246 | + dev_info(adev->dev, "MMHUB SubBlock %s, DED %d\n", | |
| 1247 | + mmhub_v1_7_ras_fields[i].name, | |
| 1248 | + ded_cnt); | |
| 1249 | + *ded_count += ded_cnt; | |
| 1250 | + } | |
| 1251 | + } | |
| 1252 | + | |
| 1253 | + return 0; | |
| 1254 | +} | |
| 1255 | + | |
| 1256 | +static void mmhub_v1_7_query_ras_error_count(struct amdgpu_device *adev, | |
| 1257 | + void *ras_error_status) | |
| 1258 | +{ | |
| 1259 | + struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status; | |
| 1260 | + uint32_t sec_count = 0, ded_count = 0; | |
| 1261 | + uint32_t i; | |
| 1262 | + uint32_t reg_value; | |
| 1263 | + | |
| 1264 | + err_data->ue_count = 0; | |
| 1265 | + err_data->ce_count = 0; | |
| 1266 | + | |
| 1267 | + for (i = 0; i < ARRAY_SIZE(mmhub_v1_7_edc_cnt_regs); i++) { | |
| 1268 | + reg_value = | |
| 1269 | + RREG32(SOC15_REG_ENTRY_OFFSET(mmhub_v1_7_edc_cnt_regs[i])); | |
| 1270 | + if (reg_value) | |
| 1271 | + mmhub_v1_7_get_ras_error_count(adev, &mmhub_v1_7_edc_cnt_regs[i], | |
| 1272 | + reg_value, &sec_count, &ded_count); | |
| 1273 | + } | |
| 1274 | + | |
| 1275 | + err_data->ce_count += sec_count; | |
| 1276 | + err_data->ue_count += ded_count; | |
| 1277 | +} | |
| 1278 | + | |
| 1279 | +static void mmhub_v1_7_reset_ras_error_count(struct amdgpu_device *adev) | |
| 1280 | +{ | |
| 1281 | + uint32_t i; | |
| 1282 | + | |
| 1283 | + /* write 0 to reset the edc counters */ | |
| 1284 | + if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__MMHUB)) { | |
| 1285 | + for (i = 0; i < ARRAY_SIZE(mmhub_v1_7_edc_cnt_regs); i++) | |
| 1286 | + WREG32(SOC15_REG_ENTRY_OFFSET(mmhub_v1_7_edc_cnt_regs[i]), 0); | |
| 1287 | + } | |
| 1288 | +} | |
| 1289 | + | |
| 1290 | +static const struct soc15_reg_entry mmhub_v1_7_err_status_regs[] = { | |
| 1291 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA0_ERR_STATUS), 0, 0, 0 }, | |
| 1292 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA1_ERR_STATUS), 0, 0, 0 }, | |
| 1293 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA2_ERR_STATUS), 0, 0, 0 }, | |
| 1294 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA3_ERR_STATUS), 0, 0, 0 }, | |
| 1295 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA4_ERR_STATUS), 0, 0, 0 }, | |
| 1296 | + { SOC15_REG_ENTRY(MMHUB, 0, regMMEA5_ERR_STATUS), 0, 0, 0 }, | |
| 1297 | +}; | |
| 1298 | + | |
| 1299 | +static void mmhub_v1_7_query_ras_error_status(struct amdgpu_device *adev) | |
| 1300 | +{ | |
| 1301 | + int i; | |
| 1302 | + uint32_t reg_value; | |
| 1303 | + | |
| 1304 | + if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__MMHUB)) | |
| 1305 | + return; | |
| 1306 | + | |
| 1307 | + for (i = 0; i < ARRAY_SIZE(mmhub_v1_7_err_status_regs); i++) { | |
| 1308 | + reg_value = | |
| 1309 | + RREG32(SOC15_REG_ENTRY_OFFSET(mmhub_v1_7_err_status_regs[i])); | |
| 1310 | + if (reg_value) | |
| 1311 | + dev_warn(adev->dev, "MMHUB EA err detected at instance: %d, status: 0x%x!\n", | |
| 1312 | + i, reg_value); | |
| 1313 | + } | |
| 1314 | +} | |
| 1315 | + | |
| 1316 | +const struct amdgpu_mmhub_funcs mmhub_v1_7_funcs = { | |
| 1317 | + .ras_late_init = amdgpu_mmhub_ras_late_init, | |
| 1318 | + .query_ras_error_count = mmhub_v1_7_query_ras_error_count, | |
| 1319 | + .reset_ras_error_count = mmhub_v1_7_reset_ras_error_count, | |
| 1320 | + .get_fb_location = mmhub_v1_7_get_fb_location, | |
| 1321 | + .init = mmhub_v1_7_init, | |
| 1322 | + .gart_enable = mmhub_v1_7_gart_enable, | |
| 1323 | + .set_fault_enable_default = mmhub_v1_7_set_fault_enable_default, | |
| 1324 | + .gart_disable = mmhub_v1_7_gart_disable, | |
| 1325 | + .set_clockgating = mmhub_v1_7_set_clockgating, | |
| 1326 | + .get_clockgating = mmhub_v1_7_get_clockgating, | |
| 1327 | + .setup_vm_pt_regs = mmhub_v1_7_setup_vm_pt_regs, | |
| 1328 | + .query_ras_error_status = mmhub_v1_7_query_ras_error_status, | |
| 1329 | +}; | |
| @@ -0,0 +1,28 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2016 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#ifndef __MMHUB_V1_7_H__ | |
| 24 | +#define __MMHUB_V1_7_H__ | |
| 25 | + | |
| 26 | +extern const struct amdgpu_mmhub_funcs mmhub_v1_7_funcs; | |
| 27 | + | |
| 28 | +#endif | |
| @@ -52,6 +52,20 @@ · 51 unmodified lines | ||
| 52 | 52 | #define BIF_MMSCH1_DOORBELL_RANGE__OFFSET_MASK 0x00000FFCL |
| 53 | 53 | #define BIF_MMSCH1_DOORBELL_RANGE__SIZE_MASK 0x001F0000L |
| 54 | 54 | |
| 55 | +#define BIF_MMSCH1_DOORBELL_RANGE__OFFSET_MASK 0x00000FFCL | |
| 56 | +#define BIF_MMSCH1_DOORBELL_RANGE__SIZE_MASK 0x001F0000L | |
| 57 | + | |
| 58 | +#define mmBIF_MMSCH1_DOORBELL_RANGE_ALDE 0x01d8 | |
| 59 | +#define mmBIF_MMSCH1_DOORBELL_RANGE_ALDE_BASE_IDX 2 | |
| 60 | +//BIF_MMSCH1_DOORBELL_ALDE_RANGE | |
| 61 | +#define BIF_MMSCH1_DOORBELL_RANGE_ALDE__OFFSET__SHIFT 0x2 | |
| 62 | +#define BIF_MMSCH1_DOORBELL_RANGE_ALDE__SIZE__SHIFT 0x10 | |
| 63 | +#define BIF_MMSCH1_DOORBELL_RANGE_ALDE__OFFSET_MASK 0x00000FFCL | |
| 64 | +#define BIF_MMSCH1_DOORBELL_RANGE_ALDE__SIZE_MASK 0x001F0000L | |
| 65 | + | |
| 66 | +#define mmRCC_DEV0_EPF0_STRAP0_ALDE 0x0015 | |
| 67 | +#define mmRCC_DEV0_EPF0_STRAP0_ALDE_BASE_IDX 2 | |
| 68 | + | |
| 55 | 69 | static void nbio_v7_4_query_ras_error_count(struct amdgpu_device *adev, |
| 56 | 70 | void *ras_error_status); |
| 57 | 71 | |
| @@ -65,7 +79,12 @@ static void nbio_v7_4_remap_hdp_registers(struct amdgpu_device *adev) · 7 unmodified lines | ||
| 65 | 79 | |
| 66 | 80 | static u32 nbio_v7_4_get_rev_id(struct amdgpu_device *adev) |
| 67 | 81 | { |
| 68 | − u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0); | |
| 82 | + u32 tmp; | |
| 83 | + | |
| 84 | + if (adev->asic_type == CHIP_ALDEBARAN) | |
| 85 | + tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0_ALDE); | |
| 86 | + else | |
| 87 | + tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0); | |
| 69 | 88 | |
| 70 | 89 | tmp &= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0_MASK; |
| 71 | 90 | tmp >>= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0__SHIFT; |
| @@ -92,10 +111,10 @@ static void nbio_v7_4_sdma_doorbell_range(struct amdgpu_device *adev, int instan · 20 unmodified lines | ||
| 92 | 111 | { |
| 93 | 112 | u32 reg, doorbell_range; |
| 94 | 113 | |
| 95 | − if (instance < 2) | |
| 114 | + if (instance < 2) { | |
| 96 | 115 | reg = instance + |
| 97 | 116 | SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE); |
| 98 | − else | |
| 117 | + } else { | |
| 99 | 118 | /* |
| 100 | 119 | * These registers address of SDMA2~7 is not consecutive |
| 101 | 120 | * from SDMA0~1. Need plus 4 dwords offset. |
| @@ -103,9 +122,19 @@ static void nbio_v7_4_sdma_doorbell_range(struct amdgpu_device *adev, int instan · 1 unmodified line | ||
| 103 | 122 | * BIF_SDMA0_DOORBELL_RANGE: 0x3bc0 |
| 104 | 123 | * BIF_SDMA1_DOORBELL_RANGE: 0x3bc4 |
| 105 | 124 | * BIF_SDMA2_DOORBELL_RANGE: 0x3bd8 |
| 125 | ++ * BIF_SDMA4_DOORBELL_RANGE: | |
| 126 | ++ * ARCTURUS: 0x3be0 | |
| 127 | ++ * ALDEBARAN: 0x3be4 | |
| 106 | 128 | */ |
| 107 | − reg = instance + 0x4 + | |
| 108 | − SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE); | |
| 129 | + if (adev->asic_type == CHIP_ALDEBARAN && instance == 4) | |
| 130 | + reg = instance + 0x4 + 0x1 + | |
| 131 | + SOC15_REG_OFFSET(NBIO, 0, | |
| 132 | + mmBIF_SDMA0_DOORBELL_RANGE); | |
| 133 | + else | |
| 134 | + reg = instance + 0x4 + | |
| 135 | + SOC15_REG_OFFSET(NBIO, 0, | |
| 136 | + mmBIF_SDMA0_DOORBELL_RANGE); | |
| 137 | + } | |
| 109 | 138 | |
| 110 | 139 | doorbell_range = RREG32(reg); |
| 111 | 140 | |
| @@ -124,9 +153,12 @@ static void nbio_v7_4_vcn_doorbell_range(struct amdgpu_device *adev, bool use_do · 12 unmodified lines | ||
| 124 | 153 | u32 reg; |
| 125 | 154 | u32 doorbell_range; |
| 126 | 155 | |
| 127 | − if (instance) | |
| 128 | − reg = SOC15_REG_OFFSET(NBIO, 0, mmBIF_MMSCH1_DOORBELL_RANGE); | |
| 129 | − else | |
| 156 | + if (instance) { | |
| 157 | + if (adev->asic_type == CHIP_ALDEBARAN) | |
| 158 | + reg = SOC15_REG_OFFSET(NBIO, 0, mmBIF_MMSCH1_DOORBELL_RANGE_ALDE); | |
| 159 | + else | |
| 160 | + reg = SOC15_REG_OFFSET(NBIO, 0, mmBIF_MMSCH1_DOORBELL_RANGE); | |
| 161 | + } else | |
| 130 | 162 | reg = SOC15_REG_OFFSET(NBIO, 0, mmBIF_MMSCH0_DOORBELL_RANGE); |
| 131 | 163 | |
| 132 | 164 | doorbell_range = RREG32(reg); |
| @@ -25,6 +25,8 @@ · 24 unmodified lines | ||
| 25 | 25 | #include <linux/module.h> |
| 26 | 26 | #include <linux/pci.h> |
| 27 | 27 | |
| 28 | +#include <drm/amdgpu_drm.h> | |
| 29 | + | |
| 28 | 30 | #include "amdgpu.h" |
| 29 | 31 | #include "amdgpu_atombios.h" |
| 30 | 32 | #include "amdgpu_ih.h" |
| @@ -65,6 +67,184 @@ · 34 unmodified lines | ||
| 65 | 67 | |
| 66 | 68 | static const struct amd_ip_funcs nv_common_ip_funcs; |
| 67 | 69 | |
| 70 | +/* Navi */ | |
| 71 | +static const struct amdgpu_video_codec_info nv_video_codecs_encode_array[] = | |
| 72 | +{ | |
| 73 | + { | |
| 74 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 75 | + .max_width = 4096, | |
| 76 | + .max_height = 2304, | |
| 77 | + .max_pixels_per_frame = 4096 * 2304, | |
| 78 | + .max_level = 0, | |
| 79 | + }, | |
| 80 | + { | |
| 81 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 82 | + .max_width = 4096, | |
| 83 | + .max_height = 2304, | |
| 84 | + .max_pixels_per_frame = 4096 * 2304, | |
| 85 | + .max_level = 0, | |
| 86 | + }, | |
| 87 | +}; | |
| 88 | + | |
| 89 | +static const struct amdgpu_video_codecs nv_video_codecs_encode = | |
| 90 | +{ | |
| 91 | + .codec_count = ARRAY_SIZE(nv_video_codecs_encode_array), | |
| 92 | + .codec_array = nv_video_codecs_encode_array, | |
| 93 | +}; | |
| 94 | + | |
| 95 | +/* Navi1x */ | |
| 96 | +static const struct amdgpu_video_codec_info nv_video_codecs_decode_array[] = | |
| 97 | +{ | |
| 98 | + { | |
| 99 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 100 | + .max_width = 4096, | |
| 101 | + .max_height = 4096, | |
| 102 | + .max_pixels_per_frame = 4096 * 4096, | |
| 103 | + .max_level = 3, | |
| 104 | + }, | |
| 105 | + { | |
| 106 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 107 | + .max_width = 4096, | |
| 108 | + .max_height = 4096, | |
| 109 | + .max_pixels_per_frame = 4096 * 4096, | |
| 110 | + .max_level = 5, | |
| 111 | + }, | |
| 112 | + { | |
| 113 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 114 | + .max_width = 4096, | |
| 115 | + .max_height = 4096, | |
| 116 | + .max_pixels_per_frame = 4096 * 4096, | |
| 117 | + .max_level = 52, | |
| 118 | + }, | |
| 119 | + { | |
| 120 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 121 | + .max_width = 4096, | |
| 122 | + .max_height = 4096, | |
| 123 | + .max_pixels_per_frame = 4096 * 4096, | |
| 124 | + .max_level = 4, | |
| 125 | + }, | |
| 126 | + { | |
| 127 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 128 | + .max_width = 8192, | |
| 129 | + .max_height = 4352, | |
| 130 | + .max_pixels_per_frame = 8192 * 4352, | |
| 131 | + .max_level = 186, | |
| 132 | + }, | |
| 133 | + { | |
| 134 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, | |
| 135 | + .max_width = 4096, | |
| 136 | + .max_height = 4096, | |
| 137 | + .max_pixels_per_frame = 4096 * 4096, | |
| 138 | + .max_level = 0, | |
| 139 | + }, | |
| 140 | + { | |
| 141 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, | |
| 142 | + .max_width = 8192, | |
| 143 | + .max_height = 4352, | |
| 144 | + .max_pixels_per_frame = 8192 * 4352, | |
| 145 | + .max_level = 0, | |
| 146 | + }, | |
| 147 | +}; | |
| 148 | + | |
| 149 | +static const struct amdgpu_video_codecs nv_video_codecs_decode = | |
| 150 | +{ | |
| 151 | + .codec_count = ARRAY_SIZE(nv_video_codecs_decode_array), | |
| 152 | + .codec_array = nv_video_codecs_decode_array, | |
| 153 | +}; | |
| 154 | + | |
| 155 | +/* Sienna Cichlid */ | |
| 156 | +static const struct amdgpu_video_codec_info sc_video_codecs_decode_array[] = | |
| 157 | +{ | |
| 158 | + { | |
| 159 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 160 | + .max_width = 4096, | |
| 161 | + .max_height = 4096, | |
| 162 | + .max_pixels_per_frame = 4096 * 4096, | |
| 163 | + .max_level = 3, | |
| 164 | + }, | |
| 165 | + { | |
| 166 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 167 | + .max_width = 4096, | |
| 168 | + .max_height = 4096, | |
| 169 | + .max_pixels_per_frame = 4096 * 4096, | |
| 170 | + .max_level = 5, | |
| 171 | + }, | |
| 172 | + { | |
| 173 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 174 | + .max_width = 4096, | |
| 175 | + .max_height = 4096, | |
| 176 | + .max_pixels_per_frame = 4096 * 4096, | |
| 177 | + .max_level = 52, | |
| 178 | + }, | |
| 179 | + { | |
| 180 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 181 | + .max_width = 4096, | |
| 182 | + .max_height = 4096, | |
| 183 | + .max_pixels_per_frame = 4096 * 4096, | |
| 184 | + .max_level = 4, | |
| 185 | + }, | |
| 186 | + { | |
| 187 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 188 | + .max_width = 8192, | |
| 189 | + .max_height = 4352, | |
| 190 | + .max_pixels_per_frame = 8192 * 4352, | |
| 191 | + .max_level = 186, | |
| 192 | + }, | |
| 193 | + { | |
| 194 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, | |
| 195 | + .max_width = 4096, | |
| 196 | + .max_height = 4096, | |
| 197 | + .max_pixels_per_frame = 4096 * 4096, | |
| 198 | + .max_level = 0, | |
| 199 | + }, | |
| 200 | + { | |
| 201 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, | |
| 202 | + .max_width = 8192, | |
| 203 | + .max_height = 4352, | |
| 204 | + .max_pixels_per_frame = 8192 * 4352, | |
| 205 | + .max_level = 0, | |
| 206 | + }, | |
| 207 | + { | |
| 208 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, | |
| 209 | + .max_width = 8192, | |
| 210 | + .max_height = 4352, | |
| 211 | + .max_pixels_per_frame = 8192 * 4352, | |
| 212 | + .max_level = 0, | |
| 213 | + }, | |
| 214 | +}; | |
| 215 | + | |
| 216 | +static const struct amdgpu_video_codecs sc_video_codecs_decode = | |
| 217 | +{ | |
| 218 | + .codec_count = ARRAY_SIZE(sc_video_codecs_decode_array), | |
| 219 | + .codec_array = sc_video_codecs_decode_array, | |
| 220 | +}; | |
| 221 | + | |
| 222 | +static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode, | |
| 223 | + const struct amdgpu_video_codecs **codecs) | |
| 224 | +{ | |
| 225 | + switch (adev->asic_type) { | |
| 226 | + case CHIP_SIENNA_CICHLID: | |
| 227 | + case CHIP_NAVY_FLOUNDER: | |
| 228 | + case CHIP_DIMGREY_CAVEFISH: | |
| 229 | + case CHIP_VANGOGH: | |
| 230 | + if (encode) | |
| 231 | + *codecs = &nv_video_codecs_encode; | |
| 232 | + else | |
| 233 | + *codecs = &sc_video_codecs_decode; | |
| 234 | + return 0; | |
| 235 | + case CHIP_NAVI10: | |
| 236 | + case CHIP_NAVI14: | |
| 237 | + case CHIP_NAVI12: | |
| 238 | + if (encode) | |
| 239 | + *codecs = &nv_video_codecs_encode; | |
| 240 | + else | |
| 241 | + *codecs = &nv_video_codecs_decode; | |
| 242 | + return 0; | |
| 243 | + default: | |
| 244 | + return -EINVAL; | |
| 245 | + } | |
| 246 | +} | |
| 247 | + | |
| 68 | 248 | /* |
| 69 | 249 | * Indirect registers accessor |
| 70 | 250 | */ |
| @@ -304,44 +484,6 @@ static int nv_read_register(struct amdgpu_device *adev, u32 se_num, · 233 unmodified lines | ||
| 304 | 484 | return -EINVAL; |
| 305 | 485 | } |
| 306 | 486 | |
| 307 | −static int nv_asic_mode1_reset(struct amdgpu_device *adev) | |
| 308 | −{ | |
| 309 | − u32 i; | |
| 310 | − int ret = 0; | |
| 311 | − | |
| 312 | − amdgpu_atombios_scratch_regs_engine_hung(adev, true); | |
| 313 | − | |
| 314 | − /* disable BM */ | |
| 315 | − pci_clear_master(adev->pdev); | |
| 316 | − | |
| 317 | − amdgpu_device_cache_pci_state(adev->pdev); | |
| 318 | − | |
| 319 | − if (amdgpu_dpm_is_mode1_reset_supported(adev)) { | |
| 320 | − dev_info(adev->dev, "GPU smu mode1 reset\n"); | |
| 321 | − ret = amdgpu_dpm_mode1_reset(adev); | |
| 322 | − } else { | |
| 323 | − dev_info(adev->dev, "GPU psp mode1 reset\n"); | |
| 324 | − ret = psp_gpu_reset(adev); | |
| 325 | − } | |
| 326 | − | |
| 327 | − if (ret) | |
| 328 | − dev_err(adev->dev, "GPU mode1 reset failed\n"); | |
| 329 | − amdgpu_device_load_pci_state(adev->pdev); | |
| 330 | − | |
| 331 | − /* wait for asic to come out of reset */ | |
| 332 | − for (i = 0; i < adev->usec_timeout; i++) { | |
| 333 | − u32 memsize = adev->nbio.funcs->get_memsize(adev); | |
| 334 | − | |
| 335 | − if (memsize != 0xffffffff) | |
| 336 | − break; | |
| 337 | − udelay(1); | |
| 338 | − } | |
| 339 | − | |
| 340 | − amdgpu_atombios_scratch_regs_engine_hung(adev, false); | |
| 341 | − | |
| 342 | − return ret; | |
| 343 | −} | |
| 344 | − | |
| 345 | 487 | static int nv_asic_mode2_reset(struct amdgpu_device *adev) |
| 346 | 488 | { |
| 347 | 489 | u32 i; |
| @@ -444,7 +586,7 @@ static int nv_asic_reset(struct amdgpu_device *adev) · 96 unmodified lines | ||
| 444 | 586 | break; |
| 445 | 587 | default: |
| 446 | 588 | dev_info(adev->dev, "MODE1 reset\n"); |
| 447 | − ret = nv_asic_mode1_reset(adev); | |
| 589 | + ret = amdgpu_device_mode1_reset(adev); | |
| 448 | 590 | break; |
| 449 | 591 | } |
| 450 | 592 | |
| @@ -847,6 +989,7 @@ static const struct amdgpu_asic_funcs nv_asic_funcs = · 396 unmodified lines | ||
| 847 | 989 | .supports_baco = &nv_asic_supports_baco, |
| 848 | 990 | .pre_asic_init = &nv_pre_asic_init, |
| 849 | 991 | .update_umd_stable_pstate = &nv_update_umd_stable_pstate, |
| 992 | + .query_video_codecs = &nv_query_video_codecs, | |
| 850 | 993 | }; |
| 851 | 994 | |
| 852 | 995 | static int nv_common_early_init(void *handle) |
| @@ -235,6 +235,7 @@ enum psp_gfx_fw_type { · 234 unmodified lines | ||
| 235 | 235 | GFX_FW_TYPE_SDMA6 = 56, /* SDMA6 MI */ |
| 236 | 236 | GFX_FW_TYPE_SDMA7 = 57, /* SDMA7 MI */ |
| 237 | 237 | GFX_FW_TYPE_VCN1 = 58, /* VCN1 MI */ |
| 238 | + GFX_FW_TYPE_REG_LIST = 67, /* REG_LIST MI */ | |
| 238 | 239 | GFX_FW_TYPE_MAX |
| 239 | 240 | }; |
| 240 | 241 | |
| @@ -0,0 +1,378 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#include "amdgpu.h" | |
| 24 | +#include "amdgpu_psp.h" | |
| 25 | +#include "amdgpu_ucode.h" | |
| 26 | +#include "soc15_common.h" | |
| 27 | +#include "psp_v13_0.h" | |
| 28 | + | |
| 29 | +#include "mp/mp_13_0_2_offset.h" | |
| 30 | +#include "mp/mp_13_0_2_sh_mask.h" | |
| 31 | + | |
| 32 | +MODULE_FIRMWARE("amdgpu/aldebaran_sos.bin"); | |
| 33 | +MODULE_FIRMWARE("amdgpu/aldebaran_ta.bin"); | |
| 34 | + | |
| 35 | +static int psp_v13_0_init_microcode(struct psp_context *psp) | |
| 36 | +{ | |
| 37 | + struct amdgpu_device *adev = psp->adev; | |
| 38 | + const char *chip_name; | |
| 39 | + int err = 0; | |
| 40 | + | |
| 41 | + switch (adev->asic_type) { | |
| 42 | + case CHIP_ALDEBARAN: | |
| 43 | + chip_name = "aldebaran"; | |
| 44 | + break; | |
| 45 | + default: | |
| 46 | + BUG(); | |
| 47 | + } | |
| 48 | + | |
| 49 | + err = psp_init_sos_microcode(psp, chip_name); | |
| 50 | + if (err) | |
| 51 | + return err; | |
| 52 | + | |
| 53 | + err = psp_init_ta_microcode(&adev->psp, chip_name); | |
| 54 | + | |
| 55 | + return err; | |
| 56 | +} | |
| 57 | + | |
| 58 | +static bool psp_v13_0_is_sos_alive(struct psp_context *psp) | |
| 59 | +{ | |
| 60 | + struct amdgpu_device *adev = psp->adev; | |
| 61 | + uint32_t sol_reg; | |
| 62 | + | |
| 63 | + sol_reg = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81); | |
| 64 | + | |
| 65 | + return sol_reg != 0x0; | |
| 66 | +} | |
| 67 | + | |
| 68 | +static int psp_v13_0_wait_for_bootloader(struct psp_context *psp) | |
| 69 | +{ | |
| 70 | + struct amdgpu_device *adev = psp->adev; | |
| 71 | + | |
| 72 | + int ret; | |
| 73 | + int retry_loop; | |
| 74 | + | |
| 75 | + for (retry_loop = 0; retry_loop < 10; retry_loop++) { | |
| 76 | + /* Wait for bootloader to signify that is | |
| 77 | + ready having bit 31 of C2PMSG_35 set to 1 */ | |
| 78 | + ret = psp_wait_for(psp, | |
| 79 | + SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_35), | |
| 80 | + 0x80000000, | |
| 81 | + 0x80000000, | |
| 82 | + false); | |
| 83 | + | |
| 84 | + if (ret == 0) | |
| 85 | + return 0; | |
| 86 | + } | |
| 87 | + | |
| 88 | + return ret; | |
| 89 | +} | |
| 90 | + | |
| 91 | +static int psp_v13_0_bootloader_load_kdb(struct psp_context *psp) | |
| 92 | +{ | |
| 93 | + int ret; | |
| 94 | + uint32_t psp_gfxdrv_command_reg = 0; | |
| 95 | + struct amdgpu_device *adev = psp->adev; | |
| 96 | + | |
| 97 | + /* Check tOS sign of life register to confirm sys driver and sOS | |
| 98 | + * are already been loaded. | |
| 99 | + */ | |
| 100 | + if (psp_v13_0_is_sos_alive(psp)) | |
| 101 | + return 0; | |
| 102 | + | |
| 103 | + ret = psp_v13_0_wait_for_bootloader(psp); | |
| 104 | + if (ret) | |
| 105 | + return ret; | |
| 106 | + | |
| 107 | + memset(psp->fw_pri_buf, 0, PSP_1_MEG); | |
| 108 | + | |
| 109 | + /* Copy PSP KDB binary to memory */ | |
| 110 | + memcpy(psp->fw_pri_buf, psp->kdb_start_addr, psp->kdb_bin_size); | |
| 111 | + | |
| 112 | + /* Provide the PSP KDB to bootloader */ | |
| 113 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36, | |
| 114 | + (uint32_t)(psp->fw_pri_mc_addr >> 20)); | |
| 115 | + psp_gfxdrv_command_reg = PSP_BL__LOAD_KEY_DATABASE; | |
| 116 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35, | |
| 117 | + psp_gfxdrv_command_reg); | |
| 118 | + | |
| 119 | + ret = psp_v13_0_wait_for_bootloader(psp); | |
| 120 | + | |
| 121 | + return ret; | |
| 122 | +} | |
| 123 | + | |
| 124 | +static int psp_v13_0_bootloader_load_sysdrv(struct psp_context *psp) | |
| 125 | +{ | |
| 126 | + int ret; | |
| 127 | + uint32_t psp_gfxdrv_command_reg = 0; | |
| 128 | + struct amdgpu_device *adev = psp->adev; | |
| 129 | + | |
| 130 | + /* Check sOS sign of life register to confirm sys driver and sOS | |
| 131 | + * are already been loaded. | |
| 132 | + */ | |
| 133 | + if (psp_v13_0_is_sos_alive(psp)) | |
| 134 | + return 0; | |
| 135 | + | |
| 136 | + ret = psp_v13_0_wait_for_bootloader(psp); | |
| 137 | + if (ret) | |
| 138 | + return ret; | |
| 139 | + | |
| 140 | + memset(psp->fw_pri_buf, 0, PSP_1_MEG); | |
| 141 | + | |
| 142 | + /* Copy PSP System Driver binary to memory */ | |
| 143 | + memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size); | |
| 144 | + | |
| 145 | + /* Provide the sys driver to bootloader */ | |
| 146 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36, | |
| 147 | + (uint32_t)(psp->fw_pri_mc_addr >> 20)); | |
| 148 | + psp_gfxdrv_command_reg = PSP_BL__LOAD_SYSDRV; | |
| 149 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35, | |
| 150 | + psp_gfxdrv_command_reg); | |
| 151 | + | |
| 152 | + /* there might be handshake issue with hardware which needs delay */ | |
| 153 | + mdelay(20); | |
| 154 | + | |
| 155 | + ret = psp_v13_0_wait_for_bootloader(psp); | |
| 156 | + | |
| 157 | + return ret; | |
| 158 | +} | |
| 159 | + | |
| 160 | +static int psp_v13_0_bootloader_load_sos(struct psp_context *psp) | |
| 161 | +{ | |
| 162 | + int ret; | |
| 163 | + unsigned int psp_gfxdrv_command_reg = 0; | |
| 164 | + struct amdgpu_device *adev = psp->adev; | |
| 165 | + | |
| 166 | + /* Check sOS sign of life register to confirm sys driver and sOS | |
| 167 | + * are already been loaded. | |
| 168 | + */ | |
| 169 | + if (psp_v13_0_is_sos_alive(psp)) | |
| 170 | + return 0; | |
| 171 | + | |
| 172 | + ret = psp_v13_0_wait_for_bootloader(psp); | |
| 173 | + if (ret) | |
| 174 | + return ret; | |
| 175 | + | |
| 176 | + memset(psp->fw_pri_buf, 0, PSP_1_MEG); | |
| 177 | + | |
| 178 | + /* Copy Secure OS binary to PSP memory */ | |
| 179 | + memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size); | |
| 180 | + | |
| 181 | + /* Provide the PSP secure OS to bootloader */ | |
| 182 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_36, | |
| 183 | + (uint32_t)(psp->fw_pri_mc_addr >> 20)); | |
| 184 | + psp_gfxdrv_command_reg = PSP_BL__LOAD_SOSDRV; | |
| 185 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_35, | |
| 186 | + psp_gfxdrv_command_reg); | |
| 187 | + | |
| 188 | + /* there might be handshake issue with hardware which needs delay */ | |
| 189 | + mdelay(20); | |
| 190 | + ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_81), | |
| 191 | + RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_81), | |
| 192 | + 0, true); | |
| 193 | + | |
| 194 | + return ret; | |
| 195 | +} | |
| 196 | + | |
| 197 | +static int psp_v13_0_ring_init(struct psp_context *psp, | |
| 198 | + enum psp_ring_type ring_type) | |
| 199 | +{ | |
| 200 | + int ret = 0; | |
| 201 | + struct psp_ring *ring; | |
| 202 | + struct amdgpu_device *adev = psp->adev; | |
| 203 | + | |
| 204 | + ring = &psp->km_ring; | |
| 205 | + | |
| 206 | + ring->ring_type = ring_type; | |
| 207 | + | |
| 208 | + /* allocate 4k Page of Local Frame Buffer memory for ring */ | |
| 209 | + ring->ring_size = 0x1000; | |
| 210 | + ret = amdgpu_bo_create_kernel(adev, ring->ring_size, PAGE_SIZE, | |
| 211 | + AMDGPU_GEM_DOMAIN_VRAM, | |
| 212 | + &adev->firmware.rbuf, | |
| 213 | + &ring->ring_mem_mc_addr, | |
| 214 | + (void **)&ring->ring_mem); | |
| 215 | + if (ret) { | |
| 216 | + ring->ring_size = 0; | |
| 217 | + return ret; | |
| 218 | + } | |
| 219 | + | |
| 220 | + return 0; | |
| 221 | +} | |
| 222 | + | |
| 223 | +static int psp_v13_0_ring_stop(struct psp_context *psp, | |
| 224 | + enum psp_ring_type ring_type) | |
| 225 | +{ | |
| 226 | + int ret = 0; | |
| 227 | + struct amdgpu_device *adev = psp->adev; | |
| 228 | + | |
| 229 | + if (amdgpu_sriov_vf(adev)) { | |
| 230 | + /* Write the ring destroy command*/ | |
| 231 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_101, | |
| 232 | + GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING); | |
| 233 | + /* there might be handshake issue with hardware which needs delay */ | |
| 234 | + mdelay(20); | |
| 235 | + /* Wait for response flag (bit 31) */ | |
| 236 | + ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_101), | |
| 237 | + 0x80000000, 0x80000000, false); | |
| 238 | + } else { | |
| 239 | + /* Write the ring destroy command*/ | |
| 240 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_64, | |
| 241 | + GFX_CTRL_CMD_ID_DESTROY_RINGS); | |
| 242 | + /* there might be handshake issue with hardware which needs delay */ | |
| 243 | + mdelay(20); | |
| 244 | + /* Wait for response flag (bit 31) */ | |
| 245 | + ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_64), | |
| 246 | + 0x80000000, 0x80000000, false); | |
| 247 | + } | |
| 248 | + | |
| 249 | + return ret; | |
| 250 | +} | |
| 251 | + | |
| 252 | +static int psp_v13_0_ring_create(struct psp_context *psp, | |
| 253 | + enum psp_ring_type ring_type) | |
| 254 | +{ | |
| 255 | + int ret = 0; | |
| 256 | + unsigned int psp_ring_reg = 0; | |
| 257 | + struct psp_ring *ring = &psp->km_ring; | |
| 258 | + struct amdgpu_device *adev = psp->adev; | |
| 259 | + | |
| 260 | + if (amdgpu_sriov_vf(adev)) { | |
| 261 | + ret = psp_v13_0_ring_stop(psp, ring_type); | |
| 262 | + if (ret) { | |
| 263 | + DRM_ERROR("psp_v13_0_ring_stop_sriov failed!\n"); | |
| 264 | + return ret; | |
| 265 | + } | |
| 266 | + | |
| 267 | + /* Write low address of the ring to C2PMSG_102 */ | |
| 268 | + psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr); | |
| 269 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_102, psp_ring_reg); | |
| 270 | + /* Write high address of the ring to C2PMSG_103 */ | |
| 271 | + psp_ring_reg = upper_32_bits(ring->ring_mem_mc_addr); | |
| 272 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_103, psp_ring_reg); | |
| 273 | + | |
| 274 | + /* Write the ring initialization command to C2PMSG_101 */ | |
| 275 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_101, | |
| 276 | + GFX_CTRL_CMD_ID_INIT_GPCOM_RING); | |
| 277 | + | |
| 278 | + /* there might be handshake issue with hardware which needs delay */ | |
| 279 | + mdelay(20); | |
| 280 | + | |
| 281 | + /* Wait for response flag (bit 31) in C2PMSG_101 */ | |
| 282 | + ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_101), | |
| 283 | + 0x80000000, 0x8000FFFF, false); | |
| 284 | + | |
| 285 | + } else { | |
| 286 | + /* Wait for sOS ready for ring creation */ | |
| 287 | + ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_64), | |
| 288 | + 0x80000000, 0x80000000, false); | |
| 289 | + if (ret) { | |
| 290 | + DRM_ERROR("Failed to wait for trust OS ready for ring creation\n"); | |
| 291 | + return ret; | |
| 292 | + } | |
| 293 | + | |
| 294 | + /* Write low address of the ring to C2PMSG_69 */ | |
| 295 | + psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr); | |
| 296 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_69, psp_ring_reg); | |
| 297 | + /* Write high address of the ring to C2PMSG_70 */ | |
| 298 | + psp_ring_reg = upper_32_bits(ring->ring_mem_mc_addr); | |
| 299 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_70, psp_ring_reg); | |
| 300 | + /* Write size of ring to C2PMSG_71 */ | |
| 301 | + psp_ring_reg = ring->ring_size; | |
| 302 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_71, psp_ring_reg); | |
| 303 | + /* Write the ring initialization command to C2PMSG_64 */ | |
| 304 | + psp_ring_reg = ring_type; | |
| 305 | + psp_ring_reg = psp_ring_reg << 16; | |
| 306 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_64, psp_ring_reg); | |
| 307 | + | |
| 308 | + /* there might be handshake issue with hardware which needs delay */ | |
| 309 | + mdelay(20); | |
| 310 | + | |
| 311 | + /* Wait for response flag (bit 31) in C2PMSG_64 */ | |
| 312 | + ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, regMP0_SMN_C2PMSG_64), | |
| 313 | + 0x80000000, 0x8000FFFF, false); | |
| 314 | + } | |
| 315 | + | |
| 316 | + return ret; | |
| 317 | +} | |
| 318 | + | |
| 319 | +static int psp_v13_0_ring_destroy(struct psp_context *psp, | |
| 320 | + enum psp_ring_type ring_type) | |
| 321 | +{ | |
| 322 | + int ret = 0; | |
| 323 | + struct psp_ring *ring = &psp->km_ring; | |
| 324 | + struct amdgpu_device *adev = psp->adev; | |
| 325 | + | |
| 326 | + ret = psp_v13_0_ring_stop(psp, ring_type); | |
| 327 | + if (ret) | |
| 328 | + DRM_ERROR("Fail to stop psp ring\n"); | |
| 329 | + | |
| 330 | + amdgpu_bo_free_kernel(&adev->firmware.rbuf, | |
| 331 | + &ring->ring_mem_mc_addr, | |
| 332 | + (void **)&ring->ring_mem); | |
| 333 | + | |
| 334 | + return ret; | |
| 335 | +} | |
| 336 | + | |
| 337 | +static uint32_t psp_v13_0_ring_get_wptr(struct psp_context *psp) | |
| 338 | +{ | |
| 339 | + uint32_t data; | |
| 340 | + struct amdgpu_device *adev = psp->adev; | |
| 341 | + | |
| 342 | + if (amdgpu_sriov_vf(adev)) | |
| 343 | + data = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_102); | |
| 344 | + else | |
| 345 | + data = RREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_67); | |
| 346 | + | |
| 347 | + return data; | |
| 348 | +} | |
| 349 | + | |
| 350 | +static void psp_v13_0_ring_set_wptr(struct psp_context *psp, uint32_t value) | |
| 351 | +{ | |
| 352 | + struct amdgpu_device *adev = psp->adev; | |
| 353 | + | |
| 354 | + if (amdgpu_sriov_vf(adev)) { | |
| 355 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_102, value); | |
| 356 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_101, | |
| 357 | + GFX_CTRL_CMD_ID_CONSUME_CMD); | |
| 358 | + } else | |
| 359 | + WREG32_SOC15(MP0, 0, regMP0_SMN_C2PMSG_67, value); | |
| 360 | +} | |
| 361 | + | |
| 362 | +static const struct psp_funcs psp_v13_0_funcs = { | |
| 363 | + .init_microcode = psp_v13_0_init_microcode, | |
| 364 | + .bootloader_load_kdb = psp_v13_0_bootloader_load_kdb, | |
| 365 | + .bootloader_load_sysdrv = psp_v13_0_bootloader_load_sysdrv, | |
| 366 | + .bootloader_load_sos = psp_v13_0_bootloader_load_sos, | |
| 367 | + .ring_init = psp_v13_0_ring_init, | |
| 368 | + .ring_create = psp_v13_0_ring_create, | |
| 369 | + .ring_stop = psp_v13_0_ring_stop, | |
| 370 | + .ring_destroy = psp_v13_0_ring_destroy, | |
| 371 | + .ring_get_wptr = psp_v13_0_ring_get_wptr, | |
| 372 | + .ring_set_wptr = psp_v13_0_ring_set_wptr, | |
| 373 | +}; | |
| 374 | + | |
| 375 | +void psp_v13_0_set_psp_funcs(struct psp_context *psp) | |
| 376 | +{ | |
| 377 | + psp->funcs = &psp_v13_0_funcs; | |
| 378 | +} | |
| @@ -0,0 +1,30 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#ifndef __PSP_V13_0_H__ | |
| 24 | +#define __PSP_V13_0_H__ | |
| 25 | + | |
| 26 | +#include "amdgpu_psp.h" | |
| 27 | + | |
| 28 | +void psp_v13_0_set_psp_funcs(struct psp_context *psp); | |
| 29 | + | |
| 30 | +#endif | |
| @@ -56,6 +56,7 @@ · 55 unmodified lines | ||
| 56 | 56 | #include "ivsrcid/sdma1/irqsrcs_sdma1_4_0.h" |
| 57 | 57 | |
| 58 | 58 | #include "amdgpu_ras.h" |
| 59 | +#include "sdma_v4_4.h" | |
| 59 | 60 | |
| 60 | 61 | MODULE_FIRMWARE("amdgpu/vega10_sdma.bin"); |
| 61 | 62 | MODULE_FIRMWARE("amdgpu/vega10_sdma1.bin"); |
| @@ -69,6 +70,7 @@ MODULE_FIRMWARE("amdgpu/raven2_sdma.bin"); · 7 unmodified lines | ||
| 69 | 70 | MODULE_FIRMWARE("amdgpu/arcturus_sdma.bin"); |
| 70 | 71 | MODULE_FIRMWARE("amdgpu/renoir_sdma.bin"); |
| 71 | 72 | MODULE_FIRMWARE("amdgpu/green_sardine_sdma.bin"); |
| 73 | +MODULE_FIRMWARE("amdgpu/aldebaran_sdma.bin"); | |
| 72 | 74 | |
| 73 | 75 | #define SDMA0_POWER_CNTL__ON_OFF_CONDITION_HOLD_TIME_MASK 0x000000F8L |
| 74 | 76 | #define SDMA0_POWER_CNTL__ON_OFF_STATUS_DURATION_TIME_MASK 0xFC000000L |
| @@ -259,6 +261,24 @@ static const struct soc15_reg_golden golden_settings_sdma_arct[] = · 184 unmodified lines | ||
| 259 | 261 | SOC15_REG_GOLDEN_VALUE(SDMA7, 0, mmSDMA7_UTCL1_TIMEOUT, 0xffffffff, 0x00010001) |
| 260 | 262 | }; |
| 261 | 263 | |
| 264 | +static const struct soc15_reg_golden golden_settings_sdma_aldebaran[] = { | |
| 265 | + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | |
| 266 | + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), | |
| 267 | + SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_UTCL1_TIMEOUT, 0xffffffff, 0x00010001), | |
| 268 | + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | |
| 269 | + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), | |
| 270 | + SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_UTCL1_TIMEOUT, 0xffffffff, 0x00010001), | |
| 271 | + SOC15_REG_GOLDEN_VALUE(SDMA2, 0, mmSDMA2_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | |
| 272 | + SOC15_REG_GOLDEN_VALUE(SDMA2, 0, mmSDMA2_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), | |
| 273 | + SOC15_REG_GOLDEN_VALUE(SDMA3, 0, mmSDMA2_UTCL1_TIMEOUT, 0xffffffff, 0x00010001), | |
| 274 | + SOC15_REG_GOLDEN_VALUE(SDMA3, 0, mmSDMA3_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | |
| 275 | + SOC15_REG_GOLDEN_VALUE(SDMA3, 0, mmSDMA3_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), | |
| 276 | + SOC15_REG_GOLDEN_VALUE(SDMA3, 0, mmSDMA3_UTCL1_TIMEOUT, 0xffffffff, 0x00010001), | |
| 277 | + SOC15_REG_GOLDEN_VALUE(SDMA4, 0, mmSDMA4_GB_ADDR_CONFIG, 0x0018773f, 0x00104002), | |
| 278 | + SOC15_REG_GOLDEN_VALUE(SDMA4, 0, mmSDMA4_GB_ADDR_CONFIG_READ, 0x0018773f, 0x00104002), | |
| 279 | + SOC15_REG_GOLDEN_VALUE(SDMA4, 0, mmSDMA4_UTCL1_TIMEOUT, 0xffffffff, 0x00010001), | |
| 280 | +}; | |
| 281 | + | |
| 262 | 282 | static const struct soc15_reg_golden golden_settings_sdma_4_3[] = { |
| 263 | 283 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CHICKEN_BITS, 0xfe931f07, 0x02831f07), |
| 264 | 284 | SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CLK_CTRL, 0xffffffff, 0x3f000100), |
| @@ -482,6 +502,11 @@ static void sdma_v4_0_init_golden_registers(struct amdgpu_device *adev) · 217 unmodified lines | ||
| 482 | 502 | golden_settings_sdma_arct, |
| 483 | 503 | ARRAY_SIZE(golden_settings_sdma_arct)); |
| 484 | 504 | break; |
| 505 | + case CHIP_ALDEBARAN: | |
| 506 | + soc15_program_register_sequence(adev, | |
| 507 | + golden_settings_sdma_aldebaran, | |
| 508 | + ARRAY_SIZE(golden_settings_sdma_aldebaran)); | |
| 509 | + break; | |
| 485 | 510 | case CHIP_RAVEN: |
| 486 | 511 | soc15_program_register_sequence(adev, |
| 487 | 512 | golden_settings_sdma_4_1, |
| @@ -564,7 +589,8 @@ static void sdma_v4_0_destroy_inst_ctx(struct amdgpu_device *adev) · 76 unmodified lines | ||
| 564 | 589 | |
| 565 | 590 | /* arcturus shares the same FW memory across |
| 566 | 591 | all SDMA isntances */ |
| 567 | − if (adev->asic_type == CHIP_ARCTURUS) | |
| 592 | + if (adev->asic_type == CHIP_ARCTURUS || | |
| 593 | + adev->asic_type == CHIP_ALDEBARAN) | |
| 568 | 594 | break; |
| 569 | 595 | } |
| 570 | 596 | |
| @@ -621,6 +647,9 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev) · 50 unmodified lines | ||
| 621 | 647 | else |
| 622 | 648 | chip_name = "green_sardine"; |
| 623 | 649 | break; |
| 650 | + case CHIP_ALDEBARAN: | |
| 651 | + chip_name = "aldebaran"; | |
| 652 | + break; | |
| 624 | 653 | default: |
| 625 | 654 | BUG(); |
| 626 | 655 | } |
| @@ -636,8 +665,9 @@ static int sdma_v4_0_init_microcode(struct amdgpu_device *adev) · 9 unmodified lines | ||
| 636 | 665 | goto out; |
| 637 | 666 | |
| 638 | 667 | for (i = 1; i < adev->sdma.num_instances; i++) { |
| 639 | − if (adev->asic_type == CHIP_ARCTURUS) { | |
| 640 | − /* Acturus will leverage the same FW memory | |
| 668 | + if (adev->asic_type == CHIP_ARCTURUS || | |
| 669 | + adev->asic_type == CHIP_ALDEBARAN) { | |
| 670 | + /* Acturus & Aldebaran will leverage the same FW memory | |
| 641 | 671 | for every SDMA instance */ |
| 642 | 672 | memcpy((void *)&adev->sdma.instance[i], |
| 643 | 673 | (void *)&adev->sdma.instance[0], |
| @@ -1825,6 +1855,8 @@ static int sdma_v4_0_early_init(void *handle) · 1181 unmodified lines | ||
| 1825 | 1855 | adev->sdma.num_instances = 1; |
| 1826 | 1856 | else if (adev->asic_type == CHIP_ARCTURUS) |
| 1827 | 1857 | adev->sdma.num_instances = 8; |
| 1858 | + else if (adev->asic_type == CHIP_ALDEBARAN) | |
| 1859 | + adev->sdma.num_instances = 5; | |
| 1828 | 1860 | else |
| 1829 | 1861 | adev->sdma.num_instances = 2; |
| 1830 | 1862 | |
| @@ -1895,6 +1927,33 @@ static int sdma_v4_0_sw_init(void *handle) · 64 unmodified lines | ||
| 1895 | 1927 | return r; |
| 1896 | 1928 | } |
| 1897 | 1929 | |
| 1930 | + /* SDMA VM_HOLE/DOORBELL_INV/POLL_TIMEOUT/SRBM_WRITE_PROTECTION event*/ | |
| 1931 | + for (i = 0; i < adev->sdma.num_instances; i++) { | |
| 1932 | + r = amdgpu_irq_add_id(adev, sdma_v4_0_seq_to_irq_id(i), | |
| 1933 | + SDMA0_4_0__SRCID__SDMA_VM_HOLE, | |
| 1934 | + &adev->sdma.vm_hole_irq); | |
| 1935 | + if (r) | |
| 1936 | + return r; | |
| 1937 | + | |
| 1938 | + r = amdgpu_irq_add_id(adev, sdma_v4_0_seq_to_irq_id(i), | |
| 1939 | + SDMA0_4_0__SRCID__SDMA_DOORBELL_INVALID, | |
| 1940 | + &adev->sdma.doorbell_invalid_irq); | |
| 1941 | + if (r) | |
| 1942 | + return r; | |
| 1943 | + | |
| 1944 | + r = amdgpu_irq_add_id(adev, sdma_v4_0_seq_to_irq_id(i), | |
| 1945 | + SDMA0_4_0__SRCID__SDMA_POLL_TIMEOUT, | |
| 1946 | + &adev->sdma.pool_timeout_irq); | |
| 1947 | + if (r) | |
| 1948 | + return r; | |
| 1949 | + | |
| 1950 | + r = amdgpu_irq_add_id(adev, sdma_v4_0_seq_to_irq_id(i), | |
| 1951 | + SDMA0_4_0__SRCID__SDMA_SRBMWRITE, | |
| 1952 | + &adev->sdma.srbm_write_irq); | |
| 1953 | + if (r) | |
| 1954 | + return r; | |
| 1955 | + } | |
| 1956 | + | |
| 1898 | 1957 | for (i = 0; i < adev->sdma.num_instances; i++) { |
| 1899 | 1958 | ring = &adev->sdma.instance[i].ring; |
| 1900 | 1959 | ring->ring_obj = NULL; |
| @@ -2149,6 +2208,72 @@ static int sdma_v4_0_set_ecc_irq_state(struct amdgpu_device *adev, · 248 unmodified lines | ||
| 2149 | 2208 | return 0; |
| 2150 | 2209 | } |
| 2151 | 2210 | |
| 2211 | +static int sdma_v4_0_print_iv_entry(struct amdgpu_device *adev, | |
| 2212 | + struct amdgpu_iv_entry *entry) | |
| 2213 | +{ | |
| 2214 | + int instance; | |
| 2215 | + struct amdgpu_task_info task_info; | |
| 2216 | + u64 addr; | |
| 2217 | + | |
| 2218 | + instance = sdma_v4_0_irq_id_to_seq(entry->client_id); | |
| 2219 | + if (instance < 0 || instance >= adev->sdma.num_instances) { | |
| 2220 | + dev_err(adev->dev, "sdma instance invalid %d\n", instance); | |
| 2221 | + return -EINVAL; | |
| 2222 | + } | |
| 2223 | + | |
| 2224 | + addr = (u64)entry->src_data[0] << 12; | |
| 2225 | + addr |= ((u64)entry->src_data[1] & 0xf) << 44; | |
| 2226 | + | |
| 2227 | + memset(&task_info, 0, sizeof(struct amdgpu_task_info)); | |
| 2228 | + amdgpu_vm_get_task_info(adev, entry->pasid, &task_info); | |
| 2229 | + | |
| 2230 | + dev_info(adev->dev, | |
| 2231 | + "[sdma%d] address:0x%016llx src_id:%u ring:%u vmid:%u " | |
| 2232 | + "pasid:%u, for process %s pid %d thread %s pid %d\n", | |
| 2233 | + instance, addr, entry->src_id, entry->ring_id, entry->vmid, | |
| 2234 | + entry->pasid, task_info.process_name, task_info.tgid, | |
| 2235 | + task_info.task_name, task_info.pid); | |
| 2236 | + return 0; | |
| 2237 | +} | |
| 2238 | + | |
| 2239 | +static int sdma_v4_0_process_vm_hole_irq(struct amdgpu_device *adev, | |
| 2240 | + struct amdgpu_irq_src *source, | |
| 2241 | + struct amdgpu_iv_entry *entry) | |
| 2242 | +{ | |
| 2243 | + dev_err(adev->dev, "MC or SEM address in VM hole\n"); | |
| 2244 | + sdma_v4_0_print_iv_entry(adev, entry); | |
| 2245 | + return 0; | |
| 2246 | +} | |
| 2247 | + | |
| 2248 | +static int sdma_v4_0_process_doorbell_invalid_irq(struct amdgpu_device *adev, | |
| 2249 | + struct amdgpu_irq_src *source, | |
| 2250 | + struct amdgpu_iv_entry *entry) | |
| 2251 | +{ | |
| 2252 | + dev_err(adev->dev, "SDMA received a doorbell from BIF with byte_enable !=0xff\n"); | |
| 2253 | + sdma_v4_0_print_iv_entry(adev, entry); | |
| 2254 | + return 0; | |
| 2255 | +} | |
| 2256 | + | |
| 2257 | +static int sdma_v4_0_process_pool_timeout_irq(struct amdgpu_device *adev, | |
| 2258 | + struct amdgpu_irq_src *source, | |
| 2259 | + struct amdgpu_iv_entry *entry) | |
| 2260 | +{ | |
| 2261 | + dev_err(adev->dev, | |
| 2262 | + "Polling register/memory timeout executing POLL_REG/MEM with finite timer\n"); | |
| 2263 | + sdma_v4_0_print_iv_entry(adev, entry); | |
| 2264 | + return 0; | |
| 2265 | +} | |
| 2266 | + | |
| 2267 | +static int sdma_v4_0_process_srbm_write_irq(struct amdgpu_device *adev, | |
| 2268 | + struct amdgpu_irq_src *source, | |
| 2269 | + struct amdgpu_iv_entry *entry) | |
| 2270 | +{ | |
| 2271 | + dev_err(adev->dev, | |
| 2272 | + "SDMA gets an Register Write SRBM_WRITE command in non-privilege command buffer\n"); | |
| 2273 | + sdma_v4_0_print_iv_entry(adev, entry); | |
| 2274 | + return 0; | |
| 2275 | +} | |
| 2276 | + | |
| 2152 | 2277 | static void sdma_v4_0_update_medium_grain_clock_gating( |
| 2153 | 2278 | struct amdgpu_device *adev, |
| 2154 | 2279 | bool enable) |
| @@ -2222,21 +2347,10 @@ static int sdma_v4_0_set_clockgating_state(void *handle, · 67 unmodified lines | ||
| 2222 | 2347 | if (amdgpu_sriov_vf(adev)) |
| 2223 | 2348 | return 0; |
| 2224 | 2349 | |
| 2225 | − switch (adev->asic_type) { | |
| 2226 | − case CHIP_VEGA10: | |
| 2227 | − case CHIP_VEGA12: | |
| 2228 | − case CHIP_VEGA20: | |
| 2229 | − case CHIP_RAVEN: | |
| 2230 | − case CHIP_ARCTURUS: | |
| 2231 | − case CHIP_RENOIR: | |
| 2232 | − sdma_v4_0_update_medium_grain_clock_gating(adev, | |
| 2233 | − state == AMD_CG_STATE_GATE); | |
| 2234 | − sdma_v4_0_update_medium_grain_light_sleep(adev, | |
| 2235 | − state == AMD_CG_STATE_GATE); | |
| 2236 | − break; | |
| 2237 | − default: | |
| 2238 | − break; | |
| 2239 | − } | |
| 2350 | + sdma_v4_0_update_medium_grain_clock_gating(adev, | |
| 2351 | + state == AMD_CG_STATE_GATE); | |
| 2352 | + sdma_v4_0_update_medium_grain_light_sleep(adev, | |
| 2353 | + state == AMD_CG_STATE_GATE); | |
| 2240 | 2354 | return 0; |
| 2241 | 2355 | } |
| 2242 | 2356 | |
| @@ -2249,7 +2363,7 @@ static int sdma_v4_0_set_powergating_state(void *handle, · 6 unmodified lines | ||
| 2249 | 2363 | case CHIP_RAVEN: |
| 2250 | 2364 | case CHIP_RENOIR: |
| 2251 | 2365 | sdma_v4_1_update_power_gating(adev, |
| 2252 | − state == AMD_PG_STATE_GATE ? true : false); | |
| 2366 | + state == AMD_PG_STATE_GATE); | |
| 2253 | 2367 | break; |
| 2254 | 2368 | default: |
| 2255 | 2369 | break; |
| @@ -2465,7 +2579,21 @@ static const struct amdgpu_irq_src_funcs sdma_v4_0_ecc_irq_funcs = { · 209 unmodified lines | ||
| 2465 | 2579 | .process = amdgpu_sdma_process_ecc_irq, |
| 2466 | 2580 | }; |
| 2467 | 2581 | |
| 2582 | +static const struct amdgpu_irq_src_funcs sdma_v4_0_vm_hole_irq_funcs = { | |
| 2583 | + .process = sdma_v4_0_process_vm_hole_irq, | |
| 2584 | +}; | |
| 2585 | + | |
| 2586 | +static const struct amdgpu_irq_src_funcs sdma_v4_0_doorbell_invalid_irq_funcs = { | |
| 2587 | + .process = sdma_v4_0_process_doorbell_invalid_irq, | |
| 2588 | +}; | |
| 2589 | + | |
| 2590 | +static const struct amdgpu_irq_src_funcs sdma_v4_0_pool_timeout_irq_funcs = { | |
| 2591 | + .process = sdma_v4_0_process_pool_timeout_irq, | |
| 2592 | +}; | |
| 2468 | 2593 | |
| 2594 | +static const struct amdgpu_irq_src_funcs sdma_v4_0_srbm_write_irq_funcs = { | |
| 2595 | + .process = sdma_v4_0_process_srbm_write_irq, | |
| 2596 | +}; | |
| 2469 | 2597 | |
| 2470 | 2598 | static void sdma_v4_0_set_irq_funcs(struct amdgpu_device *adev) |
| 2471 | 2599 | { |
| @@ -2474,9 +2602,17 @@ static void sdma_v4_0_set_irq_funcs(struct amdgpu_device *adev) · 2 unmodified lines | ||
| 2474 | 2602 | adev->sdma.trap_irq.num_types = AMDGPU_SDMA_IRQ_INSTANCE1; |
| 2475 | 2603 | adev->sdma.ecc_irq.num_types = AMDGPU_SDMA_IRQ_INSTANCE1; |
| 2476 | 2604 | break; |
| 2605 | + case 5: | |
| 2606 | + adev->sdma.trap_irq.num_types = AMDGPU_SDMA_IRQ_INSTANCE5; | |
| 2607 | + adev->sdma.ecc_irq.num_types = AMDGPU_SDMA_IRQ_INSTANCE5; | |
| 2608 | + break; | |
| 2477 | 2609 | case 8: |
| 2478 | 2610 | adev->sdma.trap_irq.num_types = AMDGPU_SDMA_IRQ_LAST; |
| 2479 | 2611 | adev->sdma.ecc_irq.num_types = AMDGPU_SDMA_IRQ_LAST; |
| 2612 | + adev->sdma.vm_hole_irq.num_types = AMDGPU_SDMA_IRQ_INSTANCE5; | |
| 2613 | + adev->sdma.doorbell_invalid_irq.num_types = AMDGPU_SDMA_IRQ_LAST; | |
| 2614 | + adev->sdma.pool_timeout_irq.num_types = AMDGPU_SDMA_IRQ_LAST; | |
| 2615 | + adev->sdma.srbm_write_irq.num_types = AMDGPU_SDMA_IRQ_LAST; | |
| 2480 | 2616 | break; |
| 2481 | 2617 | case 2: |
| 2482 | 2618 | default: |
| @@ -2487,6 +2623,10 @@ static void sdma_v4_0_set_irq_funcs(struct amdgpu_device *adev) · 4 unmodified lines | ||
| 2487 | 2623 | adev->sdma.trap_irq.funcs = &sdma_v4_0_trap_irq_funcs; |
| 2488 | 2624 | adev->sdma.illegal_inst_irq.funcs = &sdma_v4_0_illegal_inst_irq_funcs; |
| 2489 | 2625 | adev->sdma.ecc_irq.funcs = &sdma_v4_0_ecc_irq_funcs; |
| 2626 | + adev->sdma.vm_hole_irq.funcs = &sdma_v4_0_vm_hole_irq_funcs; | |
| 2627 | + adev->sdma.doorbell_invalid_irq.funcs = &sdma_v4_0_doorbell_invalid_irq_funcs; | |
| 2628 | + adev->sdma.pool_timeout_irq.funcs = &sdma_v4_0_pool_timeout_irq_funcs; | |
| 2629 | + adev->sdma.srbm_write_irq.funcs = &sdma_v4_0_srbm_write_irq_funcs; | |
| 2490 | 2630 | } |
| 2491 | 2631 | |
| 2492 | 2632 | /** |
| @@ -2655,6 +2795,9 @@ static void sdma_v4_0_set_ras_funcs(struct amdgpu_device *adev) · 162 unmodified lines | ||
| 2655 | 2795 | case CHIP_ARCTURUS: |
| 2656 | 2796 | adev->sdma.funcs = &sdma_v4_0_ras_funcs; |
| 2657 | 2797 | break; |
| 2798 | + case CHIP_ALDEBARAN: | |
| 2799 | + adev->sdma.funcs = &sdma_v4_4_ras_funcs; | |
| 2800 | + break; | |
| 2658 | 2801 | default: |
| 2659 | 2802 | break; |
| 2660 | 2803 | } |
| @@ -0,0 +1,232 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#include "amdgpu.h" | |
| 24 | +#include "sdma/sdma_4_4_0_offset.h" | |
| 25 | +#include "sdma/sdma_4_4_0_sh_mask.h" | |
| 26 | +#include "soc15.h" | |
| 27 | +#include "amdgpu_ras.h" | |
| 28 | + | |
| 29 | +#define SDMA1_REG_OFFSET 0x600 | |
| 30 | +#define SDMA2_REG_OFFSET 0x1cda0 | |
| 31 | +#define SDMA3_REG_OFFSET 0x1d1a0 | |
| 32 | +#define SDMA4_REG_OFFSET 0x1d5a0 | |
| 33 | + | |
| 34 | +/* helper function that allow only use sdma0 register offset | |
| 35 | + * to calculate register offset for all the sdma instances */ | |
| 36 | +static uint32_t sdma_v4_4_get_reg_offset(struct amdgpu_device *adev, | |
| 37 | + uint32_t instance, | |
| 38 | + uint32_t offset) | |
| 39 | +{ | |
| 40 | + uint32_t sdma_base = adev->reg_offset[SDMA0_HWIP][0][0]; | |
| 41 | + | |
| 42 | + switch (instance) { | |
| 43 | + case 0: | |
| 44 | + return (sdma_base + offset); | |
| 45 | + case 1: | |
| 46 | + return (sdma_base + SDMA1_REG_OFFSET + offset); | |
| 47 | + case 2: | |
| 48 | + return (sdma_base + SDMA2_REG_OFFSET + offset); | |
| 49 | + case 3: | |
| 50 | + return (sdma_base + SDMA3_REG_OFFSET + offset); | |
| 51 | + case 4: | |
| 52 | + return (sdma_base + SDMA4_REG_OFFSET + offset); | |
| 53 | + default: | |
| 54 | + break; | |
| 55 | + } | |
| 56 | + return 0; | |
| 57 | +} | |
| 58 | + | |
| 59 | +static const struct soc15_ras_field_entry sdma_v4_4_ras_fields[] = { | |
| 60 | + { "SDMA_MBANK_DATA_BUF0_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 61 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF0_SED), | |
| 62 | + 0, 0, | |
| 63 | + }, | |
| 64 | + { "SDMA_MBANK_DATA_BUF1_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 65 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF1_SED), | |
| 66 | + 0, 0, | |
| 67 | + }, | |
| 68 | + { "SDMA_MBANK_DATA_BUF2_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 69 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF2_SED), | |
| 70 | + 0, 0, | |
| 71 | + }, | |
| 72 | + { "SDMA_MBANK_DATA_BUF3_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 73 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF3_SED), | |
| 74 | + 0, 0, | |
| 75 | + }, | |
| 76 | + { "SDMA_MBANK_DATA_BUF4_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 77 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF4_SED), | |
| 78 | + 0, 0, | |
| 79 | + }, | |
| 80 | + { "SDMA_MBANK_DATA_BUF5_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 81 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF5_SED), | |
| 82 | + 0, 0, | |
| 83 | + }, | |
| 84 | + { "SDMA_MBANK_DATA_BUF6_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 85 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF6_SED), | |
| 86 | + 0, 0, | |
| 87 | + }, | |
| 88 | + { "SDMA_MBANK_DATA_BUF7_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 89 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF7_SED), | |
| 90 | + 0, 0, | |
| 91 | + }, | |
| 92 | + { "SDMA_MBANK_DATA_BUF8_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 93 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF8_SED), | |
| 94 | + 0, 0, | |
| 95 | + }, | |
| 96 | + { "SDMA_MBANK_DATA_BUF9_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 97 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF9_SED), | |
| 98 | + 0, 0, | |
| 99 | + }, | |
| 100 | + { "SDMA_MBANK_DATA_BUF10_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 101 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF10_SED), | |
| 102 | + 0, 0, | |
| 103 | + }, | |
| 104 | + { "SDMA_MBANK_DATA_BUF11_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 105 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF11_SED), | |
| 106 | + 0, 0, | |
| 107 | + }, | |
| 108 | + { "SDMA_MBANK_DATA_BUF12_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 109 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF12_SED), | |
| 110 | + 0, 0, | |
| 111 | + }, | |
| 112 | + { "SDMA_MBANK_DATA_BUF13_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 113 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF13_SED), | |
| 114 | + 0, 0, | |
| 115 | + }, | |
| 116 | + { "SDMA_MBANK_DATA_BUF14_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 117 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF14_SED), | |
| 118 | + 0, 0, | |
| 119 | + }, | |
| 120 | + { "SDMA_MBANK_DATA_BUF15_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER), | |
| 121 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER, SDMA_MBANK_DATA_BUF15_SED), | |
| 122 | + 0, 0, | |
| 123 | + }, | |
| 124 | + { "SDMA_UCODE_BUF_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 125 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_UCODE_BUF_SED), | |
| 126 | + 0, 0, | |
| 127 | + }, | |
| 128 | + { "SDMA_RB_CMD_BUF_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 129 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_RB_CMD_BUF_SED), | |
| 130 | + 0, 0, | |
| 131 | + }, | |
| 132 | + { "SDMA_IB_CMD_BUF_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 133 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_IB_CMD_BUF_SED), | |
| 134 | + 0, 0, | |
| 135 | + }, | |
| 136 | + { "SDMA_UTCL1_RD_FIFO_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 137 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_UTCL1_RD_FIFO_SED), | |
| 138 | + 0, 0, | |
| 139 | + }, | |
| 140 | + { "SDMA_UTCL1_RDBST_FIFO_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 141 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_UTCL1_RDBST_FIFO_SED), | |
| 142 | + 0, 0, | |
| 143 | + }, | |
| 144 | + { "SDMA_DATA_LUT_FIFO_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 145 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_DATA_LUT_FIFO_SED), | |
| 146 | + 0, 0, | |
| 147 | + }, | |
| 148 | + { "SDMA_SPLIT_DATA_BUF_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 149 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_SPLIT_DATA_BUF_SED), | |
| 150 | + 0, 0, | |
| 151 | + }, | |
| 152 | + { "SDMA_MC_WR_ADDR_FIFO_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 153 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_MC_WR_ADDR_FIFO_SED), | |
| 154 | + 0, 0, | |
| 155 | + }, | |
| 156 | + { "SDMA_MC_RDRET_BUF_SED", SOC15_REG_ENTRY(SDMA0, 0, regSDMA0_EDC_COUNTER2), | |
| 157 | + SOC15_REG_FIELD(SDMA0_EDC_COUNTER2, SDMA_MC_WR_ADDR_FIFO_SED), | |
| 158 | + 0, 0, | |
| 159 | + }, | |
| 160 | +}; | |
| 161 | + | |
| 162 | +static void sdma_v4_4_get_ras_error_count(struct amdgpu_device *adev, | |
| 163 | + uint32_t value, | |
| 164 | + uint32_t instance, | |
| 165 | + uint32_t *sec_count) | |
| 166 | +{ | |
| 167 | + uint32_t i; | |
| 168 | + uint32_t sec_cnt; | |
| 169 | + | |
| 170 | + /* double bits error (multiple bits) error detection is not supported */ | |
| 171 | + for (i = 0; i < ARRAY_SIZE(sdma_v4_4_ras_fields); i++) { | |
| 172 | + /* the SDMA_EDC_COUNTER register in each sdma instance | |
| 173 | + * shares the same sed shift_mask | |
| 174 | + * */ | |
| 175 | + sec_cnt = (value & | |
| 176 | + sdma_v4_4_ras_fields[i].sec_count_mask) >> | |
| 177 | + sdma_v4_4_ras_fields[i].sec_count_shift; | |
| 178 | + if (sec_cnt) { | |
| 179 | + dev_info(adev->dev, "Detected %s in SDMA%d, SED %d\n", | |
| 180 | + sdma_v4_4_ras_fields[i].name, | |
| 181 | + instance, sec_cnt); | |
| 182 | + *sec_count += sec_cnt; | |
| 183 | + } | |
| 184 | + } | |
| 185 | +} | |
| 186 | + | |
| 187 | +static int sdma_v4_4_query_ras_error_count(struct amdgpu_device *adev, | |
| 188 | + uint32_t instance, | |
| 189 | + void *ras_error_status) | |
| 190 | +{ | |
| 191 | + struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status; | |
| 192 | + uint32_t sec_count = 0; | |
| 193 | + uint32_t reg_value = 0; | |
| 194 | + uint32_t reg_offset = 0; | |
| 195 | + | |
| 196 | + reg_offset = sdma_v4_4_get_reg_offset(adev, instance, regSDMA0_EDC_COUNTER); | |
| 197 | + reg_value = RREG32(reg_offset); | |
| 198 | + /* double bit error is not supported */ | |
| 199 | + if (reg_value) | |
| 200 | + sdma_v4_4_get_ras_error_count(adev, reg_value, instance, &sec_count); | |
| 201 | + /* err_data->ce_count should be initialized to 0 | |
| 202 | + * before calling into this function */ | |
| 203 | + err_data->ce_count += sec_count; | |
| 204 | + /* double bit error is not supported | |
| 205 | + * set ue count to 0 */ | |
| 206 | + err_data->ue_count = 0; | |
| 207 | + | |
| 208 | + return 0; | |
| 209 | +}; | |
| 210 | + | |
| 211 | +static void sdma_v4_4_reset_ras_error_count(struct amdgpu_device *adev) | |
| 212 | +{ | |
| 213 | + int i; | |
| 214 | + uint32_t reg_offset; | |
| 215 | + | |
| 216 | + /* write 0 to EDC_COUNTER reg to clear sdma edc counters */ | |
| 217 | + if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__SDMA)) { | |
| 218 | + for (i = 0; i < adev->sdma.num_instances; i++) { | |
| 219 | + reg_offset = sdma_v4_4_get_reg_offset(adev, i, regSDMA0_EDC_COUNTER); | |
| 220 | + WREG32(reg_offset, 0); | |
| 221 | + reg_offset = sdma_v4_4_get_reg_offset(adev, i, regSDMA0_EDC_COUNTER2); | |
| 222 | + WREG32(reg_offset, 0); | |
| 223 | + } | |
| 224 | + } | |
| 225 | +} | |
| 226 | + | |
| 227 | +const struct amdgpu_sdma_ras_funcs sdma_v4_4_ras_funcs = { | |
| 228 | + .ras_late_init = amdgpu_sdma_ras_late_init, | |
| 229 | + .ras_fini = amdgpu_sdma_ras_fini, | |
| 230 | + .query_ras_error_count = sdma_v4_4_query_ras_error_count, | |
| 231 | + .reset_ras_error_count = sdma_v4_4_reset_ras_error_count, | |
| 232 | +}; | |
| @@ -0,0 +1,28 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#ifndef __SDMA_V4_4_H__ | |
| 24 | +#define __SDMA_V4_4_H__ | |
| 25 | + | |
| 26 | +extern const struct amdgpu_sdma_ras_funcs sdma_v4_4_ras_funcs; | |
| 27 | + | |
| 28 | +#endif | |
| @@ -1595,9 +1595,9 @@ static int sdma_v5_2_set_clockgating_state(void *handle, · 1594 unmodified lines | ||
| 1595 | 1595 | case CHIP_VANGOGH: |
| 1596 | 1596 | case CHIP_DIMGREY_CAVEFISH: |
| 1597 | 1597 | sdma_v5_2_update_medium_grain_clock_gating(adev, |
| 1598 | − state == AMD_CG_STATE_GATE ? true : false); | |
| 1598 | + state == AMD_CG_STATE_GATE); | |
| 1599 | 1599 | sdma_v5_2_update_medium_grain_light_sleep(adev, |
| 1600 | − state == AMD_CG_STATE_GATE ? true : false); | |
| 1600 | + state == AMD_CG_STATE_GATE); | |
| 1601 | 1601 | break; |
| 1602 | 1602 | default: |
| 1603 | 1603 | break; |
| @@ -26,6 +26,8 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <linux/module.h> |
| 27 | 27 | #include <linux/pci.h> |
| 28 | 28 | |
| 29 | +#include <drm/amdgpu_drm.h> | |
| 30 | + | |
| 29 | 31 | #include "amdgpu.h" |
| 30 | 32 | #include "amdgpu_atombios.h" |
| 31 | 33 | #include "amdgpu_ih.h" |
| @@ -905,6 +907,114 @@ static const u32 hainan_mgcg_cgcg_init[] = · 873 unmodified lines | ||
| 905 | 907 | 0x3630, 0xfffffff0, 0x00000100, |
| 906 | 908 | }; |
| 907 | 909 | |
| 910 | +/* XXX: update when we support VCE */ | |
| 911 | +#if 0 | |
| 912 | +/* tahiti, pitcarin, verde */ | |
| 913 | +static const struct amdgpu_video_codec_info tahiti_video_codecs_encode_array[] = | |
| 914 | +{ | |
| 915 | + { | |
| 916 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 917 | + .max_width = 2048, | |
| 918 | + .max_height = 1152, | |
| 919 | + .max_pixels_per_frame = 2048 * 1152, | |
| 920 | + .max_level = 0, | |
| 921 | + }, | |
| 922 | +}; | |
| 923 | + | |
| 924 | +static const struct amdgpu_video_codecs tahiti_video_codecs_encode = | |
| 925 | +{ | |
| 926 | + .codec_count = ARRAY_SIZE(tahiti_video_codecs_encode_array), | |
| 927 | + .codec_array = tahiti_video_codecs_encode_array, | |
| 928 | +}; | |
| 929 | +#else | |
| 930 | +static const struct amdgpu_video_codecs tahiti_video_codecs_encode = | |
| 931 | +{ | |
| 932 | + .codec_count = 0, | |
| 933 | + .codec_array = NULL, | |
| 934 | +}; | |
| 935 | +#endif | |
| 936 | +/* oland and hainan don't support encode */ | |
| 937 | +static const struct amdgpu_video_codecs hainan_video_codecs_encode = | |
| 938 | +{ | |
| 939 | + .codec_count = 0, | |
| 940 | + .codec_array = NULL, | |
| 941 | +}; | |
| 942 | + | |
| 943 | +/* tahiti, pitcarin, verde, oland */ | |
| 944 | +static const struct amdgpu_video_codec_info tahiti_video_codecs_decode_array[] = | |
| 945 | +{ | |
| 946 | + { | |
| 947 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 948 | + .max_width = 2048, | |
| 949 | + .max_height = 1152, | |
| 950 | + .max_pixels_per_frame = 2048 * 1152, | |
| 951 | + .max_level = 3, | |
| 952 | + }, | |
| 953 | + { | |
| 954 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 955 | + .max_width = 2048, | |
| 956 | + .max_height = 1152, | |
| 957 | + .max_pixels_per_frame = 2048 * 1152, | |
| 958 | + .max_level = 5, | |
| 959 | + }, | |
| 960 | + { | |
| 961 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 962 | + .max_width = 2048, | |
| 963 | + .max_height = 1152, | |
| 964 | + .max_pixels_per_frame = 2048 * 1152, | |
| 965 | + .max_level = 41, | |
| 966 | + }, | |
| 967 | + { | |
| 968 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 969 | + .max_width = 2048, | |
| 970 | + .max_height = 1152, | |
| 971 | + .max_pixels_per_frame = 2048 * 1152, | |
| 972 | + .max_level = 4, | |
| 973 | + }, | |
| 974 | +}; | |
| 975 | + | |
| 976 | +static const struct amdgpu_video_codecs tahiti_video_codecs_decode = | |
| 977 | +{ | |
| 978 | + .codec_count = ARRAY_SIZE(tahiti_video_codecs_decode_array), | |
| 979 | + .codec_array = tahiti_video_codecs_decode_array, | |
| 980 | +}; | |
| 981 | + | |
| 982 | +/* hainan doesn't support decode */ | |
| 983 | +static const struct amdgpu_video_codecs hainan_video_codecs_decode = | |
| 984 | +{ | |
| 985 | + .codec_count = 0, | |
| 986 | + .codec_array = NULL, | |
| 987 | +}; | |
| 988 | + | |
| 989 | +static int si_query_video_codecs(struct amdgpu_device *adev, bool encode, | |
| 990 | + const struct amdgpu_video_codecs **codecs) | |
| 991 | +{ | |
| 992 | + switch (adev->asic_type) { | |
| 993 | + case CHIP_VERDE: | |
| 994 | + case CHIP_TAHITI: | |
| 995 | + case CHIP_PITCAIRN: | |
| 996 | + if (encode) | |
| 997 | + *codecs = &tahiti_video_codecs_encode; | |
| 998 | + else | |
| 999 | + *codecs = &tahiti_video_codecs_decode; | |
| 1000 | + return 0; | |
| 1001 | + case CHIP_OLAND: | |
| 1002 | + if (encode) | |
| 1003 | + *codecs = &hainan_video_codecs_encode; | |
| 1004 | + else | |
| 1005 | + *codecs = &tahiti_video_codecs_decode; | |
| 1006 | + return 0; | |
| 1007 | + case CHIP_HAINAN: | |
| 1008 | + if (encode) | |
| 1009 | + *codecs = &hainan_video_codecs_encode; | |
| 1010 | + else | |
| 1011 | + *codecs = &hainan_video_codecs_decode; | |
| 1012 | + return 0; | |
| 1013 | + default: | |
| 1014 | + return -EINVAL; | |
| 1015 | + } | |
| 1016 | +} | |
| 1017 | + | |
| 908 | 1018 | static u32 si_pcie_rreg(struct amdgpu_device *adev, u32 reg) |
| 909 | 1019 | { |
| 910 | 1020 | unsigned long flags; |
| @@ -1903,6 +2013,7 @@ static const struct amdgpu_asic_funcs si_asic_funcs = · 992 unmodified lines | ||
| 1903 | 2013 | .get_pcie_replay_count = &si_get_pcie_replay_count, |
| 1904 | 2014 | .supports_baco = &si_asic_supports_baco, |
| 1905 | 2015 | .pre_asic_init = &si_pre_asic_init, |
| 2016 | + .query_video_codecs = &si_query_video_codecs, | |
| 1906 | 2017 | }; |
| 1907 | 2018 | |
| 1908 | 2019 | static uint32_t si_get_rev_id(struct amdgpu_device *adev) |
| @@ -0,0 +1,121 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#include "amdgpu.h" | |
| 24 | +#include "smuio_v13_0.h" | |
| 25 | +#include "smuio/smuio_13_0_2_offset.h" | |
| 26 | +#include "smuio/smuio_13_0_2_sh_mask.h" | |
| 27 | + | |
| 28 | +#define SMUIO_MCM_CONFIG__HOST_GPU_XGMI_MASK 0x00000001L | |
| 29 | + | |
| 30 | +static u32 smuio_v13_0_get_rom_index_offset(struct amdgpu_device *adev) | |
| 31 | +{ | |
| 32 | + return SOC15_REG_OFFSET(SMUIO, 0, regROM_INDEX); | |
| 33 | +} | |
| 34 | + | |
| 35 | +static u32 smuio_v13_0_get_rom_data_offset(struct amdgpu_device *adev) | |
| 36 | +{ | |
| 37 | + return SOC15_REG_OFFSET(SMUIO, 0, regROM_DATA); | |
| 38 | +} | |
| 39 | + | |
| 40 | +static void smuio_v13_0_update_rom_clock_gating(struct amdgpu_device *adev, bool enable) | |
| 41 | +{ | |
| 42 | + u32 def, data; | |
| 43 | + | |
| 44 | + /* enable/disable ROM CG is not supported on APU */ | |
| 45 | + if (adev->flags & AMD_IS_APU) | |
| 46 | + return; | |
| 47 | + | |
| 48 | + def = data = RREG32_SOC15(SMUIO, 0, regCGTT_ROM_CLK_CTRL0); | |
| 49 | + | |
| 50 | + if (enable && (adev->cg_flags & AMD_CG_SUPPORT_ROM_MGCG)) | |
| 51 | + data &= ~(CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK | | |
| 52 | + CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK); | |
| 53 | + else | |
| 54 | + data |= CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK | | |
| 55 | + CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE1_MASK; | |
| 56 | + | |
| 57 | + if (def != data) | |
| 58 | + WREG32_SOC15(SMUIO, 0, regCGTT_ROM_CLK_CTRL0, data); | |
| 59 | +} | |
| 60 | + | |
| 61 | +static void smuio_v13_0_get_clock_gating_state(struct amdgpu_device *adev, u32 *flags) | |
| 62 | +{ | |
| 63 | + u32 data; | |
| 64 | + | |
| 65 | + /* CGTT_ROM_CLK_CTRL0 is not available for APU */ | |
| 66 | + if (adev->flags & AMD_IS_APU) | |
| 67 | + return; | |
| 68 | + | |
| 69 | + data = RREG32_SOC15(SMUIO, 0, regCGTT_ROM_CLK_CTRL0); | |
| 70 | + if (!(data & CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK)) | |
| 71 | + *flags |= AMD_CG_SUPPORT_ROM_MGCG; | |
| 72 | +} | |
| 73 | + | |
| 74 | +/** | |
| 75 | + * smuio_v13_0_get_die_id - query die id from FCH. | |
| 76 | + * | |
| 77 | + * @adev: amdgpu device pointer | |
| 78 | + * | |
| 79 | + * Returns die id | |
| 80 | + */ | |
| 81 | +static u32 smuio_v13_0_get_die_id(struct amdgpu_device *adev) | |
| 82 | +{ | |
| 83 | + u32 data, die_id; | |
| 84 | + | |
| 85 | + data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG); | |
| 86 | + die_id = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, DIE_ID); | |
| 87 | + | |
| 88 | + return die_id; | |
| 89 | +} | |
| 90 | + | |
| 91 | +/** | |
| 92 | + * smuio_v13_0_supports_host_gpu_xgmi - detect xgmi interface between cpu and gpu/s. | |
| 93 | + * | |
| 94 | + * @adev: amdgpu device pointer | |
| 95 | + * | |
| 96 | + * Returns true on success or false otherwise. | |
| 97 | + */ | |
| 98 | +static bool smuio_v13_0_is_host_gpu_xgmi_supported(struct amdgpu_device *adev) | |
| 99 | +{ | |
| 100 | + u32 data; | |
| 101 | + | |
| 102 | + data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG); | |
| 103 | + data = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, TOPOLOGY_ID); | |
| 104 | + /* data[4:0] | |
| 105 | + * bit 0 == 0 host-gpu interface is PCIE | |
| 106 | + * bit 0 == 1 host-gpu interface is Alternate Protocal | |
| 107 | + * for AMD, this is XGMI | |
| 108 | + */ | |
| 109 | + data &= SMUIO_MCM_CONFIG__HOST_GPU_XGMI_MASK; | |
| 110 | + | |
| 111 | + return data ? true : false; | |
| 112 | +} | |
| 113 | + | |
| 114 | +const struct amdgpu_smuio_funcs smuio_v13_0_funcs = { | |
| 115 | + .get_rom_index_offset = smuio_v13_0_get_rom_index_offset, | |
| 116 | + .get_rom_data_offset = smuio_v13_0_get_rom_data_offset, | |
| 117 | + .get_die_id = smuio_v13_0_get_die_id, | |
| 118 | + .is_host_gpu_xgmi_supported = smuio_v13_0_is_host_gpu_xgmi_supported, | |
| 119 | + .update_rom_clock_gating = smuio_v13_0_update_rom_clock_gating, | |
| 120 | + .get_clock_gating_state = smuio_v13_0_get_clock_gating_state, | |
| 121 | +}; | |
| @@ -0,0 +1,30 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + */ | |
| 23 | +#ifndef __SMUIO_V13_0_H__ | |
| 24 | +#define __SMUIO_V13_0_H__ | |
| 25 | + | |
| 26 | +#include "soc15_common.h" | |
| 27 | + | |
| 28 | +extern const struct amdgpu_smuio_funcs smuio_v13_0_funcs; | |
| 29 | + | |
| 30 | +#endif /* __SMUIO_V13_0_H__ */ | |
| @@ -25,6 +25,8 @@ · 24 unmodified lines | ||
| 25 | 25 | #include <linux/module.h> |
| 26 | 26 | #include <linux/pci.h> |
| 27 | 27 | |
| 28 | +#include <drm/amdgpu_drm.h> | |
| 29 | + | |
| 28 | 30 | #include "amdgpu.h" |
| 29 | 31 | #include "amdgpu_atombios.h" |
| 30 | 32 | #include "amdgpu_ih.h" |
| @@ -71,6 +73,7 @@ · 40 unmodified lines | ||
| 71 | 73 | #include "jpeg_v2_5.h" |
| 72 | 74 | #include "smuio_v9_0.h" |
| 73 | 75 | #include "smuio_v11_0.h" |
| 76 | +#include "smuio_v13_0.h" | |
| 74 | 77 | #include "dce_virtual.h" |
| 75 | 78 | #include "mxgpu_ai.h" |
| 76 | 79 | #include "amdgpu_smu.h" |
| @@ -83,6 +86,234 @@ · 6 unmodified lines | ||
| 83 | 86 | #define mmMP0_MISC_LIGHT_SLEEP_CTRL 0x01ba |
| 84 | 87 | #define mmMP0_MISC_LIGHT_SLEEP_CTRL_BASE_IDX 0 |
| 85 | 88 | |
| 89 | +/* Vega, Raven, Arcturus */ | |
| 90 | +static const struct amdgpu_video_codec_info vega_video_codecs_encode_array[] = | |
| 91 | +{ | |
| 92 | + { | |
| 93 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 94 | + .max_width = 4096, | |
| 95 | + .max_height = 2304, | |
| 96 | + .max_pixels_per_frame = 4096 * 2304, | |
| 97 | + .max_level = 0, | |
| 98 | + }, | |
| 99 | + { | |
| 100 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 101 | + .max_width = 4096, | |
| 102 | + .max_height = 2304, | |
| 103 | + .max_pixels_per_frame = 4096 * 2304, | |
| 104 | + .max_level = 0, | |
| 105 | + }, | |
| 106 | +}; | |
| 107 | + | |
| 108 | +static const struct amdgpu_video_codecs vega_video_codecs_encode = | |
| 109 | +{ | |
| 110 | + .codec_count = ARRAY_SIZE(vega_video_codecs_encode_array), | |
| 111 | + .codec_array = vega_video_codecs_encode_array, | |
| 112 | +}; | |
| 113 | + | |
| 114 | +/* Vega */ | |
| 115 | +static const struct amdgpu_video_codec_info vega_video_codecs_decode_array[] = | |
| 116 | +{ | |
| 117 | + { | |
| 118 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 119 | + .max_width = 4096, | |
| 120 | + .max_height = 4096, | |
| 121 | + .max_pixels_per_frame = 4096 * 4096, | |
| 122 | + .max_level = 3, | |
| 123 | + }, | |
| 124 | + { | |
| 125 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 126 | + .max_width = 4096, | |
| 127 | + .max_height = 4096, | |
| 128 | + .max_pixels_per_frame = 4096 * 4096, | |
| 129 | + .max_level = 5, | |
| 130 | + }, | |
| 131 | + { | |
| 132 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 133 | + .max_width = 4096, | |
| 134 | + .max_height = 4096, | |
| 135 | + .max_pixels_per_frame = 4096 * 4096, | |
| 136 | + .max_level = 52, | |
| 137 | + }, | |
| 138 | + { | |
| 139 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 140 | + .max_width = 4096, | |
| 141 | + .max_height = 4096, | |
| 142 | + .max_pixels_per_frame = 4096 * 4096, | |
| 143 | + .max_level = 4, | |
| 144 | + }, | |
| 145 | + { | |
| 146 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 147 | + .max_width = 4096, | |
| 148 | + .max_height = 4096, | |
| 149 | + .max_pixels_per_frame = 4096 * 4096, | |
| 150 | + .max_level = 186, | |
| 151 | + }, | |
| 152 | + { | |
| 153 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, | |
| 154 | + .max_width = 4096, | |
| 155 | + .max_height = 4096, | |
| 156 | + .max_pixels_per_frame = 4096 * 4096, | |
| 157 | + .max_level = 0, | |
| 158 | + }, | |
| 159 | +}; | |
| 160 | + | |
| 161 | +static const struct amdgpu_video_codecs vega_video_codecs_decode = | |
| 162 | +{ | |
| 163 | + .codec_count = ARRAY_SIZE(vega_video_codecs_decode_array), | |
| 164 | + .codec_array = vega_video_codecs_decode_array, | |
| 165 | +}; | |
| 166 | + | |
| 167 | +/* Raven */ | |
| 168 | +static const struct amdgpu_video_codec_info rv_video_codecs_decode_array[] = | |
| 169 | +{ | |
| 170 | + { | |
| 171 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 172 | + .max_width = 4096, | |
| 173 | + .max_height = 4096, | |
| 174 | + .max_pixels_per_frame = 4096 * 4096, | |
| 175 | + .max_level = 3, | |
| 176 | + }, | |
| 177 | + { | |
| 178 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 179 | + .max_width = 4096, | |
| 180 | + .max_height = 4096, | |
| 181 | + .max_pixels_per_frame = 4096 * 4096, | |
| 182 | + .max_level = 5, | |
| 183 | + }, | |
| 184 | + { | |
| 185 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 186 | + .max_width = 4096, | |
| 187 | + .max_height = 4096, | |
| 188 | + .max_pixels_per_frame = 4096 * 4096, | |
| 189 | + .max_level = 52, | |
| 190 | + }, | |
| 191 | + { | |
| 192 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 193 | + .max_width = 4096, | |
| 194 | + .max_height = 4096, | |
| 195 | + .max_pixels_per_frame = 4096 * 4096, | |
| 196 | + .max_level = 4, | |
| 197 | + }, | |
| 198 | + { | |
| 199 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 200 | + .max_width = 4096, | |
| 201 | + .max_height = 4096, | |
| 202 | + .max_pixels_per_frame = 4096 * 4096, | |
| 203 | + .max_level = 186, | |
| 204 | + }, | |
| 205 | + { | |
| 206 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, | |
| 207 | + .max_width = 4096, | |
| 208 | + .max_height = 4096, | |
| 209 | + .max_pixels_per_frame = 4096 * 4096, | |
| 210 | + .max_level = 0, | |
| 211 | + }, | |
| 212 | + { | |
| 213 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, | |
| 214 | + .max_width = 4096, | |
| 215 | + .max_height = 4096, | |
| 216 | + .max_pixels_per_frame = 4096 * 4096, | |
| 217 | + .max_level = 0, | |
| 218 | + }, | |
| 219 | +}; | |
| 220 | + | |
| 221 | +static const struct amdgpu_video_codecs rv_video_codecs_decode = | |
| 222 | +{ | |
| 223 | + .codec_count = ARRAY_SIZE(rv_video_codecs_decode_array), | |
| 224 | + .codec_array = rv_video_codecs_decode_array, | |
| 225 | +}; | |
| 226 | + | |
| 227 | +/* Renoir, Arcturus */ | |
| 228 | +static const struct amdgpu_video_codec_info rn_video_codecs_decode_array[] = | |
| 229 | +{ | |
| 230 | + { | |
| 231 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 232 | + .max_width = 4096, | |
| 233 | + .max_height = 4096, | |
| 234 | + .max_pixels_per_frame = 4096 * 4096, | |
| 235 | + .max_level = 3, | |
| 236 | + }, | |
| 237 | + { | |
| 238 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 239 | + .max_width = 4096, | |
| 240 | + .max_height = 4096, | |
| 241 | + .max_pixels_per_frame = 4096 * 4096, | |
| 242 | + .max_level = 5, | |
| 243 | + }, | |
| 244 | + { | |
| 245 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 246 | + .max_width = 4096, | |
| 247 | + .max_height = 4096, | |
| 248 | + .max_pixels_per_frame = 4096 * 4096, | |
| 249 | + .max_level = 52, | |
| 250 | + }, | |
| 251 | + { | |
| 252 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 253 | + .max_width = 4096, | |
| 254 | + .max_height = 4096, | |
| 255 | + .max_pixels_per_frame = 4096 * 4096, | |
| 256 | + .max_level = 4, | |
| 257 | + }, | |
| 258 | + { | |
| 259 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 260 | + .max_width = 8192, | |
| 261 | + .max_height = 4352, | |
| 262 | + .max_pixels_per_frame = 4096 * 4096, | |
| 263 | + .max_level = 186, | |
| 264 | + }, | |
| 265 | + { | |
| 266 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, | |
| 267 | + .max_width = 4096, | |
| 268 | + .max_height = 4096, | |
| 269 | + .max_pixels_per_frame = 4096 * 4096, | |
| 270 | + .max_level = 0, | |
| 271 | + }, | |
| 272 | + { | |
| 273 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, | |
| 274 | + .max_width = 8192, | |
| 275 | + .max_height = 4352, | |
| 276 | + .max_pixels_per_frame = 4096 * 4096, | |
| 277 | + .max_level = 0, | |
| 278 | + }, | |
| 279 | +}; | |
| 280 | + | |
| 281 | +static const struct amdgpu_video_codecs rn_video_codecs_decode = | |
| 282 | +{ | |
| 283 | + .codec_count = ARRAY_SIZE(rn_video_codecs_decode_array), | |
| 284 | + .codec_array = rn_video_codecs_decode_array, | |
| 285 | +}; | |
| 286 | + | |
| 287 | +static int soc15_query_video_codecs(struct amdgpu_device *adev, bool encode, | |
| 288 | + const struct amdgpu_video_codecs **codecs) | |
| 289 | +{ | |
| 290 | + switch (adev->asic_type) { | |
| 291 | + case CHIP_VEGA20: | |
| 292 | + case CHIP_VEGA10: | |
| 293 | + case CHIP_VEGA12: | |
| 294 | + if (encode) | |
| 295 | + *codecs = &vega_video_codecs_encode; | |
| 296 | + else | |
| 297 | + *codecs = &vega_video_codecs_decode; | |
| 298 | + return 0; | |
| 299 | + case CHIP_RAVEN: | |
| 300 | + if (encode) | |
| 301 | + *codecs = &vega_video_codecs_encode; | |
| 302 | + else | |
| 303 | + *codecs = &rv_video_codecs_decode; | |
| 304 | + return 0; | |
| 305 | + case CHIP_ARCTURUS: | |
| 306 | + case CHIP_RENOIR: | |
| 307 | + if (encode) | |
| 308 | + *codecs = &vega_video_codecs_encode; | |
| 309 | + else | |
| 310 | + *codecs = &rn_video_codecs_decode; | |
| 311 | + return 0; | |
| 312 | + default: | |
| 313 | + return -EINVAL; | |
| 314 | + } | |
| 315 | +} | |
| 316 | + | |
| 86 | 317 | /* |
| 87 | 318 | * Indirect registers accessor |
| 88 | 319 | */ |
| @@ -419,40 +650,6 @@ void soc15_program_register_sequence(struct amdgpu_device *adev, · 330 unmodified lines | ||
| 419 | 650 | |
| 420 | 651 | } |
| 421 | 652 | |
| 422 | −static int soc15_asic_mode1_reset(struct amdgpu_device *adev) | |
| 423 | −{ | |
| 424 | − u32 i; | |
| 425 | − int ret = 0; | |
| 426 | − | |
| 427 | − amdgpu_atombios_scratch_regs_engine_hung(adev, true); | |
| 428 | − | |
| 429 | − dev_info(adev->dev, "GPU mode1 reset\n"); | |
| 430 | − | |
| 431 | − /* disable BM */ | |
| 432 | − pci_clear_master(adev->pdev); | |
| 433 | − | |
| 434 | − amdgpu_device_cache_pci_state(adev->pdev); | |
| 435 | − | |
| 436 | − ret = psp_gpu_reset(adev); | |
| 437 | − if (ret) | |
| 438 | − dev_err(adev->dev, "GPU mode1 reset failed\n"); | |
| 439 | − | |
| 440 | − amdgpu_device_load_pci_state(adev->pdev); | |
| 441 | − | |
| 442 | − /* wait for asic to come out of reset */ | |
| 443 | − for (i = 0; i < adev->usec_timeout; i++) { | |
| 444 | − u32 memsize = adev->nbio.funcs->get_memsize(adev); | |
| 445 | − | |
| 446 | − if (memsize != 0xffffffff) | |
| 447 | − break; | |
| 448 | − udelay(1); | |
| 449 | − } | |
| 450 | − | |
| 451 | − amdgpu_atombios_scratch_regs_engine_hung(adev, false); | |
| 452 | − | |
| 453 | − return ret; | |
| 454 | −} | |
| 455 | − | |
| 456 | 653 | static int soc15_asic_baco_reset(struct amdgpu_device *adev) |
| 457 | 654 | { |
| 458 | 655 | struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); |
| @@ -477,13 +674,21 @@ static enum amd_reset_method · 18 unmodified lines | ||
| 477 | 674 | soc15_asic_reset_method(struct amdgpu_device *adev) |
| 478 | 675 | { |
| 479 | 676 | bool baco_reset = false; |
| 677 | + bool connected_to_cpu = false; | |
| 480 | 678 | struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); |
| 481 | 679 | |
| 680 | + if (adev->gmc.xgmi.supported && adev->gmc.xgmi.connected_to_cpu) | |
| 681 | + connected_to_cpu = true; | |
| 682 | + | |
| 482 | 683 | if (amdgpu_reset_method == AMD_RESET_METHOD_MODE1 || |
| 483 | 684 | amdgpu_reset_method == AMD_RESET_METHOD_MODE2 || |
| 484 | 685 | amdgpu_reset_method == AMD_RESET_METHOD_BACO || |
| 485 | − amdgpu_reset_method == AMD_RESET_METHOD_PCI) | |
| 486 | − return amdgpu_reset_method; | |
| 686 | + amdgpu_reset_method == AMD_RESET_METHOD_PCI) { | |
| 687 | + /* If connected to cpu, driver only support mode2 */ | |
| 688 | + if (connected_to_cpu) | |
| 689 | + return AMD_RESET_METHOD_MODE2; | |
| 690 | + return amdgpu_reset_method; | |
| 691 | + } | |
| 487 | 692 | |
| 488 | 693 | if (amdgpu_reset_method != -1) |
| 489 | 694 | dev_warn(adev->dev, "Specified reset method:%d isn't supported, using AUTO instead.\n", |
| @@ -509,6 +714,14 @@ soc15_asic_reset_method(struct amdgpu_device *adev) · 19 unmodified lines | ||
| 509 | 714 | if ((ras && ras->supported) && adev->pm.fw_version <= 0x283400) |
| 510 | 715 | baco_reset = false; |
| 511 | 716 | break; |
| 717 | + case CHIP_ALDEBARAN: | |
| 718 | + /* | |
| 719 | + * 1.connected to cpu: driver issue mode2 reset | |
| 720 | + * 2.discret gpu: driver issue mode1 reset | |
| 721 | + */ | |
| 722 | + if (connected_to_cpu) | |
| 723 | + return AMD_RESET_METHOD_MODE2; | |
| 724 | + break; | |
| 512 | 725 | default: |
| 513 | 726 | break; |
| 514 | 727 | } |
| @@ -538,7 +751,7 @@ static int soc15_asic_reset(struct amdgpu_device *adev) · 23 unmodified lines | ||
| 538 | 751 | return amdgpu_dpm_mode2_reset(adev); |
| 539 | 752 | default: |
| 540 | 753 | dev_info(adev->dev, "MODE1 reset\n"); |
| 541 | − return soc15_asic_mode1_reset(adev); | |
| 754 | + return amdgpu_device_mode1_reset(adev); | |
| 542 | 755 | } |
| 543 | 756 | } |
| 544 | 757 | |
| @@ -661,6 +874,9 @@ static void soc15_reg_base_init(struct amdgpu_device *adev) · 116 unmodified lines | ||
| 661 | 874 | case CHIP_ARCTURUS: |
| 662 | 875 | arct_reg_base_init(adev); |
| 663 | 876 | break; |
| 877 | + case CHIP_ALDEBARAN: | |
| 878 | + aldebaran_reg_base_init(adev); | |
| 879 | + break; | |
| 664 | 880 | default: |
| 665 | 881 | DRM_ERROR("Unsupported asic type: %d!\n", adev->asic_type); |
| 666 | 882 | break; |
| @@ -683,14 +899,12 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 16 unmodified lines | ||
| 683 | 899 | if (!amdgpu_sriov_vf(adev)) |
| 684 | 900 | soc15_reg_base_init(adev); |
| 685 | 901 | |
| 686 | − if (adev->asic_type == CHIP_VEGA20 || adev->asic_type == CHIP_ARCTURUS) | |
| 687 | − adev->gmc.xgmi.supported = true; | |
| 688 | − | |
| 689 | 902 | if (adev->flags & AMD_IS_APU) { |
| 690 | 903 | adev->nbio.funcs = &nbio_v7_0_funcs; |
| 691 | 904 | adev->nbio.hdp_flush_reg = &nbio_v7_0_hdp_flush_reg; |
| 692 | 905 | } else if (adev->asic_type == CHIP_VEGA20 || |
| 693 | − adev->asic_type == CHIP_ARCTURUS) { | |
| 906 | + adev->asic_type == CHIP_ARCTURUS || | |
| 907 | + adev->asic_type == CHIP_ALDEBARAN) { | |
| 694 | 908 | adev->nbio.funcs = &nbio_v7_4_funcs; |
| 695 | 909 | adev->nbio.hdp_flush_reg = &nbio_v7_4_hdp_flush_reg; |
| 696 | 910 | } else { |
| @@ -699,7 +913,9 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 2 unmodified lines | ||
| 699 | 913 | } |
| 700 | 914 | adev->hdp.funcs = &hdp_v4_0_funcs; |
| 701 | 915 | |
| 702 | − if (adev->asic_type == CHIP_VEGA20 || adev->asic_type == CHIP_ARCTURUS) | |
| 916 | + if (adev->asic_type == CHIP_VEGA20 || | |
| 917 | + adev->asic_type == CHIP_ARCTURUS || | |
| 918 | + adev->asic_type == CHIP_ALDEBARAN) | |
| 703 | 919 | adev->df.funcs = &df_v3_6_funcs; |
| 704 | 920 | else |
| 705 | 921 | adev->df.funcs = &df_v1_7_funcs; |
| @@ -707,6 +923,8 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 1 unmodified line | ||
| 707 | 923 | if (adev->asic_type == CHIP_VEGA20 || |
| 708 | 924 | adev->asic_type == CHIP_ARCTURUS) |
| 709 | 925 | adev->smuio.funcs = &smuio_v11_0_funcs; |
| 926 | + else if (adev->asic_type == CHIP_ALDEBARAN) | |
| 927 | + adev->smuio.funcs = &smuio_v13_0_funcs; | |
| 710 | 928 | else |
| 711 | 929 | adev->smuio.funcs = &smuio_v9_0_funcs; |
| 712 | 930 | |
| @@ -826,6 +1044,27 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 113 unmodified lines | ||
| 826 | 1044 | amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); |
| 827 | 1045 | amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block); |
| 828 | 1046 | break; |
| 1047 | + case CHIP_ALDEBARAN: | |
| 1048 | + amdgpu_device_ip_block_add(adev, &vega10_common_ip_block); | |
| 1049 | + amdgpu_device_ip_block_add(adev, &gmc_v9_0_ip_block); | |
| 1050 | + | |
| 1051 | + if (amdgpu_sriov_vf(adev)) { | |
| 1052 | + if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) | |
| 1053 | + amdgpu_device_ip_block_add(adev, &psp_v13_0_ip_block); | |
| 1054 | + amdgpu_device_ip_block_add(adev, &vega20_ih_ip_block); | |
| 1055 | + } else { | |
| 1056 | + amdgpu_device_ip_block_add(adev, &vega20_ih_ip_block); | |
| 1057 | + if (likely(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP)) | |
| 1058 | + amdgpu_device_ip_block_add(adev, &psp_v13_0_ip_block); | |
| 1059 | + } | |
| 1060 | + | |
| 1061 | + amdgpu_device_ip_block_add(adev, &gfx_v9_0_ip_block); | |
| 1062 | + amdgpu_device_ip_block_add(adev, &sdma_v4_0_ip_block); | |
| 1063 | + | |
| 1064 | + amdgpu_device_ip_block_add(adev, &smu_v13_0_ip_block); | |
| 1065 | + amdgpu_device_ip_block_add(adev, &vcn_v2_6_ip_block); | |
| 1066 | + amdgpu_device_ip_block_add(adev, &jpeg_v2_6_ip_block); | |
| 1067 | + break; | |
| 829 | 1068 | default: |
| 830 | 1069 | return -EINVAL; |
| 831 | 1070 | } |
| @@ -994,6 +1233,7 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs = · 162 unmodified lines | ||
| 994 | 1233 | .get_pcie_replay_count = &soc15_get_pcie_replay_count, |
| 995 | 1234 | .supports_baco = &soc15_supports_baco, |
| 996 | 1235 | .pre_asic_init = &soc15_pre_asic_init, |
| 1236 | + .query_video_codecs = &soc15_query_video_codecs, | |
| 997 | 1237 | }; |
| 998 | 1238 | |
| 999 | 1239 | static const struct amdgpu_asic_funcs vega20_asic_funcs = |
| @@ -1015,6 +1255,7 @@ static const struct amdgpu_asic_funcs vega20_asic_funcs = · 15 unmodified lines | ||
| 1015 | 1255 | .get_pcie_replay_count = &soc15_get_pcie_replay_count, |
| 1016 | 1256 | .supports_baco = &soc15_supports_baco, |
| 1017 | 1257 | .pre_asic_init = &soc15_pre_asic_init, |
| 1258 | + .query_video_codecs = &soc15_query_video_codecs, | |
| 1018 | 1259 | }; |
| 1019 | 1260 | |
| 1020 | 1261 | static int soc15_common_early_init(void *handle) |
| @@ -1244,6 +1485,21 @@ static int soc15_common_early_init(void *handle) · 223 unmodified lines | ||
| 1244 | 1485 | AMD_PG_SUPPORT_JPEG | |
| 1245 | 1486 | AMD_PG_SUPPORT_VCN_DPG; |
| 1246 | 1487 | break; |
| 1488 | + case CHIP_ALDEBARAN: | |
| 1489 | + adev->asic_funcs = &vega20_asic_funcs; | |
| 1490 | + adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | | |
| 1491 | + AMD_CG_SUPPORT_GFX_MGLS | | |
| 1492 | + AMD_CG_SUPPORT_GFX_CGCG | | |
| 1493 | + AMD_CG_SUPPORT_GFX_CGLS | | |
| 1494 | + AMD_CG_SUPPORT_GFX_CP_LS | | |
| 1495 | + AMD_CG_SUPPORT_HDP_LS | | |
| 1496 | + AMD_CG_SUPPORT_SDMA_MGCG | | |
| 1497 | + AMD_CG_SUPPORT_SDMA_LS | | |
| 1498 | + AMD_CG_SUPPORT_IH_CG; | |
| 1499 | + /*AMD_CG_SUPPORT_VCN_MGCG |AMD_CG_SUPPORT_JPEG_MGCG;*/ | |
| 1500 | + adev->pg_flags = AMD_PG_SUPPORT_VCN_DPG; | |
| 1501 | + adev->external_rev_id = adev->rev_id + 0x3c; | |
| 1502 | + break; | |
| 1247 | 1503 | default: |
| 1248 | 1504 | /* FIXME: not supported yet */ |
| 1249 | 1505 | return -EINVAL; |
| @@ -1477,6 +1733,7 @@ static int soc15_common_set_clockgating_state(void *handle, · 227 unmodified lines | ||
| 1477 | 1733 | state == AMD_CG_STATE_GATE); |
| 1478 | 1734 | break; |
| 1479 | 1735 | case CHIP_ARCTURUS: |
| 1736 | + case CHIP_ALDEBARAN: | |
| 1480 | 1737 | adev->hdp.funcs->update_clock_gating(adev, |
| 1481 | 1738 | state == AMD_CG_STATE_GATE); |
| 1482 | 1739 | break; |
| @@ -1498,15 +1755,18 @@ static void soc15_common_get_clockgating_state(void *handle, u32 *flags) · 15 unmodified lines | ||
| 1498 | 1755 | |
| 1499 | 1756 | adev->hdp.funcs->get_clock_gating_state(adev, flags); |
| 1500 | 1757 | |
| 1501 | − /* AMD_CG_SUPPORT_DRM_MGCG */ | |
| 1502 | − data = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_MISC_CGTT_CTRL0)); | |
| 1503 | − if (!(data & 0x01000000)) | |
| 1504 | − *flags |= AMD_CG_SUPPORT_DRM_MGCG; | |
| 1758 | + if (adev->asic_type != CHIP_ALDEBARAN) { | |
| 1505 | 1759 | |
| 1506 | − /* AMD_CG_SUPPORT_DRM_LS */ | |
| 1507 | − data = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_MISC_LIGHT_SLEEP_CTRL)); | |
| 1508 | − if (data & 0x1) | |
| 1509 | − *flags |= AMD_CG_SUPPORT_DRM_LS; | |
| 1760 | + /* AMD_CG_SUPPORT_DRM_MGCG */ | |
| 1761 | + data = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_MISC_CGTT_CTRL0)); | |
| 1762 | + if (!(data & 0x01000000)) | |
| 1763 | + *flags |= AMD_CG_SUPPORT_DRM_MGCG; | |
| 1764 | + | |
| 1765 | + /* AMD_CG_SUPPORT_DRM_LS */ | |
| 1766 | + data = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_MISC_LIGHT_SLEEP_CTRL)); | |
| 1767 | + if (data & 0x1) | |
| 1768 | + *flags |= AMD_CG_SUPPORT_DRM_LS; | |
| 1769 | + } | |
| 1510 | 1770 | |
| 1511 | 1771 | /* AMD_CG_SUPPORT_ROM_MGCG */ |
| 1512 | 1772 | adev->smuio.funcs->get_clock_gating_state(adev, flags); |
| @@ -49,6 +49,13 @@ struct soc15_reg_rlcg { · 48 unmodified lines | ||
| 49 | 49 | u32 reg; |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | +struct soc15_reg { | |
| 53 | + uint32_t hwip; | |
| 54 | + uint32_t inst; | |
| 55 | + uint32_t seg; | |
| 56 | + uint32_t reg_offset; | |
| 57 | +}; | |
| 58 | + | |
| 52 | 59 | struct soc15_reg_entry { |
| 53 | 60 | uint32_t hwip; |
| 54 | 61 | uint32_t inst; |
| @@ -88,6 +95,10 @@ struct soc15_ras_field_entry { · 33 unmodified lines | ||
| 88 | 95 | |
| 89 | 96 | #define SOC15_REG_FIELD(reg, field) reg##__##field##_MASK, reg##__##field##__SHIFT |
| 90 | 97 | |
| 98 | +#define SOC15_REG_FIELD_VAL(val, mask, shift) (((val) & mask) >> shift) | |
| 99 | + | |
| 100 | +#define SOC15_RAS_REG_FIELD_VAL(val, entry, field) SOC15_REG_FIELD_VAL((val), (entry).field##_count_mask, (entry).field##_count_shift) | |
| 101 | + | |
| 91 | 102 | void soc15_grbm_select(struct amdgpu_device *adev, |
| 92 | 103 | u32 me, u32 pipe, u32 queue, u32 vmid); |
| 93 | 104 | void soc15_set_virt_ops(struct amdgpu_device *adev); |
| @@ -100,6 +111,7 @@ void soc15_program_register_sequence(struct amdgpu_device *adev, · 6 unmodified lines | ||
| 100 | 111 | int vega10_reg_base_init(struct amdgpu_device *adev); |
| 101 | 112 | int vega20_reg_base_init(struct amdgpu_device *adev); |
| 102 | 113 | int arct_reg_base_init(struct amdgpu_device *adev); |
| 114 | +int aldebaran_reg_base_init(struct amdgpu_device *adev); | |
| 103 | 115 | |
| 104 | 116 | void vega10_doorbell_index_init(struct amdgpu_device *adev); |
| 105 | 117 | void vega20_doorbell_index_init(struct amdgpu_device *adev); |
| @@ -100,6 +100,30 @@ · 99 unmodified lines | ||
| 100 | 100 | } \ |
| 101 | 101 | } while (0) |
| 102 | 102 | |
| 103 | +#define WREG32_RLC_EX(prefix, reg, value) \ | |
| 104 | + do { \ | |
| 105 | + if (amdgpu_sriov_fullaccess(adev)) { \ | |
| 106 | + uint32_t i = 0; \ | |
| 107 | + uint32_t retries = 50000; \ | |
| 108 | + uint32_t r0 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG0_BASE_IDX] + prefix##SCRATCH_REG0; \ | |
| 109 | + uint32_t r1 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG1; \ | |
| 110 | + uint32_t spare_int = adev->reg_offset[GC_HWIP][0][prefix##RLC_SPARE_INT_BASE_IDX] + prefix##RLC_SPARE_INT; \ | |
| 111 | + WREG32(r0, value); \ | |
| 112 | + WREG32(r1, (reg | 0x80000000)); \ | |
| 113 | + WREG32(spare_int, 0x1); \ | |
| 114 | + for (i = 0; i < retries; i++) { \ | |
| 115 | + u32 tmp = RREG32(r1); \ | |
| 116 | + if (!(tmp & 0x80000000)) \ | |
| 117 | + break; \ | |
| 118 | + udelay(10); \ | |
| 119 | + } \ | |
| 120 | + if (i >= retries) \ | |
| 121 | + pr_err("timeout: rlcg program reg:0x%05x failed !\n", reg); \ | |
| 122 | + } else { \ | |
| 123 | + WREG32(reg, value); \ | |
| 124 | + } \ | |
| 125 | + } while (0) | |
| 126 | + | |
| 103 | 127 | #define WREG32_SOC15_RLC_SHADOW(ip, inst, reg, value) \ |
| 104 | 128 | do { \ |
| 105 | 129 | uint32_t target_reg = adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg;\ |
| @@ -118,12 +142,36 @@ · 12 unmodified lines | ||
| 118 | 142 | } \ |
| 119 | 143 | } while (0) |
| 120 | 144 | |
| 145 | +#define WREG32_SOC15_RLC_SHADOW_EX(prefix, ip, inst, reg, value) \ | |
| 146 | + do { \ | |
| 147 | + uint32_t target_reg = adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg;\ | |
| 148 | + if (amdgpu_sriov_fullaccess(adev)) { \ | |
| 149 | + uint32_t r2 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG2; \ | |
| 150 | + uint32_t r3 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG3; \ | |
| 151 | + uint32_t grbm_cntl = adev->reg_offset[GC_HWIP][0][prefix##GRBM_GFX_CNTL_BASE_IDX] + prefix##GRBM_GFX_CNTL; \ | |
| 152 | + uint32_t grbm_idx = adev->reg_offset[GC_HWIP][0][prefix##GRBM_GFX_INDEX_BASE_IDX] + prefix##GRBM_GFX_INDEX; \ | |
| 153 | + if (target_reg == grbm_cntl) \ | |
| 154 | + WREG32(r2, value); \ | |
| 155 | + else if (target_reg == grbm_idx) \ | |
| 156 | + WREG32(r3, value); \ | |
| 157 | + WREG32(target_reg, value); \ | |
| 158 | + } else { \ | |
| 159 | + WREG32(target_reg, value); \ | |
| 160 | + } \ | |
| 161 | + } while (0) | |
| 162 | + | |
| 121 | 163 | #define WREG32_SOC15_RLC(ip, inst, reg, value) \ |
| 122 | 164 | do { \ |
| 123 | 165 | uint32_t target_reg = adev->reg_offset[GC_HWIP][0][reg##_BASE_IDX] + reg;\ |
| 124 | 166 | WREG32_RLC(target_reg, value); \ |
| 125 | 167 | } while (0) |
| 126 | 168 | |
| 169 | +#define WREG32_SOC15_RLC_EX(prefix, ip, inst, reg, value) \ | |
| 170 | + do { \ | |
| 171 | + uint32_t target_reg = adev->reg_offset[GC_HWIP][0][reg##_BASE_IDX] + reg;\ | |
| 172 | + WREG32_RLC_EX(prefix, target_reg, value); \ | |
| 173 | + } while (0) | |
| 174 | + | |
| 127 | 175 | #define WREG32_FIELD15_RLC(ip, idx, reg, field, val) \ |
| 128 | 176 | WREG32_RLC((adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg), \ |
| 129 | 177 | (RREG32(adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg) \ |
| @@ -50,6 +50,7 @@ enum ta_securedisplay_status { · 49 unmodified lines | ||
| 50 | 50 | TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR = 0x04, /* Fail to Write to I2C */ |
| 51 | 51 | TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR = 0x05, /*Fail Read DIO Scratch Register*/ |
| 52 | 52 | TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR = 0x06, /* Fail to Read CRC*/ |
| 53 | + TA_SECUREDISPLAY_STATUS__I2C_INIT_ERROR = 0x07, /* Failed to initialize I2C */ | |
| 53 | 54 | |
| 54 | 55 | TA_SECUREDISPLAY_STATUS__MAX = 0x7FFFFFFF,/* Maximum Value for status*/ |
| 55 | 56 | }; |
| @@ -1545,6 +1545,36 @@ static const struct amdgpu_ring_funcs vcn_v2_5_dec_ring_vm_funcs = { · 1544 unmodified lines | ||
| 1545 | 1545 | .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, |
| 1546 | 1546 | }; |
| 1547 | 1547 | |
| 1548 | +static const struct amdgpu_ring_funcs vcn_v2_6_dec_ring_vm_funcs = { | |
| 1549 | + .type = AMDGPU_RING_TYPE_VCN_DEC, | |
| 1550 | + .align_mask = 0xf, | |
| 1551 | + .vmhub = AMDGPU_MMHUB_0, | |
| 1552 | + .get_rptr = vcn_v2_5_dec_ring_get_rptr, | |
| 1553 | + .get_wptr = vcn_v2_5_dec_ring_get_wptr, | |
| 1554 | + .set_wptr = vcn_v2_5_dec_ring_set_wptr, | |
| 1555 | + .emit_frame_size = | |
| 1556 | + SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 + | |
| 1557 | + SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 8 + | |
| 1558 | + 8 + /* vcn_v2_0_dec_ring_emit_vm_flush */ | |
| 1559 | + 14 + 14 + /* vcn_v2_0_dec_ring_emit_fence x2 vm fence */ | |
| 1560 | + 6, | |
| 1561 | + .emit_ib_size = 8, /* vcn_v2_0_dec_ring_emit_ib */ | |
| 1562 | + .emit_ib = vcn_v2_0_dec_ring_emit_ib, | |
| 1563 | + .emit_fence = vcn_v2_0_dec_ring_emit_fence, | |
| 1564 | + .emit_vm_flush = vcn_v2_0_dec_ring_emit_vm_flush, | |
| 1565 | + .test_ring = vcn_v2_0_dec_ring_test_ring, | |
| 1566 | + .test_ib = amdgpu_vcn_dec_ring_test_ib, | |
| 1567 | + .insert_nop = vcn_v2_0_dec_ring_insert_nop, | |
| 1568 | + .insert_start = vcn_v2_0_dec_ring_insert_start, | |
| 1569 | + .insert_end = vcn_v2_0_dec_ring_insert_end, | |
| 1570 | + .pad_ib = amdgpu_ring_generic_pad_ib, | |
| 1571 | + .begin_use = amdgpu_vcn_ring_begin_use, | |
| 1572 | + .end_use = amdgpu_vcn_ring_end_use, | |
| 1573 | + .emit_wreg = vcn_v2_0_dec_ring_emit_wreg, | |
| 1574 | + .emit_reg_wait = vcn_v2_0_dec_ring_emit_reg_wait, | |
| 1575 | + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, | |
| 1576 | +}; | |
| 1577 | + | |
| 1548 | 1578 | /** |
| 1549 | 1579 | * vcn_v2_5_enc_ring_get_rptr - get enc read pointer |
| 1550 | 1580 | * |
| @@ -1644,6 +1674,36 @@ static const struct amdgpu_ring_funcs vcn_v2_5_enc_ring_vm_funcs = { · 93 unmodified lines | ||
| 1644 | 1674 | .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, |
| 1645 | 1675 | }; |
| 1646 | 1676 | |
| 1677 | +static const struct amdgpu_ring_funcs vcn_v2_6_enc_ring_vm_funcs = { | |
| 1678 | + .type = AMDGPU_RING_TYPE_VCN_ENC, | |
| 1679 | + .align_mask = 0x3f, | |
| 1680 | + .nop = VCN_ENC_CMD_NO_OP, | |
| 1681 | + .vmhub = AMDGPU_MMHUB_0, | |
| 1682 | + .get_rptr = vcn_v2_5_enc_ring_get_rptr, | |
| 1683 | + .get_wptr = vcn_v2_5_enc_ring_get_wptr, | |
| 1684 | + .set_wptr = vcn_v2_5_enc_ring_set_wptr, | |
| 1685 | + .emit_frame_size = | |
| 1686 | + SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 + | |
| 1687 | + SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 4 + | |
| 1688 | + 4 + /* vcn_v2_0_enc_ring_emit_vm_flush */ | |
| 1689 | + 5 + 5 + /* vcn_v2_0_enc_ring_emit_fence x2 vm fence */ | |
| 1690 | + 1, /* vcn_v2_0_enc_ring_insert_end */ | |
| 1691 | + .emit_ib_size = 5, /* vcn_v2_0_enc_ring_emit_ib */ | |
| 1692 | + .emit_ib = vcn_v2_0_enc_ring_emit_ib, | |
| 1693 | + .emit_fence = vcn_v2_0_enc_ring_emit_fence, | |
| 1694 | + .emit_vm_flush = vcn_v2_0_enc_ring_emit_vm_flush, | |
| 1695 | + .test_ring = amdgpu_vcn_enc_ring_test_ring, | |
| 1696 | + .test_ib = amdgpu_vcn_enc_ring_test_ib, | |
| 1697 | + .insert_nop = amdgpu_ring_insert_nop, | |
| 1698 | + .insert_end = vcn_v2_0_enc_ring_insert_end, | |
| 1699 | + .pad_ib = amdgpu_ring_generic_pad_ib, | |
| 1700 | + .begin_use = amdgpu_vcn_ring_begin_use, | |
| 1701 | + .end_use = amdgpu_vcn_ring_end_use, | |
| 1702 | + .emit_wreg = vcn_v2_0_enc_ring_emit_wreg, | |
| 1703 | + .emit_reg_wait = vcn_v2_0_enc_ring_emit_reg_wait, | |
| 1704 | + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, | |
| 1705 | +}; | |
| 1706 | + | |
| 1647 | 1707 | static void vcn_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev) |
| 1648 | 1708 | { |
| 1649 | 1709 | int i; |
| @@ -1651,7 +1711,10 @@ static void vcn_v2_5_set_dec_ring_funcs(struct amdgpu_device *adev) · 1 unmodified line | ||
| 1651 | 1711 | for (i = 0; i < adev->vcn.num_vcn_inst; ++i) { |
| 1652 | 1712 | if (adev->vcn.harvest_config & (1 << i)) |
| 1653 | 1713 | continue; |
| 1654 | − adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_5_dec_ring_vm_funcs; | |
| 1714 | + if (adev->asic_type == CHIP_ARCTURUS) | |
| 1715 | + adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_5_dec_ring_vm_funcs; | |
| 1716 | + else /* CHIP_ALDEBARAN */ | |
| 1717 | + adev->vcn.inst[i].ring_dec.funcs = &vcn_v2_6_dec_ring_vm_funcs; | |
| 1655 | 1718 | adev->vcn.inst[i].ring_dec.me = i; |
| 1656 | 1719 | DRM_INFO("VCN(%d) decode is enabled in VM mode\n", i); |
| 1657 | 1720 | } |
| @@ -1665,7 +1728,10 @@ static void vcn_v2_5_set_enc_ring_funcs(struct amdgpu_device *adev) · 7 unmodified lines | ||
| 1665 | 1728 | if (adev->vcn.harvest_config & (1 << j)) |
| 1666 | 1729 | continue; |
| 1667 | 1730 | for (i = 0; i < adev->vcn.num_enc_rings; ++i) { |
| 1668 | − adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_5_enc_ring_vm_funcs; | |
| 1731 | + if (adev->asic_type == CHIP_ARCTURUS) | |
| 1732 | + adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_5_enc_ring_vm_funcs; | |
| 1733 | + else /* CHIP_ALDEBARAN */ | |
| 1734 | + adev->vcn.inst[j].ring_enc[i].funcs = &vcn_v2_6_enc_ring_vm_funcs; | |
| 1669 | 1735 | adev->vcn.inst[j].ring_enc[i].me = j; |
| 1670 | 1736 | } |
| 1671 | 1737 | DRM_INFO("VCN(%d) encode is enabled in VM mode\n", j); |
| @@ -1830,6 +1896,26 @@ static const struct amd_ip_funcs vcn_v2_5_ip_funcs = { · 158 unmodified lines | ||
| 1830 | 1896 | .set_powergating_state = vcn_v2_5_set_powergating_state, |
| 1831 | 1897 | }; |
| 1832 | 1898 | |
| 1899 | +static const struct amd_ip_funcs vcn_v2_6_ip_funcs = { | |
| 1900 | + .name = "vcn_v2_6", | |
| 1901 | + .early_init = vcn_v2_5_early_init, | |
| 1902 | + .late_init = NULL, | |
| 1903 | + .sw_init = vcn_v2_5_sw_init, | |
| 1904 | + .sw_fini = vcn_v2_5_sw_fini, | |
| 1905 | + .hw_init = vcn_v2_5_hw_init, | |
| 1906 | + .hw_fini = vcn_v2_5_hw_fini, | |
| 1907 | + .suspend = vcn_v2_5_suspend, | |
| 1908 | + .resume = vcn_v2_5_resume, | |
| 1909 | + .is_idle = vcn_v2_5_is_idle, | |
| 1910 | + .wait_for_idle = vcn_v2_5_wait_for_idle, | |
| 1911 | + .check_soft_reset = NULL, | |
| 1912 | + .pre_soft_reset = NULL, | |
| 1913 | + .soft_reset = NULL, | |
| 1914 | + .post_soft_reset = NULL, | |
| 1915 | + .set_clockgating_state = vcn_v2_5_set_clockgating_state, | |
| 1916 | + .set_powergating_state = vcn_v2_5_set_powergating_state, | |
| 1917 | +}; | |
| 1918 | + | |
| 1833 | 1919 | const struct amdgpu_ip_block_version vcn_v2_5_ip_block = |
| 1834 | 1920 | { |
| 1835 | 1921 | .type = AMD_IP_BLOCK_TYPE_VCN, |
| @@ -1838,3 +1924,12 @@ const struct amdgpu_ip_block_version vcn_v2_5_ip_block = · 2 unmodified lines | ||
| 1838 | 1924 | .rev = 0, |
| 1839 | 1925 | .funcs = &vcn_v2_5_ip_funcs, |
| 1840 | 1926 | }; |
| 1927 | + | |
| 1928 | +const struct amdgpu_ip_block_version vcn_v2_6_ip_block = | |
| 1929 | +{ | |
| 1930 | + .type = AMD_IP_BLOCK_TYPE_VCN, | |
| 1931 | + .major = 2, | |
| 1932 | + .minor = 6, | |
| 1933 | + .rev = 0, | |
| 1934 | + .funcs = &vcn_v2_6_ip_funcs, | |
| 1935 | +}; | |
| @@ -25,5 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | #define __VCN_V2_5_H__ |
| 26 | 26 | |
| 27 | 27 | extern const struct amdgpu_ip_block_version vcn_v2_5_ip_block; |
| 28 | +extern const struct amdgpu_ip_block_version vcn_v2_6_ip_block; | |
| 28 | 29 | |
| 29 | 30 | #endif /* __VCN_V2_5_H__ */ |
| @@ -238,7 +238,8 @@ static int vcn_v3_0_sw_init(void *handle) · 237 unmodified lines | ||
| 238 | 238 | |
| 239 | 239 | fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr; |
| 240 | 240 | fw_shared->present_flag_0 |= cpu_to_le32(AMDGPU_VCN_SW_RING_FLAG) | |
| 241 | − cpu_to_le32(AMDGPU_VCN_MULTI_QUEUE_FLAG); | |
| 241 | + cpu_to_le32(AMDGPU_VCN_MULTI_QUEUE_FLAG) | | |
| 242 | + cpu_to_le32(AMDGPU_VCN_FW_SHARED_FLAG_0_RB); | |
| 242 | 243 | fw_shared->sw_ring.is_enabled = cpu_to_le32(DEC_SW_RING_ENABLED); |
| 243 | 244 | } |
| 244 | 245 | |
| @@ -1074,7 +1075,13 @@ static int vcn_v3_0_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, boo · 829 unmodified lines | ||
| 1074 | 1075 | WREG32_SOC15(VCN, inst_idx, mmUVD_RBC_RB_WPTR, |
| 1075 | 1076 | lower_32_bits(ring->wptr)); |
| 1076 | 1077 | |
| 1078 | + /* Reset FW shared memory RBC WPTR/RPTR */ | |
| 1079 | + fw_shared->rb.rptr = 0; | |
| 1080 | + fw_shared->rb.wptr = lower_32_bits(ring->wptr); | |
| 1081 | + | |
| 1082 | + /*resetting done, fw can check RB ring */ | |
| 1077 | 1083 | fw_shared->multi_queue.decode_queue_mode &= cpu_to_le32(~FW_QUEUE_RING_RESET); |
| 1084 | + | |
| 1078 | 1085 | /* Unstall DPG */ |
| 1079 | 1086 | WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS), |
| 1080 | 1087 | 0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK); |
| @@ -1239,9 +1246,11 @@ static int vcn_v3_0_start(struct amdgpu_device *adev) · 158 unmodified lines | ||
| 1239 | 1246 | /* Initialize the ring buffer's read and write pointers */ |
| 1240 | 1247 | WREG32_SOC15(VCN, i, mmUVD_RBC_RB_RPTR, 0); |
| 1241 | 1248 | |
| 1249 | + WREG32_SOC15(VCN, i, mmUVD_SCRATCH2, 0); | |
| 1242 | 1250 | ring->wptr = RREG32_SOC15(VCN, i, mmUVD_RBC_RB_RPTR); |
| 1243 | 1251 | WREG32_SOC15(VCN, i, mmUVD_RBC_RB_WPTR, |
| 1244 | 1252 | lower_32_bits(ring->wptr)); |
| 1253 | + fw_shared->rb.wptr = lower_32_bits(ring->wptr); | |
| 1245 | 1254 | fw_shared->multi_queue.decode_queue_mode &= cpu_to_le32(~FW_QUEUE_RING_RESET); |
| 1246 | 1255 | |
| 1247 | 1256 | fw_shared->multi_queue.encode_generalpurpose_queue_mode |= cpu_to_le32(FW_QUEUE_RING_RESET); |
| @@ -1662,6 +1671,10 @@ static int vcn_v3_0_pause_dpg_mode(struct amdgpu_device *adev, · 414 unmodified lines | ||
| 1662 | 1671 | WREG32_SOC15(VCN, inst_idx, mmUVD_RB_WPTR2, lower_32_bits(ring->wptr)); |
| 1663 | 1672 | fw_shared->multi_queue.encode_lowlatency_queue_mode &= cpu_to_le32(~FW_QUEUE_RING_RESET); |
| 1664 | 1673 | |
| 1674 | + /* restore wptr/rptr with pointers saved in FW shared memory*/ | |
| 1675 | + WREG32_SOC15(VCN, inst_idx, mmUVD_RBC_RB_RPTR, fw_shared->rb.rptr); | |
| 1676 | + WREG32_SOC15(VCN, inst_idx, mmUVD_RBC_RB_WPTR, fw_shared->rb.wptr); | |
| 1677 | + | |
| 1665 | 1678 | /* Unstall DPG */ |
| 1666 | 1679 | WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS), |
| 1667 | 1680 | 0, ~UVD_POWER_STATUS__STALL_DPG_POWER_UP_MASK); |
| @@ -1721,6 +1734,15 @@ static uint64_t vcn_v3_0_dec_ring_get_wptr(struct amdgpu_ring *ring) · 53 unmodified lines | ||
| 1721 | 1734 | static void vcn_v3_0_dec_ring_set_wptr(struct amdgpu_ring *ring) |
| 1722 | 1735 | { |
| 1723 | 1736 | struct amdgpu_device *adev = ring->adev; |
| 1737 | + volatile struct amdgpu_fw_shared *fw_shared; | |
| 1738 | + | |
| 1739 | + if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) { | |
| 1740 | + /*whenever update RBC_RB_WPTR, we save the wptr in shared rb.wptr and scratch2 */ | |
| 1741 | + fw_shared = adev->vcn.inst[ring->me].fw_shared_cpu_addr; | |
| 1742 | + fw_shared->rb.wptr = lower_32_bits(ring->wptr); | |
| 1743 | + WREG32_SOC15(VCN, ring->me, mmUVD_SCRATCH2, | |
| 1744 | + lower_32_bits(ring->wptr)); | |
| 1745 | + } | |
| 1724 | 1746 | |
| 1725 | 1747 | if (ring->use_doorbell) { |
| 1726 | 1748 | adev->wb.wb[ring->wptr_offs] = lower_32_bits(ring->wptr); |
| @@ -220,10 +220,8 @@ static int vega10_ih_enable_ring(struct amdgpu_device *adev, · 219 unmodified lines | ||
| 220 | 220 | tmp = vega10_ih_rb_cntl(ih, tmp); |
| 221 | 221 | if (ih == &adev->irq.ih) |
| 222 | 222 | tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RPTR_REARM, !!adev->irq.msi_enabled); |
| 223 | − if (ih == &adev->irq.ih1) { | |
| 224 | − tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_ENABLE, 0); | |
| 223 | + if (ih == &adev->irq.ih1) | |
| 225 | 224 | tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RB_FULL_DRAIN_ENABLE, 1); |
| 226 | − } | |
| 227 | 225 | if (amdgpu_sriov_vf(adev)) { |
| 228 | 226 | if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp)) { |
| 229 | 227 | dev_err(adev->dev, "PSP program IH_RB_CNTL failed!\n"); |
| @@ -265,7 +263,6 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) · 35 unmodified lines | ||
| 265 | 263 | u32 ih_chicken; |
| 266 | 264 | int ret; |
| 267 | 265 | int i; |
| 268 | − u32 tmp; | |
| 269 | 266 | |
| 270 | 267 | /* disable irqs */ |
| 271 | 268 | ret = vega10_ih_toggle_interrupts(adev, false); |
| @@ -291,15 +288,6 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) · 19 unmodified lines | ||
| 291 | 288 | } |
| 292 | 289 | } |
| 293 | 290 | |
| 294 | − tmp = RREG32_SOC15(OSSSYS, 0, mmIH_STORM_CLIENT_LIST_CNTL); | |
| 295 | − tmp = REG_SET_FIELD(tmp, IH_STORM_CLIENT_LIST_CNTL, | |
| 296 | − CLIENT18_IS_STORM_CLIENT, 1); | |
| 297 | − WREG32_SOC15(OSSSYS, 0, mmIH_STORM_CLIENT_LIST_CNTL, tmp); | |
| 298 | − | |
| 299 | − tmp = RREG32_SOC15(OSSSYS, 0, mmIH_INT_FLOOD_CNTL); | |
| 300 | − tmp = REG_SET_FIELD(tmp, IH_INT_FLOOD_CNTL, FLOOD_CNTL_ENABLE, 1); | |
| 301 | − WREG32_SOC15(OSSSYS, 0, mmIH_INT_FLOOD_CNTL, tmp); | |
| 302 | − | |
| 303 | 291 | pci_set_master(adev->pdev); |
| 304 | 292 | |
| 305 | 293 | /* enable interrupts */ |
| @@ -345,11 +333,17 @@ static u32 vega10_ih_get_wptr(struct amdgpu_device *adev, · 39 unmodified lines | ||
| 345 | 333 | u32 wptr, tmp; |
| 346 | 334 | struct amdgpu_ih_regs *ih_regs; |
| 347 | 335 | |
| 348 | − wptr = le32_to_cpu(*ih->wptr_cpu); | |
| 349 | − ih_regs = &ih->ih_regs; | |
| 336 | + if (ih == &adev->irq.ih) { | |
| 337 | + /* Only ring0 supports writeback. On other rings fall back | |
| 338 | + * to register-based code with overflow checking below. | |
| 339 | + */ | |
| 340 | + wptr = le32_to_cpu(*ih->wptr_cpu); | |
| 350 | 341 | |
| 351 | − if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) | |
| 352 | − goto out; | |
| 342 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) | |
| 343 | + goto out; | |
| 344 | + } | |
| 345 | + | |
| 346 | + ih_regs = &ih->ih_regs; | |
| 353 | 347 | |
| 354 | 348 | /* Double check that the overflow wasn't already cleared. */ |
| 355 | 349 | wptr = RREG32_NO_KIQ(ih_regs->ih_rb_wptr); |
| @@ -440,15 +434,11 @@ static int vega10_ih_self_irq(struct amdgpu_device *adev, · 84 unmodified lines | ||
| 440 | 434 | struct amdgpu_irq_src *source, |
| 441 | 435 | struct amdgpu_iv_entry *entry) |
| 442 | 436 | { |
| 443 | − uint32_t wptr = cpu_to_le32(entry->src_data[0]); | |
| 444 | − | |
| 445 | 437 | switch (entry->ring_id) { |
| 446 | 438 | case 1: |
| 447 | − *adev->irq.ih1.wptr_cpu = wptr; | |
| 448 | 439 | schedule_work(&adev->irq.ih1_work); |
| 449 | 440 | break; |
| 450 | 441 | case 2: |
| 451 | − *adev->irq.ih2.wptr_cpu = wptr; | |
| 452 | 442 | schedule_work(&adev->irq.ih2_work); |
| 453 | 443 | break; |
| 454 | 444 | default: break; |
| @@ -35,6 +35,9 @@ · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | #define MAX_REARM_RETRY 10 |
| 37 | 37 | |
| 38 | +#define mmIH_CHICKEN_ALDEBARAN 0x18d | |
| 39 | +#define mmIH_CHICKEN_ALDEBARAN_BASE_IDX 0 | |
| 40 | + | |
| 38 | 41 | static void vega20_ih_set_interrupt_funcs(struct amdgpu_device *adev); |
| 39 | 42 | |
| 40 | 43 | /** |
| @@ -104,6 +107,8 @@ static int vega20_ih_toggle_ring_interrupts(struct amdgpu_device *adev, · 63 unmodified lines | ||
| 104 | 107 | |
| 105 | 108 | tmp = RREG32(ih_regs->ih_rb_cntl); |
| 106 | 109 | tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RB_ENABLE, (enable ? 1 : 0)); |
| 110 | + tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RB_GPU_TS_ENABLE, 1); | |
| 111 | + | |
| 107 | 112 | /* enable_intr field is only valid in ring0 */ |
| 108 | 113 | if (ih == &adev->irq.ih) |
| 109 | 114 | tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, ENABLE_INTR, (enable ? 1 : 0)); |
| @@ -220,10 +225,8 @@ static int vega20_ih_enable_ring(struct amdgpu_device *adev, · 110 unmodified lines | ||
| 220 | 225 | tmp = vega20_ih_rb_cntl(ih, tmp); |
| 221 | 226 | if (ih == &adev->irq.ih) |
| 222 | 227 | tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RPTR_REARM, !!adev->irq.msi_enabled); |
| 223 | − if (ih == &adev->irq.ih1) { | |
| 224 | − tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_ENABLE, 0); | |
| 228 | + if (ih == &adev->irq.ih1) | |
| 225 | 229 | tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, RB_FULL_DRAIN_ENABLE, 1); |
| 226 | − } | |
| 227 | 230 | if (amdgpu_sriov_vf(adev)) { |
| 228 | 231 | if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp)) { |
| 229 | 232 | dev_err(adev->dev, "PSP program IH_RB_CNTL failed!\n"); |
| @@ -297,7 +300,6 @@ static int vega20_ih_irq_init(struct amdgpu_device *adev) · 67 unmodified lines | ||
| 297 | 300 | u32 ih_chicken; |
| 298 | 301 | int ret; |
| 299 | 302 | int i; |
| 300 | − u32 tmp; | |
| 301 | 303 | |
| 302 | 304 | /* disable irqs */ |
| 303 | 305 | ret = vega20_ih_toggle_interrupts(adev, false); |
| @@ -316,6 +318,18 @@ static int vega20_ih_irq_init(struct amdgpu_device *adev) · 12 unmodified lines | ||
| 316 | 318 | WREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN, ih_chicken); |
| 317 | 319 | } |
| 318 | 320 | |
| 321 | + /* psp firmware won't program IH_CHICKEN for aldebaran | |
| 322 | + * driver needs to program it properly according to | |
| 323 | + * MC_SPACE type in IH_RB_CNTL */ | |
| 324 | + if (adev->asic_type == CHIP_ALDEBARAN) { | |
| 325 | + ih_chicken = RREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN_ALDEBARAN); | |
| 326 | + if (adev->irq.ih.use_bus_addr) { | |
| 327 | + ih_chicken = REG_SET_FIELD(ih_chicken, IH_CHICKEN, | |
| 328 | + MC_SPACE_GPA_ENABLE, 1); | |
| 329 | + } | |
| 330 | + WREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN_ALDEBARAN, ih_chicken); | |
| 331 | + } | |
| 332 | + | |
| 319 | 333 | for (i = 0; i < ARRAY_SIZE(ih); i++) { |
| 320 | 334 | if (ih[i]->ring_size) { |
| 321 | 335 | if (i == 1) |
| @@ -326,15 +340,6 @@ static int vega20_ih_irq_init(struct amdgpu_device *adev) · 4 unmodified lines | ||
| 326 | 340 | } |
| 327 | 341 | } |
| 328 | 342 | |
| 329 | − tmp = RREG32_SOC15(OSSSYS, 0, mmIH_STORM_CLIENT_LIST_CNTL); | |
| 330 | − tmp = REG_SET_FIELD(tmp, IH_STORM_CLIENT_LIST_CNTL, | |
| 331 | − CLIENT18_IS_STORM_CLIENT, 1); | |
| 332 | − WREG32_SOC15(OSSSYS, 0, mmIH_STORM_CLIENT_LIST_CNTL, tmp); | |
| 333 | − | |
| 334 | − tmp = RREG32_SOC15(OSSSYS, 0, mmIH_INT_FLOOD_CNTL); | |
| 335 | − tmp = REG_SET_FIELD(tmp, IH_INT_FLOOD_CNTL, FLOOD_CNTL_ENABLE, 1); | |
| 336 | − WREG32_SOC15(OSSSYS, 0, mmIH_INT_FLOOD_CNTL, tmp); | |
| 337 | − | |
| 338 | 343 | pci_set_master(adev->pdev); |
| 339 | 344 | |
| 340 | 345 | /* enable interrupts */ |
| @@ -380,11 +385,17 @@ static u32 vega20_ih_get_wptr(struct amdgpu_device *adev, · 39 unmodified lines | ||
| 380 | 385 | u32 wptr, tmp; |
| 381 | 386 | struct amdgpu_ih_regs *ih_regs; |
| 382 | 387 | |
| 383 | − wptr = le32_to_cpu(*ih->wptr_cpu); | |
| 384 | − ih_regs = &ih->ih_regs; | |
| 388 | + if (ih == &adev->irq.ih) { | |
| 389 | + /* Only ring0 supports writeback. On other rings fall back | |
| 390 | + * to register-based code with overflow checking below. | |
| 391 | + */ | |
| 392 | + wptr = le32_to_cpu(*ih->wptr_cpu); | |
| 385 | 393 | |
| 386 | − if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) | |
| 387 | − goto out; | |
| 394 | + if (!REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) | |
| 395 | + goto out; | |
| 396 | + } | |
| 397 | + | |
| 398 | + ih_regs = &ih->ih_regs; | |
| 388 | 399 | |
| 389 | 400 | /* Double check that the overflow wasn't already cleared. */ |
| 390 | 401 | wptr = RREG32_NO_KIQ(ih_regs->ih_rb_wptr); |
| @@ -476,15 +487,11 @@ static int vega20_ih_self_irq(struct amdgpu_device *adev, · 85 unmodified lines | ||
| 476 | 487 | struct amdgpu_irq_src *source, |
| 477 | 488 | struct amdgpu_iv_entry *entry) |
| 478 | 489 | { |
| 479 | − uint32_t wptr = cpu_to_le32(entry->src_data[0]); | |
| 480 | − | |
| 481 | 490 | switch (entry->ring_id) { |
| 482 | 491 | case 1: |
| 483 | − *adev->irq.ih1.wptr_cpu = wptr; | |
| 484 | 492 | schedule_work(&adev->irq.ih1_work); |
| 485 | 493 | break; |
| 486 | 494 | case 2: |
| 487 | − *adev->irq.ih2.wptr_cpu = wptr; | |
| 488 | 495 | schedule_work(&adev->irq.ih2_work); |
| 489 | 496 | break; |
| 490 | 497 | default: break; |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/pci.h> |
| 25 | 25 | #include <linux/slab.h> |
| 26 | 26 | |
| 27 | +#include <drm/amdgpu_drm.h> | |
| 28 | + | |
| 27 | 29 | #include "amdgpu.h" |
| 28 | 30 | #include "amdgpu_atombios.h" |
| 29 | 31 | #include "amdgpu_ih.h" |
| @@ -79,6 +81,193 @@ · 49 unmodified lines | ||
| 79 | 81 | #include "mxgpu_vi.h" |
| 80 | 82 | #include "amdgpu_dm.h" |
| 81 | 83 | |
| 84 | +/* Topaz */ | |
| 85 | +static const struct amdgpu_video_codecs topaz_video_codecs_encode = | |
| 86 | +{ | |
| 87 | + .codec_count = 0, | |
| 88 | + .codec_array = NULL, | |
| 89 | +}; | |
| 90 | + | |
| 91 | +/* Tonga, CZ, ST, Fiji */ | |
| 92 | +static const struct amdgpu_video_codec_info tonga_video_codecs_encode_array[] = | |
| 93 | +{ | |
| 94 | + { | |
| 95 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 96 | + .max_width = 4096, | |
| 97 | + .max_height = 2304, | |
| 98 | + .max_pixels_per_frame = 4096 * 2304, | |
| 99 | + .max_level = 0, | |
| 100 | + }, | |
| 101 | +}; | |
| 102 | + | |
| 103 | +static const struct amdgpu_video_codecs tonga_video_codecs_encode = | |
| 104 | +{ | |
| 105 | + .codec_count = ARRAY_SIZE(tonga_video_codecs_encode_array), | |
| 106 | + .codec_array = tonga_video_codecs_encode_array, | |
| 107 | +}; | |
| 108 | + | |
| 109 | +/* Polaris */ | |
| 110 | +static const struct amdgpu_video_codec_info polaris_video_codecs_encode_array[] = | |
| 111 | +{ | |
| 112 | + { | |
| 113 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 114 | + .max_width = 4096, | |
| 115 | + .max_height = 2304, | |
| 116 | + .max_pixels_per_frame = 4096 * 2304, | |
| 117 | + .max_level = 0, | |
| 118 | + }, | |
| 119 | + { | |
| 120 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 121 | + .max_width = 4096, | |
| 122 | + .max_height = 2304, | |
| 123 | + .max_pixels_per_frame = 4096 * 2304, | |
| 124 | + .max_level = 0, | |
| 125 | + }, | |
| 126 | +}; | |
| 127 | + | |
| 128 | +static const struct amdgpu_video_codecs polaris_video_codecs_encode = | |
| 129 | +{ | |
| 130 | + .codec_count = ARRAY_SIZE(polaris_video_codecs_encode_array), | |
| 131 | + .codec_array = polaris_video_codecs_encode_array, | |
| 132 | +}; | |
| 133 | + | |
| 134 | +/* Topaz */ | |
| 135 | +static const struct amdgpu_video_codecs topaz_video_codecs_decode = | |
| 136 | +{ | |
| 137 | + .codec_count = 0, | |
| 138 | + .codec_array = NULL, | |
| 139 | +}; | |
| 140 | + | |
| 141 | +/* Tonga */ | |
| 142 | +static const struct amdgpu_video_codec_info tonga_video_codecs_decode_array[] = | |
| 143 | +{ | |
| 144 | + { | |
| 145 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 146 | + .max_width = 4096, | |
| 147 | + .max_height = 4096, | |
| 148 | + .max_pixels_per_frame = 4096 * 4096, | |
| 149 | + .max_level = 3, | |
| 150 | + }, | |
| 151 | + { | |
| 152 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 153 | + .max_width = 4096, | |
| 154 | + .max_height = 4096, | |
| 155 | + .max_pixels_per_frame = 4096 * 4096, | |
| 156 | + .max_level = 5, | |
| 157 | + }, | |
| 158 | + { | |
| 159 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 160 | + .max_width = 4096, | |
| 161 | + .max_height = 4096, | |
| 162 | + .max_pixels_per_frame = 4096 * 4096, | |
| 163 | + .max_level = 52, | |
| 164 | + }, | |
| 165 | + { | |
| 166 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 167 | + .max_width = 4096, | |
| 168 | + .max_height = 4096, | |
| 169 | + .max_pixels_per_frame = 4096 * 4096, | |
| 170 | + .max_level = 4, | |
| 171 | + }, | |
| 172 | +}; | |
| 173 | + | |
| 174 | +static const struct amdgpu_video_codecs tonga_video_codecs_decode = | |
| 175 | +{ | |
| 176 | + .codec_count = ARRAY_SIZE(tonga_video_codecs_decode_array), | |
| 177 | + .codec_array = tonga_video_codecs_decode_array, | |
| 178 | +}; | |
| 179 | + | |
| 180 | +/* CZ, ST, Fiji, Polaris */ | |
| 181 | +static const struct amdgpu_video_codec_info cz_video_codecs_decode_array[] = | |
| 182 | +{ | |
| 183 | + { | |
| 184 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, | |
| 185 | + .max_width = 4096, | |
| 186 | + .max_height = 4096, | |
| 187 | + .max_pixels_per_frame = 4096 * 4096, | |
| 188 | + .max_level = 3, | |
| 189 | + }, | |
| 190 | + { | |
| 191 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, | |
| 192 | + .max_width = 4096, | |
| 193 | + .max_height = 4096, | |
| 194 | + .max_pixels_per_frame = 4096 * 4096, | |
| 195 | + .max_level = 5, | |
| 196 | + }, | |
| 197 | + { | |
| 198 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, | |
| 199 | + .max_width = 4096, | |
| 200 | + .max_height = 4096, | |
| 201 | + .max_pixels_per_frame = 4096 * 4096, | |
| 202 | + .max_level = 52, | |
| 203 | + }, | |
| 204 | + { | |
| 205 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, | |
| 206 | + .max_width = 4096, | |
| 207 | + .max_height = 4096, | |
| 208 | + .max_pixels_per_frame = 4096 * 4096, | |
| 209 | + .max_level = 4, | |
| 210 | + }, | |
| 211 | + { | |
| 212 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, | |
| 213 | + .max_width = 4096, | |
| 214 | + .max_height = 4096, | |
| 215 | + .max_pixels_per_frame = 4096 * 4096, | |
| 216 | + .max_level = 186, | |
| 217 | + }, | |
| 218 | + { | |
| 219 | + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, | |
| 220 | + .max_width = 4096, | |
| 221 | + .max_height = 4096, | |
| 222 | + .max_pixels_per_frame = 4096 * 4096, | |
| 223 | + .max_level = 0, | |
| 224 | + }, | |
| 225 | +}; | |
| 226 | + | |
| 227 | +static const struct amdgpu_video_codecs cz_video_codecs_decode = | |
| 228 | +{ | |
| 229 | + .codec_count = ARRAY_SIZE(cz_video_codecs_decode_array), | |
| 230 | + .codec_array = cz_video_codecs_decode_array, | |
| 231 | +}; | |
| 232 | + | |
| 233 | +static int vi_query_video_codecs(struct amdgpu_device *adev, bool encode, | |
| 234 | + const struct amdgpu_video_codecs **codecs) | |
| 235 | +{ | |
| 236 | + switch (adev->asic_type) { | |
| 237 | + case CHIP_TOPAZ: | |
| 238 | + if (encode) | |
| 239 | + *codecs = &topaz_video_codecs_encode; | |
| 240 | + else | |
| 241 | + *codecs = &topaz_video_codecs_decode; | |
| 242 | + return 0; | |
| 243 | + case CHIP_TONGA: | |
| 244 | + if (encode) | |
| 245 | + *codecs = &tonga_video_codecs_encode; | |
| 246 | + else | |
| 247 | + *codecs = &tonga_video_codecs_decode; | |
| 248 | + return 0; | |
| 249 | + case CHIP_POLARIS10: | |
| 250 | + case CHIP_POLARIS11: | |
| 251 | + case CHIP_POLARIS12: | |
| 252 | + case CHIP_VEGAM: | |
| 253 | + if (encode) | |
| 254 | + *codecs = &polaris_video_codecs_encode; | |
| 255 | + else | |
| 256 | + *codecs = &cz_video_codecs_decode; | |
| 257 | + return 0; | |
| 258 | + case CHIP_FIJI: | |
| 259 | + case CHIP_CARRIZO: | |
| 260 | + case CHIP_STONEY: | |
| 261 | + if (encode) | |
| 262 | + *codecs = &tonga_video_codecs_encode; | |
| 263 | + else | |
| 264 | + *codecs = &cz_video_codecs_decode; | |
| 265 | + return 0; | |
| 266 | + default: | |
| 267 | + return -EINVAL; | |
| 268 | + } | |
| 269 | +} | |
| 270 | + | |
| 82 | 271 | /* |
| 83 | 272 | * Indirect registers accessor |
| 84 | 273 | */ |
| @@ -1085,6 +1274,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = · 1000 unmodified lines | ||
| 1085 | 1274 | .get_pcie_replay_count = &vi_get_pcie_replay_count, |
| 1086 | 1275 | .supports_baco = &vi_asic_supports_baco, |
| 1087 | 1276 | .pre_asic_init = &vi_pre_asic_init, |
| 1277 | + .query_video_codecs = &vi_query_video_codecs, | |
| 1088 | 1278 | }; |
| 1089 | 1279 | |
| 1090 | 1280 | #define CZ_REV_BRISTOL(rev) \ |
| @@ -80,8 +80,9 @@ static bool cik_event_interrupt_isr(struct kfd_dev *dev, · 79 unmodified lines | ||
| 80 | 80 | ihre->source_id == CIK_INTSRC_SDMA_TRAP || |
| 81 | 81 | ihre->source_id == CIK_INTSRC_SQ_INTERRUPT_MSG || |
| 82 | 82 | ihre->source_id == CIK_INTSRC_CP_BAD_OPCODE || |
| 83 | − ihre->source_id == CIK_INTSRC_GFX_PAGE_INV_FAULT || | |
| 84 | − ihre->source_id == CIK_INTSRC_GFX_MEM_PROT_FAULT; | |
| 83 | + ((ihre->source_id == CIK_INTSRC_GFX_PAGE_INV_FAULT || | |
| 84 | + ihre->source_id == CIK_INTSRC_GFX_MEM_PROT_FAULT) && | |
| 85 | + !amdgpu_no_queue_eviction_on_vm_fault); | |
| 85 | 86 | } |
| 86 | 87 | |
| 87 | 88 | static void cik_event_interrupt_wq(struct kfd_dev *dev, |
| @@ -1575,6 +1575,498 @@ static const uint32_t cwsr_trap_arcturus_hex[] = { · 1574 unmodified lines | ||
| 1575 | 1575 | 0xbf810000, 0x00000000, |
| 1576 | 1576 | }; |
| 1577 | 1577 | |
| 1578 | +static const uint32_t cwsr_trap_aldebaran_hex[] = { | |
| 1579 | + 0xbf820001, 0xbf8202ce, | |
| 1580 | + 0xb8f8f802, 0x89788678, | |
| 1581 | + 0xb8eef801, 0x866eff6e, | |
| 1582 | + 0x00000800, 0xbf840003, | |
| 1583 | + 0x866eff78, 0x00002000, | |
| 1584 | + 0xbf840016, 0xb8fbf803, | |
| 1585 | + 0x866eff7b, 0x00000400, | |
| 1586 | + 0xbf85003b, 0x866eff7b, | |
| 1587 | + 0x00000800, 0xbf850003, | |
| 1588 | + 0x866eff7b, 0x00000100, | |
| 1589 | + 0xbf84000c, 0x866eff78, | |
| 1590 | + 0x00002000, 0xbf840005, | |
| 1591 | + 0xbf8e0010, 0xb8eef803, | |
| 1592 | + 0x866eff6e, 0x00000400, | |
| 1593 | + 0xbf84fffb, 0x8778ff78, | |
| 1594 | + 0x00002000, 0x80ec886c, | |
| 1595 | + 0x82ed806d, 0xb8eef807, | |
| 1596 | + 0x866fff6e, 0x001f8000, | |
| 1597 | + 0x8e6f8b6f, 0x8977ff77, | |
| 1598 | + 0xfc000000, 0x87776f77, | |
| 1599 | + 0x896eff6e, 0x001f8000, | |
| 1600 | + 0xb96ef807, 0xb8faf812, | |
| 1601 | + 0xb8fbf813, 0x8efa887a, | |
| 1602 | + 0xc0071bbd, 0x00000000, | |
| 1603 | + 0xbf8cc07f, 0xc0071ebd, | |
| 1604 | + 0x00000008, 0xbf8cc07f, | |
| 1605 | + 0x86ee6e6e, 0xbf840001, | |
| 1606 | + 0xbe801d6e, 0xb8fbf803, | |
| 1607 | + 0x867bff7b, 0x000001ff, | |
| 1608 | + 0xbf850002, 0x806c846c, | |
| 1609 | + 0x826d806d, 0x866dff6d, | |
| 1610 | + 0x0000ffff, 0x8f6e8b77, | |
| 1611 | + 0x866eff6e, 0x001f8000, | |
| 1612 | + 0xb96ef807, 0x86fe7e7e, | |
| 1613 | + 0x86ea6a6a, 0x8f6e8378, | |
| 1614 | + 0xb96ee0c2, 0xbf800002, | |
| 1615 | + 0xb9780002, 0xbe801f6c, | |
| 1616 | + 0x866dff6d, 0x0000ffff, | |
| 1617 | + 0xbefa0080, 0xb97a0283, | |
| 1618 | + 0xb8fa2407, 0x8e7a9b7a, | |
| 1619 | + 0x876d7a6d, 0xb8fa03c7, | |
| 1620 | + 0x8e7a9a7a, 0x876d7a6d, | |
| 1621 | + 0xb8faf807, 0x867aff7a, | |
| 1622 | + 0x00007fff, 0xb97af807, | |
| 1623 | + 0xbeee007e, 0xbeef007f, | |
| 1624 | + 0xbefe0180, 0xbf900004, | |
| 1625 | + 0x877a8478, 0xb97af802, | |
| 1626 | + 0xbf8e0002, 0xbf88fffe, | |
| 1627 | + 0xb8fa2985, 0x807a817a, | |
| 1628 | + 0x8e7a8a7a, 0x8e7a817a, | |
| 1629 | + 0xb8fb1605, 0x807b817b, | |
| 1630 | + 0x8e7b867b, 0x807a7b7a, | |
| 1631 | + 0x807a7e7a, 0x827b807f, | |
| 1632 | + 0x867bff7b, 0x0000ffff, | |
| 1633 | + 0xc04b1c3d, 0x00000050, | |
| 1634 | + 0xbf8cc07f, 0xc04b1d3d, | |
| 1635 | + 0x00000060, 0xbf8cc07f, | |
| 1636 | + 0xc0431e7d, 0x00000074, | |
| 1637 | + 0xbf8cc07f, 0xbef4007e, | |
| 1638 | + 0x8675ff7f, 0x0000ffff, | |
| 1639 | + 0x8775ff75, 0x00040000, | |
| 1640 | + 0xbef60080, 0xbef700ff, | |
| 1641 | + 0x00807fac, 0x867aff7f, | |
| 1642 | + 0x08000000, 0x8f7a837a, | |
| 1643 | + 0x87777a77, 0x867aff7f, | |
| 1644 | + 0x70000000, 0x8f7a817a, | |
| 1645 | + 0x87777a77, 0xbef1007c, | |
| 1646 | + 0xbef00080, 0xb8f02985, | |
| 1647 | + 0x80708170, 0x8e708a70, | |
| 1648 | + 0x8e708170, 0xb8fa1605, | |
| 1649 | + 0x807a817a, 0x8e7a867a, | |
| 1650 | + 0x80707a70, 0xbef60084, | |
| 1651 | + 0xbef600ff, 0x01000000, | |
| 1652 | + 0xbefe007c, 0xbefc0070, | |
| 1653 | + 0xc0611c7a, 0x0000007c, | |
| 1654 | + 0xbf8cc07f, 0x80708470, | |
| 1655 | + 0xbefc007e, 0xbefe007c, | |
| 1656 | + 0xbefc0070, 0xc0611b3a, | |
| 1657 | + 0x0000007c, 0xbf8cc07f, | |
| 1658 | + 0x80708470, 0xbefc007e, | |
| 1659 | + 0xbefe007c, 0xbefc0070, | |
| 1660 | + 0xc0611b7a, 0x0000007c, | |
| 1661 | + 0xbf8cc07f, 0x80708470, | |
| 1662 | + 0xbefc007e, 0xbefe007c, | |
| 1663 | + 0xbefc0070, 0xc0611bba, | |
| 1664 | + 0x0000007c, 0xbf8cc07f, | |
| 1665 | + 0x80708470, 0xbefc007e, | |
| 1666 | + 0xbefe007c, 0xbefc0070, | |
| 1667 | + 0xc0611bfa, 0x0000007c, | |
| 1668 | + 0xbf8cc07f, 0x80708470, | |
| 1669 | + 0xbefc007e, 0xbefe007c, | |
| 1670 | + 0xbefc0070, 0xc0611e3a, | |
| 1671 | + 0x0000007c, 0xbf8cc07f, | |
| 1672 | + 0x80708470, 0xbefc007e, | |
| 1673 | + 0xb8fbf803, 0xbefe007c, | |
| 1674 | + 0xbefc0070, 0xc0611efa, | |
| 1675 | + 0x0000007c, 0xbf8cc07f, | |
| 1676 | + 0x80708470, 0xbefc007e, | |
| 1677 | + 0xbefe007c, 0xbefc0070, | |
| 1678 | + 0xc0611a3a, 0x0000007c, | |
| 1679 | + 0xbf8cc07f, 0x80708470, | |
| 1680 | + 0xbefc007e, 0xbefe007c, | |
| 1681 | + 0xbefc0070, 0xc0611a7a, | |
| 1682 | + 0x0000007c, 0xbf8cc07f, | |
| 1683 | + 0x80708470, 0xbefc007e, | |
| 1684 | + 0xb8f1f801, 0xbefe007c, | |
| 1685 | + 0xbefc0070, 0xc0611c7a, | |
| 1686 | + 0x0000007c, 0xbf8cc07f, | |
| 1687 | + 0x80708470, 0xbefc007e, | |
| 1688 | + 0x867aff7f, 0x04000000, | |
| 1689 | + 0xbeef0080, 0x876f6f7a, | |
| 1690 | + 0xb8f02985, 0x80708170, | |
| 1691 | + 0x8e708a70, 0x8e708170, | |
| 1692 | + 0xb8fb1605, 0x807b817b, | |
| 1693 | + 0x8e7b847b, 0x8e76827b, | |
| 1694 | + 0xbef600ff, 0x01000000, | |
| 1695 | + 0xbef20174, 0x80747074, | |
| 1696 | + 0x82758075, 0xbefc0080, | |
| 1697 | + 0xbf800000, 0xbe802b00, | |
| 1698 | + 0xbe822b02, 0xbe842b04, | |
| 1699 | + 0xbe862b06, 0xbe882b08, | |
| 1700 | + 0xbe8a2b0a, 0xbe8c2b0c, | |
| 1701 | + 0xbe8e2b0e, 0xc06b003a, | |
| 1702 | + 0x00000000, 0xbf8cc07f, | |
| 1703 | + 0xc06b013a, 0x00000010, | |
| 1704 | + 0xbf8cc07f, 0xc06b023a, | |
| 1705 | + 0x00000020, 0xbf8cc07f, | |
| 1706 | + 0xc06b033a, 0x00000030, | |
| 1707 | + 0xbf8cc07f, 0x8074c074, | |
| 1708 | + 0x82758075, 0x807c907c, | |
| 1709 | + 0xbf0a7b7c, 0xbf85ffe7, | |
| 1710 | + 0xbef40172, 0xbef00080, | |
| 1711 | + 0xbefe00c1, 0xbeff00c1, | |
| 1712 | + 0xbee80080, 0xbee90080, | |
| 1713 | + 0xbef600ff, 0x01000000, | |
| 1714 | + 0x867aff78, 0x00400000, | |
| 1715 | + 0xbf850003, 0xb8faf803, | |
| 1716 | + 0x897a7aff, 0x10000000, | |
| 1717 | + 0xbf85004d, 0xbe840080, | |
| 1718 | + 0xd2890000, 0x00000900, | |
| 1719 | + 0x80048104, 0xd2890001, | |
| 1720 | + 0x00000900, 0x80048104, | |
| 1721 | + 0xd2890002, 0x00000900, | |
| 1722 | + 0x80048104, 0xd2890003, | |
| 1723 | + 0x00000900, 0x80048104, | |
| 1724 | + 0xc069003a, 0x00000070, | |
| 1725 | + 0xbf8cc07f, 0x80709070, | |
| 1726 | + 0xbf06c004, 0xbf84ffee, | |
| 1727 | + 0xbe840080, 0xd2890000, | |
| 1728 | + 0x00000901, 0x80048104, | |
| 1729 | + 0xd2890001, 0x00000901, | |
| 1730 | + 0x80048104, 0xd2890002, | |
| 1731 | + 0x00000901, 0x80048104, | |
| 1732 | + 0xd2890003, 0x00000901, | |
| 1733 | + 0x80048104, 0xc069003a, | |
| 1734 | + 0x00000070, 0xbf8cc07f, | |
| 1735 | + 0x80709070, 0xbf06c004, | |
| 1736 | + 0xbf84ffee, 0xbe840080, | |
| 1737 | + 0xd2890000, 0x00000902, | |
| 1738 | + 0x80048104, 0xd2890001, | |
| 1739 | + 0x00000902, 0x80048104, | |
| 1740 | + 0xd2890002, 0x00000902, | |
| 1741 | + 0x80048104, 0xd2890003, | |
| 1742 | + 0x00000902, 0x80048104, | |
| 1743 | + 0xc069003a, 0x00000070, | |
| 1744 | + 0xbf8cc07f, 0x80709070, | |
| 1745 | + 0xbf06c004, 0xbf84ffee, | |
| 1746 | + 0xbe840080, 0xd2890000, | |
| 1747 | + 0x00000903, 0x80048104, | |
| 1748 | + 0xd2890001, 0x00000903, | |
| 1749 | + 0x80048104, 0xd2890002, | |
| 1750 | + 0x00000903, 0x80048104, | |
| 1751 | + 0xd2890003, 0x00000903, | |
| 1752 | + 0x80048104, 0xc069003a, | |
| 1753 | + 0x00000070, 0xbf8cc07f, | |
| 1754 | + 0x80709070, 0xbf06c004, | |
| 1755 | + 0xbf84ffee, 0xbf820008, | |
| 1756 | + 0xe0724000, 0x701d0000, | |
| 1757 | + 0xe0724100, 0x701d0100, | |
| 1758 | + 0xe0724200, 0x701d0200, | |
| 1759 | + 0xe0724300, 0x701d0300, | |
| 1760 | + 0xbefe00c1, 0xbeff00c1, | |
| 1761 | + 0xb8fb4306, 0x867bc17b, | |
| 1762 | + 0xbf840064, 0xbf8a0000, | |
| 1763 | + 0x867aff6f, 0x04000000, | |
| 1764 | + 0xbf840060, 0x8e7b867b, | |
| 1765 | + 0x8e7b827b, 0xbef6007b, | |
| 1766 | + 0xb8f02985, 0x80708170, | |
| 1767 | + 0x8e708a70, 0x8e708170, | |
| 1768 | + 0xb8fa1605, 0x807a817a, | |
| 1769 | + 0x8e7a867a, 0x80707a70, | |
| 1770 | + 0x8070ff70, 0x00000080, | |
| 1771 | + 0xbef600ff, 0x01000000, | |
| 1772 | + 0xbefc0080, 0xd28c0002, | |
| 1773 | + 0x000100c1, 0xd28d0003, | |
| 1774 | + 0x000204c1, 0x867aff78, | |
| 1775 | + 0x00400000, 0xbf850003, | |
| 1776 | + 0xb8faf803, 0x897a7aff, | |
| 1777 | + 0x10000000, 0xbf850030, | |
| 1778 | + 0x24040682, 0xd86e4000, | |
| 1779 | + 0x00000002, 0xbf8cc07f, | |
| 1780 | + 0xbe840080, 0xd2890000, | |
| 1781 | + 0x00000900, 0x80048104, | |
| 1782 | + 0xd2890001, 0x00000900, | |
| 1783 | + 0x80048104, 0xd2890002, | |
| 1784 | + 0x00000900, 0x80048104, | |
| 1785 | + 0xd2890003, 0x00000900, | |
| 1786 | + 0x80048104, 0xc069003a, | |
| 1787 | + 0x00000070, 0xbf8cc07f, | |
| 1788 | + 0x80709070, 0xbf06c004, | |
| 1789 | + 0xbf84ffee, 0xbe840080, | |
| 1790 | + 0xd2890000, 0x00000901, | |
| 1791 | + 0x80048104, 0xd2890001, | |
| 1792 | + 0x00000901, 0x80048104, | |
| 1793 | + 0xd2890002, 0x00000901, | |
| 1794 | + 0x80048104, 0xd2890003, | |
| 1795 | + 0x00000901, 0x80048104, | |
| 1796 | + 0xc069003a, 0x00000070, | |
| 1797 | + 0xbf8cc07f, 0x80709070, | |
| 1798 | + 0xbf06c004, 0xbf84ffee, | |
| 1799 | + 0x680404ff, 0x00000200, | |
| 1800 | + 0xd0c9006a, 0x0000f702, | |
| 1801 | + 0xbf87ffd2, 0xbf820015, | |
| 1802 | + 0xd1060002, 0x00011103, | |
| 1803 | + 0x7e0602ff, 0x00000200, | |
| 1804 | + 0xbefc00ff, 0x00010000, | |
| 1805 | + 0xbe800077, 0x8677ff77, | |
| 1806 | + 0xff7fffff, 0x8777ff77, | |
| 1807 | + 0x00058000, 0xd8ec0000, | |
| 1808 | + 0x00000002, 0xbf8cc07f, | |
| 1809 | + 0xe0765000, 0x701d0002, | |
| 1810 | + 0x68040702, 0xd0c9006a, | |
| 1811 | + 0x0000f702, 0xbf87fff7, | |
| 1812 | + 0xbef70000, 0xbef000ff, | |
| 1813 | + 0x00000400, 0xbefe00c1, | |
| 1814 | + 0xbeff00c1, 0xb8fb2b05, | |
| 1815 | + 0x807b817b, 0x8e7b827b, | |
| 1816 | + 0xbef600ff, 0x01000000, | |
| 1817 | + 0xbefc0084, 0xbf0a7b7c, | |
| 1818 | + 0xbf84006d, 0xbf11017c, | |
| 1819 | + 0x807bff7b, 0x00001000, | |
| 1820 | + 0x867aff78, 0x00400000, | |
| 1821 | + 0xbf850003, 0xb8faf803, | |
| 1822 | + 0x897a7aff, 0x10000000, | |
| 1823 | + 0xbf850051, 0xbe840080, | |
| 1824 | + 0xd2890000, 0x00000900, | |
| 1825 | + 0x80048104, 0xd2890001, | |
| 1826 | + 0x00000900, 0x80048104, | |
| 1827 | + 0xd2890002, 0x00000900, | |
| 1828 | + 0x80048104, 0xd2890003, | |
| 1829 | + 0x00000900, 0x80048104, | |
| 1830 | + 0xc069003a, 0x00000070, | |
| 1831 | + 0xbf8cc07f, 0x80709070, | |
| 1832 | + 0xbf06c004, 0xbf84ffee, | |
| 1833 | + 0xbe840080, 0xd2890000, | |
| 1834 | + 0x00000901, 0x80048104, | |
| 1835 | + 0xd2890001, 0x00000901, | |
| 1836 | + 0x80048104, 0xd2890002, | |
| 1837 | + 0x00000901, 0x80048104, | |
| 1838 | + 0xd2890003, 0x00000901, | |
| 1839 | + 0x80048104, 0xc069003a, | |
| 1840 | + 0x00000070, 0xbf8cc07f, | |
| 1841 | + 0x80709070, 0xbf06c004, | |
| 1842 | + 0xbf84ffee, 0xbe840080, | |
| 1843 | + 0xd2890000, 0x00000902, | |
| 1844 | + 0x80048104, 0xd2890001, | |
| 1845 | + 0x00000902, 0x80048104, | |
| 1846 | + 0xd2890002, 0x00000902, | |
| 1847 | + 0x80048104, 0xd2890003, | |
| 1848 | + 0x00000902, 0x80048104, | |
| 1849 | + 0xc069003a, 0x00000070, | |
| 1850 | + 0xbf8cc07f, 0x80709070, | |
| 1851 | + 0xbf06c004, 0xbf84ffee, | |
| 1852 | + 0xbe840080, 0xd2890000, | |
| 1853 | + 0x00000903, 0x80048104, | |
| 1854 | + 0xd2890001, 0x00000903, | |
| 1855 | + 0x80048104, 0xd2890002, | |
| 1856 | + 0x00000903, 0x80048104, | |
| 1857 | + 0xd2890003, 0x00000903, | |
| 1858 | + 0x80048104, 0xc069003a, | |
| 1859 | + 0x00000070, 0xbf8cc07f, | |
| 1860 | + 0x80709070, 0xbf06c004, | |
| 1861 | + 0xbf84ffee, 0x807c847c, | |
| 1862 | + 0xbf0a7b7c, 0xbf85ffb1, | |
| 1863 | + 0xbf9c0000, 0xbf820012, | |
| 1864 | + 0x7e000300, 0x7e020301, | |
| 1865 | + 0x7e040302, 0x7e060303, | |
| 1866 | + 0xe0724000, 0x701d0000, | |
| 1867 | + 0xe0724100, 0x701d0100, | |
| 1868 | + 0xe0724200, 0x701d0200, | |
| 1869 | + 0xe0724300, 0x701d0300, | |
| 1870 | + 0x807c847c, 0x8070ff70, | |
| 1871 | + 0x00000400, 0xbf0a7b7c, | |
| 1872 | + 0xbf85ffef, 0xbf9c0000, | |
| 1873 | + 0xb8fb2985, 0x807b817b, | |
| 1874 | + 0x8e7b837b, 0xb8fa2b05, | |
| 1875 | + 0x807a817a, 0x8e7a827a, | |
| 1876 | + 0x80fb7a7b, 0x867b7b7b, | |
| 1877 | + 0xbf84007a, 0x807bff7b, | |
| 1878 | + 0x00001000, 0xbefc0080, | |
| 1879 | + 0xbf11017c, 0x867aff78, | |
| 1880 | + 0x00400000, 0xbf850003, | |
| 1881 | + 0xb8faf803, 0x897a7aff, | |
| 1882 | + 0x10000000, 0xbf850059, | |
| 1883 | + 0xd3d84000, 0x18000100, | |
| 1884 | + 0xd3d84001, 0x18000101, | |
| 1885 | + 0xd3d84002, 0x18000102, | |
| 1886 | + 0xd3d84003, 0x18000103, | |
| 1887 | + 0xbe840080, 0xd2890000, | |
| 1888 | + 0x00000900, 0x80048104, | |
| 1889 | + 0xd2890001, 0x00000900, | |
| 1890 | + 0x80048104, 0xd2890002, | |
| 1891 | + 0x00000900, 0x80048104, | |
| 1892 | + 0xd2890003, 0x00000900, | |
| 1893 | + 0x80048104, 0xc069003a, | |
| 1894 | + 0x00000070, 0xbf8cc07f, | |
| 1895 | + 0x80709070, 0xbf06c004, | |
| 1896 | + 0xbf84ffee, 0xbe840080, | |
| 1897 | + 0xd2890000, 0x00000901, | |
| 1898 | + 0x80048104, 0xd2890001, | |
| 1899 | + 0x00000901, 0x80048104, | |
| 1900 | + 0xd2890002, 0x00000901, | |
| 1901 | + 0x80048104, 0xd2890003, | |
| 1902 | + 0x00000901, 0x80048104, | |
| 1903 | + 0xc069003a, 0x00000070, | |
| 1904 | + 0xbf8cc07f, 0x80709070, | |
| 1905 | + 0xbf06c004, 0xbf84ffee, | |
| 1906 | + 0xbe840080, 0xd2890000, | |
| 1907 | + 0x00000902, 0x80048104, | |
| 1908 | + 0xd2890001, 0x00000902, | |
| 1909 | + 0x80048104, 0xd2890002, | |
| 1910 | + 0x00000902, 0x80048104, | |
| 1911 | + 0xd2890003, 0x00000902, | |
| 1912 | + 0x80048104, 0xc069003a, | |
| 1913 | + 0x00000070, 0xbf8cc07f, | |
| 1914 | + 0x80709070, 0xbf06c004, | |
| 1915 | + 0xbf84ffee, 0xbe840080, | |
| 1916 | + 0xd2890000, 0x00000903, | |
| 1917 | + 0x80048104, 0xd2890001, | |
| 1918 | + 0x00000903, 0x80048104, | |
| 1919 | + 0xd2890002, 0x00000903, | |
| 1920 | + 0x80048104, 0xd2890003, | |
| 1921 | + 0x00000903, 0x80048104, | |
| 1922 | + 0xc069003a, 0x00000070, | |
| 1923 | + 0xbf8cc07f, 0x80709070, | |
| 1924 | + 0xbf06c004, 0xbf84ffee, | |
| 1925 | + 0x807c847c, 0xbf0a7b7c, | |
| 1926 | + 0xbf85ffa9, 0xbf9c0000, | |
| 1927 | + 0xbf820016, 0xd3d84000, | |
| 1928 | + 0x18000100, 0xd3d84001, | |
| 1929 | + 0x18000101, 0xd3d84002, | |
| 1930 | + 0x18000102, 0xd3d84003, | |
| 1931 | + 0x18000103, 0xe0724000, | |
| 1932 | + 0x701d0000, 0xe0724100, | |
| 1933 | + 0x701d0100, 0xe0724200, | |
| 1934 | + 0x701d0200, 0xe0724300, | |
| 1935 | + 0x701d0300, 0x807c847c, | |
| 1936 | + 0x8070ff70, 0x00000400, | |
| 1937 | + 0xbf0a7b7c, 0xbf85ffeb, | |
| 1938 | + 0xbf9c0000, 0xbf820101, | |
| 1939 | + 0xbef4007e, 0x8675ff7f, | |
| 1940 | + 0x0000ffff, 0x8775ff75, | |
| 1941 | + 0x00040000, 0xbef60080, | |
| 1942 | + 0xbef700ff, 0x00807fac, | |
| 1943 | + 0x866eff7f, 0x08000000, | |
| 1944 | + 0x8f6e836e, 0x87776e77, | |
| 1945 | + 0x866eff7f, 0x70000000, | |
| 1946 | + 0x8f6e816e, 0x87776e77, | |
| 1947 | + 0x866eff7f, 0x04000000, | |
| 1948 | + 0xbf84001f, 0xbefe00c1, | |
| 1949 | + 0xbeff00c1, 0xb8ef4306, | |
| 1950 | + 0x866fc16f, 0xbf84001a, | |
| 1951 | + 0x8e6f866f, 0x8e6f826f, | |
| 1952 | + 0xbef6006f, 0xb8f82985, | |
| 1953 | + 0x80788178, 0x8e788a78, | |
| 1954 | + 0x8e788178, 0xb8ee1605, | |
| 1955 | + 0x806e816e, 0x8e6e866e, | |
| 1956 | + 0x80786e78, 0x8078ff78, | |
| 1957 | + 0x00000080, 0xbef600ff, | |
| 1958 | + 0x01000000, 0xbefc0080, | |
| 1959 | + 0xe0510000, 0x781d0000, | |
| 1960 | + 0xe0510100, 0x781d0000, | |
| 1961 | + 0x807cff7c, 0x00000200, | |
| 1962 | + 0x8078ff78, 0x00000200, | |
| 1963 | + 0xbf0a6f7c, 0xbf85fff6, | |
| 1964 | + 0xbefe00c1, 0xbeff00c1, | |
| 1965 | + 0xbef600ff, 0x01000000, | |
| 1966 | + 0xb8ef2b05, 0x806f816f, | |
| 1967 | + 0x8e6f826f, 0x806fff6f, | |
| 1968 | + 0x00008000, 0xbef80080, | |
| 1969 | + 0xbeee0078, 0x8078ff78, | |
| 1970 | + 0x00000400, 0xbefc0084, | |
| 1971 | + 0xbf11087c, 0xe0524000, | |
| 1972 | + 0x781d0000, 0xe0524100, | |
| 1973 | + 0x781d0100, 0xe0524200, | |
| 1974 | + 0x781d0200, 0xe0524300, | |
| 1975 | + 0x781d0300, 0xbf8c0f70, | |
| 1976 | + 0x7e000300, 0x7e020301, | |
| 1977 | + 0x7e040302, 0x7e060303, | |
| 1978 | + 0x807c847c, 0x8078ff78, | |
| 1979 | + 0x00000400, 0xbf0a6f7c, | |
| 1980 | + 0xbf85ffee, 0xb8ef2985, | |
| 1981 | + 0x806f816f, 0x8e6f836f, | |
| 1982 | + 0xb8f92b05, 0x80798179, | |
| 1983 | + 0x8e798279, 0x80ef796f, | |
| 1984 | + 0x866f6f6f, 0xbf84001a, | |
| 1985 | + 0x806fff6f, 0x00008000, | |
| 1986 | + 0xbefc0080, 0xbf11087c, | |
| 1987 | + 0xe0524000, 0x781d0000, | |
| 1988 | + 0xe0524100, 0x781d0100, | |
| 1989 | + 0xe0524200, 0x781d0200, | |
| 1990 | + 0xe0524300, 0x781d0300, | |
| 1991 | + 0xbf8c0f70, 0xd3d94000, | |
| 1992 | + 0x18000100, 0xd3d94001, | |
| 1993 | + 0x18000101, 0xd3d94002, | |
| 1994 | + 0x18000102, 0xd3d94003, | |
| 1995 | + 0x18000103, 0x807c847c, | |
| 1996 | + 0x8078ff78, 0x00000400, | |
| 1997 | + 0xbf0a6f7c, 0xbf85ffea, | |
| 1998 | + 0xbf9c0000, 0xe0524000, | |
| 1999 | + 0x6e1d0000, 0xe0524100, | |
| 2000 | + 0x6e1d0100, 0xe0524200, | |
| 2001 | + 0x6e1d0200, 0xe0524300, | |
| 2002 | + 0x6e1d0300, 0xbf8c0f70, | |
| 2003 | + 0xb8f82985, 0x80788178, | |
| 2004 | + 0x8e788a78, 0x8e788178, | |
| 2005 | + 0xb8ee1605, 0x806e816e, | |
| 2006 | + 0x8e6e866e, 0x80786e78, | |
| 2007 | + 0x80f8c078, 0xb8ef1605, | |
| 2008 | + 0x806f816f, 0x8e6f846f, | |
| 2009 | + 0x8e76826f, 0xbef600ff, | |
| 2010 | + 0x01000000, 0xbefc006f, | |
| 2011 | + 0xc031003a, 0x00000078, | |
| 2012 | + 0x80f8c078, 0xbf8cc07f, | |
| 2013 | + 0x80fc907c, 0xbf800000, | |
| 2014 | + 0xbe802d00, 0xbe822d02, | |
| 2015 | + 0xbe842d04, 0xbe862d06, | |
| 2016 | + 0xbe882d08, 0xbe8a2d0a, | |
| 2017 | + 0xbe8c2d0c, 0xbe8e2d0e, | |
| 2018 | + 0xbf06807c, 0xbf84fff0, | |
| 2019 | + 0xb8f82985, 0x80788178, | |
| 2020 | + 0x8e788a78, 0x8e788178, | |
| 2021 | + 0xb8ee1605, 0x806e816e, | |
| 2022 | + 0x8e6e866e, 0x80786e78, | |
| 2023 | + 0xbef60084, 0xbef600ff, | |
| 2024 | + 0x01000000, 0xc0211bfa, | |
| 2025 | + 0x00000078, 0x80788478, | |
| 2026 | + 0xc0211b3a, 0x00000078, | |
| 2027 | + 0x80788478, 0xc0211b7a, | |
| 2028 | + 0x00000078, 0x80788478, | |
| 2029 | + 0xc0211c3a, 0x00000078, | |
| 2030 | + 0x80788478, 0xc0211c7a, | |
| 2031 | + 0x00000078, 0x80788478, | |
| 2032 | + 0xc0211eba, 0x00000078, | |
| 2033 | + 0x80788478, 0xc0211efa, | |
| 2034 | + 0x00000078, 0x80788478, | |
| 2035 | + 0xc0211a3a, 0x00000078, | |
| 2036 | + 0x80788478, 0xc0211a7a, | |
| 2037 | + 0x00000078, 0x80788478, | |
| 2038 | + 0xc0211cfa, 0x00000078, | |
| 2039 | + 0x80788478, 0xbf8cc07f, | |
| 2040 | + 0xbefc006f, 0xbefe0070, | |
| 2041 | + 0xbeff0071, 0x866f7bff, | |
| 2042 | + 0x000003ff, 0xb96f4803, | |
| 2043 | + 0x866f7bff, 0xfffff800, | |
| 2044 | + 0x8f6f8b6f, 0xb96fa2c3, | |
| 2045 | + 0xb973f801, 0xb8ee2985, | |
| 2046 | + 0x806e816e, 0x8e6e8a6e, | |
| 2047 | + 0x8e6e816e, 0xb8ef1605, | |
| 2048 | + 0x806f816f, 0x8e6f866f, | |
| 2049 | + 0x806e6f6e, 0x806e746e, | |
| 2050 | + 0x826f8075, 0x866fff6f, | |
| 2051 | + 0x0000ffff, 0xc00b1c37, | |
| 2052 | + 0x00000050, 0xc00b1d37, | |
| 2053 | + 0x00000060, 0xc0031e77, | |
| 2054 | + 0x00000074, 0xbf8cc07f, | |
| 2055 | + 0x866fff6d, 0xf8000000, | |
| 2056 | + 0x8f6f9b6f, 0x8e6f906f, | |
| 2057 | + 0xbeee0080, 0x876e6f6e, | |
| 2058 | + 0x866fff6d, 0x04000000, | |
| 2059 | + 0x8f6f9a6f, 0x8e6f8f6f, | |
| 2060 | + 0x876e6f6e, 0x866fff7a, | |
| 2061 | + 0x00800000, 0x8f6f976f, | |
| 2062 | + 0xb96ef807, 0x866dff6d, | |
| 2063 | + 0x0000ffff, 0x86fe7e7e, | |
| 2064 | + 0x86ea6a6a, 0x8f6e837a, | |
| 2065 | + 0xb96ee0c2, 0xbf800002, | |
| 2066 | + 0xb97a0002, 0xbf8a0000, | |
| 2067 | + 0x95806f6c, 0xbf810000, | |
| 2068 | +}; | |
| 2069 | + | |
| 1578 | 2070 | static const uint32_t cwsr_trap_gfx10_hex[] = { |
| 1579 | 2071 | 0xbf820001, 0xbf8201cf, |
| 1580 | 2072 | 0xb0804004, 0xb978f802, |
| @@ -563,6 +563,7 @@ L_RESTORE: · 562 unmodified lines | ||
| 563 | 563 | buffer_load_dword v1, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256 |
| 564 | 564 | buffer_load_dword v2, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256*2 |
| 565 | 565 | buffer_load_dword v3, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256*3 |
| 566 | + s_waitcnt vmcnt(0) | |
| 566 | 567 | |
| 567 | 568 | /* restore SGPRs */ |
| 568 | 569 | ////////////////////////////// |
| @@ -21,9 +21,24 @@ · 20 unmodified lines | ||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | /* To compile this assembly code: |
| 24 | − * PROJECT=greenland ./sp3 cwsr_trap_handler_gfx9.asm -hex tmp.hex | |
| 24 | + * | |
| 25 | + * gfx9: | |
| 26 | + * cpp -DASIC_FAMILY=CHIP_VEGAM cwsr_trap_handler_gfx9.asm -P -o gfx9.sp3 | |
| 27 | + * sp3 gfx9.sp3 -hex gfx9.hex | |
| 28 | + * | |
| 29 | + * arcturus: | |
| 30 | + * cpp -DASIC_FAMILY=CHIP_ARCTURUS cwsr_trap_handler_gfx9.asm -P -o arcturus.sp3 | |
| 31 | + * sp3 arcturus.sp3 -hex arcturus.hex | |
| 32 | + * | |
| 33 | + * aldebaran: | |
| 34 | + * cpp -DASIC_FAMILY=CHIP_ALDEBARAN cwsr_trap_handler_gfx9.asm -P -o aldebaran.sp3 | |
| 35 | + * sp3 aldebaran.sp3 -hex aldebaran.hex | |
| 25 | 36 | */ |
| 26 | 37 | |
| 38 | +#define CHIP_VEGAM 18 | |
| 39 | +#define CHIP_ARCTURUS 23 | |
| 40 | +#define CHIP_ALDEBARAN 25 | |
| 41 | + | |
| 27 | 42 | var ACK_SQC_STORE = 1 //workaround for suspected SQC store bug causing incorrect stores under concurrency |
| 28 | 43 | var SAVE_AFTER_XNACK_ERROR = 1 //workaround for TCP store failure after XNACK error when ALLOW_REPLAY=0, for debugger |
| 29 | 44 | var SINGLE_STEP_MISSED_WORKAROUND = 1 //workaround for lost MODE.DEBUG_EN exception when SAVECTX raised |
| @@ -44,10 +59,17 @@ var SQ_WAVE_STATUS_ALLOW_REPLAY_MASK = 0x400000 · 14 unmodified lines | ||
| 44 | 59 | |
| 45 | 60 | var SQ_WAVE_LDS_ALLOC_LDS_SIZE_SHIFT = 12 |
| 46 | 61 | var SQ_WAVE_LDS_ALLOC_LDS_SIZE_SIZE = 9 |
| 47 | −var SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT = 8 | |
| 48 | 62 | var SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE = 6 |
| 49 | −var SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SHIFT = 24 | |
| 50 | 63 | var SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SIZE = 3 //FIXME sq.blk still has 4 bits at this time while SQ programming guide has 3 bits |
| 64 | +var SQ_WAVE_GPR_ALLOC_SGPR_SIZE_SHIFT = 24 | |
| 65 | + | |
| 66 | +#if ASIC_FAMILY >= CHIP_ALDEBARAN | |
| 67 | +var SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT = 6 | |
| 68 | +var SQ_WAVE_GPR_ALLOC_ACCV_OFFSET_SHIFT = 12 | |
| 69 | +var SQ_WAVE_GPR_ALLOC_ACCV_OFFSET_SIZE = 6 | |
| 70 | +#else | |
| 71 | +var SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT = 8 | |
| 72 | +#endif | |
| 51 | 73 | |
| 52 | 74 | var SQ_WAVE_TRAPSTS_SAVECTX_MASK = 0x400 |
| 53 | 75 | var SQ_WAVE_TRAPSTS_EXCE_MASK = 0x1FF // Exception mask |
| @@ -134,7 +156,7 @@ var s_restore_spi_init_lo = exec_lo · 80 unmodified lines | ||
| 134 | 156 | var s_restore_spi_init_hi = exec_hi |
| 135 | 157 | |
| 136 | 158 | var s_restore_mem_offset = ttmp12 |
| 137 | −var s_restore_accvgpr_offset = ttmp13 | |
| 159 | +var s_restore_tmp2 = ttmp13 | |
| 138 | 160 | var s_restore_alloc_size = ttmp3 |
| 139 | 161 | var s_restore_tmp = ttmp2 |
| 140 | 162 | var s_restore_mem_offset_save = s_restore_tmp //no conflict |
| @@ -466,12 +488,7 @@ if SAVE_AFTER_XNACK_ERROR · 325 unmodified lines | ||
| 466 | 488 | L_SAVE_FIRST_VGPRS_WITH_TCP: |
| 467 | 489 | end |
| 468 | 490 | |
| 469 | − buffer_store_dword v0, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 | |
| 470 | − buffer_store_dword v1, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256 | |
| 471 | − buffer_store_dword v2, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256*2 | |
| 472 | − buffer_store_dword v3, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256*3 | |
| 473 | − | |
| 474 | − | |
| 491 | + write_4vgprs_to_mem(s_save_buf_rsrc0, s_save_mem_offset) | |
| 475 | 492 | |
| 476 | 493 | /* save LDS */ |
| 477 | 494 | ////////////////////////////// |
| @@ -565,11 +582,8 @@ L_SAVE_LDS_DONE: · 87 unmodified lines | ||
| 565 | 582 | s_mov_b32 exec_lo, 0xFFFFFFFF //need every thread from now on |
| 566 | 583 | s_mov_b32 exec_hi, 0xFFFFFFFF |
| 567 | 584 | |
| 568 | − s_getreg_b32 s_save_alloc_size, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE) //vpgr_size | |
| 569 | − s_add_u32 s_save_alloc_size, s_save_alloc_size, 1 | |
| 570 | − s_lshl_b32 s_save_alloc_size, s_save_alloc_size, 2 //Number of VGPRs = (vgpr_size + 1) * 4 (non-zero value) //FIXME for GFX, zero is possible | |
| 571 | − s_lshl_b32 s_save_buf_rsrc2, s_save_alloc_size, 8 //NUM_RECORDS in bytes (64 threads*4) | |
| 572 | − s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes | |
| 585 | + get_num_arch_vgprs(s_save_alloc_size) | |
| 586 | + s_mov_b32 s_save_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes | |
| 573 | 587 | |
| 574 | 588 | |
| 575 | 589 | // VGPR store using dw burst |
| @@ -602,10 +616,7 @@ end · 26 unmodified lines | ||
| 602 | 616 | v_mov_b32 v2, v2 //v0 = v[0+m0] |
| 603 | 617 | v_mov_b32 v3, v3 //v0 = v[0+m0] |
| 604 | 618 | |
| 605 | − buffer_store_dword v0, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 | |
| 606 | − buffer_store_dword v1, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256 | |
| 607 | − buffer_store_dword v2, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256*2 | |
| 608 | − buffer_store_dword v3, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256*3 | |
| 619 | + write_4vgprs_to_mem(s_save_buf_rsrc0, s_save_mem_offset) | |
| 609 | 620 | |
| 610 | 621 | s_add_u32 m0, m0, 4 //next vgpr index |
| 611 | 622 | s_add_u32 s_save_mem_offset, s_save_mem_offset, 256*4 //every buffer_store_dword does 256 bytes |
| @@ -615,8 +626,17 @@ end · 3 unmodified lines | ||
| 615 | 626 | |
| 616 | 627 | L_SAVE_VGPR_END: |
| 617 | 628 | |
| 618 | −if ASIC_TARGET_ARCTURUS | |
| 629 | +#if ASIC_FAMILY >= CHIP_ARCTURUS | |
| 619 | 630 | // Save ACC VGPRs |
| 631 | + | |
| 632 | +#if ASIC_FAMILY >= CHIP_ALDEBARAN | |
| 633 | + // ACC VGPR count may differ from ARCH VGPR count. | |
| 634 | + get_num_acc_vgprs(s_save_alloc_size, s_save_tmp) | |
| 635 | + s_and_b32 s_save_alloc_size, s_save_alloc_size, s_save_alloc_size | |
| 636 | + s_cbranch_scc0 L_SAVE_ACCVGPR_END | |
| 637 | + s_add_u32 s_save_alloc_size, s_save_alloc_size, 0x1000 //add 0x1000 since we compare m0 against it later | |
| 638 | +#endif | |
| 639 | + | |
| 620 | 640 | s_mov_b32 m0, 0x0 //VGPR initial index value =0 |
| 621 | 641 | s_set_gpr_idx_on m0, 0x1 //M0[7:0] = M0[7:0] and M0[15:12] = 0x1 |
| 622 | 642 | |
| @@ -644,10 +664,7 @@ L_SAVE_ACCVGPR_LOOP: · 21 unmodified lines | ||
| 644 | 664 | v_accvgpr_read v[vgpr], acc[vgpr] // v[N] = acc[N+m0] |
| 645 | 665 | end |
| 646 | 666 | |
| 647 | − buffer_store_dword v0, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 | |
| 648 | − buffer_store_dword v1, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256 | |
| 649 | − buffer_store_dword v2, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256*2 | |
| 650 | − buffer_store_dword v3, v0, s_save_buf_rsrc0, s_save_mem_offset slc:1 glc:1 offset:256*3 | |
| 667 | + write_4vgprs_to_mem(s_save_buf_rsrc0, s_save_mem_offset) | |
| 651 | 668 | |
| 652 | 669 | s_add_u32 m0, m0, 4 |
| 653 | 670 | s_add_u32 s_save_mem_offset, s_save_mem_offset, 256*4 |
| @@ -656,7 +673,7 @@ L_SAVE_ACCVGPR_LOOP: · 2 unmodified lines | ||
| 656 | 673 | s_set_gpr_idx_off |
| 657 | 674 | |
| 658 | 675 | L_SAVE_ACCVGPR_END: |
| 659 | −end | |
| 676 | +#endif | |
| 660 | 677 | |
| 661 | 678 | s_branch L_END_PGM |
| 662 | 679 | |
| @@ -724,53 +741,23 @@ L_RESTORE: · 61 unmodified lines | ||
| 724 | 741 | /* restore VGPRs */ |
| 725 | 742 | ////////////////////////////// |
| 726 | 743 | L_RESTORE_VGPR: |
| 727 | − // VGPR SR memory offset : 0 | |
| 728 | − s_mov_b32 s_restore_mem_offset, 0x0 | |
| 729 | 744 | s_mov_b32 exec_lo, 0xFFFFFFFF //need every thread from now on //be consistent with SAVE although can be moved ahead |
| 730 | 745 | s_mov_b32 exec_hi, 0xFFFFFFFF |
| 746 | + s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes | |
| 731 | 747 | |
| 732 | − s_getreg_b32 s_restore_alloc_size, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE) //vpgr_size | |
| 733 | − s_add_u32 s_restore_alloc_size, s_restore_alloc_size, 1 | |
| 734 | − s_lshl_b32 s_restore_alloc_size, s_restore_alloc_size, 2 //Number of VGPRs = (vgpr_size + 1) * 4 (non-zero value) | |
| 735 | − s_lshl_b32 s_restore_buf_rsrc2, s_restore_alloc_size, 8 //NUM_RECORDS in bytes (64 threads*4) | |
| 736 | − | |
| 737 | −if ASIC_TARGET_ARCTURUS | |
| 738 | − s_mov_b32 s_restore_accvgpr_offset, s_restore_buf_rsrc2 //ACC VGPRs at end of VGPRs | |
| 739 | −end | |
| 740 | − | |
| 741 | − s_mov_b32 s_restore_buf_rsrc2, 0x1000000 //NUM_RECORDS in bytes | |
| 748 | + // Save ARCH VGPRs 4-N, then all ACC VGPRs, then ARCH VGPRs 0-3. | |
| 749 | + get_num_arch_vgprs(s_restore_alloc_size) | |
| 750 | + s_add_u32 s_restore_alloc_size, s_restore_alloc_size, 0x8000 //add 0x8000 since we compare m0 against it later | |
| 742 | 751 | |
| 743 | − // VGPR load using dw burst | |
| 752 | + // ARCH VGPRs at offset: 0 | |
| 753 | + s_mov_b32 s_restore_mem_offset, 0x0 | |
| 744 | 754 | s_mov_b32 s_restore_mem_offset_save, s_restore_mem_offset // restore start with v1, v0 will be the last |
| 745 | 755 | s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 256*4 |
| 746 | −if ASIC_TARGET_ARCTURUS | |
| 747 | − s_mov_b32 s_restore_accvgpr_offset_save, s_restore_accvgpr_offset | |
| 748 | − s_add_u32 s_restore_accvgpr_offset, s_restore_accvgpr_offset, 256*4 | |
| 749 | −end | |
| 750 | 756 | s_mov_b32 m0, 4 //VGPR initial index value = 1 |
| 751 | − s_set_gpr_idx_on m0, 0x8 //M0[7:0] = M0[7:0] and M0[15:12] = 0x8 | |
| 752 | − s_add_u32 s_restore_alloc_size, s_restore_alloc_size, 0x8000 //add 0x8000 since we compare m0 against it later | |
| 757 | + s_set_gpr_idx_on m0, 0x8 //M0[7:0] = M0[7:0] and M0[15:12] = 0x8 | |
| 753 | 758 | |
| 754 | 759 | L_RESTORE_VGPR_LOOP: |
| 755 | − | |
| 756 | −if ASIC_TARGET_ARCTURUS | |
| 757 | − buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset slc:1 glc:1 | |
| 758 | − buffer_load_dword v1, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset slc:1 glc:1 offset:256 | |
| 759 | − buffer_load_dword v2, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset slc:1 glc:1 offset:256*2 | |
| 760 | − buffer_load_dword v3, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset slc:1 glc:1 offset:256*3 | |
| 761 | − s_add_u32 s_restore_accvgpr_offset, s_restore_accvgpr_offset, 256*4 | |
| 762 | − s_waitcnt vmcnt(0) | |
| 763 | − | |
| 764 | − for var vgpr = 0; vgpr < 4; ++ vgpr | |
| 765 | − v_accvgpr_write acc[vgpr], v[vgpr] | |
| 766 | − end | |
| 767 | −end | |
| 768 | − | |
| 769 | − buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset slc:1 glc:1 | |
| 770 | − buffer_load_dword v1, v0, s_restore_buf_rsrc0, s_restore_mem_offset slc:1 glc:1 offset:256 | |
| 771 | − buffer_load_dword v2, v0, s_restore_buf_rsrc0, s_restore_mem_offset slc:1 glc:1 offset:256*2 | |
| 772 | − buffer_load_dword v3, v0, s_restore_buf_rsrc0, s_restore_mem_offset slc:1 glc:1 offset:256*3 | |
| 773 | − s_waitcnt vmcnt(0) //ensure data ready | |
| 760 | + read_4vgprs_from_mem(s_restore_buf_rsrc0, s_restore_mem_offset) | |
| 774 | 761 | v_mov_b32 v0, v0 //v[0+m0] = v0 |
| 775 | 762 | v_mov_b32 v1, v1 |
| 776 | 763 | v_mov_b32 v2, v2 |
| @@ -779,24 +766,38 @@ end · 2 unmodified lines | ||
| 779 | 766 | s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 256*4 //every buffer_load_dword does 256 bytes |
| 780 | 767 | s_cmp_lt_u32 m0, s_restore_alloc_size //scc = (m0 < s_restore_alloc_size) ? 1 : 0 |
| 781 | 768 | s_cbranch_scc1 L_RESTORE_VGPR_LOOP //VGPR restore (except v0) is complete? |
| 782 | − s_set_gpr_idx_off | |
| 783 | − /* VGPR restore on v0 */ | |
| 784 | −if ASIC_TARGET_ARCTURUS | |
| 785 | − buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset_save slc:1 glc:1 | |
| 786 | − buffer_load_dword v1, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset_save slc:1 glc:1 offset:256 | |
| 787 | − buffer_load_dword v2, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset_save slc:1 glc:1 offset:256*2 | |
| 788 | − buffer_load_dword v3, v0, s_restore_buf_rsrc0, s_restore_accvgpr_offset_save slc:1 glc:1 offset:256*3 | |
| 789 | − s_waitcnt vmcnt(0) | |
| 790 | 769 | |
| 791 | − for var vgpr = 0; vgpr < 4; ++ vgpr | |
| 792 | − v_accvgpr_write acc[vgpr], v[vgpr] | |
| 793 | − end | |
| 794 | −end | |
| 770 | +#if ASIC_FAMILY >= CHIP_ALDEBARAN | |
| 771 | + // ACC VGPR count may differ from ARCH VGPR count. | |
| 772 | + get_num_acc_vgprs(s_restore_alloc_size, s_restore_tmp2) | |
| 773 | + s_and_b32 s_restore_alloc_size, s_restore_alloc_size, s_restore_alloc_size | |
| 774 | + s_cbranch_scc0 L_RESTORE_ACCVGPR_END | |
| 775 | + s_add_u32 s_restore_alloc_size, s_restore_alloc_size, 0x8000 //add 0x8000 since we compare m0 against it later | |
| 776 | +#endif | |
| 795 | 777 | |
| 796 | − buffer_load_dword v0, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 | |
| 797 | − buffer_load_dword v1, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256 | |
| 798 | − buffer_load_dword v2, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256*2 | |
| 799 | − buffer_load_dword v3, v0, s_restore_buf_rsrc0, s_restore_mem_offset_save slc:1 glc:1 offset:256*3 | |
| 778 | +#if ASIC_FAMILY >= CHIP_ARCTURUS | |
| 779 | + // ACC VGPRs at offset: size(ARCH VGPRs) | |
| 780 | + s_mov_b32 m0, 0 | |
| 781 | + s_set_gpr_idx_on m0, 0x8 //M0[7:0] = M0[7:0] and M0[15:12] = 0x8 | |
| 782 | + | |
| 783 | + L_RESTORE_ACCVGPR_LOOP: | |
| 784 | + read_4vgprs_from_mem(s_restore_buf_rsrc0, s_restore_mem_offset) | |
| 785 | + | |
| 786 | + for var vgpr = 0; vgpr < 4; ++ vgpr | |
| 787 | + v_accvgpr_write acc[vgpr], v[vgpr] | |
| 788 | + end | |
| 789 | + | |
| 790 | + s_add_u32 m0, m0, 4 //next vgpr index | |
| 791 | + s_add_u32 s_restore_mem_offset, s_restore_mem_offset, 256*4 //every buffer_load_dword does 256 bytes | |
| 792 | + s_cmp_lt_u32 m0, s_restore_alloc_size //scc = (m0 < s_restore_alloc_size) ? 1 : 0 | |
| 793 | + s_cbranch_scc1 L_RESTORE_ACCVGPR_LOOP //VGPR restore (except v0) is complete? | |
| 794 | + L_RESTORE_ACCVGPR_END: | |
| 795 | +#endif | |
| 796 | + | |
| 797 | + s_set_gpr_idx_off | |
| 798 | + | |
| 799 | + // Restore VGPRs 0-3 last, no longer needed. | |
| 800 | + read_4vgprs_from_mem(s_restore_buf_rsrc0, s_restore_mem_offset_save) | |
| 800 | 801 | |
| 801 | 802 | /* restore SGPRs */ |
| 802 | 803 | ////////////////////////////// |
| @@ -974,6 +975,21 @@ function check_if_tcp_store_ok · 171 unmodified lines | ||
| 974 | 975 | L_TCP_STORE_CHECK_DONE: |
| 975 | 976 | end |
| 976 | 977 | |
| 978 | +function write_4vgprs_to_mem(s_rsrc, s_mem_offset) | |
| 979 | + buffer_store_dword v0, v0, s_rsrc, s_mem_offset slc:1 glc:1 | |
| 980 | + buffer_store_dword v1, v0, s_rsrc, s_mem_offset slc:1 glc:1 offset:256 | |
| 981 | + buffer_store_dword v2, v0, s_rsrc, s_mem_offset slc:1 glc:1 offset:256*2 | |
| 982 | + buffer_store_dword v3, v0, s_rsrc, s_mem_offset slc:1 glc:1 offset:256*3 | |
| 983 | +end | |
| 984 | + | |
| 985 | +function read_4vgprs_from_mem(s_rsrc, s_mem_offset) | |
| 986 | + buffer_load_dword v0, v0, s_rsrc, s_mem_offset slc:1 glc:1 | |
| 987 | + buffer_load_dword v1, v0, s_rsrc, s_mem_offset slc:1 glc:1 offset:256 | |
| 988 | + buffer_load_dword v2, v0, s_rsrc, s_mem_offset slc:1 glc:1 offset:256*2 | |
| 989 | + buffer_load_dword v3, v0, s_rsrc, s_mem_offset slc:1 glc:1 offset:256*3 | |
| 990 | + s_waitcnt vmcnt(0) | |
| 991 | +end | |
| 992 | + | |
| 977 | 993 | function write_vgpr_to_mem_with_sqc(v, s_rsrc, s_mem_offset) |
| 978 | 994 | s_mov_b32 s4, 0 |
| 979 | 995 | |
| @@ -1008,9 +1024,9 @@ function get_vgpr_size_bytes(s_vgpr_size_byte) · 28 unmodified lines | ||
| 1008 | 1024 | s_add_u32 s_vgpr_size_byte, s_vgpr_size_byte, 1 |
| 1009 | 1025 | s_lshl_b32 s_vgpr_size_byte, s_vgpr_size_byte, (2+8) //Number of VGPRs = (vgpr_size + 1) * 4 * 64 * 4 (non-zero value) //FIXME for GFX, zero is possible |
| 1010 | 1026 | |
| 1011 | −if ASIC_TARGET_ARCTURUS | |
| 1027 | +#if ASIC_FAMILY >= CHIP_ARCTURUS | |
| 1012 | 1028 | s_lshl_b32 s_vgpr_size_byte, s_vgpr_size_byte, 1 // Double size for ACC VGPRs |
| 1013 | −end | |
| 1029 | +#endif | |
| 1014 | 1030 | end |
| 1015 | 1031 | |
| 1016 | 1032 | function get_sgpr_size_bytes(s_sgpr_size_byte) |
| @@ -1023,6 +1039,32 @@ function get_hwreg_size_bytes · 6 unmodified lines | ||
| 1023 | 1039 | return 128 //HWREG size 128 bytes |
| 1024 | 1040 | end |
| 1025 | 1041 | |
| 1042 | +function get_num_arch_vgprs(s_num_arch_vgprs) | |
| 1043 | +#if ASIC_FAMILY >= CHIP_ALDEBARAN | |
| 1044 | + // VGPR count includes ACC VGPRs, use ACC VGPR offset for ARCH VGPR count. | |
| 1045 | + s_getreg_b32 s_num_arch_vgprs, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_ACCV_OFFSET_SHIFT,SQ_WAVE_GPR_ALLOC_ACCV_OFFSET_SIZE) | |
| 1046 | +#else | |
| 1047 | + s_getreg_b32 s_num_arch_vgprs, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE) | |
| 1048 | +#endif | |
| 1049 | + | |
| 1050 | + // Number of VGPRs = (vgpr_size + 1) * 4 | |
| 1051 | + s_add_u32 s_num_arch_vgprs, s_num_arch_vgprs, 1 | |
| 1052 | + s_lshl_b32 s_num_arch_vgprs, s_num_arch_vgprs, 2 | |
| 1053 | +end | |
| 1054 | + | |
| 1055 | +#if ASIC_FAMILY >= CHIP_ALDEBARAN | |
| 1056 | +function get_num_acc_vgprs(s_num_acc_vgprs, s_tmp) | |
| 1057 | + // VGPR count = (GPR_ALLOC.VGPR_SIZE + 1) * 8 | |
| 1058 | + s_getreg_b32 s_num_acc_vgprs, hwreg(HW_REG_GPR_ALLOC,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SHIFT,SQ_WAVE_GPR_ALLOC_VGPR_SIZE_SIZE) | |
| 1059 | + s_add_u32 s_num_acc_vgprs, s_num_acc_vgprs, 1 | |
| 1060 | + s_lshl_b32 s_num_acc_vgprs, s_num_acc_vgprs, 3 | |
| 1061 | + | |
| 1062 | + // ACC VGPR count = VGPR count - ARCH VGPR count. | |
| 1063 | + get_num_arch_vgprs(s_tmp) | |
| 1064 | + s_sub_u32 s_num_acc_vgprs, s_num_acc_vgprs, s_tmp | |
| 1065 | +end | |
| 1066 | +#endif | |
| 1067 | + | |
| 1026 | 1068 | function ack_sqc_store_workaround |
| 1027 | 1069 | if ACK_SQC_STORE |
| 1028 | 1070 | s_waitcnt lgkmcnt(0) |
| @@ -556,11 +556,7 @@ static int kfd_ioctl_set_trap_handler(struct file *filep, · 555 unmodified lines | ||
| 556 | 556 | goto out; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | − if (dev->dqm->ops.set_trap_handler(dev->dqm, | |
| 560 | − &pdd->qpd, | |
| 561 | − args->tba_addr, | |
| 562 | − args->tma_addr)) | |
| 563 | − err = -EINVAL; | |
| 559 | + kfd_process_set_trap_handler(&pdd->qpd, args->tba_addr, args->tma_addr); | |
| 564 | 560 | |
| 565 | 561 | out: |
| 566 | 562 | mutex_unlock(&p->mutex); |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "kfd_priv.h" |
| 27 | 27 | #include "kfd_topology.h" |
| 28 | 28 | #include "kfd_iommu.h" |
| 29 | +#include "amdgpu.h" | |
| 29 | 30 | #include "amdgpu_amdkfd.h" |
| 30 | 31 | |
| 31 | 32 | /* GPU Processor ID base for dGPUs for which VCRAT needs to be created. |
| @@ -665,6 +666,7 @@ static int kfd_fill_gpu_cache_info(struct kfd_dev *kdev, · 633 unmodified lines | ||
| 665 | 666 | case CHIP_VEGA12: |
| 666 | 667 | case CHIP_VEGA20: |
| 667 | 668 | case CHIP_ARCTURUS: |
| 669 | + case CHIP_ALDEBARAN: | |
| 668 | 670 | pcache_info = vega10_cache_info; |
| 669 | 671 | num_of_cache_types = ARRAY_SIZE(vega10_cache_info); |
| 670 | 672 | break; |
| @@ -1112,6 +1114,8 @@ static int kfd_fill_gpu_direct_io_link_to_cpu(int *avail_size, · 441 unmodified lines | ||
| 1112 | 1114 | struct crat_subtype_iolink *sub_type_hdr, |
| 1113 | 1115 | uint32_t proximity_domain) |
| 1114 | 1116 | { |
| 1117 | + struct amdgpu_device *adev = (struct amdgpu_device *)kdev->kgd; | |
| 1118 | + | |
| 1115 | 1119 | *avail_size -= sizeof(struct crat_subtype_iolink); |
| 1116 | 1120 | if (*avail_size < 0) |
| 1117 | 1121 | return -ENOMEM; |
| @@ -1128,7 +1132,18 @@ static int kfd_fill_gpu_direct_io_link_to_cpu(int *avail_size, · 10 unmodified lines | ||
| 1128 | 1132 | /* Fill in IOLINK subtype. |
| 1129 | 1133 | * TODO: Fill-in other fields of iolink subtype |
| 1130 | 1134 | */ |
| 1131 | − sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_PCIEXPRESS; | |
| 1135 | + if (adev->gmc.xgmi.connected_to_cpu) { | |
| 1136 | + /* | |
| 1137 | + * with host gpu xgmi link, host can access gpu memory whether | |
| 1138 | + * or not pcie bar type is large, so always create bidirectional | |
| 1139 | + * io link. | |
| 1140 | + */ | |
| 1141 | + sub_type_hdr->flags |= CRAT_IOLINK_FLAGS_BI_DIRECTIONAL; | |
| 1142 | + sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_XGMI; | |
| 1143 | + } else { | |
| 1144 | + sub_type_hdr->io_interface_type = CRAT_IOLINK_TYPE_PCIEXPRESS; | |
| 1145 | + } | |
| 1146 | + | |
| 1132 | 1147 | sub_type_hdr->proximity_domain_from = proximity_domain; |
| 1133 | 1148 | #ifdef CONFIG_NUMA |
| 1134 | 1149 | if (kdev->pdev->dev.numa_node == NUMA_NO_NODE) |
| @@ -46,6 +46,7 @@ extern const struct kfd2kgd_calls gfx_v7_kfd2kgd; · 45 unmodified lines | ||
| 46 | 46 | extern const struct kfd2kgd_calls gfx_v8_kfd2kgd; |
| 47 | 47 | extern const struct kfd2kgd_calls gfx_v9_kfd2kgd; |
| 48 | 48 | extern const struct kfd2kgd_calls arcturus_kfd2kgd; |
| 49 | +extern const struct kfd2kgd_calls aldebaran_kfd2kgd; | |
| 49 | 50 | extern const struct kfd2kgd_calls gfx_v10_kfd2kgd; |
| 50 | 51 | extern const struct kfd2kgd_calls gfx_v10_3_kfd2kgd; |
| 51 | 52 | |
| @@ -71,6 +72,7 @@ static const struct kfd2kgd_calls *kfd2kgd_funcs[] = { · 19 unmodified lines | ||
| 71 | 72 | [CHIP_VEGA20] = &gfx_v9_kfd2kgd, |
| 72 | 73 | [CHIP_RENOIR] = &gfx_v9_kfd2kgd, |
| 73 | 74 | [CHIP_ARCTURUS] = &arcturus_kfd2kgd, |
| 75 | + [CHIP_ALDEBARAN] = &aldebaran_kfd2kgd, | |
| 74 | 76 | [CHIP_NAVI10] = &gfx_v10_kfd2kgd, |
| 75 | 77 | [CHIP_NAVI12] = &gfx_v10_kfd2kgd, |
| 76 | 78 | [CHIP_NAVI14] = &gfx_v10_kfd2kgd, |
| @@ -392,6 +394,24 @@ static const struct kfd_device_info arcturus_device_info = { · 315 unmodified lines | ||
| 392 | 394 | .num_sdma_queues_per_engine = 8, |
| 393 | 395 | }; |
| 394 | 396 | |
| 397 | +static const struct kfd_device_info aldebaran_device_info = { | |
| 398 | + .asic_family = CHIP_ALDEBARAN, | |
| 399 | + .asic_name = "aldebaran", | |
| 400 | + .max_pasid_bits = 16, | |
| 401 | + .max_no_of_hqd = 24, | |
| 402 | + .doorbell_size = 8, | |
| 403 | + .ih_ring_entry_size = 8 * sizeof(uint32_t), | |
| 404 | + .event_interrupt_class = &event_interrupt_class_v9, | |
| 405 | + .num_of_watch_points = 4, | |
| 406 | + .mqd_size_aligned = MQD_SIZE_ALIGNED, | |
| 407 | + .supports_cwsr = true, | |
| 408 | + .needs_iommu_device = false, | |
| 409 | + .needs_pci_atomics = false, | |
| 410 | + .num_sdma_engines = 2, | |
| 411 | + .num_xgmi_sdma_engines = 3, | |
| 412 | + .num_sdma_queues_per_engine = 8, | |
| 413 | +}; | |
| 414 | + | |
| 395 | 415 | static const struct kfd_device_info renoir_device_info = { |
| 396 | 416 | .asic_family = CHIP_RENOIR, |
| 397 | 417 | .asic_name = "renoir", |
| @@ -556,6 +576,7 @@ static const struct kfd_device_info *kfd_supported_devices[][2] = { · 158 unmodified lines | ||
| 556 | 576 | [CHIP_VEGA20] = {&vega20_device_info, NULL}, |
| 557 | 577 | [CHIP_RENOIR] = {&renoir_device_info, NULL}, |
| 558 | 578 | [CHIP_ARCTURUS] = {&arcturus_device_info, &arcturus_device_info}, |
| 579 | + [CHIP_ALDEBARAN] = {&aldebaran_device_info, NULL}, | |
| 559 | 580 | [CHIP_NAVI10] = {&navi10_device_info, NULL}, |
| 560 | 581 | [CHIP_NAVI12] = {&navi12_device_info, &navi12_device_info}, |
| 561 | 582 | [CHIP_NAVI14] = {&navi14_device_info, NULL}, |
| @@ -640,6 +661,10 @@ static void kfd_cwsr_init(struct kfd_dev *kfd) · 78 unmodified lines | ||
| 640 | 661 | BUILD_BUG_ON(sizeof(cwsr_trap_arcturus_hex) > PAGE_SIZE); |
| 641 | 662 | kfd->cwsr_isa = cwsr_trap_arcturus_hex; |
| 642 | 663 | kfd->cwsr_isa_size = sizeof(cwsr_trap_arcturus_hex); |
| 664 | + } else if (kfd->device_info->asic_family == CHIP_ALDEBARAN) { | |
| 665 | + BUILD_BUG_ON(sizeof(cwsr_trap_aldebaran_hex) > PAGE_SIZE); | |
| 666 | + kfd->cwsr_isa = cwsr_trap_aldebaran_hex; | |
| 667 | + kfd->cwsr_isa_size = sizeof(cwsr_trap_aldebaran_hex); | |
| 643 | 668 | } else if (kfd->device_info->asic_family < CHIP_NAVI10) { |
| 644 | 669 | BUILD_BUG_ON(sizeof(cwsr_trap_gfx9_hex) > PAGE_SIZE); |
| 645 | 670 | kfd->cwsr_isa = cwsr_trap_gfx9_hex; |
| @@ -1128,6 +1128,9 @@ static int set_sched_resources(struct device_queue_manager *dqm) · 1127 unmodified lines | ||
| 1128 | 1128 | |
| 1129 | 1129 | static int initialize_cpsch(struct device_queue_manager *dqm) |
| 1130 | 1130 | { |
| 1131 | + uint64_t num_sdma_queues; | |
| 1132 | + uint64_t num_xgmi_sdma_queues; | |
| 1133 | + | |
| 1131 | 1134 | pr_debug("num of pipes: %d\n", get_pipes_per_mec(dqm)); |
| 1132 | 1135 | |
| 1133 | 1136 | mutex_init(&dqm->lock_hidden); |
| @@ -1136,8 +1139,18 @@ static int initialize_cpsch(struct device_queue_manager *dqm) · 2 unmodified lines | ||
| 1136 | 1139 | dqm->active_cp_queue_count = 0; |
| 1137 | 1140 | dqm->gws_queue_count = 0; |
| 1138 | 1141 | dqm->active_runlist = false; |
| 1139 | − dqm->sdma_bitmap = ~0ULL >> (64 - get_num_sdma_queues(dqm)); | |
| 1140 | − dqm->xgmi_sdma_bitmap = ~0ULL >> (64 - get_num_xgmi_sdma_queues(dqm)); | |
| 1142 | + | |
| 1143 | + num_sdma_queues = get_num_sdma_queues(dqm); | |
| 1144 | + if (num_sdma_queues >= BITS_PER_TYPE(dqm->sdma_bitmap)) | |
| 1145 | + dqm->sdma_bitmap = ULLONG_MAX; | |
| 1146 | + else | |
| 1147 | + dqm->sdma_bitmap = (BIT_ULL(num_sdma_queues) - 1); | |
| 1148 | + | |
| 1149 | + num_xgmi_sdma_queues = get_num_xgmi_sdma_queues(dqm); | |
| 1150 | + if (num_xgmi_sdma_queues >= BITS_PER_TYPE(dqm->xgmi_sdma_bitmap)) | |
| 1151 | + dqm->xgmi_sdma_bitmap = ULLONG_MAX; | |
| 1152 | + else | |
| 1153 | + dqm->xgmi_sdma_bitmap = (BIT_ULL(num_xgmi_sdma_queues) - 1); | |
| 1141 | 1154 | |
| 1142 | 1155 | INIT_WORK(&dqm->hw_exception_work, kfd_process_hw_exception); |
| 1143 | 1156 | |
| @@ -1393,6 +1406,7 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, · 249 unmodified lines | ||
| 1393 | 1406 | uint32_t filter_param) |
| 1394 | 1407 | { |
| 1395 | 1408 | int retval = 0; |
| 1409 | + struct mqd_manager *mqd_mgr; | |
| 1396 | 1410 | |
| 1397 | 1411 | if (!dqm->sched_running) |
| 1398 | 1412 | return 0; |
| @@ -1424,6 +1438,22 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, · 25 unmodified lines | ||
| 1424 | 1438 | return retval; |
| 1425 | 1439 | } |
| 1426 | 1440 | |
| 1441 | + /* In the current MEC firmware implementation, if compute queue | |
| 1442 | + * doesn't response to the preemption request in time, HIQ will | |
| 1443 | + * abandon the unmap request without returning any timeout error | |
| 1444 | + * to driver. Instead, MEC firmware will log the doorbell of the | |
| 1445 | + * unresponding compute queue to HIQ.MQD.queue_doorbell_id fields. | |
| 1446 | + * To make sure the queue unmap was successful, driver need to | |
| 1447 | + * check those fields | |
| 1448 | + */ | |
| 1449 | + mqd_mgr = dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ]; | |
| 1450 | + if (mqd_mgr->read_doorbell_id(dqm->packets.priv_queue->queue->mqd)) { | |
| 1451 | + pr_err("HIQ MQD's queue_doorbell_id0 is not 0, Queue preemption time out\n"); | |
| 1452 | + while (halt_if_hws_hang) | |
| 1453 | + schedule(); | |
| 1454 | + return -ETIME; | |
| 1455 | + } | |
| 1456 | + | |
| 1427 | 1457 | pm_release_ib(&dqm->packets); |
| 1428 | 1458 | dqm->active_runlist = false; |
| 1429 | 1459 | |
| @@ -1596,26 +1626,6 @@ out: · 166 unmodified lines | ||
| 1596 | 1626 | return retval; |
| 1597 | 1627 | } |
| 1598 | 1628 | |
| 1599 | −static int set_trap_handler(struct device_queue_manager *dqm, | |
| 1600 | − struct qcm_process_device *qpd, | |
| 1601 | − uint64_t tba_addr, | |
| 1602 | − uint64_t tma_addr) | |
| 1603 | −{ | |
| 1604 | − uint64_t *tma; | |
| 1605 | − | |
| 1606 | − if (dqm->dev->cwsr_enabled) { | |
| 1607 | − /* Jump from CWSR trap handler to user trap */ | |
| 1608 | − tma = (uint64_t *)(qpd->cwsr_kaddr + KFD_CWSR_TMA_OFFSET); | |
| 1609 | − tma[0] = tba_addr; | |
| 1610 | − tma[1] = tma_addr; | |
| 1611 | − } else { | |
| 1612 | − qpd->tba_addr = tba_addr; | |
| 1613 | − qpd->tma_addr = tma_addr; | |
| 1614 | − } | |
| 1615 | − | |
| 1616 | − return 0; | |
| 1617 | −} | |
| 1618 | − | |
| 1619 | 1629 | static int process_termination_nocpsch(struct device_queue_manager *dqm, |
| 1620 | 1630 | struct qcm_process_device *qpd) |
| 1621 | 1631 | { |
| @@ -1859,7 +1869,6 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev) · 237 unmodified lines | ||
| 1859 | 1869 | dqm->ops.create_kernel_queue = create_kernel_queue_cpsch; |
| 1860 | 1870 | dqm->ops.destroy_kernel_queue = destroy_kernel_queue_cpsch; |
| 1861 | 1871 | dqm->ops.set_cache_memory_policy = set_cache_memory_policy; |
| 1862 | − dqm->ops.set_trap_handler = set_trap_handler; | |
| 1863 | 1872 | dqm->ops.process_termination = process_termination_cpsch; |
| 1864 | 1873 | dqm->ops.evict_process_queues = evict_process_queues_cpsch; |
| 1865 | 1874 | dqm->ops.restore_process_queues = restore_process_queues_cpsch; |
| @@ -1878,7 +1887,6 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev) · 12 unmodified lines | ||
| 1878 | 1887 | dqm->ops.initialize = initialize_nocpsch; |
| 1879 | 1888 | dqm->ops.uninitialize = uninitialize; |
| 1880 | 1889 | dqm->ops.set_cache_memory_policy = set_cache_memory_policy; |
| 1881 | − dqm->ops.set_trap_handler = set_trap_handler; | |
| 1882 | 1890 | dqm->ops.process_termination = process_termination_nocpsch; |
| 1883 | 1891 | dqm->ops.evict_process_queues = evict_process_queues_nocpsch; |
| 1884 | 1892 | dqm->ops.restore_process_queues = |
| @@ -1918,6 +1926,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev) · 33 unmodified lines | ||
| 1918 | 1926 | case CHIP_RAVEN: |
| 1919 | 1927 | case CHIP_RENOIR: |
| 1920 | 1928 | case CHIP_ARCTURUS: |
| 1929 | + case CHIP_ALDEBARAN: | |
| 1921 | 1930 | device_queue_manager_init_v9(&dqm->asic_ops); |
| 1922 | 1931 | break; |
| 1923 | 1932 | case CHIP_NAVI10: |
| @@ -121,11 +121,6 @@ struct device_queue_manager_ops { · 120 unmodified lines | ||
| 121 | 121 | void __user *alternate_aperture_base, |
| 122 | 122 | uint64_t alternate_aperture_size); |
| 123 | 123 | |
| 124 | − int (*set_trap_handler)(struct device_queue_manager *dqm, | |
| 125 | − struct qcm_process_device *qpd, | |
| 126 | − uint64_t tba_addr, | |
| 127 | − uint64_t tma_addr); | |
| 128 | − | |
| 129 | 124 | int (*process_termination)(struct device_queue_manager *dqm, |
| 130 | 125 | struct qcm_process_device *qpd); |
| 131 | 126 | |
| @@ -412,6 +412,7 @@ int kfd_init_apertures(struct kfd_process *process) · 411 unmodified lines | ||
| 412 | 412 | case CHIP_RAVEN: |
| 413 | 413 | case CHIP_RENOIR: |
| 414 | 414 | case CHIP_ARCTURUS: |
| 415 | + case CHIP_ALDEBARAN: | |
| 415 | 416 | case CHIP_NAVI10: |
| 416 | 417 | case CHIP_NAVI12: |
| 417 | 418 | case CHIP_NAVI14: |
| @@ -98,9 +98,10 @@ static bool event_interrupt_isr_v9(struct kfd_dev *dev, · 97 unmodified lines | ||
| 98 | 98 | source_id == SOC15_INTSRC_SDMA_TRAP || |
| 99 | 99 | source_id == SOC15_INTSRC_SQ_INTERRUPT_MSG || |
| 100 | 100 | source_id == SOC15_INTSRC_CP_BAD_OPCODE || |
| 101 | − client_id == SOC15_IH_CLIENTID_VMC || | |
| 101 | + ((client_id == SOC15_IH_CLIENTID_VMC || | |
| 102 | 102 | client_id == SOC15_IH_CLIENTID_VMC1 || |
| 103 | − client_id == SOC15_IH_CLIENTID_UTCL2; | |
| 103 | + client_id == SOC15_IH_CLIENTID_UTCL2) && | |
| 104 | + !amdgpu_no_queue_eviction_on_vm_fault); | |
| 104 | 105 | } |
| 105 | 106 | |
| 106 | 107 | static void event_interrupt_wq_v9(struct kfd_dev *dev, |
| @@ -20,6 +20,10 @@ · 19 unmodified lines | ||
| 20 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | +#include <linux/kconfig.h> | |
| 24 | + | |
| 25 | +#if IS_REACHABLE(CONFIG_AMD_IOMMU_V2) | |
| 26 | + | |
| 23 | 27 | #include <linux/printk.h> |
| 24 | 28 | #include <linux/device.h> |
| 25 | 29 | #include <linux/slab.h> |
| @@ -355,3 +359,5 @@ int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev) · 329 unmodified lines | ||
| 355 | 359 | |
| 356 | 360 | return 0; |
| 357 | 361 | } |
| 362 | + | |
| 363 | +#endif | |
| @@ -23,7 +23,9 @@ · 22 unmodified lines | ||
| 23 | 23 | #ifndef __KFD_IOMMU_H__ |
| 24 | 24 | #define __KFD_IOMMU_H__ |
| 25 | 25 | |
| 26 | −#if defined(CONFIG_AMD_IOMMU_V2_MODULE) || defined(CONFIG_AMD_IOMMU_V2) | |
| 26 | +#include <linux/kconfig.h> | |
| 27 | + | |
| 28 | +#if IS_REACHABLE(CONFIG_AMD_IOMMU_V2) | |
| 27 | 29 | |
| 28 | 30 | #define KFD_SUPPORT_IOMMU_V2 |
| 29 | 31 | |
| @@ -46,6 +48,9 @@ static inline int kfd_iommu_check_device(struct kfd_dev *kfd) · 16 unmodified lines | ||
| 46 | 48 | } |
| 47 | 49 | static inline int kfd_iommu_device_init(struct kfd_dev *kfd) |
| 48 | 50 | { |
| 51 | +#if IS_MODULE(CONFIG_AMD_IOMMU_V2) | |
| 52 | + WARN_ONCE(1, "iommu_v2 module is not usable by built-in KFD"); | |
| 53 | +#endif | |
| 49 | 54 | return 0; |
| 50 | 55 | } |
| 51 | 56 | |
| @@ -73,6 +78,6 @@ static inline int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev) · 21 unmodified lines | ||
| 73 | 78 | return 0; |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | −#endif /* defined(CONFIG_AMD_IOMMU_V2) */ | |
| 81 | +#endif /* IS_REACHABLE(CONFIG_AMD_IOMMU_V2) */ | |
| 77 | 82 | |
| 78 | 83 | #endif /* __KFD_IOMMU_H__ */ |
| @@ -101,6 +101,7 @@ struct mqd_manager { · 100 unmodified lines | ||
| 101 | 101 | #if defined(CONFIG_DEBUG_FS) |
| 102 | 102 | int (*debugfs_show_mqd)(struct seq_file *m, void *data); |
| 103 | 103 | #endif |
| 104 | + uint32_t (*read_doorbell_id)(void *mqd); | |
| 104 | 105 | |
| 105 | 106 | struct mutex mqd_mutex; |
| 106 | 107 | struct kfd_dev *dev; |
| @@ -226,6 +226,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, · 225 unmodified lines | ||
| 226 | 226 | __update_mqd(mm, mqd, q, 1); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | +static uint32_t read_doorbell_id(void *mqd) | |
| 230 | +{ | |
| 231 | + struct cik_mqd *m = (struct cik_mqd *)mqd; | |
| 232 | + | |
| 233 | + return m->queue_doorbell_id0; | |
| 234 | +} | |
| 235 | + | |
| 229 | 236 | static void update_mqd_hawaii(struct mqd_manager *mm, void *mqd, |
| 230 | 237 | struct queue_properties *q) |
| 231 | 238 | { |
| @@ -398,6 +405,7 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type, · 166 unmodified lines | ||
| 398 | 405 | #if defined(CONFIG_DEBUG_FS) |
| 399 | 406 | mqd->debugfs_show_mqd = debugfs_show_mqd; |
| 400 | 407 | #endif |
| 408 | + mqd->read_doorbell_id = read_doorbell_id; | |
| 401 | 409 | break; |
| 402 | 410 | case KFD_MQD_TYPE_DIQ: |
| 403 | 411 | mqd->allocate_mqd = allocate_mqd; |
| @@ -224,6 +224,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, · 223 unmodified lines | ||
| 224 | 224 | q->is_active = QUEUE_IS_ACTIVE(*q); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | +static uint32_t read_doorbell_id(void *mqd) | |
| 228 | +{ | |
| 229 | + struct v10_compute_mqd *m = (struct v10_compute_mqd *)mqd; | |
| 230 | + | |
| 231 | + return m->queue_doorbell_id0; | |
| 232 | +} | |
| 233 | + | |
| 227 | 234 | static int destroy_mqd(struct mqd_manager *mm, void *mqd, |
| 228 | 235 | enum kfd_preempt_type type, |
| 229 | 236 | unsigned int timeout, uint32_t pipe_id, |
| @@ -425,6 +432,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type, · 195 unmodified lines | ||
| 425 | 432 | #if defined(CONFIG_DEBUG_FS) |
| 426 | 433 | mqd->debugfs_show_mqd = debugfs_show_mqd; |
| 427 | 434 | #endif |
| 435 | + mqd->read_doorbell_id = read_doorbell_id; | |
| 428 | 436 | pr_debug("%s@%i\n", __func__, __LINE__); |
| 429 | 437 | break; |
| 430 | 438 | case KFD_MQD_TYPE_DIQ: |
| @@ -276,6 +276,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, · 275 unmodified lines | ||
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |
| 279 | +static uint32_t read_doorbell_id(void *mqd) | |
| 280 | +{ | |
| 281 | + struct v9_mqd *m = (struct v9_mqd *)mqd; | |
| 282 | + | |
| 283 | + return m->queue_doorbell_id0; | |
| 284 | +} | |
| 285 | + | |
| 279 | 286 | static int destroy_mqd(struct mqd_manager *mm, void *mqd, |
| 280 | 287 | enum kfd_preempt_type type, |
| 281 | 288 | unsigned int timeout, uint32_t pipe_id, |
| @@ -477,6 +484,7 @@ struct mqd_manager *mqd_manager_init_v9(enum KFD_MQD_TYPE type, · 195 unmodified lines | ||
| 477 | 484 | #if defined(CONFIG_DEBUG_FS) |
| 478 | 485 | mqd->debugfs_show_mqd = debugfs_show_mqd; |
| 479 | 486 | #endif |
| 487 | + mqd->read_doorbell_id = read_doorbell_id; | |
| 480 | 488 | break; |
| 481 | 489 | case KFD_MQD_TYPE_DIQ: |
| 482 | 490 | mqd->allocate_mqd = allocate_mqd; |
| @@ -243,6 +243,13 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, · 242 unmodified lines | ||
| 243 | 243 | __update_mqd(mm, mqd, q, MTYPE_CC, 1); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | +static uint32_t read_doorbell_id(void *mqd) | |
| 247 | +{ | |
| 248 | + struct vi_mqd *m = (struct vi_mqd *)mqd; | |
| 249 | + | |
| 250 | + return m->queue_doorbell_id0; | |
| 251 | +} | |
| 252 | + | |
| 246 | 253 | static void update_mqd_tonga(struct mqd_manager *mm, void *mqd, |
| 247 | 254 | struct queue_properties *q) |
| 248 | 255 | { |
| @@ -446,6 +453,7 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type, · 197 unmodified lines | ||
| 446 | 453 | #if defined(CONFIG_DEBUG_FS) |
| 447 | 454 | mqd->debugfs_show_mqd = debugfs_show_mqd; |
| 448 | 455 | #endif |
| 456 | + mqd->read_doorbell_id = read_doorbell_id; | |
| 449 | 457 | break; |
| 450 | 458 | case KFD_MQD_TYPE_DIQ: |
| 451 | 459 | mqd->allocate_mqd = allocate_mqd; |
| @@ -242,6 +242,7 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm) · 241 unmodified lines | ||
| 242 | 242 | case CHIP_RAVEN: |
| 243 | 243 | case CHIP_RENOIR: |
| 244 | 244 | case CHIP_ARCTURUS: |
| 245 | + case CHIP_ALDEBARAN: | |
| 245 | 246 | case CHIP_NAVI10: |
| 246 | 247 | case CHIP_NAVI12: |
| 247 | 248 | case CHIP_NAVI14: |
| @@ -169,6 +169,11 @@ extern bool hws_gws_support; · 168 unmodified lines | ||
| 169 | 169 | /* Queue preemption timeout in ms */ |
| 170 | 170 | extern int queue_preemption_timeout_ms; |
| 171 | 171 | |
| 172 | +/* | |
| 173 | + * Don't evict process queues on vm fault | |
| 174 | + */ | |
| 175 | +extern int amdgpu_no_queue_eviction_on_vm_fault; | |
| 176 | + | |
| 172 | 177 | /* Enable eviction debug messages */ |
| 173 | 178 | extern bool debug_evictions; |
| 174 | 179 | |
| @@ -944,6 +949,10 @@ bool interrupt_is_wanted(struct kfd_dev *dev, · 769 unmodified lines | ||
| 944 | 949 | /* amdkfd Apertures */ |
| 945 | 950 | int kfd_init_apertures(struct kfd_process *process); |
| 946 | 951 | |
| 952 | +void kfd_process_set_trap_handler(struct qcm_process_device *qpd, | |
| 953 | + uint64_t tba_addr, | |
| 954 | + uint64_t tma_addr); | |
| 955 | + | |
| 947 | 956 | /* Queue Context Management */ |
| 948 | 957 | int init_queue(struct queue **q, const struct queue_properties *properties); |
| 949 | 958 | void uninit_queue(struct queue *q); |
| @@ -775,10 +775,8 @@ struct kfd_process *kfd_create_process(struct file *filep) · 774 unmodified lines | ||
| 775 | 775 | goto out; |
| 776 | 776 | |
| 777 | 777 | ret = kfd_process_init_cwsr_apu(process, filep); |
| 778 | − if (ret) { | |
| 779 | − process = ERR_PTR(ret); | |
| 780 | − goto out; | |
| 781 | − } | |
| 778 | + if (ret) | |
| 779 | + goto out_destroy; | |
| 782 | 780 | |
| 783 | 781 | if (!procfs.kobj) |
| 784 | 782 | goto out; |
| @@ -826,6 +824,14 @@ out: · 41 unmodified lines | ||
| 826 | 824 | mutex_unlock(&kfd_processes_mutex); |
| 827 | 825 | |
| 828 | 826 | return process; |
| 827 | + | |
| 828 | +out_destroy: | |
| 829 | + hash_del_rcu(&process->kfd_processes); | |
| 830 | + mutex_unlock(&kfd_processes_mutex); | |
| 831 | + synchronize_srcu(&kfd_processes_srcu); | |
| 832 | + /* kfd_process_free_notifier will trigger the cleanup */ | |
| 833 | + mmu_notifier_put(&process->mmu_notifier); | |
| 834 | + return ERR_PTR(ret); | |
| 829 | 835 | } |
| 830 | 836 | |
| 831 | 837 | struct kfd_process *kfd_get_process(const struct task_struct *thread) |
| @@ -1011,6 +1017,16 @@ static void kfd_process_ref_release(struct kref *ref) · 179 unmodified lines | ||
| 1011 | 1017 | queue_work(kfd_process_wq, &p->release_work); |
| 1012 | 1018 | } |
| 1013 | 1019 | |
| 1020 | +static struct mmu_notifier *kfd_process_alloc_notifier(struct mm_struct *mm) | |
| 1021 | +{ | |
| 1022 | + int idx = srcu_read_lock(&kfd_processes_srcu); | |
| 1023 | + struct kfd_process *p = find_process_by_mm(mm); | |
| 1024 | + | |
| 1025 | + srcu_read_unlock(&kfd_processes_srcu, idx); | |
| 1026 | + | |
| 1027 | + return p ? &p->mmu_notifier : ERR_PTR(-ESRCH); | |
| 1028 | +} | |
| 1029 | + | |
| 1014 | 1030 | static void kfd_process_free_notifier(struct mmu_notifier *mn) |
| 1015 | 1031 | { |
| 1016 | 1032 | kfd_unref_process(container_of(mn, struct kfd_process, mmu_notifier)); |
| @@ -1075,6 +1091,7 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, · 58 unmodified lines | ||
| 1075 | 1091 | |
| 1076 | 1092 | static const struct mmu_notifier_ops kfd_process_mmu_notifier_ops = { |
| 1077 | 1093 | .release = kfd_process_notifier_release, |
| 1094 | + .alloc_notifier = kfd_process_alloc_notifier, | |
| 1078 | 1095 | .free_notifier = kfd_process_free_notifier, |
| 1079 | 1096 | }; |
| 1080 | 1097 | |
| @@ -1145,6 +1162,25 @@ static int kfd_process_device_init_cwsr_dgpu(struct kfd_process_device *pdd) · 64 unmodified lines | ||
| 1145 | 1162 | return 0; |
| 1146 | 1163 | } |
| 1147 | 1164 | |
| 1165 | +void kfd_process_set_trap_handler(struct qcm_process_device *qpd, | |
| 1166 | + uint64_t tba_addr, | |
| 1167 | + uint64_t tma_addr) | |
| 1168 | +{ | |
| 1169 | + if (qpd->cwsr_kaddr) { | |
| 1170 | + /* KFD trap handler is bound, record as second-level TBA/TMA | |
| 1171 | + * in first-level TMA. First-level trap will jump to second. | |
| 1172 | + */ | |
| 1173 | + uint64_t *tma = | |
| 1174 | + (uint64_t *)(qpd->cwsr_kaddr + KFD_CWSR_TMA_OFFSET); | |
| 1175 | + tma[0] = tba_addr; | |
| 1176 | + tma[1] = tma_addr; | |
| 1177 | + } else { | |
| 1178 | + /* No trap handler bound, bind as first-level TBA/TMA. */ | |
| 1179 | + qpd->tba_addr = tba_addr; | |
| 1180 | + qpd->tma_addr = tma_addr; | |
| 1181 | + } | |
| 1182 | +} | |
| 1183 | + | |
| 1148 | 1184 | /* |
| 1149 | 1185 | * On return the kfd_process is fully operational and will be freed when the |
| 1150 | 1186 | * mm is released |
| @@ -1152,6 +1188,7 @@ static int kfd_process_device_init_cwsr_dgpu(struct kfd_process_device *pdd) · 1 unmodified line | ||
| 1152 | 1188 | static struct kfd_process *create_process(const struct task_struct *thread) |
| 1153 | 1189 | { |
| 1154 | 1190 | struct kfd_process *process; |
| 1191 | + struct mmu_notifier *mn; | |
| 1155 | 1192 | int err = -ENOMEM; |
| 1156 | 1193 | |
| 1157 | 1194 | process = kzalloc(sizeof(*process), GFP_KERNEL); |
| @@ -1182,19 +1219,28 @@ static struct kfd_process *create_process(const struct task_struct *thread) · 24 unmodified lines | ||
| 1182 | 1219 | if (err != 0) |
| 1183 | 1220 | goto err_init_apertures; |
| 1184 | 1221 | |
| 1185 | − /* Must be last, have to use release destruction after this */ | |
| 1186 | − process->mmu_notifier.ops = &kfd_process_mmu_notifier_ops; | |
| 1187 | − err = mmu_notifier_register(&process->mmu_notifier, process->mm); | |
| 1188 | − if (err) | |
| 1222 | + /* alloc_notifier needs to find the process in the hash table */ | |
| 1223 | + hash_add_rcu(kfd_processes_table, &process->kfd_processes, | |
| 1224 | + (uintptr_t)process->mm); | |
| 1225 | + | |
| 1226 | + /* MMU notifier registration must be the last call that can fail | |
| 1227 | + * because after this point we cannot unwind the process creation. | |
| 1228 | + * After this point, mmu_notifier_put will trigger the cleanup by | |
| 1229 | + * dropping the last process reference in the free_notifier. | |
| 1230 | + */ | |
| 1231 | + mn = mmu_notifier_get(&kfd_process_mmu_notifier_ops, process->mm); | |
| 1232 | + if (IS_ERR(mn)) { | |
| 1233 | + err = PTR_ERR(mn); | |
| 1189 | 1234 | goto err_register_notifier; |
| 1235 | + } | |
| 1236 | + BUG_ON(mn != &process->mmu_notifier); | |
| 1190 | 1237 | |
| 1191 | 1238 | get_task_struct(process->lead_thread); |
| 1192 | − hash_add_rcu(kfd_processes_table, &process->kfd_processes, | |
| 1193 | − (uintptr_t)process->mm); | |
| 1194 | 1239 | |
| 1195 | 1240 | return process; |
| 1196 | 1241 | |
| 1197 | 1242 | err_register_notifier: |
| 1243 | + hash_del_rcu(&process->kfd_processes); | |
| 1198 | 1244 | kfd_process_free_outstanding_kfd_bos(process); |
| 1199 | 1245 | kfd_process_destroy_pdds(process); |
| 1200 | 1246 | err_init_apertures: |
| @@ -1370,6 +1370,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu) · 1369 unmodified lines | ||
| 1370 | 1370 | case CHIP_RAVEN: |
| 1371 | 1371 | case CHIP_RENOIR: |
| 1372 | 1372 | case CHIP_ARCTURUS: |
| 1373 | + case CHIP_ALDEBARAN: | |
| 1373 | 1374 | case CHIP_NAVI10: |
| 1374 | 1375 | case CHIP_NAVI12: |
| 1375 | 1376 | case CHIP_NAVI14: |
| @@ -47,13 +47,14 @@ · 46 unmodified lines | ||
| 47 | 47 | #define HSA_CAP_DOORBELL_TYPE_2_0 0x2 |
| 48 | 48 | #define HSA_CAP_AQL_QUEUE_DOUBLE_MAP 0x00004000 |
| 49 | 49 | |
| 50 | −#define HSA_CAP_SRAM_EDCSUPPORTED 0x00080000 | |
| 50 | +#define HSA_CAP_RESERVED_WAS_SRAM_EDCSUPPORTED 0x00080000 /* Old buggy user mode depends on this being 0 */ | |
| 51 | 51 | #define HSA_CAP_MEM_EDCSUPPORTED 0x00100000 |
| 52 | 52 | #define HSA_CAP_RASEVENTNOTIFY 0x00200000 |
| 53 | 53 | #define HSA_CAP_ASIC_REVISION_MASK 0x03c00000 |
| 54 | 54 | #define HSA_CAP_ASIC_REVISION_SHIFT 22 |
| 55 | +#define HSA_CAP_SRAM_EDCSUPPORTED 0x04000000 | |
| 55 | 56 | |
| 56 | −#define HSA_CAP_RESERVED 0xfc078000 | |
| 57 | +#define HSA_CAP_RESERVED 0xf80f8000 | |
| 57 | 58 | |
| 58 | 59 | struct kfd_node_properties { |
| 59 | 60 | uint64_t hive_id; |
| @@ -38,4 +38,18 @@ config DEBUG_KERNEL_DC · 37 unmodified lines | ||
| 38 | 38 | help |
| 39 | 39 | Choose this option if you want to hit kdgb_break in assert. |
| 40 | 40 | |
| 41 | +config DRM_AMD_SECURE_DISPLAY | |
| 42 | + bool "Enable secure display support" | |
| 43 | + default n | |
| 44 | + depends on DEBUG_FS | |
| 45 | + depends on DRM_AMD_DC_DCN | |
| 46 | + help | |
| 47 | + Choose this option if you want to | |
| 48 | + support secure display | |
| 49 | + | |
| 50 | + This option enables the calculation | |
| 51 | + of crc of specific region via debugfs. | |
| 52 | + Cooperate with specific DMCU FW. | |
| 53 | + | |
| 54 | + | |
| 41 | 55 | endmenu |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "dc/inc/hw/dmcu.h" |
| 35 | 35 | #include "dc/inc/hw/abm.h" |
| 36 | 36 | #include "dc/dc_dmub_srv.h" |
| 37 | +#include "dc/dc_edid_parser.h" | |
| 37 | 38 | #include "amdgpu_dm_trace.h" |
| 38 | 39 | |
| 39 | 40 | #include "vid.h" |
| @@ -75,7 +76,6 @@ · 35 unmodified lines | ||
| 75 | 76 | #include <drm/drm_edid.h> |
| 76 | 77 | #include <drm/drm_vblank.h> |
| 77 | 78 | #include <drm/drm_audio_component.h> |
| 78 | −#include <drm/drm_hdcp.h> | |
| 79 | 79 | |
| 80 | 80 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 81 | 81 | #include "ivsrcid/dcn/irqsrcs_dcn_1_0.h" |
| @@ -212,6 +212,9 @@ static bool amdgpu_dm_psr_disable_all(struct amdgpu_display_manager *dm); · 130 unmodified lines | ||
| 212 | 212 | static const struct drm_format_info * |
| 213 | 213 | amd_get_format_info(const struct drm_mode_fb_cmd2 *cmd); |
| 214 | 214 | |
| 215 | +static bool | |
| 216 | +is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state, | |
| 217 | + struct drm_crtc_state *new_crtc_state); | |
| 215 | 218 | /* |
| 216 | 219 | * dm_vblank_get_counter |
| 217 | 220 | * |
| @@ -335,6 +338,17 @@ static inline bool amdgpu_dm_vrr_active(struct dm_crtc_state *dm_state) · 117 unmodified lines | ||
| 335 | 338 | dm_state->freesync_config.state == VRR_STATE_ACTIVE_FIXED; |
| 336 | 339 | } |
| 337 | 340 | |
| 341 | +static inline bool is_dc_timing_adjust_needed(struct dm_crtc_state *old_state, | |
| 342 | + struct dm_crtc_state *new_state) | |
| 343 | +{ | |
| 344 | + if (new_state->freesync_config.state == VRR_STATE_ACTIVE_FIXED) | |
| 345 | + return true; | |
| 346 | + else if (amdgpu_dm_vrr_active(old_state) != amdgpu_dm_vrr_active(new_state)) | |
| 347 | + return true; | |
| 348 | + else | |
| 349 | + return false; | |
| 350 | +} | |
| 351 | + | |
| 338 | 352 | /** |
| 339 | 353 | * dm_pflip_high_irq() - Handle pageflip interrupt |
| 340 | 354 | * @interrupt_params: ignored |
| @@ -566,6 +580,31 @@ static void dm_crtc_high_irq(void *interrupt_params) · 225 unmodified lines | ||
| 566 | 580 | spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); |
| 567 | 581 | } |
| 568 | 582 | |
| 583 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 584 | +/** | |
| 585 | + * dm_dcn_vertical_interrupt0_high_irq() - Handles OTG Vertical interrupt0 for | |
| 586 | + * DCN generation ASICs | |
| 587 | + * @interrupt params - interrupt parameters | |
| 588 | + * | |
| 589 | + * Used to set crc window/read out crc value at vertical line 0 position | |
| 590 | + */ | |
| 591 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 592 | +static void dm_dcn_vertical_interrupt0_high_irq(void *interrupt_params) | |
| 593 | +{ | |
| 594 | + struct common_irq_params *irq_params = interrupt_params; | |
| 595 | + struct amdgpu_device *adev = irq_params->adev; | |
| 596 | + struct amdgpu_crtc *acrtc; | |
| 597 | + | |
| 598 | + acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VLINE0); | |
| 599 | + | |
| 600 | + if (!acrtc) | |
| 601 | + return; | |
| 602 | + | |
| 603 | + amdgpu_dm_crtc_handle_crc_window_irq(&acrtc->base); | |
| 604 | +} | |
| 605 | +#endif | |
| 606 | +#endif | |
| 607 | + | |
| 569 | 608 | static int dm_set_clockgating_state(void *handle, |
| 570 | 609 | enum amd_clockgating_state state) |
| 571 | 610 | { |
| @@ -951,9 +990,7 @@ static void event_mall_stutter(struct work_struct *work) · 379 unmodified lines | ||
| 951 | 990 | else |
| 952 | 991 | dm->active_vblank_irq_count--; |
| 953 | 992 | |
| 954 | − | |
| 955 | − dc_allow_idle_optimizations( | |
| 956 | − dm->dc, dm->active_vblank_irq_count == 0 ? true : false); | |
| 993 | + dc_allow_idle_optimizations(dm->dc, dm->active_vblank_irq_count == 0); | |
| 957 | 994 | |
| 958 | 995 | DRM_DEBUG_DRIVER("Allow idle optimizations (MALL): %d\n", dm->active_vblank_irq_count == 0); |
| 959 | 996 | |
| @@ -1060,6 +1097,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) · 100 unmodified lines | ||
| 1060 | 1097 | |
| 1061 | 1098 | init_data.flags.power_down_display_on_boot = true; |
| 1062 | 1099 | |
| 1100 | + INIT_LIST_HEAD(&adev->dm.da_list); | |
| 1063 | 1101 | /* Display Core create. */ |
| 1064 | 1102 | adev->dm.dc = dc_create(&init_data); |
| 1065 | 1103 | |
| @@ -1138,6 +1176,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) · 72 unmodified lines | ||
| 1138 | 1176 | |
| 1139 | 1177 | dc_init_callbacks(adev->dm.dc, &init_params); |
| 1140 | 1178 | } |
| 1179 | +#endif | |
| 1180 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 1181 | + adev->dm.crc_rd_wrk = amdgpu_dm_crtc_secure_display_create_work(); | |
| 1141 | 1182 | #endif |
| 1142 | 1183 | if (amdgpu_dm_initialize_drm_device(adev)) { |
| 1143 | 1184 | DRM_ERROR( |
| @@ -1182,6 +1223,13 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) · 38 unmodified lines | ||
| 1182 | 1223 | |
| 1183 | 1224 | amdgpu_dm_destroy_drm_device(&adev->dm); |
| 1184 | 1225 | |
| 1226 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 1227 | + if (adev->dm.crc_rd_wrk) { | |
| 1228 | + flush_work(&adev->dm.crc_rd_wrk->notify_ta_work); | |
| 1229 | + kfree(adev->dm.crc_rd_wrk); | |
| 1230 | + adev->dm.crc_rd_wrk = NULL; | |
| 1231 | + } | |
| 1232 | +#endif | |
| 1185 | 1233 | #ifdef CONFIG_DRM_AMD_DC_HDCP |
| 1186 | 1234 | if (adev->dm.hdcp_workqueue) { |
| 1187 | 1235 | hdcp_destroy(&adev->dev->kobj, adev->dm.hdcp_workqueue); |
| @@ -1191,6 +1239,15 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) · 3 unmodified lines | ||
| 1191 | 1239 | if (adev->dm.dc) |
| 1192 | 1240 | dc_deinit_callbacks(adev->dm.dc); |
| 1193 | 1241 | #endif |
| 1242 | + | |
| 1243 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 1244 | + if (adev->dm.vblank_workqueue) { | |
| 1245 | + adev->dm.vblank_workqueue->dm = NULL; | |
| 1246 | + kfree(adev->dm.vblank_workqueue); | |
| 1247 | + adev->dm.vblank_workqueue = NULL; | |
| 1248 | + } | |
| 1249 | +#endif | |
| 1250 | + | |
| 1194 | 1251 | if (adev->dm.dc->ctx->dmub_srv) { |
| 1195 | 1252 | dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv); |
| 1196 | 1253 | adev->dm.dc->ctx->dmub_srv = NULL; |
| @@ -1847,6 +1904,9 @@ static int dm_suspend(void *handle) · 650 unmodified lines | ||
| 1847 | 1904 | return ret; |
| 1848 | 1905 | } |
| 1849 | 1906 | |
| 1907 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 1908 | + amdgpu_dm_crtc_secure_display_suspend(adev); | |
| 1909 | +#endif | |
| 1850 | 1910 | WARN_ON(adev->dm.cached_state); |
| 1851 | 1911 | adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev)); |
| 1852 | 1912 | |
| @@ -2171,6 +2231,10 @@ static int dm_resume(void *handle) · 318 unmodified lines | ||
| 2171 | 2231 | |
| 2172 | 2232 | dm->cached_state = NULL; |
| 2173 | 2233 | |
| 2234 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 2235 | + amdgpu_dm_crtc_secure_display_resume(adev); | |
| 2236 | +#endif | |
| 2237 | + | |
| 2174 | 2238 | amdgpu_dm_irq_resume_late(adev); |
| 2175 | 2239 | |
| 2176 | 2240 | amdgpu_dm_smu_write_watermarks_table(adev); |
| @@ -2907,6 +2971,16 @@ static int dcn10_register_irq_handlers(struct amdgpu_device *adev) · 730 unmodified lines | ||
| 2907 | 2971 | struct dc_interrupt_params int_params = {0}; |
| 2908 | 2972 | int r; |
| 2909 | 2973 | int i; |
| 2974 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 2975 | + static const unsigned int vrtl_int_srcid[] = { | |
| 2976 | + DCN_1_0__SRCID__OTG1_VERTICAL_INTERRUPT0_CONTROL, | |
| 2977 | + DCN_1_0__SRCID__OTG2_VERTICAL_INTERRUPT0_CONTROL, | |
| 2978 | + DCN_1_0__SRCID__OTG3_VERTICAL_INTERRUPT0_CONTROL, | |
| 2979 | + DCN_1_0__SRCID__OTG4_VERTICAL_INTERRUPT0_CONTROL, | |
| 2980 | + DCN_1_0__SRCID__OTG5_VERTICAL_INTERRUPT0_CONTROL, | |
| 2981 | + DCN_1_0__SRCID__OTG6_VERTICAL_INTERRUPT0_CONTROL | |
| 2982 | + }; | |
| 2983 | +#endif | |
| 2910 | 2984 | |
| 2911 | 2985 | int_params.requested_polarity = INTERRUPT_POLARITY_DEFAULT; |
| 2912 | 2986 | int_params.current_polarity = INTERRUPT_POLARITY_DEFAULT; |
| @@ -2947,6 +3021,37 @@ static int dcn10_register_irq_handlers(struct amdgpu_device *adev) · 34 unmodified lines | ||
| 2947 | 3021 | adev, &int_params, dm_crtc_high_irq, c_irq_params); |
| 2948 | 3022 | } |
| 2949 | 3023 | |
| 3024 | + /* Use otg vertical line interrupt */ | |
| 3025 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 3026 | + for (i = 0; i <= adev->mode_info.num_crtc - 1; i++) { | |
| 3027 | + r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_DCE, | |
| 3028 | + vrtl_int_srcid[i], &adev->vline0_irq); | |
| 3029 | + | |
| 3030 | + if (r) { | |
| 3031 | + DRM_ERROR("Failed to add vline0 irq id!\n"); | |
| 3032 | + return r; | |
| 3033 | + } | |
| 3034 | + | |
| 3035 | + int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT; | |
| 3036 | + int_params.irq_source = | |
| 3037 | + dc_interrupt_to_irq_source(dc, vrtl_int_srcid[i], 0); | |
| 3038 | + | |
| 3039 | + if (int_params.irq_source == DC_IRQ_SOURCE_INVALID) { | |
| 3040 | + DRM_ERROR("Failed to register vline0 irq %d!\n", vrtl_int_srcid[i]); | |
| 3041 | + break; | |
| 3042 | + } | |
| 3043 | + | |
| 3044 | + c_irq_params = &adev->dm.vline0_params[int_params.irq_source | |
| 3045 | + - DC_IRQ_SOURCE_DC1_VLINE0]; | |
| 3046 | + | |
| 3047 | + c_irq_params->adev = adev; | |
| 3048 | + c_irq_params->irq_src = int_params.irq_source; | |
| 3049 | + | |
| 3050 | + amdgpu_dm_irq_register_interrupt(adev, &int_params, | |
| 3051 | + dm_dcn_vertical_interrupt0_high_irq, c_irq_params); | |
| 3052 | + } | |
| 3053 | +#endif | |
| 3054 | + | |
| 2950 | 3055 | /* Use VUPDATE_NO_LOCK interrupt on DCN, which seems to correspond to |
| 2951 | 3056 | * the regular VUPDATE interrupt on DCE. We want DC_IRQ_SOURCE_VUPDATEx |
| 2952 | 3057 | * to trigger at end of each vblank, regardless of state of the lock, |
| @@ -5001,19 +5106,16 @@ static void fill_stream_properties_from_drm_display_mode( · 2048 unmodified lines | ||
| 5001 | 5106 | timing_out->hdmi_vic = hv_frame.vic; |
| 5002 | 5107 | } |
| 5003 | 5108 | |
| 5004 | − timing_out->h_addressable = mode_in->crtc_hdisplay; | |
| 5005 | − timing_out->h_total = mode_in->crtc_htotal; | |
| 5006 | − timing_out->h_sync_width = | |
| 5007 | − mode_in->crtc_hsync_end - mode_in->crtc_hsync_start; | |
| 5008 | − timing_out->h_front_porch = | |
| 5009 | − mode_in->crtc_hsync_start - mode_in->crtc_hdisplay; | |
| 5010 | − timing_out->v_total = mode_in->crtc_vtotal; | |
| 5011 | − timing_out->v_addressable = mode_in->crtc_vdisplay; | |
| 5012 | − timing_out->v_front_porch = | |
| 5013 | − mode_in->crtc_vsync_start - mode_in->crtc_vdisplay; | |
| 5014 | − timing_out->v_sync_width = | |
| 5015 | − mode_in->crtc_vsync_end - mode_in->crtc_vsync_start; | |
| 5016 | − timing_out->pix_clk_100hz = mode_in->crtc_clock * 10; | |
| 5109 | + timing_out->h_addressable = mode_in->hdisplay; | |
| 5110 | + timing_out->h_total = mode_in->htotal; | |
| 5111 | + timing_out->h_sync_width = mode_in->hsync_end - mode_in->hsync_start; | |
| 5112 | + timing_out->h_front_porch = mode_in->hsync_start - mode_in->hdisplay; | |
| 5113 | + timing_out->v_total = mode_in->vtotal; | |
| 5114 | + timing_out->v_addressable = mode_in->vdisplay; | |
| 5115 | + timing_out->v_front_porch = mode_in->vsync_start - mode_in->vdisplay; | |
| 5116 | + timing_out->v_sync_width = mode_in->vsync_end - mode_in->vsync_start; | |
| 5117 | + timing_out->pix_clk_100hz = mode_in->clock * 10; | |
| 5118 | + | |
| 5017 | 5119 | timing_out->aspect_ratio = get_aspect_ratio(mode_in); |
| 5018 | 5120 | |
| 5019 | 5121 | stream->output_color_space = get_output_color_space(timing_out); |
| @@ -5180,6 +5282,86 @@ static void dm_enable_per_frame_crtc_master_sync(struct dc_state *context) · 160 unmodified lines | ||
| 5180 | 5282 | set_master_stream(context->streams, context->stream_count); |
| 5181 | 5283 | } |
| 5182 | 5284 | |
| 5285 | +static struct drm_display_mode * | |
| 5286 | +get_highest_refresh_rate_mode(struct amdgpu_dm_connector *aconnector, | |
| 5287 | + bool use_probed_modes) | |
| 5288 | +{ | |
| 5289 | + struct drm_display_mode *m, *m_pref = NULL; | |
| 5290 | + u16 current_refresh, highest_refresh; | |
| 5291 | + struct list_head *list_head = use_probed_modes ? | |
| 5292 | + &aconnector->base.probed_modes : | |
| 5293 | + &aconnector->base.modes; | |
| 5294 | + | |
| 5295 | + if (aconnector->freesync_vid_base.clock != 0) | |
| 5296 | + return &aconnector->freesync_vid_base; | |
| 5297 | + | |
| 5298 | + /* Find the preferred mode */ | |
| 5299 | + list_for_each_entry (m, list_head, head) { | |
| 5300 | + if (m->type & DRM_MODE_TYPE_PREFERRED) { | |
| 5301 | + m_pref = m; | |
| 5302 | + break; | |
| 5303 | + } | |
| 5304 | + } | |
| 5305 | + | |
| 5306 | + if (!m_pref) { | |
| 5307 | + /* Probably an EDID with no preferred mode. Fallback to first entry */ | |
| 5308 | + m_pref = list_first_entry_or_null( | |
| 5309 | + &aconnector->base.modes, struct drm_display_mode, head); | |
| 5310 | + if (!m_pref) { | |
| 5311 | + DRM_DEBUG_DRIVER("No preferred mode found in EDID\n"); | |
| 5312 | + return NULL; | |
| 5313 | + } | |
| 5314 | + } | |
| 5315 | + | |
| 5316 | + highest_refresh = drm_mode_vrefresh(m_pref); | |
| 5317 | + | |
| 5318 | + /* | |
| 5319 | + * Find the mode with highest refresh rate with same resolution. | |
| 5320 | + * For some monitors, preferred mode is not the mode with highest | |
| 5321 | + * supported refresh rate. | |
| 5322 | + */ | |
| 5323 | + list_for_each_entry (m, list_head, head) { | |
| 5324 | + current_refresh = drm_mode_vrefresh(m); | |
| 5325 | + | |
| 5326 | + if (m->hdisplay == m_pref->hdisplay && | |
| 5327 | + m->vdisplay == m_pref->vdisplay && | |
| 5328 | + highest_refresh < current_refresh) { | |
| 5329 | + highest_refresh = current_refresh; | |
| 5330 | + m_pref = m; | |
| 5331 | + } | |
| 5332 | + } | |
| 5333 | + | |
| 5334 | + aconnector->freesync_vid_base = *m_pref; | |
| 5335 | + return m_pref; | |
| 5336 | +} | |
| 5337 | + | |
| 5338 | +static bool is_freesync_video_mode(struct drm_display_mode *mode, | |
| 5339 | + struct amdgpu_dm_connector *aconnector) | |
| 5340 | +{ | |
| 5341 | + struct drm_display_mode *high_mode; | |
| 5342 | + int timing_diff; | |
| 5343 | + | |
| 5344 | + high_mode = get_highest_refresh_rate_mode(aconnector, false); | |
| 5345 | + if (!high_mode || !mode) | |
| 5346 | + return false; | |
| 5347 | + | |
| 5348 | + timing_diff = high_mode->vtotal - mode->vtotal; | |
| 5349 | + | |
| 5350 | + if (high_mode->clock == 0 || high_mode->clock != mode->clock || | |
| 5351 | + high_mode->hdisplay != mode->hdisplay || | |
| 5352 | + high_mode->vdisplay != mode->vdisplay || | |
| 5353 | + high_mode->hsync_start != mode->hsync_start || | |
| 5354 | + high_mode->hsync_end != mode->hsync_end || | |
| 5355 | + high_mode->htotal != mode->htotal || | |
| 5356 | + high_mode->hskew != mode->hskew || | |
| 5357 | + high_mode->vscan != mode->vscan || | |
| 5358 | + high_mode->vsync_start - mode->vsync_start != timing_diff || | |
| 5359 | + high_mode->vsync_end - mode->vsync_end != timing_diff) | |
| 5360 | + return false; | |
| 5361 | + else | |
| 5362 | + return true; | |
| 5363 | +} | |
| 5364 | + | |
| 5183 | 5365 | static struct dc_stream_state * |
| 5184 | 5366 | create_stream_for_sink(struct amdgpu_dm_connector *aconnector, |
| 5185 | 5367 | const struct drm_display_mode *drm_mode, |
| @@ -5193,8 +5375,10 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 7 unmodified lines | ||
| 5193 | 5375 | dm_state ? &dm_state->base : NULL; |
| 5194 | 5376 | struct dc_stream_state *stream = NULL; |
| 5195 | 5377 | struct drm_display_mode mode = *drm_mode; |
| 5378 | + struct drm_display_mode saved_mode; | |
| 5379 | + struct drm_display_mode *freesync_mode = NULL; | |
| 5196 | 5380 | bool native_mode_found = false; |
| 5197 | − bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false; | |
| 5381 | + bool recalculate_timing = dm_state ? (dm_state->scaling != RMX_OFF) : false; | |
| 5198 | 5382 | int mode_refresh; |
| 5199 | 5383 | int preferred_refresh = 0; |
| 5200 | 5384 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| @@ -5202,6 +5386,9 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 1 unmodified line | ||
| 5202 | 5386 | uint32_t link_bandwidth_kbps; |
| 5203 | 5387 | #endif |
| 5204 | 5388 | struct dc_sink *sink = NULL; |
| 5389 | + | |
| 5390 | + memset(&saved_mode, 0, sizeof(saved_mode)); | |
| 5391 | + | |
| 5205 | 5392 | if (aconnector == NULL) { |
| 5206 | 5393 | DRM_ERROR("aconnector is NULL!\n"); |
| 5207 | 5394 | return stream; |
| @@ -5254,25 +5441,38 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 46 unmodified lines | ||
| 5254 | 5441 | */ |
| 5255 | 5442 | DRM_DEBUG_DRIVER("No preferred mode found\n"); |
| 5256 | 5443 | } else { |
| 5257 | − decide_crtc_timing_for_drm_display_mode( | |
| 5444 | + recalculate_timing |= amdgpu_freesync_vid_mode && | |
| 5445 | + is_freesync_video_mode(&mode, aconnector); | |
| 5446 | + if (recalculate_timing) { | |
| 5447 | + freesync_mode = get_highest_refresh_rate_mode(aconnector, false); | |
| 5448 | + saved_mode = mode; | |
| 5449 | + mode = *freesync_mode; | |
| 5450 | + } else { | |
| 5451 | + decide_crtc_timing_for_drm_display_mode( | |
| 5258 | 5452 | &mode, preferred_mode, |
| 5259 | 5453 | dm_state ? (dm_state->scaling != RMX_OFF) : false); |
| 5454 | + } | |
| 5455 | + | |
| 5260 | 5456 | preferred_refresh = drm_mode_vrefresh(preferred_mode); |
| 5261 | 5457 | } |
| 5262 | 5458 | |
| 5263 | − if (!dm_state) | |
| 5459 | + if (recalculate_timing) | |
| 5460 | + drm_mode_set_crtcinfo(&saved_mode, 0); | |
| 5461 | + else | |
| 5264 | 5462 | drm_mode_set_crtcinfo(&mode, 0); |
| 5265 | 5463 | |
| 5266 | − /* | |
| 5464 | + /* | |
| 5267 | 5465 | * If scaling is enabled and refresh rate didn't change |
| 5268 | 5466 | * we copy the vic and polarities of the old timings |
| 5269 | 5467 | */ |
| 5270 | − if (!scale || mode_refresh != preferred_refresh) | |
| 5271 | − fill_stream_properties_from_drm_display_mode(stream, | |
| 5272 | − &mode, &aconnector->base, con_state, NULL, requested_bpc); | |
| 5468 | + if (!recalculate_timing || mode_refresh != preferred_refresh) | |
| 5469 | + fill_stream_properties_from_drm_display_mode( | |
| 5470 | + stream, &mode, &aconnector->base, con_state, NULL, | |
| 5471 | + requested_bpc); | |
| 5273 | 5472 | else |
| 5274 | − fill_stream_properties_from_drm_display_mode(stream, | |
| 5275 | − &mode, &aconnector->base, con_state, old_stream, requested_bpc); | |
| 5473 | + fill_stream_properties_from_drm_display_mode( | |
| 5474 | + stream, &mode, &aconnector->base, con_state, old_stream, | |
| 5475 | + requested_bpc); | |
| 5276 | 5476 | |
| 5277 | 5477 | stream->timing.flags.DSC = 0; |
| 5278 | 5478 | |
| @@ -5409,15 +5609,22 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc) · 130 unmodified lines | ||
| 5409 | 5609 | state->abm_level = cur->abm_level; |
| 5410 | 5610 | state->vrr_supported = cur->vrr_supported; |
| 5411 | 5611 | state->freesync_config = cur->freesync_config; |
| 5412 | − state->crc_src = cur->crc_src; | |
| 5413 | 5612 | state->cm_has_degamma = cur->cm_has_degamma; |
| 5414 | 5613 | state->cm_is_degamma_srgb = cur->cm_is_degamma_srgb; |
| 5415 | − | |
| 5416 | 5614 | /* TODO Duplicate dc_stream after objects are stream object is flattened */ |
| 5417 | 5615 | |
| 5418 | 5616 | return &state->base; |
| 5419 | 5617 | } |
| 5420 | 5618 | |
| 5619 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 5620 | +static int amdgpu_dm_crtc_late_register(struct drm_crtc *crtc) | |
| 5621 | +{ | |
| 5622 | + crtc_debugfs_init(crtc); | |
| 5623 | + | |
| 5624 | + return 0; | |
| 5625 | +} | |
| 5626 | +#endif | |
| 5627 | + | |
| 5421 | 5628 | static inline int dm_set_vupdate_irq(struct drm_crtc *crtc, bool enable) |
| 5422 | 5629 | { |
| 5423 | 5630 | enum dc_irq_source irq_source; |
| @@ -5503,6 +5710,9 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { · 79 unmodified lines | ||
| 5503 | 5710 | .enable_vblank = dm_enable_vblank, |
| 5504 | 5711 | .disable_vblank = dm_disable_vblank, |
| 5505 | 5712 | .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, |
| 5713 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 5714 | + .late_register = amdgpu_dm_crtc_late_register, | |
| 5715 | +#endif | |
| 5506 | 5716 | }; |
| 5507 | 5717 | |
| 5508 | 5718 | static enum drm_connector_status |
| @@ -6488,13 +6698,17 @@ static int dm_plane_helper_check_state(struct drm_plane_state *state, · 979 unmodified lines | ||
| 6488 | 6698 | else if (state->crtc_y + state->crtc_h > new_crtc_state->mode.crtc_vdisplay) |
| 6489 | 6699 | viewport_height = new_crtc_state->mode.crtc_vdisplay - state->crtc_y; |
| 6490 | 6700 | |
| 6491 | − /* If completely outside of screen, viewport_width and/or viewport_height will be negative, | |
| 6492 | − * which is still OK to satisfy the condition below, thereby also covering these cases | |
| 6493 | − * (when plane is completely outside of screen). | |
| 6494 | − * x2 for width is because of pipe-split. | |
| 6495 | − */ | |
| 6496 | − if (viewport_width < MIN_VIEWPORT_SIZE*2 || viewport_height < MIN_VIEWPORT_SIZE) | |
| 6701 | + if (viewport_width < 0 || viewport_height < 0) { | |
| 6702 | + DRM_DEBUG_ATOMIC("Plane completely outside of screen\n"); | |
| 6703 | + return -EINVAL; | |
| 6704 | + } else if (viewport_width < MIN_VIEWPORT_SIZE*2) { /* x2 for width is because of pipe-split. */ | |
| 6705 | + DRM_DEBUG_ATOMIC("Viewport width %d smaller than %d\n", viewport_width, MIN_VIEWPORT_SIZE*2); | |
| 6497 | 6706 | return -EINVAL; |
| 6707 | + } else if (viewport_height < MIN_VIEWPORT_SIZE) { | |
| 6708 | + DRM_DEBUG_ATOMIC("Viewport height %d smaller than %d\n", viewport_height, MIN_VIEWPORT_SIZE); | |
| 6709 | + return -EINVAL; | |
| 6710 | + } | |
| 6711 | + | |
| 6498 | 6712 | } |
| 6499 | 6713 | |
| 6500 | 6714 | /* Get min/max allowed scaling factors from plane caps. */ |
| @@ -6975,11 +7189,118 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector, · 474 unmodified lines | ||
| 6975 | 7189 | */ |
| 6976 | 7190 | drm_mode_sort(&connector->probed_modes); |
| 6977 | 7191 | amdgpu_dm_get_native_mode(connector); |
| 7192 | + | |
| 7193 | + /* Freesync capabilities are reset by calling | |
| 7194 | + * drm_add_edid_modes() and need to be | |
| 7195 | + * restored here. | |
| 7196 | + */ | |
| 7197 | + amdgpu_dm_update_freesync_caps(connector, edid); | |
| 6978 | 7198 | } else { |
| 6979 | 7199 | amdgpu_dm_connector->num_modes = 0; |
| 6980 | 7200 | } |
| 6981 | 7201 | } |
| 6982 | 7202 | |
| 7203 | +static bool is_duplicate_mode(struct amdgpu_dm_connector *aconnector, | |
| 7204 | + struct drm_display_mode *mode) | |
| 7205 | +{ | |
| 7206 | + struct drm_display_mode *m; | |
| 7207 | + | |
| 7208 | + list_for_each_entry (m, &aconnector->base.probed_modes, head) { | |
| 7209 | + if (drm_mode_equal(m, mode)) | |
| 7210 | + return true; | |
| 7211 | + } | |
| 7212 | + | |
| 7213 | + return false; | |
| 7214 | +} | |
| 7215 | + | |
| 7216 | +static uint add_fs_modes(struct amdgpu_dm_connector *aconnector) | |
| 7217 | +{ | |
| 7218 | + const struct drm_display_mode *m; | |
| 7219 | + struct drm_display_mode *new_mode; | |
| 7220 | + uint i; | |
| 7221 | + uint32_t new_modes_count = 0; | |
| 7222 | + | |
| 7223 | + /* Standard FPS values | |
| 7224 | + * | |
| 7225 | + * 23.976 - TV/NTSC | |
| 7226 | + * 24 - Cinema | |
| 7227 | + * 25 - TV/PAL | |
| 7228 | + * 29.97 - TV/NTSC | |
| 7229 | + * 30 - TV/NTSC | |
| 7230 | + * 48 - Cinema HFR | |
| 7231 | + * 50 - TV/PAL | |
| 7232 | + * 60 - Commonly used | |
| 7233 | + * 48,72,96 - Multiples of 24 | |
| 7234 | + */ | |
| 7235 | + const uint32_t common_rates[] = { 23976, 24000, 25000, 29970, 30000, | |
| 7236 | + 48000, 50000, 60000, 72000, 96000 }; | |
| 7237 | + | |
| 7238 | + /* | |
| 7239 | + * Find mode with highest refresh rate with the same resolution | |
| 7240 | + * as the preferred mode. Some monitors report a preferred mode | |
| 7241 | + * with lower resolution than the highest refresh rate supported. | |
| 7242 | + */ | |
| 7243 | + | |
| 7244 | + m = get_highest_refresh_rate_mode(aconnector, true); | |
| 7245 | + if (!m) | |
| 7246 | + return 0; | |
| 7247 | + | |
| 7248 | + for (i = 0; i < ARRAY_SIZE(common_rates); i++) { | |
| 7249 | + uint64_t target_vtotal, target_vtotal_diff; | |
| 7250 | + uint64_t num, den; | |
| 7251 | + | |
| 7252 | + if (drm_mode_vrefresh(m) * 1000 < common_rates[i]) | |
| 7253 | + continue; | |
| 7254 | + | |
| 7255 | + if (common_rates[i] < aconnector->min_vfreq * 1000 || | |
| 7256 | + common_rates[i] > aconnector->max_vfreq * 1000) | |
| 7257 | + continue; | |
| 7258 | + | |
| 7259 | + num = (unsigned long long)m->clock * 1000 * 1000; | |
| 7260 | + den = common_rates[i] * (unsigned long long)m->htotal; | |
| 7261 | + target_vtotal = div_u64(num, den); | |
| 7262 | + target_vtotal_diff = target_vtotal - m->vtotal; | |
| 7263 | + | |
| 7264 | + /* Check for illegal modes */ | |
| 7265 | + if (m->vsync_start + target_vtotal_diff < m->vdisplay || | |
| 7266 | + m->vsync_end + target_vtotal_diff < m->vsync_start || | |
| 7267 | + m->vtotal + target_vtotal_diff < m->vsync_end) | |
| 7268 | + continue; | |
| 7269 | + | |
| 7270 | + new_mode = drm_mode_duplicate(aconnector->base.dev, m); | |
| 7271 | + if (!new_mode) | |
| 7272 | + goto out; | |
| 7273 | + | |
| 7274 | + new_mode->vtotal += (u16)target_vtotal_diff; | |
| 7275 | + new_mode->vsync_start += (u16)target_vtotal_diff; | |
| 7276 | + new_mode->vsync_end += (u16)target_vtotal_diff; | |
| 7277 | + new_mode->type &= ~DRM_MODE_TYPE_PREFERRED; | |
| 7278 | + new_mode->type |= DRM_MODE_TYPE_DRIVER; | |
| 7279 | + | |
| 7280 | + if (!is_duplicate_mode(aconnector, new_mode)) { | |
| 7281 | + drm_mode_probed_add(&aconnector->base, new_mode); | |
| 7282 | + new_modes_count += 1; | |
| 7283 | + } else | |
| 7284 | + drm_mode_destroy(aconnector->base.dev, new_mode); | |
| 7285 | + } | |
| 7286 | + out: | |
| 7287 | + return new_modes_count; | |
| 7288 | +} | |
| 7289 | + | |
| 7290 | +static void amdgpu_dm_connector_add_freesync_modes(struct drm_connector *connector, | |
| 7291 | + struct edid *edid) | |
| 7292 | +{ | |
| 7293 | + struct amdgpu_dm_connector *amdgpu_dm_connector = | |
| 7294 | + to_amdgpu_dm_connector(connector); | |
| 7295 | + | |
| 7296 | + if (!(amdgpu_freesync_vid_mode && edid)) | |
| 7297 | + return; | |
| 7298 | + | |
| 7299 | + if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10) | |
| 7300 | + amdgpu_dm_connector->num_modes += | |
| 7301 | + add_fs_modes(amdgpu_dm_connector); | |
| 7302 | +} | |
| 7303 | + | |
| 6983 | 7304 | static int amdgpu_dm_connector_get_modes(struct drm_connector *connector) |
| 6984 | 7305 | { |
| 6985 | 7306 | struct amdgpu_dm_connector *amdgpu_dm_connector = |
| @@ -6995,6 +7316,7 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector) · 9 unmodified lines | ||
| 6995 | 7316 | } else { |
| 6996 | 7317 | amdgpu_dm_connector_ddc_get_modes(connector, edid); |
| 6997 | 7318 | amdgpu_dm_connector_add_common_modes(encoder, connector); |
| 7319 | + amdgpu_dm_connector_add_freesync_modes(connector, edid); | |
| 6998 | 7320 | } |
| 6999 | 7321 | amdgpu_dm_fbc_init(connector); |
| 7000 | 7322 | |
| @@ -7299,8 +7621,19 @@ static void manage_dm_interrupts(struct amdgpu_device *adev, · 298 unmodified lines | ||
| 7299 | 7621 | adev, |
| 7300 | 7622 | &adev->pageflip_irq, |
| 7301 | 7623 | irq_type); |
| 7624 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 7625 | + amdgpu_irq_get( | |
| 7626 | + adev, | |
| 7627 | + &adev->vline0_irq, | |
| 7628 | + irq_type); | |
| 7629 | +#endif | |
| 7302 | 7630 | } else { |
| 7303 | − | |
| 7631 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 7632 | + amdgpu_irq_put( | |
| 7633 | + adev, | |
| 7634 | + &adev->vline0_irq, | |
| 7635 | + irq_type); | |
| 7636 | +#endif | |
| 7304 | 7637 | amdgpu_irq_put( |
| 7305 | 7638 | adev, |
| 7306 | 7639 | &adev->pageflip_irq, |
| @@ -7424,10 +7757,6 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc, · 117 unmodified lines | ||
| 7424 | 7757 | int x, y; |
| 7425 | 7758 | int xorigin = 0, yorigin = 0; |
| 7426 | 7759 | |
| 7427 | − position->enable = false; | |
| 7428 | − position->x = 0; | |
| 7429 | − position->y = 0; | |
| 7430 | − | |
| 7431 | 7760 | if (!crtc || !plane->state->fb) |
| 7432 | 7761 | return 0; |
| 7433 | 7762 | |
| @@ -7474,7 +7803,7 @@ static void handle_cursor_update(struct drm_plane *plane, · 40 unmodified lines | ||
| 7474 | 7803 | struct dm_crtc_state *crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL; |
| 7475 | 7804 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
| 7476 | 7805 | uint64_t address = afb ? afb->address : 0; |
| 7477 | − struct dc_cursor_position position; | |
| 7806 | + struct dc_cursor_position position = {0}; | |
| 7478 | 7807 | struct dc_cursor_attributes attributes; |
| 7479 | 7808 | int ret; |
| 7480 | 7809 | |
| @@ -7559,6 +7888,7 @@ static void update_freesync_state_on_stream( · 78 unmodified lines | ||
| 7559 | 7888 | struct amdgpu_device *adev = dm->adev; |
| 7560 | 7889 | struct amdgpu_crtc *acrtc = to_amdgpu_crtc(new_crtc_state->base.crtc); |
| 7561 | 7890 | unsigned long flags; |
| 7891 | + bool pack_sdp_v1_3 = false; | |
| 7562 | 7892 | |
| 7563 | 7893 | if (!new_stream) |
| 7564 | 7894 | return; |
| @@ -7600,7 +7930,8 @@ static void update_freesync_state_on_stream( · 35 unmodified lines | ||
| 7600 | 7930 | &vrr_params, |
| 7601 | 7931 | PACKET_TYPE_VRR, |
| 7602 | 7932 | TRANSFER_FUNC_UNKNOWN, |
| 7603 | − &vrr_infopacket); | |
| 7933 | + &vrr_infopacket, | |
| 7934 | + pack_sdp_v1_3); | |
| 7604 | 7935 | |
| 7605 | 7936 | new_crtc_state->freesync_timing_changed |= |
| 7606 | 7937 | (memcmp(&acrtc->dm_irq_params.vrr_params.adjust, |
| @@ -7654,9 +7985,22 @@ static void update_stream_irq_parameters( · 47 unmodified lines | ||
| 7654 | 7985 | if (new_crtc_state->vrr_supported && |
| 7655 | 7986 | config.min_refresh_in_uhz && |
| 7656 | 7987 | config.max_refresh_in_uhz) { |
| 7657 | − config.state = new_crtc_state->base.vrr_enabled ? | |
| 7658 | − VRR_STATE_ACTIVE_VARIABLE : | |
| 7659 | − VRR_STATE_INACTIVE; | |
| 7988 | + /* | |
| 7989 | + * if freesync compatible mode was set, config.state will be set | |
| 7990 | + * in atomic check | |
| 7991 | + */ | |
| 7992 | + if (config.state == VRR_STATE_ACTIVE_FIXED && config.fixed_refresh_in_uhz && | |
| 7993 | + (!drm_atomic_crtc_needs_modeset(&new_crtc_state->base) || | |
| 7994 | + new_crtc_state->freesync_config.state == VRR_STATE_ACTIVE_FIXED)) { | |
| 7995 | + vrr_params.max_refresh_in_uhz = config.max_refresh_in_uhz; | |
| 7996 | + vrr_params.min_refresh_in_uhz = config.min_refresh_in_uhz; | |
| 7997 | + vrr_params.fixed_refresh_in_uhz = config.fixed_refresh_in_uhz; | |
| 7998 | + vrr_params.state = VRR_STATE_ACTIVE_FIXED; | |
| 7999 | + } else { | |
| 8000 | + config.state = new_crtc_state->base.vrr_enabled ? | |
| 8001 | + VRR_STATE_ACTIVE_VARIABLE : | |
| 8002 | + VRR_STATE_INACTIVE; | |
| 8003 | + } | |
| 7660 | 8004 | } else { |
| 7661 | 8005 | config.state = VRR_STATE_UNSUPPORTED; |
| 7662 | 8006 | } |
| @@ -7977,8 +8321,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 314 unmodified lines | ||
| 7977 | 8321 | * re-adjust the min/max bounds now that DC doesn't handle this |
| 7978 | 8322 | * as part of commit. |
| 7979 | 8323 | */ |
| 7980 | − if (amdgpu_dm_vrr_active(dm_old_crtc_state) != | |
| 7981 | − amdgpu_dm_vrr_active(acrtc_state)) { | |
| 8324 | + if (is_dc_timing_adjust_needed(dm_old_crtc_state, acrtc_state)) { | |
| 7982 | 8325 | spin_lock_irqsave(&pcrtc->dev->event_lock, flags); |
| 7983 | 8326 | dc_stream_adjust_vmin_vmax( |
| 7984 | 8327 | dm->dc, acrtc_state->stream, |
| @@ -8263,6 +8606,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 278 unmodified lines | ||
| 8263 | 8606 | /* i.e. reset mode */ |
| 8264 | 8607 | if (dm_old_crtc_state->stream) |
| 8265 | 8608 | remove_stream(adev, acrtc, dm_old_crtc_state->stream); |
| 8609 | + | |
| 8266 | 8610 | mode_set_reset_required = true; |
| 8267 | 8611 | } |
| 8268 | 8612 | } /* for_each_crtc_in_state() */ |
| @@ -8321,8 +8665,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 52 unmodified lines | ||
| 8321 | 8665 | hdcp_update_display( |
| 8322 | 8666 | adev->dm.hdcp_workqueue, aconnector->dc_link->link_index, aconnector, |
| 8323 | 8667 | new_con_state->hdcp_content_type, |
| 8324 | − new_con_state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED ? true | |
| 8325 | − : false); | |
| 8668 | + new_con_state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED); | |
| 8326 | 8669 | } |
| 8327 | 8670 | #endif |
| 8328 | 8671 | |
| @@ -8432,7 +8775,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 103 unmodified lines | ||
| 8432 | 8775 | */ |
| 8433 | 8776 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { |
| 8434 | 8777 | struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); |
| 8435 | − | |
| 8778 | +#ifdef CONFIG_DEBUG_FS | |
| 8779 | + bool configure_crc = false; | |
| 8780 | + enum amdgpu_dm_pipe_crc_source cur_crc_src; | |
| 8781 | +#endif | |
| 8436 | 8782 | dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); |
| 8437 | 8783 | |
| 8438 | 8784 | if (new_crtc_state->active && |
| @@ -8448,12 +8794,21 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 9 unmodified lines | ||
| 8448 | 8794 | * settings for the stream. |
| 8449 | 8795 | */ |
| 8450 | 8796 | dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); |
| 8797 | + spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); | |
| 8798 | + cur_crc_src = acrtc->dm_irq_params.crc_src; | |
| 8799 | + spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); | |
| 8800 | + | |
| 8801 | + if (amdgpu_dm_is_valid_crc_source(cur_crc_src)) { | |
| 8802 | + configure_crc = true; | |
| 8803 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 8804 | + if (amdgpu_dm_crc_window_is_activated(crtc)) | |
| 8805 | + configure_crc = false; | |
| 8806 | +#endif | |
| 8807 | + } | |
| 8451 | 8808 | |
| 8452 | − if (amdgpu_dm_is_valid_crc_source(dm_new_crtc_state->crc_src)) { | |
| 8809 | + if (configure_crc) | |
| 8453 | 8810 | amdgpu_dm_crtc_configure_crc_source( |
| 8454 | − crtc, dm_new_crtc_state, | |
| 8455 | − dm_new_crtc_state->crc_src); | |
| 8456 | − } | |
| 8811 | + crtc, dm_new_crtc_state, cur_crc_src); | |
| 8457 | 8812 | #endif |
| 8458 | 8813 | } |
| 8459 | 8814 | } |
| @@ -8662,6 +9017,7 @@ static void get_freesync_config_for_crtc( · 202 unmodified lines | ||
| 8662 | 9017 | to_amdgpu_dm_connector(new_con_state->base.connector); |
| 8663 | 9018 | struct drm_display_mode *mode = &new_crtc_state->base.mode; |
| 8664 | 9019 | int vrefresh = drm_mode_vrefresh(mode); |
| 9020 | + bool fs_vid_mode = false; | |
| 8665 | 9021 | |
| 8666 | 9022 | new_crtc_state->vrr_supported = new_con_state->freesync_capable && |
| 8667 | 9023 | vrefresh >= aconnector->min_vfreq && |
| @@ -8669,17 +9025,24 @@ static void get_freesync_config_for_crtc( · 1 unmodified line | ||
| 8669 | 9025 | |
| 8670 | 9026 | if (new_crtc_state->vrr_supported) { |
| 8671 | 9027 | new_crtc_state->stream->ignore_msa_timing_param = true; |
| 8672 | − config.state = new_crtc_state->base.vrr_enabled ? | |
| 8673 | − VRR_STATE_ACTIVE_VARIABLE : | |
| 8674 | − VRR_STATE_INACTIVE; | |
| 8675 | − config.min_refresh_in_uhz = | |
| 8676 | − aconnector->min_vfreq * 1000000; | |
| 8677 | − config.max_refresh_in_uhz = | |
| 8678 | − aconnector->max_vfreq * 1000000; | |
| 9028 | + fs_vid_mode = new_crtc_state->freesync_config.state == VRR_STATE_ACTIVE_FIXED; | |
| 9029 | + | |
| 9030 | + config.min_refresh_in_uhz = aconnector->min_vfreq * 1000000; | |
| 9031 | + config.max_refresh_in_uhz = aconnector->max_vfreq * 1000000; | |
| 8679 | 9032 | config.vsif_supported = true; |
| 8680 | 9033 | config.btr = true; |
| 8681 | − } | |
| 8682 | 9034 | |
| 9035 | + if (fs_vid_mode) { | |
| 9036 | + config.state = VRR_STATE_ACTIVE_FIXED; | |
| 9037 | + config.fixed_refresh_in_uhz = new_crtc_state->freesync_config.fixed_refresh_in_uhz; | |
| 9038 | + goto out; | |
| 9039 | + } else if (new_crtc_state->base.vrr_enabled) { | |
| 9040 | + config.state = VRR_STATE_ACTIVE_VARIABLE; | |
| 9041 | + } else { | |
| 9042 | + config.state = VRR_STATE_INACTIVE; | |
| 9043 | + } | |
| 9044 | + } | |
| 9045 | +out: | |
| 8683 | 9046 | new_crtc_state->freesync_config = config; |
| 8684 | 9047 | } |
| 8685 | 9048 | |
| @@ -8692,6 +9055,50 @@ static void reset_freesync_config_for_crtc( · 6 unmodified lines | ||
| 8692 | 9055 | sizeof(new_crtc_state->vrr_infopacket)); |
| 8693 | 9056 | } |
| 8694 | 9057 | |
| 9058 | +static bool | |
| 9059 | +is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state, | |
| 9060 | + struct drm_crtc_state *new_crtc_state) | |
| 9061 | +{ | |
| 9062 | + struct drm_display_mode old_mode, new_mode; | |
| 9063 | + | |
| 9064 | + if (!old_crtc_state || !new_crtc_state) | |
| 9065 | + return false; | |
| 9066 | + | |
| 9067 | + old_mode = old_crtc_state->mode; | |
| 9068 | + new_mode = new_crtc_state->mode; | |
| 9069 | + | |
| 9070 | + if (old_mode.clock == new_mode.clock && | |
| 9071 | + old_mode.hdisplay == new_mode.hdisplay && | |
| 9072 | + old_mode.vdisplay == new_mode.vdisplay && | |
| 9073 | + old_mode.htotal == new_mode.htotal && | |
| 9074 | + old_mode.vtotal != new_mode.vtotal && | |
| 9075 | + old_mode.hsync_start == new_mode.hsync_start && | |
| 9076 | + old_mode.vsync_start != new_mode.vsync_start && | |
| 9077 | + old_mode.hsync_end == new_mode.hsync_end && | |
| 9078 | + old_mode.vsync_end != new_mode.vsync_end && | |
| 9079 | + old_mode.hskew == new_mode.hskew && | |
| 9080 | + old_mode.vscan == new_mode.vscan && | |
| 9081 | + (old_mode.vsync_end - old_mode.vsync_start) == | |
| 9082 | + (new_mode.vsync_end - new_mode.vsync_start)) | |
| 9083 | + return true; | |
| 9084 | + | |
| 9085 | + return false; | |
| 9086 | +} | |
| 9087 | + | |
| 9088 | +static void set_freesync_fixed_config(struct dm_crtc_state *dm_new_crtc_state) { | |
| 9089 | + uint64_t num, den, res; | |
| 9090 | + struct drm_crtc_state *new_crtc_state = &dm_new_crtc_state->base; | |
| 9091 | + | |
| 9092 | + dm_new_crtc_state->freesync_config.state = VRR_STATE_ACTIVE_FIXED; | |
| 9093 | + | |
| 9094 | + num = (unsigned long long)new_crtc_state->mode.clock * 1000 * 1000000; | |
| 9095 | + den = (unsigned long long)new_crtc_state->mode.htotal * | |
| 9096 | + (unsigned long long)new_crtc_state->mode.vtotal; | |
| 9097 | + | |
| 9098 | + res = div_u64(num, den); | |
| 9099 | + dm_new_crtc_state->freesync_config.fixed_refresh_in_uhz = res; | |
| 9100 | +} | |
| 9101 | + | |
| 8695 | 9102 | static int dm_update_crtc_state(struct amdgpu_display_manager *dm, |
| 8696 | 9103 | struct drm_atomic_state *state, |
| 8697 | 9104 | struct drm_crtc *crtc, |
| @@ -8782,6 +9189,11 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, · 84 unmodified lines | ||
| 8782 | 9189 | * TODO: Refactor this function to allow this check to work |
| 8783 | 9190 | * in all conditions. |
| 8784 | 9191 | */ |
| 9192 | + if (amdgpu_freesync_vid_mode && | |
| 9193 | + dm_new_crtc_state->stream && | |
| 9194 | + is_timing_unchanged_for_freesync(new_crtc_state, old_crtc_state)) | |
| 9195 | + goto skip_modeset; | |
| 9196 | + | |
| 8785 | 9197 | if (dm_new_crtc_state->stream && |
| 8786 | 9198 | dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) && |
| 8787 | 9199 | dc_is_stream_scaling_unchanged(new_stream, dm_old_crtc_state->stream)) { |
| @@ -8813,6 +9225,24 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, · 25 unmodified lines | ||
| 8813 | 9225 | if (!dm_old_crtc_state->stream) |
| 8814 | 9226 | goto skip_modeset; |
| 8815 | 9227 | |
| 9228 | + if (amdgpu_freesync_vid_mode && dm_new_crtc_state->stream && | |
| 9229 | + is_timing_unchanged_for_freesync(new_crtc_state, | |
| 9230 | + old_crtc_state)) { | |
| 9231 | + new_crtc_state->mode_changed = false; | |
| 9232 | + DRM_DEBUG_DRIVER( | |
| 9233 | + "Mode change not required for front porch change, " | |
| 9234 | + "setting mode_changed to %d", | |
| 9235 | + new_crtc_state->mode_changed); | |
| 9236 | + | |
| 9237 | + set_freesync_fixed_config(dm_new_crtc_state); | |
| 9238 | + | |
| 9239 | + goto skip_modeset; | |
| 9240 | + } else if (amdgpu_freesync_vid_mode && aconnector && | |
| 9241 | + is_freesync_video_mode(&new_crtc_state->mode, | |
| 9242 | + aconnector)) { | |
| 9243 | + set_freesync_fixed_config(dm_new_crtc_state); | |
| 9244 | + } | |
| 9245 | + | |
| 8816 | 9246 | ret = dm_atomic_get_state(state, &dm_state); |
| 8817 | 9247 | if (ret) |
| 8818 | 9248 | goto fail; |
| @@ -9390,7 +9820,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, · 571 unmodified lines | ||
| 9390 | 9820 | } |
| 9391 | 9821 | |
| 9392 | 9822 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 9393 | − if (adev->asic_type >= CHIP_NAVI10) { | |
| 9823 | + if (dc_resource_is_dsc_encoding_supported(dc)) { | |
| 9394 | 9824 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { |
| 9395 | 9825 | if (drm_atomic_crtc_needs_modeset(new_crtc_state)) { |
| 9396 | 9826 | ret = add_affected_mst_dsc_crtcs(state, crtc); |
| @@ -9696,11 +10126,85 @@ static bool is_dp_capable_without_timing_msa(struct dc *dc, · 299 unmodified lines | ||
| 9696 | 10126 | |
| 9697 | 10127 | return capable; |
| 9698 | 10128 | } |
| 10129 | + | |
| 10130 | +static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector, | |
| 10131 | + uint8_t *edid_ext, int len, | |
| 10132 | + struct amdgpu_hdmi_vsdb_info *vsdb_info) | |
| 10133 | +{ | |
| 10134 | + int i; | |
| 10135 | + struct amdgpu_device *adev = drm_to_adev(aconnector->base.dev); | |
| 10136 | + struct dc *dc = adev->dm.dc; | |
| 10137 | + | |
| 10138 | + /* send extension block to DMCU for parsing */ | |
| 10139 | + for (i = 0; i < len; i += 8) { | |
| 10140 | + bool res; | |
| 10141 | + int offset; | |
| 10142 | + | |
| 10143 | + /* send 8 bytes a time */ | |
| 10144 | + if (!dc_edid_parser_send_cea(dc, i, len, &edid_ext[i], 8)) | |
| 10145 | + return false; | |
| 10146 | + | |
| 10147 | + if (i+8 == len) { | |
| 10148 | + /* EDID block sent completed, expect result */ | |
| 10149 | + int version, min_rate, max_rate; | |
| 10150 | + | |
| 10151 | + res = dc_edid_parser_recv_amd_vsdb(dc, &version, &min_rate, &max_rate); | |
| 10152 | + if (res) { | |
| 10153 | + /* amd vsdb found */ | |
| 10154 | + vsdb_info->freesync_supported = 1; | |
| 10155 | + vsdb_info->amd_vsdb_version = version; | |
| 10156 | + vsdb_info->min_refresh_rate_hz = min_rate; | |
| 10157 | + vsdb_info->max_refresh_rate_hz = max_rate; | |
| 10158 | + return true; | |
| 10159 | + } | |
| 10160 | + /* not amd vsdb */ | |
| 10161 | + return false; | |
| 10162 | + } | |
| 10163 | + | |
| 10164 | + /* check for ack*/ | |
| 10165 | + res = dc_edid_parser_recv_cea_ack(dc, &offset); | |
| 10166 | + if (!res) | |
| 10167 | + return false; | |
| 10168 | + } | |
| 10169 | + | |
| 10170 | + return false; | |
| 10171 | +} | |
| 10172 | + | |
| 10173 | +static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector, | |
| 10174 | + struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info) | |
| 10175 | +{ | |
| 10176 | + uint8_t *edid_ext = NULL; | |
| 10177 | + int i; | |
| 10178 | + bool valid_vsdb_found = false; | |
| 10179 | + | |
| 10180 | + /*----- drm_find_cea_extension() -----*/ | |
| 10181 | + /* No EDID or EDID extensions */ | |
| 10182 | + if (edid == NULL || edid->extensions == 0) | |
| 10183 | + return -ENODEV; | |
| 10184 | + | |
| 10185 | + /* Find CEA extension */ | |
| 10186 | + for (i = 0; i < edid->extensions; i++) { | |
| 10187 | + edid_ext = (uint8_t *)edid + EDID_LENGTH * (i + 1); | |
| 10188 | + if (edid_ext[0] == CEA_EXT) | |
| 10189 | + break; | |
| 10190 | + } | |
| 10191 | + | |
| 10192 | + if (i == edid->extensions) | |
| 10193 | + return -ENODEV; | |
| 10194 | + | |
| 10195 | + /*----- cea_db_offsets() -----*/ | |
| 10196 | + if (edid_ext[0] != CEA_EXT) | |
| 10197 | + return -ENODEV; | |
| 10198 | + | |
| 10199 | + valid_vsdb_found = parse_edid_cea(aconnector, edid_ext, EDID_LENGTH, vsdb_info); | |
| 10200 | + | |
| 10201 | + return valid_vsdb_found ? i : -ENODEV; | |
| 10202 | +} | |
| 10203 | + | |
| 9699 | 10204 | void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, |
| 9700 | 10205 | struct edid *edid) |
| 9701 | 10206 | { |
| 9702 | − int i; | |
| 9703 | − bool edid_check_required; | |
| 10207 | + int i = 0; | |
| 9704 | 10208 | struct detailed_timing *timing; |
| 9705 | 10209 | struct detailed_non_pixel *data; |
| 9706 | 10210 | struct detailed_data_monitor_range *range; |
| @@ -9711,6 +10215,7 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, · 4 unmodified lines | ||
| 9711 | 10215 | struct drm_device *dev = connector->dev; |
| 9712 | 10216 | struct amdgpu_device *adev = drm_to_adev(dev); |
| 9713 | 10217 | bool freesync_capable = false; |
| 10218 | + struct amdgpu_hdmi_vsdb_info vsdb_info = {0}; | |
| 9714 | 10219 | |
| 9715 | 10220 | if (!connector->state) { |
| 9716 | 10221 | DRM_ERROR("%s - Connector has no state", __func__); |
| @@ -9729,60 +10234,75 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, · 12 unmodified lines | ||
| 9729 | 10234 | |
| 9730 | 10235 | dm_con_state = to_dm_connector_state(connector->state); |
| 9731 | 10236 | |
| 9732 | − edid_check_required = false; | |
| 9733 | 10237 | if (!amdgpu_dm_connector->dc_sink) { |
| 9734 | 10238 | DRM_ERROR("dc_sink NULL, could not add free_sync module.\n"); |
| 9735 | 10239 | goto update; |
| 9736 | 10240 | } |
| 9737 | 10241 | if (!adev->dm.freesync_module) |
| 9738 | 10242 | goto update; |
| 9739 | − /* | |
| 9740 | − * if edid non zero restrict freesync only for dp and edp | |
| 9741 | − */ | |
| 9742 | − if (edid) { | |
| 9743 | − if (amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT | |
| 9744 | − || amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_EDP) { | |
| 10243 | + | |
| 10244 | + | |
| 10245 | + if (amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT | |
| 10246 | + || amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_EDP) { | |
| 10247 | + bool edid_check_required = false; | |
| 10248 | + | |
| 10249 | + if (edid) { | |
| 9745 | 10250 | edid_check_required = is_dp_capable_without_timing_msa( |
| 9746 | 10251 | adev->dm.dc, |
| 9747 | 10252 | amdgpu_dm_connector); |
| 9748 | 10253 | } |
| 9749 | − } | |
| 9750 | − if (edid_check_required == true && (edid->version > 1 || | |
| 9751 | − (edid->version == 1 && edid->revision > 1))) { | |
| 9752 | − for (i = 0; i < 4; i++) { | |
| 9753 | 10254 | |
| 9754 | − timing = &edid->detailed_timings[i]; | |
| 9755 | − data = &timing->data.other_data; | |
| 9756 | − range = &data->data.range; | |
| 9757 | − /* | |
| 9758 | − * Check if monitor has continuous frequency mode | |
| 9759 | − */ | |
| 9760 | − if (data->type != EDID_DETAIL_MONITOR_RANGE) | |
| 9761 | − continue; | |
| 9762 | − /* | |
| 9763 | − * Check for flag range limits only. If flag == 1 then | |
| 9764 | − * no additional timing information provided. | |
| 9765 | − * Default GTF, GTF Secondary curve and CVT are not | |
| 9766 | − * supported | |
| 9767 | − */ | |
| 9768 | − if (range->flags != 1) | |
| 9769 | − continue; | |
| 10255 | + if (edid_check_required == true && (edid->version > 1 || | |
| 10256 | + (edid->version == 1 && edid->revision > 1))) { | |
| 10257 | + for (i = 0; i < 4; i++) { | |
| 9770 | 10258 | |
| 9771 | − amdgpu_dm_connector->min_vfreq = range->min_vfreq; | |
| 9772 | − amdgpu_dm_connector->max_vfreq = range->max_vfreq; | |
| 9773 | − amdgpu_dm_connector->pixel_clock_mhz = | |
| 9774 | − range->pixel_clock_mhz * 10; | |
| 10259 | + timing = &edid->detailed_timings[i]; | |
| 10260 | + data = &timing->data.other_data; | |
| 10261 | + range = &data->data.range; | |
| 10262 | + /* | |
| 10263 | + * Check if monitor has continuous frequency mode | |
| 10264 | + */ | |
| 10265 | + if (data->type != EDID_DETAIL_MONITOR_RANGE) | |
| 10266 | + continue; | |
| 10267 | + /* | |
| 10268 | + * Check for flag range limits only. If flag == 1 then | |
| 10269 | + * no additional timing information provided. | |
| 10270 | + * Default GTF, GTF Secondary curve and CVT are not | |
| 10271 | + * supported | |
| 10272 | + */ | |
| 10273 | + if (range->flags != 1) | |
| 10274 | + continue; | |
| 9775 | 10275 | |
| 9776 | − connector->display_info.monitor_range.min_vfreq = range->min_vfreq; | |
| 9777 | − connector->display_info.monitor_range.max_vfreq = range->max_vfreq; | |
| 10276 | + amdgpu_dm_connector->min_vfreq = range->min_vfreq; | |
| 10277 | + amdgpu_dm_connector->max_vfreq = range->max_vfreq; | |
| 10278 | + amdgpu_dm_connector->pixel_clock_mhz = | |
| 10279 | + range->pixel_clock_mhz * 10; | |
| 9778 | 10280 | |
| 9779 | − break; | |
| 9780 | − } | |
| 10281 | + connector->display_info.monitor_range.min_vfreq = range->min_vfreq; | |
| 10282 | + connector->display_info.monitor_range.max_vfreq = range->max_vfreq; | |
| 9781 | 10283 | |
| 9782 | − if (amdgpu_dm_connector->max_vfreq - | |
| 9783 | − amdgpu_dm_connector->min_vfreq > 10) { | |
| 10284 | + break; | |
| 10285 | + } | |
| 9784 | 10286 | |
| 9785 | − freesync_capable = true; | |
| 10287 | + if (amdgpu_dm_connector->max_vfreq - | |
| 10288 | + amdgpu_dm_connector->min_vfreq > 10) { | |
| 10289 | + | |
| 10290 | + freesync_capable = true; | |
| 10291 | + } | |
| 10292 | + } | |
| 10293 | + } else if (edid && amdgpu_dm_connector->dc_sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A) { | |
| 10294 | + i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, &vsdb_info); | |
| 10295 | + if (i >= 0 && vsdb_info.freesync_supported) { | |
| 10296 | + timing = &edid->detailed_timings[i]; | |
| 10297 | + data = &timing->data.other_data; | |
| 10298 | + | |
| 10299 | + amdgpu_dm_connector->min_vfreq = vsdb_info.min_refresh_rate_hz; | |
| 10300 | + amdgpu_dm_connector->max_vfreq = vsdb_info.max_refresh_rate_hz; | |
| 10301 | + if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10) | |
| 10302 | + freesync_capable = true; | |
| 10303 | + | |
| 10304 | + connector->display_info.monitor_range.min_vfreq = vsdb_info.min_refresh_rate_hz; | |
| 10305 | + connector->display_info.monitor_range.max_vfreq = vsdb_info.max_refresh_rate_hz; | |
| 9786 | 10306 | } |
| 9787 | 10307 | } |
| 9788 | 10308 | |
| @@ -68,18 +68,6 @@ struct common_irq_params { · 67 unmodified lines | ||
| 68 | 68 | enum dc_irq_source irq_src; |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | −/** | |
| 72 | − * struct irq_list_head - Linked-list for low context IRQ handlers. | |
| 73 | − * | |
| 74 | − * @head: The list_head within &struct handler_data | |
| 75 | − * @work: A work_struct containing the deferred handler work | |
| 76 | − */ | |
| 77 | −struct irq_list_head { | |
| 78 | − struct list_head head; | |
| 79 | − /* In case this interrupt needs post-processing, 'work' will be queued*/ | |
| 80 | − struct work_struct work; | |
| 81 | −}; | |
| 82 | − | |
| 83 | 71 | /** |
| 84 | 72 | * struct dm_compressor_info - Buffer info used by frame buffer compression |
| 85 | 73 | * @cpu_addr: MMIO cpu addr |
| @@ -144,6 +132,16 @@ struct amdgpu_dm_backlight_caps { · 58 unmodified lines | ||
| 144 | 132 | bool aux_support; |
| 145 | 133 | }; |
| 146 | 134 | |
| 135 | +/** | |
| 136 | + * struct dal_allocation - Tracks mapped FB memory for SMU communication | |
| 137 | + */ | |
| 138 | +struct dal_allocation { | |
| 139 | + struct list_head list; | |
| 140 | + struct amdgpu_bo *bo; | |
| 141 | + void *cpu_ptr; | |
| 142 | + u64 gpu_addr; | |
| 143 | +}; | |
| 144 | + | |
| 147 | 145 | /** |
| 148 | 146 | * struct amdgpu_display_manager - Central amdgpu display manager device |
| 149 | 147 | * |
| @@ -257,12 +255,12 @@ struct amdgpu_display_manager { · 107 unmodified lines | ||
| 257 | 255 | */ |
| 258 | 256 | struct mutex audio_lock; |
| 259 | 257 | |
| 258 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 260 | 259 | /** |
| 261 | − * @vblank_work_lock: | |
| 260 | + * @vblank_lock: | |
| 262 | 261 | * |
| 263 | 262 | * Guards access to deferred vblank work state. |
| 264 | 263 | */ |
| 265 | −#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 266 | 264 | spinlock_t vblank_lock; |
| 267 | 265 | #endif |
| 268 | 266 | |
| @@ -293,7 +291,7 @@ struct amdgpu_display_manager { · 24 unmodified lines | ||
| 293 | 291 | * Note that handlers are called in the same order as they were |
| 294 | 292 | * registered (FIFO). |
| 295 | 293 | */ |
| 296 | − struct irq_list_head irq_handler_list_low_tab[DAL_IRQ_SOURCES_NUMBER]; | |
| 294 | + struct list_head irq_handler_list_low_tab[DAL_IRQ_SOURCES_NUMBER]; | |
| 297 | 295 | |
| 298 | 296 | /** |
| 299 | 297 | * @irq_handler_list_high_tab: |
| @@ -323,6 +321,15 @@ struct amdgpu_display_manager { · 23 unmodified lines | ||
| 323 | 321 | struct common_irq_params |
| 324 | 322 | vblank_params[DC_IRQ_SOURCE_VBLANK6 - DC_IRQ_SOURCE_VBLANK1 + 1]; |
| 325 | 323 | |
| 324 | + /** | |
| 325 | + * @vline0_params: | |
| 326 | + * | |
| 327 | + * OTG vertical interrupt0 IRQ parameters, passed to registered | |
| 328 | + * handlers when triggered. | |
| 329 | + */ | |
| 330 | + struct common_irq_params | |
| 331 | + vline0_params[DC_IRQ_SOURCE_DC6_VLINE0 - DC_IRQ_SOURCE_DC1_VLINE0 + 1]; | |
| 332 | + | |
| 326 | 333 | /** |
| 327 | 334 | * @vupdate_params: |
| 328 | 335 | * |
| @@ -345,6 +352,11 @@ struct amdgpu_display_manager { · 16 unmodified lines | ||
| 345 | 352 | #endif |
| 346 | 353 | |
| 347 | 354 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 355 | + /** | |
| 356 | + * @vblank_workqueue: | |
| 357 | + * | |
| 358 | + * amdgpu workqueue during vblank | |
| 359 | + */ | |
| 348 | 360 | struct vblank_workqueue *vblank_workqueue; |
| 349 | 361 | #endif |
| 350 | 362 | |
| @@ -363,12 +375,18 @@ struct amdgpu_display_manager { · 12 unmodified lines | ||
| 363 | 375 | */ |
| 364 | 376 | const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; |
| 365 | 377 | |
| 378 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 366 | 379 | /** |
| 367 | 380 | * @active_vblank_irq_count: |
| 368 | 381 | * |
| 369 | 382 | * number of currently active vblank irqs |
| 370 | 383 | */ |
| 371 | 384 | uint32_t active_vblank_irq_count; |
| 385 | +#endif | |
| 386 | + | |
| 387 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 388 | + struct crc_rd_work *crc_rd_wrk; | |
| 389 | +#endif | |
| 372 | 390 | |
| 373 | 391 | /** |
| 374 | 392 | * @mst_encoders: |
| @@ -377,6 +395,13 @@ struct amdgpu_display_manager { · 2 unmodified lines | ||
| 377 | 395 | */ |
| 378 | 396 | struct amdgpu_encoder mst_encoders[AMDGPU_DM_MAX_CRTC]; |
| 379 | 397 | bool force_timing_sync; |
| 398 | + bool dmcub_trace_event_en; | |
| 399 | + /** | |
| 400 | + * @da_list: | |
| 401 | + * | |
| 402 | + * DAL fb memory allocation list, for communication with SMU. | |
| 403 | + */ | |
| 404 | + struct list_head da_list; | |
| 380 | 405 | }; |
| 381 | 406 | |
| 382 | 407 | enum dsc_clock_force_state { |
| @@ -440,6 +465,8 @@ struct amdgpu_dm_connector { · 57 unmodified lines | ||
| 440 | 465 | #endif |
| 441 | 466 | bool force_yuv420_output; |
| 442 | 467 | struct dsc_preferred_settings dsc_settings; |
| 468 | + /* Cached display modes */ | |
| 469 | + struct drm_display_mode freesync_vid_base; | |
| 443 | 470 | }; |
| 444 | 471 | |
| 445 | 472 | #define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base) |
| @@ -462,7 +489,6 @@ struct dm_crtc_state { · 16 unmodified lines | ||
| 462 | 489 | int active_planes; |
| 463 | 490 | |
| 464 | 491 | int crc_skip_count; |
| 465 | − enum amdgpu_dm_pipe_crc_source crc_src; | |
| 466 | 492 | |
| 467 | 493 | bool freesync_timing_changed; |
| 468 | 494 | bool freesync_vrr_info_changed; |
| @@ -501,6 +527,14 @@ struct dm_connector_state { · 32 unmodified lines | ||
| 501 | 527 | uint64_t pbn; |
| 502 | 528 | }; |
| 503 | 529 | |
| 530 | +struct amdgpu_hdmi_vsdb_info { | |
| 531 | + unsigned int amd_vsdb_version; /* VSDB version, should be used to determine which VSIF to send */ | |
| 532 | + bool freesync_supported; /* FreeSync Supported */ | |
| 533 | + unsigned int min_refresh_rate_hz; /* FreeSync Minimum Refresh Rate in Hz */ | |
| 534 | + unsigned int max_refresh_rate_hz; /* FreeSync Maximum Refresh Rate in Hz */ | |
| 535 | +}; | |
| 536 | + | |
| 537 | + | |
| 504 | 538 | #define to_dm_connector_state(x)\ |
| 505 | 539 | container_of((x), struct dm_connector_state, base) |
| 506 | 540 | |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "amdgpu.h" |
| 30 | 30 | #include "amdgpu_dm.h" |
| 31 | 31 | #include "dc.h" |
| 32 | +#include "amdgpu_securedisplay.h" | |
| 32 | 33 | |
| 33 | 34 | static const char *const pipe_crc_sources[] = { |
| 34 | 35 | "none", |
| @@ -81,6 +82,73 @@ const char *const *amdgpu_dm_crtc_get_crc_sources(struct drm_crtc *crtc, · 46 unmodified lines | ||
| 81 | 82 | return pipe_crc_sources; |
| 82 | 83 | } |
| 83 | 84 | |
| 85 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 86 | +static void amdgpu_dm_set_crc_window_default(struct drm_crtc *crtc) | |
| 87 | +{ | |
| 88 | + struct drm_device *drm_dev = crtc->dev; | |
| 89 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 90 | + | |
| 91 | + spin_lock_irq(&drm_dev->event_lock); | |
| 92 | + acrtc->dm_irq_params.crc_window.x_start = 0; | |
| 93 | + acrtc->dm_irq_params.crc_window.y_start = 0; | |
| 94 | + acrtc->dm_irq_params.crc_window.x_end = 0; | |
| 95 | + acrtc->dm_irq_params.crc_window.y_end = 0; | |
| 96 | + acrtc->dm_irq_params.crc_window.activated = false; | |
| 97 | + acrtc->dm_irq_params.crc_window.update_win = false; | |
| 98 | + acrtc->dm_irq_params.crc_window.skip_frame_cnt = 0; | |
| 99 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 100 | +} | |
| 101 | + | |
| 102 | +static void amdgpu_dm_crtc_notify_ta_to_read(struct work_struct *work) | |
| 103 | +{ | |
| 104 | + struct crc_rd_work *crc_rd_wrk; | |
| 105 | + struct amdgpu_device *adev; | |
| 106 | + struct psp_context *psp; | |
| 107 | + struct securedisplay_cmd *securedisplay_cmd; | |
| 108 | + struct drm_crtc *crtc; | |
| 109 | + uint8_t phy_id; | |
| 110 | + int ret; | |
| 111 | + | |
| 112 | + crc_rd_wrk = container_of(work, struct crc_rd_work, notify_ta_work); | |
| 113 | + spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock); | |
| 114 | + crtc = crc_rd_wrk->crtc; | |
| 115 | + | |
| 116 | + if (!crtc) { | |
| 117 | + spin_unlock_irq(&crc_rd_wrk->crc_rd_work_lock); | |
| 118 | + return; | |
| 119 | + } | |
| 120 | + | |
| 121 | + adev = drm_to_adev(crtc->dev); | |
| 122 | + psp = &adev->psp; | |
| 123 | + phy_id = crc_rd_wrk->phy_inst; | |
| 124 | + spin_unlock_irq(&crc_rd_wrk->crc_rd_work_lock); | |
| 125 | + | |
| 126 | + psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, | |
| 127 | + TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); | |
| 128 | + securedisplay_cmd->securedisplay_in_message.send_roi_crc.phy_id = | |
| 129 | + phy_id; | |
| 130 | + ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); | |
| 131 | + if (!ret) { | |
| 132 | + if (securedisplay_cmd->status != TA_SECUREDISPLAY_STATUS__SUCCESS) { | |
| 133 | + psp_securedisplay_parse_resp_status(psp, securedisplay_cmd->status); | |
| 134 | + } | |
| 135 | + } | |
| 136 | +} | |
| 137 | + | |
| 138 | +bool amdgpu_dm_crc_window_is_activated(struct drm_crtc *crtc) | |
| 139 | +{ | |
| 140 | + struct drm_device *drm_dev = crtc->dev; | |
| 141 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 142 | + bool ret = false; | |
| 143 | + | |
| 144 | + spin_lock_irq(&drm_dev->event_lock); | |
| 145 | + ret = acrtc->dm_irq_params.crc_window.activated; | |
| 146 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 147 | + | |
| 148 | + return ret; | |
| 149 | +} | |
| 150 | +#endif | |
| 151 | + | |
| 84 | 152 | int |
| 85 | 153 | amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, const char *src_name, |
| 86 | 154 | size_t *values_cnt) |
| @@ -114,6 +182,20 @@ int amdgpu_dm_crtc_configure_crc_source(struct drm_crtc *crtc, · 27 unmodified lines | ||
| 114 | 182 | |
| 115 | 183 | /* Enable CRTC CRC generation if necessary. */ |
| 116 | 184 | if (dm_is_crc_source_crtc(source) || source == AMDGPU_DM_PIPE_CRC_SOURCE_NONE) { |
| 185 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 186 | + if (!enable) { | |
| 187 | + if (adev->dm.crc_rd_wrk) { | |
| 188 | + flush_work(&adev->dm.crc_rd_wrk->notify_ta_work); | |
| 189 | + spin_lock_irq(&adev->dm.crc_rd_wrk->crc_rd_work_lock); | |
| 190 | + if (adev->dm.crc_rd_wrk->crtc == crtc) { | |
| 191 | + dc_stream_stop_dmcu_crc_win_update(stream_state->ctx->dc, | |
| 192 | + dm_crtc_state->stream); | |
| 193 | + adev->dm.crc_rd_wrk->crtc = NULL; | |
| 194 | + } | |
| 195 | + spin_unlock_irq(&adev->dm.crc_rd_wrk->crc_rd_work_lock); | |
| 196 | + } | |
| 197 | + } | |
| 198 | +#endif | |
| 117 | 199 | if (!dc_stream_configure_crc(stream_state->ctx->dc, |
| 118 | 200 | stream_state, NULL, enable, enable)) { |
| 119 | 201 | ret = -EINVAL; |
| @@ -142,8 +224,11 @@ unlock: · 22 unmodified lines | ||
| 142 | 224 | int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) |
| 143 | 225 | { |
| 144 | 226 | enum amdgpu_dm_pipe_crc_source source = dm_parse_crc_source(src_name); |
| 227 | + enum amdgpu_dm_pipe_crc_source cur_crc_src; | |
| 145 | 228 | struct drm_crtc_commit *commit; |
| 146 | 229 | struct dm_crtc_state *crtc_state; |
| 230 | + struct drm_device *drm_dev = crtc->dev; | |
| 231 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 147 | 232 | struct drm_dp_aux *aux = NULL; |
| 148 | 233 | bool enable = false; |
| 149 | 234 | bool enabled = false; |
| @@ -182,6 +267,9 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) · 32 unmodified lines | ||
| 182 | 267 | |
| 183 | 268 | enable = amdgpu_dm_is_valid_crc_source(source); |
| 184 | 269 | crtc_state = to_dm_crtc_state(crtc->state); |
| 270 | + spin_lock_irq(&drm_dev->event_lock); | |
| 271 | + cur_crc_src = acrtc->dm_irq_params.crc_src; | |
| 272 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 185 | 273 | |
| 186 | 274 | /* |
| 187 | 275 | * USER REQ SRC | CURRENT SRC | BEHAVIOR |
| @@ -198,7 +286,7 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) · 10 unmodified lines | ||
| 198 | 286 | */ |
| 199 | 287 | if (dm_is_crc_source_dprx(source) || |
| 200 | 288 | (source == AMDGPU_DM_PIPE_CRC_SOURCE_NONE && |
| 201 | − dm_is_crc_source_dprx(crtc_state->crc_src))) { | |
| 289 | + dm_is_crc_source_dprx(cur_crc_src))) { | |
| 202 | 290 | struct amdgpu_dm_connector *aconn = NULL; |
| 203 | 291 | struct drm_connector *connector; |
| 204 | 292 | struct drm_connector_list_iter conn_iter; |
| @@ -228,6 +316,10 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) · 23 unmodified lines | ||
| 228 | 316 | } |
| 229 | 317 | } |
| 230 | 318 | |
| 319 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 320 | + amdgpu_dm_set_crc_window_default(crtc); | |
| 321 | +#endif | |
| 322 | + | |
| 231 | 323 | if (amdgpu_dm_crtc_configure_crc_source(crtc, crtc_state, source)) { |
| 232 | 324 | ret = -EINVAL; |
| 233 | 325 | goto cleanup; |
| @@ -237,7 +329,7 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) · 3 unmodified lines | ||
| 237 | 329 | * Reading the CRC requires the vblank interrupt handler to be |
| 238 | 330 | * enabled. Keep a reference until CRC capture stops. |
| 239 | 331 | */ |
| 240 | − enabled = amdgpu_dm_is_valid_crc_source(crtc_state->crc_src); | |
| 332 | + enabled = amdgpu_dm_is_valid_crc_source(cur_crc_src); | |
| 241 | 333 | if (!enabled && enable) { |
| 242 | 334 | ret = drm_crtc_vblank_get(crtc); |
| 243 | 335 | if (ret) |
| @@ -261,7 +353,9 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) · 17 unmodified lines | ||
| 261 | 353 | } |
| 262 | 354 | } |
| 263 | 355 | |
| 264 | − crtc_state->crc_src = source; | |
| 356 | + spin_lock_irq(&drm_dev->event_lock); | |
| 357 | + acrtc->dm_irq_params.crc_src = source; | |
| 358 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 265 | 359 | |
| 266 | 360 | /* Reset crc_skipped on dm state */ |
| 267 | 361 | crtc_state->crc_skip_count = 0; |
| @@ -286,16 +380,26 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc) · 18 unmodified lines | ||
| 286 | 380 | { |
| 287 | 381 | struct dm_crtc_state *crtc_state; |
| 288 | 382 | struct dc_stream_state *stream_state; |
| 383 | + struct drm_device *drm_dev = NULL; | |
| 384 | + enum amdgpu_dm_pipe_crc_source cur_crc_src; | |
| 385 | + struct amdgpu_crtc *acrtc = NULL; | |
| 289 | 386 | uint32_t crcs[3]; |
| 387 | + unsigned long flags; | |
| 290 | 388 | |
| 291 | 389 | if (crtc == NULL) |
| 292 | 390 | return; |
| 293 | 391 | |
| 294 | 392 | crtc_state = to_dm_crtc_state(crtc->state); |
| 295 | 393 | stream_state = crtc_state->stream; |
| 394 | + acrtc = to_amdgpu_crtc(crtc); | |
| 395 | + drm_dev = crtc->dev; | |
| 396 | + | |
| 397 | + spin_lock_irqsave(&drm_dev->event_lock, flags); | |
| 398 | + cur_crc_src = acrtc->dm_irq_params.crc_src; | |
| 399 | + spin_unlock_irqrestore(&drm_dev->event_lock, flags); | |
| 296 | 400 | |
| 297 | 401 | /* Early return if CRC capture is not enabled. */ |
| 298 | − if (!amdgpu_dm_is_valid_crc_source(crtc_state->crc_src)) | |
| 402 | + if (!amdgpu_dm_is_valid_crc_source(cur_crc_src)) | |
| 299 | 403 | return; |
| 300 | 404 | |
| 301 | 405 | /* |
| @@ -309,7 +413,7 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc) · 7 unmodified lines | ||
| 309 | 413 | return; |
| 310 | 414 | } |
| 311 | 415 | |
| 312 | − if (dm_is_crc_source_crtc(crtc_state->crc_src)) { | |
| 416 | + if (dm_is_crc_source_crtc(cur_crc_src)) { | |
| 313 | 417 | if (!dc_stream_get_crc(stream_state->ctx->dc, stream_state, |
| 314 | 418 | &crcs[0], &crcs[1], &crcs[2])) |
| 315 | 419 | return; |
| @@ -318,3 +422,182 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc) · 2 unmodified lines | ||
| 318 | 422 | drm_crtc_accurate_vblank_count(crtc), crcs); |
| 319 | 423 | } |
| 320 | 424 | } |
| 425 | + | |
| 426 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 427 | +void amdgpu_dm_crtc_handle_crc_window_irq(struct drm_crtc *crtc) | |
| 428 | +{ | |
| 429 | + struct dc_stream_state *stream_state; | |
| 430 | + struct drm_device *drm_dev = NULL; | |
| 431 | + enum amdgpu_dm_pipe_crc_source cur_crc_src; | |
| 432 | + struct amdgpu_crtc *acrtc = NULL; | |
| 433 | + struct amdgpu_device *adev = NULL; | |
| 434 | + struct crc_rd_work *crc_rd_wrk = NULL; | |
| 435 | + struct crc_params *crc_window = NULL, tmp_window; | |
| 436 | + unsigned long flags1, flags2; | |
| 437 | + struct crtc_position position; | |
| 438 | + uint32_t v_blank; | |
| 439 | + uint32_t v_back_porch; | |
| 440 | + uint32_t crc_window_latch_up_line; | |
| 441 | + struct dc_crtc_timing *timing_out; | |
| 442 | + | |
| 443 | + if (crtc == NULL) | |
| 444 | + return; | |
| 445 | + | |
| 446 | + acrtc = to_amdgpu_crtc(crtc); | |
| 447 | + adev = drm_to_adev(crtc->dev); | |
| 448 | + drm_dev = crtc->dev; | |
| 449 | + | |
| 450 | + spin_lock_irqsave(&drm_dev->event_lock, flags1); | |
| 451 | + stream_state = acrtc->dm_irq_params.stream; | |
| 452 | + cur_crc_src = acrtc->dm_irq_params.crc_src; | |
| 453 | + timing_out = &stream_state->timing; | |
| 454 | + | |
| 455 | + /* Early return if CRC capture is not enabled. */ | |
| 456 | + if (!amdgpu_dm_is_valid_crc_source(cur_crc_src)) | |
| 457 | + goto cleanup; | |
| 458 | + | |
| 459 | + if (dm_is_crc_source_crtc(cur_crc_src)) { | |
| 460 | + if (acrtc->dm_irq_params.crc_window.activated) { | |
| 461 | + if (acrtc->dm_irq_params.crc_window.update_win) { | |
| 462 | + if (acrtc->dm_irq_params.crc_window.skip_frame_cnt) { | |
| 463 | + acrtc->dm_irq_params.crc_window.skip_frame_cnt -= 1; | |
| 464 | + goto cleanup; | |
| 465 | + } | |
| 466 | + crc_window = &tmp_window; | |
| 467 | + | |
| 468 | + tmp_window.windowa_x_start = | |
| 469 | + acrtc->dm_irq_params.crc_window.x_start; | |
| 470 | + tmp_window.windowa_y_start = | |
| 471 | + acrtc->dm_irq_params.crc_window.y_start; | |
| 472 | + tmp_window.windowa_x_end = | |
| 473 | + acrtc->dm_irq_params.crc_window.x_end; | |
| 474 | + tmp_window.windowa_y_end = | |
| 475 | + acrtc->dm_irq_params.crc_window.y_end; | |
| 476 | + tmp_window.windowb_x_start = | |
| 477 | + acrtc->dm_irq_params.crc_window.x_start; | |
| 478 | + tmp_window.windowb_y_start = | |
| 479 | + acrtc->dm_irq_params.crc_window.y_start; | |
| 480 | + tmp_window.windowb_x_end = | |
| 481 | + acrtc->dm_irq_params.crc_window.x_end; | |
| 482 | + tmp_window.windowb_y_end = | |
| 483 | + acrtc->dm_irq_params.crc_window.y_end; | |
| 484 | + | |
| 485 | + dc_stream_forward_dmcu_crc_window(stream_state->ctx->dc, | |
| 486 | + stream_state, crc_window); | |
| 487 | + | |
| 488 | + acrtc->dm_irq_params.crc_window.update_win = false; | |
| 489 | + | |
| 490 | + dc_stream_get_crtc_position(stream_state->ctx->dc, &stream_state, 1, | |
| 491 | + &position.vertical_count, | |
| 492 | + &position.nominal_vcount); | |
| 493 | + | |
| 494 | + v_blank = timing_out->v_total - timing_out->v_border_top - | |
| 495 | + timing_out->v_addressable - timing_out->v_border_bottom; | |
| 496 | + | |
| 497 | + v_back_porch = v_blank - timing_out->v_front_porch - | |
| 498 | + timing_out->v_sync_width; | |
| 499 | + | |
| 500 | + crc_window_latch_up_line = v_back_porch + timing_out->v_sync_width; | |
| 501 | + | |
| 502 | + /* take 3 lines margin*/ | |
| 503 | + if ((position.vertical_count + 3) >= crc_window_latch_up_line) | |
| 504 | + acrtc->dm_irq_params.crc_window.skip_frame_cnt = 1; | |
| 505 | + else | |
| 506 | + acrtc->dm_irq_params.crc_window.skip_frame_cnt = 0; | |
| 507 | + } else { | |
| 508 | + if (acrtc->dm_irq_params.crc_window.skip_frame_cnt == 0) { | |
| 509 | + if (adev->dm.crc_rd_wrk) { | |
| 510 | + crc_rd_wrk = adev->dm.crc_rd_wrk; | |
| 511 | + spin_lock_irqsave(&crc_rd_wrk->crc_rd_work_lock, flags2); | |
| 512 | + crc_rd_wrk->phy_inst = | |
| 513 | + stream_state->link->link_enc_hw_inst; | |
| 514 | + spin_unlock_irqrestore(&crc_rd_wrk->crc_rd_work_lock, flags2); | |
| 515 | + schedule_work(&crc_rd_wrk->notify_ta_work); | |
| 516 | + } | |
| 517 | + } else { | |
| 518 | + acrtc->dm_irq_params.crc_window.skip_frame_cnt -= 1; | |
| 519 | + } | |
| 520 | + } | |
| 521 | + } | |
| 522 | + } | |
| 523 | + | |
| 524 | +cleanup: | |
| 525 | + spin_unlock_irqrestore(&drm_dev->event_lock, flags1); | |
| 526 | +} | |
| 527 | + | |
| 528 | +void amdgpu_dm_crtc_secure_display_resume(struct amdgpu_device *adev) | |
| 529 | +{ | |
| 530 | + struct drm_crtc *crtc; | |
| 531 | + enum amdgpu_dm_pipe_crc_source cur_crc_src; | |
| 532 | + struct crc_rd_work *crc_rd_wrk = adev->dm.crc_rd_wrk; | |
| 533 | + struct crc_window_parm cur_crc_window; | |
| 534 | + struct amdgpu_crtc *acrtc = NULL; | |
| 535 | + | |
| 536 | + drm_for_each_crtc(crtc, &adev->ddev) { | |
| 537 | + acrtc = to_amdgpu_crtc(crtc); | |
| 538 | + | |
| 539 | + spin_lock_irq(&adev_to_drm(adev)->event_lock); | |
| 540 | + cur_crc_src = acrtc->dm_irq_params.crc_src; | |
| 541 | + cur_crc_window = acrtc->dm_irq_params.crc_window; | |
| 542 | + spin_unlock_irq(&adev_to_drm(adev)->event_lock); | |
| 543 | + | |
| 544 | + if (amdgpu_dm_is_valid_crc_source(cur_crc_src)) { | |
| 545 | + amdgpu_dm_crtc_set_crc_source(crtc, | |
| 546 | + pipe_crc_sources[cur_crc_src]); | |
| 547 | + spin_lock_irq(&adev_to_drm(adev)->event_lock); | |
| 548 | + acrtc->dm_irq_params.crc_window = cur_crc_window; | |
| 549 | + if (acrtc->dm_irq_params.crc_window.activated) { | |
| 550 | + acrtc->dm_irq_params.crc_window.update_win = true; | |
| 551 | + acrtc->dm_irq_params.crc_window.skip_frame_cnt = 1; | |
| 552 | + spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock); | |
| 553 | + crc_rd_wrk->crtc = crtc; | |
| 554 | + spin_unlock_irq(&crc_rd_wrk->crc_rd_work_lock); | |
| 555 | + } | |
| 556 | + spin_unlock_irq(&adev_to_drm(adev)->event_lock); | |
| 557 | + } | |
| 558 | + } | |
| 559 | +} | |
| 560 | + | |
| 561 | +void amdgpu_dm_crtc_secure_display_suspend(struct amdgpu_device *adev) | |
| 562 | +{ | |
| 563 | + struct drm_crtc *crtc; | |
| 564 | + struct crc_window_parm cur_crc_window; | |
| 565 | + enum amdgpu_dm_pipe_crc_source cur_crc_src; | |
| 566 | + struct amdgpu_crtc *acrtc = NULL; | |
| 567 | + | |
| 568 | + drm_for_each_crtc(crtc, &adev->ddev) { | |
| 569 | + acrtc = to_amdgpu_crtc(crtc); | |
| 570 | + | |
| 571 | + spin_lock_irq(&adev_to_drm(adev)->event_lock); | |
| 572 | + cur_crc_src = acrtc->dm_irq_params.crc_src; | |
| 573 | + cur_crc_window = acrtc->dm_irq_params.crc_window; | |
| 574 | + cur_crc_window.update_win = false; | |
| 575 | + spin_unlock_irq(&adev_to_drm(adev)->event_lock); | |
| 576 | + | |
| 577 | + if (amdgpu_dm_is_valid_crc_source(cur_crc_src)) { | |
| 578 | + amdgpu_dm_crtc_set_crc_source(crtc, NULL); | |
| 579 | + spin_lock_irq(&adev_to_drm(adev)->event_lock); | |
| 580 | + /* For resume to set back crc source*/ | |
| 581 | + acrtc->dm_irq_params.crc_src = cur_crc_src; | |
| 582 | + acrtc->dm_irq_params.crc_window = cur_crc_window; | |
| 583 | + spin_unlock_irq(&adev_to_drm(adev)->event_lock); | |
| 584 | + } | |
| 585 | + } | |
| 586 | + | |
| 587 | +} | |
| 588 | + | |
| 589 | +struct crc_rd_work *amdgpu_dm_crtc_secure_display_create_work(void) | |
| 590 | +{ | |
| 591 | + struct crc_rd_work *crc_rd_wrk = NULL; | |
| 592 | + | |
| 593 | + crc_rd_wrk = kzalloc(sizeof(*crc_rd_wrk), GFP_KERNEL); | |
| 594 | + | |
| 595 | + if (!crc_rd_wrk) | |
| 596 | + return NULL; | |
| 597 | + | |
| 598 | + spin_lock_init(&crc_rd_wrk->crc_rd_work_lock); | |
| 599 | + INIT_WORK(&crc_rd_wrk->notify_ta_work, amdgpu_dm_crtc_notify_ta_to_read); | |
| 600 | + | |
| 601 | + return crc_rd_wrk; | |
| 602 | +} | |
| 603 | +#endif | |
| @@ -39,6 +39,29 @@ enum amdgpu_dm_pipe_crc_source { · 38 unmodified lines | ||
| 39 | 39 | AMDGPU_DM_PIPE_CRC_SOURCE_INVALID = -1, |
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 43 | +struct crc_window_parm { | |
| 44 | + uint16_t x_start; | |
| 45 | + uint16_t y_start; | |
| 46 | + uint16_t x_end; | |
| 47 | + uint16_t y_end; | |
| 48 | + /* CRC windwo is activated or not*/ | |
| 49 | + bool activated; | |
| 50 | + /* Update crc window during vertical blank or not */ | |
| 51 | + bool update_win; | |
| 52 | + /* skip reading/writing for few frames */ | |
| 53 | + int skip_frame_cnt; | |
| 54 | +}; | |
| 55 | + | |
| 56 | +struct crc_rd_work { | |
| 57 | + struct work_struct notify_ta_work; | |
| 58 | + /* To protect crc_rd_work carried fields*/ | |
| 59 | + spinlock_t crc_rd_work_lock; | |
| 60 | + struct drm_crtc *crtc; | |
| 61 | + uint8_t phy_inst; | |
| 62 | +}; | |
| 63 | +#endif | |
| 64 | + | |
| 42 | 65 | static inline bool amdgpu_dm_is_valid_crc_source(enum amdgpu_dm_pipe_crc_source source) |
| 43 | 66 | { |
| 44 | 67 | return (source > AMDGPU_DM_PIPE_CRC_SOURCE_NONE) && |
| @@ -64,4 +87,18 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc); · 19 unmodified lines | ||
| 64 | 87 | #define amdgpu_dm_crtc_handle_crc_irq(x) |
| 65 | 88 | #endif |
| 66 | 89 | |
| 90 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 91 | +bool amdgpu_dm_crc_window_is_activated(struct drm_crtc *crtc); | |
| 92 | +void amdgpu_dm_crtc_handle_crc_window_irq(struct drm_crtc *crtc); | |
| 93 | +struct crc_rd_work *amdgpu_dm_crtc_secure_display_create_work(void); | |
| 94 | +void amdgpu_dm_crtc_secure_display_resume(struct amdgpu_device *adev); | |
| 95 | +void amdgpu_dm_crtc_secure_display_suspend(struct amdgpu_device *adev); | |
| 96 | +#else | |
| 97 | +#define amdgpu_dm_crc_window_is_activated(x) | |
| 98 | +#define amdgpu_dm_crtc_handle_crc_window_irq(x) | |
| 99 | +#define amdgpu_dm_crtc_secure_display_create_work() | |
| 100 | +#define amdgpu_dm_crtc_secure_display_resume(x) | |
| 101 | +#define amdgpu_dm_crtc_secure_display_suspend(x) | |
| 102 | +#endif | |
| 103 | + | |
| 67 | 104 | #endif /* AMD_DAL_DEV_AMDGPU_DM_AMDGPU_DM_CRC_H_ */ |
| @@ -25,8 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | #include <linux/uaccess.h> |
| 27 | 27 | |
| 28 | −#include <drm/drm_debugfs.h> | |
| 29 | − | |
| 30 | 28 | #include "dc.h" |
| 31 | 29 | #include "amdgpu.h" |
| 32 | 30 | #include "amdgpu_dm.h" |
| @@ -36,6 +34,7 @@ · 3 unmodified lines | ||
| 36 | 34 | #include "resource.h" |
| 37 | 35 | #include "dsc.h" |
| 38 | 36 | #include "dc_link_dp.h" |
| 37 | +#include "dc/dc_dmub_srv.h" | |
| 39 | 38 | |
| 40 | 39 | struct dmub_debugfs_trace_header { |
| 41 | 40 | uint32_t entry_count; |
| @@ -2154,6 +2153,149 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf, · 2112 unmodified lines | ||
| 2154 | 2153 | return result; |
| 2155 | 2154 | } |
| 2156 | 2155 | |
| 2156 | + | |
| 2157 | +/* | |
| 2158 | + * function description: Read max_requested_bpc property from the connector | |
| 2159 | + * | |
| 2160 | + * Access it with the following command: | |
| 2161 | + * | |
| 2162 | + * cat /sys/kernel/debug/dri/0/DP-X/max_bpc | |
| 2163 | + * | |
| 2164 | + */ | |
| 2165 | +static ssize_t dp_max_bpc_read(struct file *f, char __user *buf, | |
| 2166 | + size_t size, loff_t *pos) | |
| 2167 | +{ | |
| 2168 | + struct amdgpu_dm_connector *aconnector = file_inode(f)->i_private; | |
| 2169 | + struct drm_connector *connector = &aconnector->base; | |
| 2170 | + struct drm_device *dev = connector->dev; | |
| 2171 | + struct dm_connector_state *state; | |
| 2172 | + ssize_t result = 0; | |
| 2173 | + char *rd_buf = NULL; | |
| 2174 | + char *rd_buf_ptr = NULL; | |
| 2175 | + const uint32_t rd_buf_size = 10; | |
| 2176 | + int r; | |
| 2177 | + | |
| 2178 | + rd_buf = kcalloc(rd_buf_size, sizeof(char), GFP_KERNEL); | |
| 2179 | + | |
| 2180 | + if (!rd_buf) | |
| 2181 | + return -ENOMEM; | |
| 2182 | + | |
| 2183 | + mutex_lock(&dev->mode_config.mutex); | |
| 2184 | + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | |
| 2185 | + | |
| 2186 | + if (connector->state == NULL) | |
| 2187 | + goto unlock; | |
| 2188 | + | |
| 2189 | + state = to_dm_connector_state(connector->state); | |
| 2190 | + | |
| 2191 | + rd_buf_ptr = rd_buf; | |
| 2192 | + snprintf(rd_buf_ptr, rd_buf_size, | |
| 2193 | + "%u\n", | |
| 2194 | + state->base.max_requested_bpc); | |
| 2195 | + | |
| 2196 | + while (size) { | |
| 2197 | + if (*pos >= rd_buf_size) | |
| 2198 | + break; | |
| 2199 | + | |
| 2200 | + r = put_user(*(rd_buf + result), buf); | |
| 2201 | + if (r) { | |
| 2202 | + result = r; /* r = -EFAULT */ | |
| 2203 | + goto unlock; | |
| 2204 | + } | |
| 2205 | + buf += 1; | |
| 2206 | + size -= 1; | |
| 2207 | + *pos += 1; | |
| 2208 | + result += 1; | |
| 2209 | + } | |
| 2210 | +unlock: | |
| 2211 | + drm_modeset_unlock(&dev->mode_config.connection_mutex); | |
| 2212 | + mutex_unlock(&dev->mode_config.mutex); | |
| 2213 | + kfree(rd_buf); | |
| 2214 | + return result; | |
| 2215 | +} | |
| 2216 | + | |
| 2217 | + | |
| 2218 | +/* | |
| 2219 | + * function description: Set max_requested_bpc property on the connector | |
| 2220 | + * | |
| 2221 | + * This function will not force the input BPC on connector, it will only | |
| 2222 | + * change the max value. This is equivalent to setting max_bpc through | |
| 2223 | + * xrandr. | |
| 2224 | + * | |
| 2225 | + * The BPC value written must be >= 6 and <= 16. Values outside of this | |
| 2226 | + * range will result in errors. | |
| 2227 | + * | |
| 2228 | + * BPC values: | |
| 2229 | + * 0x6 - 6 BPC | |
| 2230 | + * 0x8 - 8 BPC | |
| 2231 | + * 0xa - 10 BPC | |
| 2232 | + * 0xc - 12 BPC | |
| 2233 | + * 0x10 - 16 BPC | |
| 2234 | + * | |
| 2235 | + * Write the max_bpc in the following way: | |
| 2236 | + * | |
| 2237 | + * echo 0x6 > /sys/kernel/debug/dri/0/DP-X/max_bpc | |
| 2238 | + * | |
| 2239 | + */ | |
| 2240 | +static ssize_t dp_max_bpc_write(struct file *f, const char __user *buf, | |
| 2241 | + size_t size, loff_t *pos) | |
| 2242 | +{ | |
| 2243 | + struct amdgpu_dm_connector *aconnector = file_inode(f)->i_private; | |
| 2244 | + struct drm_connector *connector = &aconnector->base; | |
| 2245 | + struct dm_connector_state *state; | |
| 2246 | + struct drm_device *dev = connector->dev; | |
| 2247 | + char *wr_buf = NULL; | |
| 2248 | + uint32_t wr_buf_size = 42; | |
| 2249 | + int max_param_num = 1; | |
| 2250 | + long param[1] = {0}; | |
| 2251 | + uint8_t param_nums = 0; | |
| 2252 | + | |
| 2253 | + if (size == 0) | |
| 2254 | + return -EINVAL; | |
| 2255 | + | |
| 2256 | + wr_buf = kcalloc(wr_buf_size, sizeof(char), GFP_KERNEL); | |
| 2257 | + | |
| 2258 | + if (!wr_buf) { | |
| 2259 | + DRM_DEBUG_DRIVER("no memory to allocate write buffer\n"); | |
| 2260 | + return -ENOSPC; | |
| 2261 | + } | |
| 2262 | + | |
| 2263 | + if (parse_write_buffer_into_params(wr_buf, size, | |
| 2264 | + (long *)param, buf, | |
| 2265 | + max_param_num, | |
| 2266 | + ¶m_nums)) { | |
| 2267 | + kfree(wr_buf); | |
| 2268 | + return -EINVAL; | |
| 2269 | + } | |
| 2270 | + | |
| 2271 | + if (param_nums <= 0) { | |
| 2272 | + DRM_DEBUG_DRIVER("user data not be read\n"); | |
| 2273 | + kfree(wr_buf); | |
| 2274 | + return -EINVAL; | |
| 2275 | + } | |
| 2276 | + | |
| 2277 | + if (param[0] < 6 || param[0] > 16) { | |
| 2278 | + DRM_DEBUG_DRIVER("bad max_bpc value\n"); | |
| 2279 | + kfree(wr_buf); | |
| 2280 | + return -EINVAL; | |
| 2281 | + } | |
| 2282 | + | |
| 2283 | + mutex_lock(&dev->mode_config.mutex); | |
| 2284 | + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | |
| 2285 | + | |
| 2286 | + if (connector->state == NULL) | |
| 2287 | + goto unlock; | |
| 2288 | + | |
| 2289 | + state = to_dm_connector_state(connector->state); | |
| 2290 | + state->base.max_requested_bpc = param[0]; | |
| 2291 | +unlock: | |
| 2292 | + drm_modeset_unlock(&dev->mode_config.connection_mutex); | |
| 2293 | + mutex_unlock(&dev->mode_config.mutex); | |
| 2294 | + | |
| 2295 | + kfree(wr_buf); | |
| 2296 | + return size; | |
| 2297 | +} | |
| 2298 | + | |
| 2157 | 2299 | DEFINE_SHOW_ATTRIBUTE(dp_dsc_fec_support); |
| 2158 | 2300 | DEFINE_SHOW_ATTRIBUTE(dmub_fw_state); |
| 2159 | 2301 | DEFINE_SHOW_ATTRIBUTE(dmub_tracebuffer); |
| @@ -2265,6 +2407,13 @@ static const struct file_operations dp_dpcd_data_debugfs_fops = { · 105 unmodified lines | ||
| 2265 | 2407 | .llseek = default_llseek |
| 2266 | 2408 | }; |
| 2267 | 2409 | |
| 2410 | +static const struct file_operations dp_max_bpc_debugfs_fops = { | |
| 2411 | + .owner = THIS_MODULE, | |
| 2412 | + .read = dp_max_bpc_read, | |
| 2413 | + .write = dp_max_bpc_write, | |
| 2414 | + .llseek = default_llseek | |
| 2415 | +}; | |
| 2416 | + | |
| 2268 | 2417 | static const struct { |
| 2269 | 2418 | char *name; |
| 2270 | 2419 | const struct file_operations *fops; |
| @@ -2287,7 +2436,8 @@ static const struct { · 16 unmodified lines | ||
| 2287 | 2436 | {"dsc_pic_height", &dp_dsc_pic_height_debugfs_fops}, |
| 2288 | 2437 | {"dsc_chunk_size", &dp_dsc_chunk_size_debugfs_fops}, |
| 2289 | 2438 | {"dsc_slice_bpg", &dp_dsc_slice_bpg_offset_debugfs_fops}, |
| 2290 | − {"dp_dsc_fec_support", &dp_dsc_fec_support_fops} | |
| 2439 | + {"dp_dsc_fec_support", &dp_dsc_fec_support_fops}, | |
| 2440 | + {"max_bpc", &dp_max_bpc_debugfs_fops} | |
| 2291 | 2441 | }; |
| 2292 | 2442 | |
| 2293 | 2443 | #ifdef CONFIG_DRM_AMD_DC_HDCP |
| @@ -2341,9 +2491,51 @@ static int psr_get(void *data, u64 *val) · 47 unmodified lines | ||
| 2341 | 2491 | return 0; |
| 2342 | 2492 | } |
| 2343 | 2493 | |
| 2494 | +/* | |
| 2495 | + * Set dmcub trace event IRQ enable or disable. | |
| 2496 | + * Usage to enable dmcub trace event IRQ: echo 1 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en | |
| 2497 | + * Usage to disable dmcub trace event IRQ: echo 0 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en | |
| 2498 | + */ | |
| 2499 | +static int dmcub_trace_event_state_set(void *data, u64 val) | |
| 2500 | +{ | |
| 2501 | + struct amdgpu_device *adev = data; | |
| 2502 | + | |
| 2503 | + if (val == 1 || val == 0) { | |
| 2504 | + dc_dmub_trace_event_control(adev->dm.dc, val); | |
| 2505 | + adev->dm.dmcub_trace_event_en = (bool)val; | |
| 2506 | + } else | |
| 2507 | + return 0; | |
| 2508 | + | |
| 2509 | + return 0; | |
| 2510 | +} | |
| 2511 | + | |
| 2512 | +/* | |
| 2513 | + * The interface doesn't need get function, so it will return the | |
| 2514 | + * value of zero | |
| 2515 | + * Usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en | |
| 2516 | + */ | |
| 2517 | +static int dmcub_trace_event_state_get(void *data, u64 *val) | |
| 2518 | +{ | |
| 2519 | + struct amdgpu_device *adev = data; | |
| 2520 | + | |
| 2521 | + *val = adev->dm.dmcub_trace_event_en; | |
| 2522 | + return 0; | |
| 2523 | +} | |
| 2524 | + | |
| 2525 | +DEFINE_DEBUGFS_ATTRIBUTE(dmcub_trace_event_state_fops, dmcub_trace_event_state_get, | |
| 2526 | + dmcub_trace_event_state_set, "%llu\n"); | |
| 2344 | 2527 | |
| 2345 | 2528 | DEFINE_DEBUGFS_ATTRIBUTE(psr_fops, psr_get, NULL, "%llu\n"); |
| 2346 | 2529 | |
| 2530 | +static const struct { | |
| 2531 | + char *name; | |
| 2532 | + const struct file_operations *fops; | |
| 2533 | +} connector_debugfs_entries[] = { | |
| 2534 | + {"force_yuv420_output", &force_yuv420_output_fops}, | |
| 2535 | + {"output_bpc", &output_bpc_fops}, | |
| 2536 | + {"trigger_hotplug", &trigger_hotplug_debugfs_fops} | |
| 2537 | +}; | |
| 2538 | + | |
| 2347 | 2539 | void connector_debugfs_init(struct amdgpu_dm_connector *connector) |
| 2348 | 2540 | { |
| 2349 | 2541 | int i; |
| @@ -2360,14 +2552,11 @@ void connector_debugfs_init(struct amdgpu_dm_connector *connector) · 10 unmodified lines | ||
| 2360 | 2552 | if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) |
| 2361 | 2553 | debugfs_create_file_unsafe("psr_state", 0444, dir, connector, &psr_fops); |
| 2362 | 2554 | |
| 2363 | − debugfs_create_file_unsafe("force_yuv420_output", 0644, dir, connector, | |
| 2364 | − &force_yuv420_output_fops); | |
| 2365 | − | |
| 2366 | − debugfs_create_file("output_bpc", 0644, dir, connector, | |
| 2367 | − &output_bpc_fops); | |
| 2368 | − | |
| 2369 | − debugfs_create_file("trigger_hotplug", 0644, dir, connector, | |
| 2370 | − &trigger_hotplug_debugfs_fops); | |
| 2555 | + for (i = 0; i < ARRAY_SIZE(connector_debugfs_entries); i++) { | |
| 2556 | + debugfs_create_file(connector_debugfs_entries[i].name, | |
| 2557 | + 0644, dir, connector, | |
| 2558 | + connector_debugfs_entries[i].fops); | |
| 2559 | + } | |
| 2371 | 2560 | |
| 2372 | 2561 | connector->debugfs_dpcd_address = 0; |
| 2373 | 2562 | connector->debugfs_dpcd_size = 0; |
| @@ -2383,6 +2572,225 @@ void connector_debugfs_init(struct amdgpu_dm_connector *connector) · 9 unmodified lines | ||
| 2383 | 2572 | #endif |
| 2384 | 2573 | } |
| 2385 | 2574 | |
| 2575 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 2576 | +/* | |
| 2577 | + * Set crc window coordinate x start | |
| 2578 | + */ | |
| 2579 | +static int crc_win_x_start_set(void *data, u64 val) | |
| 2580 | +{ | |
| 2581 | + struct drm_crtc *crtc = data; | |
| 2582 | + struct drm_device *drm_dev = crtc->dev; | |
| 2583 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2584 | + | |
| 2585 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2586 | + acrtc->dm_irq_params.crc_window.x_start = (uint16_t) val; | |
| 2587 | + acrtc->dm_irq_params.crc_window.update_win = false; | |
| 2588 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2589 | + | |
| 2590 | + return 0; | |
| 2591 | +} | |
| 2592 | + | |
| 2593 | +/* | |
| 2594 | + * Get crc window coordinate x start | |
| 2595 | + */ | |
| 2596 | +static int crc_win_x_start_get(void *data, u64 *val) | |
| 2597 | +{ | |
| 2598 | + struct drm_crtc *crtc = data; | |
| 2599 | + struct drm_device *drm_dev = crtc->dev; | |
| 2600 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2601 | + | |
| 2602 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2603 | + *val = acrtc->dm_irq_params.crc_window.x_start; | |
| 2604 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2605 | + | |
| 2606 | + return 0; | |
| 2607 | +} | |
| 2608 | + | |
| 2609 | +DEFINE_DEBUGFS_ATTRIBUTE(crc_win_x_start_fops, crc_win_x_start_get, | |
| 2610 | + crc_win_x_start_set, "%llu\n"); | |
| 2611 | + | |
| 2612 | + | |
| 2613 | +/* | |
| 2614 | + * Set crc window coordinate y start | |
| 2615 | + */ | |
| 2616 | +static int crc_win_y_start_set(void *data, u64 val) | |
| 2617 | +{ | |
| 2618 | + struct drm_crtc *crtc = data; | |
| 2619 | + struct drm_device *drm_dev = crtc->dev; | |
| 2620 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2621 | + | |
| 2622 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2623 | + acrtc->dm_irq_params.crc_window.y_start = (uint16_t) val; | |
| 2624 | + acrtc->dm_irq_params.crc_window.update_win = false; | |
| 2625 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2626 | + | |
| 2627 | + return 0; | |
| 2628 | +} | |
| 2629 | + | |
| 2630 | +/* | |
| 2631 | + * Get crc window coordinate y start | |
| 2632 | + */ | |
| 2633 | +static int crc_win_y_start_get(void *data, u64 *val) | |
| 2634 | +{ | |
| 2635 | + struct drm_crtc *crtc = data; | |
| 2636 | + struct drm_device *drm_dev = crtc->dev; | |
| 2637 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2638 | + | |
| 2639 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2640 | + *val = acrtc->dm_irq_params.crc_window.y_start; | |
| 2641 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2642 | + | |
| 2643 | + return 0; | |
| 2644 | +} | |
| 2645 | + | |
| 2646 | +DEFINE_DEBUGFS_ATTRIBUTE(crc_win_y_start_fops, crc_win_y_start_get, | |
| 2647 | + crc_win_y_start_set, "%llu\n"); | |
| 2648 | + | |
| 2649 | +/* | |
| 2650 | + * Set crc window coordinate x end | |
| 2651 | + */ | |
| 2652 | +static int crc_win_x_end_set(void *data, u64 val) | |
| 2653 | +{ | |
| 2654 | + struct drm_crtc *crtc = data; | |
| 2655 | + struct drm_device *drm_dev = crtc->dev; | |
| 2656 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2657 | + | |
| 2658 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2659 | + acrtc->dm_irq_params.crc_window.x_end = (uint16_t) val; | |
| 2660 | + acrtc->dm_irq_params.crc_window.update_win = false; | |
| 2661 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2662 | + | |
| 2663 | + return 0; | |
| 2664 | +} | |
| 2665 | + | |
| 2666 | +/* | |
| 2667 | + * Get crc window coordinate x end | |
| 2668 | + */ | |
| 2669 | +static int crc_win_x_end_get(void *data, u64 *val) | |
| 2670 | +{ | |
| 2671 | + struct drm_crtc *crtc = data; | |
| 2672 | + struct drm_device *drm_dev = crtc->dev; | |
| 2673 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2674 | + | |
| 2675 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2676 | + *val = acrtc->dm_irq_params.crc_window.x_end; | |
| 2677 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2678 | + | |
| 2679 | + return 0; | |
| 2680 | +} | |
| 2681 | + | |
| 2682 | +DEFINE_DEBUGFS_ATTRIBUTE(crc_win_x_end_fops, crc_win_x_end_get, | |
| 2683 | + crc_win_x_end_set, "%llu\n"); | |
| 2684 | + | |
| 2685 | +/* | |
| 2686 | + * Set crc window coordinate y end | |
| 2687 | + */ | |
| 2688 | +static int crc_win_y_end_set(void *data, u64 val) | |
| 2689 | +{ | |
| 2690 | + struct drm_crtc *crtc = data; | |
| 2691 | + struct drm_device *drm_dev = crtc->dev; | |
| 2692 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2693 | + | |
| 2694 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2695 | + acrtc->dm_irq_params.crc_window.y_end = (uint16_t) val; | |
| 2696 | + acrtc->dm_irq_params.crc_window.update_win = false; | |
| 2697 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2698 | + | |
| 2699 | + return 0; | |
| 2700 | +} | |
| 2701 | + | |
| 2702 | +/* | |
| 2703 | + * Get crc window coordinate y end | |
| 2704 | + */ | |
| 2705 | +static int crc_win_y_end_get(void *data, u64 *val) | |
| 2706 | +{ | |
| 2707 | + struct drm_crtc *crtc = data; | |
| 2708 | + struct drm_device *drm_dev = crtc->dev; | |
| 2709 | + struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | |
| 2710 | + | |
| 2711 | + spin_lock_irq(&drm_dev->event_lock); | |
| 2712 | + *val = acrtc->dm_irq_params.crc_window.y_end; | |
| 2713 | + spin_unlock_irq(&drm_dev->event_lock); | |
| 2714 | + | |
| 2715 | + return 0; | |
| 2716 | +} | |
| 2717 | + | |
| 2718 | +DEFINE_DEBUGFS_ATTRIBUTE(crc_win_y_end_fops, crc_win_y_end_get, | |
| 2719 | + crc_win_y_end_set, "%llu\n"); | |
| 2720 | +/* | |
| 2721 | + * Trigger to commit crc window | |
| 2722 | + */ | |
| 2723 | +static int crc_win_update_set(void *data, u64 val) | |
| 2724 | +{ | |
| 2725 | + struct drm_crtc *new_crtc = data; | |
| 2726 | + struct drm_crtc *old_crtc = NULL; | |
| 2727 | + struct amdgpu_crtc *new_acrtc, *old_acrtc; | |
| 2728 | + struct amdgpu_device *adev = drm_to_adev(new_crtc->dev); | |
| 2729 | + struct crc_rd_work *crc_rd_wrk = adev->dm.crc_rd_wrk; | |
| 2730 | + | |
| 2731 | + if (val) { | |
| 2732 | + spin_lock_irq(&adev_to_drm(adev)->event_lock); | |
| 2733 | + spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock); | |
| 2734 | + if (crc_rd_wrk && crc_rd_wrk->crtc) { | |
| 2735 | + old_crtc = crc_rd_wrk->crtc; | |
| 2736 | + old_acrtc = to_amdgpu_crtc(old_crtc); | |
| 2737 | + } | |
| 2738 | + new_acrtc = to_amdgpu_crtc(new_crtc); | |
| 2739 | + | |
| 2740 | + if (old_crtc && old_crtc != new_crtc) { | |
| 2741 | + old_acrtc->dm_irq_params.crc_window.activated = false; | |
| 2742 | + old_acrtc->dm_irq_params.crc_window.update_win = false; | |
| 2743 | + old_acrtc->dm_irq_params.crc_window.skip_frame_cnt = 0; | |
| 2744 | + | |
| 2745 | + new_acrtc->dm_irq_params.crc_window.activated = true; | |
| 2746 | + new_acrtc->dm_irq_params.crc_window.update_win = true; | |
| 2747 | + new_acrtc->dm_irq_params.crc_window.skip_frame_cnt = 0; | |
| 2748 | + crc_rd_wrk->crtc = new_crtc; | |
| 2749 | + } else { | |
| 2750 | + new_acrtc->dm_irq_params.crc_window.activated = true; | |
| 2751 | + new_acrtc->dm_irq_params.crc_window.update_win = true; | |
| 2752 | + new_acrtc->dm_irq_params.crc_window.skip_frame_cnt = 0; | |
| 2753 | + crc_rd_wrk->crtc = new_crtc; | |
| 2754 | + } | |
| 2755 | + spin_unlock_irq(&crc_rd_wrk->crc_rd_work_lock); | |
| 2756 | + spin_unlock_irq(&adev_to_drm(adev)->event_lock); | |
| 2757 | + } | |
| 2758 | + | |
| 2759 | + return 0; | |
| 2760 | +} | |
| 2761 | + | |
| 2762 | +/* | |
| 2763 | + * Get crc window update flag | |
| 2764 | + */ | |
| 2765 | +static int crc_win_update_get(void *data, u64 *val) | |
| 2766 | +{ | |
| 2767 | + *val = 0; | |
| 2768 | + return 0; | |
| 2769 | +} | |
| 2770 | + | |
| 2771 | +DEFINE_DEBUGFS_ATTRIBUTE(crc_win_update_fops, crc_win_update_get, | |
| 2772 | + crc_win_update_set, "%llu\n"); | |
| 2773 | + | |
| 2774 | +void crtc_debugfs_init(struct drm_crtc *crtc) | |
| 2775 | +{ | |
| 2776 | + struct dentry *dir = debugfs_lookup("crc", crtc->debugfs_entry); | |
| 2777 | + | |
| 2778 | + if (!dir) | |
| 2779 | + return; | |
| 2780 | + | |
| 2781 | + debugfs_create_file_unsafe("crc_win_x_start", 0644, dir, crtc, | |
| 2782 | + &crc_win_x_start_fops); | |
| 2783 | + debugfs_create_file_unsafe("crc_win_y_start", 0644, dir, crtc, | |
| 2784 | + &crc_win_y_start_fops); | |
| 2785 | + debugfs_create_file_unsafe("crc_win_x_end", 0644, dir, crtc, | |
| 2786 | + &crc_win_x_end_fops); | |
| 2787 | + debugfs_create_file_unsafe("crc_win_y_end", 0644, dir, crtc, | |
| 2788 | + &crc_win_y_end_fops); | |
| 2789 | + debugfs_create_file_unsafe("crc_win_update", 0644, dir, crtc, | |
| 2790 | + &crc_win_update_fops); | |
| 2791 | + | |
| 2792 | +} | |
| 2793 | +#endif | |
| 2386 | 2794 | /* |
| 2387 | 2795 | * Writes DTN log state to the user supplied buffer. |
| 2388 | 2796 | * Example usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dtn_log |
| @@ -2450,11 +2858,9 @@ static ssize_t dtn_log_write( · 61 unmodified lines | ||
| 2450 | 2858 | * As written to display, taking ABM and backlight lut into account. |
| 2451 | 2859 | * Ranges from 0x0 to 0x10000 (= 100% PWM) |
| 2452 | 2860 | */ |
| 2453 | −static int current_backlight_read(struct seq_file *m, void *data) | |
| 2861 | +static int current_backlight_show(struct seq_file *m, void *unused) | |
| 2454 | 2862 | { |
| 2455 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 2456 | − struct drm_device *dev = node->minor->dev; | |
| 2457 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 2863 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2458 | 2864 | struct amdgpu_display_manager *dm = &adev->dm; |
| 2459 | 2865 | |
| 2460 | 2866 | unsigned int backlight = dc_link_get_backlight_level(dm->backlight_link); |
| @@ -2468,11 +2874,9 @@ static int current_backlight_read(struct seq_file *m, void *data) · 7 unmodified lines | ||
| 2468 | 2874 | * As written to display, taking ABM and backlight lut into account. |
| 2469 | 2875 | * Ranges from 0x0 to 0x10000 (= 100% PWM) |
| 2470 | 2876 | */ |
| 2471 | −static int target_backlight_read(struct seq_file *m, void *data) | |
| 2877 | +static int target_backlight_show(struct seq_file *m, void *unused) | |
| 2472 | 2878 | { |
| 2473 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 2474 | − struct drm_device *dev = node->minor->dev; | |
| 2475 | − struct amdgpu_device *adev = drm_to_adev(dev); | |
| 2879 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2476 | 2880 | struct amdgpu_display_manager *dm = &adev->dm; |
| 2477 | 2881 | |
| 2478 | 2882 | unsigned int backlight = dc_link_get_target_backlight_pwm(dm->backlight_link); |
| @@ -2481,10 +2885,10 @@ static int target_backlight_read(struct seq_file *m, void *data) · 2 unmodified lines | ||
| 2481 | 2885 | return 0; |
| 2482 | 2886 | } |
| 2483 | 2887 | |
| 2484 | −static int mst_topo(struct seq_file *m, void *unused) | |
| 2888 | +static int mst_topo_show(struct seq_file *m, void *unused) | |
| 2485 | 2889 | { |
| 2486 | − struct drm_info_node *node = (struct drm_info_node *)m->private; | |
| 2487 | − struct drm_device *dev = node->minor->dev; | |
| 2890 | + struct amdgpu_device *adev = (struct amdgpu_device *)m->private; | |
| 2891 | + struct drm_device *dev = adev_to_drm(adev); | |
| 2488 | 2892 | struct drm_connector *connector; |
| 2489 | 2893 | struct drm_connector_list_iter conn_iter; |
| 2490 | 2894 | struct amdgpu_dm_connector *aconnector; |
| @@ -2504,12 +2908,6 @@ static int mst_topo(struct seq_file *m, void *unused) · 13 unmodified lines | ||
| 2504 | 2908 | return 0; |
| 2505 | 2909 | } |
| 2506 | 2910 | |
| 2507 | −static const struct drm_info_list amdgpu_dm_debugfs_list[] = { | |
| 2508 | − {"amdgpu_current_backlight_pwm", ¤t_backlight_read}, | |
| 2509 | − {"amdgpu_target_backlight_pwm", &target_backlight_read}, | |
| 2510 | − {"amdgpu_mst_topology", &mst_topo}, | |
| 2511 | −}; | |
| 2512 | − | |
| 2513 | 2911 | /* |
| 2514 | 2912 | * Sets the force_timing_sync debug optino from the given string. |
| 2515 | 2913 | * All connected displays will be force synchronized immediately. |
| @@ -2568,10 +2966,13 @@ static int visual_confirm_get(void *data, u64 *val) · 52 unmodified lines | ||
| 2568 | 2966 | return 0; |
| 2569 | 2967 | } |
| 2570 | 2968 | |
| 2969 | +DEFINE_SHOW_ATTRIBUTE(current_backlight); | |
| 2970 | +DEFINE_SHOW_ATTRIBUTE(target_backlight); | |
| 2971 | +DEFINE_SHOW_ATTRIBUTE(mst_topo); | |
| 2571 | 2972 | DEFINE_DEBUGFS_ATTRIBUTE(visual_confirm_fops, visual_confirm_get, |
| 2572 | 2973 | visual_confirm_set, "%llu\n"); |
| 2573 | 2974 | |
| 2574 | −int dtn_debugfs_init(struct amdgpu_device *adev) | |
| 2975 | +void dtn_debugfs_init(struct amdgpu_device *adev) | |
| 2575 | 2976 | { |
| 2576 | 2977 | static const struct file_operations dtn_log_fops = { |
| 2577 | 2978 | .owner = THIS_MODULE, |
| @@ -2582,13 +2983,13 @@ int dtn_debugfs_init(struct amdgpu_device *adev) · 4 unmodified lines | ||
| 2582 | 2983 | |
| 2583 | 2984 | struct drm_minor *minor = adev_to_drm(adev)->primary; |
| 2584 | 2985 | struct dentry *root = minor->debugfs_root; |
| 2585 | − int ret; | |
| 2586 | − | |
| 2587 | − ret = amdgpu_debugfs_add_files(adev, amdgpu_dm_debugfs_list, | |
| 2588 | − ARRAY_SIZE(amdgpu_dm_debugfs_list)); | |
| 2589 | − if (ret) | |
| 2590 | − return ret; | |
| 2591 | 2986 | |
| 2987 | + debugfs_create_file("amdgpu_current_backlight_pwm", 0444, | |
| 2988 | + root, adev, ¤t_backlight_fops); | |
| 2989 | + debugfs_create_file("amdgpu_target_backlight_pwm", 0444, | |
| 2990 | + root, adev, &target_backlight_fops); | |
| 2991 | + debugfs_create_file("amdgpu_mst_topology", 0444, root, | |
| 2992 | + adev, &mst_topo_fops); | |
| 2592 | 2993 | debugfs_create_file("amdgpu_dm_dtn_log", 0644, root, adev, |
| 2593 | 2994 | &dtn_log_fops); |
| 2594 | 2995 | |
| @@ -2604,5 +3005,6 @@ int dtn_debugfs_init(struct amdgpu_device *adev) · 9 unmodified lines | ||
| 2604 | 3005 | debugfs_create_file_unsafe("amdgpu_dm_force_timing_sync", 0644, root, |
| 2605 | 3006 | adev, &force_timing_sync_ops); |
| 2606 | 3007 | |
| 2607 | − return 0; | |
| 3008 | + debugfs_create_file_unsafe("amdgpu_dm_dmcub_trace_event_en", 0644, root, | |
| 3009 | + adev, &dmcub_trace_event_state_fops); | |
| 2608 | 3010 | } |
| @@ -30,6 +30,9 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "amdgpu_dm.h" |
| 31 | 31 | |
| 32 | 32 | void connector_debugfs_init(struct amdgpu_dm_connector *connector); |
| 33 | −int dtn_debugfs_init(struct amdgpu_device *adev); | |
| 33 | +void dtn_debugfs_init(struct amdgpu_device *adev); | |
| 34 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 35 | +void crtc_debugfs_init(struct drm_crtc *crtc); | |
| 36 | +#endif | |
| 34 | 37 | |
| 35 | 38 | #endif |
| @@ -652,14 +652,54 @@ void *dm_helpers_allocate_gpu_mem( · 651 unmodified lines | ||
| 652 | 652 | size_t size, |
| 653 | 653 | long long *addr) |
| 654 | 654 | { |
| 655 | − // TODO | |
| 656 | − return NULL; | |
| 655 | + struct amdgpu_device *adev = ctx->driver_context; | |
| 656 | + struct dal_allocation *da; | |
| 657 | + u32 domain = (type == DC_MEM_ALLOC_TYPE_GART) ? | |
| 658 | + AMDGPU_GEM_DOMAIN_GTT : AMDGPU_GEM_DOMAIN_VRAM; | |
| 659 | + int ret; | |
| 660 | + | |
| 661 | + da = kzalloc(sizeof(struct dal_allocation), GFP_KERNEL); | |
| 662 | + if (!da) | |
| 663 | + return NULL; | |
| 664 | + | |
| 665 | + ret = amdgpu_bo_create_kernel(adev, size, PAGE_SIZE, | |
| 666 | + domain, &da->bo, | |
| 667 | + &da->gpu_addr, &da->cpu_ptr); | |
| 668 | + | |
| 669 | + *addr = da->gpu_addr; | |
| 670 | + | |
| 671 | + if (ret) { | |
| 672 | + kfree(da); | |
| 673 | + return NULL; | |
| 674 | + } | |
| 675 | + | |
| 676 | + /* add da to list in dm */ | |
| 677 | + list_add(&da->list, &adev->dm.da_list); | |
| 678 | + | |
| 679 | + return da->cpu_ptr; | |
| 657 | 680 | } |
| 658 | 681 | |
| 659 | 682 | void dm_helpers_free_gpu_mem( |
| 660 | 683 | struct dc_context *ctx, |
| 661 | 684 | enum dc_gpu_mem_alloc_type type, |
| 662 | 685 | void *pvMem) |
| 686 | +{ | |
| 687 | + struct amdgpu_device *adev = ctx->driver_context; | |
| 688 | + struct dal_allocation *da; | |
| 689 | + | |
| 690 | + /* walk the da list in DM */ | |
| 691 | + list_for_each_entry(da, &adev->dm.da_list, list) { | |
| 692 | + if (pvMem == da->cpu_ptr) { | |
| 693 | + amdgpu_bo_free_kernel(&da->bo, &da->gpu_addr, &da->cpu_ptr); | |
| 694 | + list_del(&da->list); | |
| 695 | + kfree(da); | |
| 696 | + break; | |
| 697 | + } | |
| 698 | + } | |
| 699 | +} | |
| 700 | + | |
| 701 | +bool dm_helpers_dmub_outbox0_interrupt_control(struct dc_context *ctx, bool enable) | |
| 663 | 702 | { |
| 664 | 703 | // TODO |
| 704 | + return true; | |
| 665 | 705 | } |
| @@ -82,6 +82,7 @@ struct amdgpu_dm_irq_handler_data { · 81 unmodified lines | ||
| 82 | 82 | struct amdgpu_display_manager *dm; |
| 83 | 83 | /* DAL irq source which registered for this interrupt. */ |
| 84 | 84 | enum dc_irq_source irq_source; |
| 85 | + struct work_struct work; | |
| 85 | 86 | }; |
| 86 | 87 | |
| 87 | 88 | #define DM_IRQ_TABLE_LOCK(adev, flags) \ |
| @@ -111,20 +112,10 @@ static void init_handler_common_data(struct amdgpu_dm_irq_handler_data *hcd, · 23 unmodified lines | ||
| 111 | 112 | */ |
| 112 | 113 | static void dm_irq_work_func(struct work_struct *work) |
| 113 | 114 | { |
| 114 | − struct irq_list_head *irq_list_head = | |
| 115 | − container_of(work, struct irq_list_head, work); | |
| 116 | − struct list_head *handler_list = &irq_list_head->head; | |
| 117 | − struct amdgpu_dm_irq_handler_data *handler_data; | |
| 118 | − | |
| 119 | − list_for_each_entry(handler_data, handler_list, list) { | |
| 120 | − DRM_DEBUG_KMS("DM_IRQ: work_func: for dal_src=%d\n", | |
| 121 | − handler_data->irq_source); | |
| 115 | + struct amdgpu_dm_irq_handler_data *handler_data = | |
| 116 | + container_of(work, struct amdgpu_dm_irq_handler_data, work); | |
| 122 | 117 | |
| 123 | − DRM_DEBUG_KMS("DM_IRQ: schedule_work: for dal_src=%d\n", | |
| 124 | − handler_data->irq_source); | |
| 125 | − | |
| 126 | − handler_data->handler(handler_data->handler_arg); | |
| 127 | − } | |
| 118 | + handler_data->handler(handler_data->handler_arg); | |
| 128 | 119 | |
| 129 | 120 | /* Call a DAL subcomponent which registered for interrupt notification |
| 130 | 121 | * at INTERRUPT_LOW_IRQ_CONTEXT. |
| @@ -156,7 +147,7 @@ static struct list_head *remove_irq_handler(struct amdgpu_device *adev, · 25 unmodified lines | ||
| 156 | 147 | break; |
| 157 | 148 | case INTERRUPT_LOW_IRQ_CONTEXT: |
| 158 | 149 | default: |
| 159 | − hnd_list = &adev->dm.irq_handler_list_low_tab[irq_source].head; | |
| 150 | + hnd_list = &adev->dm.irq_handler_list_low_tab[irq_source]; | |
| 160 | 151 | break; |
| 161 | 152 | } |
| 162 | 153 | |
| @@ -290,7 +281,8 @@ void *amdgpu_dm_irq_register_interrupt(struct amdgpu_device *adev, · 127 unmodified lines | ||
| 290 | 281 | break; |
| 291 | 282 | case INTERRUPT_LOW_IRQ_CONTEXT: |
| 292 | 283 | default: |
| 293 | − hnd_list = &adev->dm.irq_handler_list_low_tab[irq_source].head; | |
| 284 | + hnd_list = &adev->dm.irq_handler_list_low_tab[irq_source]; | |
| 285 | + INIT_WORK(&handler_data->work, dm_irq_work_func); | |
| 294 | 286 | break; |
| 295 | 287 | } |
| 296 | 288 | |
| @@ -372,7 +364,7 @@ void amdgpu_dm_irq_unregister_interrupt(struct amdgpu_device *adev, · 75 unmodified lines | ||
| 372 | 364 | int amdgpu_dm_irq_init(struct amdgpu_device *adev) |
| 373 | 365 | { |
| 374 | 366 | int src; |
| 375 | − struct irq_list_head *lh; | |
| 367 | + struct list_head *lh; | |
| 376 | 368 | |
| 377 | 369 | DRM_DEBUG_KMS("DM_IRQ\n"); |
| 378 | 370 | |
| @@ -381,9 +373,7 @@ int amdgpu_dm_irq_init(struct amdgpu_device *adev) · 2 unmodified lines | ||
| 381 | 373 | for (src = 0; src < DAL_IRQ_SOURCES_NUMBER; src++) { |
| 382 | 374 | /* low context handler list init */ |
| 383 | 375 | lh = &adev->dm.irq_handler_list_low_tab[src]; |
| 384 | − INIT_LIST_HEAD(&lh->head); | |
| 385 | − INIT_WORK(&lh->work, dm_irq_work_func); | |
| 386 | − | |
| 376 | + INIT_LIST_HEAD(lh); | |
| 387 | 377 | /* high context handler init */ |
| 388 | 378 | INIT_LIST_HEAD(&adev->dm.irq_handler_list_high_tab[src]); |
| 389 | 379 | } |
| @@ -400,8 +390,11 @@ int amdgpu_dm_irq_init(struct amdgpu_device *adev) · 10 unmodified lines | ||
| 400 | 390 | void amdgpu_dm_irq_fini(struct amdgpu_device *adev) |
| 401 | 391 | { |
| 402 | 392 | int src; |
| 403 | − struct irq_list_head *lh; | |
| 393 | + struct list_head *lh; | |
| 394 | + struct list_head *entry, *tmp; | |
| 395 | + struct amdgpu_dm_irq_handler_data *handler; | |
| 404 | 396 | unsigned long irq_table_flags; |
| 397 | + | |
| 405 | 398 | DRM_DEBUG_KMS("DM_IRQ: releasing resources.\n"); |
| 406 | 399 | for (src = 0; src < DAL_IRQ_SOURCES_NUMBER; src++) { |
| 407 | 400 | DM_IRQ_TABLE_LOCK(adev, irq_table_flags); |
| @@ -410,7 +403,16 @@ void amdgpu_dm_irq_fini(struct amdgpu_device *adev) · 2 unmodified lines | ||
| 410 | 403 | * (because no code can schedule a new one). */ |
| 411 | 404 | lh = &adev->dm.irq_handler_list_low_tab[src]; |
| 412 | 405 | DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags); |
| 413 | − flush_work(&lh->work); | |
| 406 | + | |
| 407 | + if (!list_empty(lh)) { | |
| 408 | + list_for_each_safe(entry, tmp, lh) { | |
| 409 | + handler = list_entry( | |
| 410 | + entry, | |
| 411 | + struct amdgpu_dm_irq_handler_data, | |
| 412 | + list); | |
| 413 | + flush_work(&handler->work); | |
| 414 | + } | |
| 415 | + } | |
| 414 | 416 | } |
| 415 | 417 | } |
| 416 | 418 | |
| @@ -420,6 +422,8 @@ int amdgpu_dm_irq_suspend(struct amdgpu_device *adev) · 3 unmodified lines | ||
| 420 | 422 | struct list_head *hnd_list_h; |
| 421 | 423 | struct list_head *hnd_list_l; |
| 422 | 424 | unsigned long irq_table_flags; |
| 425 | + struct list_head *entry, *tmp; | |
| 426 | + struct amdgpu_dm_irq_handler_data *handler; | |
| 423 | 427 | |
| 424 | 428 | DM_IRQ_TABLE_LOCK(adev, irq_table_flags); |
| 425 | 429 | |
| @@ -430,14 +434,22 @@ int amdgpu_dm_irq_suspend(struct amdgpu_device *adev) · 4 unmodified lines | ||
| 430 | 434 | * will be disabled from manage_dm_interrupts on disable CRTC. |
| 431 | 435 | */ |
| 432 | 436 | for (src = DC_IRQ_SOURCE_HPD1; src <= DC_IRQ_SOURCE_HPD6RX; src++) { |
| 433 | − hnd_list_l = &adev->dm.irq_handler_list_low_tab[src].head; | |
| 437 | + hnd_list_l = &adev->dm.irq_handler_list_low_tab[src]; | |
| 434 | 438 | hnd_list_h = &adev->dm.irq_handler_list_high_tab[src]; |
| 435 | 439 | if (!list_empty(hnd_list_l) || !list_empty(hnd_list_h)) |
| 436 | 440 | dc_interrupt_set(adev->dm.dc, src, false); |
| 437 | 441 | |
| 438 | 442 | DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags); |
| 439 | − flush_work(&adev->dm.irq_handler_list_low_tab[src].work); | |
| 440 | 443 | |
| 444 | + if (!list_empty(hnd_list_l)) { | |
| 445 | + list_for_each_safe (entry, tmp, hnd_list_l) { | |
| 446 | + handler = list_entry( | |
| 447 | + entry, | |
| 448 | + struct amdgpu_dm_irq_handler_data, | |
| 449 | + list); | |
| 450 | + flush_work(&handler->work); | |
| 451 | + } | |
| 452 | + } | |
| 441 | 453 | DM_IRQ_TABLE_LOCK(adev, irq_table_flags); |
| 442 | 454 | } |
| 443 | 455 | |
| @@ -457,7 +469,7 @@ int amdgpu_dm_irq_resume_early(struct amdgpu_device *adev) · 13 unmodified lines | ||
| 457 | 469 | |
| 458 | 470 | /* re-enable short pulse interrupts HW interrupt */ |
| 459 | 471 | for (src = DC_IRQ_SOURCE_HPD1RX; src <= DC_IRQ_SOURCE_HPD6RX; src++) { |
| 460 | − hnd_list_l = &adev->dm.irq_handler_list_low_tab[src].head; | |
| 472 | + hnd_list_l = &adev->dm.irq_handler_list_low_tab[src]; | |
| 461 | 473 | hnd_list_h = &adev->dm.irq_handler_list_high_tab[src]; |
| 462 | 474 | if (!list_empty(hnd_list_l) || !list_empty(hnd_list_h)) |
| 463 | 475 | dc_interrupt_set(adev->dm.dc, src, true); |
| @@ -483,7 +495,7 @@ int amdgpu_dm_irq_resume_late(struct amdgpu_device *adev) · 19 unmodified lines | ||
| 483 | 495 | * will be enabled from manage_dm_interrupts on enable CRTC. |
| 484 | 496 | */ |
| 485 | 497 | for (src = DC_IRQ_SOURCE_HPD1; src <= DC_IRQ_SOURCE_HPD6; src++) { |
| 486 | − hnd_list_l = &adev->dm.irq_handler_list_low_tab[src].head; | |
| 498 | + hnd_list_l = &adev->dm.irq_handler_list_low_tab[src]; | |
| 487 | 499 | hnd_list_h = &adev->dm.irq_handler_list_high_tab[src]; |
| 488 | 500 | if (!list_empty(hnd_list_l) || !list_empty(hnd_list_h)) |
| 489 | 501 | dc_interrupt_set(adev->dm.dc, src, true); |
| @@ -500,22 +512,51 @@ int amdgpu_dm_irq_resume_late(struct amdgpu_device *adev) · 10 unmodified lines | ||
| 500 | 512 | static void amdgpu_dm_irq_schedule_work(struct amdgpu_device *adev, |
| 501 | 513 | enum dc_irq_source irq_source) |
| 502 | 514 | { |
| 503 | − unsigned long irq_table_flags; | |
| 504 | − struct work_struct *work = NULL; | |
| 515 | + struct list_head *handler_list = &adev->dm.irq_handler_list_low_tab[irq_source]; | |
| 516 | + struct amdgpu_dm_irq_handler_data *handler_data; | |
| 517 | + bool work_queued = false; | |
| 505 | 518 | |
| 506 | − DM_IRQ_TABLE_LOCK(adev, irq_table_flags); | |
| 519 | + if (list_empty(handler_list)) | |
| 520 | + return; | |
| 507 | 521 | |
| 508 | − if (!list_empty(&adev->dm.irq_handler_list_low_tab[irq_source].head)) | |
| 509 | − work = &adev->dm.irq_handler_list_low_tab[irq_source].work; | |
| 522 | + list_for_each_entry (handler_data, handler_list, list) { | |
| 523 | + if (queue_work(system_highpri_wq, &handler_data->work)) { | |
| 524 | + work_queued = true; | |
| 525 | + break; | |
| 526 | + } | |
| 527 | + } | |
| 510 | 528 | |
| 511 | − DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags); | |
| 529 | + if (!work_queued) { | |
| 530 | + struct amdgpu_dm_irq_handler_data *handler_data_add; | |
| 531 | + /*get the amdgpu_dm_irq_handler_data of first item pointed by handler_list*/ | |
| 532 | + handler_data = container_of(handler_list->next, struct amdgpu_dm_irq_handler_data, list); | |
| 512 | 533 | |
| 513 | − if (work) { | |
| 514 | − if (!schedule_work(work)) | |
| 515 | − DRM_INFO("amdgpu_dm_irq_schedule_work FAILED src %d\n", | |
| 516 | − irq_source); | |
| 517 | − } | |
| 534 | + /*allocate a new amdgpu_dm_irq_handler_data*/ | |
| 535 | + handler_data_add = kzalloc(sizeof(*handler_data), GFP_KERNEL); | |
| 536 | + if (!handler_data_add) { | |
| 537 | + DRM_ERROR("DM_IRQ: failed to allocate irq handler!\n"); | |
| 538 | + return; | |
| 539 | + } | |
| 540 | + | |
| 541 | + /*copy new amdgpu_dm_irq_handler_data members from handler_data*/ | |
| 542 | + handler_data_add->handler = handler_data->handler; | |
| 543 | + handler_data_add->handler_arg = handler_data->handler_arg; | |
| 544 | + handler_data_add->dm = handler_data->dm; | |
| 545 | + handler_data_add->irq_source = irq_source; | |
| 518 | 546 | |
| 547 | + list_add_tail(&handler_data_add->list, handler_list); | |
| 548 | + | |
| 549 | + INIT_WORK(&handler_data_add->work, dm_irq_work_func); | |
| 550 | + | |
| 551 | + if (queue_work(system_highpri_wq, &handler_data_add->work)) | |
| 552 | + DRM_DEBUG("Queued work for handling interrupt from " | |
| 553 | + "display for IRQ source %d\n", | |
| 554 | + irq_source); | |
| 555 | + else | |
| 556 | + DRM_ERROR("Failed to queue work for handling interrupt " | |
| 557 | + "from display for IRQ source %d\n", | |
| 558 | + irq_source); | |
| 559 | + } | |
| 519 | 560 | } |
| 520 | 561 | |
| 521 | 562 | /* |
| @@ -26,12 +26,21 @@ · 25 unmodified lines | ||
| 26 | 26 | #ifndef __AMDGPU_DM_IRQ_PARAMS_H__ |
| 27 | 27 | #define __AMDGPU_DM_IRQ_PARAMS_H__ |
| 28 | 28 | |
| 29 | +#include "amdgpu_dm_crc.h" | |
| 30 | + | |
| 29 | 31 | struct dm_irq_params { |
| 30 | 32 | u32 last_flip_vblank; |
| 31 | 33 | struct mod_vrr_params vrr_params; |
| 32 | 34 | struct dc_stream_state *stream; |
| 33 | 35 | int active_planes; |
| 34 | 36 | struct mod_freesync_config freesync_config; |
| 37 | + | |
| 38 | +#ifdef CONFIG_DEBUG_FS | |
| 39 | + enum amdgpu_dm_pipe_crc_source crc_src; | |
| 40 | +#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY | |
| 41 | + struct crc_window_parm crc_window; | |
| 42 | +#endif | |
| 43 | +#endif | |
| 35 | 44 | }; |
| 36 | 45 | |
| 37 | 46 | #endif /* __AMDGPU_DM_IRQ_PARAMS_H__ */ |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | #include "dc_link_ddc.h" |
| 39 | 39 | |
| 40 | 40 | #include "i2caux_interface.h" |
| 41 | +#include "dmub_cmd.h" | |
| 41 | 42 | #if defined(CONFIG_DEBUG_FS) |
| 42 | 43 | #include "amdgpu_dm_debugfs.h" |
| 43 | 44 | #endif |
| @@ -51,7 +52,7 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux, · 7 unmodified lines | ||
| 51 | 52 | { |
| 52 | 53 | ssize_t result = 0; |
| 53 | 54 | struct aux_payload payload; |
| 54 | − enum aux_channel_operation_result operation_result; | |
| 55 | + enum aux_return_code_type operation_result; | |
| 55 | 56 | |
| 56 | 57 | if (WARN_ON(msg->size > 16)) |
| 57 | 58 | return -E2BIG; |
| @@ -73,17 +74,19 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux, · 15 unmodified lines | ||
| 73 | 74 | |
| 74 | 75 | if (result < 0) |
| 75 | 76 | switch (operation_result) { |
| 76 | − case AUX_CHANNEL_OPERATION_SUCCEEDED: | |
| 77 | + case AUX_RET_SUCCESS: | |
| 77 | 78 | break; |
| 78 | − case AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON: | |
| 79 | − case AUX_CHANNEL_OPERATION_FAILED_REASON_UNKNOWN: | |
| 79 | + case AUX_RET_ERROR_HPD_DISCON: | |
| 80 | + case AUX_RET_ERROR_UNKNOWN: | |
| 81 | + case AUX_RET_ERROR_INVALID_OPERATION: | |
| 82 | + case AUX_RET_ERROR_PROTOCOL_ERROR: | |
| 80 | 83 | result = -EIO; |
| 81 | 84 | break; |
| 82 | − case AUX_CHANNEL_OPERATION_FAILED_INVALID_REPLY: | |
| 83 | − case AUX_CHANNEL_OPERATION_FAILED_ENGINE_ACQUIRE: | |
| 85 | + case AUX_RET_ERROR_INVALID_REPLY: | |
| 86 | + case AUX_RET_ERROR_ENGINE_ACQUIRE: | |
| 84 | 87 | result = -EBUSY; |
| 85 | 88 | break; |
| 86 | − case AUX_CHANNEL_OPERATION_FAILED_TIMEOUT: | |
| 89 | + case AUX_RET_ERROR_TIMEOUT: | |
| 87 | 90 | result = -ETIMEDOUT; |
| 88 | 91 | break; |
| 89 | 92 | } |
| @@ -54,7 +54,7 @@ AMD_DC = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/dc/,$(DC_LI · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | include $(AMD_DC) |
| 56 | 56 | |
| 57 | −DISPLAY_CORE = dc.o dc_link.o dc_resource.o dc_hw_sequencer.o dc_sink.o \ | |
| 57 | +DISPLAY_CORE = dc.o dc_stat.o dc_link.o dc_resource.o dc_hw_sequencer.o dc_sink.o \ | |
| 58 | 58 | dc_surface.o dc_link_hwss.o dc_link_dp.o dc_link_ddc.o dc_debug.o dc_stream.o |
| 59 | 59 | |
| 60 | 60 | ifdef CONFIG_DRM_AMD_DC_DCN |
| @@ -49,24 +49,20 @@ bool is_rgb_cspace(enum dc_color_space output_color_space) · 48 unmodified lines | ||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | −bool is_child_pipe_tree_visible(struct pipe_ctx *pipe_ctx) | |
| 52 | +bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx) | |
| 53 | 53 | { |
| 54 | 54 | if (pipe_ctx->plane_state && pipe_ctx->plane_state->visible) |
| 55 | 55 | return true; |
| 56 | − if (pipe_ctx->bottom_pipe && is_child_pipe_tree_visible(pipe_ctx->bottom_pipe)) | |
| 57 | − return true; | |
| 58 | − if (pipe_ctx->next_odm_pipe && is_child_pipe_tree_visible(pipe_ctx->next_odm_pipe)) | |
| 56 | + if (pipe_ctx->bottom_pipe && is_lower_pipe_tree_visible(pipe_ctx->bottom_pipe)) | |
| 59 | 57 | return true; |
| 60 | 58 | return false; |
| 61 | 59 | } |
| 62 | 60 | |
| 63 | −bool is_parent_pipe_tree_visible(struct pipe_ctx *pipe_ctx) | |
| 61 | +bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx) | |
| 64 | 62 | { |
| 65 | 63 | if (pipe_ctx->plane_state && pipe_ctx->plane_state->visible) |
| 66 | 64 | return true; |
| 67 | − if (pipe_ctx->top_pipe && is_parent_pipe_tree_visible(pipe_ctx->top_pipe)) | |
| 68 | − return true; | |
| 69 | − if (pipe_ctx->prev_odm_pipe && is_parent_pipe_tree_visible(pipe_ctx->prev_odm_pipe)) | |
| 65 | + if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe)) | |
| 70 | 66 | return true; |
| 71 | 67 | return false; |
| 72 | 68 | } |
| @@ -75,13 +71,9 @@ bool is_pipe_tree_visible(struct pipe_ctx *pipe_ctx) · 2 unmodified lines | ||
| 75 | 71 | { |
| 76 | 72 | if (pipe_ctx->plane_state && pipe_ctx->plane_state->visible) |
| 77 | 73 | return true; |
| 78 | − if (pipe_ctx->top_pipe && is_parent_pipe_tree_visible(pipe_ctx->top_pipe)) | |
| 79 | − return true; | |
| 80 | − if (pipe_ctx->bottom_pipe && is_child_pipe_tree_visible(pipe_ctx->bottom_pipe)) | |
| 81 | − return true; | |
| 82 | − if (pipe_ctx->prev_odm_pipe && is_parent_pipe_tree_visible(pipe_ctx->prev_odm_pipe)) | |
| 74 | + if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe)) | |
| 83 | 75 | return true; |
| 84 | − if (pipe_ctx->next_odm_pipe && is_child_pipe_tree_visible(pipe_ctx->next_odm_pipe)) | |
| 76 | + if (pipe_ctx->bottom_pipe && is_lower_pipe_tree_visible(pipe_ctx->bottom_pipe)) | |
| 85 | 77 | return true; |
| 86 | 78 | return false; |
| 87 | 79 | } |
| @@ -30,9 +30,9 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | bool is_rgb_cspace(enum dc_color_space output_color_space); |
| 32 | 32 | |
| 33 | −bool is_child_pipe_tree_visible(struct pipe_ctx *pipe_ctx); | |
| 33 | +bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx); | |
| 34 | 34 | |
| 35 | −bool is_parent_pipe_tree_visible(struct pipe_ctx *pipe_ctx); | |
| 35 | +bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx); | |
| 36 | 36 | |
| 37 | 37 | bool is_pipe_tree_visible(struct pipe_ctx *pipe_ctx); |
| 38 | 38 | |
| @@ -1180,14 +1180,15 @@ static enum bp_result bios_parser_enable_disp_power_gating( · 1179 unmodified lines | ||
| 1180 | 1180 | |
| 1181 | 1181 | static enum bp_result bios_parser_enable_lvtma_control( |
| 1182 | 1182 | struct dc_bios *dcb, |
| 1183 | − uint8_t uc_pwr_on) | |
| 1183 | + uint8_t uc_pwr_on, | |
| 1184 | + uint8_t panel_instance) | |
| 1184 | 1185 | { |
| 1185 | 1186 | struct bios_parser *bp = BP_FROM_DCB(dcb); |
| 1186 | 1187 | |
| 1187 | 1188 | if (!bp->cmd_tbl.enable_lvtma_control) |
| 1188 | 1189 | return BP_RESULT_FAILURE; |
| 1189 | 1190 | |
| 1190 | − return bp->cmd_tbl.enable_lvtma_control(bp, uc_pwr_on); | |
| 1191 | + return bp->cmd_tbl.enable_lvtma_control(bp, uc_pwr_on, panel_instance); | |
| 1191 | 1192 | } |
| 1192 | 1193 | |
| 1193 | 1194 | static bool bios_parser_is_accelerated_mode( |
| @@ -64,9 +64,10 @@ bool bios_is_accelerated_mode( · 63 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | void bios_set_scratch_acc_mode_change( |
| 67 | − struct dc_bios *bios) | |
| 67 | + struct dc_bios *bios, | |
| 68 | + uint32_t state) | |
| 68 | 69 | { |
| 69 | − REG_UPDATE(BIOS_SCRATCH_6, S6_ACC_MODE, 1); | |
| 70 | + REG_UPDATE(BIOS_SCRATCH_6, S6_ACC_MODE, state); | |
| 70 | 71 | } |
| 71 | 72 | |
| 72 | 73 | |
| @@ -32,7 +32,7 @@ uint8_t *bios_get_image(struct dc_bios *bp, uint32_t offset, · 31 unmodified lines | ||
| 32 | 32 | uint32_t size); |
| 33 | 33 | |
| 34 | 34 | bool bios_is_accelerated_mode(struct dc_bios *bios); |
| 35 | −void bios_set_scratch_acc_mode_change(struct dc_bios *bios); | |
| 35 | +void bios_set_scratch_acc_mode_change(struct dc_bios *bios, uint32_t state); | |
| 36 | 36 | void bios_set_scratch_critical_state(struct dc_bios *bios, bool state); |
| 37 | 37 | uint32_t bios_get_vga_enabled_displays(struct dc_bios *bios); |
| 38 | 38 | |
| @@ -1531,6 +1531,27 @@ static enum bp_result adjust_display_pll_v2( · 1530 unmodified lines | ||
| 1531 | 1531 | params.ucEncodeMode = |
| 1532 | 1532 | (uint8_t)bp->cmd_helper->encoder_mode_bp_to_atom( |
| 1533 | 1533 | bp_params->signal_type, false); |
| 1534 | + | |
| 1535 | + if (EXEC_BIOS_CMD_TABLE(AdjustDisplayPll, params)) { | |
| 1536 | + /* Convert output pixel clock back 10KHz-->KHz: multiply | |
| 1537 | + * original pixel clock in KHz by ratio | |
| 1538 | + * [output pxlClk/input pxlClk] */ | |
| 1539 | + uint64_t pixel_clk_10_khz_out = | |
| 1540 | + (uint64_t)le16_to_cpu(params.usPixelClock); | |
| 1541 | + uint64_t pixel_clk = (uint64_t)bp_params->pixel_clock; | |
| 1542 | + | |
| 1543 | + if (pixel_clock_10KHz_in != 0) { | |
| 1544 | + bp_params->adjusted_pixel_clock = | |
| 1545 | + div_u64(pixel_clk * pixel_clk_10_khz_out, | |
| 1546 | + pixel_clock_10KHz_in); | |
| 1547 | + } else { | |
| 1548 | + bp_params->adjusted_pixel_clock = 0; | |
| 1549 | + BREAK_TO_DEBUGGER(); | |
| 1550 | + } | |
| 1551 | + | |
| 1552 | + result = BP_RESULT_OK; | |
| 1553 | + } | |
| 1554 | + | |
| 1534 | 1555 | return result; |
| 1535 | 1556 | } |
| 1536 | 1557 | |
| @@ -218,6 +218,10 @@ static enum bp_result transmitter_control_v1_6( · 217 unmodified lines | ||
| 218 | 218 | struct bios_parser *bp, |
| 219 | 219 | struct bp_transmitter_control *cntl); |
| 220 | 220 | |
| 221 | +static enum bp_result transmitter_control_v1_7( | |
| 222 | + struct bios_parser *bp, | |
| 223 | + struct bp_transmitter_control *cntl); | |
| 224 | + | |
| 221 | 225 | static enum bp_result transmitter_control_fallback( |
| 222 | 226 | struct bios_parser *bp, |
| 223 | 227 | struct bp_transmitter_control *cntl); |
| @@ -233,6 +237,9 @@ static void init_transmitter_control(struct bios_parser *bp) · 9 unmodified lines | ||
| 233 | 237 | case 6: |
| 234 | 238 | bp->cmd_tbl.transmitter_control = transmitter_control_v1_6; |
| 235 | 239 | break; |
| 240 | + case 7: | |
| 241 | + bp->cmd_tbl.transmitter_control = transmitter_control_v1_7; | |
| 242 | + break; | |
| 236 | 243 | default: |
| 237 | 244 | dm_output_to_console("Don't have transmitter_control for v%d\n", crev); |
| 238 | 245 | bp->cmd_tbl.transmitter_control = transmitter_control_fallback; |
| @@ -304,13 +311,76 @@ static enum bp_result transmitter_control_v1_6( · 65 unmodified lines | ||
| 304 | 311 | return result; |
| 305 | 312 | } |
| 306 | 313 | |
| 314 | +static void transmitter_control_dmcub_v1_7( | |
| 315 | + struct dc_dmub_srv *dmcub, | |
| 316 | + struct dmub_dig_transmitter_control_data_v1_7 *dig) | |
| 317 | +{ | |
| 318 | + union dmub_rb_cmd cmd; | |
| 319 | + | |
| 320 | + memset(&cmd, 0, sizeof(cmd)); | |
| 321 | + | |
| 322 | + cmd.dig1_transmitter_control.header.type = DMUB_CMD__VBIOS; | |
| 323 | + cmd.dig1_transmitter_control.header.sub_type = | |
| 324 | + DMUB_CMD__VBIOS_DIG1_TRANSMITTER_CONTROL; | |
| 325 | + cmd.dig1_transmitter_control.header.payload_bytes = | |
| 326 | + sizeof(cmd.dig1_transmitter_control) - | |
| 327 | + sizeof(cmd.dig1_transmitter_control.header); | |
| 328 | + cmd.dig1_transmitter_control.transmitter_control.dig_v1_7 = *dig; | |
| 329 | + | |
| 330 | + dc_dmub_srv_cmd_queue(dmcub, &cmd); | |
| 331 | + dc_dmub_srv_cmd_execute(dmcub); | |
| 332 | + dc_dmub_srv_wait_idle(dmcub); | |
| 333 | +} | |
| 334 | + | |
| 335 | +static enum bp_result transmitter_control_v1_7( | |
| 336 | + struct bios_parser *bp, | |
| 337 | + struct bp_transmitter_control *cntl) | |
| 338 | +{ | |
| 339 | + enum bp_result result = BP_RESULT_FAILURE; | |
| 340 | + const struct command_table_helper *cmd = bp->cmd_helper; | |
| 341 | + struct dmub_dig_transmitter_control_data_v1_7 dig_v1_7 = {0}; | |
| 342 | + | |
| 343 | + dig_v1_7.phyid = cmd->phy_id_to_atom(cntl->transmitter); | |
| 344 | + dig_v1_7.action = (uint8_t)cntl->action; | |
| 345 | + | |
| 346 | + if (cntl->action == TRANSMITTER_CONTROL_SET_VOLTAGE_AND_PREEMPASIS) | |
| 347 | + dig_v1_7.mode_laneset.dplaneset = (uint8_t)cntl->lane_settings; | |
| 348 | + else | |
| 349 | + dig_v1_7.mode_laneset.digmode = | |
| 350 | + cmd->signal_type_to_atom_dig_mode(cntl->signal); | |
| 351 | + | |
| 352 | + dig_v1_7.lanenum = (uint8_t)cntl->lanes_number; | |
| 353 | + dig_v1_7.hpdsel = cmd->hpd_sel_to_atom(cntl->hpd_sel); | |
| 354 | + dig_v1_7.digfe_sel = cmd->dig_encoder_sel_to_atom(cntl->engine_id); | |
| 355 | + dig_v1_7.connobj_id = (uint8_t)cntl->connector_obj_id.id; | |
| 356 | + dig_v1_7.symclk_units.symclk_10khz = cntl->pixel_clock/10; | |
| 357 | + | |
| 358 | + if (cntl->action == TRANSMITTER_CONTROL_ENABLE || | |
| 359 | + cntl->action == TRANSMITTER_CONTROL_ACTIAVATE || | |
| 360 | + cntl->action == TRANSMITTER_CONTROL_DEACTIVATE) { | |
| 361 | + DC_LOG_BIOS("%s:dig_v1_7.symclk_units.symclk_10khz = %d\n", | |
| 362 | + __func__, dig_v1_7.symclk_units.symclk_10khz); | |
| 363 | + } | |
| 364 | + | |
| 365 | + if (bp->base.ctx->dc->ctx->dmub_srv && | |
| 366 | + bp->base.ctx->dc->debug.dmub_command_table) { | |
| 367 | + transmitter_control_dmcub_v1_7(bp->base.ctx->dmub_srv, &dig_v1_7); | |
| 368 | + return BP_RESULT_OK; | |
| 369 | + } | |
| 370 | + | |
| 371 | +/*color_depth not used any more, driver has deep color factor in the Phyclk*/ | |
| 372 | + if (EXEC_BIOS_CMD_TABLE(dig1transmittercontrol, dig_v1_7)) | |
| 373 | + result = BP_RESULT_OK; | |
| 374 | + return result; | |
| 375 | +} | |
| 376 | + | |
| 307 | 377 | static enum bp_result transmitter_control_fallback( |
| 308 | 378 | struct bios_parser *bp, |
| 309 | 379 | struct bp_transmitter_control *cntl) |
| 310 | 380 | { |
| 311 | 381 | if (bp->base.ctx->dc->ctx->dmub_srv && |
| 312 | 382 | bp->base.ctx->dc->debug.dmub_command_table) { |
| 313 | − return transmitter_control_v1_6(bp, cntl); | |
| 383 | + return transmitter_control_v1_7(bp, cntl); | |
| 314 | 384 | } |
| 315 | 385 | |
| 316 | 386 | return BP_RESULT_FAILURE; |
| @@ -911,7 +981,8 @@ static unsigned int get_smu_clock_info_v3_1(struct bios_parser *bp, uint8_t id) · 594 unmodified lines | ||
| 911 | 981 | |
| 912 | 982 | static enum bp_result enable_lvtma_control( |
| 913 | 983 | struct bios_parser *bp, |
| 914 | − uint8_t uc_pwr_on); | |
| 984 | + uint8_t uc_pwr_on, | |
| 985 | + uint8_t panel_instance); | |
| 915 | 986 | |
| 916 | 987 | static void init_enable_lvtma_control(struct bios_parser *bp) |
| 917 | 988 | { |
| @@ -922,19 +993,21 @@ static void init_enable_lvtma_control(struct bios_parser *bp) · 4 unmodified lines | ||
| 922 | 993 | |
| 923 | 994 | static void enable_lvtma_control_dmcub( |
| 924 | 995 | struct dc_dmub_srv *dmcub, |
| 925 | − uint8_t uc_pwr_on) | |
| 996 | + uint8_t uc_pwr_on, | |
| 997 | + uint8_t panel_instance) | |
| 926 | 998 | { |
| 927 | 999 | |
| 928 | 1000 | union dmub_rb_cmd cmd; |
| 929 | 1001 | |
| 930 | 1002 | memset(&cmd, 0, sizeof(cmd)); |
| 931 | 1003 | |
| 932 | − cmd.cmd_common.header.type = DMUB_CMD__VBIOS; | |
| 933 | − cmd.cmd_common.header.sub_type = | |
| 1004 | + cmd.lvtma_control.header.type = DMUB_CMD__VBIOS; | |
| 1005 | + cmd.lvtma_control.header.sub_type = | |
| 934 | 1006 | DMUB_CMD__VBIOS_LVTMA_CONTROL; |
| 935 | − cmd.cmd_common.cmd_buffer[0] = | |
| 1007 | + cmd.lvtma_control.data.uc_pwr_action = | |
| 936 | 1008 | uc_pwr_on; |
| 937 | − | |
| 1009 | + cmd.lvtma_control.data.panel_inst = | |
| 1010 | + panel_instance; | |
| 938 | 1011 | dc_dmub_srv_cmd_queue(dmcub, &cmd); |
| 939 | 1012 | dc_dmub_srv_cmd_execute(dmcub); |
| 940 | 1013 | dc_dmub_srv_wait_idle(dmcub); |
| @@ -943,14 +1016,16 @@ static void enable_lvtma_control_dmcub( · 2 unmodified lines | ||
| 943 | 1016 | |
| 944 | 1017 | static enum bp_result enable_lvtma_control( |
| 945 | 1018 | struct bios_parser *bp, |
| 946 | − uint8_t uc_pwr_on) | |
| 1019 | + uint8_t uc_pwr_on, | |
| 1020 | + uint8_t panel_instance) | |
| 947 | 1021 | { |
| 948 | 1022 | enum bp_result result = BP_RESULT_FAILURE; |
| 949 | 1023 | |
| 950 | 1024 | if (bp->base.ctx->dc->ctx->dmub_srv && |
| 951 | 1025 | bp->base.ctx->dc->debug.dmub_command_table) { |
| 952 | 1026 | enable_lvtma_control_dmcub(bp->base.ctx->dmub_srv, |
| 953 | − uc_pwr_on); | |
| 1027 | + uc_pwr_on, | |
| 1028 | + panel_instance); | |
| 954 | 1029 | return BP_RESULT_OK; |
| 955 | 1030 | } |
| 956 | 1031 | return result; |
| @@ -95,7 +95,8 @@ struct cmd_tbl { · 94 unmodified lines | ||
| 95 | 95 | unsigned int (*get_smu_clock_info)( |
| 96 | 96 | struct bios_parser *bp, uint8_t id); |
| 97 | 97 | enum bp_result (*enable_lvtma_control)(struct bios_parser *bp, |
| 98 | − uint8_t uc_pwr_on); | |
| 98 | + uint8_t uc_pwr_on, | |
| 99 | + uint8_t panel_instance); | |
| 99 | 100 | }; |
| 100 | 101 | |
| 101 | 102 | void dal_firmware_parser_init_cmd_tbl(struct bios_parser *bp); |
| @@ -87,12 +87,16 @@ int clk_mgr_helper_get_active_plane_cnt( · 86 unmodified lines | ||
| 87 | 87 | |
| 88 | 88 | void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_mgr) |
| 89 | 89 | { |
| 90 | − struct dc_link *edp_link = get_edp_link(dc); | |
| 90 | + struct dc_link *edp_links[MAX_NUM_EDP]; | |
| 91 | + struct dc_link *edp_link = NULL; | |
| 92 | + int edp_num; | |
| 91 | 93 | |
| 94 | + get_edp_links(dc, edp_links, &edp_num); | |
| 92 | 95 | if (dc->hwss.exit_optimized_pwr_state) |
| 93 | 96 | dc->hwss.exit_optimized_pwr_state(dc, dc->current_state); |
| 94 | 97 | |
| 95 | − if (edp_link) { | |
| 98 | + if (edp_num) { | |
| 99 | + edp_link = edp_links[0]; | |
| 96 | 100 | clk_mgr->psr_allow_active_cache = edp_link->psr_settings.psr_allow_active; |
| 97 | 101 | dc_link_set_psr_allow_active(edp_link, false, false, false); |
| 98 | 102 | } |
| @@ -101,11 +105,16 @@ void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_m · 2 unmodified lines | ||
| 101 | 105 | |
| 102 | 106 | void clk_mgr_optimize_pwr_state(const struct dc *dc, struct clk_mgr *clk_mgr) |
| 103 | 107 | { |
| 104 | − struct dc_link *edp_link = get_edp_link(dc); | |
| 108 | + struct dc_link *edp_links[MAX_NUM_EDP]; | |
| 109 | + struct dc_link *edp_link = NULL; | |
| 110 | + int edp_num; | |
| 105 | 111 | |
| 106 | − if (edp_link) | |
| 112 | + get_edp_links(dc, edp_links, &edp_num); | |
| 113 | + if (edp_num) { | |
| 114 | + edp_link = edp_links[0]; | |
| 107 | 115 | dc_link_set_psr_allow_active(edp_link, |
| 108 | 116 | clk_mgr->psr_allow_active_cache, false, false); |
| 117 | + } | |
| 109 | 118 | |
| 110 | 119 | if (dc->hwss.optimize_pwr_state) |
| 111 | 120 | dc->hwss.optimize_pwr_state(dc, dc->current_state); |
| @@ -361,7 +361,7 @@ void dcn2_read_clocks_from_hw_dentist(struct clk_mgr *clk_mgr_base) · 360 unmodified lines | ||
| 361 | 361 | REG_GET(DENTIST_DISPCLK_CNTL, DENTIST_DPPCLK_WDIVIDER, &dppclk_wdivider); |
| 362 | 362 | |
| 363 | 363 | disp_divider = dentist_get_divider_from_did(dispclk_wdivider); |
| 364 | − dpp_divider = dentist_get_divider_from_did(dispclk_wdivider); | |
| 364 | + dpp_divider = dentist_get_divider_from_did(dppclk_wdivider); | |
| 365 | 365 | |
| 366 | 366 | if (disp_divider && dpp_divider) { |
| 367 | 367 | /* Calculate the current DFS clock, in kHz.*/ |
| @@ -252,6 +252,7 @@ static void dcn3_update_clocks(struct clk_mgr *clk_mgr_base, · 251 unmodified lines | ||
| 252 | 252 | bool force_reset = false; |
| 253 | 253 | bool update_uclk = false; |
| 254 | 254 | bool p_state_change_support; |
| 255 | + int total_plane_count; | |
| 255 | 256 | |
| 256 | 257 | if (dc->work_arounds.skip_clock_update || !clk_mgr->smu_present) |
| 257 | 258 | return; |
| @@ -292,7 +293,8 @@ static void dcn3_update_clocks(struct clk_mgr *clk_mgr_base, · 34 unmodified lines | ||
| 292 | 293 | clk_mgr_base->clks.socclk_khz = new_clocks->socclk_khz; |
| 293 | 294 | |
| 294 | 295 | clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support; |
| 295 | − p_state_change_support = new_clocks->p_state_change_support || (display_count == 0); | |
| 296 | + total_plane_count = clk_mgr_helper_get_active_plane_cnt(dc, context); | |
| 297 | + p_state_change_support = new_clocks->p_state_change_support || (total_plane_count == 0); | |
| 296 | 298 | if (should_update_pstate_support(safe_to_lower, p_state_change_support, clk_mgr_base->clks.p_state_change_support)) { |
| 297 | 299 | clk_mgr_base->clks.p_state_change_support = p_state_change_support; |
| 298 | 300 | |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | ||
| 41 | 41 | #include "dc_bios_types.h" |
| 42 | 42 | |
| 43 | 43 | #include "bios_parser_interface.h" |
| 44 | +#include "bios/bios_parser_helper.h" | |
| 44 | 45 | #include "include/irq_service_interface.h" |
| 45 | 46 | #include "transform.h" |
| 46 | 47 | #include "dmcu.h" |
| @@ -68,6 +69,7 @@ · 21 unmodified lines | ||
| 68 | 69 | |
| 69 | 70 | #include "dmub/dmub_srv.h" |
| 70 | 71 | |
| 72 | +#include "i2caux_interface.h" | |
| 71 | 73 | #include "dce/dmub_hw_lock_mgr.h" |
| 72 | 74 | |
| 73 | 75 | #include "dc_trace.h" |
| @@ -163,6 +165,18 @@ static uint32_t get_num_of_internal_disp(struct dc_link **links, uint32_t num_li · 89 unmodified lines | ||
| 163 | 165 | return count; |
| 164 | 166 | } |
| 165 | 167 | |
| 168 | +static int get_seamless_boot_stream_count(struct dc_state *ctx) | |
| 169 | +{ | |
| 170 | + uint8_t i; | |
| 171 | + uint8_t seamless_boot_stream_count = 0; | |
| 172 | + | |
| 173 | + for (i = 0; i < ctx->stream_count; i++) | |
| 174 | + if (ctx->streams[i]->apply_seamless_boot_optimization) | |
| 175 | + seamless_boot_stream_count++; | |
| 176 | + | |
| 177 | + return seamless_boot_stream_count; | |
| 178 | +} | |
| 179 | + | |
| 166 | 180 | static bool create_links( |
| 167 | 181 | struct dc *dc, |
| 168 | 182 | uint32_t num_virtual_links) |
| @@ -334,6 +348,88 @@ bool dc_stream_get_crtc_position(struct dc *dc, · 165 unmodified lines | ||
| 334 | 348 | return ret; |
| 335 | 349 | } |
| 336 | 350 | |
| 351 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 352 | +bool dc_stream_forward_dmcu_crc_window(struct dc *dc, struct dc_stream_state *stream, | |
| 353 | + struct crc_params *crc_window) | |
| 354 | +{ | |
| 355 | + int i; | |
| 356 | + struct dmcu *dmcu = dc->res_pool->dmcu; | |
| 357 | + struct pipe_ctx *pipe; | |
| 358 | + struct crc_region tmp_win, *crc_win; | |
| 359 | + struct otg_phy_mux mapping_tmp, *mux_mapping; | |
| 360 | + | |
| 361 | + /*crc window can't be null*/ | |
| 362 | + if (!crc_window) | |
| 363 | + return false; | |
| 364 | + | |
| 365 | + if ((dmcu != NULL && dmcu->funcs->is_dmcu_initialized(dmcu))) { | |
| 366 | + crc_win = &tmp_win; | |
| 367 | + mux_mapping = &mapping_tmp; | |
| 368 | + /*set crc window*/ | |
| 369 | + tmp_win.x_start = crc_window->windowa_x_start; | |
| 370 | + tmp_win.y_start = crc_window->windowa_y_start; | |
| 371 | + tmp_win.x_end = crc_window->windowa_x_end; | |
| 372 | + tmp_win.y_end = crc_window->windowa_y_end; | |
| 373 | + | |
| 374 | + for (i = 0; i < MAX_PIPES; i++) { | |
| 375 | + pipe = &dc->current_state->res_ctx.pipe_ctx[i]; | |
| 376 | + if (pipe->stream == stream && !pipe->top_pipe && !pipe->prev_odm_pipe) | |
| 377 | + break; | |
| 378 | + } | |
| 379 | + | |
| 380 | + /* Stream not found */ | |
| 381 | + if (i == MAX_PIPES) | |
| 382 | + return false; | |
| 383 | + | |
| 384 | + | |
| 385 | + /*set mux routing info*/ | |
| 386 | + mapping_tmp.phy_output_num = stream->link->link_enc_hw_inst; | |
| 387 | + mapping_tmp.otg_output_num = pipe->stream_res.tg->inst; | |
| 388 | + | |
| 389 | + dmcu->funcs->forward_crc_window(dmcu, crc_win, mux_mapping); | |
| 390 | + } else { | |
| 391 | + DC_LOG_DC("dmcu is not initialized"); | |
| 392 | + return false; | |
| 393 | + } | |
| 394 | + | |
| 395 | + return true; | |
| 396 | +} | |
| 397 | + | |
| 398 | +bool dc_stream_stop_dmcu_crc_win_update(struct dc *dc, struct dc_stream_state *stream) | |
| 399 | +{ | |
| 400 | + int i; | |
| 401 | + struct dmcu *dmcu = dc->res_pool->dmcu; | |
| 402 | + struct pipe_ctx *pipe; | |
| 403 | + struct otg_phy_mux mapping_tmp, *mux_mapping; | |
| 404 | + | |
| 405 | + if ((dmcu != NULL && dmcu->funcs->is_dmcu_initialized(dmcu))) { | |
| 406 | + mux_mapping = &mapping_tmp; | |
| 407 | + | |
| 408 | + for (i = 0; i < MAX_PIPES; i++) { | |
| 409 | + pipe = &dc->current_state->res_ctx.pipe_ctx[i]; | |
| 410 | + if (pipe->stream == stream && !pipe->top_pipe && !pipe->prev_odm_pipe) | |
| 411 | + break; | |
| 412 | + } | |
| 413 | + | |
| 414 | + /* Stream not found */ | |
| 415 | + if (i == MAX_PIPES) | |
| 416 | + return false; | |
| 417 | + | |
| 418 | + | |
| 419 | + /*set mux routing info*/ | |
| 420 | + mapping_tmp.phy_output_num = stream->link->link_enc_hw_inst; | |
| 421 | + mapping_tmp.otg_output_num = pipe->stream_res.tg->inst; | |
| 422 | + | |
| 423 | + dmcu->funcs->stop_crc_win_update(dmcu, mux_mapping); | |
| 424 | + } else { | |
| 425 | + DC_LOG_DC("dmcu is not initialized"); | |
| 426 | + return false; | |
| 427 | + } | |
| 428 | + | |
| 429 | + return true; | |
| 430 | +} | |
| 431 | +#endif | |
| 432 | + | |
| 337 | 433 | /** |
| 338 | 434 | * dc_stream_configure_crc() - Configure CRC capture for the given stream. |
| 339 | 435 | * @dc: DC Object |
| @@ -970,7 +1066,6 @@ struct dc *dc_create(const struct dc_init_data *init_params) · 630 unmodified lines | ||
| 970 | 1066 | full_pipe_count, |
| 971 | 1067 | dc->res_pool->stream_enc_count); |
| 972 | 1068 | |
| 973 | − dc->optimize_seamless_boot_streams = 0; | |
| 974 | 1069 | dc->caps.max_links = dc->link_count; |
| 975 | 1070 | dc->caps.max_audios = dc->res_pool->audio_count; |
| 976 | 1071 | dc->caps.linear_pitch_alignment = 64; |
| @@ -1000,22 +1095,25 @@ destruct_dc: · 23 unmodified lines | ||
| 1000 | 1095 | |
| 1001 | 1096 | static void detect_edp_presence(struct dc *dc) |
| 1002 | 1097 | { |
| 1003 | − struct dc_link *edp_link = get_edp_link(dc); | |
| 1004 | − bool edp_sink_present = true; | |
| 1098 | + struct dc_link *edp_links[MAX_NUM_EDP]; | |
| 1099 | + struct dc_link *edp_link = NULL; | |
| 1100 | + enum dc_connection_type type; | |
| 1101 | + int i; | |
| 1102 | + int edp_num; | |
| 1005 | 1103 | |
| 1006 | − if (!edp_link) | |
| 1104 | + get_edp_links(dc, edp_links, &edp_num); | |
| 1105 | + if (!edp_num) | |
| 1007 | 1106 | return; |
| 1008 | 1107 | |
| 1009 | − if (dc->config.edp_not_connected) { | |
| 1010 | − edp_sink_present = false; | |
| 1011 | − } else { | |
| 1012 | − enum dc_connection_type type; | |
| 1013 | − dc_link_detect_sink(edp_link, &type); | |
| 1014 | − if (type == dc_connection_none) | |
| 1015 | − edp_sink_present = false; | |
| 1108 | + for (i = 0; i < edp_num; i++) { | |
| 1109 | + edp_link = edp_links[i]; | |
| 1110 | + if (dc->config.edp_not_connected) { | |
| 1111 | + edp_link->edp_sink_present = false; | |
| 1112 | + } else { | |
| 1113 | + dc_link_detect_sink(edp_link, &type); | |
| 1114 | + edp_link->edp_sink_present = (type != dc_connection_none); | |
| 1115 | + } | |
| 1016 | 1116 | } |
| 1017 | − | |
| 1018 | − edp_link->edp_sink_present = edp_sink_present; | |
| 1019 | 1117 | } |
| 1020 | 1118 | |
| 1021 | 1119 | void dc_hardware_init(struct dc *dc) |
| @@ -1091,6 +1189,7 @@ static void program_timing_sync( · 69 unmodified lines | ||
| 1091 | 1189 | |
| 1092 | 1190 | for (i = 0; i < pipe_count; i++) { |
| 1093 | 1191 | int group_size = 1; |
| 1192 | + enum timing_synchronization_type sync_type = NOT_SYNCHRONIZABLE; | |
| 1094 | 1193 | struct pipe_ctx *pipe_set[MAX_PIPES]; |
| 1095 | 1194 | |
| 1096 | 1195 | if (!unsynced_pipes[i]) |
| @@ -1105,10 +1204,22 @@ static void program_timing_sync( · 8 unmodified lines | ||
| 1105 | 1204 | for (j = i + 1; j < pipe_count; j++) { |
| 1106 | 1205 | if (!unsynced_pipes[j]) |
| 1107 | 1206 | continue; |
| 1108 | − | |
| 1109 | − if (resource_are_streams_timing_synchronizable( | |
| 1207 | + if (sync_type != TIMING_SYNCHRONIZABLE && | |
| 1208 | + dc->hwss.enable_vblanks_synchronization && | |
| 1209 | + unsynced_pipes[j]->stream_res.tg->funcs->align_vblanks && | |
| 1210 | + resource_are_vblanks_synchronizable( | |
| 1211 | + unsynced_pipes[j]->stream, | |
| 1212 | + pipe_set[0]->stream)) { | |
| 1213 | + sync_type = VBLANK_SYNCHRONIZABLE; | |
| 1214 | + pipe_set[group_size] = unsynced_pipes[j]; | |
| 1215 | + unsynced_pipes[j] = NULL; | |
| 1216 | + group_size++; | |
| 1217 | + } else | |
| 1218 | + if (sync_type != VBLANK_SYNCHRONIZABLE && | |
| 1219 | + resource_are_streams_timing_synchronizable( | |
| 1110 | 1220 | unsynced_pipes[j]->stream, |
| 1111 | 1221 | pipe_set[0]->stream)) { |
| 1222 | + sync_type = TIMING_SYNCHRONIZABLE; | |
| 1112 | 1223 | pipe_set[group_size] = unsynced_pipes[j]; |
| 1113 | 1224 | unsynced_pipes[j] = NULL; |
| 1114 | 1225 | group_size++; |
| @@ -1134,7 +1245,6 @@ static void program_timing_sync( · 19 unmodified lines | ||
| 1134 | 1245 | } |
| 1135 | 1246 | } |
| 1136 | 1247 | |
| 1137 | − | |
| 1138 | 1248 | for (k = 0; k < group_size; k++) { |
| 1139 | 1249 | struct dc_stream_status *status = dc_stream_get_status_from_state(ctx, pipe_set[k]->stream); |
| 1140 | 1250 | |
| @@ -1164,8 +1274,14 @@ static void program_timing_sync( · 23 unmodified lines | ||
| 1164 | 1274 | } |
| 1165 | 1275 | |
| 1166 | 1276 | if (group_size > 1) { |
| 1167 | − dc->hwss.enable_timing_synchronization( | |
| 1168 | − dc, group_index, group_size, pipe_set); | |
| 1277 | + if (sync_type == TIMING_SYNCHRONIZABLE) { | |
| 1278 | + dc->hwss.enable_timing_synchronization( | |
| 1279 | + dc, group_index, group_size, pipe_set); | |
| 1280 | + } else | |
| 1281 | + if (sync_type == VBLANK_SYNCHRONIZABLE) { | |
| 1282 | + dc->hwss.enable_vblanks_synchronization( | |
| 1283 | + dc, group_index, group_size, pipe_set); | |
| 1284 | + } | |
| 1169 | 1285 | group_index++; |
| 1170 | 1286 | } |
| 1171 | 1287 | num_group++; |
| @@ -1202,8 +1318,9 @@ bool dc_validate_seamless_boot_timing(const struct dc *dc, · 30 unmodified lines | ||
| 1202 | 1318 | unsigned int i, enc_inst, tg_inst = 0; |
| 1203 | 1319 | |
| 1204 | 1320 | // Seamless port only support single DP and EDP so far |
| 1205 | − if (sink->sink_signal != SIGNAL_TYPE_DISPLAY_PORT && | |
| 1206 | − sink->sink_signal != SIGNAL_TYPE_EDP) | |
| 1321 | + if ((sink->sink_signal != SIGNAL_TYPE_DISPLAY_PORT && | |
| 1322 | + sink->sink_signal != SIGNAL_TYPE_EDP) || | |
| 1323 | + sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT_MST) | |
| 1207 | 1324 | return false; |
| 1208 | 1325 | |
| 1209 | 1326 | /* Check for enabled DIG to identify enabled display */ |
| @@ -1377,11 +1494,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c · 167 unmodified lines | ||
| 1377 | 1494 | dc->hwss.enable_accelerated_mode(dc, context); |
| 1378 | 1495 | } |
| 1379 | 1496 | |
| 1380 | − for (i = 0; i < context->stream_count; i++) | |
| 1381 | − if (context->streams[i]->apply_seamless_boot_optimization) | |
| 1382 | − dc->optimize_seamless_boot_streams++; | |
| 1383 | − | |
| 1384 | − if (context->stream_count > dc->optimize_seamless_boot_streams || | |
| 1497 | + if (context->stream_count > get_seamless_boot_stream_count(context) || | |
| 1385 | 1498 | context->stream_count == 0) |
| 1386 | 1499 | dc->hwss.prepare_bandwidth(dc, context); |
| 1387 | 1500 | |
| @@ -1464,7 +1577,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c · 76 unmodified lines | ||
| 1464 | 1577 | |
| 1465 | 1578 | dc_enable_stereo(dc, context, dc_streams, context->stream_count); |
| 1466 | 1579 | |
| 1467 | − if (context->stream_count > dc->optimize_seamless_boot_streams || | |
| 1580 | + if (context->stream_count > get_seamless_boot_stream_count(context) || | |
| 1468 | 1581 | context->stream_count == 0) { |
| 1469 | 1582 | /* Must wait for no flips to be pending before doing optimize bw */ |
| 1470 | 1583 | wait_for_no_pipes_pending(dc, context); |
| @@ -1578,7 +1691,7 @@ void dc_post_update_surfaces_to_stream(struct dc *dc) · 107 unmodified lines | ||
| 1578 | 1691 | int i; |
| 1579 | 1692 | struct dc_state *context = dc->current_state; |
| 1580 | 1693 | |
| 1581 | − if ((!dc->optimized_required) || dc->optimize_seamless_boot_streams > 0) | |
| 1694 | + if ((!dc->optimized_required) || get_seamless_boot_stream_count(context) > 0) | |
| 1582 | 1695 | return; |
| 1583 | 1696 | |
| 1584 | 1697 | post_surface_trace(dc); |
| @@ -2277,8 +2390,6 @@ static void copy_stream_update_to_stream(struct dc *dc, · 692 unmodified lines | ||
| 2277 | 2390 | if (update->dither_option) |
| 2278 | 2391 | stream->dither_option = *update->dither_option; |
| 2279 | 2392 | |
| 2280 | − if (update->pending_test_pattern) | |
| 2281 | − stream->test_pattern = *update->pending_test_pattern; | |
| 2282 | 2393 | /* update current stream with writeback info */ |
| 2283 | 2394 | if (update->wb_update) { |
| 2284 | 2395 | int i; |
| @@ -2324,7 +2435,6 @@ static void commit_planes_do_stream_update(struct dc *dc, · 39 unmodified lines | ||
| 2324 | 2435 | struct dc_state *context) |
| 2325 | 2436 | { |
| 2326 | 2437 | int j; |
| 2327 | − bool should_program_abm; | |
| 2328 | 2438 | |
| 2329 | 2439 | // Stream updates |
| 2330 | 2440 | for (j = 0; j < dc->res_pool->pipe_count; j++) { |
| @@ -2375,15 +2485,6 @@ static void commit_planes_do_stream_update(struct dc *dc, · 44 unmodified lines | ||
| 2375 | 2485 | } |
| 2376 | 2486 | } |
| 2377 | 2487 | |
| 2378 | − if (stream_update->pending_test_pattern) { | |
| 2379 | − dc_link_dp_set_test_pattern(stream->link, | |
| 2380 | − stream->test_pattern.type, | |
| 2381 | − stream->test_pattern.color_space, | |
| 2382 | − stream->test_pattern.p_link_settings, | |
| 2383 | − stream->test_pattern.p_custom_pattern, | |
| 2384 | − stream->test_pattern.cust_pattern_size); | |
| 2385 | − } | |
| 2386 | − | |
| 2387 | 2488 | /* Full fe update*/ |
| 2388 | 2489 | if (update_type == UPDATE_TYPE_FAST) |
| 2389 | 2490 | continue; |
| @@ -2398,9 +2499,10 @@ static void commit_planes_do_stream_update(struct dc *dc, · 8 unmodified lines | ||
| 2398 | 2499 | if (pipe_ctx->stream_res.audio && !dc->debug.az_endpoint_mute_only) |
| 2399 | 2500 | pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio); |
| 2400 | 2501 | |
| 2401 | − dc->hwss.optimize_bandwidth(dc, dc->current_state); | |
| 2502 | + dc->optimized_required = true; | |
| 2503 | + | |
| 2402 | 2504 | } else { |
| 2403 | − if (dc->optimize_seamless_boot_streams == 0) | |
| 2505 | + if (get_seamless_boot_stream_count(context) == 0) | |
| 2404 | 2506 | dc->hwss.prepare_bandwidth(dc, dc->current_state); |
| 2405 | 2507 | |
| 2406 | 2508 | core_link_enable_stream(dc->current_state, pipe_ctx); |
| @@ -2408,7 +2510,7 @@ static void commit_planes_do_stream_update(struct dc *dc, · 1 unmodified line | ||
| 2408 | 2510 | } |
| 2409 | 2511 | |
| 2410 | 2512 | if (stream_update->abm_level && pipe_ctx->stream_res.abm) { |
| 2411 | − should_program_abm = true; | |
| 2513 | + bool should_program_abm = true; | |
| 2412 | 2514 | |
| 2413 | 2515 | // if otg funcs defined check if blanked before programming |
| 2414 | 2516 | if (pipe_ctx->stream_res.tg->funcs->is_blanked) |
| @@ -2439,7 +2541,7 @@ static void commit_planes_for_stream(struct dc *dc, · 24 unmodified lines | ||
| 2439 | 2541 | int i, j; |
| 2440 | 2542 | struct pipe_ctx *top_pipe_to_program = NULL; |
| 2441 | 2543 | |
| 2442 | − if (dc->optimize_seamless_boot_streams > 0 && surface_count > 0) { | |
| 2544 | + if (get_seamless_boot_stream_count(context) > 0 && surface_count > 0) { | |
| 2443 | 2545 | /* Optimize seamless boot flag keeps clocks and watermarks high until |
| 2444 | 2546 | * first flip. After first flip, optimization is required to lower |
| 2445 | 2547 | * bandwidth. Important to note that it is expected UEFI will |
| @@ -2448,9 +2550,8 @@ static void commit_planes_for_stream(struct dc *dc, · 2 unmodified lines | ||
| 2448 | 2550 | */ |
| 2449 | 2551 | if (stream->apply_seamless_boot_optimization) { |
| 2450 | 2552 | stream->apply_seamless_boot_optimization = false; |
| 2451 | − dc->optimize_seamless_boot_streams--; | |
| 2452 | 2553 | |
| 2453 | − if (dc->optimize_seamless_boot_streams == 0) | |
| 2554 | + if (get_seamless_boot_stream_count(context) == 0) | |
| 2454 | 2555 | dc->optimized_required = true; |
| 2455 | 2556 | } |
| 2456 | 2557 | } |
| @@ -2460,7 +2561,7 @@ static void commit_planes_for_stream(struct dc *dc, · 3 unmodified lines | ||
| 2460 | 2561 | dc_allow_idle_optimizations(dc, false); |
| 2461 | 2562 | |
| 2462 | 2563 | #endif |
| 2463 | − if (dc->optimize_seamless_boot_streams == 0) | |
| 2564 | + if (get_seamless_boot_stream_count(context) == 0) | |
| 2464 | 2565 | dc->hwss.prepare_bandwidth(dc, context); |
| 2465 | 2566 | |
| 2466 | 2567 | context_clock_trace(dc, context); |
| @@ -2868,6 +2969,9 @@ void dc_set_power_state( · 401 unmodified lines | ||
| 2868 | 2969 | struct kref refcount; |
| 2869 | 2970 | struct display_mode_lib *dml; |
| 2870 | 2971 | |
| 2972 | + if (!dc->current_state) | |
| 2973 | + return; | |
| 2974 | + | |
| 2871 | 2975 | switch (power_state) { |
| 2872 | 2976 | case DC_ACPI_CM_POWER_STATE_D0: |
| 2873 | 2977 | dc_resource_state_construct(dc, dc->current_state); |
| @@ -3176,3 +3280,113 @@ void dc_hardware_release(struct dc *dc) · 302 unmodified lines | ||
| 3176 | 3280 | dc->hwss.hardware_release(dc); |
| 3177 | 3281 | } |
| 3178 | 3282 | #endif |
| 3283 | + | |
| 3284 | +/** | |
| 3285 | + ***************************************************************************** | |
| 3286 | + * Function: dc_enable_dmub_notifications | |
| 3287 | + * | |
| 3288 | + * @brief | |
| 3289 | + * Returns whether dmub notification can be enabled | |
| 3290 | + * | |
| 3291 | + * @param | |
| 3292 | + * [in] dc: dc structure | |
| 3293 | + * | |
| 3294 | + * @return | |
| 3295 | + * True to enable dmub notifications, False otherwise | |
| 3296 | + ***************************************************************************** | |
| 3297 | + */ | |
| 3298 | +bool dc_enable_dmub_notifications(struct dc *dc) | |
| 3299 | +{ | |
| 3300 | + /* dmub aux needs dmub notifications to be enabled */ | |
| 3301 | + return dc->debug.enable_dmub_aux_for_legacy_ddc; | |
| 3302 | +} | |
| 3303 | + | |
| 3304 | +/** | |
| 3305 | + ***************************************************************************** | |
| 3306 | + * Function: dc_process_dmub_aux_transfer_async | |
| 3307 | + * | |
| 3308 | + * @brief | |
| 3309 | + * Submits aux command to dmub via inbox message | |
| 3310 | + * Sets port index appropriately for legacy DDC | |
| 3311 | + * | |
| 3312 | + * @param | |
| 3313 | + * [in] dc: dc structure | |
| 3314 | + * [in] link_index: link index | |
| 3315 | + * [in] payload: aux payload | |
| 3316 | + * | |
| 3317 | + * @return | |
| 3318 | + * True if successful, False if failure | |
| 3319 | + ***************************************************************************** | |
| 3320 | + */ | |
| 3321 | +bool dc_process_dmub_aux_transfer_async(struct dc *dc, | |
| 3322 | + uint32_t link_index, | |
| 3323 | + struct aux_payload *payload) | |
| 3324 | +{ | |
| 3325 | + uint8_t action; | |
| 3326 | + union dmub_rb_cmd cmd = {0}; | |
| 3327 | + struct dc_dmub_srv *dmub_srv = dc->ctx->dmub_srv; | |
| 3328 | + | |
| 3329 | + ASSERT(payload->length <= 16); | |
| 3330 | + | |
| 3331 | + cmd.dp_aux_access.header.type = DMUB_CMD__DP_AUX_ACCESS; | |
| 3332 | + cmd.dp_aux_access.header.payload_bytes = 0; | |
| 3333 | + cmd.dp_aux_access.aux_control.type = AUX_CHANNEL_LEGACY_DDC; | |
| 3334 | + cmd.dp_aux_access.aux_control.instance = dc->links[link_index]->ddc_hw_inst; | |
| 3335 | + cmd.dp_aux_access.aux_control.sw_crc_enabled = 0; | |
| 3336 | + cmd.dp_aux_access.aux_control.timeout = 0; | |
| 3337 | + cmd.dp_aux_access.aux_control.dpaux.address = payload->address; | |
| 3338 | + cmd.dp_aux_access.aux_control.dpaux.is_i2c_over_aux = payload->i2c_over_aux; | |
| 3339 | + cmd.dp_aux_access.aux_control.dpaux.length = payload->length; | |
| 3340 | + | |
| 3341 | + /* set aux action */ | |
| 3342 | + if (payload->i2c_over_aux) { | |
| 3343 | + if (payload->write) { | |
| 3344 | + if (payload->mot) | |
| 3345 | + action = DP_AUX_REQ_ACTION_I2C_WRITE_MOT; | |
| 3346 | + else | |
| 3347 | + action = DP_AUX_REQ_ACTION_I2C_WRITE; | |
| 3348 | + } else { | |
| 3349 | + if (payload->mot) | |
| 3350 | + action = DP_AUX_REQ_ACTION_I2C_READ_MOT; | |
| 3351 | + else | |
| 3352 | + action = DP_AUX_REQ_ACTION_I2C_READ; | |
| 3353 | + } | |
| 3354 | + } else { | |
| 3355 | + if (payload->write) | |
| 3356 | + action = DP_AUX_REQ_ACTION_DPCD_WRITE; | |
| 3357 | + else | |
| 3358 | + action = DP_AUX_REQ_ACTION_DPCD_READ; | |
| 3359 | + } | |
| 3360 | + | |
| 3361 | + cmd.dp_aux_access.aux_control.dpaux.action = action; | |
| 3362 | + | |
| 3363 | + if (payload->length && payload->write) { | |
| 3364 | + memcpy(cmd.dp_aux_access.aux_control.dpaux.data, | |
| 3365 | + payload->data, | |
| 3366 | + payload->length | |
| 3367 | + ); | |
| 3368 | + } | |
| 3369 | + | |
| 3370 | + dc_dmub_srv_cmd_queue(dmub_srv, &cmd); | |
| 3371 | + dc_dmub_srv_cmd_execute(dmub_srv); | |
| 3372 | + dc_dmub_srv_wait_idle(dmub_srv); | |
| 3373 | + | |
| 3374 | + return true; | |
| 3375 | +} | |
| 3376 | + | |
| 3377 | +/** | |
| 3378 | + ***************************************************************************** | |
| 3379 | + * Function: dc_disable_accelerated_mode | |
| 3380 | + * | |
| 3381 | + * @brief | |
| 3382 | + * disable accelerated mode | |
| 3383 | + * | |
| 3384 | + * @param | |
| 3385 | + * [in] dc: dc structure | |
| 3386 | + * | |
| 3387 | + ***************************************************************************** | |
| 3388 | + */ | |
| 3389 | +void dc_disable_accelerated_mode(struct dc *dc) | |
| 3390 | +{ | |
| 3391 | + bios_set_scratch_acc_mode_change(dc->ctx->dc_bios, 0); | |
| 3392 | +} | |
| @@ -91,8 +91,14 @@ static void dc_link_destruct(struct dc_link *link) · 90 unmodified lines | ||
| 91 | 91 | if (link->panel_cntl) |
| 92 | 92 | link->panel_cntl->funcs->destroy(&link->panel_cntl); |
| 93 | 93 | |
| 94 | − if (link->link_enc) | |
| 94 | + if (link->link_enc) { | |
| 95 | + /* Update link encoder tracking variables. These are used for the dynamic | |
| 96 | + * assignment of link encoders to streams. | |
| 97 | + */ | |
| 98 | + link->dc->res_pool->link_encoders[link->link_enc->preferred_engine] = NULL; | |
| 99 | + link->dc->res_pool->dig_link_enc_count--; | |
| 95 | 100 | link->link_enc->funcs->destroy(&link->link_enc); |
| 101 | + } | |
| 96 | 102 | |
| 97 | 103 | if (link->local_sink) |
| 98 | 104 | dc_sink_release(link->local_sink); |
| @@ -1500,7 +1506,7 @@ static bool dc_link_construct(struct dc_link *link, · 1401 unmodified lines | ||
| 1500 | 1506 | (link->link_id.id == CONNECTOR_ID_EDP || |
| 1501 | 1507 | link->link_id.id == CONNECTOR_ID_LVDS)) { |
| 1502 | 1508 | panel_cntl_init_data.ctx = dc_ctx; |
| 1503 | − panel_cntl_init_data.inst = 0; | |
| 1509 | + panel_cntl_init_data.inst = link->link_index; | |
| 1504 | 1510 | link->panel_cntl = |
| 1505 | 1511 | link->dc->res_pool->funcs->panel_cntl_create( |
| 1506 | 1512 | &panel_cntl_init_data); |
| @@ -1532,6 +1538,12 @@ static bool dc_link_construct(struct dc_link *link, · 25 unmodified lines | ||
| 1532 | 1538 | |
| 1533 | 1539 | DC_LOG_DC("BIOS object table - DP_IS_USB_C: %d", link->link_enc->features.flags.bits.DP_IS_USB_C); |
| 1534 | 1540 | |
| 1541 | + /* Update link encoder tracking variables. These are used for the dynamic | |
| 1542 | + * assignment of link encoders to streams. | |
| 1543 | + */ | |
| 1544 | + link->dc->res_pool->link_encoders[link->link_enc->preferred_engine] = link->link_enc; | |
| 1545 | + link->dc->res_pool->dig_link_enc_count++; | |
| 1546 | + | |
| 1535 | 1547 | link->link_enc_hw_inst = link->link_enc->transmitter; |
| 1536 | 1548 | |
| 1537 | 1549 | for (i = 0; i < 4; i++) { |
| @@ -1603,6 +1615,7 @@ static bool dc_link_construct(struct dc_link *link, · 65 unmodified lines | ||
| 1603 | 1615 | link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED; |
| 1604 | 1616 | |
| 1605 | 1617 | DC_LOG_DC("BIOS object table - %s finished successfully.\n", __func__); |
| 1618 | + kfree(info); | |
| 1606 | 1619 | return true; |
| 1607 | 1620 | device_tag_fail: |
| 1608 | 1621 | link->link_enc->funcs->destroy(&link->link_enc); |
| @@ -3257,6 +3270,16 @@ void core_link_enable_stream( · 1648 unmodified lines | ||
| 3257 | 3270 | /* Do not touch link on seamless boot optimization. */ |
| 3258 | 3271 | if (pipe_ctx->stream->apply_seamless_boot_optimization) { |
| 3259 | 3272 | pipe_ctx->stream->dpms_off = false; |
| 3273 | + | |
| 3274 | + /* Still enable stream features & audio on seamless boot for DP external displays */ | |
| 3275 | + if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT) { | |
| 3276 | + enable_stream_features(pipe_ctx); | |
| 3277 | + if (pipe_ctx->stream_res.audio != NULL) { | |
| 3278 | + pipe_ctx->stream_res.stream_enc->funcs->dp_audio_enable(pipe_ctx->stream_res.stream_enc); | |
| 3279 | + dc->hwss.enable_audio_stream(pipe_ctx); | |
| 3280 | + } | |
| 3281 | + } | |
| 3282 | + | |
| 3260 | 3283 | #if defined(CONFIG_DRM_AMD_DC_HDCP) |
| 3261 | 3284 | update_psp_stream_config(pipe_ctx, false); |
| 3262 | 3285 | #endif |
| @@ -3480,15 +3503,12 @@ uint32_t dc_bandwidth_in_kbps_from_timing( · 217 unmodified lines | ||
| 3480 | 3503 | { |
| 3481 | 3504 | uint32_t bits_per_channel = 0; |
| 3482 | 3505 | uint32_t kbps; |
| 3483 | − struct fixed31_32 link_bw_kbps; | |
| 3484 | 3506 | |
| 3507 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 3485 | 3508 | if (timing->flags.DSC) { |
| 3486 | − link_bw_kbps = dc_fixpt_from_int(timing->pix_clk_100hz); | |
| 3487 | − link_bw_kbps = dc_fixpt_div_int(link_bw_kbps, 160); | |
| 3488 | − link_bw_kbps = dc_fixpt_mul_int(link_bw_kbps, timing->dsc_cfg.bits_per_pixel); | |
| 3489 | − kbps = dc_fixpt_ceil(link_bw_kbps); | |
| 3490 | − return kbps; | |
| 3509 | + return dc_dsc_stream_bandwidth_in_kbps(timing->pix_clk_100hz, timing->dsc_cfg.bits_per_pixel); | |
| 3491 | 3510 | } |
| 3511 | +#endif | |
| 3492 | 3512 | |
| 3493 | 3513 | switch (timing->display_color_depth) { |
| 3494 | 3514 | case COLOR_DEPTH_666: |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "core_types.h" |
| 37 | 37 | #include "dc_link_ddc.h" |
| 38 | 38 | #include "dce/dce_aux.h" |
| 39 | +#include "dmub/inc/dmub_cmd.h" | |
| 39 | 40 | |
| 40 | 41 | #define DC_LOGGER_INIT(logger) |
| 41 | 42 | |
| @@ -558,7 +559,7 @@ bool dal_ddc_service_query_ddc_data( · 516 unmodified lines | ||
| 558 | 559 | /* should not set mot (middle of transaction) to 0 |
| 559 | 560 | * if there are pending read payloads |
| 560 | 561 | */ |
| 561 | − payload.mot = read_size == 0 ? false : true; | |
| 562 | + payload.mot = !(read_size == 0); | |
| 562 | 563 | payload.length = write_size; |
| 563 | 564 | payload.data = write_buf; |
| 564 | 565 | |
| @@ -655,7 +656,7 @@ bool dal_ddc_submit_aux_command(struct ddc_service *ddc, · 90 unmodified lines | ||
| 655 | 656 | */ |
| 656 | 657 | int dc_link_aux_transfer_raw(struct ddc_service *ddc, |
| 657 | 658 | struct aux_payload *payload, |
| 658 | − enum aux_channel_operation_result *operation_result) | |
| 659 | + enum aux_return_code_type *operation_result) | |
| 659 | 660 | { |
| 660 | 661 | return dce_aux_transfer_raw(ddc, payload, operation_result); |
| 661 | 662 | } |
| @@ -1669,6 +1669,22 @@ bool perform_link_training_with_retries( · 1668 unmodified lines | ||
| 1669 | 1669 | msleep(delay_dp_power_up_in_ms); |
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | +#ifdef CONFIG_DRM_AMD_DC_HDCP | |
| 1673 | + if (panel_mode == DP_PANEL_MODE_EDP) { | |
| 1674 | + struct cp_psp *cp_psp = &stream->ctx->cp_psp; | |
| 1675 | + | |
| 1676 | + if (cp_psp && cp_psp->funcs.enable_assr) { | |
| 1677 | + if (!cp_psp->funcs.enable_assr(cp_psp->handle, link)) { | |
| 1678 | + /* since eDP implies ASSR on, change panel | |
| 1679 | + * mode to disable ASSR | |
| 1680 | + */ | |
| 1681 | + panel_mode = DP_PANEL_MODE_DEFAULT; | |
| 1682 | + } | |
| 1683 | + } else | |
| 1684 | + panel_mode = DP_PANEL_MODE_DEFAULT; | |
| 1685 | + } | |
| 1686 | +#endif | |
| 1687 | + | |
| 1672 | 1688 | dp_set_panel_mode(link, panel_mode); |
| 1673 | 1689 | |
| 1674 | 1690 | if (link->aux_access_disabled) { |
| @@ -4265,7 +4281,7 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode) · 2590 unmodified lines | ||
| 4265 | 4281 | |
| 4266 | 4282 | if (edp_config_set.bits.PANEL_MODE_EDP |
| 4267 | 4283 | != panel_mode_edp) { |
| 4268 | − enum dc_status result = DC_ERROR_UNEXPECTED; | |
| 4284 | + enum dc_status result; | |
| 4269 | 4285 | |
| 4270 | 4286 | edp_config_set.bits.PANEL_MODE_EDP = |
| 4271 | 4287 | panel_mode_edp; |
| @@ -417,6 +417,49 @@ int resource_get_clock_source_reference( · 416 unmodified lines | ||
| 417 | 417 | return -1; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | +bool resource_are_vblanks_synchronizable( | |
| 421 | + struct dc_stream_state *stream1, | |
| 422 | + struct dc_stream_state *stream2) | |
| 423 | +{ | |
| 424 | + uint32_t base60_refresh_rates[] = {10, 20, 5}; | |
| 425 | + uint8_t i; | |
| 426 | + uint8_t rr_count = sizeof(base60_refresh_rates)/sizeof(base60_refresh_rates[0]); | |
| 427 | + uint64_t frame_time_diff; | |
| 428 | + | |
| 429 | + if (stream1->ctx->dc->config.vblank_alignment_dto_params && | |
| 430 | + stream1->ctx->dc->config.vblank_alignment_max_frame_time_diff > 0 && | |
| 431 | + dc_is_dp_signal(stream1->signal) && | |
| 432 | + dc_is_dp_signal(stream2->signal) && | |
| 433 | + false == stream1->has_non_synchronizable_pclk && | |
| 434 | + false == stream2->has_non_synchronizable_pclk && | |
| 435 | + stream1->timing.flags.VBLANK_SYNCHRONIZABLE && | |
| 436 | + stream2->timing.flags.VBLANK_SYNCHRONIZABLE) { | |
| 437 | + /* disable refresh rates higher than 60Hz for now */ | |
| 438 | + if (stream1->timing.pix_clk_100hz*100/stream1->timing.h_total/ | |
| 439 | + stream1->timing.v_total > 60) | |
| 440 | + return false; | |
| 441 | + if (stream2->timing.pix_clk_100hz*100/stream2->timing.h_total/ | |
| 442 | + stream2->timing.v_total > 60) | |
| 443 | + return false; | |
| 444 | + frame_time_diff = (uint64_t)10000 * | |
| 445 | + stream1->timing.h_total * | |
| 446 | + stream1->timing.v_total * | |
| 447 | + stream2->timing.pix_clk_100hz; | |
| 448 | + frame_time_diff = div_u64(frame_time_diff, stream1->timing.pix_clk_100hz); | |
| 449 | + frame_time_diff = div_u64(frame_time_diff, stream2->timing.h_total); | |
| 450 | + frame_time_diff = div_u64(frame_time_diff, stream2->timing.v_total); | |
| 451 | + for (i = 0; i < rr_count; i++) { | |
| 452 | + int64_t diff = (int64_t)div_u64(frame_time_diff * base60_refresh_rates[i], 10) - 10000; | |
| 453 | + | |
| 454 | + if (diff < 0) | |
| 455 | + diff = -diff; | |
| 456 | + if (diff < stream1->ctx->dc->config.vblank_alignment_max_frame_time_diff) | |
| 457 | + return true; | |
| 458 | + } | |
| 459 | + } | |
| 460 | + return false; | |
| 461 | +} | |
| 462 | + | |
| 420 | 463 | bool resource_are_streams_timing_synchronizable( |
| 421 | 464 | struct dc_stream_state *stream1, |
| 422 | 465 | struct dc_stream_state *stream2) |
| @@ -0,0 +1,64 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + * Authors: AMD | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include "dc/dc_stat.h" | |
| 26 | +#include "dmub/dmub_srv_stat.h" | |
| 27 | +#include "dc_dmub_srv.h" | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * DOC: DC STAT Interface | |
| 31 | + * | |
| 32 | + * These interfaces are called without acquiring DAL and DC locks. | |
| 33 | + * Hence, there is limitations on whese interfaces can access. Only | |
| 34 | + * variables exclusively defined for these interfaces can be modified. | |
| 35 | + */ | |
| 36 | + | |
| 37 | +/** | |
| 38 | + ***************************************************************************** | |
| 39 | + * Function: dc_stat_get_dmub_notification | |
| 40 | + * | |
| 41 | + * @brief | |
| 42 | + * Calls dmub layer to retrieve dmub notification | |
| 43 | + * | |
| 44 | + * @param | |
| 45 | + * [in] dc: dc structure | |
| 46 | + * [in] notify: dmub notification structure | |
| 47 | + * | |
| 48 | + * @return | |
| 49 | + * None | |
| 50 | + ***************************************************************************** | |
| 51 | + */ | |
| 52 | +void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification *notify) | |
| 53 | +{ | |
| 54 | + /** | |
| 55 | + * This function is called without dal and dc locks, so | |
| 56 | + * we shall not modify any dc, dc_dmub_srv or dmub variables | |
| 57 | + * except variables exclusively accessed by this function | |
| 58 | + */ | |
| 59 | + struct dmub_srv *dmub = dc->ctx->dmub_srv->dmub; | |
| 60 | + enum dmub_status status; | |
| 61 | + | |
| 62 | + status = dmub_srv_stat_get_notification(dmub, notify); | |
| 63 | + ASSERT(status == DMUB_STATUS_OK); | |
| 64 | +} | |
| @@ -42,13 +42,17 @@ · 41 unmodified lines | ||
| 42 | 42 | #include "inc/hw/dmcu.h" |
| 43 | 43 | #include "dml/display_mode_lib.h" |
| 44 | 44 | |
| 45 | −#define DC_VER "3.2.122" | |
| 45 | +/* forward declaration */ | |
| 46 | +struct aux_payload; | |
| 47 | + | |
| 48 | +#define DC_VER "3.2.127" | |
| 46 | 49 | |
| 47 | 50 | #define MAX_SURFACES 3 |
| 48 | 51 | #define MAX_PLANES 6 |
| 49 | 52 | #define MAX_STREAMS 6 |
| 50 | 53 | #define MAX_SINKS_PER_LINK 4 |
| 51 | 54 | #define MIN_VIEWPORT_SIZE 12 |
| 55 | +#define MAX_NUM_EDP 2 | |
| 52 | 56 | |
| 53 | 57 | /******************************************************************************* |
| 54 | 58 | * Display Core Interfaces |
| @@ -151,6 +155,8 @@ struct dc_caps { · 96 unmodified lines | ||
| 151 | 155 | uint32_t max_links; |
| 152 | 156 | uint32_t max_audios; |
| 153 | 157 | uint32_t max_slave_planes; |
| 158 | + uint32_t max_slave_yuv_planes; | |
| 159 | + uint32_t max_slave_rgb_planes; | |
| 154 | 160 | uint32_t max_planes; |
| 155 | 161 | uint32_t max_downscale_ratio; |
| 156 | 162 | uint32_t i2c_speed_in_khz; |
| @@ -301,6 +307,8 @@ struct dc_config { · 144 unmodified lines | ||
| 301 | 307 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 302 | 308 | bool clamp_min_dcfclk; |
| 303 | 309 | #endif |
| 310 | + uint64_t vblank_alignment_dto_params; | |
| 311 | + uint8_t vblank_alignment_max_frame_time_diff; | |
| 304 | 312 | }; |
| 305 | 313 | |
| 306 | 314 | enum visual_confirm { |
| @@ -528,6 +536,10 @@ struct dc_debug_options { · 221 unmodified lines | ||
| 528 | 536 | bool disable_dsc; |
| 529 | 537 | bool enable_dram_clock_change_one_display_vactive; |
| 530 | 538 | union mem_low_power_enable_options enable_mem_low_power; |
| 539 | + bool force_vblank_alignment; | |
| 540 | + | |
| 541 | + /* Enable dmub aux for legacy ddc */ | |
| 542 | + bool enable_dmub_aux_for_legacy_ddc; | |
| 531 | 543 | }; |
| 532 | 544 | |
| 533 | 545 | struct dc_debug_data { |
| @@ -628,7 +640,6 @@ struct dc { · 94 unmodified lines | ||
| 628 | 640 | #endif |
| 629 | 641 | |
| 630 | 642 | /* Require to maintain clocks and bandwidth for UEFI enabled HW */ |
| 631 | − int optimize_seamless_boot_streams; | |
| 632 | 643 | |
| 633 | 644 | /* FBC compressor */ |
| 634 | 645 | struct compressor *fbc_compressor; |
| @@ -1292,8 +1303,20 @@ void dc_hardware_release(struct dc *dc); · 657 unmodified lines | ||
| 1292 | 1303 | |
| 1293 | 1304 | bool dc_set_psr_allow_active(struct dc *dc, bool enable); |
| 1294 | 1305 | |
| 1306 | +bool dc_enable_dmub_notifications(struct dc *dc); | |
| 1307 | + | |
| 1308 | +bool dc_process_dmub_aux_transfer_async(struct dc *dc, | |
| 1309 | + uint32_t link_index, | |
| 1310 | + struct aux_payload *payload); | |
| 1311 | + | |
| 1295 | 1312 | /******************************************************************************* |
| 1296 | 1313 | * DSC Interfaces |
| 1297 | 1314 | ******************************************************************************/ |
| 1298 | 1315 | #include "dc_dsc.h" |
| 1316 | + | |
| 1317 | +/******************************************************************************* | |
| 1318 | + * Disable acc mode Interfaces | |
| 1319 | + ******************************************************************************/ | |
| 1320 | +void dc_disable_accelerated_mode(struct dc *dc); | |
| 1321 | + | |
| 1299 | 1322 | #endif /* DC_INTERFACE_H_ */ |
| @@ -139,7 +139,8 @@ struct dc_vbios_funcs { · 138 unmodified lines | ||
| 139 | 139 | |
| 140 | 140 | enum bp_result (*enable_lvtma_control)( |
| 141 | 141 | struct dc_bios *bios, |
| 142 | − uint8_t uc_pwr_on); | |
| 142 | + uint8_t uc_pwr_on, | |
| 143 | + uint8_t panel_instance); | |
| 143 | 144 | |
| 144 | 145 | enum bp_result (*get_soc_bb_info)( |
| 145 | 146 | struct dc_bios *dcb, |
| @@ -44,16 +44,6 @@ enum i2caux_transaction_action { · 43 unmodified lines | ||
| 44 | 44 | I2CAUX_TRANSACTION_ACTION_DP_READ = 0x90 |
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | −enum aux_channel_operation_result { | |
| 48 | − AUX_CHANNEL_OPERATION_SUCCEEDED, | |
| 49 | − AUX_CHANNEL_OPERATION_FAILED_REASON_UNKNOWN, | |
| 50 | − AUX_CHANNEL_OPERATION_FAILED_INVALID_REPLY, | |
| 51 | − AUX_CHANNEL_OPERATION_FAILED_TIMEOUT, | |
| 52 | − AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON, | |
| 53 | − AUX_CHANNEL_OPERATION_FAILED_ENGINE_ACQUIRE | |
| 54 | −}; | |
| 55 | − | |
| 56 | − | |
| 57 | 47 | struct aux_request_transaction_data { |
| 58 | 48 | enum aux_transaction_type type; |
| 59 | 49 | enum i2caux_transaction_action action; |
| @@ -26,6 +26,10 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "dc.h" |
| 27 | 27 | #include "dc_dmub_srv.h" |
| 28 | 28 | #include "../dmub/dmub_srv.h" |
| 29 | +#include "dm_helpers.h" | |
| 30 | + | |
| 31 | +#define CTX dc_dmub_srv->ctx | |
| 32 | +#define DC_LOGGER CTX->logger | |
| 29 | 33 | |
| 30 | 34 | static void dc_dmub_srv_construct(struct dc_dmub_srv *dc_srv, struct dc *dc, |
| 31 | 35 | struct dmub_srv *dmub) |
| @@ -106,6 +110,25 @@ void dc_dmub_srv_wait_idle(struct dc_dmub_srv *dc_dmub_srv) · 74 unmodified lines | ||
| 106 | 110 | DC_ERROR("Error waiting for DMUB idle: status=%d\n", status); |
| 107 | 111 | } |
| 108 | 112 | |
| 113 | +bool dc_dmub_srv_cmd_with_reply_data(struct dc_dmub_srv *dc_dmub_srv, union dmub_rb_cmd *cmd) | |
| 114 | +{ | |
| 115 | + struct dmub_srv *dmub; | |
| 116 | + enum dmub_status status; | |
| 117 | + | |
| 118 | + if (!dc_dmub_srv || !dc_dmub_srv->dmub) | |
| 119 | + return false; | |
| 120 | + | |
| 121 | + dmub = dc_dmub_srv->dmub; | |
| 122 | + | |
| 123 | + status = dmub_srv_cmd_with_reply_data(dmub, cmd); | |
| 124 | + if (status != DMUB_STATUS_OK) { | |
| 125 | + DC_LOG_DEBUG("No reply for DMUB command: status=%d\n", status); | |
| 126 | + return false; | |
| 127 | + } | |
| 128 | + | |
| 129 | + return true; | |
| 130 | +} | |
| 131 | + | |
| 109 | 132 | void dc_dmub_srv_wait_phy_init(struct dc_dmub_srv *dc_dmub_srv) |
| 110 | 133 | { |
| 111 | 134 | struct dmub_srv *dmub = dc_dmub_srv->dmub; |
| @@ -148,3 +171,14 @@ bool dc_dmub_srv_notify_stream_mask(struct dc_dmub_srv *dc_dmub_srv, · 36 unmodified lines | ||
| 148 | 171 | dmub, DMUB_GPINT__IDLE_OPT_NOTIFY_STREAM_MASK, |
| 149 | 172 | stream_mask, timeout) == DMUB_STATUS_OK; |
| 150 | 173 | } |
| 174 | + | |
| 175 | +bool dc_dmub_srv_get_dmub_outbox0_msg(const struct dc *dc, struct dmcub_trace_buf_entry *entry) | |
| 176 | +{ | |
| 177 | + struct dmub_srv *dmub = dc->ctx->dmub_srv->dmub; | |
| 178 | + return dmub_srv_get_outbox0_msg(dmub, entry); | |
| 179 | +} | |
| 180 | + | |
| 181 | +void dc_dmub_trace_event_control(struct dc *dc, bool enable) | |
| 182 | +{ | |
| 183 | + dm_helpers_dmub_outbox0_interrupt_control(dc->ctx, enable); | |
| 184 | +} | |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "dmub/dmub_srv.h" |
| 31 | 31 | |
| 32 | 32 | struct dmub_srv; |
| 33 | +struct dc; | |
| 33 | 34 | |
| 34 | 35 | struct dc_reg_helper_state { |
| 35 | 36 | bool gather_in_progress; |
| @@ -56,6 +57,13 @@ void dc_dmub_srv_wait_idle(struct dc_dmub_srv *dc_dmub_srv); · 20 unmodified lines | ||
| 56 | 57 | |
| 57 | 58 | void dc_dmub_srv_wait_phy_init(struct dc_dmub_srv *dc_dmub_srv); |
| 58 | 59 | |
| 60 | +bool dc_dmub_srv_cmd_with_reply_data(struct dc_dmub_srv *dc_dmub_srv, union dmub_rb_cmd *cmd); | |
| 61 | + | |
| 59 | 62 | bool dc_dmub_srv_notify_stream_mask(struct dc_dmub_srv *dc_dmub_srv, |
| 60 | 63 | unsigned int stream_mask); |
| 64 | + | |
| 65 | +bool dc_dmub_srv_get_dmub_outbox0_msg(const struct dc *dc, struct dmcub_trace_buf_entry *entry); | |
| 66 | + | |
| 67 | +void dc_dmub_trace_event_control(struct dc *dc, bool enable); | |
| 68 | + | |
| 61 | 69 | #endif /* _DMUB_DC_SRV_H_ */ |
| @@ -51,6 +51,7 @@ struct dc_dsc_policy { · 50 unmodified lines | ||
| 51 | 51 | int min_slice_height; // Must not be less than 8 |
| 52 | 52 | uint32_t max_target_bpp; |
| 53 | 53 | uint32_t min_target_bpp; |
| 54 | + uint32_t preferred_bpp_x16; | |
| 54 | 55 | bool enable_dsc_when_not_needed; |
| 55 | 56 | }; |
| 56 | 57 | |
| @@ -62,8 +63,8 @@ bool dc_dsc_parse_dsc_dpcd(const struct dc *dc, · 5 unmodified lines | ||
| 62 | 63 | bool dc_dsc_compute_bandwidth_range( |
| 63 | 64 | const struct display_stream_compressor *dsc, |
| 64 | 65 | uint32_t dsc_min_slice_height_override, |
| 65 | − uint32_t min_bpp, | |
| 66 | − uint32_t max_bpp, | |
| 66 | + uint32_t min_bpp_x16, | |
| 67 | + uint32_t max_bpp_x16, | |
| 67 | 68 | const struct dsc_dec_dpcd_caps *dsc_sink_caps, |
| 68 | 69 | const struct dc_crtc_timing *timing, |
| 69 | 70 | struct dc_dsc_bw_range *range); |
| @@ -77,12 +78,16 @@ bool dc_dsc_compute_config( · 7 unmodified lines | ||
| 77 | 78 | const struct dc_crtc_timing *timing, |
| 78 | 79 | struct dc_dsc_config *dsc_cfg); |
| 79 | 80 | |
| 81 | +uint32_t dc_dsc_stream_bandwidth_in_kbps(uint32_t pix_clk_100hz, uint32_t bpp_x16); | |
| 82 | + | |
| 80 | 83 | void dc_dsc_get_policy_for_timing(const struct dc_crtc_timing *timing, |
| 81 | − uint32_t max_target_bpp_limit_override, | |
| 84 | + uint32_t max_target_bpp_limit_override_x16, | |
| 82 | 85 | struct dc_dsc_policy *policy); |
| 83 | 86 | |
| 84 | 87 | void dc_dsc_policy_set_max_target_bpp_limit(uint32_t limit); |
| 85 | 88 | |
| 86 | 89 | void dc_dsc_policy_set_enable_dsc_when_not_needed(bool enable); |
| 87 | 90 | |
| 91 | +uint32_t dc_dsc_stream_bandwidth_in_kbps(uint32_t pix_clk_100hz, uint32_t bpp_x16); | |
| 92 | + | |
| 88 | 93 | #endif |
| @@ -705,6 +705,7 @@ struct dc_crtc_timing_flags { · 704 unmodified lines | ||
| 705 | 705 | #ifndef TRIM_FSFT |
| 706 | 706 | uint32_t FAST_TRANSPORT: 1; |
| 707 | 707 | #endif |
| 708 | + uint32_t VBLANK_SYNCHRONIZABLE: 1; | |
| 708 | 709 | }; |
| 709 | 710 | |
| 710 | 711 | enum dc_timing_3d_format { |
| @@ -769,6 +770,7 @@ struct dc_crtc_timing { · 58 unmodified lines | ||
| 769 | 770 | #endif |
| 770 | 771 | |
| 771 | 772 | struct dc_crtc_timing_flags flags; |
| 773 | + uint32_t dsc_fixed_bits_per_pixel_x16; /* DSC target bitrate in 1/16 of bpp (e.g. 128 -> 8bpp) */ | |
| 772 | 774 | struct dc_dsc_config dsc_cfg; |
| 773 | 775 | }; |
| 774 | 776 | |
| @@ -103,6 +103,10 @@ struct dc_link { · 102 unmodified lines | ||
| 103 | 103 | bool lttpr_non_transparent_mode; |
| 104 | 104 | bool is_internal_display; |
| 105 | 105 | |
| 106 | + /* TODO: Rename. Flag an endpoint as having a programmable mapping to a | |
| 107 | + * DIG encoder. */ | |
| 108 | + bool is_dig_mapping_flexible; | |
| 109 | + | |
| 106 | 110 | bool edp_sink_present; |
| 107 | 111 | |
| 108 | 112 | /* caps is the same as reported_link_cap. link_traing use |
| @@ -183,16 +187,21 @@ static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_ · 74 unmodified lines | ||
| 183 | 187 | return dc->links[link_index]; |
| 184 | 188 | } |
| 185 | 189 | |
| 186 | −static inline struct dc_link *get_edp_link(const struct dc *dc) | |
| 190 | +static inline void get_edp_links(const struct dc *dc, | |
| 191 | + struct dc_link **edp_links, | |
| 192 | + int *edp_num) | |
| 187 | 193 | { |
| 188 | 194 | int i; |
| 189 | 195 | |
| 190 | − // report any eDP links, even unconnected DDI's | |
| 196 | + *edp_num = 0; | |
| 191 | 197 | for (i = 0; i < dc->link_count; i++) { |
| 192 | − if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP) | |
| 193 | − return dc->links[i]; | |
| 198 | + // report any eDP links, even unconnected DDI's | |
| 199 | + if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP) { | |
| 200 | + edp_links[*edp_num] = dc->links[i]; | |
| 201 | + if (++(*edp_num) == MAX_NUM_EDP) | |
| 202 | + return; | |
| 203 | + } | |
| 194 | 204 | } |
| 195 | − return NULL; | |
| 196 | 205 | } |
| 197 | 206 | |
| 198 | 207 | /* Set backlight level of an embedded panel (eDP, LVDS). |
| @@ -0,0 +1,42 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + * Authors: AMD | |
| 23 | + * | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#ifndef _DC_STAT_H_ | |
| 27 | +#define _DC_STAT_H_ | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * DOC: DC STAT Interface | |
| 31 | + * | |
| 32 | + * These interfaces are called without acquiring DAL and DC locks. | |
| 33 | + * Hence, there is limitations on whese interfaces can access. Only | |
| 34 | + * variables exclusively defined for these interfaces can be modified. | |
| 35 | + */ | |
| 36 | + | |
| 37 | +#include "dc.h" | |
| 38 | +#include "dmub/dmub_srv.h" | |
| 39 | + | |
| 40 | +void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification *notify); | |
| 41 | + | |
| 42 | +#endif /* _DC_STAT_H_ */ | |
| @@ -130,14 +130,6 @@ union stream_update_flags { · 129 unmodified lines | ||
| 130 | 130 | uint32_t raw; |
| 131 | 131 | }; |
| 132 | 132 | |
| 133 | −struct test_pattern { | |
| 134 | − enum dp_test_pattern type; | |
| 135 | − enum dp_test_pattern_color_space color_space; | |
| 136 | − struct link_training_settings const *p_link_settings; | |
| 137 | − unsigned char const *p_custom_pattern; | |
| 138 | − unsigned int cust_pattern_size; | |
| 139 | −}; | |
| 140 | − | |
| 141 | 133 | struct dc_stream_state { |
| 142 | 134 | // sink is deprecated, new code should not reference |
| 143 | 135 | // this pointer |
| @@ -235,9 +227,10 @@ struct dc_stream_state { · 91 unmodified lines | ||
| 235 | 227 | |
| 236 | 228 | uint32_t stream_id; |
| 237 | 229 | bool is_dsc_enabled; |
| 238 | − | |
| 239 | − struct test_pattern test_pattern; | |
| 240 | 230 | union stream_update_flags update_flags; |
| 231 | + | |
| 232 | + bool has_non_synchronizable_pclk; | |
| 233 | + bool vblank_synchronized; | |
| 241 | 234 | }; |
| 242 | 235 | |
| 243 | 236 | #define ABM_LEVEL_IMMEDIATE_DISABLE 255 |
| @@ -271,7 +264,6 @@ struct dc_stream_update { · 27 unmodified lines | ||
| 271 | 264 | struct dc_dsc_config *dsc_config; |
| 272 | 265 | struct dc_transfer_func *func_shaper; |
| 273 | 266 | struct dc_3dlut *lut3d_func; |
| 274 | − struct test_pattern *pending_test_pattern; | |
| 275 | 267 | }; |
| 276 | 268 | |
| 277 | 269 | bool dc_is_stream_unchanged( |
| @@ -461,6 +453,13 @@ bool dc_stream_get_crtc_position(struct dc *dc, · 183 unmodified lines | ||
| 461 | 453 | unsigned int *v_pos, |
| 462 | 454 | unsigned int *nom_v_pos); |
| 463 | 455 | |
| 456 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 457 | +bool dc_stream_forward_dmcu_crc_window(struct dc *dc, struct dc_stream_state *stream, | |
| 458 | + struct crc_params *crc_window); | |
| 459 | +bool dc_stream_stop_dmcu_crc_win_update(struct dc *dc, | |
| 460 | + struct dc_stream_state *stream); | |
| 461 | +#endif | |
| 462 | + | |
| 464 | 463 | bool dc_stream_configure_crc(struct dc *dc, |
| 465 | 464 | struct dc_stream_state *stream, |
| 466 | 465 | struct crc_params *crc_window, |
| @@ -30,7 +30,7 @@ DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \ · 29 unmodified lines | ||
| 30 | 30 | dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \ |
| 31 | 31 | dce_opp.o dce_dmcu.o dce_abm.o dce_ipp.o dce_aux.o \ |
| 32 | 32 | dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dmub_psr.o dmub_abm.o dce_panel_cntl.o \ |
| 33 | −dmub_hw_lock_mgr.o | |
| 33 | +dmub_hw_lock_mgr.o dmub_outbox.o | |
| 34 | 34 | |
| 35 | 35 | AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE)) |
| 36 | 36 | |
| @@ -31,6 +31,8 @@ · 30 unmodified lines | ||
| 31 | 31 | #include "dce_aux.h" |
| 32 | 32 | #include "dce/dce_11_0_sh_mask.h" |
| 33 | 33 | #include "dm_event_log.h" |
| 34 | +#include "dm_helpers.h" | |
| 35 | +#include "dmub/inc/dmub_cmd.h" | |
| 34 | 36 | |
| 35 | 37 | #define CTX \ |
| 36 | 38 | aux110->base.ctx |
| @@ -324,7 +326,7 @@ static int read_channel_reply(struct dce_aux *engine, uint32_t size, · 287 unmodified lines | ||
| 324 | 326 | return 0; |
| 325 | 327 | } |
| 326 | 328 | |
| 327 | −static enum aux_channel_operation_result get_channel_status( | |
| 329 | +static enum aux_return_code_type get_channel_status( | |
| 328 | 330 | struct dce_aux *engine, |
| 329 | 331 | uint8_t *returned_bytes) |
| 330 | 332 | { |
| @@ -335,7 +337,7 @@ static enum aux_channel_operation_result get_channel_status( · 4 unmodified lines | ||
| 335 | 337 | if (returned_bytes == NULL) { |
| 336 | 338 | /*caller pass NULL pointer*/ |
| 337 | 339 | ASSERT_CRITICAL(false); |
| 338 | − return AUX_CHANNEL_OPERATION_FAILED_REASON_UNKNOWN; | |
| 340 | + return AUX_RET_ERROR_UNKNOWN; | |
| 339 | 341 | } |
| 340 | 342 | *returned_bytes = 0; |
| 341 | 343 | |
| @@ -346,7 +348,7 @@ static enum aux_channel_operation_result get_channel_status( · 4 unmodified lines | ||
| 346 | 348 | value = REG_READ(AUX_SW_STATUS); |
| 347 | 349 | /* in case HPD is LOW, exit AUX transaction */ |
| 348 | 350 | if ((value & AUX_SW_STATUS__AUX_SW_HPD_DISCON_MASK)) |
| 349 | − return AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON; | |
| 351 | + return AUX_RET_ERROR_HPD_DISCON; | |
| 350 | 352 | |
| 351 | 353 | /* Note that the following bits are set in 'status.bits' |
| 352 | 354 | * during CTS 4.2.1.2 (FW 3.3.1): |
| @@ -359,14 +361,14 @@ static enum aux_channel_operation_result get_channel_status( · 6 unmodified lines | ||
| 359 | 361 | if (value & AUX_SW_STATUS__AUX_SW_DONE_MASK) { |
| 360 | 362 | if ((value & AUX_SW_STATUS__AUX_SW_RX_TIMEOUT_STATE_MASK) || |
| 361 | 363 | (value & AUX_SW_STATUS__AUX_SW_RX_TIMEOUT_MASK)) |
| 362 | − return AUX_CHANNEL_OPERATION_FAILED_TIMEOUT; | |
| 364 | + return AUX_RET_ERROR_TIMEOUT; | |
| 363 | 365 | |
| 364 | 366 | else if ((value & AUX_SW_STATUS__AUX_SW_RX_INVALID_STOP_MASK) || |
| 365 | 367 | (value & AUX_SW_STATUS__AUX_SW_RX_RECV_NO_DET_MASK) || |
| 366 | 368 | (value & |
| 367 | 369 | AUX_SW_STATUS__AUX_SW_RX_RECV_INVALID_H_MASK) || |
| 368 | 370 | (value & AUX_SW_STATUS__AUX_SW_RX_RECV_INVALID_L_MASK)) |
| 369 | − return AUX_CHANNEL_OPERATION_FAILED_INVALID_REPLY; | |
| 371 | + return AUX_RET_ERROR_INVALID_REPLY; | |
| 370 | 372 | |
| 371 | 373 | *returned_bytes = get_reg_field_value(value, |
| 372 | 374 | AUX_SW_STATUS, |
| @@ -374,17 +376,17 @@ static enum aux_channel_operation_result get_channel_status( · 1 unmodified line | ||
| 374 | 376 | |
| 375 | 377 | if (*returned_bytes == 0) |
| 376 | 378 | return |
| 377 | − AUX_CHANNEL_OPERATION_FAILED_INVALID_REPLY; | |
| 379 | + AUX_RET_ERROR_INVALID_REPLY; | |
| 378 | 380 | else { |
| 379 | 381 | *returned_bytes -= 1; |
| 380 | − return AUX_CHANNEL_OPERATION_SUCCEEDED; | |
| 382 | + return AUX_RET_SUCCESS; | |
| 381 | 383 | } |
| 382 | 384 | } else { |
| 383 | 385 | /*time_elapsed >= aux_engine->timeout_period |
| 384 | 386 | * AUX_SW_STATUS__AUX_SW_HPD_DISCON = at this point |
| 385 | 387 | */ |
| 386 | 388 | ASSERT_CRITICAL(false); |
| 387 | − return AUX_CHANNEL_OPERATION_FAILED_TIMEOUT; | |
| 389 | + return AUX_RET_ERROR_TIMEOUT; | |
| 388 | 390 | } |
| 389 | 391 | } |
| 390 | 392 | |
| @@ -541,7 +543,7 @@ static enum i2caux_transaction_action i2caux_action_from_payload(struct aux_payl · 150 unmodified lines | ||
| 541 | 543 | |
| 542 | 544 | int dce_aux_transfer_raw(struct ddc_service *ddc, |
| 543 | 545 | struct aux_payload *payload, |
| 544 | − enum aux_channel_operation_result *operation_result) | |
| 546 | + enum aux_return_code_type *operation_result) | |
| 545 | 547 | { |
| 546 | 548 | struct ddc *ddc_pin = ddc->ddc_pin; |
| 547 | 549 | struct dce_aux *aux_engine; |
| @@ -556,7 +558,7 @@ int dce_aux_transfer_raw(struct ddc_service *ddc, · 8 unmodified lines | ||
| 556 | 558 | |
| 557 | 559 | aux_engine = ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]; |
| 558 | 560 | if (!acquire(aux_engine, ddc_pin)) { |
| 559 | − *operation_result = AUX_CHANNEL_OPERATION_FAILED_ENGINE_ACQUIRE; | |
| 561 | + *operation_result = AUX_RET_ERROR_ENGINE_ACQUIRE; | |
| 560 | 562 | return -1; |
| 561 | 563 | } |
| 562 | 564 | |
| @@ -575,8 +577,9 @@ int dce_aux_transfer_raw(struct ddc_service *ddc, · 12 unmodified lines | ||
| 575 | 577 | submit_channel_request(aux_engine, &aux_req); |
| 576 | 578 | *operation_result = get_channel_status(aux_engine, &returned_bytes); |
| 577 | 579 | |
| 578 | − if (*operation_result == AUX_CHANNEL_OPERATION_SUCCEEDED) { | |
| 580 | + if (*operation_result == AUX_RET_SUCCESS) { | |
| 579 | 581 | int __maybe_unused bytes_replied = 0; |
| 582 | + | |
| 580 | 583 | bytes_replied = read_channel_reply(aux_engine, payload->length, |
| 581 | 584 | payload->data, payload->reply, |
| 582 | 585 | &status); |
| @@ -604,7 +607,7 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 21 unmodified lines | ||
| 604 | 607 | int i, ret = 0; |
| 605 | 608 | uint8_t reply; |
| 606 | 609 | bool payload_reply = true; |
| 607 | − enum aux_channel_operation_result operation_result; | |
| 610 | + enum aux_return_code_type operation_result; | |
| 608 | 611 | bool retry_on_defer = false; |
| 609 | 612 | |
| 610 | 613 | int aux_ack_retries = 0, |
| @@ -620,8 +623,9 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 9 unmodified lines | ||
| 620 | 623 | |
| 621 | 624 | for (i = 0; i < AUX_MAX_RETRIES; i++) { |
| 622 | 625 | ret = dce_aux_transfer_raw(ddc, payload, &operation_result); |
| 626 | + | |
| 623 | 627 | switch (operation_result) { |
| 624 | − case AUX_CHANNEL_OPERATION_SUCCEEDED: | |
| 628 | + case AUX_RET_SUCCESS: | |
| 625 | 629 | aux_timeout_retries = 0; |
| 626 | 630 | aux_invalid_reply_retries = 0; |
| 627 | 631 | |
| @@ -667,14 +671,14 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 39 unmodified lines | ||
| 667 | 671 | } |
| 668 | 672 | break; |
| 669 | 673 | |
| 670 | − case AUX_CHANNEL_OPERATION_FAILED_INVALID_REPLY: | |
| 674 | + case AUX_RET_ERROR_INVALID_REPLY: | |
| 671 | 675 | if (++aux_invalid_reply_retries >= AUX_MAX_INVALID_REPLY_RETRIES) |
| 672 | 676 | goto fail; |
| 673 | 677 | else |
| 674 | 678 | udelay(400); |
| 675 | 679 | break; |
| 676 | 680 | |
| 677 | − case AUX_CHANNEL_OPERATION_FAILED_TIMEOUT: | |
| 681 | + case AUX_RET_ERROR_TIMEOUT: | |
| 678 | 682 | // Check whether a DEFER had occurred before the timeout. |
| 679 | 683 | // If so, treat timeout as a DEFER. |
| 680 | 684 | if (retry_on_defer) { |
| @@ -696,9 +700,9 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · 15 unmodified lines | ||
| 696 | 700 | } |
| 697 | 701 | break; |
| 698 | 702 | |
| 699 | − case AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON: | |
| 700 | − case AUX_CHANNEL_OPERATION_FAILED_ENGINE_ACQUIRE: | |
| 701 | − case AUX_CHANNEL_OPERATION_FAILED_REASON_UNKNOWN: | |
| 703 | + case AUX_RET_ERROR_HPD_DISCON: | |
| 704 | + case AUX_RET_ERROR_ENGINE_ACQUIRE: | |
| 705 | + case AUX_RET_ERROR_UNKNOWN: | |
| 702 | 706 | default: |
| 703 | 707 | goto fail; |
| 704 | 708 | } |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "i2caux_interface.h" |
| 30 | 30 | #include "inc/hw/aux_engine.h" |
| 31 | 31 | |
| 32 | +enum aux_return_code_type; | |
| 32 | 33 | |
| 33 | 34 | #define AUX_COMMON_REG_LIST0(id)\ |
| 34 | 35 | SRI(AUX_CONTROL, DP_AUX, id), \ |
| @@ -99,7 +100,6 @@ struct dce110_aux_registers { · 64 unmodified lines | ||
| 99 | 100 | AUX_SF(AUX_SW_CONTROL, AUX_SW_GO, mask_sh),\ |
| 100 | 101 | AUX_SF(AUX_SW_DATA, AUX_SW_AUTOINCREMENT_DISABLE, mask_sh),\ |
| 101 | 102 | AUX_SF(AUX_SW_DATA, AUX_SW_DATA_RW, mask_sh),\ |
| 102 | − AUX_SF(AUX_SW_DATA, AUX_SW_AUTOINCREMENT_DISABLE, mask_sh),\ | |
| 103 | 103 | AUX_SF(AUX_SW_DATA, AUX_SW_INDEX, mask_sh),\ |
| 104 | 104 | AUX_SF(AUX_SW_DATA, AUX_SW_DATA, mask_sh),\ |
| 105 | 105 | AUX_SF(AUX_SW_STATUS, AUX_SW_REPLY_BYTE_COUNT, mask_sh),\ |
| @@ -302,7 +302,7 @@ bool dce110_aux_engine_acquire( · 196 unmodified lines | ||
| 302 | 302 | |
| 303 | 303 | int dce_aux_transfer_raw(struct ddc_service *ddc, |
| 304 | 304 | struct aux_payload *cmd, |
| 305 | − enum aux_channel_operation_result *operation_result); | |
| 305 | + enum aux_return_code_type *operation_result); | |
| 306 | 306 | |
| 307 | 307 | bool dce_aux_transfer_with_retries(struct ddc_service *ddc, |
| 308 | 308 | struct aux_payload *cmd); |
| @@ -1002,15 +1002,27 @@ static bool get_pixel_clk_frequency_100hz( · 1001 unmodified lines | ||
| 1002 | 1002 | { |
| 1003 | 1003 | struct dce110_clk_src *clk_src = TO_DCE110_CLK_SRC(clock_source); |
| 1004 | 1004 | unsigned int clock_hz = 0; |
| 1005 | + unsigned int modulo_hz = 0; | |
| 1005 | 1006 | |
| 1006 | 1007 | if (clock_source->id == CLOCK_SOURCE_ID_DP_DTO) { |
| 1007 | 1008 | clock_hz = REG_READ(PHASE[inst]); |
| 1008 | 1009 | |
| 1009 | − /* NOTE: There is agreement with VBIOS here that MODULO is | |
| 1010 | − * programmed equal to DPREFCLK, in which case PHASE will be | |
| 1011 | − * equivalent to pixel clock. | |
| 1012 | − */ | |
| 1013 | − *pixel_clk_khz = clock_hz / 100; | |
| 1010 | + if (clock_source->ctx->dc->hwss.enable_vblanks_synchronization && | |
| 1011 | + clock_source->ctx->dc->config.vblank_alignment_max_frame_time_diff > 0) { | |
| 1012 | + /* NOTE: In case VBLANK syncronization is enabled, MODULO may | |
| 1013 | + * not be programmed equal to DPREFCLK | |
| 1014 | + */ | |
| 1015 | + modulo_hz = REG_READ(MODULO[inst]); | |
| 1016 | + *pixel_clk_khz = div_u64((uint64_t)clock_hz* | |
| 1017 | + clock_source->ctx->dc->clk_mgr->dprefclk_khz*10, | |
| 1018 | + modulo_hz); | |
| 1019 | + } else { | |
| 1020 | + /* NOTE: There is agreement with VBIOS here that MODULO is | |
| 1021 | + * programmed equal to DPREFCLK, in which case PHASE will be | |
| 1022 | + * equivalent to pixel clock. | |
| 1023 | + */ | |
| 1024 | + *pixel_clk_khz = clock_hz / 100; | |
| 1025 | + } | |
| 1014 | 1026 | return true; |
| 1015 | 1027 | } |
| 1016 | 1028 | |
| @@ -1074,8 +1086,35 @@ static bool dcn20_program_pix_clk( · 57 unmodified lines | ||
| 1074 | 1086 | struct pixel_clk_params *pix_clk_params, |
| 1075 | 1087 | struct pll_settings *pll_settings) |
| 1076 | 1088 | { |
| 1089 | + struct dce110_clk_src *clk_src = TO_DCE110_CLK_SRC(clock_source); | |
| 1090 | + unsigned int inst = pix_clk_params->controller_id - CONTROLLER_ID_D0; | |
| 1091 | + | |
| 1077 | 1092 | dce112_program_pix_clk(clock_source, pix_clk_params, pll_settings); |
| 1078 | 1093 | |
| 1094 | + if (clock_source->ctx->dc->hwss.enable_vblanks_synchronization && | |
| 1095 | + clock_source->ctx->dc->config.vblank_alignment_max_frame_time_diff > 0) { | |
| 1096 | + /* NOTE: In case VBLANK syncronization is enabled, | |
| 1097 | + * we need to set modulo to default DPREFCLK first | |
| 1098 | + * dce112_program_pix_clk does not set default DPREFCLK | |
| 1099 | + */ | |
| 1100 | + REG_WRITE(MODULO[inst], | |
| 1101 | + clock_source->ctx->dc->clk_mgr->dprefclk_khz*1000); | |
| 1102 | + } | |
| 1103 | + return true; | |
| 1104 | +} | |
| 1105 | + | |
| 1106 | +static bool dcn20_override_dp_pix_clk( | |
| 1107 | + struct clock_source *clock_source, | |
| 1108 | + unsigned int inst, | |
| 1109 | + unsigned int pixel_clk, | |
| 1110 | + unsigned int ref_clk) | |
| 1111 | +{ | |
| 1112 | + struct dce110_clk_src *clk_src = TO_DCE110_CLK_SRC(clock_source); | |
| 1113 | + | |
| 1114 | + REG_UPDATE(PIXEL_RATE_CNTL[inst], DP_DTO0_ENABLE, 0); | |
| 1115 | + REG_WRITE(PHASE[inst], pixel_clk); | |
| 1116 | + REG_WRITE(MODULO[inst], ref_clk); | |
| 1117 | + REG_UPDATE(PIXEL_RATE_CNTL[inst], DP_DTO0_ENABLE, 1); | |
| 1079 | 1118 | return true; |
| 1080 | 1119 | } |
| 1081 | 1120 | |
| @@ -1083,7 +1122,8 @@ static const struct clock_source_funcs dcn20_clk_src_funcs = { · 1 unmodified line | ||
| 1083 | 1122 | .cs_power_down = dce110_clock_source_power_down, |
| 1084 | 1123 | .program_pix_clk = dcn20_program_pix_clk, |
| 1085 | 1124 | .get_pix_clk_dividers = dce112_get_pix_clk_dividers, |
| 1086 | − .get_pixel_clk_frequency_100hz = get_pixel_clk_frequency_100hz | |
| 1125 | + .get_pixel_clk_frequency_100hz = get_pixel_clk_frequency_100hz, | |
| 1126 | + .override_dp_pix_clk = dcn20_override_dp_pix_clk | |
| 1087 | 1127 | }; |
| 1088 | 1128 | |
| 1089 | 1129 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| @@ -57,6 +57,8 @@ · 56 unmodified lines | ||
| 57 | 57 | #define MCP_SYNC_PHY_LOCK 0x90 |
| 58 | 58 | #define MCP_SYNC_PHY_UNLOCK 0x91 |
| 59 | 59 | #define MCP_BL_SET_PWM_FRAC 0x6A /* Enable or disable Fractional PWM */ |
| 60 | +#define CRC_WIN_NOTIFY 0x92 | |
| 61 | +#define CRC_STOP_UPDATE 0x93 | |
| 60 | 62 | #define MCP_SEND_EDID_CEA 0xA0 |
| 61 | 63 | #define EDID_CEA_CMD_ACK 1 |
| 62 | 64 | #define EDID_CEA_CMD_NACK 2 |
| @@ -930,6 +932,84 @@ static bool dcn10_recv_edid_cea_ack(struct dmcu *dmcu, int *offset) · 867 unmodified lines | ||
| 930 | 932 | |
| 931 | 933 | #endif //(CONFIG_DRM_AMD_DC_DCN) |
| 932 | 934 | |
| 935 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 936 | +static void dcn10_forward_crc_window(struct dmcu *dmcu, | |
| 937 | + struct crc_region *crc_win, | |
| 938 | + struct otg_phy_mux *mux_mapping) | |
| 939 | +{ | |
| 940 | + struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu); | |
| 941 | + unsigned int dmcu_max_retry_on_wait_reg_ready = 801; | |
| 942 | + unsigned int dmcu_wait_reg_ready_interval = 100; | |
| 943 | + unsigned int crc_start = 0, crc_end = 0, otg_phy_mux = 0; | |
| 944 | + | |
| 945 | + /* If microcontroller is not running, do nothing */ | |
| 946 | + if (dmcu->dmcu_state != DMCU_RUNNING) | |
| 947 | + return; | |
| 948 | + | |
| 949 | + if (!crc_win) | |
| 950 | + return; | |
| 951 | + | |
| 952 | + /* waitDMCUReadyForCmd */ | |
| 953 | + REG_WAIT(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 0, | |
| 954 | + dmcu_wait_reg_ready_interval, | |
| 955 | + dmcu_max_retry_on_wait_reg_ready); | |
| 956 | + | |
| 957 | + /* build up nitification data */ | |
| 958 | + crc_start = (((unsigned int) crc_win->x_start) << 16) | crc_win->y_start; | |
| 959 | + crc_end = (((unsigned int) crc_win->x_end) << 16) | crc_win->y_end; | |
| 960 | + otg_phy_mux = | |
| 961 | + (((unsigned int) mux_mapping->otg_output_num) << 16) | mux_mapping->phy_output_num; | |
| 962 | + | |
| 963 | + dm_write_reg(dmcu->ctx, REG(MASTER_COMM_DATA_REG1), | |
| 964 | + crc_start); | |
| 965 | + | |
| 966 | + dm_write_reg(dmcu->ctx, REG(MASTER_COMM_DATA_REG2), | |
| 967 | + crc_end); | |
| 968 | + | |
| 969 | + dm_write_reg(dmcu->ctx, REG(MASTER_COMM_DATA_REG3), | |
| 970 | + otg_phy_mux); | |
| 971 | + | |
| 972 | + /* setDMCUParam_Cmd */ | |
| 973 | + REG_UPDATE(MASTER_COMM_CMD_REG, MASTER_COMM_CMD_REG_BYTE0, | |
| 974 | + CRC_WIN_NOTIFY); | |
| 975 | + | |
| 976 | + /* notifyDMCUMsg */ | |
| 977 | + REG_UPDATE(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 1); | |
| 978 | +} | |
| 979 | + | |
| 980 | +static void dcn10_stop_crc_win_update(struct dmcu *dmcu, | |
| 981 | + struct otg_phy_mux *mux_mapping) | |
| 982 | +{ | |
| 983 | + struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(dmcu); | |
| 984 | + unsigned int dmcu_max_retry_on_wait_reg_ready = 801; | |
| 985 | + unsigned int dmcu_wait_reg_ready_interval = 100; | |
| 986 | + unsigned int otg_phy_mux = 0; | |
| 987 | + | |
| 988 | + /* If microcontroller is not running, do nothing */ | |
| 989 | + if (dmcu->dmcu_state != DMCU_RUNNING) | |
| 990 | + return; | |
| 991 | + | |
| 992 | + /* waitDMCUReadyForCmd */ | |
| 993 | + REG_WAIT(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 0, | |
| 994 | + dmcu_wait_reg_ready_interval, | |
| 995 | + dmcu_max_retry_on_wait_reg_ready); | |
| 996 | + | |
| 997 | + /* build up nitification data */ | |
| 998 | + otg_phy_mux = | |
| 999 | + (((unsigned int) mux_mapping->otg_output_num) << 16) | mux_mapping->phy_output_num; | |
| 1000 | + | |
| 1001 | + dm_write_reg(dmcu->ctx, REG(MASTER_COMM_DATA_REG1), | |
| 1002 | + otg_phy_mux); | |
| 1003 | + | |
| 1004 | + /* setDMCUParam_Cmd */ | |
| 1005 | + REG_UPDATE(MASTER_COMM_CMD_REG, MASTER_COMM_CMD_REG_BYTE0, | |
| 1006 | + CRC_STOP_UPDATE); | |
| 1007 | + | |
| 1008 | + /* notifyDMCUMsg */ | |
| 1009 | + REG_UPDATE(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT, 1); | |
| 1010 | +} | |
| 1011 | +#endif | |
| 1012 | + | |
| 933 | 1013 | static const struct dmcu_funcs dce_funcs = { |
| 934 | 1014 | .dmcu_init = dce_dmcu_init, |
| 935 | 1015 | .load_iram = dce_dmcu_load_iram, |
| @@ -953,6 +1033,10 @@ static const struct dmcu_funcs dcn10_funcs = { · 17 unmodified lines | ||
| 953 | 1033 | .send_edid_cea = dcn10_send_edid_cea, |
| 954 | 1034 | .recv_amd_vsdb = dcn10_recv_amd_vsdb, |
| 955 | 1035 | .recv_edid_cea_ack = dcn10_recv_edid_cea_ack, |
| 1036 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 1037 | + .forward_crc_window = dcn10_forward_crc_window, | |
| 1038 | + .stop_crc_win_update = dcn10_stop_crc_win_update, | |
| 1039 | +#endif | |
| 956 | 1040 | .is_dmcu_initialized = dcn10_is_dmcu_initialized |
| 957 | 1041 | }; |
| 958 | 1042 | |
| @@ -216,9 +216,7 @@ static void set_spatial_dither( · 215 unmodified lines | ||
| 216 | 216 | REG_UPDATE(FMT_BIT_DEPTH_CONTROL, |
| 217 | 217 | FMT_TEMPORAL_DITHER_EN, 0); |
| 218 | 218 | |
| 219 | − /* no 10bpc on DCE11*/ | |
| 220 | − if (params->flags.SPATIAL_DITHER_ENABLED == 0 || | |
| 221 | − params->flags.SPATIAL_DITHER_DEPTH == 2) | |
| 219 | + if (params->flags.SPATIAL_DITHER_ENABLED == 0) | |
| 222 | 220 | return; |
| 223 | 221 | |
| 224 | 222 | /* only use FRAME_COUNTER_MAX if frameRandom == 1*/ |
| @@ -72,11 +72,11 @@ static void dmub_abm_init(struct abm *abm, uint32_t backlight) · 71 unmodified lines | ||
| 72 | 72 | { |
| 73 | 73 | struct dce_abm *dce_abm = TO_DMUB_ABM(abm); |
| 74 | 74 | |
| 75 | − REG_WRITE(DC_ABM1_HG_SAMPLE_RATE, 0x103); | |
| 76 | − REG_WRITE(DC_ABM1_HG_SAMPLE_RATE, 0x101); | |
| 77 | − REG_WRITE(DC_ABM1_LS_SAMPLE_RATE, 0x103); | |
| 78 | − REG_WRITE(DC_ABM1_LS_SAMPLE_RATE, 0x101); | |
| 79 | − REG_WRITE(BL1_PWM_BL_UPDATE_SAMPLE_RATE, 0x101); | |
| 75 | + REG_WRITE(DC_ABM1_HG_SAMPLE_RATE, 0x3); | |
| 76 | + REG_WRITE(DC_ABM1_HG_SAMPLE_RATE, 0x1); | |
| 77 | + REG_WRITE(DC_ABM1_LS_SAMPLE_RATE, 0x3); | |
| 78 | + REG_WRITE(DC_ABM1_LS_SAMPLE_RATE, 0x1); | |
| 79 | + REG_WRITE(BL1_PWM_BL_UPDATE_SAMPLE_RATE, 0x1); | |
| 80 | 80 | |
| 81 | 81 | REG_SET_3(DC_ABM1_HG_MISC_CTRL, 0, |
| 82 | 82 | ABM1_HG_NUM_OF_BINS_SEL, 0, |
| @@ -0,0 +1,60 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + * Authors: AMD | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include "dmub_outbox.h" | |
| 26 | +#include "dc_dmub_srv.h" | |
| 27 | +#include "dmub/inc/dmub_cmd.h" | |
| 28 | + | |
| 29 | +/** | |
| 30 | + ***************************************************************************** | |
| 31 | + * Function: dmub_enable_outbox_notification | |
| 32 | + * | |
| 33 | + * @brief | |
| 34 | + * Sends inbox cmd to dmub to enable outbox1 messages with interrupt. | |
| 35 | + * Dmub sends outbox1 message and triggers outbox1 interrupt. | |
| 36 | + * | |
| 37 | + * @param | |
| 38 | + * [in] dc: dc structure | |
| 39 | + * | |
| 40 | + * @return | |
| 41 | + * None | |
| 42 | + ***************************************************************************** | |
| 43 | + */ | |
| 44 | +void dmub_enable_outbox_notification(struct dc *dc) | |
| 45 | +{ | |
| 46 | + union dmub_rb_cmd cmd; | |
| 47 | + struct dc_context *dc_ctx = dc->ctx; | |
| 48 | + | |
| 49 | + memset(&cmd, 0x0, sizeof(cmd)); | |
| 50 | + cmd.outbox1_enable.header.type = DMUB_CMD__OUTBOX1_ENABLE; | |
| 51 | + cmd.outbox1_enable.header.sub_type = 0; | |
| 52 | + cmd.outbox1_enable.header.payload_bytes = | |
| 53 | + sizeof(cmd.outbox1_enable) - | |
| 54 | + sizeof(cmd.outbox1_enable.header); | |
| 55 | + cmd.outbox1_enable.enable = true; | |
| 56 | + | |
| 57 | + dc_dmub_srv_cmd_queue(dc_ctx->dmub_srv, &cmd); | |
| 58 | + dc_dmub_srv_cmd_execute(dc_ctx->dmub_srv); | |
| 59 | + dc_dmub_srv_wait_idle(dc_ctx->dmub_srv); | |
| 60 | +} | |
| @@ -0,0 +1,33 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright 2020 Advanced Micro Devices, Inc. | |
| 3 | + * | |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | + * copy of this software and associated documentation files (the "Software"), | |
| 6 | + * to deal in the Software without restriction, including without limitation | |
| 7 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | + * Software is furnished to do so, subject to the following conditions: | |
| 10 | + * | |
| 11 | + * The above copyright notice and this permission notice shall be included in | |
| 12 | + * all copies or substantial portions of the Software. | |
| 13 | + * | |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 17 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 18 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 19 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 20 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | + * | |
| 22 | + * Authors: AMD | |
| 23 | + * | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#ifndef _DMUB_OUTBOX_H_ | |
| 27 | +#define _DMUB_OUTBOX_H_ | |
| 28 | + | |
| 29 | +#include "dc.h" | |
| 30 | + | |
| 31 | +void dmub_enable_outbox_notification(struct dc *dc); | |
| 32 | + | |
| 33 | +#endif /* _DMUB_OUTBOX_H_ */ | |
| @@ -81,13 +81,18 @@ static void dmub_psr_get_state(struct dmub_psr *dmub, enum dc_psr_state *state) · 80 unmodified lines | ||
| 81 | 81 | { |
| 82 | 82 | struct dmub_srv *srv = dmub->ctx->dmub_srv->dmub; |
| 83 | 83 | uint32_t raw_state; |
| 84 | + enum dmub_status status; | |
| 84 | 85 | |
| 85 | 86 | // Send gpint command and wait for ack |
| 86 | − dmub_srv_send_gpint_command(srv, DMUB_GPINT__GET_PSR_STATE, 0, 30); | |
| 87 | − | |
| 88 | − dmub_srv_get_gpint_response(srv, &raw_state); | |
| 89 | − | |
| 90 | − *state = convert_psr_state(raw_state); | |
| 87 | + status = dmub_srv_send_gpint_command(srv, DMUB_GPINT__GET_PSR_STATE, 0, 30); | |
| 88 | + | |
| 89 | + if (status == DMUB_STATUS_OK) { | |
| 90 | + // GPINT was executed, get response | |
| 91 | + dmub_srv_get_gpint_response(srv, &raw_state); | |
| 92 | + *state = convert_psr_state(raw_state); | |
| 93 | + } else | |
| 94 | + // Return invalid state when GPINT times out | |
| 95 | + *state = 0xFF; | |
| 91 | 96 | } |
| 92 | 97 | |
| 93 | 98 | /* |
| @@ -216,6 +221,7 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub, · 122 unmodified lines | ||
| 216 | 221 | res_ctx->pipe_ctx[i].stream->link == link && |
| 217 | 222 | res_ctx->pipe_ctx[i].stream->link->connector_signal == SIGNAL_TYPE_EDP) { |
| 218 | 223 | pipe_ctx = &res_ctx->pipe_ctx[i]; |
| 224 | + //TODO: refactor for multi edp support | |
| 219 | 225 | break; |
| 220 | 226 | } |
| 221 | 227 | } |
| @@ -269,8 +275,7 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub, · 47 unmodified lines | ||
| 269 | 275 | copy_settings_data->frame_cap_ind = psr_context->psrFrameCaptureIndicationReq; |
| 270 | 276 | copy_settings_data->init_sdp_deadline = psr_context->sdpTransmitLineNumDeadline; |
| 271 | 277 | copy_settings_data->debug.u32All = 0; |
| 272 | − copy_settings_data->debug.bitfields.visual_confirm = dc->dc->debug.visual_confirm == VISUAL_CONFIRM_PSR ? | |
| 273 | − true : false; | |
| 278 | + copy_settings_data->debug.bitfields.visual_confirm = dc->dc->debug.visual_confirm == VISUAL_CONFIRM_PSR; | |
| 274 | 279 | copy_settings_data->debug.bitfields.use_hw_lock_mgr = 1; |
| 275 | 280 | |
| 276 | 281 | dc_dmub_srv_cmd_queue(dc->dmub_srv, &cmd); |
| @@ -797,6 +797,7 @@ void dce110_edp_power_control( · 796 unmodified lines | ||
| 797 | 797 | struct dc_context *ctx = link->ctx; |
| 798 | 798 | struct bp_transmitter_control cntl = { 0 }; |
| 799 | 799 | enum bp_result bp_result; |
| 800 | + uint8_t panel_instance; | |
| 800 | 801 | |
| 801 | 802 | |
| 802 | 803 | if (dal_graphics_object_id_get_connector_id(link->link_enc->connector) |
| @@ -807,7 +808,6 @@ void dce110_edp_power_control( · 4 unmodified lines | ||
| 807 | 808 | |
| 808 | 809 | if (!link->panel_cntl) |
| 809 | 810 | return; |
| 810 | − | |
| 811 | 811 | if (power_up != |
| 812 | 812 | link->panel_cntl->funcs->is_panel_powered_on(link->panel_cntl)) { |
| 813 | 813 | |
| @@ -880,15 +880,18 @@ void dce110_edp_power_control( · 66 unmodified lines | ||
| 880 | 880 | cntl.coherent = false; |
| 881 | 881 | cntl.lanes_number = LANE_COUNT_FOUR; |
| 882 | 882 | cntl.hpd_sel = link->link_enc->hpd_source; |
| 883 | + panel_instance = link->panel_cntl->inst; | |
| 883 | 884 | |
| 884 | 885 | if (ctx->dc->ctx->dmub_srv && |
| 885 | 886 | ctx->dc->debug.dmub_command_table) { |
| 886 | 887 | if (cntl.action == TRANSMITTER_CONTROL_POWER_ON) |
| 887 | 888 | bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, |
| 888 | − LVTMA_CONTROL_POWER_ON); | |
| 889 | + LVTMA_CONTROL_POWER_ON, | |
| 890 | + panel_instance); | |
| 889 | 891 | else |
| 890 | 892 | bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, |
| 891 | − LVTMA_CONTROL_POWER_OFF); | |
| 893 | + LVTMA_CONTROL_POWER_OFF, | |
| 894 | + panel_instance); | |
| 892 | 895 | } |
| 893 | 896 | |
| 894 | 897 | bp_result = link_transmitter_control(ctx->dc_bios, &cntl); |
| @@ -963,6 +966,7 @@ void dce110_edp_backlight_control( · 68 unmodified lines | ||
| 963 | 966 | { |
| 964 | 967 | struct dc_context *ctx = link->ctx; |
| 965 | 968 | struct bp_transmitter_control cntl = { 0 }; |
| 969 | + uint8_t panel_instance; | |
| 966 | 970 | |
| 967 | 971 | if (dal_graphics_object_id_get_connector_id(link->link_enc->connector) |
| 968 | 972 | != CONNECTOR_ID_EDP) { |
| @@ -1011,6 +1015,7 @@ void dce110_edp_backlight_control( · 42 unmodified lines | ||
| 1011 | 1015 | */ |
| 1012 | 1016 | /* dc_service_sleep_in_milliseconds(50); */ |
| 1013 | 1017 | /*edp 1.2*/ |
| 1018 | + panel_instance = link->panel_cntl->inst; | |
| 1014 | 1019 | if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON) |
| 1015 | 1020 | edp_receiver_ready_T7(link); |
| 1016 | 1021 | |
| @@ -1018,10 +1023,12 @@ void dce110_edp_backlight_control( · 1 unmodified line | ||
| 1018 | 1023 | ctx->dc->debug.dmub_command_table) { |
| 1019 | 1024 | if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON) |
| 1020 | 1025 | ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, |
| 1021 | − LVTMA_CONTROL_LCD_BLON); | |
| 1026 | + LVTMA_CONTROL_LCD_BLON, | |
| 1027 | + panel_instance); | |
| 1022 | 1028 | else |
| 1023 | 1029 | ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, |
| 1024 | − LVTMA_CONTROL_LCD_BLOFF); | |
| 1030 | + LVTMA_CONTROL_LCD_BLOFF, | |
| 1031 | + panel_instance); | |
| 1025 | 1032 | } |
| 1026 | 1033 | |
| 1027 | 1034 | link_transmitter_control(ctx->dc_bios, &cntl); |
| @@ -1629,34 +1636,39 @@ static void disable_vga_and_power_gate_all_controllers( · 601 unmodified lines | ||
| 1629 | 1636 | } |
| 1630 | 1637 | |
| 1631 | 1638 | |
| 1632 | −static struct dc_stream_state *get_edp_stream(struct dc_state *context) | |
| 1639 | +static void get_edp_streams(struct dc_state *context, | |
| 1640 | + struct dc_stream_state **edp_streams, | |
| 1641 | + int *edp_stream_num) | |
| 1633 | 1642 | { |
| 1634 | 1643 | int i; |
| 1635 | 1644 | |
| 1645 | + *edp_stream_num = 0; | |
| 1636 | 1646 | for (i = 0; i < context->stream_count; i++) { |
| 1637 | − if (context->streams[i]->signal == SIGNAL_TYPE_EDP) | |
| 1638 | − return context->streams[i]; | |
| 1647 | + if (context->streams[i]->signal == SIGNAL_TYPE_EDP) { | |
| 1648 | + edp_streams[*edp_stream_num] = context->streams[i]; | |
| 1649 | + if (++(*edp_stream_num) == MAX_NUM_EDP) | |
| 1650 | + return; | |
| 1651 | + } | |
| 1639 | 1652 | } |
| 1640 | − return NULL; | |
| 1641 | 1653 | } |
| 1642 | 1654 | |
| 1643 | −static struct dc_link *get_edp_link_with_sink( | |
| 1655 | +static void get_edp_links_with_sink( | |
| 1644 | 1656 | struct dc *dc, |
| 1645 | − struct dc_state *context) | |
| 1657 | + struct dc_link **edp_links_with_sink, | |
| 1658 | + int *edp_with_sink_num) | |
| 1646 | 1659 | { |
| 1647 | 1660 | int i; |
| 1648 | − struct dc_link *link = NULL; | |
| 1649 | 1661 | |
| 1650 | 1662 | /* check if there is an eDP panel not in use */ |
| 1663 | + *edp_with_sink_num = 0; | |
| 1651 | 1664 | for (i = 0; i < dc->link_count; i++) { |
| 1652 | 1665 | if (dc->links[i]->local_sink && |
| 1653 | 1666 | dc->links[i]->local_sink->sink_signal == SIGNAL_TYPE_EDP) { |
| 1654 | − link = dc->links[i]; | |
| 1655 | − break; | |
| 1667 | + edp_links_with_sink[*edp_with_sink_num] = dc->links[i]; | |
| 1668 | + if (++(*edp_with_sink_num) == MAX_NUM_EDP) | |
| 1669 | + return; | |
| 1656 | 1670 | } |
| 1657 | 1671 | } |
| 1658 | − | |
| 1659 | − return link; | |
| 1660 | 1672 | } |
| 1661 | 1673 | |
| 1662 | 1674 | /* |
| @@ -1668,36 +1680,48 @@ static struct dc_link *get_edp_link_with_sink( · 5 unmodified lines | ||
| 1668 | 1680 | */ |
| 1669 | 1681 | void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) |
| 1670 | 1682 | { |
| 1671 | − int i; | |
| 1672 | − struct dc_link *edp_link_with_sink = get_edp_link_with_sink(dc, context); | |
| 1673 | − struct dc_link *edp_link = get_edp_link(dc); | |
| 1683 | + struct dc_link *edp_links_with_sink[MAX_NUM_EDP]; | |
| 1684 | + struct dc_link *edp_links[MAX_NUM_EDP]; | |
| 1685 | + struct dc_stream_state *edp_streams[MAX_NUM_EDP]; | |
| 1686 | + struct dc_link *edp_link_with_sink = NULL; | |
| 1687 | + struct dc_link *edp_link = NULL; | |
| 1674 | 1688 | struct dc_stream_state *edp_stream = NULL; |
| 1689 | + struct dce_hwseq *hws = dc->hwseq; | |
| 1690 | + int edp_with_sink_num; | |
| 1691 | + int edp_num; | |
| 1692 | + int edp_stream_num; | |
| 1693 | + int i; | |
| 1675 | 1694 | bool can_apply_edp_fast_boot = false; |
| 1676 | 1695 | bool can_apply_seamless_boot = false; |
| 1677 | 1696 | bool keep_edp_vdd_on = false; |
| 1678 | − struct dce_hwseq *hws = dc->hwseq; | |
| 1697 | + | |
| 1698 | + get_edp_links_with_sink(dc, edp_links_with_sink, &edp_with_sink_num); | |
| 1699 | + get_edp_links(dc, edp_links, &edp_num); | |
| 1679 | 1700 | |
| 1680 | 1701 | if (hws->funcs.init_pipes) |
| 1681 | 1702 | hws->funcs.init_pipes(dc, context); |
| 1682 | 1703 | |
| 1683 | − edp_stream = get_edp_stream(context); | |
| 1704 | + get_edp_streams(context, edp_streams, &edp_stream_num); | |
| 1684 | 1705 | |
| 1685 | 1706 | // Check fastboot support, disable on DCE8 because of blank screens |
| 1686 | − if (edp_link && dc->ctx->dce_version != DCE_VERSION_8_0 && | |
| 1707 | + if (edp_num && dc->ctx->dce_version != DCE_VERSION_8_0 && | |
| 1687 | 1708 | dc->ctx->dce_version != DCE_VERSION_8_1 && |
| 1688 | 1709 | dc->ctx->dce_version != DCE_VERSION_8_3) { |
| 1689 | − | |
| 1690 | − // enable fastboot if backend is enabled on eDP | |
| 1691 | − if (edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc)) { | |
| 1692 | − /* Set optimization flag on eDP stream*/ | |
| 1693 | − if (edp_stream && edp_link->link_status.link_active) { | |
| 1694 | − edp_stream->apply_edp_fast_boot_optimization = true; | |
| 1695 | − can_apply_edp_fast_boot = true; | |
| 1710 | + for (i = 0; i < edp_num; i++) { | |
| 1711 | + edp_link = edp_links[i]; | |
| 1712 | + // enable fastboot if backend is enabled on eDP | |
| 1713 | + if (edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc)) { | |
| 1714 | + /* Set optimization flag on eDP stream*/ | |
| 1715 | + if (edp_stream_num && edp_link->link_status.link_active) { | |
| 1716 | + edp_stream = edp_streams[0]; | |
| 1717 | + edp_stream->apply_edp_fast_boot_optimization = true; | |
| 1718 | + can_apply_edp_fast_boot = true; | |
| 1719 | + break; | |
| 1720 | + } | |
| 1696 | 1721 | } |
| 1697 | 1722 | } |
| 1698 | − | |
| 1699 | 1723 | // We are trying to enable eDP, don't power down VDD |
| 1700 | − if (edp_stream) | |
| 1724 | + if (edp_stream_num) | |
| 1701 | 1725 | keep_edp_vdd_on = true; |
| 1702 | 1726 | } |
| 1703 | 1727 | |
| @@ -1712,6 +1736,9 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) · 8 unmodified lines | ||
| 1712 | 1736 | /* eDP should not have stream in resume from S4 and so even with VBios post |
| 1713 | 1737 | * it should get turned off |
| 1714 | 1738 | */ |
| 1739 | + if (edp_with_sink_num) | |
| 1740 | + edp_link_with_sink = edp_links_with_sink[0]; | |
| 1741 | + | |
| 1715 | 1742 | if (!can_apply_edp_fast_boot && !can_apply_seamless_boot) { |
| 1716 | 1743 | if (edp_link_with_sink && !keep_edp_vdd_on) { |
| 1717 | 1744 | /*turn off backlight before DP_blank and encoder powered down*/ |
| @@ -1723,7 +1750,7 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) · 5 unmodified lines | ||
| 1723 | 1750 | if (edp_link_with_sink && !keep_edp_vdd_on) |
| 1724 | 1751 | dc->hwss.edp_power_control(edp_link_with_sink, false); |
| 1725 | 1752 | } |
| 1726 | − bios_set_scratch_acc_mode_change(dc->ctx->dc_bios); | |
| 1753 | + bios_set_scratch_acc_mode_change(dc->ctx->dc_bios, 1); | |
| 1727 | 1754 | } |
| 1728 | 1755 | |
| 1729 | 1756 | static uint32_t compute_pstate_blackout_duration( |
| @@ -1272,6 +1272,8 @@ static bool underlay_create(struct dc_context *ctx, struct resource_pool *pool) · 1271 unmodified lines | ||
| 1272 | 1272 | |
| 1273 | 1273 | /* update the public caps to indicate an underlay is available */ |
| 1274 | 1274 | ctx->dc->caps.max_slave_planes = 1; |
| 1275 | + ctx->dc->caps.max_slave_yuv_planes = 1; | |
| 1276 | + ctx->dc->caps.max_slave_rgb_planes = 0; | |
| 1275 | 1277 | |
| 1276 | 1278 | return true; |
| 1277 | 1279 | } |
| @@ -53,6 +53,7 @@ · 52 unmodified lines | ||
| 53 | 53 | #include "dsc.h" |
| 54 | 54 | #include "dce/dmub_hw_lock_mgr.h" |
| 55 | 55 | #include "dc_trace.h" |
| 56 | +#include "dce/dmub_outbox.h" | |
| 56 | 57 | |
| 57 | 58 | #define DC_LOGGER_INIT(logger) |
| 58 | 59 | |
| @@ -1355,6 +1356,10 @@ void dcn10_init_hw(struct dc *dc) · 1296 unmodified lines | ||
| 1355 | 1356 | hws->funcs.dsc_pg_control(hws, res_pool->dscs[i]->inst, false); |
| 1356 | 1357 | } |
| 1357 | 1358 | |
| 1359 | + /* Enable outbox notification feature of dmub */ | |
| 1360 | + if (dc->debug.enable_dmub_aux_for_legacy_ddc) | |
| 1361 | + dmub_enable_outbox_notification(dc); | |
| 1362 | + | |
| 1358 | 1363 | /* we want to turn off all dp displays before doing detection */ |
| 1359 | 1364 | if (dc->config.power_down_display_on_boot) { |
| 1360 | 1365 | uint8_t dpcd_power_state = '\0'; |
| @@ -1457,19 +1462,26 @@ void dcn10_init_hw(struct dc *dc) · 96 unmodified lines | ||
| 1457 | 1462 | */ |
| 1458 | 1463 | void dcn10_power_down_on_boot(struct dc *dc) |
| 1459 | 1464 | { |
| 1460 | − int i = 0; | |
| 1465 | + struct dc_link *edp_links[MAX_NUM_EDP]; | |
| 1461 | 1466 | struct dc_link *edp_link; |
| 1467 | + int edp_num; | |
| 1468 | + int i = 0; | |
| 1462 | 1469 | |
| 1463 | − edp_link = get_edp_link(dc); | |
| 1464 | − if (edp_link && | |
| 1465 | − edp_link->link_enc->funcs->is_dig_enabled && | |
| 1466 | − edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) && | |
| 1467 | − dc->hwseq->funcs.edp_backlight_control && | |
| 1468 | − dc->hwss.power_down && | |
| 1469 | − dc->hwss.edp_power_control) { | |
| 1470 | − dc->hwseq->funcs.edp_backlight_control(edp_link, false); | |
| 1471 | − dc->hwss.power_down(dc); | |
| 1472 | − dc->hwss.edp_power_control(edp_link, false); | |
| 1470 | + get_edp_links(dc, edp_links, &edp_num); | |
| 1471 | + | |
| 1472 | + if (edp_num) { | |
| 1473 | + for (i = 0; i < edp_num; i++) { | |
| 1474 | + edp_link = edp_links[i]; | |
| 1475 | + if (edp_link->link_enc->funcs->is_dig_enabled && | |
| 1476 | + edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) && | |
| 1477 | + dc->hwseq->funcs.edp_backlight_control && | |
| 1478 | + dc->hwss.power_down && | |
| 1479 | + dc->hwss.edp_power_control) { | |
| 1480 | + dc->hwseq->funcs.edp_backlight_control(edp_link, false); | |
| 1481 | + dc->hwss.power_down(dc); | |
| 1482 | + dc->hwss.edp_power_control(edp_link, false); | |
| 1483 | + } | |
| 1484 | + } | |
| 1473 | 1485 | } else { |
| 1474 | 1486 | for (i = 0; i < dc->link_count; i++) { |
| 1475 | 1487 | struct dc_link *link = dc->links[i]; |
| @@ -1851,6 +1863,230 @@ static bool wait_for_reset_trigger_to_occur( · 375 unmodified lines | ||
| 1851 | 1863 | return rc; |
| 1852 | 1864 | } |
| 1853 | 1865 | |
| 1866 | +uint64_t reduceSizeAndFraction( | |
| 1867 | + uint64_t *numerator, | |
| 1868 | + uint64_t *denominator, | |
| 1869 | + bool checkUint32Bounary) | |
| 1870 | +{ | |
| 1871 | + int i; | |
| 1872 | + bool ret = checkUint32Bounary == false; | |
| 1873 | + uint64_t max_int32 = 0xffffffff; | |
| 1874 | + uint64_t num, denom; | |
| 1875 | + static const uint16_t prime_numbers[] = { | |
| 1876 | + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, | |
| 1877 | + 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, | |
| 1878 | + 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, | |
| 1879 | + 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, | |
| 1880 | + 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, | |
| 1881 | + 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, | |
| 1882 | + 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, | |
| 1883 | + 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, | |
| 1884 | + 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, | |
| 1885 | + 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, | |
| 1886 | + 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, | |
| 1887 | + 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, | |
| 1888 | + 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, | |
| 1889 | + 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, | |
| 1890 | + 941, 947, 953, 967, 971, 977, 983, 991, 997}; | |
| 1891 | + int count = ARRAY_SIZE(prime_numbers); | |
| 1892 | + | |
| 1893 | + num = *numerator; | |
| 1894 | + denom = *denominator; | |
| 1895 | + for (i = 0; i < count; i++) { | |
| 1896 | + uint32_t num_reminder, denom_reminder; | |
| 1897 | + uint64_t num_result, denom_result; | |
| 1898 | + if (checkUint32Bounary && | |
| 1899 | + num <= max_int32 && denom <= max_int32) { | |
| 1900 | + ret = true; | |
| 1901 | + break; | |
| 1902 | + } | |
| 1903 | + do { | |
| 1904 | + num_result = div_u64_rem(num, prime_numbers[i], &num_reminder); | |
| 1905 | + denom_result = div_u64_rem(denom, prime_numbers[i], &denom_reminder); | |
| 1906 | + if (num_reminder == 0 && denom_reminder == 0) { | |
| 1907 | + num = num_result; | |
| 1908 | + denom = denom_result; | |
| 1909 | + } | |
| 1910 | + } while (num_reminder == 0 && denom_reminder == 0); | |
| 1911 | + } | |
| 1912 | + *numerator = num; | |
| 1913 | + *denominator = denom; | |
| 1914 | + return ret; | |
| 1915 | +} | |
| 1916 | + | |
| 1917 | +bool is_low_refresh_rate(struct pipe_ctx *pipe) | |
| 1918 | +{ | |
| 1919 | + uint32_t master_pipe_refresh_rate = | |
| 1920 | + pipe->stream->timing.pix_clk_100hz * 100 / | |
| 1921 | + pipe->stream->timing.h_total / | |
| 1922 | + pipe->stream->timing.v_total; | |
| 1923 | + return master_pipe_refresh_rate <= 30; | |
| 1924 | +} | |
| 1925 | + | |
| 1926 | +uint8_t get_clock_divider(struct pipe_ctx *pipe, bool account_low_refresh_rate) | |
| 1927 | +{ | |
| 1928 | + uint32_t clock_divider = 1; | |
| 1929 | + uint32_t numpipes = 1; | |
| 1930 | + | |
| 1931 | + if (account_low_refresh_rate && is_low_refresh_rate(pipe)) | |
| 1932 | + clock_divider *= 2; | |
| 1933 | + | |
| 1934 | + if (pipe->stream_res.pix_clk_params.pixel_encoding == PIXEL_ENCODING_YCBCR420) | |
| 1935 | + clock_divider *= 2; | |
| 1936 | + | |
| 1937 | + while (pipe->next_odm_pipe) { | |
| 1938 | + pipe = pipe->next_odm_pipe; | |
| 1939 | + numpipes++; | |
| 1940 | + } | |
| 1941 | + clock_divider *= numpipes; | |
| 1942 | + | |
| 1943 | + return clock_divider; | |
| 1944 | +} | |
| 1945 | + | |
| 1946 | +int dcn10_align_pixel_clocks( | |
| 1947 | + struct dc *dc, | |
| 1948 | + int group_size, | |
| 1949 | + struct pipe_ctx *grouped_pipes[]) | |
| 1950 | +{ | |
| 1951 | + struct dc_context *dc_ctx = dc->ctx; | |
| 1952 | + int i, master = -1, embedded = -1; | |
| 1953 | + struct dc_crtc_timing hw_crtc_timing[MAX_PIPES] = {0}; | |
| 1954 | + uint64_t phase[MAX_PIPES]; | |
| 1955 | + uint64_t modulo[MAX_PIPES]; | |
| 1956 | + unsigned int pclk; | |
| 1957 | + | |
| 1958 | + uint32_t embedded_pix_clk_100hz; | |
| 1959 | + uint16_t embedded_h_total; | |
| 1960 | + uint16_t embedded_v_total; | |
| 1961 | + bool clamshell_closed = false; | |
| 1962 | + uint32_t dp_ref_clk_100hz = | |
| 1963 | + dc->res_pool->dp_clock_source->ctx->dc->clk_mgr->dprefclk_khz*10; | |
| 1964 | + | |
| 1965 | + if (dc->config.vblank_alignment_dto_params && | |
| 1966 | + dc->res_pool->dp_clock_source->funcs->override_dp_pix_clk) { | |
| 1967 | + clamshell_closed = | |
| 1968 | + (dc->config.vblank_alignment_dto_params >> 63); | |
| 1969 | + embedded_h_total = | |
| 1970 | + (dc->config.vblank_alignment_dto_params >> 32) & 0x7FFF; | |
| 1971 | + embedded_v_total = | |
| 1972 | + (dc->config.vblank_alignment_dto_params >> 48) & 0x7FFF; | |
| 1973 | + embedded_pix_clk_100hz = | |
| 1974 | + dc->config.vblank_alignment_dto_params & 0xFFFFFFFF; | |
| 1975 | + | |
| 1976 | + for (i = 0; i < group_size; i++) { | |
| 1977 | + grouped_pipes[i]->stream_res.tg->funcs->get_hw_timing( | |
| 1978 | + grouped_pipes[i]->stream_res.tg, | |
| 1979 | + &hw_crtc_timing[i]); | |
| 1980 | + dc->res_pool->dp_clock_source->funcs->get_pixel_clk_frequency_100hz( | |
| 1981 | + dc->res_pool->dp_clock_source, | |
| 1982 | + grouped_pipes[i]->stream_res.tg->inst, | |
| 1983 | + &pclk); | |
| 1984 | + hw_crtc_timing[i].pix_clk_100hz = pclk; | |
| 1985 | + if (dc_is_embedded_signal( | |
| 1986 | + grouped_pipes[i]->stream->signal)) { | |
| 1987 | + embedded = i; | |
| 1988 | + master = i; | |
| 1989 | + phase[i] = embedded_pix_clk_100hz*100; | |
| 1990 | + modulo[i] = dp_ref_clk_100hz*100; | |
| 1991 | + } else { | |
| 1992 | + | |
| 1993 | + phase[i] = (uint64_t)embedded_pix_clk_100hz* | |
| 1994 | + hw_crtc_timing[i].h_total* | |
| 1995 | + hw_crtc_timing[i].v_total; | |
| 1996 | + phase[i] = div_u64(phase[i], get_clock_divider(grouped_pipes[i], true)); | |
| 1997 | + modulo[i] = (uint64_t)dp_ref_clk_100hz* | |
| 1998 | + embedded_h_total* | |
| 1999 | + embedded_v_total; | |
| 2000 | + | |
| 2001 | + if (reduceSizeAndFraction(&phase[i], | |
| 2002 | + &modulo[i], true) == false) { | |
| 2003 | + /* | |
| 2004 | + * this will help to stop reporting | |
| 2005 | + * this timing synchronizable | |
| 2006 | + */ | |
| 2007 | + DC_SYNC_INFO("Failed to reduce DTO parameters\n"); | |
| 2008 | + grouped_pipes[i]->stream->has_non_synchronizable_pclk = true; | |
| 2009 | + } | |
| 2010 | + } | |
| 2011 | + } | |
| 2012 | + | |
| 2013 | + for (i = 0; i < group_size; i++) { | |
| 2014 | + if (i != embedded && !grouped_pipes[i]->stream->has_non_synchronizable_pclk) { | |
| 2015 | + dc->res_pool->dp_clock_source->funcs->override_dp_pix_clk( | |
| 2016 | + dc->res_pool->dp_clock_source, | |
| 2017 | + grouped_pipes[i]->stream_res.tg->inst, | |
| 2018 | + phase[i], modulo[i]); | |
| 2019 | + dc->res_pool->dp_clock_source->funcs->get_pixel_clk_frequency_100hz( | |
| 2020 | + dc->res_pool->dp_clock_source, | |
| 2021 | + grouped_pipes[i]->stream_res.tg->inst, &pclk); | |
| 2022 | + grouped_pipes[i]->stream->timing.pix_clk_100hz = | |
| 2023 | + pclk*get_clock_divider(grouped_pipes[i], false); | |
| 2024 | + if (master == -1) | |
| 2025 | + master = i; | |
| 2026 | + } | |
| 2027 | + } | |
| 2028 | + | |
| 2029 | + } | |
| 2030 | + return master; | |
| 2031 | +} | |
| 2032 | + | |
| 2033 | +void dcn10_enable_vblanks_synchronization( | |
| 2034 | + struct dc *dc, | |
| 2035 | + int group_index, | |
| 2036 | + int group_size, | |
| 2037 | + struct pipe_ctx *grouped_pipes[]) | |
| 2038 | +{ | |
| 2039 | + struct dc_context *dc_ctx = dc->ctx; | |
| 2040 | + struct output_pixel_processor *opp; | |
| 2041 | + struct timing_generator *tg; | |
| 2042 | + int i, width, height, master; | |
| 2043 | + | |
| 2044 | + for (i = 1; i < group_size; i++) { | |
| 2045 | + opp = grouped_pipes[i]->stream_res.opp; | |
| 2046 | + tg = grouped_pipes[i]->stream_res.tg; | |
| 2047 | + tg->funcs->get_otg_active_size(tg, &width, &height); | |
| 2048 | + if (opp->funcs->opp_program_dpg_dimensions) | |
| 2049 | + opp->funcs->opp_program_dpg_dimensions(opp, width, 2*(height) + 1); | |
| 2050 | + } | |
| 2051 | + | |
| 2052 | + for (i = 0; i < group_size; i++) { | |
| 2053 | + if (grouped_pipes[i]->stream == NULL) | |
| 2054 | + continue; | |
| 2055 | + grouped_pipes[i]->stream->vblank_synchronized = false; | |
| 2056 | + grouped_pipes[i]->stream->has_non_synchronizable_pclk = false; | |
| 2057 | + } | |
| 2058 | + | |
| 2059 | + DC_SYNC_INFO("Aligning DP DTOs\n"); | |
| 2060 | + | |
| 2061 | + master = dcn10_align_pixel_clocks(dc, group_size, grouped_pipes); | |
| 2062 | + | |
| 2063 | + DC_SYNC_INFO("Synchronizing VBlanks\n"); | |
| 2064 | + | |
| 2065 | + if (master >= 0) { | |
| 2066 | + for (i = 0; i < group_size; i++) { | |
| 2067 | + if (i != master && !grouped_pipes[i]->stream->has_non_synchronizable_pclk) | |
| 2068 | + grouped_pipes[i]->stream_res.tg->funcs->align_vblanks( | |
| 2069 | + grouped_pipes[master]->stream_res.tg, | |
| 2070 | + grouped_pipes[i]->stream_res.tg, | |
| 2071 | + grouped_pipes[master]->stream->timing.pix_clk_100hz, | |
| 2072 | + grouped_pipes[i]->stream->timing.pix_clk_100hz, | |
| 2073 | + get_clock_divider(grouped_pipes[master], false), | |
| 2074 | + get_clock_divider(grouped_pipes[i], false)); | |
| 2075 | + grouped_pipes[i]->stream->vblank_synchronized = true; | |
| 2076 | + } | |
| 2077 | + grouped_pipes[master]->stream->vblank_synchronized = true; | |
| 2078 | + DC_SYNC_INFO("Sync complete\n"); | |
| 2079 | + } | |
| 2080 | + | |
| 2081 | + for (i = 1; i < group_size; i++) { | |
| 2082 | + opp = grouped_pipes[i]->stream_res.opp; | |
| 2083 | + tg = grouped_pipes[i]->stream_res.tg; | |
| 2084 | + tg->funcs->get_otg_active_size(tg, &width, &height); | |
| 2085 | + if (opp->funcs->opp_program_dpg_dimensions) | |
| 2086 | + opp->funcs->opp_program_dpg_dimensions(opp, width, height); | |
| 2087 | + } | |
| 2088 | +} | |
| 2089 | + | |
| 1854 | 2090 | void dcn10_enable_timing_synchronization( |
| 1855 | 2091 | struct dc *dc, |
| 1856 | 2092 | int group_index, |
| @@ -1872,6 +2108,12 @@ void dcn10_enable_timing_synchronization( · 15 unmodified lines | ||
| 1872 | 2108 | opp->funcs->opp_program_dpg_dimensions(opp, width, 2*(height) + 1); |
| 1873 | 2109 | } |
| 1874 | 2110 | |
| 2111 | + for (i = 0; i < group_size; i++) { | |
| 2112 | + if (grouped_pipes[i]->stream == NULL) | |
| 2113 | + continue; | |
| 2114 | + grouped_pipes[i]->stream->vblank_synchronized = false; | |
| 2115 | + } | |
| 2116 | + | |
| 1875 | 2117 | for (i = 1; i < group_size; i++) |
| 1876 | 2118 | grouped_pipes[i]->stream_res.tg->funcs->enable_reset_trigger( |
| 1877 | 2119 | grouped_pipes[i]->stream_res.tg, |
| @@ -2642,7 +2884,7 @@ static void dcn10_update_dchubp_dpp( · 764 unmodified lines | ||
| 2642 | 2884 | hws->funcs.update_plane_addr(dc, pipe_ctx); |
| 2643 | 2885 | |
| 2644 | 2886 | if (is_pipe_tree_visible(pipe_ctx)) |
| 2645 | − dc->hwss.set_hubp_blank(dc, pipe_ctx, false); | |
| 2887 | + hubp->funcs->set_blank(hubp, false); | |
| 2646 | 2888 | } |
| 2647 | 2889 | |
| 2648 | 2890 | void dcn10_blank_pixel_data( |
| @@ -3153,16 +3395,13 @@ void dcn10_setup_stereo(struct pipe_ctx *pipe_ctx, struct dc *dc) · 504 unmodified lines | ||
| 3153 | 3395 | return; |
| 3154 | 3396 | } |
| 3155 | 3397 | |
| 3156 | −static struct pipe_ctx *get_pipe_ctx_by_hubp_inst(struct dc_state *context, int mpcc_inst) | |
| 3398 | +static struct hubp *get_hubp_by_inst(struct resource_pool *res_pool, int mpcc_inst) | |
| 3157 | 3399 | { |
| 3158 | 3400 | int i; |
| 3159 | 3401 | |
| 3160 | − for (i = 0; i < MAX_PIPES; i++) { | |
| 3161 | − if (context->res_ctx.pipe_ctx[i].plane_res.hubp | |
| 3162 | − && context->res_ctx.pipe_ctx[i].plane_res.hubp->inst == mpcc_inst) { | |
| 3163 | − return &context->res_ctx.pipe_ctx[i]; | |
| 3164 | − } | |
| 3165 | − | |
| 3402 | + for (i = 0; i < res_pool->pipe_count; i++) { | |
| 3403 | + if (res_pool->hubps[i]->inst == mpcc_inst) | |
| 3404 | + return res_pool->hubps[i]; | |
| 3166 | 3405 | } |
| 3167 | 3406 | ASSERT(false); |
| 3168 | 3407 | return NULL; |
| @@ -3185,23 +3424,11 @@ void dcn10_wait_for_mpcc_disconnect( · 16 unmodified lines | ||
| 3185 | 3424 | |
| 3186 | 3425 | for (mpcc_inst = 0; mpcc_inst < MAX_PIPES; mpcc_inst++) { |
| 3187 | 3426 | if (pipe_ctx->stream_res.opp->mpcc_disconnect_pending[mpcc_inst]) { |
| 3188 | − struct pipe_ctx *restore_bottom_pipe; | |
| 3189 | − struct pipe_ctx *restore_top_pipe; | |
| 3190 | − struct pipe_ctx *inst_pipe_ctx = get_pipe_ctx_by_hubp_inst(dc->current_state, mpcc_inst); | |
| 3427 | + struct hubp *hubp = get_hubp_by_inst(res_pool, mpcc_inst); | |
| 3191 | 3428 | |
| 3192 | − ASSERT(inst_pipe_ctx); | |
| 3193 | 3429 | res_pool->mpc->funcs->wait_for_idle(res_pool->mpc, mpcc_inst); |
| 3194 | 3430 | pipe_ctx->stream_res.opp->mpcc_disconnect_pending[mpcc_inst] = false; |
| 3195 | − /* | |
| 3196 | − * Set top and bottom pipes NULL, as we don't want | |
| 3197 | − * to blank those pipes when disconnecting from MPCC | |
| 3198 | − */ | |
| 3199 | − restore_bottom_pipe = inst_pipe_ctx->bottom_pipe; | |
| 3200 | − restore_top_pipe = inst_pipe_ctx->top_pipe; | |
| 3201 | − inst_pipe_ctx->top_pipe = inst_pipe_ctx->bottom_pipe = NULL; | |
| 3202 | − dc->hwss.set_hubp_blank(dc, inst_pipe_ctx, true); | |
| 3203 | − inst_pipe_ctx->top_pipe = restore_top_pipe; | |
| 3204 | − inst_pipe_ctx->bottom_pipe = restore_bottom_pipe; | |
| 3431 | + hubp->funcs->set_blank(hubp, true); | |
| 3205 | 3432 | } |
| 3206 | 3433 | } |
| 3207 | 3434 | |
| @@ -3754,10 +3981,3 @@ void dcn10_get_clock(struct dc *dc, · 546 unmodified lines | ||
| 3754 | 3981 | dc->clk_mgr->funcs->get_clock(dc->clk_mgr, context, clock_type, clock_cfg); |
| 3755 | 3982 | |
| 3756 | 3983 | } |
| 3757 | − | |
| 3758 | −void dcn10_set_hubp_blank(const struct dc *dc, | |
| 3759 | − struct pipe_ctx *pipe_ctx, | |
| 3760 | − bool blank_enable) | |
| 3761 | −{ | |
| 3762 | − pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, blank_enable); | |
| 3763 | −} | |
| @@ -123,6 +123,11 @@ void dcn10_enable_timing_synchronization( · 122 unmodified lines | ||
| 123 | 123 | int group_index, |
| 124 | 124 | int group_size, |
| 125 | 125 | struct pipe_ctx *grouped_pipes[]); |
| 126 | +void dcn10_enable_vblanks_synchronization( | |
| 127 | + struct dc *dc, | |
| 128 | + int group_index, | |
| 129 | + int group_size, | |
| 130 | + struct pipe_ctx *grouped_pipes[]); | |
| 126 | 131 | void dcn10_enable_per_frame_crtc_position_reset( |
| 127 | 132 | struct dc *dc, |
| 128 | 133 | int group_size, |
| @@ -204,8 +209,5 @@ void dcn10_wait_for_pending_cleared(struct dc *dc, · 75 unmodified lines | ||
| 204 | 209 | struct dc_state *context); |
| 205 | 210 | void dcn10_set_hdr_multiplier(struct pipe_ctx *pipe_ctx); |
| 206 | 211 | void dcn10_verify_allow_pstate_change_high(struct dc *dc); |
| 207 | −void dcn10_set_hubp_blank(const struct dc *dc, | |
| 208 | − struct pipe_ctx *pipe_ctx, | |
| 209 | − bool blank_enable); | |
| 210 | 212 | |
| 211 | 213 | #endif /* __DC_HWSS_DCN10_H__ */ |
| @@ -79,7 +79,6 @@ static const struct hw_sequencer_funcs dcn10_funcs = { · 78 unmodified lines | ||
| 79 | 79 | .set_backlight_level = dce110_set_backlight_level, |
| 80 | 80 | .set_abm_immediate_disable = dce110_set_abm_immediate_disable, |
| 81 | 81 | .set_pipe = dce110_set_pipe, |
| 82 | − .set_hubp_blank = dcn10_set_hubp_blank, | |
| 83 | 82 | }; |
| 84 | 83 | |
| 85 | 84 | static const struct hwseq_private_funcs dcn10_private_funcs = { |
| @@ -212,6 +212,7 @@ struct dcn_optc_registers { · 211 unmodified lines | ||
| 212 | 212 | SF(OTG0_OTG_CONTROL, OTG_START_POINT_CNTL, mask_sh),\ |
| 213 | 213 | SF(OTG0_OTG_CONTROL, OTG_DISABLE_POINT_CNTL, mask_sh),\ |
| 214 | 214 | SF(OTG0_OTG_CONTROL, OTG_FIELD_NUMBER_CNTL, mask_sh),\ |
| 215 | + SF(OTG0_OTG_CONTROL, OTG_CURRENT_MASTER_EN_STATE, mask_sh),\ | |
| 215 | 216 | SF(OTG0_OTG_STEREO_CONTROL, OTG_STEREO_EN, mask_sh),\ |
| 216 | 217 | SF(OTG0_OTG_STEREO_CONTROL, OTG_STEREO_SYNC_OUTPUT_LINE_NUM, mask_sh),\ |
| 217 | 218 | SF(OTG0_OTG_STEREO_CONTROL, OTG_STEREO_SYNC_OUTPUT_POLARITY, mask_sh),\ |
| @@ -352,6 +353,7 @@ struct dcn_optc_registers { · 134 unmodified lines | ||
| 352 | 353 | type OTG_START_POINT_CNTL;\ |
| 353 | 354 | type OTG_DISABLE_POINT_CNTL;\ |
| 354 | 355 | type OTG_FIELD_NUMBER_CNTL;\ |
| 356 | + type OTG_CURRENT_MASTER_EN_STATE;\ | |
| 355 | 357 | type OTG_STEREO_EN;\ |
| 356 | 358 | type OTG_STEREO_SYNC_OUTPUT_LINE_NUM;\ |
| 357 | 359 | type OTG_STEREO_SYNC_OUTPUT_POLARITY;\ |
| @@ -82,7 +82,7 @@ const struct _vcs_dpi_ip_params_st dcn1_0_ip = { · 81 unmodified lines | ||
| 82 | 82 | .meta_chunk_size_kbytes = 2, |
| 83 | 83 | .writeback_chunk_size_kbytes = 2, |
| 84 | 84 | .line_buffer_size_bits = 589824, |
| 85 | − .max_line_buffer_lines = 12, | |
| 85 | + .max_line_buffer_lines = 32, | |
| 86 | 86 | .IsLineBufferBppFixed = 0, |
| 87 | 87 | .LineBufferFixedBpp = -1, |
| 88 | 88 | .writeback_luma_buffer_size_kbytes = 12, |
| @@ -619,6 +619,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 530 unmodified lines | ||
| 619 | 619 | .recovery_enabled = false, /*enable this by default after testing.*/ |
| 620 | 620 | .max_downscale_src_width = 3840, |
| 621 | 621 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 622 | + .use_max_lb = true | |
| 622 | 623 | }; |
| 623 | 624 | |
| 624 | 625 | static const struct dc_debug_options debug_defaults_diags = { |
| @@ -630,6 +631,7 @@ static const struct dc_debug_options debug_defaults_diags = { · 5 unmodified lines | ||
| 630 | 631 | .disable_pplib_clock_request = true, |
| 631 | 632 | .disable_pplib_wm_range = true, |
| 632 | 633 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 634 | + .use_max_lb = true | |
| 633 | 635 | }; |
| 634 | 636 | |
| 635 | 637 | static void dcn10_dpp_destroy(struct dpp **dpp) |
| @@ -1420,6 +1422,8 @@ static bool dcn10_resource_construct( · 784 unmodified lines | ||
| 1420 | 1422 | dc->caps.max_cursor_size = 256; |
| 1421 | 1423 | dc->caps.min_horizontal_blanking_period = 80; |
| 1422 | 1424 | dc->caps.max_slave_planes = 1; |
| 1425 | + dc->caps.max_slave_yuv_planes = 1; | |
| 1426 | + dc->caps.max_slave_rgb_planes = 0; | |
| 1423 | 1427 | dc->caps.is_apu = true; |
| 1424 | 1428 | dc->caps.post_blend_color_processing = false; |
| 1425 | 1429 | dc->caps.extended_aux_timeout_support = false; |
| @@ -738,7 +738,6 @@ void enc1_stream_encoder_update_dp_info_packets( · 737 unmodified lines | ||
| 738 | 738 | REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP2_ENABLE, info_frame->spd.valid); |
| 739 | 739 | REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP3_ENABLE, info_frame->hdrsmd.valid); |
| 740 | 740 | |
| 741 | − | |
| 742 | 741 | /* This bit is the master enable bit. |
| 743 | 742 | * When enabling secondary stream engine, |
| 744 | 743 | * this master bit must also be set. |
| @@ -1507,38 +1507,8 @@ static void dcn20_update_dchubp_dpp( · 1506 unmodified lines | ||
| 1507 | 1507 | if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed |
| 1508 | 1508 | || pipe_ctx->stream->update_flags.bits.gamut_remap |
| 1509 | 1509 | || pipe_ctx->stream->update_flags.bits.out_csc) { |
| 1510 | − struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc; | |
| 1511 | − | |
| 1512 | − if (mpc->funcs->set_gamut_remap) { | |
| 1513 | − int i; | |
| 1514 | − int mpcc_id = hubp->inst; | |
| 1515 | − struct mpc_grph_gamut_adjustment adjust; | |
| 1516 | − bool enable_remap_dpp = false; | |
| 1517 | − | |
| 1518 | − memset(&adjust, 0, sizeof(adjust)); | |
| 1519 | − adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS; | |
| 1520 | − | |
| 1521 | − /* save the enablement of gamut remap for dpp */ | |
| 1522 | − enable_remap_dpp = pipe_ctx->stream->gamut_remap_matrix.enable_remap; | |
| 1523 | − | |
| 1524 | − /* force bypass gamut remap for dpp/cm */ | |
| 1525 | − pipe_ctx->stream->gamut_remap_matrix.enable_remap = false; | |
| 1526 | − dc->hwss.program_gamut_remap(pipe_ctx); | |
| 1527 | − | |
| 1528 | − /* restore gamut remap flag and use this remap into mpc */ | |
| 1529 | − pipe_ctx->stream->gamut_remap_matrix.enable_remap = enable_remap_dpp; | |
| 1530 | − | |
| 1531 | − /* build remap matrix for top plane if enabled */ | |
| 1532 | − if (enable_remap_dpp && pipe_ctx->top_pipe == NULL) { | |
| 1533 | − adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW; | |
| 1534 | − for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++) | |
| 1535 | − adjust.temperature_matrix[i] = | |
| 1536 | − pipe_ctx->stream->gamut_remap_matrix.matrix[i]; | |
| 1537 | − } | |
| 1538 | − mpc->funcs->set_gamut_remap(mpc, mpcc_id, &adjust); | |
| 1539 | − } else | |
| 1540 | − /* dpp/cm gamut remap*/ | |
| 1541 | − dc->hwss.program_gamut_remap(pipe_ctx); | |
| 1510 | + /* dpp/cm gamut remap*/ | |
| 1511 | + dc->hwss.program_gamut_remap(pipe_ctx); | |
| 1542 | 1512 | |
| 1543 | 1513 | /*call the dcn2 method which uses mpc csc*/ |
| 1544 | 1514 | dc->hwss.program_output_csc(dc, |
| @@ -1581,8 +1551,8 @@ static void dcn20_update_dchubp_dpp( · 36 unmodified lines | ||
| 1581 | 1551 | |
| 1582 | 1552 | |
| 1583 | 1553 | |
| 1584 | − if (is_pipe_tree_visible(pipe_ctx)) | |
| 1585 | − dc->hwss.set_hubp_blank(dc, pipe_ctx, false); | |
| 1554 | + if (pipe_ctx->update_flags.bits.enable) | |
| 1555 | + hubp->funcs->set_blank(hubp, false); | |
| 1586 | 1556 | } |
| 1587 | 1557 | |
| 1588 | 1558 | |
| @@ -1778,10 +1748,19 @@ void dcn20_post_unlock_program_front_end( · 189 unmodified lines | ||
| 1778 | 1748 | |
| 1779 | 1749 | for (i = 0; i < dc->res_pool->pipe_count; i++) { |
| 1780 | 1750 | struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; |
| 1751 | + struct pipe_ctx *mpcc_pipe; | |
| 1781 | 1752 | |
| 1782 | 1753 | if (pipe->vtp_locked) { |
| 1783 | − dc->hwss.set_hubp_blank(dc, pipe, true); | |
| 1754 | + dc->hwseq->funcs.wait_for_blank_complete(pipe->stream_res.opp); | |
| 1755 | + pipe->plane_res.hubp->funcs->set_blank(pipe->plane_res.hubp, true); | |
| 1784 | 1756 | pipe->vtp_locked = false; |
| 1757 | + | |
| 1758 | + for (mpcc_pipe = pipe->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) | |
| 1759 | + mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, true); | |
| 1760 | + | |
| 1761 | + for (i = 0; i < dc->res_pool->pipe_count; i++) | |
| 1762 | + if (context->res_ctx.pipe_ctx[i].update_flags.bits.disable) | |
| 1763 | + dc->hwss.disable_plane(dc, &dc->current_state->res_ctx.pipe_ctx[i]); | |
| 1785 | 1764 | } |
| 1786 | 1765 | } |
| 1787 | 1766 | /* WA to apply WM setting*/ |
| @@ -42,6 +42,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { · 41 unmodified lines | ||
| 42 | 42 | .program_output_csc = dcn20_program_output_csc, |
| 43 | 43 | .enable_accelerated_mode = dce110_enable_accelerated_mode, |
| 44 | 44 | .enable_timing_synchronization = dcn10_enable_timing_synchronization, |
| 45 | + .enable_vblanks_synchronization = dcn10_enable_vblanks_synchronization, | |
| 45 | 46 | .enable_per_frame_crtc_position_reset = dcn10_enable_per_frame_crtc_position_reset, |
| 46 | 47 | .update_info_frame = dce110_update_info_frame, |
| 47 | 48 | .send_immediate_sdp_message = dcn10_send_immediate_sdp_message, |
| @@ -94,7 +95,6 @@ static const struct hw_sequencer_funcs dcn20_funcs = { · 46 unmodified lines | ||
| 94 | 95 | .optimize_timing_for_fsft = dcn20_optimize_timing_for_fsft, |
| 95 | 96 | #endif |
| 96 | 97 | .set_disp_pattern_generator = dcn20_set_disp_pattern_generator, |
| 97 | − .set_hubp_blank = dcn10_set_hubp_blank, | |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | 100 | static const struct hwseq_private_funcs dcn20_private_funcs = { |
| @@ -309,6 +309,129 @@ void optc2_set_dwb_source(struct timing_generator *optc, · 308 unmodified lines | ||
| 309 | 309 | OPTC_DWB1_SOURCE_SELECT, optc->inst); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | +void optc2_align_vblanks( | |
| 313 | + struct timing_generator *optc_master, | |
| 314 | + struct timing_generator *optc_slave, | |
| 315 | + uint32_t master_pixel_clock_100Hz, | |
| 316 | + uint32_t slave_pixel_clock_100Hz, | |
| 317 | + uint8_t master_clock_divider, | |
| 318 | + uint8_t slave_clock_divider) | |
| 319 | +{ | |
| 320 | + /* accessing slave OTG registers */ | |
| 321 | + struct optc *optc1 = DCN10TG_FROM_TG(optc_slave); | |
| 322 | + | |
| 323 | + uint32_t master_v_active = 0; | |
| 324 | + uint32_t master_h_total = 0; | |
| 325 | + uint32_t slave_h_total = 0; | |
| 326 | + uint64_t L, XY; | |
| 327 | + uint32_t X, Y, p = 10000; | |
| 328 | + uint32_t master_update_lock; | |
| 329 | + | |
| 330 | + /* disable slave OTG */ | |
| 331 | + REG_UPDATE(OTG_CONTROL, OTG_MASTER_EN, 0); | |
| 332 | + /* wait until disabled */ | |
| 333 | + REG_WAIT(OTG_CONTROL, | |
| 334 | + OTG_CURRENT_MASTER_EN_STATE, | |
| 335 | + 0, 10, 5000); | |
| 336 | + | |
| 337 | + REG_GET(OTG_H_TOTAL, OTG_H_TOTAL, &slave_h_total); | |
| 338 | + | |
| 339 | + /* assign slave OTG to be controlled by master update lock */ | |
| 340 | + REG_SET(OTG_GLOBAL_CONTROL0, 0, | |
| 341 | + OTG_MASTER_UPDATE_LOCK_SEL, optc_master->inst); | |
| 342 | + | |
| 343 | + /* accessing master OTG registers */ | |
| 344 | + optc1 = DCN10TG_FROM_TG(optc_master); | |
| 345 | + | |
| 346 | + /* saving update lock state, not sure if it's needed */ | |
| 347 | + REG_GET(OTG_MASTER_UPDATE_LOCK, | |
| 348 | + OTG_MASTER_UPDATE_LOCK, &master_update_lock); | |
| 349 | + /* unlocking master OTG */ | |
| 350 | + REG_SET(OTG_MASTER_UPDATE_LOCK, 0, | |
| 351 | + OTG_MASTER_UPDATE_LOCK, 0); | |
| 352 | + | |
| 353 | + REG_GET(OTG_V_BLANK_START_END, | |
| 354 | + OTG_V_BLANK_START, &master_v_active); | |
| 355 | + REG_GET(OTG_H_TOTAL, OTG_H_TOTAL, &master_h_total); | |
| 356 | + | |
| 357 | + /* calculate when to enable slave OTG */ | |
| 358 | + L = (uint64_t)p * slave_h_total * master_pixel_clock_100Hz; | |
| 359 | + L = div_u64(L, master_h_total); | |
| 360 | + L = div_u64(L, slave_pixel_clock_100Hz); | |
| 361 | + XY = div_u64(L, p); | |
| 362 | + Y = master_v_active - XY - 1; | |
| 363 | + X = div_u64(((XY + 1) * p - L) * master_h_total, p * master_clock_divider); | |
| 364 | + | |
| 365 | + /* | |
| 366 | + * set master OTG to unlock when V/H | |
| 367 | + * counters reach calculated values | |
| 368 | + */ | |
| 369 | + REG_UPDATE(OTG_GLOBAL_CONTROL1, | |
| 370 | + MASTER_UPDATE_LOCK_DB_EN, 1); | |
| 371 | + REG_UPDATE_2(OTG_GLOBAL_CONTROL1, | |
| 372 | + MASTER_UPDATE_LOCK_DB_X, | |
| 373 | + X, | |
| 374 | + MASTER_UPDATE_LOCK_DB_Y, | |
| 375 | + Y); | |
| 376 | + | |
| 377 | + /* lock master OTG */ | |
| 378 | + REG_SET(OTG_MASTER_UPDATE_LOCK, 0, | |
| 379 | + OTG_MASTER_UPDATE_LOCK, 1); | |
| 380 | + REG_WAIT(OTG_MASTER_UPDATE_LOCK, | |
| 381 | + UPDATE_LOCK_STATUS, 1, 1, 10); | |
| 382 | + | |
| 383 | + /* accessing slave OTG registers */ | |
| 384 | + optc1 = DCN10TG_FROM_TG(optc_slave); | |
| 385 | + | |
| 386 | + /* | |
| 387 | + * enable slave OTG, the OTG is locked with | |
| 388 | + * master's update lock, so it will not run | |
| 389 | + */ | |
| 390 | + REG_UPDATE(OTG_CONTROL, | |
| 391 | + OTG_MASTER_EN, 1); | |
| 392 | + | |
| 393 | + /* accessing master OTG registers */ | |
| 394 | + optc1 = DCN10TG_FROM_TG(optc_master); | |
| 395 | + | |
| 396 | + /* | |
| 397 | + * unlock master OTG. When master H/V counters reach | |
| 398 | + * DB_XY point, slave OTG will start | |
| 399 | + */ | |
| 400 | + REG_SET(OTG_MASTER_UPDATE_LOCK, 0, | |
| 401 | + OTG_MASTER_UPDATE_LOCK, 0); | |
| 402 | + | |
| 403 | + /* accessing slave OTG registers */ | |
| 404 | + optc1 = DCN10TG_FROM_TG(optc_slave); | |
| 405 | + | |
| 406 | + /* wait for slave OTG to start running*/ | |
| 407 | + REG_WAIT(OTG_CONTROL, | |
| 408 | + OTG_CURRENT_MASTER_EN_STATE, | |
| 409 | + 1, 10, 5000); | |
| 410 | + | |
| 411 | + /* accessing master OTG registers */ | |
| 412 | + optc1 = DCN10TG_FROM_TG(optc_master); | |
| 413 | + | |
| 414 | + /* disable the XY point*/ | |
| 415 | + REG_UPDATE(OTG_GLOBAL_CONTROL1, | |
| 416 | + MASTER_UPDATE_LOCK_DB_EN, 0); | |
| 417 | + REG_UPDATE_2(OTG_GLOBAL_CONTROL1, | |
| 418 | + MASTER_UPDATE_LOCK_DB_X, | |
| 419 | + 0, | |
| 420 | + MASTER_UPDATE_LOCK_DB_Y, | |
| 421 | + 0); | |
| 422 | + | |
| 423 | + /*restore master update lock*/ | |
| 424 | + REG_SET(OTG_MASTER_UPDATE_LOCK, 0, | |
| 425 | + OTG_MASTER_UPDATE_LOCK, master_update_lock); | |
| 426 | + | |
| 427 | + /* accessing slave OTG registers */ | |
| 428 | + optc1 = DCN10TG_FROM_TG(optc_slave); | |
| 429 | + /* restore slave to be controlled by it's own */ | |
| 430 | + REG_SET(OTG_GLOBAL_CONTROL0, 0, | |
| 431 | + OTG_MASTER_UPDATE_LOCK_SEL, optc_slave->inst); | |
| 432 | + | |
| 433 | +} | |
| 434 | + | |
| 312 | 435 | void optc2_triplebuffer_lock(struct timing_generator *optc) |
| 313 | 436 | { |
| 314 | 437 | struct optc *optc1 = DCN10TG_FROM_TG(optc); |
| @@ -468,6 +591,7 @@ static struct timing_generator_funcs dcn20_tg_funcs = { · 153 unmodified lines | ||
| 468 | 591 | .program_manual_trigger = optc2_program_manual_trigger, |
| 469 | 592 | .setup_manual_trigger = optc2_setup_manual_trigger, |
| 470 | 593 | .get_hw_timing = optc1_get_hw_timing, |
| 594 | + .align_vblanks = optc2_align_vblanks, | |
| 471 | 595 | }; |
| 472 | 596 | |
| 473 | 597 | void dcn20_timing_generator_init(struct optc *optc1) |
| @@ -112,7 +112,7 @@ struct _vcs_dpi_ip_params_st dcn2_0_ip = { · 111 unmodified lines | ||
| 112 | 112 | .is_line_buffer_bpp_fixed = 0, |
| 113 | 113 | .line_buffer_fixed_bpp = 0, |
| 114 | 114 | .dcc_supported = true, |
| 115 | − .max_line_buffer_lines = 12, | |
| 115 | + .max_line_buffer_lines = 32, | |
| 116 | 116 | .writeback_luma_buffer_size_kbytes = 12, |
| 117 | 117 | .writeback_chroma_buffer_size_kbytes = 8, |
| 118 | 118 | .writeback_chroma_line_buffer_width_pixels = 4, |
| @@ -180,7 +180,7 @@ static struct _vcs_dpi_ip_params_st dcn2_0_nv14_ip = { · 61 unmodified lines | ||
| 180 | 180 | .is_line_buffer_bpp_fixed = 0, |
| 181 | 181 | .line_buffer_fixed_bpp = 0, |
| 182 | 182 | .dcc_supported = true, |
| 183 | − .max_line_buffer_lines = 12, | |
| 183 | + .max_line_buffer_lines = 32, | |
| 184 | 184 | .writeback_luma_buffer_size_kbytes = 12, |
| 185 | 185 | .writeback_chroma_buffer_size_kbytes = 8, |
| 186 | 186 | .writeback_chroma_line_buffer_width_pixels = 4, |
| @@ -1075,6 +1075,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 888 unmodified lines | ||
| 1075 | 1075 | .scl_reset_length10 = true, |
| 1076 | 1076 | .sanity_checks = false, |
| 1077 | 1077 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 1078 | + .use_max_lb = true | |
| 1078 | 1079 | }; |
| 1079 | 1080 | |
| 1080 | 1081 | static const struct dc_debug_options debug_defaults_diags = { |
| @@ -1091,6 +1092,7 @@ static const struct dc_debug_options debug_defaults_diags = { · 10 unmodified lines | ||
| 1091 | 1092 | .scl_reset_length10 = true, |
| 1092 | 1093 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 1093 | 1094 | .enable_tri_buf = true, |
| 1095 | + .use_max_lb = true | |
| 1094 | 1096 | }; |
| 1095 | 1097 | |
| 1096 | 1098 | void dcn20_dpp_destroy(struct dpp **dpp) |
| @@ -2033,9 +2035,13 @@ int dcn20_populate_dml_pipes_from_context( · 936 unmodified lines | ||
| 2033 | 2035 | if (res_ctx->pipe_ctx[pipe_cnt].stream == res_ctx->pipe_ctx[i].stream) |
| 2034 | 2036 | continue; |
| 2035 | 2037 | |
| 2036 | − if (dc->debug.disable_timing_sync || !resource_are_streams_timing_synchronizable( | |
| 2038 | + if (dc->debug.disable_timing_sync || | |
| 2039 | + (!resource_are_streams_timing_synchronizable( | |
| 2037 | 2040 | res_ctx->pipe_ctx[pipe_cnt].stream, |
| 2038 | − res_ctx->pipe_ctx[i].stream)) { | |
| 2041 | + res_ctx->pipe_ctx[i].stream) && | |
| 2042 | + !resource_are_vblanks_synchronizable( | |
| 2043 | + res_ctx->pipe_ctx[pipe_cnt].stream, | |
| 2044 | + res_ctx->pipe_ctx[i].stream))) { | |
| 2039 | 2045 | synchronized_vblank = false; |
| 2040 | 2046 | break; |
| 2041 | 2047 | } |
| @@ -3697,6 +3703,8 @@ static bool dcn20_resource_construct( · 1655 unmodified lines | ||
| 3697 | 3703 | dc->caps.dmdata_alloc_size = 2048; |
| 3698 | 3704 | |
| 3699 | 3705 | dc->caps.max_slave_planes = 1; |
| 3706 | + dc->caps.max_slave_yuv_planes = 1; | |
| 3707 | + dc->caps.max_slave_rgb_planes = 1; | |
| 3700 | 3708 | dc->caps.post_blend_color_processing = true; |
| 3701 | 3709 | dc->caps.force_dp_tps4_for_cp2520 = true; |
| 3702 | 3710 | dc->caps.extended_aux_timeout_support = true; |
| @@ -99,7 +99,6 @@ static const struct hw_sequencer_funcs dcn21_funcs = { · 98 unmodified lines | ||
| 99 | 99 | #endif |
| 100 | 100 | .is_abm_supported = dcn21_is_abm_supported, |
| 101 | 101 | .set_disp_pattern_generator = dcn20_set_disp_pattern_generator, |
| 102 | − .set_hubp_blank = dcn10_set_hubp_blank, | |
| 103 | 102 | }; |
| 104 | 103 | |
| 105 | 104 | static const struct hwseq_private_funcs dcn21_private_funcs = { |
| @@ -61,7 +61,6 @@ · 60 unmodified lines | ||
| 61 | 61 | #include "dcn21/dcn21_dccg.h" |
| 62 | 62 | #include "dcn21_hubbub.h" |
| 63 | 63 | #include "dcn10/dcn10_resource.h" |
| 64 | −#include "dce110/dce110_resource.h" | |
| 65 | 64 | #include "dce/dce_panel_cntl.h" |
| 66 | 65 | |
| 67 | 66 | #include "dcn20/dcn20_dwb.h" |
| @@ -116,7 +115,7 @@ struct _vcs_dpi_ip_params_st dcn2_1_ip = { · 48 unmodified lines | ||
| 116 | 115 | .is_line_buffer_bpp_fixed = 0, |
| 117 | 116 | .line_buffer_fixed_bpp = 0, |
| 118 | 117 | .dcc_supported = true, |
| 119 | − .max_line_buffer_lines = 12, | |
| 118 | + .max_line_buffer_lines = 32, | |
| 120 | 119 | .writeback_luma_buffer_size_kbytes = 12, |
| 121 | 120 | .writeback_chroma_buffer_size_kbytes = 8, |
| 122 | 121 | .writeback_chroma_line_buffer_width_pixels = 4, |
| @@ -883,7 +882,9 @@ static const struct dc_debug_options debug_defaults_drv = { · 760 unmodified lines | ||
| 883 | 882 | .scl_reset_length10 = true, |
| 884 | 883 | .sanity_checks = true, |
| 885 | 884 | .disable_48mhz_pwrdwn = false, |
| 886 | − .usbc_combo_phy_reset_wa = true | |
| 885 | + .usbc_combo_phy_reset_wa = true, | |
| 886 | + .dmub_command_table = true, | |
| 887 | + .use_max_lb = true | |
| 887 | 888 | }; |
| 888 | 889 | |
| 889 | 890 | static const struct dc_debug_options debug_defaults_diags = { |
| @@ -899,7 +900,8 @@ static const struct dc_debug_options debug_defaults_diags = { · 9 unmodified lines | ||
| 899 | 900 | .disable_stutter = true, |
| 900 | 901 | .disable_48mhz_pwrdwn = true, |
| 901 | 902 | .disable_psr = true, |
| 902 | − .enable_tri_buf = true | |
| 903 | + .enable_tri_buf = true, | |
| 904 | + .use_max_lb = true | |
| 903 | 905 | }; |
| 904 | 906 | |
| 905 | 907 | enum dcn20_clk_src_array_id { |
| @@ -1595,6 +1597,11 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param · 689 unmodified lines | ||
| 1595 | 1597 | dcn2_1_soc.num_chans = bw_params->num_channels; |
| 1596 | 1598 | |
| 1597 | 1599 | ASSERT(clk_table->num_entries); |
| 1600 | + /* Copy dcn2_1_soc.clock_limits to clock_limits to avoid copying over null states later */ | |
| 1601 | + for (i = 0; i < dcn2_1_soc.num_states + 1; i++) { | |
| 1602 | + clock_limits[i] = dcn2_1_soc.clock_limits[i]; | |
| 1603 | + } | |
| 1604 | + | |
| 1598 | 1605 | for (i = 0; i < clk_table->num_entries; i++) { |
| 1599 | 1606 | /* loop backwards*/ |
| 1600 | 1607 | for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) { |
| @@ -1628,11 +1635,11 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param · 27 unmodified lines | ||
| 1628 | 1635 | dcn2_1_soc.clock_limits[i] = clock_limits[i]; |
| 1629 | 1636 | if (clk_table->num_entries) { |
| 1630 | 1637 | dcn2_1_soc.num_states = clk_table->num_entries + 1; |
| 1638 | + /* fill in min DF PState */ | |
| 1639 | + dcn2_1_soc.clock_limits[1] = construct_low_pstate_lvl(clk_table, closest_clk_lvl); | |
| 1631 | 1640 | /* duplicate last level */ |
| 1632 | 1641 | dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states - 1]; |
| 1633 | 1642 | dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states; |
| 1634 | − /* fill in min DF PState */ | |
| 1635 | − dcn2_1_soc.clock_limits[1] = construct_low_pstate_lvl(clk_table, closest_clk_lvl); | |
| 1636 | 1643 | } |
| 1637 | 1644 | |
| 1638 | 1645 | dml_init_instance(&dc->dml, &dcn2_1_soc, &dcn2_1_ip, DML_PROJECT_DCN21); |
| @@ -1975,6 +1982,8 @@ static bool dcn21_resource_construct( · 336 unmodified lines | ||
| 1975 | 1982 | dc->caps.dmdata_alloc_size = 2048; |
| 1976 | 1983 | |
| 1977 | 1984 | dc->caps.max_slave_planes = 1; |
| 1985 | + dc->caps.max_slave_yuv_planes = 1; | |
| 1986 | + dc->caps.max_slave_rgb_planes = 1; | |
| 1978 | 1987 | dc->caps.post_blend_color_processing = true; |
| 1979 | 1988 | dc->caps.force_dp_tps4_for_cp2520 = true; |
| 1980 | 1989 | dc->caps.extended_aux_timeout_support = true; |
| @@ -113,6 +113,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 112 unmodified lines | ||
| 113 | 113 | struct pwl_result_data *rgb_resulted; |
| 114 | 114 | struct pwl_result_data *rgb; |
| 115 | 115 | struct pwl_result_data *rgb_plus_1; |
| 116 | + struct pwl_result_data *rgb_minus_1; | |
| 116 | 117 | struct fixed31_32 end_value; |
| 117 | 118 | |
| 118 | 119 | int32_t region_start, region_end; |
| @@ -140,7 +141,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 21 unmodified lines | ||
| 140 | 141 | region_start = -MAX_LOW_POINT; |
| 141 | 142 | region_end = NUMBER_REGIONS - MAX_LOW_POINT; |
| 142 | 143 | } else { |
| 143 | − /* 10 segments | |
| 144 | + /* 11 segments | |
| 144 | 145 | * segment is from 2^-10 to 2^0 |
| 145 | 146 | * There are less than 256 points, for optimization |
| 146 | 147 | */ |
| @@ -154,9 +155,10 @@ bool cm3_helper_translate_curve_to_hw_format( · 7 unmodified lines | ||
| 154 | 155 | seg_distr[7] = 4; |
| 155 | 156 | seg_distr[8] = 4; |
| 156 | 157 | seg_distr[9] = 4; |
| 158 | + seg_distr[10] = 1; | |
| 157 | 159 | |
| 158 | 160 | region_start = -10; |
| 159 | − region_end = 0; | |
| 161 | + region_end = 1; | |
| 160 | 162 | } |
| 161 | 163 | |
| 162 | 164 | for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++) |
| @@ -189,6 +191,10 @@ bool cm3_helper_translate_curve_to_hw_format( · 26 unmodified lines | ||
| 189 | 191 | rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index]; |
| 190 | 192 | rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index]; |
| 191 | 193 | |
| 194 | + rgb_resulted[hw_points].red = rgb_resulted[hw_points - 1].red; | |
| 195 | + rgb_resulted[hw_points].green = rgb_resulted[hw_points - 1].green; | |
| 196 | + rgb_resulted[hw_points].blue = rgb_resulted[hw_points - 1].blue; | |
| 197 | + | |
| 192 | 198 | // All 3 color channels have same x |
| 193 | 199 | corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2), |
| 194 | 200 | dc_fixpt_from_int(region_start)); |
| @@ -259,15 +265,18 @@ bool cm3_helper_translate_curve_to_hw_format( · 64 unmodified lines | ||
| 259 | 265 | |
| 260 | 266 | rgb = rgb_resulted; |
| 261 | 267 | rgb_plus_1 = rgb_resulted + 1; |
| 268 | + rgb_minus_1 = rgb; | |
| 262 | 269 | |
| 263 | 270 | i = 1; |
| 264 | 271 | while (i != hw_points + 1) { |
| 265 | − if (dc_fixpt_lt(rgb_plus_1->red, rgb->red)) | |
| 266 | − rgb_plus_1->red = rgb->red; | |
| 267 | − if (dc_fixpt_lt(rgb_plus_1->green, rgb->green)) | |
| 268 | − rgb_plus_1->green = rgb->green; | |
| 269 | − if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue)) | |
| 270 | − rgb_plus_1->blue = rgb->blue; | |
| 272 | + if (i >= hw_points - 1) { | |
| 273 | + if (dc_fixpt_lt(rgb_plus_1->red, rgb->red)) | |
| 274 | + rgb_plus_1->red = dc_fixpt_add(rgb->red, rgb_minus_1->delta_red); | |
| 275 | + if (dc_fixpt_lt(rgb_plus_1->green, rgb->green)) | |
| 276 | + rgb_plus_1->green = dc_fixpt_add(rgb->green, rgb_minus_1->delta_green); | |
| 277 | + if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue)) | |
| 278 | + rgb_plus_1->blue = dc_fixpt_add(rgb->blue, rgb_minus_1->delta_blue); | |
| 279 | + } | |
| 271 | 280 | |
| 272 | 281 | rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red); |
| 273 | 282 | rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green); |
| @@ -283,6 +292,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 9 unmodified lines | ||
| 283 | 292 | } |
| 284 | 293 | |
| 285 | 294 | ++rgb_plus_1; |
| 295 | + rgb_minus_1 = rgb; | |
| 286 | 296 | ++rgb; |
| 287 | 297 | ++i; |
| 288 | 298 | } |
| @@ -454,7 +454,6 @@ static void enc3_stream_encoder_update_dp_info_packets( · 453 unmodified lines | ||
| 454 | 454 | REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP2_ENABLE, info_frame->spd.valid); |
| 455 | 455 | REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP3_ENABLE, info_frame->hdrsmd.valid); |
| 456 | 456 | |
| 457 | − | |
| 458 | 457 | /* This bit is the master enable bit. |
| 459 | 458 | * When enabling secondary stream engine, |
| 460 | 459 | * this master bit must also be set. |
| @@ -718,7 +718,7 @@ bool dpp3_program_blnd_lut( · 717 unmodified lines | ||
| 718 | 718 | next_mode = LUT_RAM_B; |
| 719 | 719 | |
| 720 | 720 | dpp3_power_on_blnd_lut(dpp_base, true); |
| 721 | − dpp3_configure_blnd_lut(dpp_base, next_mode == LUT_RAM_A ? true:false); | |
| 721 | + dpp3_configure_blnd_lut(dpp_base, next_mode == LUT_RAM_A); | |
| 722 | 722 | |
| 723 | 723 | if (next_mode == LUT_RAM_A) |
| 724 | 724 | dpp3_program_blnd_luta_settings(dpp_base, params); |
| @@ -1136,7 +1136,7 @@ bool dpp3_program_shaper( · 411 unmodified lines | ||
| 1136 | 1136 | else |
| 1137 | 1137 | next_mode = LUT_RAM_A; |
| 1138 | 1138 | |
| 1139 | − dpp3_configure_shaper_lut(dpp_base, next_mode == LUT_RAM_A ? true:false); | |
| 1139 | + dpp3_configure_shaper_lut(dpp_base, next_mode == LUT_RAM_A); | |
| 1140 | 1140 | |
| 1141 | 1141 | if (next_mode == LUT_RAM_A) |
| 1142 | 1142 | dpp3_program_shaper_luta_settings(dpp_base, params); |
| @@ -240,7 +240,7 @@ bool dpp3_program_gamcor_lut( · 239 unmodified lines | ||
| 240 | 240 | next_mode = LUT_RAM_A; |
| 241 | 241 | |
| 242 | 242 | dpp3_power_on_gamcor_lut(dpp_base, true); |
| 243 | − dpp3_configure_gamcor_lut(dpp_base, next_mode == LUT_RAM_A ? true:false); | |
| 243 | + dpp3_configure_gamcor_lut(dpp_base, next_mode == LUT_RAM_A); | |
| 244 | 244 | |
| 245 | 245 | if (next_mode == LUT_RAM_B) { |
| 246 | 246 | gam_regs.start_cntl_b = REG(CM_GAMCOR_RAMB_START_CNTL_B); |
| @@ -295,7 +295,7 @@ bool dpp3_program_gamcor_lut( · 48 unmodified lines | ||
| 295 | 295 | cm_helper_program_gamcor_xfer_func(dpp_base->ctx, params, &gam_regs); |
| 296 | 296 | |
| 297 | 297 | dpp3_program_gammcor_lut(dpp_base, params->rgb_resulted, params->hw_points_num, |
| 298 | − next_mode == LUT_RAM_A ? true:false); | |
| 298 | + next_mode == LUT_RAM_A); | |
| 299 | 299 | |
| 300 | 300 | //select Gamma LUT to use for next frame |
| 301 | 301 | REG_UPDATE(CM_GAMCOR_CONTROL, CM_GAMCOR_SELECT, next_mode == LUT_RAM_A ? 0:1); |
| @@ -217,7 +217,7 @@ static bool dwb3_program_ogam_lut( · 216 unmodified lines | ||
| 217 | 217 | else |
| 218 | 218 | next_mode = LUT_RAM_A; |
| 219 | 219 | |
| 220 | − dwb3_configure_ogam_lut(dwbc30, next_mode == LUT_RAM_A ? true : false); | |
| 220 | + dwb3_configure_ogam_lut(dwbc30, next_mode == LUT_RAM_A); | |
| 221 | 221 | |
| 222 | 222 | if (next_mode == LUT_RAM_A) |
| 223 | 223 | dwb3_program_ogam_luta_settings(dwbc30, params); |
| @@ -421,11 +421,12 @@ void dcn30_program_all_writeback_pipes_in_tree( · 420 unmodified lines | ||
| 421 | 421 | |
| 422 | 422 | void dcn30_init_hw(struct dc *dc) |
| 423 | 423 | { |
| 424 | − int i, j; | |
| 425 | 424 | struct abm **abms = dc->res_pool->multiple_abms; |
| 426 | 425 | struct dce_hwseq *hws = dc->hwseq; |
| 427 | 426 | struct dc_bios *dcb = dc->ctx->dc_bios; |
| 428 | 427 | struct resource_pool *res_pool = dc->res_pool; |
| 428 | + int i, j; | |
| 429 | + int edp_num; | |
| 429 | 430 | uint32_t backlight = MAX_BACKLIGHT_LEVEL; |
| 430 | 431 | |
| 431 | 432 | if (dc->clk_mgr && dc->clk_mgr->funcs->init_clocks) |
| @@ -574,17 +575,23 @@ void dcn30_init_hw(struct dc *dc) · 142 unmodified lines | ||
| 574 | 575 | * if DIG is turned on and seamless boot not enabled |
| 575 | 576 | */ |
| 576 | 577 | if (dc->config.power_down_display_on_boot) { |
| 577 | − struct dc_link *edp_link = get_edp_link(dc); | |
| 578 | − | |
| 579 | − if (edp_link && | |
| 580 | − edp_link->link_enc->funcs->is_dig_enabled && | |
| 581 | − edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) && | |
| 582 | − dc->hwss.edp_backlight_control && | |
| 583 | − dc->hwss.power_down && | |
| 584 | − dc->hwss.edp_power_control) { | |
| 585 | − dc->hwss.edp_backlight_control(edp_link, false); | |
| 586 | − dc->hwss.power_down(dc); | |
| 587 | − dc->hwss.edp_power_control(edp_link, false); | |
| 578 | + struct dc_link *edp_links[MAX_NUM_EDP]; | |
| 579 | + struct dc_link *edp_link; | |
| 580 | + | |
| 581 | + get_edp_links(dc, edp_links, &edp_num); | |
| 582 | + if (edp_num) { | |
| 583 | + for (i = 0; i < edp_num; i++) { | |
| 584 | + edp_link = edp_links[i]; | |
| 585 | + if (edp_link->link_enc->funcs->is_dig_enabled && | |
| 586 | + edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) && | |
| 587 | + dc->hwss.edp_backlight_control && | |
| 588 | + dc->hwss.power_down && | |
| 589 | + dc->hwss.edp_power_control) { | |
| 590 | + dc->hwss.edp_backlight_control(edp_link, false); | |
| 591 | + dc->hwss.power_down(dc); | |
| 592 | + dc->hwss.edp_power_control(edp_link, false); | |
| 593 | + } | |
| 594 | + } | |
| 588 | 595 | } else { |
| 589 | 596 | for (i = 0; i < dc->link_count; i++) { |
| 590 | 597 | struct dc_link *link = dc->links[i]; |
| @@ -651,7 +658,7 @@ void dcn30_set_avmute(struct pipe_ctx *pipe_ctx, bool enable) · 60 unmodified lines | ||
| 651 | 658 | if (pipe_ctx == NULL) |
| 652 | 659 | return; |
| 653 | 660 | |
| 654 | − if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal) && pipe_ctx->stream_res.stream_enc != NULL) | |
| 661 | + if (dc_is_hdmi_signal(pipe_ctx->stream->signal) && pipe_ctx->stream_res.stream_enc != NULL) | |
| 655 | 662 | pipe_ctx->stream_res.stream_enc->funcs->set_avmute( |
| 656 | 663 | pipe_ctx->stream_res.stream_enc, |
| 657 | 664 | enable); |
| @@ -848,7 +855,7 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable) · 190 unmodified lines | ||
| 848 | 855 | |
| 849 | 856 | cmd.mall.cursor_copy_src.quad_part = cursor_attr.address.quad_part; |
| 850 | 857 | cmd.mall.cursor_copy_dst.quad_part = |
| 851 | − plane->address.grph.cursor_cache_addr.quad_part; | |
| 858 | + (plane->address.grph.cursor_cache_addr.quad_part + 2047) & ~2047; | |
| 852 | 859 | cmd.mall.cursor_width = cursor_attr.width; |
| 853 | 860 | cmd.mall.cursor_height = cursor_attr.height; |
| 854 | 861 | cmd.mall.cursor_pitch = cursor_attr.pitch; |
| @@ -858,8 +865,7 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable) · 3 unmodified lines | ||
| 858 | 865 | dc_dmub_srv_wait_idle(dc->ctx->dmub_srv); |
| 859 | 866 | |
| 860 | 867 | /* Use copied cursor, and it's okay to not switch back */ |
| 861 | − cursor_attr.address.quad_part = | |
| 862 | − plane->address.grph.cursor_cache_addr.quad_part; | |
| 868 | + cursor_attr.address.quad_part = cmd.mall.cursor_copy_dst.quad_part; | |
| 863 | 869 | dc_stream_set_cursor_attributes(stream, &cursor_attr); |
| 864 | 870 | } |
| 865 | 871 | |
| @@ -940,53 +946,6 @@ void dcn30_hardware_release(struct dc *dc) · 74 unmodified lines | ||
| 940 | 946 | dc->res_pool->hubbub, true, true); |
| 941 | 947 | } |
| 942 | 948 | |
| 943 | −void dcn30_set_hubp_blank(const struct dc *dc, | |
| 944 | − struct pipe_ctx *pipe_ctx, | |
| 945 | − bool blank_enable) | |
| 946 | −{ | |
| 947 | − struct pipe_ctx *mpcc_pipe; | |
| 948 | − struct pipe_ctx *odm_pipe; | |
| 949 | − | |
| 950 | − if (blank_enable) { | |
| 951 | − struct plane_resource *plane_res = &pipe_ctx->plane_res; | |
| 952 | − struct stream_resource *stream_res = &pipe_ctx->stream_res; | |
| 953 | − | |
| 954 | − /* Wait for enter vblank */ | |
| 955 | − stream_res->tg->funcs->wait_for_state(stream_res->tg, CRTC_STATE_VBLANK); | |
| 956 | − | |
| 957 | − /* Blank HUBP to allow p-state during blank on all timings */ | |
| 958 | − pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, true); | |
| 959 | − /* Confirm hubp in blank */ | |
| 960 | − ASSERT(plane_res->hubp->funcs->hubp_in_blank(plane_res->hubp)); | |
| 961 | − /* Toggle HUBP_DISABLE */ | |
| 962 | − plane_res->hubp->funcs->hubp_soft_reset(plane_res->hubp, true); | |
| 963 | − plane_res->hubp->funcs->hubp_soft_reset(plane_res->hubp, false); | |
| 964 | − for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) { | |
| 965 | − mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, true); | |
| 966 | − /* Confirm hubp in blank */ | |
| 967 | − ASSERT(mpcc_pipe->plane_res.hubp->funcs->hubp_in_blank(mpcc_pipe->plane_res.hubp)); | |
| 968 | − /* Toggle HUBP_DISABLE */ | |
| 969 | − mpcc_pipe->plane_res.hubp->funcs->hubp_soft_reset(mpcc_pipe->plane_res.hubp, true); | |
| 970 | − mpcc_pipe->plane_res.hubp->funcs->hubp_soft_reset(mpcc_pipe->plane_res.hubp, false); | |
| 971 | − | |
| 972 | − } | |
| 973 | − for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) { | |
| 974 | − odm_pipe->plane_res.hubp->funcs->set_blank(odm_pipe->plane_res.hubp, true); | |
| 975 | − /* Confirm hubp in blank */ | |
| 976 | − ASSERT(odm_pipe->plane_res.hubp->funcs->hubp_in_blank(odm_pipe->plane_res.hubp)); | |
| 977 | − /* Toggle HUBP_DISABLE */ | |
| 978 | − odm_pipe->plane_res.hubp->funcs->hubp_soft_reset(odm_pipe->plane_res.hubp, true); | |
| 979 | − odm_pipe->plane_res.hubp->funcs->hubp_soft_reset(odm_pipe->plane_res.hubp, false); | |
| 980 | − } | |
| 981 | − } else { | |
| 982 | − pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, false); | |
| 983 | − for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) | |
| 984 | − mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, false); | |
| 985 | − for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) | |
| 986 | − odm_pipe->plane_res.hubp->funcs->set_blank(odm_pipe->plane_res.hubp, false); | |
| 987 | − } | |
| 988 | −} | |
| 989 | − | |
| 990 | 949 | void dcn30_set_disp_pattern_generator(const struct dc *dc, |
| 991 | 950 | struct pipe_ctx *pipe_ctx, |
| 992 | 951 | enum controller_dp_test_pattern test_pattern, |
| @@ -996,6 +955,7 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc, · 3 unmodified lines | ||
| 996 | 955 | int width, int height, int offset) |
| 997 | 956 | { |
| 998 | 957 | struct stream_resource *stream_res = &pipe_ctx->stream_res; |
| 958 | + struct pipe_ctx *mpcc_pipe; | |
| 999 | 959 | |
| 1000 | 960 | if (test_pattern != CONTROLLER_DP_TEST_PATTERN_VIDEOMODE) { |
| 1001 | 961 | pipe_ctx->vtp_locked = false; |
| @@ -1007,12 +967,20 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc, · 5 unmodified lines | ||
| 1007 | 967 | if (stream_res->tg->funcs->is_tg_enabled(stream_res->tg)) { |
| 1008 | 968 | if (stream_res->tg->funcs->is_locked(stream_res->tg)) |
| 1009 | 969 | pipe_ctx->vtp_locked = true; |
| 1010 | − else | |
| 1011 | − dc->hwss.set_hubp_blank(dc, pipe_ctx, true); | |
| 970 | + else { | |
| 971 | + /* Blank HUBP to allow p-state during blank on all timings */ | |
| 972 | + pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, true); | |
| 973 | + | |
| 974 | + for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) | |
| 975 | + mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, true); | |
| 976 | + } | |
| 1012 | 977 | } |
| 1013 | 978 | } else { |
| 1014 | − dc->hwss.set_hubp_blank(dc, pipe_ctx, false); | |
| 1015 | 979 | /* turning off DPG */ |
| 980 | + pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, false); | |
| 981 | + for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) | |
| 982 | + mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, false); | |
| 983 | + | |
| 1016 | 984 | stream_res->opp->funcs->opp_set_disp_pattern_generator(stream_res->opp, test_pattern, color_space, |
| 1017 | 985 | color_depth, solid_color, width, height, offset); |
| 1018 | 986 | } |
| @@ -80,8 +80,4 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc, · 79 unmodified lines | ||
| 80 | 80 | const struct tg_color *solid_color, |
| 81 | 81 | int width, int height, int offset); |
| 82 | 82 | |
| 83 | −void dcn30_set_hubp_blank(const struct dc *dc, | |
| 84 | − struct pipe_ctx *pipe_ctx, | |
| 85 | − bool blank_enable); | |
| 86 | − | |
| 87 | 83 | #endif /* __DC_HWSS_DCN30_H__ */ |
| @@ -98,7 +98,6 @@ static const struct hw_sequencer_funcs dcn30_funcs = { · 97 unmodified lines | ||
| 98 | 98 | .hardware_release = dcn30_hardware_release, |
| 99 | 99 | .set_pipe = dcn21_set_pipe, |
| 100 | 100 | .set_disp_pattern_generator = dcn30_set_disp_pattern_generator, |
| 101 | − .set_hubp_blank = dcn30_set_hubp_blank, | |
| 102 | 101 | }; |
| 103 | 102 | |
| 104 | 103 | static const struct hwseq_private_funcs dcn30_private_funcs = { |
| @@ -143,16 +143,18 @@ static void mpc3_power_on_ogam_lut( · 142 unmodified lines | ||
| 143 | 143 | { |
| 144 | 144 | struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc); |
| 145 | 145 | |
| 146 | − if (mpc->ctx->dc->debug.enable_mem_low_power.bits.mpc) { | |
| 147 | − // Force power on | |
| 148 | − REG_UPDATE(MPCC_MEM_PWR_CTRL[mpcc_id], MPCC_OGAM_MEM_PWR_DIS, power_on == true ? 1:0); | |
| 149 | − // Wait for confirmation when powering on | |
| 150 | − if (power_on) | |
| 151 | − REG_WAIT(MPCC_MEM_PWR_CTRL[mpcc_id], MPCC_OGAM_MEM_PWR_STATE, 0, 10, 10); | |
| 152 | − } else { | |
| 153 | − REG_SET(MPCC_MEM_PWR_CTRL[mpcc_id], 0, | |
| 154 | − MPCC_OGAM_MEM_PWR_FORCE, power_on == true ? 0 : 1); | |
| 155 | − } | |
| 146 | + /* | |
| 147 | + * Powering on: force memory active so the LUT can be updated. | |
| 148 | + * Powering off: allow entering memory low power mode | |
| 149 | + * | |
| 150 | + * Memory low power mode is controlled during MPC OGAM LUT init. | |
| 151 | + */ | |
| 152 | + REG_UPDATE(MPCC_MEM_PWR_CTRL[mpcc_id], | |
| 153 | + MPCC_OGAM_MEM_PWR_DIS, power_on != 0); | |
| 154 | + | |
| 155 | + /* Wait for memory to be powered on - we won't be able to write to it otherwise. */ | |
| 156 | + if (power_on) | |
| 157 | + REG_WAIT(MPCC_MEM_PWR_CTRL[mpcc_id], MPCC_OGAM_MEM_PWR_STATE, 0, 10, 10); | |
| 156 | 158 | } |
| 157 | 159 | |
| 158 | 160 | static void mpc3_configure_ogam_lut( |
| @@ -355,7 +357,7 @@ void mpc3_set_output_gamma( · 196 unmodified lines | ||
| 355 | 357 | next_mode = LUT_RAM_A; |
| 356 | 358 | |
| 357 | 359 | mpc3_power_on_ogam_lut(mpc, mpcc_id, true); |
| 358 | − mpc3_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A ? true:false); | |
| 360 | + mpc3_configure_ogam_lut(mpc, mpcc_id, next_mode == LUT_RAM_A); | |
| 359 | 361 | |
| 360 | 362 | if (next_mode == LUT_RAM_A) |
| 361 | 363 | mpc3_program_luta(mpc, mpcc_id, params); |
| @@ -1427,7 +1429,7 @@ const struct mpc_funcs dcn30_mpc_funcs = { · 1065 unmodified lines | ||
| 1427 | 1429 | .acquire_rmu = mpcc3_acquire_rmu, |
| 1428 | 1430 | .program_3dlut = mpc3_program_3dlut, |
| 1429 | 1431 | .release_rmu = mpcc3_release_rmu, |
| 1430 | − .power_on_mpc_mem_pwr = mpc20_power_on_ogam_lut, | |
| 1432 | + .power_on_mpc_mem_pwr = mpc3_power_on_ogam_lut, | |
| 1431 | 1433 | .get_mpc_out_mux = mpc1_get_mpc_out_mux, |
| 1432 | 1434 | |
| 1433 | 1435 | }; |
| @@ -120,7 +120,7 @@ struct _vcs_dpi_ip_params_st dcn3_0_ip = { · 119 unmodified lines | ||
| 120 | 120 | .dcc_supported = true, |
| 121 | 121 | .writeback_interface_buffer_size_kbytes = 90, |
| 122 | 122 | .writeback_line_buffer_buffer_size = 0, |
| 123 | − .max_line_buffer_lines = 12, | |
| 123 | + .max_line_buffer_lines = 32, | |
| 124 | 124 | .writeback_luma_buffer_size_kbytes = 12, // writeback_line_buffer_buffer_size = 656640 |
| 125 | 125 | .writeback_chroma_buffer_size_kbytes = 8, |
| 126 | 126 | .writeback_chroma_line_buffer_width_pixels = 4, |
| @@ -181,7 +181,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_0_soc = { · 54 unmodified lines | ||
| 181 | 181 | }, |
| 182 | 182 | .min_dcfclk = 500.0, /* TODO: set this to actual min DCFCLK */ |
| 183 | 183 | .num_states = 1, |
| 184 | − .sr_exit_time_us = 12, | |
| 184 | + .sr_exit_time_us = 15.5, | |
| 185 | 185 | .sr_enter_plus_exit_time_us = 20, |
| 186 | 186 | .urgent_latency_us = 4.0, |
| 187 | 187 | .urgent_latency_pixel_data_only_us = 4.0, |
| @@ -852,6 +852,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 664 unmodified lines | ||
| 852 | 852 | .dwb_fi_phase = -1, // -1 = disable, |
| 853 | 853 | .dmub_command_table = true, |
| 854 | 854 | .disable_psr = false, |
| 855 | + .use_max_lb = true | |
| 855 | 856 | }; |
| 856 | 857 | |
| 857 | 858 | static const struct dc_debug_options debug_defaults_diags = { |
| @@ -870,6 +871,7 @@ static const struct dc_debug_options debug_defaults_diags = { · 12 unmodified lines | ||
| 870 | 871 | .dmub_command_table = true, |
| 871 | 872 | .disable_psr = true, |
| 872 | 873 | .enable_tri_buf = true, |
| 874 | + .use_max_lb = true | |
| 873 | 875 | }; |
| 874 | 876 | |
| 875 | 877 | void dcn30_dpp_destroy(struct dpp **dpp) |
| @@ -1874,6 +1876,7 @@ static noinline bool dcn30_internal_validate_bw( · 998 unmodified lines | ||
| 1874 | 1876 | if (!pipes) |
| 1875 | 1877 | return false; |
| 1876 | 1878 | |
| 1879 | + dc->res_pool->funcs->update_soc_for_wm_a(dc, context); | |
| 1877 | 1880 | pipe_cnt = dc->res_pool->funcs->populate_dml_pipes(dc, context, pipes, fast_validate); |
| 1878 | 1881 | |
| 1879 | 1882 | DC_FP_START(); |
| @@ -2223,11 +2226,7 @@ static noinline void dcn30_calculate_wm_and_dlg_fp( · 343 unmodified lines | ||
| 2223 | 2226 | * |
| 2224 | 2227 | * Set A calculated last so that following calculations are based on Set A |
| 2225 | 2228 | */ |
| 2226 | − if (dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].valid) { | |
| 2227 | − context->bw_ctx.dml.soc.dram_clock_change_latency_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us; | |
| 2228 | − context->bw_ctx.dml.soc.sr_enter_plus_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.sr_enter_plus_exit_time_us; | |
| 2229 | − context->bw_ctx.dml.soc.sr_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.sr_exit_time_us; | |
| 2230 | − } | |
| 2229 | + dc->res_pool->funcs->update_soc_for_wm_a(dc, context); | |
| 2231 | 2230 | context->bw_ctx.bw.dcn.watermarks.a.urgent_ns = get_wm_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000; |
| 2232 | 2231 | context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000; |
| 2233 | 2232 | context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000; |
| @@ -2270,6 +2269,15 @@ static noinline void dcn30_calculate_wm_and_dlg_fp( · 36 unmodified lines | ||
| 2270 | 2269 | dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us; |
| 2271 | 2270 | } |
| 2272 | 2271 | |
| 2272 | +void dcn30_update_soc_for_wm_a(struct dc *dc, struct dc_state *context) | |
| 2273 | +{ | |
| 2274 | + if (dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].valid) { | |
| 2275 | + context->bw_ctx.dml.soc.dram_clock_change_latency_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us; | |
| 2276 | + context->bw_ctx.dml.soc.sr_enter_plus_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.sr_enter_plus_exit_time_us; | |
| 2277 | + context->bw_ctx.dml.soc.sr_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.sr_exit_time_us; | |
| 2278 | + } | |
| 2279 | +} | |
| 2280 | + | |
| 2273 | 2281 | void dcn30_calculate_wm_and_dlg( |
| 2274 | 2282 | struct dc *dc, struct dc_state *context, |
| 2275 | 2283 | display_e2e_pipe_params_st *pipes, |
| @@ -2494,6 +2502,7 @@ static const struct resource_funcs dcn30_res_pool_funcs = { · 218 unmodified lines | ||
| 2494 | 2502 | .panel_cntl_create = dcn30_panel_cntl_create, |
| 2495 | 2503 | .validate_bandwidth = dcn30_validate_bandwidth, |
| 2496 | 2504 | .calculate_wm_and_dlg = dcn30_calculate_wm_and_dlg, |
| 2505 | + .update_soc_for_wm_a = dcn30_update_soc_for_wm_a, | |
| 2497 | 2506 | .populate_dml_pipes = dcn30_populate_dml_pipes_from_context, |
| 2498 | 2507 | .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer, |
| 2499 | 2508 | .add_stream_to_ctx = dcn30_add_stream_to_ctx, |
| @@ -2566,6 +2575,8 @@ static bool dcn30_resource_construct( · 66 unmodified lines | ||
| 2566 | 2575 | dc->caps.cursor_cache_size = dc->caps.max_cursor_size * dc->caps.max_cursor_size * 8; |
| 2567 | 2576 | |
| 2568 | 2577 | dc->caps.max_slave_planes = 1; |
| 2578 | + dc->caps.max_slave_yuv_planes = 1; | |
| 2579 | + dc->caps.max_slave_rgb_planes = 1; | |
| 2569 | 2580 | dc->caps.post_blend_color_processing = true; |
| 2570 | 2581 | dc->caps.force_dp_tps4_for_cp2520 = true; |
| 2571 | 2582 | dc->caps.extended_aux_timeout_support = true; |
| @@ -60,6 +60,7 @@ void dcn30_calculate_wm_and_dlg( · 59 unmodified lines | ||
| 60 | 60 | display_e2e_pipe_params_st *pipes, |
| 61 | 61 | int pipe_cnt, |
| 62 | 62 | int vlevel); |
| 63 | +void dcn30_update_soc_for_wm_a(struct dc *dc, struct dc_state *context); | |
| 63 | 64 | void dcn30_populate_dml_writeback_from_context( |
| 64 | 65 | struct dc *dc, struct resource_context *res_ctx, display_e2e_pipe_params_st *pipes); |
| 65 | 66 | |
| @@ -98,7 +98,6 @@ static const struct hw_sequencer_funcs dcn301_funcs = { · 97 unmodified lines | ||
| 98 | 98 | .set_abm_immediate_disable = dcn21_set_abm_immediate_disable, |
| 99 | 99 | .set_pipe = dcn21_set_pipe, |
| 100 | 100 | .set_disp_pattern_generator = dcn30_set_disp_pattern_generator, |
| 101 | − .set_hubp_blank = dcn30_set_hubp_blank, | |
| 102 | 101 | }; |
| 103 | 102 | |
| 104 | 103 | static const struct hwseq_private_funcs dcn301_private_funcs = { |
| @@ -116,7 +116,7 @@ struct _vcs_dpi_ip_params_st dcn3_01_ip = { · 115 unmodified lines | ||
| 116 | 116 | .dcc_supported = true, |
| 117 | 117 | .writeback_interface_buffer_size_kbytes = 90, |
| 118 | 118 | .writeback_line_buffer_buffer_size = 656640, |
| 119 | − .max_line_buffer_lines = 12, | |
| 119 | + .max_line_buffer_lines = 32, | |
| 120 | 120 | .writeback_luma_buffer_size_kbytes = 12, // writeback_line_buffer_buffer_size = 656640 |
| 121 | 121 | .writeback_chroma_buffer_size_kbytes = 8, |
| 122 | 122 | .writeback_chroma_line_buffer_width_pixels = 4, |
| @@ -873,6 +873,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 750 unmodified lines | ||
| 873 | 873 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 874 | 874 | .dwb_fi_phase = -1, // -1 = disable |
| 875 | 875 | .dmub_command_table = true, |
| 876 | + .use_max_lb = false, | |
| 876 | 877 | }; |
| 877 | 878 | |
| 878 | 879 | static const struct dc_debug_options debug_defaults_diags = { |
| @@ -889,6 +890,7 @@ static const struct dc_debug_options debug_defaults_diags = { · 10 unmodified lines | ||
| 889 | 890 | .scl_reset_length10 = true, |
| 890 | 891 | .dwb_fi_phase = -1, // -1 = disable |
| 891 | 892 | .dmub_command_table = true, |
| 893 | + .use_max_lb = false, | |
| 892 | 894 | }; |
| 893 | 895 | |
| 894 | 896 | void dcn301_dpp_destroy(struct dpp **dpp) |
| @@ -1719,6 +1721,7 @@ static struct resource_funcs dcn301_res_pool_funcs = { · 824 unmodified lines | ||
| 1719 | 1721 | .panel_cntl_create = dcn301_panel_cntl_create, |
| 1720 | 1722 | .validate_bandwidth = dcn30_validate_bandwidth, |
| 1721 | 1723 | .calculate_wm_and_dlg = dcn301_calculate_wm_and_dlg, |
| 1724 | + .update_soc_for_wm_a = dcn30_update_soc_for_wm_a, | |
| 1722 | 1725 | .populate_dml_pipes = dcn30_populate_dml_pipes_from_context, |
| 1723 | 1726 | .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer, |
| 1724 | 1727 | .add_stream_to_ctx = dcn30_add_stream_to_ctx, |
| @@ -1764,6 +1767,8 @@ static bool dcn301_resource_construct( · 39 unmodified lines | ||
| 1764 | 1767 | dc->caps.min_horizontal_blanking_period = 80; |
| 1765 | 1768 | dc->caps.dmdata_alloc_size = 2048; |
| 1766 | 1769 | dc->caps.max_slave_planes = 1; |
| 1770 | + dc->caps.max_slave_yuv_planes = 1; | |
| 1771 | + dc->caps.max_slave_rgb_planes = 1; | |
| 1767 | 1772 | dc->caps.is_apu = true; |
| 1768 | 1773 | dc->caps.post_blend_color_processing = true; |
| 1769 | 1774 | dc->caps.force_dp_tps4_for_cp2520 = true; |
| @@ -101,7 +101,7 @@ struct _vcs_dpi_ip_params_st dcn3_02_ip = { · 100 unmodified lines | ||
| 101 | 101 | .dcc_supported = true, |
| 102 | 102 | .writeback_interface_buffer_size_kbytes = 90, |
| 103 | 103 | .writeback_line_buffer_buffer_size = 0, |
| 104 | − .max_line_buffer_lines = 12, | |
| 104 | + .max_line_buffer_lines = 32, | |
| 105 | 105 | .writeback_luma_buffer_size_kbytes = 12, // writeback_line_buffer_buffer_size = 656640 |
| 106 | 106 | .writeback_chroma_buffer_size_kbytes = 8, |
| 107 | 107 | .writeback_chroma_line_buffer_width_pixels = 4, |
| @@ -223,6 +223,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 115 unmodified lines | ||
| 223 | 223 | .underflow_assert_delay_us = 0xFFFFFFFF, |
| 224 | 224 | .dwb_fi_phase = -1, // -1 = disable, |
| 225 | 225 | .dmub_command_table = true, |
| 226 | + .use_max_lb = true | |
| 226 | 227 | }; |
| 227 | 228 | |
| 228 | 229 | static const struct dc_debug_options debug_defaults_diags = { |
| @@ -241,6 +242,7 @@ static const struct dc_debug_options debug_defaults_diags = { · 12 unmodified lines | ||
| 241 | 242 | .dmub_command_table = true, |
| 242 | 243 | .enable_tri_buf = true, |
| 243 | 244 | .disable_psr = true, |
| 245 | + .use_max_lb = true | |
| 244 | 246 | }; |
| 245 | 247 | |
| 246 | 248 | enum dcn302_clk_src_array_id { |
| @@ -1395,6 +1397,7 @@ static struct resource_funcs dcn302_res_pool_funcs = { · 1148 unmodified lines | ||
| 1395 | 1397 | .panel_cntl_create = dcn302_panel_cntl_create, |
| 1396 | 1398 | .validate_bandwidth = dcn30_validate_bandwidth, |
| 1397 | 1399 | .calculate_wm_and_dlg = dcn30_calculate_wm_and_dlg, |
| 1400 | + .update_soc_for_wm_a = dcn30_update_soc_for_wm_a, | |
| 1398 | 1401 | .populate_dml_pipes = dcn30_populate_dml_pipes_from_context, |
| 1399 | 1402 | .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer, |
| 1400 | 1403 | .add_stream_to_ctx = dcn30_add_stream_to_ctx, |
| @@ -1481,6 +1484,8 @@ static bool dcn302_resource_construct( · 80 unmodified lines | ||
| 1481 | 1484 | dc->caps.mall_size_total = dc->caps.mall_size_per_mem_channel * dc->ctx->dc_bios->vram_info.num_chans * 1048576; |
| 1482 | 1485 | dc->caps.cursor_cache_size = dc->caps.max_cursor_size * dc->caps.max_cursor_size * 8; |
| 1483 | 1486 | dc->caps.max_slave_planes = 1; |
| 1487 | + dc->caps.max_slave_yuv_planes = 1; | |
| 1488 | + dc->caps.max_slave_rgb_planes = 1; | |
| 1484 | 1489 | dc->caps.post_blend_color_processing = true; |
| 1485 | 1490 | dc->caps.force_dp_tps4_for_cp2520 = true; |
| 1486 | 1491 | dc->caps.extended_aux_timeout_support = true; |
| @@ -156,4 +156,6 @@ void dm_set_dcn_clocks( · 155 unmodified lines | ||
| 156 | 156 | struct dc_context *ctx, |
| 157 | 157 | struct dc_clocks *clks); |
| 158 | 158 | |
| 159 | +bool dm_helpers_dmub_outbox0_interrupt_control(struct dc_context *ctx, bool enable); | |
| 160 | + | |
| 159 | 161 | #endif /* __DM_HELPERS__ */ |
| @@ -3437,6 +3437,7 @@ void dml20_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l · 3436 unmodified lines | ||
| 3437 | 3437 | mode_lib->vba.DCCEnabledInAnyPlane = true; |
| 3438 | 3438 | } |
| 3439 | 3439 | } |
| 3440 | + mode_lib->vba.UrgentLatency = mode_lib->vba.UrgentLatencyPixelDataOnly; | |
| 3440 | 3441 | for (i = 0; i <= mode_lib->vba.soc.num_states; i++) { |
| 3441 | 3442 | locals->FabricAndDRAMBandwidthPerState[i] = dml_min( |
| 3442 | 3443 | mode_lib->vba.DRAMSpeedPerState[i] * mode_lib->vba.NumberOfChannels |
| @@ -3544,6 +3544,7 @@ void dml20v2_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode · 3543 unmodified lines | ||
| 3544 | 3544 | mode_lib->vba.DCCEnabledInAnyPlane = true; |
| 3545 | 3545 | } |
| 3546 | 3546 | } |
| 3547 | + mode_lib->vba.UrgentLatency = mode_lib->vba.UrgentLatencyPixelDataOnly; | |
| 3547 | 3548 | for (i = 0; i <= mode_lib->vba.soc.num_states; i++) { |
| 3548 | 3549 | locals->FabricAndDRAMBandwidthPerState[i] = dml_min( |
| 3549 | 3550 | mode_lib->vba.DRAMSpeedPerState[i] * mode_lib->vba.NumberOfChannels |
| @@ -4050,7 +4050,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l · 4049 unmodified lines | ||
| 4050 | 4050 | v->RequiredDPPCLK[i][j][NumberOfNonSplitPlaneOfMaximumBandwidth] = v->MinDPPCLKUsingSingleDPP[NumberOfNonSplitPlaneOfMaximumBandwidth] |
| 4051 | 4051 | * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100) / 2; |
| 4052 | 4052 | v->TotalNumberOfActiveDPP[i][j] = v->TotalNumberOfActiveDPP[i][j] + 1; |
| 4053 | − v->TotalNumberOfSingleDPPPlanes[i][j] = v->TotalNumberOfSingleDPPPlanes[i][j] + 1; | |
| 4053 | + v->TotalNumberOfSingleDPPPlanes[i][j] = v->TotalNumberOfSingleDPPPlanes[i][j] - 1; | |
| 4054 | 4054 | } |
| 4055 | 4055 | } |
| 4056 | 4056 | if (v->TotalNumberOfActiveDPP[i][j] > v->MaxNumDPP) { |
| @@ -599,7 +599,6 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib) · 598 unmodified lines | ||
| 599 | 599 | for (k = j + 1; k < mode_lib->vba.cache_num_pipes; ++k) { |
| 600 | 600 | display_pipe_source_params_st *src_k = &pipes[k].pipe.src; |
| 601 | 601 | display_pipe_dest_params_st *dst_k = &pipes[k].pipe.dest; |
| 602 | − display_output_params_st *dout_k = &pipes[j].dout; | |
| 603 | 602 | |
| 604 | 603 | if (src_k->is_hsplit && !visited[k] |
| 605 | 604 | && src->hsplit_grp == src_k->hsplit_grp) { |
| @@ -620,8 +619,6 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib) · 14 unmodified lines | ||
| 620 | 619 | mode_lib->vba.ViewportHeightChroma[mode_lib->vba.NumberOfActivePlanes] += |
| 621 | 620 | src_k->viewport_height_c; |
| 622 | 621 | } |
| 623 | − mode_lib->vba.NumberOfDSCSlices[mode_lib->vba.NumberOfActivePlanes] += | |
| 624 | − dout_k->dsc_slices; | |
| 625 | 622 | |
| 626 | 623 | visited[k] = true; |
| 627 | 624 | } |
| @@ -37,59 +37,6 @@ static uint32_t dsc_policy_max_target_bpp_limit = 16; · 36 unmodified lines | ||
| 37 | 37 | /* default DSC policy enables DSC only when needed */ |
| 38 | 38 | static bool dsc_policy_enable_dsc_when_not_needed; |
| 39 | 39 | |
| 40 | −static uint32_t dc_dsc_bandwidth_in_kbps_from_timing( | |
| 41 | − const struct dc_crtc_timing *timing) | |
| 42 | −{ | |
| 43 | − uint32_t bits_per_channel = 0; | |
| 44 | − uint32_t kbps; | |
| 45 | − | |
| 46 | − if (timing->flags.DSC) { | |
| 47 | − kbps = (timing->pix_clk_100hz * timing->dsc_cfg.bits_per_pixel); | |
| 48 | − kbps = kbps / 160 + ((kbps % 160) ? 1 : 0); | |
| 49 | − return kbps; | |
| 50 | − } | |
| 51 | − | |
| 52 | − switch (timing->display_color_depth) { | |
| 53 | − case COLOR_DEPTH_666: | |
| 54 | − bits_per_channel = 6; | |
| 55 | − break; | |
| 56 | − case COLOR_DEPTH_888: | |
| 57 | − bits_per_channel = 8; | |
| 58 | − break; | |
| 59 | − case COLOR_DEPTH_101010: | |
| 60 | − bits_per_channel = 10; | |
| 61 | − break; | |
| 62 | − case COLOR_DEPTH_121212: | |
| 63 | − bits_per_channel = 12; | |
| 64 | − break; | |
| 65 | − case COLOR_DEPTH_141414: | |
| 66 | − bits_per_channel = 14; | |
| 67 | − break; | |
| 68 | − case COLOR_DEPTH_161616: | |
| 69 | − bits_per_channel = 16; | |
| 70 | − break; | |
| 71 | − default: | |
| 72 | − break; | |
| 73 | − } | |
| 74 | − | |
| 75 | − ASSERT(bits_per_channel != 0); | |
| 76 | − | |
| 77 | − kbps = timing->pix_clk_100hz / 10; | |
| 78 | − kbps *= bits_per_channel; | |
| 79 | − | |
| 80 | − if (timing->flags.Y_ONLY != 1) { | |
| 81 | − /*Only YOnly make reduce bandwidth by 1/3 compares to RGB*/ | |
| 82 | − kbps *= 3; | |
| 83 | − if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420) | |
| 84 | − kbps /= 2; | |
| 85 | − else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422) | |
| 86 | − kbps = kbps * 2 / 3; | |
| 87 | − } | |
| 88 | − | |
| 89 | − return kbps; | |
| 90 | − | |
| 91 | −} | |
| 92 | − | |
| 93 | 40 | static bool dsc_buff_block_size_from_dpcd(int dpcd_buff_block_size, int *buff_block_size) |
| 94 | 41 | { |
| 95 | 42 | |
| @@ -315,18 +262,18 @@ static inline uint32_t dsc_div_by_10_round_up(uint32_t value) · 219 unmodified lines | ||
| 315 | 262 | * and uncompressed bandwidth. |
| 316 | 263 | */ |
| 317 | 264 | static void get_dsc_bandwidth_range( |
| 318 | − const uint32_t min_bpp, | |
| 319 | − const uint32_t max_bpp, | |
| 265 | + const uint32_t min_bpp_x16, | |
| 266 | + const uint32_t max_bpp_x16, | |
| 320 | 267 | const struct dsc_enc_caps *dsc_caps, |
| 321 | 268 | const struct dc_crtc_timing *timing, |
| 322 | 269 | struct dc_dsc_bw_range *range) |
| 323 | 270 | { |
| 324 | 271 | /* native stream bandwidth */ |
| 325 | − range->stream_kbps = dc_dsc_bandwidth_in_kbps_from_timing(timing); | |
| 272 | + range->stream_kbps = dc_bandwidth_in_kbps_from_timing(timing); | |
| 326 | 273 | |
| 327 | 274 | /* max dsc target bpp */ |
| 328 | − range->max_kbps = dsc_div_by_10_round_up(max_bpp * timing->pix_clk_100hz); | |
| 329 | − range->max_target_bpp_x16 = max_bpp * 16; | |
| 275 | + range->max_kbps = dc_dsc_stream_bandwidth_in_kbps(timing->pix_clk_100hz, max_bpp_x16); | |
| 276 | + range->max_target_bpp_x16 = max_bpp_x16; | |
| 330 | 277 | if (range->max_kbps > range->stream_kbps) { |
| 331 | 278 | /* max dsc target bpp is capped to native bandwidth */ |
| 332 | 279 | range->max_kbps = range->stream_kbps; |
| @@ -334,8 +281,8 @@ static void get_dsc_bandwidth_range( · 1 unmodified line | ||
| 334 | 281 | } |
| 335 | 282 | |
| 336 | 283 | /* min dsc target bpp */ |
| 337 | − range->min_kbps = dsc_div_by_10_round_up(min_bpp * timing->pix_clk_100hz); | |
| 338 | − range->min_target_bpp_x16 = min_bpp * 16; | |
| 284 | + range->min_kbps = dc_dsc_stream_bandwidth_in_kbps(timing->pix_clk_100hz, min_bpp_x16); | |
| 285 | + range->min_target_bpp_x16 = min_bpp_x16; | |
| 339 | 286 | if (range->min_kbps > range->max_kbps) { |
| 340 | 287 | /* min dsc target bpp is capped to max dsc bandwidth*/ |
| 341 | 288 | range->min_kbps = range->max_kbps; |
| @@ -363,12 +310,17 @@ static bool decide_dsc_target_bpp_x16( · 21 unmodified lines | ||
| 363 | 310 | |
| 364 | 311 | memset(&range, 0, sizeof(range)); |
| 365 | 312 | |
| 366 | − get_dsc_bandwidth_range(policy->min_target_bpp, policy->max_target_bpp, | |
| 313 | + get_dsc_bandwidth_range(policy->min_target_bpp * 16, policy->max_target_bpp * 16, | |
| 367 | 314 | dsc_common_caps, timing, &range); |
| 368 | 315 | if (!policy->enable_dsc_when_not_needed && target_bandwidth_kbps >= range.stream_kbps) { |
| 369 | 316 | /* enough bandwidth without dsc */ |
| 370 | 317 | *target_bpp_x16 = 0; |
| 371 | 318 | should_use_dsc = false; |
| 319 | + } else if (policy->preferred_bpp_x16 > 0 && | |
| 320 | + policy->preferred_bpp_x16 <= range.max_target_bpp_x16 && | |
| 321 | + policy->preferred_bpp_x16 >= range.min_target_bpp_x16) { | |
| 322 | + *target_bpp_x16 = policy->preferred_bpp_x16; | |
| 323 | + should_use_dsc = true; | |
| 372 | 324 | } else if (target_bandwidth_kbps >= range.max_kbps) { |
| 373 | 325 | /* use max target bpp allowed */ |
| 374 | 326 | *target_bpp_x16 = range.max_target_bpp_x16; |
| @@ -545,7 +497,7 @@ static bool setup_dsc_config( · 170 unmodified lines | ||
| 545 | 497 | int target_bandwidth_kbps, |
| 546 | 498 | const struct dc_crtc_timing *timing, |
| 547 | 499 | int min_slice_height_override, |
| 548 | − int max_dsc_target_bpp_limit_override, | |
| 500 | + int max_dsc_target_bpp_limit_override_x16, | |
| 549 | 501 | struct dc_dsc_config *dsc_cfg) |
| 550 | 502 | { |
| 551 | 503 | struct dsc_enc_caps dsc_common_caps; |
| @@ -564,7 +516,7 @@ static bool setup_dsc_config( · 12 unmodified lines | ||
| 564 | 516 | |
| 565 | 517 | memset(dsc_cfg, 0, sizeof(struct dc_dsc_config)); |
| 566 | 518 | |
| 567 | − dc_dsc_get_policy_for_timing(timing, max_dsc_target_bpp_limit_override, &policy); | |
| 519 | + dc_dsc_get_policy_for_timing(timing, max_dsc_target_bpp_limit_override_x16, &policy); | |
| 568 | 520 | pic_width = timing->h_addressable + timing->h_border_left + timing->h_border_right; |
| 569 | 521 | pic_height = timing->v_addressable + timing->v_border_top + timing->v_border_bottom; |
| 570 | 522 | |
| @@ -865,8 +817,8 @@ bool dc_dsc_parse_dsc_dpcd(const struct dc *dc, const uint8_t *dpcd_dsc_basic_da · 294 unmodified lines | ||
| 865 | 817 | bool dc_dsc_compute_bandwidth_range( |
| 866 | 818 | const struct display_stream_compressor *dsc, |
| 867 | 819 | uint32_t dsc_min_slice_height_override, |
| 868 | − uint32_t min_bpp, | |
| 869 | − uint32_t max_bpp, | |
| 820 | + uint32_t min_bpp_x16, | |
| 821 | + uint32_t max_bpp_x16, | |
| 870 | 822 | const struct dsc_dec_dpcd_caps *dsc_sink_caps, |
| 871 | 823 | const struct dc_crtc_timing *timing, |
| 872 | 824 | struct dc_dsc_bw_range *range) |
| @@ -883,10 +835,10 @@ bool dc_dsc_compute_bandwidth_range( · 10 unmodified lines | ||
| 883 | 835 | |
| 884 | 836 | if (is_dsc_possible) |
| 885 | 837 | is_dsc_possible = setup_dsc_config(dsc_sink_caps, &dsc_enc_caps, 0, timing, |
| 886 | − dsc_min_slice_height_override, max_bpp, &config); | |
| 838 | + dsc_min_slice_height_override, max_bpp_x16, &config); | |
| 887 | 839 | |
| 888 | 840 | if (is_dsc_possible) |
| 889 | − get_dsc_bandwidth_range(min_bpp, max_bpp, &dsc_common_caps, timing, range); | |
| 841 | + get_dsc_bandwidth_range(min_bpp_x16, max_bpp_x16, &dsc_common_caps, timing, range); | |
| 890 | 842 | |
| 891 | 843 | return is_dsc_possible; |
| 892 | 844 | } |
| @@ -908,11 +860,20 @@ bool dc_dsc_compute_config( · 15 unmodified lines | ||
| 908 | 860 | &dsc_enc_caps, |
| 909 | 861 | target_bandwidth_kbps, |
| 910 | 862 | timing, dsc_min_slice_height_override, |
| 911 | − max_target_bpp_limit_override, dsc_cfg); | |
| 863 | + max_target_bpp_limit_override * 16, dsc_cfg); | |
| 912 | 864 | return is_dsc_possible; |
| 913 | 865 | } |
| 914 | 866 | |
| 915 | −void dc_dsc_get_policy_for_timing(const struct dc_crtc_timing *timing, uint32_t max_target_bpp_limit_override, struct dc_dsc_policy *policy) | |
| 867 | +uint32_t dc_dsc_stream_bandwidth_in_kbps(uint32_t pix_clk_100hz, uint32_t bpp_x16) | |
| 868 | +{ | |
| 869 | + struct fixed31_32 link_bw_kbps; | |
| 870 | + link_bw_kbps = dc_fixpt_from_int(pix_clk_100hz); | |
| 871 | + link_bw_kbps = dc_fixpt_div_int(link_bw_kbps, 160); | |
| 872 | + link_bw_kbps = dc_fixpt_mul_int(link_bw_kbps, bpp_x16); | |
| 873 | + return dc_fixpt_ceil(link_bw_kbps); | |
| 874 | +} | |
| 875 | + | |
| 876 | +void dc_dsc_get_policy_for_timing(const struct dc_crtc_timing *timing, uint32_t max_target_bpp_limit_override_x16, struct dc_dsc_policy *policy) | |
| 916 | 877 | { |
| 917 | 878 | uint32_t bpc = 0; |
| 918 | 879 | |
| @@ -967,13 +928,15 @@ void dc_dsc_get_policy_for_timing(const struct dc_crtc_timing *timing, uint32_t · 48 unmodified lines | ||
| 967 | 928 | return; |
| 968 | 929 | } |
| 969 | 930 | |
| 931 | + policy->preferred_bpp_x16 = timing->dsc_fixed_bits_per_pixel_x16; | |
| 932 | + | |
| 970 | 933 | /* internal upper limit, default 16 bpp */ |
| 971 | 934 | if (policy->max_target_bpp > dsc_policy_max_target_bpp_limit) |
| 972 | 935 | policy->max_target_bpp = dsc_policy_max_target_bpp_limit; |
| 973 | 936 | |
| 974 | 937 | /* apply override */ |
| 975 | − if (max_target_bpp_limit_override && policy->max_target_bpp > max_target_bpp_limit_override) | |
| 976 | − policy->max_target_bpp = max_target_bpp_limit_override; | |
| 938 | + if (max_target_bpp_limit_override_x16 && policy->max_target_bpp > max_target_bpp_limit_override_x16 / 16) | |
| 939 | + policy->max_target_bpp = max_target_bpp_limit_override_x16 / 16; | |
| 977 | 940 | |
| 978 | 941 | /* enable DSC when not needed, default false */ |
| 979 | 942 | if (dsc_policy_enable_dsc_when_not_needed) |
| @@ -48,10 +48,6 @@ · 47 unmodified lines | ||
| 48 | 48 | #define REGI(reg_name, block, id)\ |
| 49 | 49 | mm ## block ## id ## _ ## reg_name |
| 50 | 50 | |
| 51 | −#include "../hw_gpio.h" | |
| 52 | −#include "../hw_ddc.h" | |
| 53 | −#include "../hw_hpd.h" | |
| 54 | − | |
| 55 | 51 | #include "reg_helper.h" |
| 56 | 52 | #include "../hpd_regs.h" |
| 57 | 53 | |
| @@ -39,7 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | #define HDCP14_KSV_SIZE 5 |
| 40 | 40 | #define HDCP14_MAX_KSV_FIFO_SIZE 127*HDCP14_KSV_SIZE |
| 41 | 41 | |
| 42 | −static const bool hdcp_cmd_is_read[] = { | |
| 42 | +static const bool hdcp_cmd_is_read[HDCP_MESSAGE_ID_MAX] = { | |
| 43 | 43 | [HDCP_MESSAGE_ID_READ_BKSV] = true, |
| 44 | 44 | [HDCP_MESSAGE_ID_READ_RI_R0] = true, |
| 45 | 45 | [HDCP_MESSAGE_ID_READ_PJ] = true, |
| @@ -75,7 +75,7 @@ static const bool hdcp_cmd_is_read[] = { · 29 unmodified lines | ||
| 75 | 75 | [HDCP_MESSAGE_ID_WRITE_CONTENT_STREAM_TYPE] = false |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | −static const uint8_t hdcp_i2c_offsets[] = { | |
| 78 | +static const uint8_t hdcp_i2c_offsets[HDCP_MESSAGE_ID_MAX] = { | |
| 79 | 79 | [HDCP_MESSAGE_ID_READ_BKSV] = 0x0, |
| 80 | 80 | [HDCP_MESSAGE_ID_READ_RI_R0] = 0x8, |
| 81 | 81 | [HDCP_MESSAGE_ID_READ_PJ] = 0xA, |
| @@ -106,7 +106,8 @@ static const uint8_t hdcp_i2c_offsets[] = { · 24 unmodified lines | ||
| 106 | 106 | [HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_SEND_ACK] = 0x60, |
| 107 | 107 | [HDCP_MESSAGE_ID_WRITE_REPEATER_AUTH_STREAM_MANAGE] = 0x60, |
| 108 | 108 | [HDCP_MESSAGE_ID_READ_REPEATER_AUTH_STREAM_READY] = 0x80, |
| 109 | − [HDCP_MESSAGE_ID_READ_RXSTATUS] = 0x70 | |
| 109 | + [HDCP_MESSAGE_ID_READ_RXSTATUS] = 0x70, | |
| 110 | + [HDCP_MESSAGE_ID_WRITE_CONTENT_STREAM_TYPE] = 0x0, | |
| 110 | 111 | }; |
| 111 | 112 | |
| 112 | 113 | struct protection_properties { |
| @@ -184,7 +185,7 @@ static const struct protection_properties hdmi_14_protection = { · 71 unmodified lines | ||
| 184 | 185 | .process_transaction = hdmi_14_process_transaction |
| 185 | 186 | }; |
| 186 | 187 | |
| 187 | −static const uint32_t hdcp_dpcd_addrs[] = { | |
| 188 | +static const uint32_t hdcp_dpcd_addrs[HDCP_MESSAGE_ID_MAX] = { | |
| 188 | 189 | [HDCP_MESSAGE_ID_READ_BKSV] = 0x68000, |
| 189 | 190 | [HDCP_MESSAGE_ID_READ_RI_R0] = 0x68005, |
| 190 | 191 | [HDCP_MESSAGE_ID_READ_PJ] = 0xFFFFFFFF, |
| @@ -170,6 +170,11 @@ struct clock_source_funcs { · 169 unmodified lines | ||
| 170 | 170 | const struct clock_source *clock_source, |
| 171 | 171 | unsigned int inst, |
| 172 | 172 | unsigned int *pixel_clk_khz); |
| 173 | + bool (*override_dp_pix_clk)( | |
| 174 | + struct clock_source *clock_source, | |
| 175 | + unsigned int inst, | |
| 176 | + unsigned int pixel_clk, | |
| 177 | + unsigned int ref_clk); | |
| 173 | 178 | }; |
| 174 | 179 | |
| 175 | 180 | struct clock_source { |
| @@ -97,6 +97,10 @@ struct resource_funcs { · 96 unmodified lines | ||
| 97 | 97 | const struct panel_cntl_init_data *panel_cntl_init_data); |
| 98 | 98 | struct link_encoder *(*link_enc_create)( |
| 99 | 99 | const struct encoder_init_data *init); |
| 100 | + /* Create a minimal link encoder object with no dc_link object | |
| 101 | + * associated with it. */ | |
| 102 | + struct link_encoder *(*link_enc_create_minimal)(struct dc_context *ctx, enum engine_id eng_id); | |
| 103 | + | |
| 100 | 104 | bool (*validate_bandwidth)( |
| 101 | 105 | struct dc *dc, |
| 102 | 106 | struct dc_state *context, |
| @@ -106,6 +110,8 @@ struct resource_funcs { · 3 unmodified lines | ||
| 106 | 110 | display_e2e_pipe_params_st *pipes, |
| 107 | 111 | int pipe_cnt, |
| 108 | 112 | int vlevel); |
| 113 | + void (*update_soc_for_wm_a)( | |
| 114 | + struct dc *dc, struct dc_state *context); | |
| 109 | 115 | int (*populate_dml_pipes)( |
| 110 | 116 | struct dc *dc, |
| 111 | 117 | struct dc_state *context, |
| @@ -210,6 +216,15 @@ struct resource_pool { · 98 unmodified lines | ||
| 210 | 216 | unsigned int underlay_pipe_index; |
| 211 | 217 | unsigned int stream_enc_count; |
| 212 | 218 | |
| 219 | + /* An array for accessing the link encoder objects that have been created. | |
| 220 | + * Index in array corresponds to engine ID - viz. 0: ENGINE_ID_DIGA | |
| 221 | + */ | |
| 222 | + struct link_encoder *link_encoders[MAX_DIG_LINK_ENCODERS]; | |
| 223 | + /* Number of DIG link encoder objects created - i.e. number of valid | |
| 224 | + * entries in link_encoders array. | |
| 225 | + */ | |
| 226 | + unsigned int dig_link_enc_count; | |
| 227 | + | |
| 213 | 228 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 214 | 229 | struct dc_3dlut *mpc_lut[MAX_PIPES]; |
| 215 | 230 | struct dc_transfer_func *mpc_shaper[MAX_PIPES]; |
| @@ -56,6 +56,7 @@ struct dp_receiver_id_info; · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | struct i2c_payloads; |
| 58 | 58 | struct aux_payloads; |
| 59 | +enum aux_return_code_type; | |
| 59 | 60 | |
| 60 | 61 | void dal_ddc_i2c_payloads_add( |
| 61 | 62 | struct i2c_payloads *payloads, |
| @@ -100,7 +101,7 @@ bool dal_ddc_submit_aux_command(struct ddc_service *ddc, · 38 unmodified lines | ||
| 100 | 101 | |
| 101 | 102 | int dc_link_aux_transfer_raw(struct ddc_service *ddc, |
| 102 | 103 | struct aux_payload *payload, |
| 103 | − enum aux_channel_operation_result *operation_result); | |
| 104 | + enum aux_return_code_type *operation_result); | |
| 104 | 105 | |
| 105 | 106 | bool dc_link_aux_transfer_with_retries(struct ddc_service *ddc, |
| 106 | 107 | struct aux_payload *payload); |
| @@ -29,6 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "dc_ddc_types.h" |
| 30 | 30 | #include "include/i2caux_interface.h" |
| 31 | 31 | |
| 32 | +enum aux_return_code_type; | |
| 33 | + | |
| 32 | 34 | enum i2caux_transaction_operation { |
| 33 | 35 | I2CAUX_TRANSACTION_READ, |
| 34 | 36 | I2CAUX_TRANSACTION_WRITE |
| @@ -162,7 +164,7 @@ struct aux_engine_funcs { · 127 unmodified lines | ||
| 162 | 164 | uint8_t *buffer, |
| 163 | 165 | uint8_t *reply_result, |
| 164 | 166 | uint32_t *sw_status); |
| 165 | − enum aux_channel_operation_result (*get_channel_status)( | |
| 167 | + enum aux_return_code_type (*get_channel_status)( | |
| 166 | 168 | struct aux_engine *engine, |
| 167 | 169 | uint8_t *returned_bytes); |
| 168 | 170 | bool (*is_engine_available)(struct aux_engine *engine); |
| @@ -56,6 +56,20 @@ struct dmcu { · 55 unmodified lines | ||
| 56 | 56 | bool auto_load_dmcu; |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 60 | +struct crc_region { | |
| 61 | + uint16_t x_start; | |
| 62 | + uint16_t y_start; | |
| 63 | + uint16_t x_end; | |
| 64 | + uint16_t y_end; | |
| 65 | +}; | |
| 66 | + | |
| 67 | +struct otg_phy_mux { | |
| 68 | + uint8_t phy_output_num; | |
| 69 | + uint8_t otg_output_num; | |
| 70 | +}; | |
| 71 | +#endif | |
| 72 | + | |
| 59 | 73 | struct dmcu_funcs { |
| 60 | 74 | bool (*dmcu_init)(struct dmcu *dmcu); |
| 61 | 75 | bool (*load_iram)(struct dmcu *dmcu, |
| @@ -84,6 +98,13 @@ struct dmcu_funcs { · 22 unmodified lines | ||
| 84 | 98 | int *min_frame_rate, |
| 85 | 99 | int *max_frame_rate); |
| 86 | 100 | bool (*recv_edid_cea_ack)(struct dmcu *dmcu, int *offset); |
| 101 | +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) | |
| 102 | + void (*forward_crc_window)(struct dmcu *dmcu, | |
| 103 | + struct crc_region *crc_win, | |
| 104 | + struct otg_phy_mux *mux_mapping); | |
| 105 | + void (*stop_crc_win_update)(struct dmcu *dmcu, | |
| 106 | + struct otg_phy_mux *mux_mapping); | |
| 107 | +#endif | |
| 87 | 108 | }; |
| 88 | 109 | |
| 89 | 110 | #endif |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | #define MAX_AUDIOS 7 |
| 38 | 38 | #define MAX_PIPES 6 |
| 39 | +#define MAX_DIG_LINK_ENCODERS 7 | |
| 39 | 40 | #define MAX_DWB_PIPES 1 |
| 40 | 41 | |
| 41 | 42 | struct gamma_curve { |
| @@ -109,6 +109,12 @@ enum h_timing_div_mode { · 108 unmodified lines | ||
| 109 | 109 | H_TIMING_DIV_BY4, |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | +enum timing_synchronization_type { | |
| 113 | + NOT_SYNCHRONIZABLE, | |
| 114 | + TIMING_SYNCHRONIZABLE, | |
| 115 | + VBLANK_SYNCHRONIZABLE | |
| 116 | +}; | |
| 117 | + | |
| 112 | 118 | struct crc_params { |
| 113 | 119 | /* Regions used to calculate CRC*/ |
| 114 | 120 | uint16_t windowa_x_start; |
| @@ -292,6 +298,12 @@ struct timing_generator_funcs { · 177 unmodified lines | ||
| 292 | 298 | uint32_t window_start, uint32_t window_end); |
| 293 | 299 | void (*set_vtotal_change_limit)(struct timing_generator *optc, |
| 294 | 300 | uint32_t limit); |
| 301 | + void (*align_vblanks)(struct timing_generator *master_optc, | |
| 302 | + struct timing_generator *slave_optc, | |
| 303 | + uint32_t master_pixel_clock_100Hz, | |
| 304 | + uint32_t slave_pixel_clock_100Hz, | |
| 305 | + uint8_t master_clock_divider, | |
| 306 | + uint8_t slave_clock_divider); | |
| 295 | 307 | }; |
| 296 | 308 | |
| 297 | 309 | #endif |
| @@ -111,6 +111,9 @@ struct hw_sequencer_funcs { · 110 unmodified lines | ||
| 111 | 111 | void (*enable_timing_synchronization)(struct dc *dc, |
| 112 | 112 | int group_index, int group_size, |
| 113 | 113 | struct pipe_ctx *grouped_pipes[]); |
| 114 | + void (*enable_vblanks_synchronization)(struct dc *dc, | |
| 115 | + int group_index, int group_size, | |
| 116 | + struct pipe_ctx *grouped_pipes[]); | |
| 114 | 117 | void (*setup_periodic_interrupt)(struct dc *dc, |
| 115 | 118 | struct pipe_ctx *pipe_ctx, |
| 116 | 119 | enum vline_select vline); |
| @@ -231,10 +234,6 @@ struct hw_sequencer_funcs { · 114 unmodified lines | ||
| 231 | 234 | enum dc_color_depth color_depth, |
| 232 | 235 | const struct tg_color *solid_color, |
| 233 | 236 | int width, int height, int offset); |
| 234 | − | |
| 235 | − void (*set_hubp_blank)(const struct dc *dc, | |
| 236 | − struct pipe_ctx *pipe_ctx, | |
| 237 | − bool blank_enable); | |
| 238 | 237 | }; |
| 239 | 238 | |
| 240 | 239 | void color_space_to_black_color( |
| @@ -48,6 +48,7 @@ struct resource_caps { · 47 unmodified lines | ||
| 48 | 48 | int num_ddc; |
| 49 | 49 | int num_vmid; |
| 50 | 50 | int num_dsc; |
| 51 | + unsigned int num_dig_link_enc; // Total number of DIGs (digital encoders) in DIO (Display Input/Output). | |
| 51 | 52 | int num_mpc_3dlut; |
| 52 | 53 | }; |
| 53 | 54 | |
| @@ -115,6 +116,10 @@ bool resource_are_streams_timing_synchronizable( · 61 unmodified lines | ||
| 115 | 116 | struct dc_stream_state *stream1, |
| 116 | 117 | struct dc_stream_state *stream2); |
| 117 | 118 | |
| 119 | +bool resource_are_vblanks_synchronizable( | |
| 120 | + struct dc_stream_state *stream1, | |
| 121 | + struct dc_stream_state *stream2); | |
| 122 | + | |
| 118 | 123 | struct clock_source *resource_find_used_clk_src_for_sharing( |
| 119 | 124 | struct resource_context *res_ctx, |
| 120 | 125 | struct pipe_ctx *pipe_ctx); |
| @@ -58,6 +58,18 @@ enum dc_irq_source to_dal_irq_source_dcn20( · 57 unmodified lines | ||
| 58 | 58 | return DC_IRQ_SOURCE_VBLANK5; |
| 59 | 59 | case DCN_1_0__SRCID__DC_D6_OTG_VSTARTUP: |
| 60 | 60 | return DC_IRQ_SOURCE_VBLANK6; |
| 61 | + case DCN_1_0__SRCID__OTG1_VERTICAL_INTERRUPT0_CONTROL: | |
| 62 | + return DC_IRQ_SOURCE_DC1_VLINE0; | |
| 63 | + case DCN_1_0__SRCID__OTG2_VERTICAL_INTERRUPT0_CONTROL: | |
| 64 | + return DC_IRQ_SOURCE_DC2_VLINE0; | |
| 65 | + case DCN_1_0__SRCID__OTG3_VERTICAL_INTERRUPT0_CONTROL: | |
| 66 | + return DC_IRQ_SOURCE_DC3_VLINE0; | |
| 67 | + case DCN_1_0__SRCID__OTG4_VERTICAL_INTERRUPT0_CONTROL: | |
| 68 | + return DC_IRQ_SOURCE_DC4_VLINE0; | |
| 69 | + case DCN_1_0__SRCID__OTG5_VERTICAL_INTERRUPT0_CONTROL: | |
| 70 | + return DC_IRQ_SOURCE_DC5_VLINE0; | |
| 71 | + case DCN_1_0__SRCID__OTG6_VERTICAL_INTERRUPT0_CONTROL: | |
| 72 | + return DC_IRQ_SOURCE_DC6_VLINE0; | |
| 61 | 73 | case DCN_1_0__SRCID__HUBP0_FLIP_INTERRUPT: |
| 62 | 74 | return DC_IRQ_SOURCE_PFLIP1; |
| 63 | 75 | case DCN_1_0__SRCID__HUBP1_FLIP_INTERRUPT: |
| @@ -172,6 +184,11 @@ static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { · 108 unmodified lines | ||
| 172 | 184 | .ack = NULL |
| 173 | 185 | }; |
| 174 | 186 | |
| 187 | +static const struct irq_source_info_funcs vline0_irq_info_funcs = { | |
| 188 | + .set = NULL, | |
| 189 | + .ack = NULL | |
| 190 | +}; | |
| 191 | + | |
| 175 | 192 | #undef BASE_INNER |
| 176 | 193 | #define BASE_INNER(seg) DCN_BASE__INST0_SEG ## seg |
| 177 | 194 | |
| @@ -245,6 +262,14 @@ static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { · 67 unmodified lines | ||
| 245 | 262 | .funcs = &vblank_irq_info_funcs\ |
| 246 | 263 | } |
| 247 | 264 | |
| 265 | +#define vline0_int_entry(reg_num)\ | |
| 266 | + [DC_IRQ_SOURCE_DC1_VLINE0 + reg_num] = {\ | |
| 267 | + IRQ_REG_ENTRY(OTG, reg_num,\ | |
| 268 | + OTG_VERTICAL_INTERRUPT0_CONTROL, OTG_VERTICAL_INTERRUPT0_INT_ENABLE,\ | |
| 269 | + OTG_VERTICAL_INTERRUPT0_CONTROL, OTG_VERTICAL_INTERRUPT0_CLEAR),\ | |
| 270 | + .funcs = &vline0_irq_info_funcs\ | |
| 271 | + } | |
| 272 | + | |
| 248 | 273 | #define dummy_irq_entry() \ |
| 249 | 274 | {\ |
| 250 | 275 | .funcs = &dummy_irq_info_funcs\ |
| @@ -353,6 +378,12 @@ irq_source_info_dcn20[DAL_IRQ_SOURCES_NUMBER] = { · 102 unmodified lines | ||
| 353 | 378 | vblank_int_entry(3), |
| 354 | 379 | vblank_int_entry(4), |
| 355 | 380 | vblank_int_entry(5), |
| 381 | + vline0_int_entry(0), | |
| 382 | + vline0_int_entry(1), | |
| 383 | + vline0_int_entry(2), | |
| 384 | + vline0_int_entry(3), | |
| 385 | + vline0_int_entry(4), | |
| 386 | + vline0_int_entry(5), | |
| 356 | 387 | }; |
| 357 | 388 | |
| 358 | 389 | static const struct irq_service_funcs irq_service_funcs_dcn20 = { |
| @@ -58,6 +58,20 @@ enum dc_irq_source to_dal_irq_source_dcn21( · 57 unmodified lines | ||
| 58 | 58 | return DC_IRQ_SOURCE_VBLANK5; |
| 59 | 59 | case DCN_1_0__SRCID__DC_D6_OTG_VSTARTUP: |
| 60 | 60 | return DC_IRQ_SOURCE_VBLANK6; |
| 61 | + case DCN_1_0__SRCID__DMCUB_OUTBOX_HIGH_PRIORITY_READY_INT: | |
| 62 | + return DC_IRQ_SOURCE_DMCUB_OUTBOX0; | |
| 63 | + case DCN_1_0__SRCID__OTG1_VERTICAL_INTERRUPT0_CONTROL: | |
| 64 | + return DC_IRQ_SOURCE_DC1_VLINE0; | |
| 65 | + case DCN_1_0__SRCID__OTG2_VERTICAL_INTERRUPT0_CONTROL: | |
| 66 | + return DC_IRQ_SOURCE_DC2_VLINE0; | |
| 67 | + case DCN_1_0__SRCID__OTG3_VERTICAL_INTERRUPT0_CONTROL: | |
| 68 | + return DC_IRQ_SOURCE_DC3_VLINE0; | |
| 69 | + case DCN_1_0__SRCID__OTG4_VERTICAL_INTERRUPT0_CONTROL: | |
| 70 | + return DC_IRQ_SOURCE_DC4_VLINE0; | |
| 71 | + case DCN_1_0__SRCID__OTG5_VERTICAL_INTERRUPT0_CONTROL: | |
| 72 | + return DC_IRQ_SOURCE_DC5_VLINE0; | |
| 73 | + case DCN_1_0__SRCID__OTG6_VERTICAL_INTERRUPT0_CONTROL: | |
| 74 | + return DC_IRQ_SOURCE_DC6_VLINE0; | |
| 61 | 75 | case DCN_1_0__SRCID__HUBP0_FLIP_INTERRUPT: |
| 62 | 76 | return DC_IRQ_SOURCE_PFLIP1; |
| 63 | 77 | case DCN_1_0__SRCID__HUBP1_FLIP_INTERRUPT: |
| @@ -173,6 +187,12 @@ static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { · 109 unmodified lines | ||
| 173 | 187 | .ack = NULL |
| 174 | 188 | }; |
| 175 | 189 | |
| 190 | + | |
| 191 | +static const struct irq_source_info_funcs vline0_irq_info_funcs = { | |
| 192 | + .set = NULL, | |
| 193 | + .ack = NULL | |
| 194 | +}; | |
| 195 | + | |
| 176 | 196 | #undef BASE_INNER |
| 177 | 197 | #define BASE_INNER(seg) DMU_BASE__INST0_SEG ## seg |
| 178 | 198 | |
| @@ -254,6 +274,14 @@ static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { · 75 unmodified lines | ||
| 254 | 274 | .funcs = &vblank_irq_info_funcs\ |
| 255 | 275 | } |
| 256 | 276 | |
| 277 | +#define vline0_int_entry(reg_num)\ | |
| 278 | + [DC_IRQ_SOURCE_DC1_VLINE0 + reg_num] = {\ | |
| 279 | + IRQ_REG_ENTRY(OTG, reg_num,\ | |
| 280 | + OTG_VERTICAL_INTERRUPT0_CONTROL, OTG_VERTICAL_INTERRUPT0_INT_ENABLE,\ | |
| 281 | + OTG_VERTICAL_INTERRUPT0_CONTROL, OTG_VERTICAL_INTERRUPT0_CLEAR),\ | |
| 282 | + .funcs = &vline0_irq_info_funcs\ | |
| 283 | + } | |
| 284 | + | |
| 257 | 285 | #define dummy_irq_entry() \ |
| 258 | 286 | {\ |
| 259 | 287 | .funcs = &dummy_irq_info_funcs\ |
| @@ -366,6 +394,12 @@ irq_source_info_dcn21[DAL_IRQ_SOURCES_NUMBER] = { · 106 unmodified lines | ||
| 366 | 394 | vblank_int_entry(3), |
| 367 | 395 | vblank_int_entry(4), |
10 more lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 2175 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 1739 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 7684 lines aren’t shown here.
This diff is large: its 32950 lines aren’t shown here.
This diff is large: its 5126 lines aren’t shown here.
This diff is larger than a page shows: the files after these aren’t listed. Clone the repository to see all of it.