[PATCH v3 10/10] drm/xe/xe_pci_error: Process errors in mmio_enabled

Riana Tauro
2026-04-02T06:30:12Z

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.

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
v2: use ras recovery enum (Raag)

v3: add comment for mapping
use const (Mallesh)
---
drivers/gpu/drm/xe/xe_pci_error.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_pci_error.c b/drivers/gpu/drm/xe/xe_pci_error.c
index 28b2f4f7c24b..71b6152c1593 100644
--- a/drivers/gpu/drm/xe/xe_pci_error.c
+++ b/drivers/gpu/drm/xe/xe_pci_error.c
@@ -9,6 +9,7 @@
#include "xe_device.h"
#include "xe_gt.h"
#include "xe_pci.h"
+#include "xe_ras.h"
#include "xe_survivability_mode.h"
#include "xe_uc.h"

@@ -31,6 +32,13 @@ static void xe_pci_error_handling(struct pci_dev *pdev)
pci_disable_device(pdev);
}

+/* Mapping of RAS recovery action to PCI error result */
+static const pci_ers_result_t ras_recovery_action_to_pci_result[] = {
+ [XE_RAS_RECOVERY_ACTION_RECOVERED] = PCI_ERS_RESULT_RECOVERED,
+ [XE_RAS_RECOVERY_ACTION_RESET] = PCI_ERS_RESULT_NEED_RESET,
+ [XE_RAS_RECOVERY_ACTION_DISCONNECT] = 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);
@@ -56,9 +64,13 @@ 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;
+
dev_err(&pdev->dev, "Xe Pci error recovery: MMIO enabled\n");
+ action = xe_ras_process_errors(xe);

- return PCI_ERS_RESULT_NEED_RESET;
+ return ras_recovery_action_to_pci_result[action];
}

static pci_ers_result_t xe_pci_error_slot_reset(struct pci_dev *pdev)
--
2.47.1