When the firmware reports uncorrectable errors in response to an AER
interrupt, deliver a drm-ras error event to userspace for each affected
component. Multiple errors for the same component within a single firmware
response are collapsed into one event to avoid duplicate notifications.

Signed-off-by: Riana Tauro <[email protected]>
---
 drivers/gpu/drm/xe/xe_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
index b08c664778ff..cd1307539912 100644
--- a/drivers/gpu/drm/xe/xe_ras.c
+++ b/drivers/gpu/drm/xe/xe_ras.c
@@ -449,6 +449,7 @@ enum xe_ras_recovery_action xe_ras_process_errors(struct 
xe_device *xe)
        enum xe_ras_recovery_action final_action;
        u32 remaining = XE_SYSCTRL_FLOOD_LIMIT;
        struct xe_ras_get_soc_error response;
+       u8 sent = 0;
        size_t rlen;
        int ret;
 
@@ -492,6 +493,12 @@ enum xe_ras_recovery_action xe_ras_process_errors(struct 
xe_device *xe)
                        xe_info(xe, "[RAS]: %s %s detected\n", 
comp_to_str(component),
                                sev_to_str(severity));
 
+                       /* Send event once per component */
+                       if (!(sent & BIT(component))) {
+                               sent |= BIT(component);
+                               ras_send_error_event(xe, severity, component);
+                       }
+
                        switch (component) {
                        case XE_RAS_COMP_CORE_COMPUTE:
                                action = handle_core_compute_errors(arr);
-- 
2.47.1

Reply via email to