From acc744fa62fb098358f371bfb38e6b32032459c7 Mon Sep 17 00:00:00 2001 From: Riana Tauro Date: Mon, 13 Jul 2026 13:18:00 +0530 Subject: [PATCH] drm/xe/xe_pci_error: Process errors in mmio_enabled Query system controller when any non fatal error occurs to check the type of the error, contain and recover. The system controller is queried in the mmio_enabled callback. Reviewed-by: Raag Jadav Reviewed-by: Mallesh Koujalagi Link: https://patch.msgid.link/20260713074755.1278607-10-riana.tauro@intel.com Signed-off-by: Riana Tauro --- drivers/gpu/drm/xe/xe_pci_error.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_pci_error.c b/drivers/gpu/drm/xe/xe_pci_error.c index 9b78cc0d3293..e41af2ac7f23 100644 --- a/drivers/gpu/drm/xe/xe_pci_error.c +++ b/drivers/gpu/drm/xe/xe_pci_error.c @@ -10,6 +10,7 @@ #include "xe_pci.h" #include "xe_pm.h" #include "xe_printk.h" +#include "xe_ras.h" #include "xe_survivability_mode.h" static void prepare_device_for_reset(struct pci_dev *pdev) @@ -34,6 +35,21 @@ static void prepare_device_for_reset(struct pci_dev *pdev) pci_disable_device(pdev); } +static pci_ers_result_t ras_action_to_pci_result(struct pci_dev *pdev, u8 action) +{ + switch (action) { + case XE_RAS_RECOVERY_ACTION_RECOVERED: + return PCI_ERS_RESULT_RECOVERED; + case XE_RAS_RECOVERY_ACTION_RESET: + prepare_device_for_reset(pdev); + return PCI_ERS_RESULT_NEED_RESET; + case XE_RAS_RECOVERY_ACTION_DISCONNECT: + return PCI_ERS_RESULT_DISCONNECT; + default: + return PCI_ERS_RESULT_DISCONNECT; + } +} + static pci_ers_result_t xe_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) { struct xe_device *xe = pdev_to_xe_device(pdev); @@ -62,11 +78,12 @@ static pci_ers_result_t xe_pci_error_detected(struct pci_dev *pdev, pci_channel_ static pci_ers_result_t xe_pci_error_mmio_enabled(struct pci_dev *pdev) { struct xe_device *xe = pdev_to_xe_device(pdev); + enum xe_ras_recovery_action action; xe_info(xe, "PCI error: MMIO enabled\n"); + action = xe_ras_process_errors(xe); - /* TODO: Query system controller for the type of error and take appropriate action */ - return PCI_ERS_RESULT_RECOVERED; + return ras_action_to_pci_result(pdev, action); } static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev)