Skip to contentSkip to conversation

firmware: arm_scmi: Avoid to call mbox_client_txdone on txdone_irq mode

PATCH Superseded Pin-Chuan Liu 2 participants 3 messages Feb 1, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: arm_scmi: Avoid to call mbox_client_txdone on txdone_irq mode

On txdone_irq mode, tx_tick is done from mbox_chan_txdone. Calling to mbox_client_txdone could get error message and return directly, add a check to avoid this.

Change-Id Iacbe0d36ef9cc16974c013c3e94c47dc79eae52b
---
 drivers/firmware/arm_scmi/mailbox.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/firmware/arm_scmi/mailbox.c +7 -1
index b8d470417e8f..f6fe801c2e34 100644
@@ -8,6 +8,7 @@
 
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/mailbox_controller.h>
 #include <linux/mailbox_client.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -275,7 +276,12 @@ static void mailbox_mark_txdone(struct scmi_chan_info *cinfo, int ret,
 	 * Unfortunately, we have to kick the mailbox framework after we have
 	 * received our message.
 	 */
-	mbox_client_txdone(smbox->chan, ret);
+
+	/*
+	 * With txdone_irq mode, kick can be done by mbox_chan_txdone.
+	 */
+	if (!(smbox->chan->mbox->txdone_irq))
+		mbox_client_txdone(smbox->chan, ret);
 }
 
 static void mailbox_fetch_response(struct scmi_chan_info *cinfo,
Signature · 1 line
2.18.0
#1 lore raw

Il 01/02/24 05:52, Pin-Chuan Liu ha scritto:

Quoted 6 lines

On txdone_irq mode, tx_tick is done from mbox_chan_txdone. Calling to mbox_client_txdone could get error message and return directly, add a check to avoid this.

Change-Id Iacbe0d36ef9cc16974c013c3e94c47dc79eae52b

Change-Id is something internal to you and has no meaning upstream. Please remove it.

Quoted 17 lines
---
  drivers/firmware/arm_scmi/mailbox.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/firmware/arm_scmi/mailbox.c +1 -0
index b8d470417e8f..f6fe801c2e34 100644
@@ -8,6 +8,7 @@
 
  #include <linux/err.h>
  #include <linux/device.h>
+#include <linux/mailbox_controller.h>
  #include <linux/mailbox_client.h>
  #include <linux/of.h>
  #include <linux/of_address.h>

drivers/firmware/arm_scmi/mailbox.c static void mailbox_mark_txdone(struct scmi_chan_info *cinfo, int ret, · line 282

Quoted 8 lines
drivers/firmware/arm_scmi/mailbox.c +4 -1
@@ -275,7 +276,12 @@ static void mailbox_mark_txdone(struct scmi_chan_info *cinfo, int ret,
  	 * Unfortunately, we have to kick the mailbox framework after we have
  	 * received our message.
  	 */
-	mbox_client_txdone(smbox->chan, ret);
+
+	/*
+	 * With txdone_irq mode, kick can be done by mbox_chan_txdone.
+	 */

Besides, you need one single line for this comment

Regards,
Angelo

Quoted 5 lines
drivers/firmware/arm_scmi/mailbox.c +2 -0
+	if (!(smbox->chan->mbox->txdone_irq))
+		mbox_client_txdone(smbox->chan, ret);
  }
 
  static void mailbox_fetch_response(struct scmi_chan_info *cinfo,
#2 lore raw

Thanks to Angelo, V2 updated.

Best,
Pin-Chuan

Quoted 52 lines · AngeloGioacchino Del Regno

Il 01/02/24 05:52, Pin-Chuan Liu ha scritto:

Quoted 6 lines

On txdone_irq mode, tx_tick is done from mbox_chan_txdone. Calling to mbox_client_txdone could get error message and return directly, add a check to avoid this.

Change-Id Iacbe0d36ef9cc16974c013c3e94c47dc79eae52b

Change-Id is something internal to you and has no meaning upstream. Please remove it.

Quoted 23 lines
---
  drivers/firmware/arm_scmi/mailbox.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/firmware/arm_scmi/mailbox.c +1 -0
index b8d470417e8f..f6fe801c2e34 100644
@@ -8,6 +8,7 @@
 
  #include <linux/err.h>
  #include <linux/device.h>
+#include <linux/mailbox_controller.h>
  #include <linux/mailbox_client.h>
  #include <linux/of.h>
  #include <linux/of_address.h>
@@ -275,7 +276,12 @@ static void mailbox_mark_txdone(struct
 scmi_chan_info *cinfo, int ret,
  	 * Unfortunately, we have to kick the mailbox framework after

we have
* received our message.
*/

drivers/firmware/arm_scmi/mailbox.c static void mailbox_mark_txdone(struct scmi_chan_info *cinfo, int ret, · line 282

Quoted 5 lines
drivers/firmware/arm_scmi/mailbox.c +4 -1
-	mbox_client_txdone(smbox->chan, ret);
+
+	/*
+	 * With txdone_irq mode, kick can be done by mbox_chan_txdone.
+	 */

Besides, you need one single line for this comment

Regards,
Angelo

Quoted 5 lines
drivers/firmware/arm_scmi/mailbox.c +2 -0
+	if (!(smbox->chan->mbox->txdone_irq))
+		mbox_client_txdone(smbox->chan, ret);
  }
 
  static void mailbox_fetch_response(struct scmi_chan_info *cinfo,