[PATCH v4 4/4] drm/xe/xe_i2c: Add support for i2c in survivability mode

Heikki Krogerus posted 4 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH v4 4/4] drm/xe/xe_i2c: Add support for i2c in survivability mode
Posted by Heikki Krogerus 3 months, 2 weeks ago
From: Riana Tauro <riana.tauro@intel.com>

Initialize i2c in survivability mode to allow firmware
update of Add-In Management Controller (AMC) in survivability mode

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_survivability_mode.c | 23 ++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
index 1f710b3fc599..3800cc855c22 100644
--- a/drivers/gpu/drm/xe/xe_survivability_mode.c
+++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
@@ -14,6 +14,7 @@
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_heci_gsc.h"
+#include "xe_i2c.h"
 #include "xe_mmio.h"
 #include "xe_pcode_api.h"
 #include "xe_vsec.h"
@@ -173,20 +174,26 @@ static int enable_survivability_mode(struct pci_dev *pdev)
 	survivability->mode = true;
 
 	ret = xe_heci_gsc_init(xe);
-	if (ret) {
-		/*
-		 * But if it fails, device can't enter survivability
-		 * so move it back for correct error handling
-		 */
-		survivability->mode = false;
-		return ret;
-	}
+	if (ret)
+		goto err;
 
 	xe_vsec_init(xe);
 
+	ret = xe_i2c_probe(xe);
+	if (ret)
+		goto err;
+
 	dev_err(dev, "In Survivability Mode\n");
 
 	return 0;
+
+err:
+	/*
+	 * But if it fails, device can't enter survivability
+	 * so move it back for correct error handling
+	 */
+	survivability->mode = false;
+	return ret;
 }
 
 /**
-- 
2.47.2
Re: [PATCH v4 4/4] drm/xe/xe_i2c: Add support for i2c in survivability mode
Posted by Andy Shevchenko 3 months, 2 weeks ago
On Thu, Jun 26, 2025 at 04:56:09PM +0300, Heikki Krogerus wrote:
> 
> Initialize i2c in survivability mode to allow firmware
> update of Add-In Management Controller (AMC) in survivability mode

...

> +err:
> +	/*
> +	 * But if it fails, device can't enter survivability
> +	 * so move it back for correct error handling

While at it, add a period at the end.

> +	 */
> +	survivability->mode = false;
> +	return ret;

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v4 4/4] drm/xe/xe_i2c: Add support for i2c in survivability mode
Posted by Heikki Krogerus 3 months, 1 week ago
On Thu, Jun 26, 2025 at 05:24:26PM +0300, Andy Shevchenko wrote:
> On Thu, Jun 26, 2025 at 04:56:09PM +0300, Heikki Krogerus wrote:
> > 
> > Initialize i2c in survivability mode to allow firmware
> > update of Add-In Management Controller (AMC) in survivability mode
> 
> ...
> 
> > +err:
> > +	/*
> > +	 * But if it fails, device can't enter survivability
> > +	 * so move it back for correct error handling
> 
> While at it, add a period at the end.

OK.

Because of the vacations I'll send v5 already today. There is still a
failure report from the CI system that I'm not able to interpret, but
I think it's happening because the I2C endpoint is not accessible on
every GPU. I'll try to solve that by limiting this to BMG for now like
it was originally.

thanks,

-- 
heikki