Skip to contentSkip to conversation

mei: csc: add pci error handling

PATCH New Alexander Usyskin 1 participant 1 message Sep 2

Subsystems (2)
lore
Share & tools
lore

Alexander Usyskin

author maintainer
#0 lore raw

PATCH 1/1 mei: csc: add pci error handling

Add PCI error handler callbacks.
Stop and disable communication when error is detected; reset the link and re-enable communication then device is restored.

---
 drivers/misc/mei/init.c    | 33 +++++++++++++++++++--
 drivers/misc/mei/mei_dev.h |  1 +
 drivers/misc/mei/pci-csc.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+), 3 deletions(-)
drivers/misc/mei/init.c +30 -3
index 766f119f7ed0..82444d67db2a 100644
@@ -305,10 +305,8 @@ static void mei_reset_work(struct work_struct *work)
 		schedule_work(&dev->reset_work);
 }
 
-void mei_stop(struct mei_device *dev)
+static void __mei_stop(struct mei_device *dev)
 {
-	dev_dbg(&dev->dev, "stopping the device.\n");
-
 	mutex_lock(&dev->device_lock);
 	mei_set_devstate(dev, MEI_DEV_POWERING_DOWN);
 	mutex_unlock(&dev->device_lock);
@@ -318,6 +316,35 @@ void mei_stop(struct mei_device *dev)
 	mutex_unlock(&dev->device_lock);
 
 	mei_cancel_work(dev);
+}
+
+/**
+ * mei_stop_fast - stop driver, clean bus and disable driver without resetting HW link
+ *
+ * @dev: the device structure
+ */
+void mei_stop_fast(struct mei_device *dev)
+{
+	dev_dbg(&dev->dev, "stopping the device fast.\n");
+
+	__mei_stop(dev);
+
+	mutex_lock(&dev->device_lock);
+	mei_set_devstate(dev, MEI_DEV_DISABLED);
+	mutex_unlock(&dev->device_lock);
+}
+EXPORT_SYMBOL_GPL(mei_stop_fast);
+
+/**
+ * mei_stop - stop driver, clean bus and disable driver with resetting HW link
+ *
+ * @dev: the device structure
+ */
+void mei_stop(struct mei_device *dev)
+{
+	dev_dbg(&dev->dev, "stopping the device.\n");
+
+	__mei_stop(dev);
 
 	mei_clear_interrupts(dev);
 	mei_synchronize_irq(dev);
drivers/misc/mei/mei_dev.h +1 -0
index e651b06704a1..79a7c3e63397 100644
@@ -736,6 +736,7 @@ int mei_reset(struct mei_device *dev);
 int mei_start(struct mei_device *dev);
 int mei_restart(struct mei_device *dev);
 void mei_stop(struct mei_device *dev);
+void mei_stop_fast(struct mei_device *dev);
 void mei_cancel_work(struct mei_device *dev);
 
 void mei_set_devstate(struct mei_device *dev, enum mei_dev_state state);
drivers/misc/mei/pci-csc.c +72 -0

84 lines not on this page · raw message

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260902-cri_aer-2ad6392bb5ad

Best regards,

Signature · 1 line
Alexander Usyskin <[email protected]>