All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Badal Nilawar <badal.nilawar@intel.com>
Cc: intel-xe@lists.freedesktop.org, anshuman.gupta@intel.com,
	rodrigo.vivi@intel.com, riana.tauro@intel.com,
	mallesh.koujalagi@intel.com, aravind.iddamsetty@intel.com,
	heikki.krogerus@linux.intel.com, himal.prasad.ghimiray@intel.com
Subject: Re: [PATCH v2 1/5] drm/xe: Request cold-reset recovery on AMC thermal trip alert
Date: Tue, 1 Dec 2026 12:12:38 +0100	[thread overview]
Message-ID: <aw6rpvPt_wi2g4Mh@black.igk.intel.com> (raw)
In-Reply-To: <20261201091109.1343470-8-badal.nilawar@intel.com>

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
> 

  parent reply	other threads:[~2026-12-01 11:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw6rpvPt_wi2g4Mh@black.igk.intel.com \
    --to=raag.jadav@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.