Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/xe/ras: Configure USP AER via system controller mailbox
@ 2026-12-03 17:44 Soham Purkait
  2026-12-03 17:44 ` [PATCH 1/2] drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error Soham Purkait
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Soham Purkait @ 2026-12-03 17:44 UTC (permalink / raw)
  To: intel-xe, riana.tauro, anshuman.gupta, aravind.iddamsetty,
	badal.nilawar, raag.jadav, rodrigo.vivi
  Cc: soham.purkait

The driver downgrades the USP Uncorrectable Internal Error to non-fatal
by programming the AER registers directly. This is not done when the OS
does not own AER, or when the driver runs under a hypervisor, as the USP
is not accessible.

This series requests the same downgrade from the system controller in
these cases.

Riana Tauro (1):
  drm/xe/ras: Add RAS config command to downgrade AER uncorrectable
    internal error

Soham Purkait (1):
  drm/xe/ras: Use RAS config command for USP AER downgrade during
    passthrough

 drivers/gpu/drm/xe/xe_ras.c                   | 89 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_ras_types.h             | 58 ++++++++++++
 drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h |  2 +
 3 files changed, 149 insertions(+)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error
  2026-12-03 17:44 [PATCH 0/2] drm/xe/ras: Configure USP AER via system controller mailbox Soham Purkait
@ 2026-12-03 17:44 ` Soham Purkait
  2026-12-03 18:46   ` sashiko-bot
  2026-12-03 17:44 ` [PATCH 2/2] drm/xe/ras: Use RAS config command for USP AER downgrade in passthrough Soham Purkait
  2026-12-03 18:10 ` ✗ CI.KUnit: failure for drm/xe/ras: Configure USP AER via system controller mailbox Patchwork
  2 siblings, 1 reply; 6+ messages in thread
From: Soham Purkait @ 2026-12-03 17:44 UTC (permalink / raw)
  To: intel-xe, riana.tauro, anshuman.gupta, aravind.iddamsetty,
	badal.nilawar, raag.jadav, rodrigo.vivi
  Cc: soham.purkait

From: Riana Tauro <riana.tauro@intel.com>

The driver downgrades the AER uncorrectable internal error severity of the
upstream switch port (USP) to non-fatal, so that errors can be handled
by the driver. This is done by writing the AER registers of the USP
directly, which is only allowed when the OS has native control of AER.

The OS does not have native control of AER when the platform uses firmware
first error handling or when native AER is disabled (pcie_ports=compat).
In these cases the driver cannot program the USP AER registers, so request
the firmware to downgrade the error instead.

The firmware provides a generic configuration command to get or set
firmware owned RAS configuration settings. Add support for this
configuration command and use it to request the firmware to downgrade the
severity when the OS does not have native control of AER.

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
 drivers/gpu/drm/xe/xe_ras.c                   | 65 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_ras_types.h             | 58 +++++++++++++++++
 drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h |  2 +
 3 files changed, 125 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
index 9415e4f45b80..a4bdd6f8125f 100644
--- a/drivers/gpu/drm/xe/xe_ras.c
+++ b/drivers/gpu/drm/xe/xe_ras.c
@@ -3,6 +3,7 @@
  * Copyright © 2026 Intel Corporation
  */
 
+#include <linux/aer.h>
 #include <linux/bitfield.h>
 
 #include <generated/xe_device_wa_oob.h>
@@ -496,17 +497,80 @@ static void get_offline_list(struct xe_device *xe)
 			      &response, sizeof(response), &response.common, false);
 }
 
+static inline const char *action_to_str(enum xe_ras_config_action action)
+{
+	return action == XE_RAS_CONFIG_ACTION_GET ? "get" : "set";
+}
+
+static int ras_config(struct xe_device *xe, enum xe_ras_config config,
+		      enum xe_ras_config_action action)
+{
+	struct xe_sysctrl_mailbox_command command = {0};
+	struct xe_ras_config_response response = {0};
+	struct xe_ras_config_request request = {0};
+	size_t len;
+	int ret;
+
+	request.config = config;
+	request.action = action;
+
+	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_RAS_CONFIG,
+				  &request, sizeof(request), &response, sizeof(response));
+
+	guard(xe_pm_runtime)(xe);
+	ret = xe_sysctrl_send_command(&xe->sc, &command, &len);
+	if (ret) {
+		xe_err(xe, "sysctrl: failed to %s config %u: %d\n", action_to_str(action), config,
+		       ret);
+		return ret;
+	}
+
+	if (len != sizeof(response)) {
+		xe_err(xe, "sysctrl: unexpected %s config response length %zu (expected %zu)\n",
+		       action_to_str(action), len, sizeof(response));
+		return -EIO;
+	}
+
+	ret = ras_status_to_errno(response.status);
+	if (ret) {
+		xe_err(xe, "sysctrl: %s config command failed with status %#x\n",
+		       action_to_str(action), response.status);
+		return ret;
+	}
+
+	if (response.size)
+		xe_dbg(xe, "[RAS]: %s config %u, data (%u bytes): %*ph\n",
+		       action_to_str(response.action), response.config, response.size,
+		       (int)min(response.size, sizeof(response.data)), response.data);
+
+	return 0;
+}
+
 static void ras_usp_aer_init(struct xe_device *xe)
 {
 	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
+	enum xe_ras_config config;
 	struct pci_dev *usp;
 	u16 aer_cap;
 	u32 status;
+	int ret;
 
 	usp = xe_pci_get_usp_dev(pdev);
 	if (!usp)
 		return;
 
+	if (!pcie_aer_is_native(usp)) {
+		config = XE_RAS_CONFIG_USP_AER_UNCOR_INTERNAL_NONFATAL;
+
+		ret = ras_config(xe, config, XE_RAS_CONFIG_ACTION_SET);
+		if (ret)
+			return;
+
+		/* Read the configuration */
+		ras_config(xe, config, XE_RAS_CONFIG_ACTION_GET);
+		return;
+	}
+
 	aer_cap = pci_find_ext_capability(usp, PCI_EXT_CAP_ID_ERR);
 	if (!aer_cap) {
 		dev_warn(&usp->dev, "AER capability unavailable\n");
@@ -541,6 +605,7 @@ static void ras_usp_aer_init(struct xe_device *xe)
 	pci_save_state(usp);
 	dev_dbg(&usp->dev, "Uncorrectable Internal Errors downgraded and unmasked\n");
 }
+MODULE_IMPORT_NS("CXL");
 
 static void ras_send_error_event(struct xe_device *xe, u8 severity, u8 component)
 {
diff --git a/drivers/gpu/drm/xe/xe_ras_types.h b/drivers/gpu/drm/xe/xe_ras_types.h
index 02d5a15f8c16..d8bd6592e19a 100644
--- a/drivers/gpu/drm/xe/xe_ras_types.h
+++ b/drivers/gpu/drm/xe/xe_ras_types.h
@@ -60,6 +60,30 @@ enum xe_ras_recovery_action {
 	XE_RAS_RECOVERY_ACTION_MAX
 };
 
+/**
+ * enum xe_ras_config_action - Action requested for a config
+ *
+ * @XE_RAS_CONFIG_ACTION_GET: Get the current state of the config
+ * @XE_RAS_CONFIG_ACTION_SET: Set the config
+ * @XE_RAS_CONFIG_ACTION_MAX: Max action value
+ */
+enum xe_ras_config_action {
+	XE_RAS_CONFIG_ACTION_GET = 0,
+	XE_RAS_CONFIG_ACTION_SET,
+	XE_RAS_CONFIG_ACTION_MAX
+};
+
+/**
+ * enum xe_ras_config - RAS configuration options
+ *
+ * @XE_RAS_CONFIG_USP_AER_UNCOR_INTERNAL_NONFATAL: Downgrade USP AER Uncorrectable Internal Error
+ * @XE_RAS_CONFIG_MAX: Max config value
+ */
+enum xe_ras_config {
+	XE_RAS_CONFIG_USP_AER_UNCOR_INTERNAL_NONFATAL = 0x01,
+	XE_RAS_CONFIG_MAX
+};
+
 /**
  * struct xe_ras_error_common - Error fields that are common across all products
  */
@@ -526,6 +550,40 @@ struct xe_ras_set_health_response {
 	u32 reserved1[2];
 } __packed;
 
+/**
+ * struct xe_ras_config_request - Request structure for RAS configuration
+ */
+struct xe_ras_config_request {
+	/** @config: Config id, see &enum xe_ras_config */
+	u16 config;
+	/** @action: Action to perform, see &enum xe_ras_config_action */
+	u8 action;
+	/** @reserved: Reserved for future use */
+	u8 reserved;
+	/** @size: Bytes valid in the payload */
+	u32 size;
+	/** @data: Payload */
+	u32 data[16];
+} __packed;
+
+/**
+ * struct xe_ras_config_response - Response structure for RAS configuration
+ */
+struct xe_ras_config_response {
+	/** @status: Status of config operation */
+	u32 status;
+	/** @config: Config id from request, see &enum xe_ras_config */
+	u16 config;
+	/** @action: Action that was performed, see &enum xe_ras_config_action */
+	u8 action;
+	/** @reserved: Reserved for future use */
+	u8 reserved;
+	/** @size: Bytes valid in the payload */
+	u32 size;
+	/** @data: Payload */
+	u32 data[16];
+} __packed;
+
 /* Device structures */
 
 /**
diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
index 50b1d9abaf1f..cf75c21fffa1 100644
--- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
+++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
@@ -38,6 +38,7 @@ enum xe_sysctrl_group {
  * @XE_SYSCTRL_CMD_GET_HEALTH: Retrieve gpu health
  * @XE_SYSCTRL_CMD_SET_HEALTH: Set gpu health
  * @XE_SYSCTRL_CMD_GET_INFO_QUEUE: Retrieve a chunk of info queue data
+ * @XE_SYSCTRL_CMD_RAS_CONFIG: Get or set FW RAS configuration
  */
 enum xe_sysctrl_gfsp_cmd {
 	XE_SYSCTRL_CMD_GET_SOC_ERROR		= 0x01,
@@ -52,6 +53,7 @@ enum xe_sysctrl_gfsp_cmd {
 	XE_SYSCTRL_CMD_GET_HEALTH		= 0x0B,
 	XE_SYSCTRL_CMD_SET_HEALTH		= 0x0C,
 	XE_SYSCTRL_CMD_GET_INFO_QUEUE		= 0x0D,
+	XE_SYSCTRL_CMD_RAS_CONFIG		= 0x0E,
 };
 
 /**
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] drm/xe/ras: Use RAS config command for USP AER downgrade in passthrough
  2026-12-03 17:44 [PATCH 0/2] drm/xe/ras: Configure USP AER via system controller mailbox Soham Purkait
  2026-12-03 17:44 ` [PATCH 1/2] drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error Soham Purkait
