/* Do not process in ISR, just request it to be forwarded to WQ. */
        return (pasid != 0) &&
                (ihre->source_id == CIK_INTSRC_CP_END_OF_PIPE ||
-               ihre->source_id == CIK_INTSRC_SQ_INTERRUPT_MSG);
+               ihre->source_id == CIK_INTSRC_SQ_INTERRUPT_MSG ||
+               ihre->source_id == CIK_INTSRC_CP_BAD_OPCODE);
 }
 
 static void cik_event_interrupt_wq(struct kfd_dev *dev,
                kfd_signal_event_interrupt(pasid, 0, 0);
        else if (ihre->source_id == CIK_INTSRC_SQ_INTERRUPT_MSG)
                kfd_signal_event_interrupt(pasid, ihre->data & 0xFF, 8);
+       else if (ihre->source_id == CIK_INTSRC_CP_BAD_OPCODE)
+               kfd_signal_hw_exception_event(pasid);
 }
 
 const struct kfd_event_interrupt_class event_interrupt_class_cik = {
 
 
 #define CIK_INTSRC_DEQUEUE_COMPLETE    0xC6
 #define CIK_INTSRC_CP_END_OF_PIPE      0xB5
+#define CIK_INTSRC_CP_BAD_OPCODE       0xB7
 #define CIK_INTSRC_SQ_INTERRUPT_MSG    0xEF
 
 #endif
 
        mutex_unlock(&p->event_mutex);
        mutex_unlock(&p->mutex);
 }
+
+void kfd_signal_hw_exception_event(unsigned int pasid)
+{
+       /*
+        * Because we are called from arbitrary context (workqueue) as opposed
+        * to process context, kfd_process could attempt to exit while we are
+        * running so the lookup function returns a locked process.
+        */
+       struct kfd_process *p = kfd_lookup_process_by_pasid(pasid);
+
+       if (!p)
+               return; /* Presumably process exited. */
+
+       mutex_lock(&p->event_mutex);
+
+       /* Lookup events by type and signal them */
+       lookup_events_by_type_and_signal(p, KFD_EVENT_TYPE_HW_EXCEPTION, NULL);
+
+       mutex_unlock(&p->event_mutex);
+       mutex_unlock(&p->mutex);
+}
 
 
 /* Matching HSA_EVENTTYPE */
 #define KFD_EVENT_TYPE_SIGNAL 0
+#define KFD_EVENT_TYPE_HW_EXCEPTION 3
 #define KFD_EVENT_TYPE_DEBUG 5
 #define KFD_EVENT_TYPE_MEMORY 8
 
 
 
 /* Events */
 extern const struct kfd_event_interrupt_class event_interrupt_class_cik;
+extern const struct kfd_device_global_init_class device_global_init_class_cik;
 
 enum kfd_event_wait_result {
        KFD_WAIT_COMPLETE,
 void kfd_signal_iommu_event(struct kfd_dev *dev,
                unsigned int pasid, unsigned long address,
                bool is_write_requested, bool is_execute_requested);
+void kfd_signal_hw_exception_event(unsigned int pasid);
 int kfd_set_event(struct kfd_process *p, uint32_t event_id);
 int kfd_reset_event(struct kfd_process *p, uint32_t event_id);
 int kfd_event_create(struct file *devkfd, struct kfd_process *p,