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

drm/amdgpu: Move hdp ras block init to ras sw_init

Initialize hdp ras block only when mmhub ip block
supports ras features. Driver queries ras capabilities
after early_init, ras block init needs to be moved to
sw_init.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Stanley Yang <Stanley.Yang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Hawking Zhang and committed by
Alex Deucher
474e2d49 fec70a86

+55 -9
+1 -1
drivers/gpu/drm/amd/amdgpu/Makefile
··· 54 54 amdgpu_ucode.o amdgpu_bo_list.o amdgpu_ctx.o amdgpu_sync.o \ 55 55 amdgpu_gtt_mgr.o amdgpu_preempt_mgr.o amdgpu_vram_mgr.o amdgpu_virt.o \ 56 56 amdgpu_atomfirmware.o amdgpu_vf_error.o amdgpu_sched.o \ 57 - amdgpu_debugfs.o amdgpu_ids.o amdgpu_gmc.o amdgpu_mmhub.o \ 57 + amdgpu_debugfs.o amdgpu_ids.o amdgpu_gmc.o amdgpu_mmhub.o amdgpu_hdp.o \ 58 58 amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ 59 59 amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \ 60 60 amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \
+5
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
··· 461 461 if (r) 462 462 return r; 463 463 464 + /* hdp ras block */ 465 + r = amdgpu_hdp_ras_sw_init(adev); 466 + if (r) 467 + return r; 468 + 464 469 if (!adev->gmc.xgmi.connected_to_cpu) { 465 470 adev->gmc.xgmi.ras = &xgmi_ras; 466 471 amdgpu_ras_register_ras_block(adev, &adev->gmc.xgmi.ras->ras_block);
+48
drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
··· 1 + /* 2 + * Copyright 2023 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 + 26 + int amdgpu_hdp_ras_sw_init(struct amdgpu_device *adev) 27 + { 28 + int err; 29 + struct amdgpu_hdp_ras *ras; 30 + 31 + if (!adev->hdp.ras) 32 + return 0; 33 + 34 + ras = adev->hdp.ras; 35 + err = amdgpu_ras_register_ras_block(adev, &ras->ras_block); 36 + if (err) { 37 + dev_err(adev->dev, "Failed to register hdp ras block!\n"); 38 + return err; 39 + } 40 + 41 + strcpy(ras->ras_block.ras_comm.name, "hdp"); 42 + ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__HDP; 43 + ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE; 44 + adev->hdp.ras_if = &ras->ras_block.ras_comm; 45 + 46 + /* hdp ras follows amdgpu_ras_block_late_init_default for late init */ 47 + return 0; 48 + }
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h
··· 43 43 struct amdgpu_hdp_ras *ras; 44 44 }; 45 45 46 - int amdgpu_hdp_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block); 46 + int amdgpu_hdp_ras_sw_init(struct amdgpu_device *adev); 47 47 #endif /* __AMDGPU_HDP_H__ */
-2
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 1361 1361 static void gmc_v9_0_set_hdp_ras_funcs(struct amdgpu_device *adev) 1362 1362 { 1363 1363 adev->hdp.ras = &hdp_v4_0_ras; 1364 - amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block); 1365 - adev->hdp.ras_if = &adev->hdp.ras->ras_block.ras_comm; 1366 1364 } 1367 1365 1368 1366 static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev)
-5
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c
··· 161 161 162 162 struct amdgpu_hdp_ras hdp_v4_0_ras = { 163 163 .ras_block = { 164 - .ras_comm = { 165 - .name = "hdp", 166 - .block = AMDGPU_RAS_BLOCK__HDP, 167 - .type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE, 168 - }, 169 164 .hw_ops = &hdp_v4_0_ras_hw_ops, 170 165 }, 171 166 };