@ 2026-12-03 17:44 ` Soham Purkait
  2026-12-03 19:06   ` sashiko-bot
  2026-12-03 18:10 ` ✗ CI.KUnit: failure for drm/xe/ras: Configure USP AER via system controller mailbox Patchwork
  2 siblings, 1 reply; 6+ messages in thread
From: Soham Purkait @ 2026-12-03 17:44 UTC (permalink / raw)
  To: intel-xe, riana.tauro, anshuman.gupta, aravind.iddamsetty,
	badal.nilawar, raag.jadav, rodrigo.vivi
  Cc: soham.purkait

When the device is used in passthrough, the USP is not accessible, so
the Uncorrectable Internal Error cannot be downgraded to non-fatal by
programming the AER registers directly.

Detect the passthrough case and request the downgrade from the system
controller, as already done for the non-native AER case.

Signed-off-by: Soham Purkait <soham.purkait@intel.com>
---
 drivers/gpu/drm/xe/xe_ras.c | 50 +++++++++++++++++++++++++++----------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
index a4bdd6f8125f..974c780a67bf 100644
--- a/drivers/gpu/drm/xe/xe_ras.c
+++ b/drivers/gpu/drm/xe/xe_ras.c
@@ -6,6 +6,10 @@
 #include <linux/aer.h>
 #include <linux/bitfield.h>
 
+#if IS_ENABLED(CONFIG_X86)
+#include <asm/hypervisor.h>
+#endif
+
 #include <generated/xe_device_wa_oob.h>
 
 #include "xe_assert.h"
@@ -539,35 +543,55 @@ static int ras_config(struct xe_device *xe, enum xe_ras_config config,
 	}
 
 	if (response.size)
-		xe_dbg(xe, "[RAS]: %s config %u, data (%u bytes): %*ph\n",
-		       action_to_str(response.action), response.config, response.size,
-		       (int)min(response.size, sizeof(response.data)), response.data);
+		xe_debug(xe, "[RAS]: %s config %u, data (%u bytes): %*ph\n",
+			 action_to_str(response.action), response.config, response.size,
+			 (int)min(response.size, sizeof(response.data)), response.data);
 
 	return 0;
 }
 
+static bool xe_run_as_guest(void)
+{
+#if IS_ENABLED(CONFIG_X86)
+	return !hypervisor_is_type(X86_HYPER_NATIVE);
+#else
+	return false;
+#endif
+}
+
+static void ras_usp_aer_config_mailbox(struct xe_device *xe)
+{
+	enum xe_ras_config config = XE_RAS_CONFIG_USP_AER_UNCOR_INTERNAL_NONFATAL;
+	int ret;
+
+	ret = ras_config(xe, config, XE_RAS_CONFIG_ACTION_SET);
+	if (ret)
+		return;
+
+	/* Read the configuration */
+	ras_config(xe, config, XE_RAS_CONFIG_ACTION_GET);
+}
+
 static void ras_usp_aer_init(struct xe_device *xe)
 {
 	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
-	enum xe_ras_config config;
 	struct pci_dev *usp;
 	u16 aer_cap;
 	u32 status;
-	int ret;
+
+	if (xe_run_as_guest()) {
+		xe_info(xe, "[RAS]: running as guest, using sysctrl mailbox\n");
+		ras_usp_aer_config_mailbox(xe);
+		return;
+	}
 
 	usp = xe_pci_get_usp_dev(pdev);
 	if (!usp)
 		return;
 
 	if (!pcie_aer_is_native(usp)) {
-		config = XE_RAS_CONFIG_USP_AER_UNCOR_INTERNAL_NONFATAL;
-
-		ret = ras_config(xe, config, XE_RAS_CONFIG_ACTION_SET);
-		if (ret)
-			return;
-
-		/* Read the configuration */
-		ras_config(xe, config, XE_RAS_CONFIG_ACTION_GET);
+		xe_info(xe, "[RAS]: USP AER is non-native, using sysctrl mailbox\n");
+		ras_usp_aer_config_mailbox(xe);
 		return;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* ✗ CI.KUnit: failure for drm/xe/ras: Configure USP AER via system controller mailbox
  2026-12-03 17:44 [PATCH 0/2] drm/xe/ras: Configure USP AER via system controller mailbox Soham Purkait
  2026-12-03 17:44 ` [PATCH 1/2] drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error Soham Purkait
  2026-12-03 17:44 ` [PATCH 2/2] drm/xe/ras: Use RAS config command for USP AER downgrade in passthrough Soham Purkait
@ 2026-12-03 18:10 ` Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2026-12-03 18:10 UTC (permalink / raw)
  To: Soham Purkait; +Cc: intel-xe

== Series Details ==

Series: drm/xe/ras: Configure USP AER via system controller mailbox
URL   : https://patchwork.freedesktop.org/series/180455/
State : failure

== Summary ==

+ trap cleanup EXIT
+ kunitconfigs=('/kernel/drivers/gpu/tests/.kunitconfig' '/kernel/drivers/gpu/drm/xe/.kunitconfig' '/kernel/drivers/gpu/drm/tests/.kunitconfig' '/kernel/drivers/gpu/drm/ttm/tests/.kunitconfig' '/kernel/drivers/dma-buf/.kunitconfig')
+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/tests/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/tests/.kunitconfig
[18:09:27] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[18:09:32] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
[18:09:53] Starting KUnit Kernel (1/1)...
[18:09:53] ============================================================
Running tests with:
$ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[18:09:53] ================= gpu_buddy (15 subtests) ==================
[18:09:53] [PASSED] gpu_test_buddy_alloc_limit
[18:09:53] [PASSED] gpu_test_buddy_alloc_optimistic
[18:09:53] [PASSED] gpu_test_buddy_alloc_pessimistic
[18:09:53] [PASSED] gpu_test_buddy_alloc_pathological
[18:09:53] [PASSED] gpu_test_buddy_alloc_contiguous
[18:09:53] [PASSED] gpu_test_buddy_alloc_clear
[18:09:53] [PASSED] gpu_test_buddy_alloc_range
[18:09:53] [PASSED] gpu_test_buddy_alloc_range_bias
[18:09:53] [PASSED] gpu_test_buddy_alloc_range_clear_guard
[18:09:54] [PASSED] gpu_test_buddy_fragmentation_performance
[18:09:55] [PASSED] gpu_test_buddy_dirty_tracker_performance
[18:09:55] [PASSED] gpu_test_buddy_alloc_exceeds_max_order
[18:09:55] [PASSED] gpu_test_buddy_offset_aligned_allocation
[18:09:55] [PASSED] gpu_test_buddy_subtree_offset_alignment_stress
[18:09:55] [PASSED] gpu_test_buddy_addr_to_block
[18:09:55] ==================== [PASSED] gpu_buddy ====================
[18:09:55] ============================================================
[18:09:55] Testing complete. Ran 15 tests: passed: 15
[18:09:55] Elapsed time: 28.047s total, 5.193s configuring, 20.786s building, 1.995s running

