From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, rander.wang@intel.com,
pierre-louis.bossart@linux.intel.com,
kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com
Subject: [PATCH 4/4] ASoC: SOF: Intel: ipc4: Ack a received reply or notification separately
Date: Tue, 18 Oct 2022 15:40:08 +0300 [thread overview]
Message-ID: <20221018124008.6846-5-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20221018124008.6846-1-peter.ujfalusi@linux.intel.com>
By acking a received message we tell the DSP that we have processed the
message (reply or notification) and we are open to receive a new one.
The original implementation did this in a common code after the received
message got handled as reply or notification.
With right timing this opens up a small window when we have processed the
reply and let the other thread proceed to send a new message to the DSP,
which is allowed as the DSP is free to receive message.
But when the message is received and processed by the DSP and it wants to
send a reply it will still see that the previous message has not been
acked, so it fails to send a reply. Later the first reply got acked by the
kernel, but it is too late and the in-flight message got a timeout due to
firmware not responding (which it tried, but could not).
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
---
sound/soc/sof/intel/cnl.c | 7 ++++---
sound/soc/sof/intel/hda-ipc.c | 7 ++++---
sound/soc/sof/intel/mtl.c | 5 +++--
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c
index 4bf233787757..da26f0ce9abc 100644
--- a/sound/soc/sof/intel/cnl.c
+++ b/sound/soc/sof/intel/cnl.c
@@ -72,6 +72,7 @@ irqreturn_t cnl_ipc4_irq_thread(int irq, void *context)
spin_lock_irq(&sdev->ipc_lock);
snd_sof_ipc_get_reply(sdev);
+ cnl_ipc_host_done(sdev);
snd_sof_ipc_reply(sdev, data->primary);
spin_unlock_irq(&sdev->ipc_lock);
@@ -88,10 +89,10 @@ irqreturn_t cnl_ipc4_irq_thread(int irq, void *context)
sdev->ipc->msg.rx_data = ¬ification_data;
snd_sof_ipc_msgs_rx(sdev);
sdev->ipc->msg.rx_data = NULL;
- }
- /* Let DSP know that we have finished processing the message */
- cnl_ipc_host_done(sdev);
+ /* Let DSP know that we have finished processing the message */
+ cnl_ipc_host_done(sdev);
+ }
ipc_irq = true;
}
diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c
index b4668c969a29..a7c454e03952 100644
--- a/sound/soc/sof/intel/hda-ipc.c
+++ b/sound/soc/sof/intel/hda-ipc.c
@@ -169,6 +169,7 @@ irqreturn_t hda_dsp_ipc4_irq_thread(int irq, void *context)
spin_lock_irq(&sdev->ipc_lock);
snd_sof_ipc_get_reply(sdev);
+ hda_dsp_ipc_host_done(sdev);
snd_sof_ipc_reply(sdev, data->primary);
spin_unlock_irq(&sdev->ipc_lock);
@@ -185,10 +186,10 @@ irqreturn_t hda_dsp_ipc4_irq_thread(int irq, void *context)
sdev->ipc->msg.rx_data = ¬ification_data;
snd_sof_ipc_msgs_rx(sdev);
sdev->ipc->msg.rx_data = NULL;
- }
- /* Let DSP know that we have finished processing the message */
- hda_dsp_ipc_host_done(sdev);
+ /* Let DSP know that we have finished processing the message */
+ hda_dsp_ipc_host_done(sdev);
+ }
ipc_irq = true;
}
diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c
index 9d1bc74395e7..054b9ab721ff 100644
--- a/sound/soc/sof/intel/mtl.c
+++ b/sound/soc/sof/intel/mtl.c
@@ -540,6 +540,7 @@ static irqreturn_t mtl_ipc_irq_thread(int irq, void *context)
spin_lock_irq(&sdev->ipc_lock);
snd_sof_ipc_get_reply(sdev);
+ mtl_ipc_host_done(sdev);
snd_sof_ipc_reply(sdev, data->primary);
spin_unlock_irq(&sdev->ipc_lock);
@@ -556,9 +557,9 @@ static irqreturn_t mtl_ipc_irq_thread(int irq, void *context)
sdev->ipc->msg.rx_data = ¬ification_data;
snd_sof_ipc_msgs_rx(sdev);
sdev->ipc->msg.rx_data = NULL;
- }
- mtl_ipc_host_done(sdev);
+ mtl_ipc_host_done(sdev);
+ }
ipc_irq = true;
}
--
2.38.0
next prev parent reply other threads:[~2022-10-18 12:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 12:40 [PATCH 0/4] ASoC: SOF: Intel: Harden the IPC4 low level sequencing Peter Ujfalusi
2022-10-18 12:40 ` [PATCH 1/4] ASoC: SOF: ipc4: Log the tx message before sending it Peter Ujfalusi
2022-10-18 12:40 ` [PATCH 2/4] ASoC: SOF: Intel: ipc4: Read the interrupt reason registers at the same time Peter Ujfalusi
2022-10-18 12:40 ` [PATCH 3/4] ASoC: SOF: Intel: ipc4: Wait for channel to be free before sending a message Peter Ujfalusi
2022-10-18 12:40 ` Peter Ujfalusi [this message]
2022-10-19 14:18 ` [PATCH 0/4] ASoC: SOF: Intel: Harden the IPC4 low level sequencing Mark Brown
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=20221018124008.6846-5-peter.ujfalusi@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@intel.com \
--cc=ranjani.sridharan@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox