[PATCH 4/4] ASoC: SOF: amd: Add branch prediction hint in ACP IRQ handler

Cristian Ciocaltea posted 4 patches 10 months, 2 weeks ago
[PATCH 4/4] ASoC: SOF: amd: Add branch prediction hint in ACP IRQ handler
Posted by Cristian Ciocaltea 10 months, 2 weeks ago
The conditional involving sdev->first_boot in acp_sof_ipc_irq_thread()
will succeed only once, i.e. during the very first run of the
DSP firmware.

Use the unlikely() annotation to help improve branch prediction
accuracy.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 sound/soc/sof/amd/acp-ipc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/amd/acp-ipc.c b/sound/soc/sof/amd/acp-ipc.c
index 12caefd08788595be8de03a863b88b5bbc15847d..22d4b807e1bb75e6f4e6dbf161d79b1a43808004 100644
--- a/sound/soc/sof/amd/acp-ipc.c
+++ b/sound/soc/sof/amd/acp-ipc.c
@@ -165,7 +165,7 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context)
 	int dsp_msg, dsp_ack;
 	unsigned int status;
 
-	if (sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE) {
+	if (unlikely(sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE)) {
 		acp_mailbox_read(sdev, sdev->dsp_box.offset, &status, sizeof(status));
 
 		if ((status & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {

-- 
2.48.1
Re: [PATCH 4/4] ASoC: SOF: amd: Add branch prediction hint in ACP IRQ handler
Posted by potturu venkata prasad 10 months, 1 week ago
On 2/7/25 17:16, Cristian Ciocaltea wrote:
> The conditional involving sdev->first_boot in acp_sof_ipc_irq_thread()
> will succeed only once, i.e. during the very first run of the
> DSP firmware.
>
> Use the unlikely() annotation to help improve branch prediction
> accuracy.
Okay.
Reviewed-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
>
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
>   sound/soc/sof/amd/acp-ipc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/sof/amd/acp-ipc.c b/sound/soc/sof/amd/acp-ipc.c
> index 12caefd08788595be8de03a863b88b5bbc15847d..22d4b807e1bb75e6f4e6dbf161d79b1a43808004 100644
> --- a/sound/soc/sof/amd/acp-ipc.c
> +++ b/sound/soc/sof/amd/acp-ipc.c
> @@ -165,7 +165,7 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context)
>   	int dsp_msg, dsp_ack;
>   	unsigned int status;
>   
> -	if (sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE) {
> +	if (unlikely(sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE)) {
>   		acp_mailbox_read(sdev, sdev->dsp_box.offset, &status, sizeof(status));
>   
>   		if ((status & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {
>