+ for kcfg in "${kunitconfigs[@]}"
+ [[ ! -f /kernel/drivers/gpu/drm/xe/.kunitconfig ]]
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
ERROR:root:../drivers/gpu/drm/xe/xe_ras.c: In function ‘ras_config’:
../drivers/gpu/drm/xe/xe_ras.c:546:17: error: implicit declaration of function ‘xe_debug’; did you mean ‘pr_debug’? [-Werror=implicit-function-declaration]
  546 |                 xe_debug(xe, "[RAS]: %s config %u, data (%u bytes): %*ph\n",
      |                 ^~~~~~~~
      |                 pr_debug
cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:290: drivers/gpu/drm/xe/xe_ras.o] Error 1
make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:572: drivers/gpu/drm/xe] Error 2
make[5]: *** [../scripts/Makefile.build:572: drivers/gpu/drm] Error 2
make[4]: *** [../scripts/Makefile.build:572: drivers/gpu] Error 2
make[3]: *** [../scripts/Makefile.build:572: drivers] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/kernel/Makefile:2244: .] Error 2
make[1]: *** [/kernel/Makefile:248: __sub-make] Error 2
make: *** [Makefile:248: __sub-make] Error 2

[18:09:55] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[18:09:58] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error
  2026-12-03 17:44 ` [PATCH 1/2] drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error Soham Purkait
@ 2026-12-03 18:46   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-03 18:46 UTC (permalink / raw)
  To: Soham Purkait, intel-xe

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/xe/ras: xe_ras_init() gates ras_usp_aer_init() on
  CONFIG_PCIEAER
- [Low] drm/xe/ras: xe_ras.c imports CXL symbol namespace for
  pcie_aer_is_native()
- [Low] drm/xe/ras: ras_usp_aer_init() checks pcie_aer_is_native()
  before aer_cap
--

commit 9d71dea00aef6410038d1540e828b794fda350ca
Author: Riana Tauro <riana.tauro@intel.com>

drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error

This commit adds support for the firmware RAS configuration mailbox command
and uses it in ras_usp_aer_init() to downgrade the USP AER uncorrectable
internal error severity when the OS does not have native AER control.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 9b04be3405ca7..d2141a2fc8262 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c

[ ... ]

>  static void ras_usp_aer_init(struct xe_device *xe)
>  {
>  	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> +	enum xe_ras_config config;
>  	struct pci_dev *usp;
>  	u16 aer_cap;
>  	u32 status;
> +	int ret;
>  
>  	usp = xe_pci_get_usp_dev(pdev);
>  	if (!usp)
>  		return;
>  
> +	if (!pcie_aer_is_native(usp)) {
> +		config = XE_RAS_CONFIG_USP_AER_UNCOR_INTERNAL_NONFATAL;
> +
> +		ret = ras_config(xe, config, XE_RAS_CONFIG_ACTION_SET);
> +		if (ret)
> +			return;
> +
> +		/* Read the configuration */
> +		ras_config(xe, config, XE_RAS_CONFIG_ACTION_GET);
> +		return;
> +	}

[Severity: Medium]
Should xe_ras_init() drop the IS_ENABLED(CONFIG_PCIEAER) guard around
ras_usp_aer_init()?

xe_ras_init() still skips ras_usp_aer_init() when CONFIG_PCIEAER is disabled,
even though pcie_aer_is_native() provides a stub returning 0 in that
configuration and the firmware fallback does not need native AER.  On a
CONFIG_PCIEAER=n kernel, the USP uncorrectable internal error stays fatal, so
a hardware error can trigger firmware-first fatal escalation via GHES and
panic the kernel in __ghes_panic().

>  	aer_cap = pci_find_ext_capability(usp, PCI_EXT_CAP_ID_ERR);
>  	if (!aer_cap) {
>  		dev_warn(&usp->dev, "AER capability unavailable\n");
>  		return;
>  	}

[Severity: Low]
Can checking pcie_aer_is_native(usp) before aer_cap hide a missing AER
capability?

pcie_aer_is_native() returns 0 whenever usp->aer_cap is 0, regardless of
host->native_aer.  With the current order, a USP without an AER capability
takes the !pcie_aer_is_native() branch and sends XE_SYSCTRL_CMD_RAS_CONFIG
commands to firmware instead of warning, while the if (!aer_cap) guard below
is unreachable whenever pcie_aer_is_native(usp) succeeds.

[ ... ]

> @@ -535,6 +599,7 @@ static void ras_usp_aer_init(struct xe_device *xe)
>  	pci_save_state(usp);
>  	dev_dbg(&usp->dev, "Uncorrectable Internal Errors downgraded and unmasked\n");
>  }
> +MODULE_IMPORT_NS("CXL");

[Severity: Low]
Is importing the CXL namespace into xe the right way to call
pcie_aer_is_native()?

pcie_aer_is_native() is exported in the CXL namespace, and every other
importer of that namespace is a CXL driver or test.  Importing it here
couples xe to a CXL-private export boundary that PCI maintainers have already
tightened on adjacent helpers such as pci_aer_unmask_internal_errors(), and
the import is not mentioned in the commit message.  If xe needs
pcie_aer_is_native(), it would be cleaner to promote the export to
EXPORT_SYMBOL_GPL() first with PCI maintainer agreement.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203174452.1398280-4-soham.purkait@intel.com?part=1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/xe/ras: Use RAS config command for USP AER downgrade in passthrough
  2026-12-03 17:44 ` [PATCH 2/2] drm/xe/ras: Use RAS config command for USP AER downgrade in passthrough Soham Purkait
