Skip to contentSkip to conversation

ASoC: SOF: imx8: Fix dsp_box offset

PATCH In review Pierre-Louis Bossart 2 participants 2 messages Dec 20, 2019 – Dec 25, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: SOF: imx8: Fix dsp_box offset

From: Daniel Baluta <[email protected]>

dsp_box is used to keep DSP initiated messages. The value of dsp_offset is set by the DSP with the first message, so we need a way to bootstrap it in order to get the first message.

We do this by setting the correct default dsp_box offset which on i.MX8 is not zero.

Very interesting is why it has worked until now.

On i.MX8, DSP communicates with ARM core using a shared SDRAM memory area. Actually, there are two shared areas:
* SDRAM0 - starting at 0x92400000, size 0x800000
* SDRAM1 - starting at 0x92C00000, size 0x800000

SDRAM0 keeps the data sections, starting with .rodata. By chance fw_ready structure was placed at the beginning of .rodata.

dsp_box_base is defined as SDRAM0 + dsp_box_offset and it is placed at the beginning of SDRAM1 (dsp_box_offset should be 0x800000). But because it is zero initialized by default it points to SDRAM0 where by chance the fw_ready was placed in the SOF firmware.

Anyhow, SOF commit 7466bee378dd811b ("clk: make freq arrays constant") fw_ready is no longer at the beginning of SDRAM0 and everything shows how lucky we were until now.

Fix this by properly setting the default dsp_box offset.

Fixes 202acc565a1f050 ("ASoC: SOF: imx: Add i.MX8 HW support")
---
 sound/soc/sof/imx/imx8.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/sof/imx/imx8.c +3 -0
index cfefcfd92798..dca85cf07ffa 100644
@@ -304,6 +304,9 @@ static int imx8_probe(struct snd_sof_dev *sdev)
 	}
 	sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM;
 
+	/* set default mailbox offset for FW ready message */
+	sdev->dsp_box.offset = MBOX_OFFSET;
+
 	return 0;
 
 exit_pdev_unregister:
Signature · 6 lines
2.20.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer
#1 lore raw

[alsa-devel] Applied "ASoC: SOF: imx8: Fix dsp_box offset" to the asoc tree

The patch

ASoC: SOF: imx8: Fix dsp_box offset

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

From dcf08d0f8f09081b16f69071dd55d51d5e964e84 Mon Sep 17 00:00:00 2001
From: Daniel Baluta <[email protected]>
Date: Fri, 20 Dec 2019 11:05:31 -0600
Subject: [PATCH] ASoC: SOF: imx8: Fix dsp_box offset

dsp_box is used to keep DSP initiated messages. The value of dsp_offset is set by the DSP with the first message, so we need a way to bootstrap it in order to get the first message.

We do this by setting the correct default dsp_box offset which on i.MX8 is not zero.

Very interesting is why it has worked until now.

On i.MX8, DSP communicates with ARM core using a shared SDRAM memory area. Actually, there are two shared areas:
* SDRAM0 - starting at 0x92400000, size 0x800000
* SDRAM1 - starting at 0x92C00000, size 0x800000

SDRAM0 keeps the data sections, starting with .rodata. By chance fw_ready structure was placed at the beginning of .rodata.

dsp_box_base is defined as SDRAM0 + dsp_box_offset and it is placed at the beginning of SDRAM1 (dsp_box_offset should be 0x800000). But because it is zero initialized by default it points to SDRAM0 where by chance the fw_ready was placed in the SOF firmware.

Anyhow, SOF commit 7466bee378dd811b ("clk: make freq arrays constant") fw_ready is no longer at the beginning of SDRAM0 and everything shows how lucky we were until now.

Fix this by properly setting the default dsp_box offset.

Fixes 202acc565a1f050 ("ASoC: SOF: imx: Add i.MX8 HW support")
---
 sound/soc/sof/imx/imx8.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/sof/imx/imx8.c +3 -0
index 9d926b1df0d7..aef6ca167b9c 100644
@@ -304,6 +304,9 @@ static int imx8_probe(struct snd_sof_dev *sdev)
 	}
 	sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM;
 
+	/* set default mailbox offset for FW ready message */
+	sdev->dsp_box.offset = MBOX_OFFSET;
+
 	return 0;
 
 exit_pdev_unregister:
Signature · 6 lines
2.20.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel