Skip to contentSkip to conversation

Fix MEI command timeout issue following warm reboot

PATCH In review Wentong Wu 3 participants 12 messages Jun 25, 2024 – Jun 27, 2024

Subsystems (3)
lore
Share & tools
lore

Wentong Wu

author
#0 lore raw

v4 cover Fix MEI command timeout issue following warm reboot

While enabling the IVSC on certain recent commercial products, the chipset may occasionally enter an unknown state following a warm reboot. This issue can cause the firmware to fail in responding to the MEI command from the host, despite the firmware being re-downloaded. To resolve this, the current patch set incorporates reset logic during system shutdown to ensure that the IVSC chipset remains in a valid state after a warm reboot.

Furthermore, after the firmware download is complete, the firmware requires some time to become operational. To enhance this, additional sleep time has been introduced before the initial read operation to prevent a confusing timeout error in vsc_tp_xfer().

Additionally, this patch set includes several enhancements as well:
1) utilizing the appropriate byte order swap function for data received from the ROM;
2) correcting a spelling error in a comment;
3) constructing the SPI transfer command as per the specific request.

---
v3 -> v4:
- remove Fixes: in the commit message of comment spelling fix
- re-write the commit message of change "Enhance SPI transfer of IVSC ROM"
to easy to understand

v2 -> v3:
- switch code from ibuf ? tp->rx_buf : ibuf to ibuf ? tp->rx_buf : NULL

v1 -> v2:
- remove cc spelling fix to stable
- remove the reset toggling enhancement

Wentong Wu (5):
mei: vsc: Enhance IVSC chipset stability during warm reboot
mei: vsc: Prevent timeout error with added delay post-firmware
download
mei: vsc: Utilize the appropriate byte order swap function
mei: vsc: Enhance SPI transfer of IVSC ROM
mei: vsc: Fix spelling error

 drivers/misc/mei/platform-vsc.c  |  4 ++--
 drivers/misc/mei/vsc-fw-loader.c |  2 +-
 drivers/misc/mei/vsc-tp.c        | 18 ++++++++++++++++--
 3 files changed, 19 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v4 1/5 mei: vsc: Enhance IVSC chipset stability during warm reboot

During system shutdown, incorporate reset logic to ensure the IVSC chipset remains in a valid state. This adjustment guarantees that the IVSC chipset operates in a known state following a warm reboot.

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Cc [email protected] # for 6.8+
---
 drivers/misc/mei/vsc-tp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/misc/mei/vsc-tp.c +14 -0
index e6a98dba8a73..5f3195636e53 100644
@@ -568,6 +568,19 @@ static void vsc_tp_remove(struct spi_device *spi)
 	free_irq(spi->irq, tp);
 }
 