@ 2026-12-03 19:06   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-03 19:06 UTC (permalink / raw)
  To: Soham Purkait, intel-xe

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] drm/xe/ras: undefined xe_debug() call in ras_config() breaks
  compilation
- [Medium] drm/xe/ras: CONFIG_PCIEAER guard skips sysctrl mailbox USP
  AER downgrade
- [Medium] drm/xe/ras: xe_run_as_guest() misses non-x86 and hidden x86
  guests
--

commit b3d3f6b24b0c7ca07f4fe595f8fab5a93f21a954
Author: Soham Purkait <soham.purkait@intel.com>

drm/xe/ras: Use RAS config command for USP AER downgrade in passthrough

This commit detects guest execution in ras_usp_aer_init() and routes the
Upstream Switch Port (USP) AER Uncorrectable Internal Error downgrade
through the system controller mailbox instead of programming USP AER
registers directly.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index d2141a2fc8262..cc6ff7bd002ba 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c

[ ... ]

> @@ -533,35 +537,55 @@ static int ras_config(struct xe_device *xe, enum xe_ras_config config,
>  	}
>  
>  	if (response.size)
> -		xe_dbg(xe, "[RAS]: %s config %u, data (%u bytes): %*ph\n",
> -		       action_to_str(response.action), response.config, response.size,
> -		       (int)min(response.size, sizeof(response.data)), response.data);
> +		xe_debug(xe, "[RAS]: %s config %u, data (%u bytes): %*ph\n",
> +			 action_to_str(response.action), response.config, response.size,
> +			 (int)min(response.size, sizeof(response.data)), response.data);
>  
>  	return 0;
>  }

