drm/amdgpu: add xgmi ip headers
Subsystems (2)
PATCH 1/6 drm/amdgpu: add xgmi ip headers
add xgmi ip smn address and shift mask header files
--- .../asic_reg/xgmi/xgmi_4_0_0_sh_mask.h | 69 +++++++++++++++++++ .../include/asic_reg/xgmi/xgmi_4_0_0_smn.h | 29 ++++++++ 2 files changed, 98 insertions(+) create mode 100644 drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_smn.h
drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.h new file +69 -0
@@ -0,0 +1,69 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef _xgmi_4_0_0_SH_MASK_HEADER +#define _xgmi_4_0_0_SH_MASK_HEADER + +//PCS_GOPX16_PCS_ERROR_STATUS +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataLossErr__SHIFT 0x0 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TrainingErr__SHIFT 0x1 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__CRCErr__SHIFT 0x5 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERExceededErr__SHIFT 0x6 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TxMetaDataErr__SHIFT 0x7 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayBufParityErr__SHIFT 0x8 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataParityErr__SHIFT 0x9 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoOverflowErr__SHIFT 0xa +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoUnderflowErr__SHIFT 0xb +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ElasticFifoOverflowErr__SHIFT 0xc +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DeskewErr__SHIFT 0xd +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataStartupLimitErr__SHIFT 0xf +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__FCInitTimeoutErr__SHIFT 0x10 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryTimeoutErr__SHIFT 0x11 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialTimeoutErr__SHIFT 0x12 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialAttemptErr__SHIFT 0x13 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryAttemptErr__SHIFT 0x14 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryRelockAttemptErr__SHIFT 0x15 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ClearBERAccum__SHIFT 0x17 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERAccumulator__SHIFT 0x18 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataLossErr_MASK 0x00000001L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TrainingErr_MASK 0x00000002L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__CRCErr_MASK 0x00000020L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERExceededErr_MASK 0x00000040L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TxMetaDataErr_MASK 0x00000080L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayBufParityErr_MASK 0x00000100L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataParityErr_MASK 0x00000200L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoOverflowErr_MASK 0x00000400L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoUnderflowErr_MASK 0x00000800L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ElasticFifoOverflowErr_MASK 0x00001000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DeskewErr_MASK 0x00002000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataStartupLimitErr_MASK 0x00008000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__FCInitTimeoutErr_MASK 0x00010000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryTimeoutErr_MASK 0x00020000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialTimeoutErr_MASK 0x00040000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialAttemptErr_MASK 0x00080000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryAttemptErr_MASK 0x00100000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryRelockAttemptErr_MASK 0x00200000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ClearBERAccum_MASK 0x00800000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERAccumulator_MASK 0xFF000000L + +#endif
drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_smn.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef _xgmi_4_0_0_SMN_HEADER +#define _xgmi_4_0_0_SMN_HEADER + +#define smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS 0x11af0210 + +#endif
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/6 drm/amdgpu: add wafl2 ip headers
add wafl2 smn address and shift mask definition header files
--- .../asic_reg/wafl/wafl2_4_0_0_sh_mask.h | 69 +++++++++++++++++++ .../include/asic_reg/wafl/wafl2_4_0_0_smn.h | 29 ++++++++ 2 files changed, 98 insertions(+) create mode 100644 drivers/gpu/drm/amd/include/asic_reg/wafl/wafl2_4_0_0_sh_mask.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/wafl/wafl2_4_0_0_smn.h
drivers/gpu/drm/amd/include/asic_reg/wafl/wafl2_4_0_0_sh_mask.h new file +69 -0
@@ -0,0 +1,69 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef _wafl2_4_0_0_SH_MASK_HEADER +#define _wafl2_4_0_0_SH_MASK_HEADER + +//PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DataLossErr__SHIFT 0x0 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__TrainingErr__SHIFT 0x1 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__CRCErr__SHIFT 0x5 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__BERExceededErr__SHIFT 0x6 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__TxMetaDataErr__SHIFT 0x7 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReplayBufParityErr__SHIFT 0x8 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DataParityErr__SHIFT 0x9 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReplayFifoOverflowErr__SHIFT 0xa +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReplayFifoUnderflowErr__SHIFT 0xb +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ElasticFifoOverflowErr__SHIFT 0xc +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DeskewErr__SHIFT 0xd +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DataStartupLimitErr__SHIFT 0xf +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__FCInitTimeoutErr__SHIFT 0x10 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__RecoveryTimeoutErr__SHIFT 0x11 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReadySerialTimeoutErr__SHIFT 0x12 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReadySerialAttemptErr__SHIFT 0x13 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__RecoveryAttemptErr__SHIFT 0x14 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__RecoveryRelockAttemptErr__SHIFT 0x15 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ClearBERAccum__SHIFT 0x17 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__BERAccumulator__SHIFT 0x18 +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DataLossErr_MASK 0x00000001L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__TrainingErr_MASK 0x00000002L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__CRCErr_MASK 0x00000020L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__BERExceededErr_MASK 0x00000040L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__TxMetaDataErr_MASK 0x00000080L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReplayBufParityErr_MASK 0x00000100L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DataParityErr_MASK 0x00000200L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReplayFifoOverflowErr_MASK 0x00000400L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReplayFifoUnderflowErr_MASK 0x00000800L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ElasticFifoOverflowErr_MASK 0x00001000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DeskewErr_MASK 0x00002000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__DataStartupLimitErr_MASK 0x00008000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__FCInitTimeoutErr_MASK 0x00010000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__RecoveryTimeoutErr_MASK 0x00020000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReadySerialTimeoutErr_MASK 0x00040000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ReadySerialAttemptErr_MASK 0x00080000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__RecoveryAttemptErr_MASK 0x00100000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__RecoveryRelockAttemptErr_MASK 0x00200000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__ClearBERAccum_MASK 0x00800000L +#define PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS__BERAccumulator_MASK 0xFF000000L + +#endif
drivers/gpu/drm/amd/include/asic_reg/wafl/wafl2_4_0_0_smn.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef _wafl2_4_0_0_SMN_HEADER +#define _wafl2_4_0_0_SMN_HEADER + +#define smnPCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS 0x11cf0210 + +#endif
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/6 drm/amdgpu: add helper funcs to detect PCS error
In reply to Hawking ZhangSince from vega20, hardware supports run-time detect and report XGMI/WAFL PCS ras error. Add helper functions to walkthrough every type of ras error and report it if any.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 173 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 8 ++ 2 files changed, 181 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +173 -0
@@ -26,7 +26,12 @@#include "amdgpu_xgmi.h" #include "amdgpu_smu.h" #include "amdgpu_ras.h" +#include "soc15.h" #include "df/df_3_6_offset.h" +#include "xgmi/xgmi_4_0_0_smn.h" +#include "xgmi/xgmi_4_0_0_sh_mask.h" +#include "wafl/wafl2_4_0_0_smn.h" +#include "wafl/wafl2_4_0_0_sh_mask.h" static DEFINE_MUTEX (xgmi_mutex);
@@ -36,6 +41,94 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; +static const int xgmi_pcs_err_status_reg_vg20[] = { + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS, + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS +0x100000 , +}; + +static const int wafl_pcs_err_status_reg_vg20[] = { + smnPCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS, + smnPCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS +0x100000 , +}; + +static const struct amdgpu_pcs_ras_field xgmi_pcs_ras_fields[] = { + {"XGMI PCS DataLossErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , DataLossErr)}, + {"XGMI PCS TrainingErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , TrainingErr)}, + {"XGMI PCS CRCErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , CRCErr)}, + {"XGMI PCS BERExceededErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , BERExceededErr)}, + {"XGMI PCS TxMetaDataErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , TxMetaDataErr)}, + {"XGMI PCS ReplayBufParityErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , ReplayBufParityErr)}, + {"XGMI PCS DataParityErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , DataParityErr)}, + {"XGMI PCS ReplayFifoOverflowErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , ReplayFifoOverflowErr)}, + {"XGMI PCS ReplayFifoUnderflowErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , ReplayFifoUnderflowErr)}, + {"XGMI PCS ElasticFifoOverflowErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , ElasticFifoOverflowErr)}, + {"XGMI PCS DeskewErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , DeskewErr)}, + {"XGMI PCS DataStartupLimitErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , DataStartupLimitErr)}, + {"XGMI PCS FCInitTimeoutErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , FCInitTimeoutErr)}, + {"XGMI PCS RecoveryTimeoutErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , RecoveryTimeoutErr)}, + {"XGMI PCS ReadySerialTimeoutErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , ReadySerialTimeoutErr)}, + {"XGMI PCS ReadySerialAttemptErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , ReadySerialAttemptErr)}, + {"XGMI PCS RecoveryAttemptErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , RecoveryAttemptErr)}, + {"XGMI PCS RecoveryRelockAttemptErr" , +SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , RecoveryRelockAttemptErr)}, +}; + +static const struct amdgpu_pcs_ras_field wafl_pcs_ras_fields[] = { + {"WAFL PCS DataLossErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , DataLossErr)}, + {"WAFL PCS TrainingErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , TrainingErr)}, + {"WAFL PCS CRCErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , CRCErr)}, + {"WAFL PCS BERExceededErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , BERExceededErr)}, + {"WAFL PCS TxMetaDataErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , TxMetaDataErr)}, + {"WAFL PCS ReplayBufParityErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , ReplayBufParityErr)}, + {"WAFL PCS DataParityErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , DataParityErr)}, + {"WAFL PCS ReplayFifoOverflowErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , ReplayFifoOverflowErr)}, + {"WAFL PCS ReplayFifoUnderflowErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , ReplayFifoUnderflowErr)}, + {"WAFL PCS ElasticFifoOverflowErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , ElasticFifoOverflowErr)}, + {"WAFL PCS DeskewErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , DeskewErr)}, + {"WAFL PCS DataStartupLimitErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , DataStartupLimitErr)}, + {"WAFL PCS FCInitTimeoutErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , FCInitTimeoutErr)}, + {"WAFL PCS RecoveryTimeoutErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , RecoveryTimeoutErr)}, + {"WAFL PCS ReadySerialTimeoutErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , ReadySerialTimeoutErr)}, + {"WAFL PCS ReadySerialAttemptErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , ReadySerialAttemptErr)}, + {"WAFL PCS RecoveryAttemptErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , RecoveryAttemptErr)}, + {"WAFL PCS RecoveryRelockAttemptErr" , +SOC15_REG_FIELD (PCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS , RecoveryRelockAttemptErr)}, +}; +void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list;
@@ -530,3 +623,83 @@ void amdgpu_xgmi_ras_fini(struct amdgpu_device *adev)kfree (ras_if); } } + +static int amdgpu_xgmi_query_pcs_error_status (struct amdgpu_device *adev, +uint32_t value, +uint32_t *ue_count, +uint32_t *ce_count, +bool is_xgmi_pcs) +{ +int i; +int ue_cnt; + +if (is_xgmi_pcs) { +/* query xgmi pcs error status, +* only ue is supported */ +for (i =0 ; i <ARRAY_SIZE (xgmi_pcs_ras_fields); i ++) { + ue_cnt = (value & + xgmi_pcs_ras_fields[i].pcs_err_mask) >> + xgmi_pcs_ras_fields[i].pcs_err_shift; +if (ue_cnt) { +dev_info (adev->dev,"%s detected\n" , + xgmi_pcs_ras_fields[i].err_name); + *ue_count += ue_cnt; + } + } + }else { +/* query wafl pcs error status, +* only ue is supported */ +for (i =0 ; i <ARRAY_SIZE (wafl_pcs_ras_fields); i++) { + ue_cnt = (value & + wafl_pcs_ras_fields[i].pcs_err_mask) >> + wafl_pcs_ras_fields[i].pcs_err_shift; +if (ue_cnt) { +dev_info (adev->dev,"%s detected\n" , + wafl_pcs_ras_fields[i].err_name); + *ue_count += ue_cnt; + } + } + } + +return 0 ; +} + +int amdgpu_xgmi_query_ras_error_count (struct amdgpu_device *adev, +void *ras_error_status) +{ +struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status; +int i; +uint32_t data; +uint32_t ue_cnt =0 , ce_cnt =0 ; + +if (!amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__XGMI_WAFL )) +return -EINVAL ; + + err_data->ue_count =0 ; + err_data->ce_count =0 ; + +switch (adev->asic_type) { +case CHIP_VEGA20 : +default : +/* check xgmi pcs error */ +for (i =0 ; i <ARRAY_SIZE (xgmi_pcs_err_status_reg_vg20); i++) { + data =RREG32_PCIE (xgmi_pcs_err_status_reg_vg20[i]); +if (data) +amdgpu_xgmi_query_pcs_error_status (adev, + data, &ue_cnt, &ce_cnt, true); + } +/* check wafl pcs error */ +for (i =0 ; i <ARRAY_SIZE (wafl_pcs_err_status_reg_vg20); i++) { + data =RREG32_PCIE (wafl_pcs_err_status_reg_vg20[i]); +if (data) +amdgpu_xgmi_query_pcs_error_status (adev, + data, &ue_cnt, &ce_cnt, false); + } +break ; + } + + err_data->ue_count += ue_cnt; + err_data->ce_count += ce_cnt; + +return 0 ; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +8 -0
@@ -37,6 +37,12 @@ struct amdgpu_hive_info {struct task_barrier tb; }; +struct amdgpu_pcs_ras_field { +const char *err_name; +uint32_t pcs_err_mask; +uint32_t pcs_err_shift; +}; +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);int amdgpu_xgmi_update_topology (struct amdgpu_hive_info *hive,struct amdgpu_device *adev);int amdgpu_xgmi_add_device (struct amdgpu_device *adev);
@@ -46,6 +52,8 @@ int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev, struct amdgpu_device *peer_adev);int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev);void amdgpu_xgmi_ras_fini (struct amdgpu_device *adev); +int amdgpu_xgmi_query_ras_error_count (struct amdgpu_device *adev, +void *ras_error_status);static inline bool amdgpu_xgmi_same_hive (struct amdgpu_device *adev,struct amdgpu_device *bo_adev)
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/6 drm/amdgpu: enable PCS error report on VG20
In reply to Hawking ZhangNow driver will report XGMI/WAFL PCS error through sysfs xgmi_wafl_err_count node on Vega20
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -0
@@ -31,6 +31,7 @@#include "amdgpu.h" #include "amdgpu_ras.h" #include "amdgpu_atomfirmware.h" +#include "amdgpu_xgmi.h" #include "ivsrcid/nbio/irqsrcs_nbif_7_4.h" const char *ras_error_string[] = {
@@ -720,6 +721,9 @@ int amdgpu_ras_error_query(struct amdgpu_device *adev,if (adev->nbio.funcs->query_ras_error_count) adev->nbio.funcs->query_ras_error_count (adev, &err_data);break ; +case AMDGPU_RAS_BLOCK__XGMI_WAFL : +amdgpu_xgmi_query_ras_error_count (adev, &err_data); +break ;default :break ; }
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/6 drm/amdgpu: enable PCS error report on arcturus
In reply to Hawking Zhangadd arcturus xgmi/wafl pcs err status group to support PCS error detection and report on arcturus
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +31 -0
@@ -51,6 +51,21 @@ static const int wafl_pcs_err_status_reg_vg20[] = { smnPCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS + 0x100000, }; +static const int xgmi_pcs_err_status_reg_arct[] = { + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS, + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS +0x100000 , + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS +0x500000 , + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS +0x600000 , + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS +0x700000 , + smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS +0x800000 , +}; + +/* same as vg20*/ +static const int wafl_pcs_err_status_reg_arct[] = { + smnPCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS, + smnPCS_GOPX1_0_PCS_GOPX1_PCS_ERROR_STATUS +0x100000 , +}; +static const struct amdgpu_pcs_ras_field xgmi_pcs_ras_fields[] = { {"XGMI PCS DataLossErr" ,SOC15_REG_FIELD (XGMI0_PCS_GOPX16_PCS_ERROR_STATUS , DataLossErr)},
@@ -679,6 +694,22 @@ int amdgpu_xgmi_query_ras_error_count(struct amdgpu_device *adev, err_data->ce_count =0 ;switch (adev->asic_type) { +case CHIP_ARCTURUS : +/* check xgmi pcs error */ +for (i =0 ; i <ARRAY_SIZE (xgmi_pcs_err_status_reg_arct); i++) { + data =RREG32_PCIE (xgmi_pcs_err_status_reg_arct[i]); +if (data) +amdgpu_xgmi_query_pcs_error_status (adev, + data, &ue_cnt, &ce_cnt, true); + } +/* check wafl pcs error */ +for (i =0 ; i <ARRAY_SIZE (wafl_pcs_err_status_reg_arct); i++) { + data =RREG32_PCIE (wafl_pcs_err_status_reg_arct[i]); +if (data) +amdgpu_xgmi_query_pcs_error_status (adev, + data, &ue_cnt, &ce_cnt, false); + } +break ;case CHIP_VEGA20 :default :/* check xgmi pcs error */
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
It seems patch #6 is lost.
Patch #1 ~ patch #5 are:
Quoted 229 lines
-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: 2020年3月4日 18:52
To: [email protected]; Chen, Guchun <[email protected]>; Zhou1, Tao <[email protected]>; Clements, John <[email protected]>; Li, Dennis <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/6] drm/amdgpu: add xgmi ip headersadd xgmi ip smn address and shift mask header files
Signed-off-by Hawking Zhang <[email protected]>Reviewed-by Guchun Chen <[email protected]>--- .../asic_reg/xgmi/xgmi_4_0_0_sh_mask.h | 69 +++++++++++++++++++ .../include/asic_reg/xgmi/xgmi_4_0_0_smn.h | 29 ++++++++ 2 files changed, 98 insertions(+) create mode 100644 drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.h create mode 100644
drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_smn.hdiff --git
a/drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.hb/drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.hnew file mode 100644
index 000000000000..f37712f05b03drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.h new file +14
-0@@ -0,0 +1,69 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.h new file +6
-0+ +#ifndef _xgmi_4_0_0_SH_MASK_HEADER +#define _xgmi_4_0_0_SH_MASK_HEADER + +//PCS_GOPX16_PCS_ERROR_STATUS +#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataLossErr__SHIFT 0x0 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TrainingErr__SHIFT 0x1 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__CRCErr__SHIFT 0x5 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERExceededErr__SHIFT 0x6 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TxMetaDataErr__SHIFT 0x7+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayBufParityErr__SHI
FT0x8
+#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataParityErr__SHIFT 0x9+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoOverflowErr__SHIFT0xa
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoUnderflowErr__SHIFT0xb
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ElasticFifoOverflowErr__
SHIFT0xc
+#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DeskewErr__SHIFT 0xd+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataStartupLimitErr__S
HIFT0xf
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__FCInitTimeoutErr__SHIF
T0x10
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryTimeoutErr__S
HIFT0x11
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialTimeoutErr__SHIFT0x12
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialAttemptErr__SHIFT0x13
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryAttemptErr__S
HIFT0x14
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryRelockAttemptErr__SHIFT0x15
+#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ClearBERAccum__SHIFT 0x17 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERAccumulator__SHIFT 0x18 +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataLossErr_MASK 0x00000001L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TrainingErr_MASK 0x00000002L+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__CRCErr_MASK0x00000020L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERExceededErr_MASK 0x00000040L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__TxMetaDataErr_MASK 0x00000080L+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayBufParityErr_MAS
K0x00000100L
+#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataParityErr_MASK 0x00000200L+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoOverflowErr_
MASK0x00000400L
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReplayFifoUnderflowErr_MASK0x00000800L
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ElasticFifoOverflowErr_
MASK0x00001000L
+#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DeskewErr_MASK 0x00002000L+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__DataStartupLimitErr_MA
SK0x00008000L
+#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__FCInitTimeoutErr_MASK 0x00010000L+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryTimeoutErr_M
ASK0x00020000L
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialTimeoutErr_
MASK0x00040000L
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ReadySerialAttemptErr_
MASK0x00080000L
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryAttemptErr_M
ASK0x00100000L
+#define
XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__RecoveryRelockAttemptErr_MASK0x00200000L
+#defineXGMI0_PCS_GOPX16_PCS_ERROR_STATUS__ClearBERAccum_MASK 0x00800000L +#define XGMI0_PCS_GOPX16_PCS_ERROR_STATUS__BERAccumulator_MASK 0xFF000000Ldrivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_sh_mask.h new file +2
-0+ +#endif drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_smn.h new file +14
-0@@ -0,0 +1,29 @@ +/* +* Copyright 2020 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_smn.h new file +5
-0+ +#ifndef _xgmi_4_0_0_SMN_HEADER +#define _xgmi_4_0_0_SMN_HEADER + +#define smnXGMI0_PCS_GOPX16_PCS_ERROR_STATUS0x11af0210drivers/gpu/drm/amd/include/asic_reg/xgmi/xgmi_4_0_0_smn.h new file +2
-1+ +#endif --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx