drm/amdgpu: Add psp v14_0_3 ras support
Subsystems (2)
PATCH 1/4 drm/amdgpu: Add psp v14_0_3 ras support
Add psp v14_0_3 ras support.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
@@ -3571,6 +3571,7 @@ static bool amdgpu_ras_asic_supported(struct amdgpu_device *adev)case IP_VERSION (13 ,0 ,6 ):case IP_VERSION (13 ,0 ,12 ):case IP_VERSION (13 ,0 ,14 ): +case IP_VERSION (14 ,0 ,3 ):return true;default :return false;
Signature · 1 line
2.25.1
PATCH 2/4 drm/amdgpu: Add umc v8_14_0 ip headers
Add umc v8_14_0 ip headers.
--- .../include/asic_reg/umc/umc_8_14_0_offset.h | 29 +++++++++++++++ .../include/asic_reg/umc/umc_8_14_0_sh_mask.h | 37 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 drivers/gpu/drm/amd/include/asic_reg/umc/umc_8_14_0_offset.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/umc/umc_8_14_0_sh_mask.h
drivers/gpu/drm/amd/include/asic_reg/umc/umc_8_14_0_offset.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (C) 2024 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) 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 _umc_8_14_0_OFFSET_HEADER +#define _umc_8_14_0_OFFSET_HEADER + +#define regUMCCH0_GeccErrCntSel 0x0328 +#define regUMCCH0_GeccErrCntSel_BASE_IDX 0 +#define regUMCCH0_GeccErrCnt 0x0329 +#define regUMCCH0_GeccErrCnt_BASE_IDX 0 + +#endif
drivers/gpu/drm/amd/include/asic_reg/umc/umc_8_14_0_sh_mask.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2024 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) 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 _umc_8_14_0_SH_MASK_HEADER +#define _umc_8_14_0_SH_MASK_HEADER + +//UMCCH0_GeccErrCntSel +#define UMCCH0_GeccErrCntSel__GeccErrInt__SHIFT 0xc +#define UMCCH0_GeccErrCntSel__GeccErrCntEn__SHIFT 0xf +#define UMCCH0_GeccErrCntSel__PoisonCntEn__SHIFT 0x10 +#define UMCCH0_GeccErrCntSel__GeccErrInt_MASK 0x00003000L +#define UMCCH0_GeccErrCntSel__GeccErrCntEn_MASK 0x00008000L +#define UMCCH0_GeccErrCntSel__PoisonCntEn_MASK 0x00030000L +//UMCCH0_GeccErrCnt +#define UMCCH0_GeccErrCnt__GeccErrCnt__SHIFT 0x0 +#define UMCCH0_GeccErrCnt__GeccUnCorrErrCnt__SHIFT 0x10 +#define UMCCH0_GeccErrCnt__GeccErrCnt_MASK 0x0000FFFFL +#define UMCCH0_GeccErrCnt__GeccUnCorrErrCnt_MASK 0xFFFF0000L + +#endif
Signature · 1 line
2.25.1
PATCH 3/4 drm/amdgpu: Add umc v8_14 ras functions
In reply to Candice LiAdd umc v8_14 ras functions.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 18 ++- drivers/gpu/drm/amd/amdgpu/umc_v8_14.c | 160 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/umc_v8_14.h | 51 ++++++++ 4 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/umc_v8_14.c create mode 100644 drivers/gpu/drm/amd/amdgpu/umc_v8_14.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -106,7 +106,7 @@ amdgpu-y += \ # add UMC block amdgpu-y += \ - umc_v6_0.o umc_v6_1.o umc_v6_7.o umc_v8_7.o umc_v8_10.o umc_v12_0.o + umc_v6_0.o umc_v6_1.o umc_v6_7.o umc_v8_7.o umc_v8_10.o umc_v12_0.o umc_v8_14.o # add IH block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +17 -1
@@ -40,7 +40,7 @@#include "gfxhub_v12_0.h" #include "mmhub_v4_1_0.h" #include "athub_v4_1_0.h" - +#include "umc_v8_14.h" static int gmc_v12_0_ecc_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *src,
@@ -581,6 +581,18 @@ static void gmc_v12_0_set_gmc_funcs(struct amdgpu_device *adev)static void gmc_v12_0_set_umc_funcs (struct amdgpu_device *adev) { +switch (amdgpu_ip_version (adev,UMC_HWIP ,0 )) { +case IP_VERSION (8 ,14 ,0 ): + adev->umc.channel_inst_num =UMC_V8_14_CHANNEL_INSTANCE_NUM ; + adev->umc.umc_inst_num =UMC_V8_14_UMC_INSTANCE_NUM (adev); + adev->umc.node_inst_num =0 ; + adev->umc.max_ras_err_cnt_per_query =UMC_V8_14_TOTAL_CHANNEL_NUM (adev); + adev->umc.channel_offs =UMC_V8_14_PER_CHANNEL_OFFSET ; + adev->umc.ras = &umc_v8_14_ras; +break ; +default : +break ; + } }
@@ -829,6 +841,10 @@ static int gmc_v12_0_sw_init(struct amdgpu_ip_block *ip_block)amdgpu_vm_manager_init (adev); + r =amdgpu_gmc_ras_sw_init (adev); +if (r) +return r; +return 0 ; }
drivers/gpu/drm/amd/amdgpu/umc_v8_14.c new file +160 -0
160 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/umc_v8_14.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 4/4 drm/amdgpu: Support nbif v6_3_1 fatal error handling
In reply to Candice LiAdd nbif v6_3_1 fatal error handling support.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 ++++ drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.c | 81 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.h | 1 + drivers/gpu/drm/amd/amdgpu/soc24.c | 19 +++++- 4 files changed, 111 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12 -0
@@ -36,6 +36,7 @@#include "amdgpu_xgmi.h" #include "ivsrcid/nbio/irqsrcs_nbif_7_4.h" #include "nbio_v4_3.h" +#include "nbif_v6_3_1.h" #include "nbio_v7_9.h" #include "atom.h" #include "amdgpu_reset.h"
@@ -3911,6 +3912,17 @@ int amdgpu_ras_init(struct amdgpu_device *adev)* check DF RAS */ adev->nbio.ras = &nbio_v4_3_ras;break ; +case IP_VERSION (6 ,3 ,1 ): +if (adev->ras_hw_enabled & (1 <<AMDGPU_RAS_BLOCK__DF )) +/* unlike other generation of nbio ras, +* nbif v6_3_1 only support fatal error interrupt +* to inform software that DF is freezed due to +* system fatal error event. driver should not +* enable nbio ras in such case. Instead, +* check DF RAS +*/ + adev->nbio.ras = &nbif_v6_3_1_ras; +break ;case IP_VERSION (7 ,9 ,0 ):case IP_VERSION (7 ,9 ,1 ):if (!adev->gmc.is_app_apu)
drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.c +81 -0
90 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.h +1 -0
@@ -29,5 +29,6 @@extern const struct nbio_hdp_flush_reg nbif_v6_3_1_hdp_flush_reg;extern const struct amdgpu_nbio_funcs nbif_v6_3_1_funcs;extern const struct amdgpu_nbio_funcs nbif_v6_3_1_sriov_funcs; +extern struct amdgpu_nbio_ras nbif_v6_3_1_ras;#endif
drivers/gpu/drm/amd/amdgpu/soc24.c +17 -2
@@ -444,8 +444,18 @@ static int soc24_common_late_init(struct amdgpu_ip_block *ip_block) {struct amdgpu_device *adev = ip_block->adev; -if (amdgpu_sriov_vf (adev)) +if (amdgpu_sriov_vf (adev)) {xgpu_nv_mailbox_get_irq (adev); + }else { +if (adev->nbio.ras && + adev->nbio.ras_err_event_athub_irq.funcs) +/* don't need to fail gpu late init +* if enabling athub_err_event interrupt failed +* nbif v6_3_1 only support fatal error hanlding +* just enable the interrupt directly +*/ +amdgpu_irq_get (adev, &adev->nbio.ras_err_event_athub_irq,0 ); + }/* Enable selfring doorbell aperture late because doorbell BAR * aperture will change if resize BAR successfully in gmc sw_init.
@@ -501,8 +511,13 @@ static int soc24_common_hw_fini(struct amdgpu_ip_block *ip_block) adev->nbio.funcs->enable_doorbell_aperture (adev, false); adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); -if (amdgpu_sriov_vf (adev)) +if (amdgpu_sriov_vf (adev)) {xgpu_nv_mailbox_put_irq (adev); + }else { +if (adev->nbio.ras && + adev->nbio.ras_err_event_athub_irq.funcs) +amdgpu_irq_put (adev, &adev->nbio.ras_err_event_athub_irq,0 ); + }return 0 ; }
Signature · 1 line
2.25.1
RE: [PATCH 4/4] drm/amdgpu: Support nbif v6_3_1 fatal error handling
[AMD Official Use Only - AMD Internal Distribution Only]
Series is
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Candice Li
Sent: Friday, December 6, 2024 17:05
To: [email protected]
Cc: Li, Candice <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: Support nbif v6_3_1 fatal error handling
Add nbif v6_3_1 fatal error handling support.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 12 ++++ drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.c | 81 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.h | 1 + drivers/gpu/drm/amd/amdgpu/soc24.c | 19 +++++- 4 files changed, 111 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +12 -0
@@ -36,6 +36,7 @@#include "amdgpu_xgmi.h" #include "ivsrcid/nbio/irqsrcs_nbif_7_4.h" #include "nbio_v4_3.h" +#include "nbif_v6_3_1.h" #include "nbio_v7_9.h" #include "atom.h" #include "amdgpu_reset.h"
@@ -3911,6 +3912,17 @@ int amdgpu_ras_init(struct amdgpu_device *adev)* check DF RAS */ adev->nbio.ras = &nbio_v4_3_ras;break ; +case IP_VERSION (6 ,3 ,1 ): +if (adev->ras_hw_enabled & (1 <<AMDGPU_RAS_BLOCK__DF )) +/* unlike other generation of nbio ras, +* nbif v6_3_1 only support fatal error interrupt +* to inform software that DF is freezed due to +* system fatal error event. driver should not +* enable nbio ras in such case. Instead, +* check DF RAS +*/ + adev->nbio.ras = &nbif_v6_3_1_ras; +break ;case IP_VERSION (7 ,9 ,0 ):case IP_VERSION (7 ,9 ,1 ):if (!adev->gmc.is_app_apu)
drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.c +1 -0
@@ -28,6 +28,7 @@#include "nbif/nbif_6_3_1_sh_mask.h" #include "pcie/pcie_6_1_0_offset.h" #include "pcie/pcie_6_1_0_sh_mask.h" +#include "ivsrcid/nbio/irqsrcs_nbif_7_4.h" #include <uapi/linux/kfd_ioctl.h> static void nbif_v6_3_1_remap_hdp_registers(struct amdgpu_device *adev) @@ -518,3 +519,83 @@ const struct amdgpu_nbio_funcs nbif_v6_3_1_sriov_funcs = {
.get_rom_offset = nbif_v6_3_1_get_rom_offset,
.set_reg_remap = nbif_v6_3_1_set_reg_remap, };
+
+static int nbif_v6_3_1_set_ras_err_event_athub_irq_state(struct amdgpu_device *adev,
+ struct amdgpu_irq_src *src,
+ unsigned type,
+ enum amdgpu_interrupt_state state) {
+ /* The ras_controller_irq enablement should be done in psp bl when it
+ * tries to enable ras feature. Driver only need to set the correct interrupt
+ * vector for bare-metal and sriov use case respectively
+ */+ uint32_t bif_doorbell_int_cntl;
+
+ bif_doorbell_int_cntl = RREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL);
+ bif_doorbell_int_cntl = REG_SET_FIELD(bif_doorbell_int_cntl,
+ BIF_BX0_BIF_DOORBELL_INT_CNTL, + RAS_ATHUB_ERR_EVENT_INTERRUPT_DISABLE, + (state == AMDGPU_IRQ_STATE_ENABLE) ? 0 : 1);
+ WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL,
+bif_doorbell_int_cntl);
+
+ return 0;
+}
+
+static int nbif_v6_3_1_process_err_event_athub_irq(struct amdgpu_device *adev,
+ struct amdgpu_irq_src *source,
+ struct amdgpu_iv_entry *entry)
+{
+ /* By design, the ih cookie for err_event_athub_irq should be written
+ * to bif ring. since bif ring is not enabled, just leave process callback + * as a dummy one. + */
+ return 0;
+}
+
+static const struct amdgpu_irq_src_funcs nbif_v6_3_1_ras_err_event_athub_irq_funcs = {
+ .set = nbif_v6_3_1_set_ras_err_event_athub_irq_state,
+ .process = nbif_v6_3_1_process_err_event_athub_irq,
+};
+
+static void +nbif_v6_3_1_handle_ras_err_event_athub_intr_no_bifring(struct amdgpu_device *adev) {
+ uint32_t bif_doorbell_int_cntl;
+
+ bif_doorbell_int_cntl = RREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL);
+ if (REG_GET_FIELD(bif_doorbell_int_cntl,
+ BIF_BX0_BIF_DOORBELL_INT_CNTL,
+ RAS_ATHUB_ERR_EVENT_INTERRUPT_STATUS)) {
+ /* driver has to clear the interrupt status when bif ring is disabled */
+ bif_doorbell_int_cntl = REG_SET_FIELD(bif_doorbell_int_cntl,
+ BIF_BX0_BIF_DOORBELL_INT_CNTL,
+ RAS_ATHUB_ERR_EVENT_INTERRUPT_CLEAR, 1);
+ WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL, bif_doorbell_int_cntl);
+ amdgpu_ras_global_ras_isr(adev);
+ }
+}
+
+static int nbif_v6_3_1_init_ras_err_event_athub_interrupt(struct +amdgpu_device *adev) {
+ int r;
+
+ /* init the irq funcs */
+ adev->nbio.ras_err_event_athub_irq.funcs =
+ &nbif_v6_3_1_ras_err_event_athub_irq_funcs;
+ adev->nbio.ras_err_event_athub_irq.num_types = 1;
+
+ /* register ras err event athub interrupt
+ * nbif v6_3_1 uses the same irq source as nbio v7_4
+ */
+ r = amdgpu_irq_add_id(adev, SOC21_IH_CLIENTID_BIF,
+ NBIF_7_4__SRCID__ERREVENT_ATHUB_INTERRUPT,
+ &adev->nbio.ras_err_event_athub_irq);
+
+ return r;
+}
+
+struct amdgpu_nbio_ras nbif_v6_3_1_ras = {
+ .handle_ras_err_event_athub_intr_no_bifring =
+ nbif_v6_3_1_handle_ras_err_event_athub_intr_no_bifring,
+ .init_ras_err_event_athub_interrupt =
+ nbif_v6_3_1_init_ras_err_event_athub_interrupt,
+};
drivers/gpu/drm/amd/amdgpu/nbif_v6_3_1.h +1 -0
@@ -29,5 +29,6 @@extern const struct nbio_hdp_flush_reg nbif_v6_3_1_hdp_flush_reg;extern const struct amdgpu_nbio_funcs nbif_v6_3_1_funcs;extern const struct amdgpu_nbio_funcs nbif_v6_3_1_sriov_funcs; +extern struct amdgpu_nbio_ras nbif_v6_3_1_ras;#endif
drivers/gpu/drm/amd/amdgpu/soc24.c +17 -2
@@ -444,8 +444,18 @@ static int soc24_common_late_init(struct amdgpu_ip_block *ip_block) {struct amdgpu_device *adev = ip_block->adev; -if (amdgpu_sriov_vf (adev)) +if (amdgpu_sriov_vf (adev)) {xgpu_nv_mailbox_get_irq (adev); + }else { +if (adev->nbio.ras && + adev->nbio.ras_err_event_athub_irq.funcs) +/* don't need to fail gpu late init +* if enabling athub_err_event interrupt failed +* nbif v6_3_1 only support fatal error hanlding +* just enable the interrupt directly +*/ +amdgpu_irq_get (adev, &adev->nbio.ras_err_event_athub_irq,0 ); + }/* Enable selfring doorbell aperture late because doorbell BAR * aperture will change if resize BAR successfully in gmc sw_init.
@@ -501,8 +511,13 @@ static int soc24_common_hw_fini(struct amdgpu_ip_block *ip_block) adev->nbio.funcs->enable_doorbell_aperture (adev, false); adev->nbio.funcs->enable_doorbell_selfring_aperture (adev, false); -if (amdgpu_sriov_vf (adev)) +if (amdgpu_sriov_vf (adev)) {xgpu_nv_mailbox_put_irq (adev); + }else { +if (adev->nbio.ras && + adev->nbio.ras_err_event_athub_irq.funcs) +amdgpu_irq_put (adev, &adev->nbio.ras_err_event_athub_irq,0 ); + }return 0 ; }
--
2.25.1