* [PATCH v2 0/5] Process AMC alert
@ 2026-12-01 9:11 Badal Nilawar
2026-12-01 9:11 ` [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert Badal Nilawar
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Badal Nilawar @ 2026-12-01 9:11 UTC (permalink / raw)
To: intel-xe
Cc: anshuman.gupta, rodrigo.vivi, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
This series exposes appropriate recovery mechanism for AMC alert.
Also creates the sysfs to expose AMC alert.
Sysfs patch has fixes for review comments from https://patchwork.freedesktop.org/series/175359/
v2:
- Fix Sashiko warnings
- Fix review comments
Badal Nilawar (5):
drm/xe: Request cold-reset recovery on AMC thermal trip alert
drm/xe: Request cold-reset recovery on AMC OOB request alert
drm/xe: Request cold-reset recovery on AMC CATERR alert
drm/xe/i2c: Expose AMC alert reason through sysfs
drm/xe: Request vendor recovery for AMC firmware download alert
.../ABI/testing/sysfs-driver-intel-xe-amc | 24 ++++
drivers/gpu/drm/xe/xe_amc.c | 103 +++++++++++++++---
drivers/gpu/drm/xe/xe_wedge.c | 19 ++++
3 files changed, 132 insertions(+), 14 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-xe-amc
--
2.56.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert
2026-12-01 9:11 [PATCH v2 0/5] Process AMC alert Badal Nilawar
@ 2026-12-01 9:11 ` Badal Nilawar
2026-12-01 10:58 ` Gupta, Anshuman
2026-12-01 11:12 ` Raag Jadav
2026-12-01 9:11 ` [PATCH v2 2/5] drm/xe: Request cold-reset recovery on AMC OOB request alert Badal Nilawar
` (3 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Badal Nilawar @ 2026-12-01 9:11 UTC (permalink / raw)
To: intel-xe
Cc: anshuman.gupta, rodrigo.vivi, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
AMC powers down the SoC after reporting a thermal trip. Notify userspace
through a uevent to attempt cold-reset recovery after the SoC cools down.
v2: Use DRM style logging (Anshuman)
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
drivers/gpu/drm/xe/xe_amc.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
index 37694e34271a..a673d56ad673 100644
--- a/drivers/gpu/drm/xe/xe_amc.c
+++ b/drivers/gpu/drm/xe/xe_amc.c
@@ -4,7 +4,6 @@
*/
#include <linux/delay.h>
-#include <linux/dev_printk.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/pci_ids.h>
@@ -12,6 +11,8 @@
#include <linux/string.h>
#include <linux/workqueue.h>
+#include <drm/drm_print.h>
+
#include "regs/xe_i2c_regs.h"
#include "xe_amc.h"
@@ -115,6 +116,8 @@ static void xe_amc_work(struct work_struct *work)
u8 alert_reason = AMC_ALERT_UNKNOWN;
struct amc_response response;
struct i2c_client *client;
+ const char *alert_str;
+ unsigned long recovery = 0;
int ret;
xe_pm_runtime_get(xe);
@@ -125,7 +128,7 @@ static void xe_amc_work(struct work_struct *work)
ret = i2c_master_send(client, (u8 *)request, sizeof(*request));
if (ret < 0) {
- dev_err(&client->dev, "failed to send request (%d)\n", ret);
+ drm_err(&xe->drm, "failed to send request (%d)\n", ret);
goto out_reassert_interrupt;
}
@@ -134,46 +137,52 @@ static void xe_amc_work(struct work_struct *work)
ret = i2c_master_recv(client, (u8 *)&response, sizeof(response));
if (ret < 0) {
- dev_err(&client->dev, "failed to read response (%d)\n", ret);
+ drm_err(&xe->drm, "failed to read response (%d)\n", ret);
goto out_reassert_interrupt;
}
if (!response.header.len) {
- dev_err(&client->dev, "empty response from AMC\n");
+ drm_err(&xe->drm, "empty response from AMC\n");
goto out_reassert_interrupt;
}
if (memcmp(&response.message, &request->message, sizeof(struct amc_message))) {
- dev_err(&client->dev, "response does not match the request\n");
+ drm_err(&xe->drm, "response does not match the request\n");
goto out_reassert_interrupt;
}
if (response.error) {
- dev_err(&client->dev, "AMC error 0x%02x\n", response.error);
+ drm_err(&xe->drm, "AMC error 0x%02x\n", response.error);
goto out_reassert_interrupt;
}
alert_reason = response.value;
- dev_dbg(&client->dev, "Alert reason: %d\n", alert_reason);
+ drm_dbg(&xe->drm, "Alert reason: %d\n", alert_reason);
out_reassert_interrupt:
xe_mmio_rmw32(amc->i2c->mmio, I2C_CONFIG_CMD, PCI_COMMAND_INTX_DISABLE, 0);
switch (alert_reason) {
case AMC_ALERT_FW_DOWNLOAD:
- case AMC_ALERT_THERMAL_TRIP:
case AMC_ALERT_OOB_REQUEST:
case AMC_ALERT_OOB_RESET:
case AMC_ALERT_CATERR:
- dev_warn(amc->i2c->drm_dev, "AMC Alert: %s\n", amc_alert[alert_reason]);
- xe_wedge_declare(i2c_client_to_xe_device(client),
- DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET);
+ alert_str = amc_alert[alert_reason];
+ recovery = DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET;
+ break;
+ case AMC_ALERT_THERMAL_TRIP:
+ alert_str = amc_alert[alert_reason];
+ recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
break;
default:
- dev_warn(amc->i2c->drm_dev, "unknown AMC alert: %d\n", alert_reason);
+ alert_str = "unknown";
break;
}
+ drm_warn(&xe->drm, "AMC Alert: %s (%u)\n", alert_str, alert_reason);
+ if (recovery)
+ xe_wedge_declare(xe, recovery);
+
xe_pm_runtime_put(xe);
}
--
2.56.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/5] drm/xe: Request cold-reset recovery on AMC OOB request alert
2026-12-01 9:11 [PATCH v2 0/5] Process AMC alert Badal Nilawar
2026-12-01 9:11 ` [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert Badal Nilawar
@ 2026-12-01 9:11 ` Badal Nilawar
2026-12-01 11:03 ` Gupta, Anshuman
2026-12-01 9:11 ` [PATCH v2 3/5] drm/xe: Request cold-reset recovery on AMC CATERR alert Badal Nilawar
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Badal Nilawar @ 2026-12-01 9:11 UTC (permalink / raw)
To: intel-xe
Cc: anshuman.gupta, rodrigo.vivi, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
AMC sends an OOB power-down request alert to KMD before powering down the
SoC. Notify userspace through a uevent to request cold-reset recovery.
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
drivers/gpu/drm/xe/xe_amc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
index a673d56ad673..2b53c5ff0d2b 100644
--- a/drivers/gpu/drm/xe/xe_amc.c
+++ b/drivers/gpu/drm/xe/xe_amc.c
@@ -164,12 +164,12 @@ static void xe_amc_work(struct work_struct *work)
switch (alert_reason) {
case AMC_ALERT_FW_DOWNLOAD:
- case AMC_ALERT_OOB_REQUEST:
case AMC_ALERT_OOB_RESET:
case AMC_ALERT_CATERR:
alert_str = amc_alert[alert_reason];
recovery = DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET;
break;
+ case AMC_ALERT_OOB_REQUEST:
case AMC_ALERT_THERMAL_TRIP:
alert_str = amc_alert[alert_reason];
recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
--
2.56.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 3/5] drm/xe: Request cold-reset recovery on AMC CATERR alert
2026-12-01 9:11 [PATCH v2 0/5] Process AMC alert Badal Nilawar
2026-12-01 9:11 ` [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert Badal Nilawar
2026-12-01 9:11 ` [PATCH v2 2/5] drm/xe: Request cold-reset recovery on AMC OOB request alert Badal Nilawar
@ 2026-12-01 9:11 ` Badal Nilawar
2026-12-01 11:04 ` Gupta, Anshuman
2026-12-01 9:11 ` [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs Badal Nilawar
2026-12-01 9:11 ` [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert Badal Nilawar
4 siblings, 1 reply; 14+ messages in thread
From: Badal Nilawar @ 2026-12-01 9:11 UTC (permalink / raw)
To: intel-xe
Cc: anshuman.gupta, rodrigo.vivi, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
AMC reports a CATERR when the device encounters a catastrophic error
requiring cold-reset recovery. Notify userspace through a uevent with
the requested recovery action so that it can perform the cold reset and
recover the device.
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
v2:
- Expand commit message (Anshuman)
---
drivers/gpu/drm/xe/xe_amc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
index 2b53c5ff0d2b..613f5434d7d8 100644
--- a/drivers/gpu/drm/xe/xe_amc.c
+++ b/drivers/gpu/drm/xe/xe_amc.c
@@ -165,10 +165,10 @@ static void xe_amc_work(struct work_struct *work)
switch (alert_reason) {
case AMC_ALERT_FW_DOWNLOAD:
case AMC_ALERT_OOB_RESET:
- case AMC_ALERT_CATERR:
alert_str = amc_alert[alert_reason];
recovery = DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET;
break;
+ case AMC_ALERT_CATERR:
case AMC_ALERT_OOB_REQUEST:
case AMC_ALERT_THERMAL_TRIP:
alert_str = amc_alert[alert_reason];
--
2.56.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs
2026-12-01 9:11 [PATCH v2 0/5] Process AMC alert Badal Nilawar
` (2 preceding siblings ...)
2026-12-01 9:11 ` [PATCH v2 3/5] drm/xe: Request cold-reset recovery on AMC CATERR alert Badal Nilawar
@ 2026-12-01 9:11 ` Badal Nilawar
2026-12-01 15:54 ` Gupta, Anshuman
2026-12-01 21:10 ` Rodrigo Vivi
2026-12-01 9:11 ` [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert Badal Nilawar
4 siblings, 2 replies; 14+ messages in thread
From: Badal Nilawar @ 2026-12-01 9:11 UTC (permalink / raw)
To: intel-xe
Cc: anshuman.gupta, rodrigo.vivi, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
AMC raises an SMBus alert before a power-removal or power-cycle
operation. The xe driver uses the alert reason to select a recovery
method.
Expose the reason in a read-only sysfs attribute so userspace can
identify the appropriate recovery action.
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
v2:
- Correct the documented sysfs attribute name (Sashiko)
- Ensure the alert reason is visible before publishing the
alert-seen state (Sashiko)
---
.../ABI/testing/sysfs-driver-intel-xe-amc | 24 +++++++
drivers/gpu/drm/xe/xe_amc.c | 67 ++++++++++++++++++-
2 files changed, 89 insertions(+), 2 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-xe-amc
diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-amc b/Documentation/ABI/testing/sysfs-driver-intel-xe-amc
new file mode 100644
index 000000000000..385b6519a1ca
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-amc
@@ -0,0 +1,24 @@
+What: /sys/bus/pci/drivers/xe/.../amc_alert_reason
+Date: November 2026
+KernelVersion: 7.5
+Contact: intel-xe@lists.freedesktop.org
+Description:
+ This file exposes the reason for the most recent Add-In
+ Management Controller (AMC) alert on supported Intel Xe platforms.
+
+ An AMC alert is delivered via an SMBus interrupt. The device may
+ be wedged; the required recovery method depends on the alert.
+ The attribute is read-only and available to all users.
+
+ Read returns a single line containing one of the following
+ alert reasons:
+
+ "none"
+ No AMC alert has been received
+ "unknown"
+ AMC alert received but with unknown reason
+ "Firmware Download"
+ "Thermal Trip"
+ "OOB Request"
+ "OOB Reset"
+ "Catastrophic"
diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
index 613f5434d7d8..f23abee5eb5c 100644
--- a/drivers/gpu/drm/xe/xe_amc.c
+++ b/drivers/gpu/drm/xe/xe_amc.c
@@ -50,6 +50,7 @@ enum xe_amc_alert {
};
static const char * const amc_alert[] = {
+ [AMC_ALERT_UNKNOWN] = "unknown",
[AMC_ALERT_FW_DOWNLOAD] = "Firmware Download",
[AMC_ALERT_THERMAL_TRIP] = "Thermal Trip",
[AMC_ALERT_OOB_REQUEST] = "OOB Request",
@@ -60,6 +61,8 @@ static const char * const amc_alert[] = {
struct xe_amc {
struct xe_i2c *i2c;
struct work_struct work;
+ enum xe_amc_alert alert_reason;
+ bool alert_seen;
};
struct amc_header {
@@ -108,6 +111,51 @@ static const struct amc_request amc_get_alert_reason = {
},
};
+/**
+ * DOC: AMC Alert Reason
+ *
+ * Expose the most recent AMC alert reason through device sysfs.
+ *
+ * See Documentation/ABI/testing/sysfs-driver-intel-xe-amc for the ABI
+ * specification.
+ */
+
+static enum xe_amc_alert amc_alert_reason(struct xe_amc *amc)
+{
+ return READ_ONCE(amc->alert_reason);
+}
+
+static ssize_t amc_alert_reason_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct xe_device *xe = pdev_to_xe_device(to_pci_dev(dev));
+ struct xe_amc *amc = xe->i2c->amc;
+ enum xe_amc_alert alert_reason;
+
+ /* Pairs with smp_store_release() to make alert_reason visible. */
+ if (!smp_load_acquire(&amc->alert_seen))
+ return sysfs_emit(buf, "none\n");
+
+ alert_reason = amc_alert_reason(amc);
+
+ return sysfs_emit(buf, "%s\n", amc_alert[alert_reason]);
+}
+static DEVICE_ATTR_RO(amc_alert_reason);
+
+static void amc_remove_alert_sysfs(struct xe_i2c *i2c)
+{
+ struct device *dev = i2c->drm_dev;
+
+ device_remove_file(dev, &dev_attr_amc_alert_reason);
+}
+
+static int amc_create_alert_sysfs(struct xe_i2c *i2c)
+{
+ struct device *dev = i2c->drm_dev;
+
+ return device_create_file(dev, &dev_attr_amc_alert_reason);
+}
+
static void xe_amc_work(struct work_struct *work)
{
const struct amc_request *request = &amc_get_alert_reason;
@@ -162,6 +210,11 @@ static void xe_amc_work(struct work_struct *work)
out_reassert_interrupt:
xe_mmio_rmw32(amc->i2c->mmio, I2C_CONFIG_CMD, PCI_COMMAND_INTX_DISABLE, 0);
+ WRITE_ONCE(amc->alert_reason, alert_reason < ARRAY_SIZE(amc_alert) ?
+ alert_reason : AMC_ALERT_UNKNOWN);
+ /* Publish alert_reason to readers using smp_load_acquire(). */
+ smp_store_release(&amc->alert_seen, true);
+
switch (alert_reason) {
case AMC_ALERT_FW_DOWNLOAD:
case AMC_ALERT_OOB_RESET:
@@ -175,11 +228,12 @@ static void xe_amc_work(struct work_struct *work)
recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
break;
default:
- alert_str = "unknown";
+ alert_str = amc_alert[AMC_ALERT_UNKNOWN];
break;
}
drm_warn(&xe->drm, "AMC Alert: %s (%u)\n", alert_str, alert_reason);
+
if (recovery)
xe_wedge_declare(xe, recovery);
@@ -194,6 +248,7 @@ void xe_amc_handle_alert(struct xe_i2c *i2c)
int xe_amc_init(struct xe_i2c *i2c)
{
struct xe_amc *amc;
+ int ret;
amc = kzalloc_obj(*amc);
if (!amc)
@@ -203,13 +258,21 @@ int xe_amc_init(struct xe_i2c *i2c)
i2c->amc = amc;
amc->i2c = i2c;
- return 0;
+ ret = amc_create_alert_sysfs(i2c);
+ if (ret) {
+ kfree(i2c->amc);
+ i2c->amc = NULL;
+ }
+
+ return ret;
}
void xe_amc_exit(struct xe_i2c *i2c)
{
if (i2c->amc) {
+ amc_remove_alert_sysfs(i2c);
cancel_work_sync(&i2c->amc->work);
kfree(i2c->amc);
+ i2c->amc = NULL;
}
}
--
2.56.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert
2026-12-01 9:11 [PATCH v2 0/5] Process AMC alert Badal Nilawar
` (3 preceding siblings ...)
2026-12-01 9:11 ` [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs Badal Nilawar
@ 2026-12-01 9:11 ` Badal Nilawar
2026-12-01 16:24 ` Gupta, Anshuman
2026-12-01 21:10 ` Rodrigo Vivi
4 siblings, 2 replies; 14+ messages in thread
From: Badal Nilawar @ 2026-12-01 9:11 UTC (permalink / raw)
To: intel-xe
Cc: anshuman.gupta, rodrigo.vivi, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
AMC reports a firmware download alert when a device firmware update is
in progress. Request vendor-specific recovery so userspace can identify
the alert reason and perform the documented recovery.
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
v2:
- Rephrase recovery procedure (Rodrigo)
---
drivers/gpu/drm/xe/xe_amc.c | 3 +++
drivers/gpu/drm/xe/xe_wedge.c | 19 +++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
index f23abee5eb5c..e0ff01b1d0a5 100644
--- a/drivers/gpu/drm/xe/xe_amc.c
+++ b/drivers/gpu/drm/xe/xe_amc.c
@@ -217,6 +217,9 @@ static void xe_amc_work(struct work_struct *work)
switch (alert_reason) {
case AMC_ALERT_FW_DOWNLOAD:
+ alert_str = amc_alert[alert_reason];
+ recovery = DRM_WEDGE_RECOVERY_VENDOR;
+ break;
case AMC_ALERT_OOB_RESET:
alert_str = amc_alert[alert_reason];
recovery = DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET;
diff --git a/drivers/gpu/drm/xe/xe_wedge.c b/drivers/gpu/drm/xe/xe_wedge.c
index e48cca34d660..7d58ca3b2f4b 100644
--- a/drivers/gpu/drm/xe/xe_wedge.c
+++ b/drivers/gpu/drm/xe/xe_wedge.c
@@ -54,6 +54,25 @@
*
* - Admin/userspace consumer can use firmware flashing tools like fwupd to flash
* firmware and restore device to normal operation.
+ *
+ * Case: Firmware Download (AMC alert)
+ * -----------------------------------
+ *
+ * Identification Hint
+ * +++++++++++++++++++
+ *
+ * ``WEDGED=vendor-specific`` drm device wedged uevent with
+ * ``/sys/bus/pci/devices/<device>/amc_alert_reason`` reporting
+ * ``Firmware Download`` indicates that a firmware download is in progress.
+ *
+ * Recovery Procedure
+ * ++++++++++++++++++
+ *
+ * Once ``WEDGED=vendor-specific`` drm device wedged uevent is received, follow
+ * the below steps
+ *
+ * - Check the AMC alert reason sysfs. If it reports ``Firmware Download``,
+ * ensure device reset completes and re-enumerate the device.
*/
/**
--
2.56.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* RE: [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert
2026-12-01 9:11 ` [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert Badal Nilawar
@ 2026-12-01 10:58 ` Gupta, Anshuman
2026-12-01 11:12 ` Raag Jadav
1 sibling, 0 replies; 14+ messages in thread
From: Gupta, Anshuman @ 2026-12-01 10:58 UTC (permalink / raw)
To: Nilawar, Badal, intel-xe@lists.freedesktop.org
Cc: Vivi, Rodrigo, Jadav, Raag, Tauro, Riana, Koujalagi, Mallesh,
Iddamsetty, Aravind, heikki.krogerus@linux.intel.com,
Ghimiray, Himal Prasad
> -----Original Message-----
> From: Nilawar, Badal <badal.nilawar@intel.com>
> Sent: Tuesday, December 1, 2026 2:41 PM
> To: intel-xe@lists.freedesktop.org
> Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Vivi, Rodrigo
> <rodrigo.vivi@intel.com>; Jadav, Raag <raag.jadav@intel.com>; Tauro, Riana
> <riana.tauro@intel.com>; Koujalagi, Mallesh <mallesh.koujalagi@intel.com>;
> Iddamsetty, Aravind <aravind.iddamsetty@intel.com>;
> heikki.krogerus@linux.intel.com; Ghimiray, Himal Prasad
> <himal.prasad.ghimiray@intel.com>
> Subject: [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal
> trip alert
>
> AMC powers down the SoC after reporting a thermal trip. Notify userspace
> through a uevent to attempt cold-reset recovery after the SoC cools down.
>
> v2: Use DRM style logging (Anshuman)
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> drivers/gpu/drm/xe/xe_amc.c | 33 +++++++++++++++++++++------------
> 1 file changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index 37694e34271a..a673d56ad673 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -4,7 +4,6 @@
> */
>
> #include <linux/delay.h>
> -#include <linux/dev_printk.h>
> #include <linux/err.h>
> #include <linux/i2c.h>
> #include <linux/pci_ids.h>
> @@ -12,6 +11,8 @@
> #include <linux/string.h>
> #include <linux/workqueue.h>
>
> +#include <drm/drm_print.h>
> +
> #include "regs/xe_i2c_regs.h"
>
> #include "xe_amc.h"
> @@ -115,6 +116,8 @@ static void xe_amc_work(struct work_struct *work)
> u8 alert_reason = AMC_ALERT_UNKNOWN;
> struct amc_response response;
> struct i2c_client *client;
> + const char *alert_str;
> + unsigned long recovery = 0;
> int ret;
>
> xe_pm_runtime_get(xe);
> @@ -125,7 +128,7 @@ static void xe_amc_work(struct work_struct *work)
>
> ret = i2c_master_send(client, (u8 *)request, sizeof(*request));
> if (ret < 0) {
> - dev_err(&client->dev, "failed to send request (%d)\n", ret);
> + drm_err(&xe->drm, "failed to send request (%d)\n", ret);
> goto out_reassert_interrupt;
> }
>
> @@ -134,46 +137,52 @@ static void xe_amc_work(struct work_struct *work)
>
> ret = i2c_master_recv(client, (u8 *)&response, sizeof(response));
> if (ret < 0) {
> - dev_err(&client->dev, "failed to read response (%d)\n", ret);
> + drm_err(&xe->drm, "failed to read response (%d)\n", ret);
> goto out_reassert_interrupt;
> }
>
> if (!response.header.len) {
> - dev_err(&client->dev, "empty response from AMC\n");
> + drm_err(&xe->drm, "empty response from AMC\n");
> goto out_reassert_interrupt;
> }
>
> if (memcmp(&response.message, &request->message, sizeof(struct
> amc_message))) {
> - dev_err(&client->dev, "response does not match the
> request\n");
> + drm_err(&xe->drm, "response does not match the
> request\n");
> goto out_reassert_interrupt;
> }
>
> if (response.error) {
> - dev_err(&client->dev, "AMC error 0x%02x\n", response.error);
> + drm_err(&xe->drm, "AMC error 0x%02x\n", response.error);
> goto out_reassert_interrupt;
> }
>
> alert_reason = response.value;
> - dev_dbg(&client->dev, "Alert reason: %d\n", alert_reason);
> + drm_dbg(&xe->drm, "Alert reason: %d\n", alert_reason);
Please move the unrelated diff to separate refactoring patch.
>
> out_reassert_interrupt:
> xe_mmio_rmw32(amc->i2c->mmio, I2C_CONFIG_CMD,
> PCI_COMMAND_INTX_DISABLE, 0);
>
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> - case AMC_ALERT_THERMAL_TRIP:
> case AMC_ALERT_OOB_REQUEST:
> case AMC_ALERT_OOB_RESET:
> case AMC_ALERT_CATERR:
> - dev_warn(amc->i2c->drm_dev, "AMC Alert: %s\n",
> amc_alert[alert_reason]);
> - xe_wedge_declare(i2c_client_to_xe_device(client),
> - DRM_WEDGE_RECOVERY_REBIND |
> DRM_WEDGE_RECOVERY_BUS_RESET);
> + alert_str = amc_alert[alert_reason];
> + recovery = DRM_WEDGE_RECOVERY_REBIND |
> DRM_WEDGE_RECOVERY_BUS_RESET;
> + break;
> + case AMC_ALERT_THERMAL_TRIP:
> + alert_str = amc_alert[alert_reason];
> + recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
> break;
> default:
> - dev_warn(amc->i2c->drm_dev, "unknown AMC alert: %d\n",
> alert_reason);
> + alert_str = "unknown";
> break;
> }
>
> + drm_warn(&xe->drm, "AMC Alert: %s (%u)\n", alert_str, alert_reason);
> + if (recovery)
> + xe_wedge_declare(xe, recovery);
> +
With that LGTM
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> xe_pm_runtime_put(xe);
> }
>
> --
> 2.56.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v2 2/5] drm/xe: Request cold-reset recovery on AMC OOB request alert
2026-12-01 9:11 ` [PATCH v2 2/5] drm/xe: Request cold-reset recovery on AMC OOB request alert Badal Nilawar
@ 2026-12-01 11:03 ` Gupta, Anshuman
0 siblings, 0 replies; 14+ messages in thread
From: Gupta, Anshuman @ 2026-12-01 11:03 UTC (permalink / raw)
To: Nilawar, Badal, intel-xe@lists.freedesktop.org
Cc: Vivi, Rodrigo, Jadav, Raag, Tauro, Riana, Koujalagi, Mallesh,
Iddamsetty, Aravind, heikki.krogerus@linux.intel.com,
Ghimiray, Himal Prasad
> -----Original Message-----
> From: Nilawar, Badal <badal.nilawar@intel.com>
> Sent: Tuesday, December 1, 2026 2:41 PM
> To: intel-xe@lists.freedesktop.org
> Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Vivi, Rodrigo
> <rodrigo.vivi@intel.com>; Jadav, Raag <raag.jadav@intel.com>; Tauro, Riana
> <riana.tauro@intel.com>; Koujalagi, Mallesh <mallesh.koujalagi@intel.com>;
> Iddamsetty, Aravind <aravind.iddamsetty@intel.com>;
> heikki.krogerus@linux.intel.com; Ghimiray, Himal Prasad
> <himal.prasad.ghimiray@intel.com>
> Subject: [PATCH v2 2/5] drm/xe: Request cold-reset recovery on AMC OOB
> request alert
>
> AMC sends an OOB power-down request alert to KMD before powering down
> the SoC. Notify userspace through a uevent to request cold-reset recovery.
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> drivers/gpu/drm/xe/xe_amc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index a673d56ad673..2b53c5ff0d2b 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -164,12 +164,12 @@ static void xe_amc_work(struct work_struct *work)
>
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> - case AMC_ALERT_OOB_REQUEST:
> case AMC_ALERT_OOB_RESET:
> case AMC_ALERT_CATERR:
> alert_str = amc_alert[alert_reason];
> recovery = DRM_WEDGE_RECOVERY_REBIND |
> DRM_WEDGE_RECOVERY_BUS_RESET;
> break;
> + case AMC_ALERT_OOB_REQUEST:
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> case AMC_ALERT_THERMAL_TRIP:
> alert_str = amc_alert[alert_reason];
> recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
> --
> 2.56.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v2 3/5] drm/xe: Request cold-reset recovery on AMC CATERR alert
2026-12-01 9:11 ` [PATCH v2 3/5] drm/xe: Request cold-reset recovery on AMC CATERR alert Badal Nilawar
@ 2026-12-01 11:04 ` Gupta, Anshuman
0 siblings, 0 replies; 14+ messages in thread
From: Gupta, Anshuman @ 2026-12-01 11:04 UTC (permalink / raw)
To: Nilawar, Badal, intel-xe@lists.freedesktop.org
Cc: Vivi, Rodrigo, Jadav, Raag, Tauro, Riana, Koujalagi, Mallesh,
Iddamsetty, Aravind, heikki.krogerus@linux.intel.com,
Ghimiray, Himal Prasad
> -----Original Message-----
> From: Nilawar, Badal <badal.nilawar@intel.com>
> Sent: Tuesday, December 1, 2026 2:41 PM
> To: intel-xe@lists.freedesktop.org
> Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Vivi, Rodrigo
> <rodrigo.vivi@intel.com>; Jadav, Raag <raag.jadav@intel.com>; Tauro, Riana
> <riana.tauro@intel.com>; Koujalagi, Mallesh <mallesh.koujalagi@intel.com>;
> Iddamsetty, Aravind <aravind.iddamsetty@intel.com>;
> heikki.krogerus@linux.intel.com; Ghimiray, Himal Prasad
> <himal.prasad.ghimiray@intel.com>
> Subject: [PATCH v2 3/5] drm/xe: Request cold-reset recovery on AMC CATERR
> alert
>
> AMC reports a CATERR when the device encounters a catastrophic error
> requiring cold-reset recovery. Notify userspace through a uevent with the
> requested recovery action so that it can perform the cold reset and recover
> the device.
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> v2:
> - Expand commit message (Anshuman)
> ---
> drivers/gpu/drm/xe/xe_amc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index 2b53c5ff0d2b..613f5434d7d8 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -165,10 +165,10 @@ static void xe_amc_work(struct work_struct *work)
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> case AMC_ALERT_OOB_RESET:
> - case AMC_ALERT_CATERR:
> alert_str = amc_alert[alert_reason];
> recovery = DRM_WEDGE_RECOVERY_REBIND |
> DRM_WEDGE_RECOVERY_BUS_RESET;
> break;
> + case AMC_ALERT_CATERR:
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> case AMC_ALERT_OOB_REQUEST:
> case AMC_ALERT_THERMAL_TRIP:
> alert_str = amc_alert[alert_reason];
> --
> 2.56.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert
2026-12-01 9:11 ` [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert Badal Nilawar
2026-12-01 10:58 ` Gupta, Anshuman
@ 2026-12-01 11:12 ` Raag Jadav
1 sibling, 0 replies; 14+ messages in thread
From: Raag Jadav @ 2026-12-01 11:12 UTC (permalink / raw)
To: Badal Nilawar
Cc: intel-xe, anshuman.gupta, rodrigo.vivi, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
On Tue, Dec 01, 2026 at 02:41:11PM +0530, Badal Nilawar wrote:
> AMC powers down the SoC after reporting a thermal trip. Notify userspace
> through a uevent to attempt cold-reset recovery after the SoC cools down.
>
> v2: Use DRM style logging (Anshuman)
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> drivers/gpu/drm/xe/xe_amc.c | 33 +++++++++++++++++++++------------
> 1 file changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index 37694e34271a..a673d56ad673 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -4,7 +4,6 @@
> */
>
> #include <linux/delay.h>
> -#include <linux/dev_printk.h>
> #include <linux/err.h>
> #include <linux/i2c.h>
> #include <linux/pci_ids.h>
> @@ -12,6 +11,8 @@
> #include <linux/string.h>
> #include <linux/workqueue.h>
>
> +#include <drm/drm_print.h>
> +
> #include "regs/xe_i2c_regs.h"
>
> #include "xe_amc.h"
> @@ -115,6 +116,8 @@ static void xe_amc_work(struct work_struct *work)
> u8 alert_reason = AMC_ALERT_UNKNOWN;
> struct amc_response response;
> struct i2c_client *client;
> + const char *alert_str;
> + unsigned long recovery = 0;
> int ret;
>
> xe_pm_runtime_get(xe);
> @@ -125,7 +128,7 @@ static void xe_amc_work(struct work_struct *work)
>
> ret = i2c_master_send(client, (u8 *)request, sizeof(*request));
> if (ret < 0) {
> - dev_err(&client->dev, "failed to send request (%d)\n", ret);
> + drm_err(&xe->drm, "failed to send request (%d)\n", ret);
The dev_err() choice was deliberate here, as they are not the same device.
Raag
> goto out_reassert_interrupt;
> }
>
> @@ -134,46 +137,52 @@ static void xe_amc_work(struct work_struct *work)
>
> ret = i2c_master_recv(client, (u8 *)&response, sizeof(response));
> if (ret < 0) {
> - dev_err(&client->dev, "failed to read response (%d)\n", ret);
> + drm_err(&xe->drm, "failed to read response (%d)\n", ret);
> goto out_reassert_interrupt;
> }
>
> if (!response.header.len) {
> - dev_err(&client->dev, "empty response from AMC\n");
> + drm_err(&xe->drm, "empty response from AMC\n");
> goto out_reassert_interrupt;
> }
>
> if (memcmp(&response.message, &request->message, sizeof(struct amc_message))) {
> - dev_err(&client->dev, "response does not match the request\n");
> + drm_err(&xe->drm, "response does not match the request\n");
> goto out_reassert_interrupt;
> }
>
> if (response.error) {
> - dev_err(&client->dev, "AMC error 0x%02x\n", response.error);
> + drm_err(&xe->drm, "AMC error 0x%02x\n", response.error);
> goto out_reassert_interrupt;
> }
>
> alert_reason = response.value;
> - dev_dbg(&client->dev, "Alert reason: %d\n", alert_reason);
> + drm_dbg(&xe->drm, "Alert reason: %d\n", alert_reason);
>
> out_reassert_interrupt:
> xe_mmio_rmw32(amc->i2c->mmio, I2C_CONFIG_CMD, PCI_COMMAND_INTX_DISABLE, 0);
>
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> - case AMC_ALERT_THERMAL_TRIP:
> case AMC_ALERT_OOB_REQUEST:
> case AMC_ALERT_OOB_RESET:
> case AMC_ALERT_CATERR:
> - dev_warn(amc->i2c->drm_dev, "AMC Alert: %s\n", amc_alert[alert_reason]);
> - xe_wedge_declare(i2c_client_to_xe_device(client),
> - DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET);
> + alert_str = amc_alert[alert_reason];
> + recovery = DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET;
> + break;
> + case AMC_ALERT_THERMAL_TRIP:
> + alert_str = amc_alert[alert_reason];
> + recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
> break;
> default:
> - dev_warn(amc->i2c->drm_dev, "unknown AMC alert: %d\n", alert_reason);
> + alert_str = "unknown";
> break;
> }
>
> + drm_warn(&xe->drm, "AMC Alert: %s (%u)\n", alert_str, alert_reason);
> + if (recovery)
> + xe_wedge_declare(xe, recovery);
> +
> xe_pm_runtime_put(xe);
> }
>
> --
> 2.56.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs
2026-12-01 9:11 ` [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs Badal Nilawar
@ 2026-12-01 15:54 ` Gupta, Anshuman
2026-12-01 21:10 ` Rodrigo Vivi
1 sibling, 0 replies; 14+ messages in thread
From: Gupta, Anshuman @ 2026-12-01 15:54 UTC (permalink / raw)
To: Nilawar, Badal, intel-xe@lists.freedesktop.org
Cc: Vivi, Rodrigo, Jadav, Raag, Tauro, Riana, Koujalagi, Mallesh,
Iddamsetty, Aravind, heikki.krogerus@linux.intel.com,
Ghimiray, Himal Prasad
> -----Original Message-----
> From: Nilawar, Badal <badal.nilawar@intel.com>
> Sent: Tuesday, December 1, 2026 2:41 PM
> To: intel-xe@lists.freedesktop.org
> Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Vivi, Rodrigo
> <rodrigo.vivi@intel.com>; Jadav, Raag <raag.jadav@intel.com>; Tauro, Riana
> <riana.tauro@intel.com>; Koujalagi, Mallesh <mallesh.koujalagi@intel.com>;
> Iddamsetty, Aravind <aravind.iddamsetty@intel.com>;
> heikki.krogerus@linux.intel.com; Ghimiray, Himal Prasad
> <himal.prasad.ghimiray@intel.com>
> Subject: [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs
>
> AMC raises an SMBus alert before a power-removal or power-cycle operation.
> The xe driver uses the alert reason to select a recovery method.
>
> Expose the reason in a read-only sysfs attribute so userspace can identify the
> appropriate recovery action.
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> v2:
> - Correct the documented sysfs attribute name (Sashiko)
> - Ensure the alert reason is visible before publishing the
> alert-seen state (Sashiko)
> ---
> .../ABI/testing/sysfs-driver-intel-xe-amc | 24 +++++++
> drivers/gpu/drm/xe/xe_amc.c | 67 ++++++++++++++++++-
> 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644
> Documentation/ABI/testing/sysfs-driver-intel-xe-amc
>
> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-amc
> b/Documentation/ABI/testing/sysfs-driver-intel-xe-amc
> new file mode 100644
> index 000000000000..385b6519a1ca
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-amc
> @@ -0,0 +1,24 @@
> +What: /sys/bus/pci/drivers/xe/.../amc_alert_reason
> +Date: November 2026
> +KernelVersion: 7.5
> +Contact: intel-xe@lists.freedesktop.org
> +Description:
> + This file exposes the reason for the most recent Add-In
> + Management Controller (AMC) alert on supported Intel Xe
> platforms.
> +
> + An AMC alert is delivered via an SMBus interrupt. The device
> may
> + be wedged; the required recovery method depends on the
> alert.
> + The attribute is read-only and available to all users.
> +
> + Read returns a single line containing one of the following
> + alert reasons:
> +
> + "none"
> + No AMC alert has been received
> + "unknown"
> + AMC alert received but with unknown reason
> + "Firmware Download"
> + "Thermal Trip"
> + "OOB Request"
> + "OOB Reset"
> + "Catastrophic"
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index 613f5434d7d8..f23abee5eb5c 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -50,6 +50,7 @@ enum xe_amc_alert {
> };
>
> static const char * const amc_alert[] = {
> + [AMC_ALERT_UNKNOWN] = "unknown",
> [AMC_ALERT_FW_DOWNLOAD] = "Firmware Download",
> [AMC_ALERT_THERMAL_TRIP] = "Thermal Trip",
> [AMC_ALERT_OOB_REQUEST] = "OOB Request",
> @@ -60,6 +61,8 @@ static const char * const amc_alert[] = { struct xe_amc {
> struct xe_i2c *i2c;
> struct work_struct work;
> + enum xe_amc_alert alert_reason;
> + bool alert_seen;
> };
>
> struct amc_header {
> @@ -108,6 +111,51 @@ static const struct amc_request
> amc_get_alert_reason = {
> },
> };
>
> +/**
> + * DOC: AMC Alert Reason
> + *
> + * Expose the most recent AMC alert reason through device sysfs.
> + *
> + * See Documentation/ABI/testing/sysfs-driver-intel-xe-amc for the ABI
> + * specification.
> + */
> +
> +static enum xe_amc_alert amc_alert_reason(struct xe_amc *amc) {
> + return READ_ONCE(amc->alert_reason);
> +}
> +
> +static ssize_t amc_alert_reason_show(struct device *dev,
> + struct device_attribute *attr, char *buf) {
> + struct xe_device *xe = pdev_to_xe_device(to_pci_dev(dev));
> + struct xe_amc *amc = xe->i2c->amc;
> + enum xe_amc_alert alert_reason;
> +
> + /* Pairs with smp_store_release() to make alert_reason visible. */
> + if (!smp_load_acquire(&amc->alert_seen))
> + return sysfs_emit(buf, "none\n");
> +
> + alert_reason = amc_alert_reason(amc);
> +
> + return sysfs_emit(buf, "%s\n", amc_alert[alert_reason]); } static
> +DEVICE_ATTR_RO(amc_alert_reason);
> +
> +static void amc_remove_alert_sysfs(struct xe_i2c *i2c) {
> + struct device *dev = i2c->drm_dev;
> +
> + device_remove_file(dev, &dev_attr_amc_alert_reason); }
> +
> +static int amc_create_alert_sysfs(struct xe_i2c *i2c) {
> + struct device *dev = i2c->drm_dev;
> +
> + return device_create_file(dev, &dev_attr_amc_alert_reason); }
> +
> static void xe_amc_work(struct work_struct *work) {
> const struct amc_request *request = &amc_get_alert_reason; @@ -
> 162,6 +210,11 @@ static void xe_amc_work(struct work_struct *work)
> out_reassert_interrupt:
> xe_mmio_rmw32(amc->i2c->mmio, I2C_CONFIG_CMD,
> PCI_COMMAND_INTX_DISABLE, 0);
>
> + WRITE_ONCE(amc->alert_reason, alert_reason <
> ARRAY_SIZE(amc_alert) ?
> + alert_reason : AMC_ALERT_UNKNOWN);
> + /* Publish alert_reason to readers using smp_load_acquire(). */
> + smp_store_release(&amc->alert_seen, true);
> +
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> case AMC_ALERT_OOB_RESET:
> @@ -175,11 +228,12 @@ static void xe_amc_work(struct work_struct *work)
> recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
> break;
> default:
> - alert_str = "unknown";
> + alert_str = amc_alert[AMC_ALERT_UNKNOWN];
> break;
> }
>
> drm_warn(&xe->drm, "AMC Alert: %s (%u)\n", alert_str, alert_reason);
> +
> if (recovery)
> xe_wedge_declare(xe, recovery);
>
> @@ -194,6 +248,7 @@ void xe_amc_handle_alert(struct xe_i2c *i2c) int
> xe_amc_init(struct xe_i2c *i2c) {
> struct xe_amc *amc;
> + int ret;
>
> amc = kzalloc_obj(*amc);
> if (!amc)
> @@ -203,13 +258,21 @@ int xe_amc_init(struct xe_i2c *i2c)
> i2c->amc = amc;
> amc->i2c = i2c;
>
> - return 0;
> + ret = amc_create_alert_sysfs(i2c);
> + if (ret) {
> + kfree(i2c->amc);
> + i2c->amc = NULL;
> + }
> +
> + return ret;
> }
>
> void xe_amc_exit(struct xe_i2c *i2c)
> {
> if (i2c->amc) {
> + amc_remove_alert_sysfs(i2c);
> cancel_work_sync(&i2c->amc->work);
> kfree(i2c->amc);
> + i2c->amc = NULL;
AFAIU above is unrelated to this patch, please add the required info about above change in either commit log or in version logs.
With above
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> }
> }
> --
> 2.56.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert
2026-12-01 9:11 ` [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert Badal Nilawar
@ 2026-12-01 16:24 ` Gupta, Anshuman
2026-12-01 21:10 ` Rodrigo Vivi
1 sibling, 0 replies; 14+ messages in thread
From: Gupta, Anshuman @ 2026-12-01 16:24 UTC (permalink / raw)
To: Nilawar, Badal, intel-xe@lists.freedesktop.org
Cc: Vivi, Rodrigo, Jadav, Raag, Tauro, Riana, Koujalagi, Mallesh,
Iddamsetty, Aravind, heikki.krogerus@linux.intel.com,
Ghimiray, Himal Prasad
> -----Original Message-----
> From: Nilawar, Badal <badal.nilawar@intel.com>
> Sent: Tuesday, December 1, 2026 2:41 PM
> To: intel-xe@lists.freedesktop.org
> Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Vivi, Rodrigo
> <rodrigo.vivi@intel.com>; Jadav, Raag <raag.jadav@intel.com>; Tauro, Riana
> <riana.tauro@intel.com>; Koujalagi, Mallesh <mallesh.koujalagi@intel.com>;
> Iddamsetty, Aravind <aravind.iddamsetty@intel.com>;
> heikki.krogerus@linux.intel.com; Ghimiray, Himal Prasad
> <himal.prasad.ghimiray@intel.com>
> Subject: [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware
> download alert
>
> AMC reports a firmware download alert when a device firmware update is in
> progress. Request vendor-specific recovery so userspace can identify the alert
> reason and perform the documented recovery.
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
LGTM
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
> v2:
> - Rephrase recovery procedure (Rodrigo)
> ---
> drivers/gpu/drm/xe/xe_amc.c | 3 +++
> drivers/gpu/drm/xe/xe_wedge.c | 19 +++++++++++++++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index f23abee5eb5c..e0ff01b1d0a5 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -217,6 +217,9 @@ static void xe_amc_work(struct work_struct *work)
>
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> + alert_str = amc_alert[alert_reason];
> + recovery = DRM_WEDGE_RECOVERY_VENDOR;
> + break;
> case AMC_ALERT_OOB_RESET:
> alert_str = amc_alert[alert_reason];
> recovery = DRM_WEDGE_RECOVERY_REBIND |
> DRM_WEDGE_RECOVERY_BUS_RESET; diff --git
> a/drivers/gpu/drm/xe/xe_wedge.c b/drivers/gpu/drm/xe/xe_wedge.c index
> e48cca34d660..7d58ca3b2f4b 100644
> --- a/drivers/gpu/drm/xe/xe_wedge.c
> +++ b/drivers/gpu/drm/xe/xe_wedge.c
> @@ -54,6 +54,25 @@
> *
> * - Admin/userspace consumer can use firmware flashing tools like fwupd to
> flash
> * firmware and restore device to normal operation.
> + *
> + * Case: Firmware Download (AMC alert)
> + * -----------------------------------
> + *
> + * Identification Hint
> + * +++++++++++++++++++
> + *
> + * ``WEDGED=vendor-specific`` drm device wedged uevent with
> + * ``/sys/bus/pci/devices/<device>/amc_alert_reason`` reporting
> + * ``Firmware Download`` indicates that a firmware download is in progress.
> + *
> + * Recovery Procedure
> + * ++++++++++++++++++
> + *
> + * Once ``WEDGED=vendor-specific`` drm device wedged uevent is
> + received, follow
> + * the below steps
> + *
> + * - Check the AMC alert reason sysfs. If it reports ``Firmware Download``,
> + * ensure device reset completes and re-enumerate the device.
> */
>
> /**
> --
> 2.56.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert
2026-12-01 9:11 ` [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert Badal Nilawar
2026-12-01 16:24 ` Gupta, Anshuman
@ 2026-12-01 21:10 ` Rodrigo Vivi
1 sibling, 0 replies; 14+ messages in thread
From: Rodrigo Vivi @ 2026-12-01 21:10 UTC (permalink / raw)
To: Badal Nilawar
Cc: intel-xe, anshuman.gupta, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
On Tue, Dec 01, 2026 at 02:41:15PM +0530, Badal Nilawar wrote:
> AMC reports a firmware download alert when a device firmware update is
> in progress. Request vendor-specific recovery so userspace can identify
> the alert reason and perform the documented recovery.
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> v2:
> - Rephrase recovery procedure (Rodrigo)
> ---
> drivers/gpu/drm/xe/xe_amc.c | 3 +++
> drivers/gpu/drm/xe/xe_wedge.c | 19 +++++++++++++++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index f23abee5eb5c..e0ff01b1d0a5 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -217,6 +217,9 @@ static void xe_amc_work(struct work_struct *work)
>
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> + alert_str = amc_alert[alert_reason];
> + recovery = DRM_WEDGE_RECOVERY_VENDOR;
> + break;
> case AMC_ALERT_OOB_RESET:
> alert_str = amc_alert[alert_reason];
> recovery = DRM_WEDGE_RECOVERY_REBIND | DRM_WEDGE_RECOVERY_BUS_RESET;
> diff --git a/drivers/gpu/drm/xe/xe_wedge.c b/drivers/gpu/drm/xe/xe_wedge.c
> index e48cca34d660..7d58ca3b2f4b 100644
> --- a/drivers/gpu/drm/xe/xe_wedge.c
> +++ b/drivers/gpu/drm/xe/xe_wedge.c
> @@ -54,6 +54,25 @@
> *
> * - Admin/userspace consumer can use firmware flashing tools like fwupd to flash
> * firmware and restore device to normal operation.
> + *
> + * Case: Firmware Download (AMC alert)
> + * -----------------------------------
> + *
> + * Identification Hint
> + * +++++++++++++++++++
> + *
> + * ``WEDGED=vendor-specific`` drm device wedged uevent with
> + * ``/sys/bus/pci/devices/<device>/amc_alert_reason`` reporting
> + * ``Firmware Download`` indicates that a firmware download is in progress.
> + *
> + * Recovery Procedure
> + * ++++++++++++++++++
> + *
> + * Once ``WEDGED=vendor-specific`` drm device wedged uevent is received, follow
> + * the below steps
> + *
> + * - Check the AMC alert reason sysfs. If it reports ``Firmware Download``,
> + * ensure device reset completes and re-enumerate the device.
Thank you
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> */
>
> /**
> --
> 2.56.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs
2026-12-01 9:11 ` [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs Badal Nilawar
2026-12-01 15:54 ` Gupta, Anshuman
@ 2026-12-01 21:10 ` Rodrigo Vivi
1 sibling, 0 replies; 14+ messages in thread
From: Rodrigo Vivi @ 2026-12-01 21:10 UTC (permalink / raw)
To: Badal Nilawar
Cc: intel-xe, anshuman.gupta, raag.jadav, riana.tauro,
mallesh.koujalagi, aravind.iddamsetty, heikki.krogerus,
himal.prasad.ghimiray
On Tue, Dec 01, 2026 at 02:41:14PM +0530, Badal Nilawar wrote:
> AMC raises an SMBus alert before a power-removal or power-cycle
> operation. The xe driver uses the alert reason to select a recovery
> method.
>
> Expose the reason in a read-only sysfs attribute so userspace can
> identify the appropriate recovery action.
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> v2:
> - Correct the documented sysfs attribute name (Sashiko)
> - Ensure the alert reason is visible before publishing the
> alert-seen state (Sashiko)
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> .../ABI/testing/sysfs-driver-intel-xe-amc | 24 +++++++
> drivers/gpu/drm/xe/xe_amc.c | 67 ++++++++++++++++++-
> 2 files changed, 89 insertions(+), 2 deletions(-)
> create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-xe-amc
>
> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-amc b/Documentation/ABI/testing/sysfs-driver-intel-xe-amc
> new file mode 100644
> index 000000000000..385b6519a1ca
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-amc
> @@ -0,0 +1,24 @@
> +What: /sys/bus/pci/drivers/xe/.../amc_alert_reason
> +Date: November 2026
> +KernelVersion: 7.5
> +Contact: intel-xe@lists.freedesktop.org
> +Description:
> + This file exposes the reason for the most recent Add-In
> + Management Controller (AMC) alert on supported Intel Xe platforms.
> +
> + An AMC alert is delivered via an SMBus interrupt. The device may
> + be wedged; the required recovery method depends on the alert.
> + The attribute is read-only and available to all users.
> +
> + Read returns a single line containing one of the following
> + alert reasons:
> +
> + "none"
> + No AMC alert has been received
> + "unknown"
> + AMC alert received but with unknown reason
> + "Firmware Download"
> + "Thermal Trip"
> + "OOB Request"
> + "OOB Reset"
> + "Catastrophic"
> diff --git a/drivers/gpu/drm/xe/xe_amc.c b/drivers/gpu/drm/xe/xe_amc.c
> index 613f5434d7d8..f23abee5eb5c 100644
> --- a/drivers/gpu/drm/xe/xe_amc.c
> +++ b/drivers/gpu/drm/xe/xe_amc.c
> @@ -50,6 +50,7 @@ enum xe_amc_alert {
> };
>
> static const char * const amc_alert[] = {
> + [AMC_ALERT_UNKNOWN] = "unknown",
> [AMC_ALERT_FW_DOWNLOAD] = "Firmware Download",
> [AMC_ALERT_THERMAL_TRIP] = "Thermal Trip",
> [AMC_ALERT_OOB_REQUEST] = "OOB Request",
> @@ -60,6 +61,8 @@ static const char * const amc_alert[] = {
> struct xe_amc {
> struct xe_i2c *i2c;
> struct work_struct work;
> + enum xe_amc_alert alert_reason;
> + bool alert_seen;
> };
>
> struct amc_header {
> @@ -108,6 +111,51 @@ static const struct amc_request amc_get_alert_reason = {
> },
> };
>
> +/**
> + * DOC: AMC Alert Reason
> + *
> + * Expose the most recent AMC alert reason through device sysfs.
> + *
> + * See Documentation/ABI/testing/sysfs-driver-intel-xe-amc for the ABI
> + * specification.
> + */
> +
> +static enum xe_amc_alert amc_alert_reason(struct xe_amc *amc)
> +{
> + return READ_ONCE(amc->alert_reason);
> +}
> +
> +static ssize_t amc_alert_reason_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct xe_device *xe = pdev_to_xe_device(to_pci_dev(dev));
> + struct xe_amc *amc = xe->i2c->amc;
> + enum xe_amc_alert alert_reason;
> +
> + /* Pairs with smp_store_release() to make alert_reason visible. */
> + if (!smp_load_acquire(&amc->alert_seen))
> + return sysfs_emit(buf, "none\n");
> +
> + alert_reason = amc_alert_reason(amc);
> +
> + return sysfs_emit(buf, "%s\n", amc_alert[alert_reason]);
> +}
> +static DEVICE_ATTR_RO(amc_alert_reason);
> +
> +static void amc_remove_alert_sysfs(struct xe_i2c *i2c)
> +{
> + struct device *dev = i2c->drm_dev;
> +
> + device_remove_file(dev, &dev_attr_amc_alert_reason);
> +}
> +
> +static int amc_create_alert_sysfs(struct xe_i2c *i2c)
> +{
> + struct device *dev = i2c->drm_dev;
> +
> + return device_create_file(dev, &dev_attr_amc_alert_reason);
> +}
> +
> static void xe_amc_work(struct work_struct *work)
> {
> const struct amc_request *request = &amc_get_alert_reason;
> @@ -162,6 +210,11 @@ static void xe_amc_work(struct work_struct *work)
> out_reassert_interrupt:
> xe_mmio_rmw32(amc->i2c->mmio, I2C_CONFIG_CMD, PCI_COMMAND_INTX_DISABLE, 0);
>
> + WRITE_ONCE(amc->alert_reason, alert_reason < ARRAY_SIZE(amc_alert) ?
> + alert_reason : AMC_ALERT_UNKNOWN);
> + /* Publish alert_reason to readers using smp_load_acquire(). */
> + smp_store_release(&amc->alert_seen, true);
> +
> switch (alert_reason) {
> case AMC_ALERT_FW_DOWNLOAD:
> case AMC_ALERT_OOB_RESET:
> @@ -175,11 +228,12 @@ static void xe_amc_work(struct work_struct *work)
> recovery = DRM_WEDGE_RECOVERY_COLD_RESET;
> break;
> default:
> - alert_str = "unknown";
> + alert_str = amc_alert[AMC_ALERT_UNKNOWN];
> break;
> }
>
> drm_warn(&xe->drm, "AMC Alert: %s (%u)\n", alert_str, alert_reason);
> +
> if (recovery)
> xe_wedge_declare(xe, recovery);
>
> @@ -194,6 +248,7 @@ void xe_amc_handle_alert(struct xe_i2c *i2c)
> int xe_amc_init(struct xe_i2c *i2c)
> {
> struct xe_amc *amc;
> + int ret;
>
> amc = kzalloc_obj(*amc);
> if (!amc)
> @@ -203,13 +258,21 @@ int xe_amc_init(struct xe_i2c *i2c)
> i2c->amc = amc;
> amc->i2c = i2c;
>
> - return 0;
> + ret = amc_create_alert_sysfs(i2c);
> + if (ret) {
> + kfree(i2c->amc);
> + i2c->amc = NULL;
> + }
> +
> + return ret;
> }
>
> void xe_amc_exit(struct xe_i2c *i2c)
> {
> if (i2c->amc) {
> + amc_remove_alert_sysfs(i2c);
> cancel_work_sync(&i2c->amc->work);
> kfree(i2c->amc);
> + i2c->amc = NULL;
> }
> }
> --
> 2.56.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-12-01 21:11 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 9:11 [PATCH v2 0/5] Process AMC alert Badal Nilawar
2026-12-01 9:11 ` [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert Badal Nilawar
2026-12-01 10:58 ` Gupta, Anshuman
2026-12-01 11:12 ` Raag Jadav
2026-12-01 9:11 ` [PATCH v2 2/5] drm/xe: Request cold-reset recovery on AMC OOB request alert Badal Nilawar
2026-12-01 11:03 ` Gupta, Anshuman
2026-12-01 9:11 ` [PATCH v2 3/5] drm/xe: Request cold-reset recovery on AMC CATERR alert Badal Nilawar
2026-12-01 11:04 ` Gupta, Anshuman
2026-12-01 9:11 ` [PATCH v2 4/5] drm/xe/i2c: Expose AMC alert reason through sysfs Badal Nilawar
2026-12-01 15:54 ` Gupta, Anshuman
2026-12-01 21:10 ` Rodrigo Vivi
2026-12-01 9:11 ` [PATCH v2 5/5] drm/xe: Request vendor recovery for AMC firmware download alert Badal Nilawar
2026-12-01 16:24 ` Gupta, Anshuman
2026-12-01 21:10 ` Rodrigo Vivi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox