From 8b68e9dedc5b1a2ef9fae4d11f703c6d7be32352 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 20 May 2024 04:52:26 +0000 Subject: [PATCH] drm/amdkfd: range check cp bad op exception interrupts From Jonathan Kim 41dc6791596656dd41100b85647ed489e1d5c2f2 in linux-6.6.y/6.6.31 0cac183b98d8a8c692c98e8dba37df15a9e9210d in mainline linux --- sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c | 3 ++- sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c | 3 ++- sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c index a7697ec8188..f85ca6cb90f 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v10.c @@ -336,7 +336,8 @@ static void event_interrupt_wq_v10(struct kfd_node *dev, break; } kfd_signal_event_interrupt(pasid, context_id0 & 0x7fffff, 23); - } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) { + } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && + KFD_DBG_EC_TYPE_IS_PACKET(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0))) { kfd_set_dbg_ev_from_interrupt(dev, pasid, KFD_DEBUG_DOORBELL_ID(context_id0), KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c index 2a65792fd11..3ca9c160da7 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v11.c @@ -325,7 +325,8 @@ static void event_interrupt_wq_v11(struct kfd_node *dev, /* CP */ if (source_id == SOC15_INTSRC_CP_END_OF_PIPE) kfd_signal_event_interrupt(pasid, context_id0, 32); - else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) + else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && + KFD_DBG_EC_TYPE_IS_PACKET(KFD_CTXID0_CP_BAD_OP_ECODE(context_id0))) kfd_set_dbg_ev_from_interrupt(dev, pasid, KFD_CTXID0_DOORBELL_ID(context_id0), KFD_EC_MASK(KFD_CTXID0_CP_BAD_OP_ECODE(context_id0)), diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c index 27cdaea4050..8a6729939ae 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_int_process_v9.c @@ -385,7 +385,8 @@ static void event_interrupt_wq_v9(struct kfd_node *dev, break; } kfd_signal_event_interrupt(pasid, sq_int_data, 24); - } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE) { + } else if (source_id == SOC15_INTSRC_CP_BAD_OPCODE && + KFD_DBG_EC_TYPE_IS_PACKET(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0))) { kfd_set_dbg_ev_from_interrupt(dev, pasid, KFD_DEBUG_DOORBELL_ID(context_id0), KFD_EC_MASK(KFD_DEBUG_CP_BAD_OP_ECODE(context_id0)), -- 2.20.1