[Severity: High]
Does xe_debug() exist?  drivers/gpu/drm/xe/xe_printk.h only defines
xe_dbg() and xe_dbg_ratelimited(), so this breaks compilation whenever
CONFIG_DRM_XE is enabled.

>  
> +static bool xe_run_as_guest(void)
> +{
> +#if IS_ENABLED(CONFIG_X86)
> +	return !hypervisor_is_type(X86_HYPER_NATIVE);
> +#else
> +	return false;
> +#endif
> +}

[Severity: Medium]
Can xe_run_as_guest() miss passthrough guests on non-x86 architectures or
on x86 when CONFIG_HYPERVISOR_GUEST is disabled or hypervisor CPUID is
hidden?

When it returns false in passthrough, xe_pci_get_usp_dev() returns NULL
behind a virtual root bus or single root port, leaving the physical USP
error fatal and able to trigger a Secondary Bus Reset.  Behind two
virtual bridges, AER writes hit an emulated bridge instead.

Conversely, on x86 Xen Dom0, !hypervisor_is_type(X86_HYPER_NATIVE)
evaluates to true and misclassifies the host as a guest.

[ ... ]

>  static void ras_usp_aer_init(struct xe_device *xe)
>  {
>  	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> -	enum xe_ras_config config;
>  	struct pci_dev *usp;
>  	u16 aer_cap;
>  	u32 status;
> -	int ret;
> +
> +	if (xe_run_as_guest()) {
> +		xe_info(xe, "[RAS]: running as guest, using sysctrl mailbox\n");
> +		ras_usp_aer_config_mailbox(xe);
> +		return;
> +	}

[Severity: Medium]
Will xe_ras_init() skip this sysctrl mailbox path when CONFIG_PCIEAER is
disabled?

xe_ras_init() only calls ras_usp_aer_init() when
IS_ENABLED(CONFIG_PCIEAER) is true, even though CONFIG_DRM_XE does not
select CONFIG_PCIEAER and guest kernels often omit it.  When disabled,
the downgrade is never sent and the physical USP error stays fatal.

Since include/linux/aer.h stubs pcie_aer_is_native() to return 0 when
CONFIG_PCIEAER is disabled, dropping the IS_ENABLED(CONFIG_PCIEAER)
guard in xe_ras_init() lets both passthrough guests and non-native hosts
use the sysctrl mailbox.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203174452.1398280-4-soham.purkait@intel.com?part=2

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-03 19:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 17:44 [PATCH 0/2] drm/xe/ras: Configure USP AER via system controller mailbox Soham Purkait
2026-12-03 17:44 ` [PATCH 1/2] drm/xe/ras: Add RAS config command to downgrade AER uncorrectable internal error Soham Purkait
2026-12-03 18:46   ` sashiko-bot
2026-12-03 17:44 ` [PATCH 2/2] drm/xe/ras: Use RAS config command for USP AER downgrade in passthrough Soham Purkait
2026-12-03 19:06   ` sashiko-bot
2026-12-03 18:10 ` ✗ CI.KUnit: failure for drm/xe/ras: Configure USP AER via system controller mailbox Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox