Skip to content

Commit 38298ce

Browse files
Stanley.Yangalexdeucher
authored andcommitted
drm/amdgpu: Optimize checking ras supported
Using "is_app_apu" to identify device in the native APU mode or carveout mode. Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 6fac396 commit 38298ce

3 files changed

Lines changed: 23 additions & 21 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ int psp_ras_initialize(struct psp_context *psp)
16731673

16741674
if (amdgpu_ras_is_poison_mode_supported(adev))
16751675
ras_cmd->ras_in_message.init_flags.poison_mode_en = 1;
1676-
if (!adev->gmc.xgmi.connected_to_cpu)
1676+
if (!adev->gmc.xgmi.connected_to_cpu && !adev->gmc.is_app_apu)
16771677
ras_cmd->ras_in_message.init_flags.dgpu_mode = 1;
16781678
ras_cmd->ras_in_message.init_flags.xcc_mask =
16791679
adev->gfx.xcc_mask;

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,8 +1686,7 @@ static void amdgpu_ras_interrupt_poison_consumption_handler(struct ras_manager *
16861686
}
16871687
}
16881688

1689-
if (!adev->gmc.xgmi.connected_to_cpu)
1690-
amdgpu_umc_poison_handler(adev, false);
1689+
amdgpu_umc_poison_handler(adev, false);
16911690

16921691
if (block_obj->hw_ops && block_obj->hw_ops->handle_poison_consumption)
16931692
poison_stat = block_obj->hw_ops->handle_poison_consumption(adev);
@@ -2452,11 +2451,10 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev)
24522451
{
24532452
adev->ras_hw_enabled = adev->ras_enabled = 0;
24542453

2455-
if (!adev->is_atom_fw ||
2456-
!amdgpu_ras_asic_supported(adev))
2454+
if (!amdgpu_ras_asic_supported(adev))
24572455
return;
24582456

2459-
if (!adev->gmc.xgmi.connected_to_cpu) {
2457+
if (!adev->gmc.xgmi.connected_to_cpu && !adev->gmc.is_app_apu) {
24602458
if (amdgpu_atomfirmware_mem_ecc_supported(adev)) {
24612459
dev_info(adev->dev, "MEM ECC is active.\n");
24622460
adev->ras_hw_enabled |= (1 << AMDGPU_RAS_BLOCK__UMC |

drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,27 +169,31 @@ int amdgpu_umc_poison_handler(struct amdgpu_device *adev, bool reset)
169169
{
170170
int ret = AMDGPU_RAS_SUCCESS;
171171

172-
if (!amdgpu_sriov_vf(adev)) {
173-
if (!adev->gmc.xgmi.connected_to_cpu) {
174-
struct ras_err_data err_data = {0, 0, 0, NULL};
175-
struct ras_common_if head = {
176-
.block = AMDGPU_RAS_BLOCK__UMC,
177-
};
178-
struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head);
179-
180-
ret = amdgpu_umc_do_page_retirement(adev, &err_data, NULL, reset);
181-
182-
if (ret == AMDGPU_RAS_SUCCESS && obj) {
183-
obj->err_data.ue_count += err_data.ue_count;
184-
obj->err_data.ce_count += err_data.ce_count;
185-
}
186-
} else if (reset) {
172+
if (adev->gmc.xgmi.connected_to_cpu ||
173+
adev->gmc.is_app_apu) {
174+
if (reset) {
187175
/* MCA poison handler is only responsible for GPU reset,
188176
* let MCA notifier do page retirement.
189177
*/
190178
kgd2kfd_set_sram_ecc_flag(adev->kfd.dev);
191179
amdgpu_ras_reset_gpu(adev);
192180
}
181+
return ret;
182+
}
183+
184+
if (!amdgpu_sriov_vf(adev)) {
185+
struct ras_err_data err_data = {0, 0, 0, NULL};
186+
struct ras_common_if head = {
187+
.block = AMDGPU_RAS_BLOCK__UMC,
188+
};
189+
struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head);
190+
191+
ret = amdgpu_umc_do_page_retirement(adev, &err_data, NULL, reset);
192+
193+
if (ret == AMDGPU_RAS_SUCCESS && obj) {
194+
obj->err_data.ue_count += err_data.ue_count;
195+
obj->err_data.ce_count += err_data.ce_count;
196+
}
193197
} else {
194198
if (adev->virt.ops && adev->virt.ops->ras_poison_handler)
195199
adev->virt.ops->ras_poison_handler(adev);

0 commit comments

Comments
 (0)