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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/ras: add pmfw eeprom smu interfaces

add smu interfaces and its data structures for
pmfw eeprom in uniras

v2: add 'const' to smu messages array, and specify
index for each member when initializing.

Signed-off-by: Gangliang Xie <ganglxie@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Gangliang Xie and committed by
Alex Deucher
689b03a0 45c692a1

+64
+46
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c
··· 28 28 #define RAS_MP1_MSG_QueryValidMcaCeCount 0x3A 29 29 #define RAS_MP1_MSG_McaBankCeDumpDW 0x3B 30 30 31 + static const enum smu_message_type pmfw_eeprom_msgs[] = { 32 + [RAS_SMU_GetRASTableVersion] = SMU_MSG_GetRASTableVersion, 33 + [RAS_SMU_GetBadPageCount] = SMU_MSG_GetBadPageCount, 34 + [RAS_SMU_SetTimestamp] = SMU_MSG_SetTimestamp, 35 + [RAS_SMU_GetTimestamp] = SMU_MSG_GetTimestamp, 36 + [RAS_SMU_GetBadPageIpid] = SMU_MSG_GetBadPageIpid, 37 + [RAS_SMU_EraseRasTable] = SMU_MSG_EraseRasTable, 38 + [RAS_SMU_GetBadPageMcaAddr] = SMU_MSG_GetBadPageMcaAddr, 39 + }; 40 + 31 41 static int mp1_v13_0_get_valid_bank_count(struct ras_core_context *ras_core, 32 42 u32 msg, u32 *count) 33 43 { ··· 97 87 return ret; 98 88 } 99 89 90 + static int mp1_v13_0_eeprom_send_msg(struct ras_core_context *ras_core, 91 + enum ras_fw_eeprom_cmd index, uint32_t param, uint32_t *read_arg) 92 + { 93 + struct amdgpu_device *adev = (struct amdgpu_device *)ras_core->dev; 94 + int ret = 0; 95 + 96 + if (down_read_trylock(&adev->reset_domain->sem)) { 97 + ret = amdgpu_smu_ras_send_msg(adev, 98 + pmfw_eeprom_msgs[index], param, read_arg); 99 + up_read(&adev->reset_domain->sem); 100 + } else { 101 + ret = -RAS_CORE_GPU_IN_MODE1_RESET; 102 + } 103 + 104 + return ret; 105 + } 106 + 107 + static int mp1_v13_0_get_ras_enabled_mask(struct ras_core_context *ras_core, 108 + uint64_t *enabled_mask) 109 + { 110 + struct amdgpu_device *adev = (struct amdgpu_device *)ras_core->dev; 111 + int ret = 0; 112 + 113 + if (down_read_trylock(&adev->reset_domain->sem)) { 114 + if (amdgpu_smu_ras_feature_is_enabled(adev, SMU_FEATURE_HROM_EN_BIT)) 115 + *enabled_mask |= RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM; 116 + up_read(&adev->reset_domain->sem); 117 + } else { 118 + ret = -RAS_CORE_GPU_IN_MODE1_RESET; 119 + } 120 + 121 + return ret; 122 + } 123 + 100 124 const struct ras_mp1_sys_func amdgpu_ras_mp1_sys_func_v13_0 = { 101 125 .mp1_get_valid_bank_count = mp1_v13_0_get_valid_bank_count, 102 126 .mp1_dump_valid_bank = mp1_v13_0_dump_valid_bank, 127 + .mp1_send_eeprom_msg = mp1_v13_0_eeprom_send_msg, 128 + .mp1_get_ras_enabled_mask = mp1_v13_0_get_ras_enabled_mask, 103 129 }; 104 130
+18
drivers/gpu/drm/amd/ras/rascore/ras.h
··· 49 49 #define GPU_RESET_CAUSE_FATAL (RAS_CORE_RESET_GPU | 0x0002) 50 50 #define GPU_RESET_CAUSE_RMA (RAS_CORE_RESET_GPU | 0x0004) 51 51 52 + enum ras_core_fw_feature_flags { 53 + RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM = BIT_ULL(0), 54 + }; 55 + 52 56 enum ras_block_id { 53 57 RAS_BLOCK_ID__UMC = 0, 54 58 RAS_BLOCK_ID__SDMA, ··· 131 127 RAS_GPU_STATUS__IS_VF = 0x8, 132 128 }; 133 129 130 + enum ras_fw_eeprom_cmd { 131 + RAS_SMU_GetRASTableVersion = 0, 132 + RAS_SMU_GetBadPageCount, 133 + RAS_SMU_SetTimestamp, 134 + RAS_SMU_GetTimestamp, 135 + RAS_SMU_GetBadPageIpid, 136 + RAS_SMU_EraseRasTable, 137 + RAS_SMU_GetBadPageMcaAddr, 138 + }; 139 + 134 140 struct ras_core_context; 135 141 struct ras_bank_ecc; 136 142 struct ras_umc; ··· 155 141 u32 msg, u32 *count); 156 142 int (*mp1_dump_valid_bank)(struct ras_core_context *ras_core, 157 143 u32 msg, u32 idx, u32 reg_idx, u64 *val); 144 + int (*mp1_send_eeprom_msg)(struct ras_core_context *ras_core, 145 + enum ras_fw_eeprom_cmd index, uint32_t param, uint32_t *read_arg); 146 + int (*mp1_get_ras_enabled_mask)(struct ras_core_context *ras_core, 147 + uint64_t *enabled_mask); 158 148 }; 159 149 160 150 struct ras_eeprom_sys_func {