+static void vsc_tp_shutdown(struct spi_device *spi)
+{
+	struct vsc_tp *tp = spi_get_drvdata(spi);
+
+	platform_device_unregister(tp->pdev);
+
+	mutex_destroy(&tp->mutex);
+
+	vsc_tp_reset(tp);
+
+	free_irq(spi->irq, tp);
+}
+
 static const struct acpi_device_id vsc_tp_acpi_ids[] = {
 	{ "INTC1009" }, /* Raptor Lake */
 	{ "INTC1058" }, /* Tiger Lake */
@@ -580,6 +593,7 @@ MODULE_DEVICE_TABLE(acpi, vsc_tp_acpi_ids);
 static struct spi_driver vsc_tp_driver = {
 	.probe = vsc_tp_probe,
 	.remove = vsc_tp_remove,
+	.shutdown = vsc_tp_shutdown,
 	.driver = {
 		.name = "vsc-tp",
 		.acpi_match_table = vsc_tp_acpi_ids,
Signature · 1 line
2.34.1
Acked-by on v4 1/5
#2 lore raw

Re: [PATCH v4 1/5] mei: vsc: Enhance IVSC chipset stability during warm reboot

Quoted 8 lines · Wentong Wu

During system shutdown, incorporate reset logic to ensure the IVSC chipset remains in a valid state. This adjustment guarantees that the IVSC chipset operates in a known state following a warm reboot.

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Cc [email protected] # for 6.8+
Signature · 1 line
Sakari Ailus
author
#3 lore raw

PATCH v4 2/5 mei: vsc: Prevent timeout error with added delay post-firmware download

In reply to Wentong Wu

After completing the firmware download, the firmware requires some time to become functional. This change introduces additional sleep time before the first read operation to prevent a confusing timeout error in vsc_tp_xfer().

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Cc [email protected] # for 6.8+
---
 drivers/misc/mei/platform-vsc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/platform-vsc.c +2 -2
index 1ec65d87488a..d02f6e881139 100644
@@ -28,8 +28,8 @@
 
 #define MEI_VSC_MAX_MSG_SIZE		512
 
-#define MEI_VSC_POLL_DELAY_US		(50 * USEC_PER_MSEC)
-#define MEI_VSC_POLL_TIMEOUT_US		(200 * USEC_PER_MSEC)
+#define MEI_VSC_POLL_DELAY_US		(100 * USEC_PER_MSEC)
+#define MEI_VSC_POLL_TIMEOUT_US		(400 * USEC_PER_MSEC)
 
 #define mei_dev_to_vsc_hw(dev)		((struct mei_vsc_hw *)((dev)->hw))
 
Signature · 1 line
2.34.1
Acked-by on v4 2/5
#4 lore raw

Re: [PATCH v4 2/5] mei: vsc: Prevent timeout error with added delay post-firmware download

Quoted 9 lines · Wentong Wu

After completing the firmware download, the firmware requires some time to become functional. This change introduces additional sleep time before the first read operation to prevent a confusing timeout error in vsc_tp_xfer().

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Cc [email protected] # for 6.8+
Signature · 1 line
Sakari Ailus
author
#5 lore raw

PATCH v4 3/5 mei: vsc: Utilize the appropriate byte order swap function

In reply to Wentong Wu

Switch from cpu_to_be32_array() to be32_to_cpu_array() for the received ROM data.

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Cc [email protected] # for 6.8+
---
 drivers/misc/mei/vsc-tp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/vsc-tp.c +1 -1
index 5f3195636e53..876330474444 100644
@@ -336,7 +336,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)
 		return ret;
 
 	if (ibuf)
-		cpu_to_be32_array(ibuf, tp->rx_buf, words);
+		be32_to_cpu_array(ibuf, tp->rx_buf, words);
 
 	return ret;
 }
Signature · 1 line
2.34.1
Acked-by on v4 3/5
#6 lore raw

Re: [PATCH v4 3/5] mei: vsc: Utilize the appropriate byte order swap function

Quoted 7 lines · Wentong Wu

Switch from cpu_to_be32_array() to be32_to_cpu_array() for the received ROM data.

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Cc [email protected] # for 6.8+
Signature · 1 line
Sakari Ailus
author
#7 lore raw

PATCH v4 4/5 mei: vsc: Enhance SPI transfer of IVSC ROM

In reply to Wentong Wu

Before downloading firmware, a command response is required to identify the silicon. However, when downloading IVSC firmware, reading data from the SPI transfers with the IVSC ROM is not necessary. Therefore, the rx buffer of SPI transfer command is determined based on the specific request of the caller.

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
---
 drivers/misc/mei/vsc-tp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/vsc-tp.c +1 -1
index 876330474444..1618cca9a731 100644
@@ -331,7 +331,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)
 		return ret;
 	}
 
-	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, tp->rx_buf, len);
+	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, ibuf ? tp->rx_buf : NULL, len);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.34.1
Acked-by on v4 4/5
#8 lore raw

Re: [PATCH v4 4/5] mei: vsc: Enhance SPI transfer of IVSC ROM

Quoted 9 lines · Wentong Wu

Before downloading firmware, a command response is required to identify the silicon. However, when downloading IVSC firmware, reading data from the SPI transfers with the IVSC ROM is not necessary. Therefore, the rx buffer of SPI transfer command is determined based on the specific request of the caller.

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Signature · 1 line
Sakari Ailus
Acked-by Tomas Winker on v4 4/5
#9 lore raw

RE: [PATCH v4 4/5] mei: vsc: Enhance SPI transfer of IVSC ROM

In reply to Wentong Wu
Quoted 11 lines

Before downloading firmware, a command response is required to identify the silicon. However, when downloading IVSC firmware, reading data from the SPI transfers with the IVSC ROM is not necessary. Therefore, the rx buffer of SPI transfer command is determined based on the specific request of the caller.

Fixes 566f5ca97680 ("mei: Add transport driver for IVSC device")
Quoted 20 lines
---
 drivers/misc/mei/vsc-tp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/vsc-tp.c index renamed from drivers/misc/mei/vsc-tp.c +0 -0

876330474444..1618cca9a731 100644

drivers/misc/mei/vsc-tp.c +1 -2
@@ -331,7 +331,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void
 *obuf, void *ibuf, size_t len)
 		return ret;
 	}
 
-	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, tp->rx_buf, len);
+	ret = vsc_tp_dev_xfer(tp, tp->tx_buf, ibuf ? tp->rx_buf : NULL, len);
 	if (ret)
 		return ret;
 
--

2.34.1

author
#10 lore raw

PATCH v4 5/5 mei: vsc: Fix spelling error

In reply to Wentong Wu

Fix a spelling error in a comment.

---
 drivers/misc/mei/vsc-fw-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/vsc-fw-loader.c +1 -1
index 596a9d695dfc..084d0205f97d 100644
@@ -204,7 +204,7 @@ struct vsc_img_frag {
 
 /**
  * struct vsc_fw_loader - represent vsc firmware loader
- * @dev: device used to request fimware
+ * @dev: device used to request firmware
  * @tp: transport layer used with the firmware loader
  * @csi: CSI image
  * @ace: ACE image
Signature · 1 line
2.34.1