Skip to contentSkip to conversation

ASoC: Intel: Fix Baytrail SST DSP firmware loading

PATCH Applied Jarkko Nikula 2 participants 12 messages May 9, 2014 – May 14, 2014

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

PATCH 1/2 ASoC: Intel: Fix Baytrail SST DSP firmware loading

Commit 10df350977b1 ("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") caused following regression in Baytrail SST:

baytrail-pcm-audio baytrail-pcm-audio: error: DMA alloc failed baytrail-pcm-audio baytrail-pcm-audio: error: failed to load firmware

Fix this by calling dma_coerce_mask_and_coherent() in sst_byt_init() with the same dma_dev device what is now used in sst_fw_new() when allocating the DMA buffer.

---
 sound/soc/intel/sst-baytrail-dsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/sst-baytrail-dsp.c +1 -1
index 4a5d489e520b..fc588764ffa3 100644
@@ -324,7 +324,7 @@ static int sst_byt_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 		return ret;
 	}
 
-	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
+	ret = dma_coerce_mask_and_coherent(sst->dma_dev, DMA_BIT_MASK(32));
 	if (ret)
 		return ret;
 
Signature · 1 line
2.0.0.rc0
#1 lore raw

PATCH 2/2 ASoC: Intel: Use ACPI device for Baytrail PCM buffer allocation

This follows the same idea than commit 10df350977b1
("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") by using only ACPI device for all DMA allocations. Since DMA masking is already done in firmware loading it can be removed from here.

---
 sound/soc/intel/sst-baytrail-pcm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
sound/soc/intel/sst-baytrail-pcm.c +3 -5
index 00a2118d20f5..0afb3491f5f0 100644
@@ -319,18 +319,16 @@ static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_pcm *pcm = rtd->pcm;
 	size_t size;
+	struct snd_soc_platform *platform = rtd->platform;
+	struct sst_pdata *pdata = dev_get_platdata(platform->dev);
 	int ret = 0;
 
-	ret = dma_coerce_mask_and_coherent(rtd->card->dev, DMA_BIT_MASK(32));
-	if (ret)
-		return ret;
-
 	if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
 	    pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
 		size = sst_byt_pcm_hardware.buffer_bytes_max;
 		ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
 							    SNDRV_DMA_TYPE_DEV,
-							    rtd->card->dev,
+							    pdata->dma_dev,
 							    size, size);
 		if (ret) {
 			dev_err(rtd->dev, "dma buffer allocation failed %d\n",
Signature · 1 line
2.0.0.rc0
maintainer
#2 lore raw

Re: [PATCH 2/2] ASoC: Intel: Use ACPI device for Baytrail PCM buffer allocation

Quoted 4 lines · Jarkko Nikula

This follows the same idea than commit 10df350977b1
("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") by using only ACPI device for all DMA allocations. Since DMA masking is already done in firmware loading it can be removed from here.

Is this needed as a bug fix?

#3 lore raw

Re: [PATCH 2/2] ASoC: Intel: Use ACPI device for Baytrail PCM buffer allocation

Quoted 6 lines · Mark Brown
Quoted 4 lines · Jarkko Nikula

This follows the same idea than commit 10df350977b1
("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") by using only ACPI device for all DMA allocations. Since DMA masking is already done in firmware loading it can be removed from here.

Is this needed as a bug fix?

Not really. AFAIK this IOMMU issues doesn't hit on Baytrail so this 2/2 is more like keeping code in sync.

Signature · 1 line
Jarkko
maintainer Applied
#4 lore raw

Re: [PATCH 2/2] ASoC: Intel: Use ACPI device for Baytrail PCM buffer allocation

In reply to Jarkko Nikula
Quoted 4 lines · Jarkko Nikula

This follows the same idea than commit 10df350977b1
("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") by using only ACPI device for all DMA allocations. Since DMA masking is already done in firmware loading it can be removed from here.

Applied, thanks.

maintainer
#5 lore raw
In reply to Jarkko Nikula
Quoted 5 lines · Jarkko Nikula

Commit 10df350977b1 ("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") caused following regression in Baytrail SST:

baytrail-pcm-audio baytrail-pcm-audio: error: DMA alloc failed baytrail-pcm-audio baytrail-pcm-audio: error: failed to load firmware

Is this needed on fix/intel? If so it doesn't apply there...

#6 lore raw
Quoted 7 lines · Mark Brown
Quoted 5 lines · Jarkko Nikula

Commit 10df350977b1 ("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") caused following regression in Baytrail SST:

baytrail-pcm-audio baytrail-pcm-audio: error: DMA alloc failed baytrail-pcm-audio baytrail-pcm-audio: error: failed to load firmware

Is this needed on fix/intel? If so it doesn't apply there...

Indeed it doesn't. I accidentally made it on top of my suspend/resume set and it appears to conflict without [PATCH 4/7] ASoC: Intel: Move Baytrail extended fw address saving to sst_byt_boot()".

In case you are thinking to queue Liam's 10df350977b1 as a fix Is it ok if I resend this on top of it and handle conflict when merging origin/topic/intel?

Signature · 1 line
Jarkko
maintainer
#7 lore raw
Quoted 3 lines · Jarkko Nikula

In case you are thinking to queue Liam's 10df350977b1 as a fix Is it ok if I resend this on top of it and handle conflict when merging origin/topic/intel?

Yes, it's on my fix/intel branch - please send a fix based off that.

#8 lore raw

PATCH v2 1/1 ASoC: Intel: Fix Baytrail SST DSP firmware loading

Commit 10df350977b1 ("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") caused following regression in Baytrail SST:

baytrail-pcm-audio baytrail-pcm-audio: error: DMA alloc failed baytrail-pcm-audio baytrail-pcm-audio: error: failed to load firmware

Fix this by calling dma_coerce_mask_and_coherent() in sst_byt_init() with the same dma_dev device what is now used in sst_fw_new() when allocating the DMA buffer.

---
For fix/intel branch.

---
 sound/soc/intel/sst-baytrail-dsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/sst-baytrail-dsp.c +1 -1
index a50bf7fc0e3a..adf0aca5aca6 100644
@@ -324,7 +324,7 @@ static int sst_byt_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 	memcpy_toio(sst->addr.lpe + SST_BYT_MAILBOX_OFFSET,
 	       &pdata->fw_base, sizeof(u32));
 
-	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
+	ret = dma_coerce_mask_and_coherent(sst->dma_dev, DMA_BIT_MASK(32));
 	if (ret)
 		return ret;
 
Signature · 1 line
2.0.0.rc0
maintainer Applied
#9 lore raw
Quoted 2 lines · Jarkko Nikula

Commit 10df350977b1 ("ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.") caused following regression in Baytrail SST:

Applied, thanks.

maintainer
#10 lore raw
In reply to Jarkko Nikula

sound/soc/intel/sst-baytrail-dsp.c static int sst_byt_init(struct sst_dsp *sst, struct sst_pdata *pdata) · line 329

Quoted 4 lines · Jarkko Nikula
sound/soc/intel/sst-baytrail-dsp.c +1 -1
-	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
+	ret = dma_coerce_mask_and_coherent(sst->dma_dev, DMA_BIT_MASK(32));
 	if (ret)
 		return ret;

My resolution of the merge of your revised version and topic/intel looks like this so I *think* it's OK but please check that I did the right thing.

#11 lore raw
Quoted 9 lines · Mark Brown

sound/soc/intel/sst-baytrail-dsp.c static int sst_byt_init(struct sst_dsp *sst, struct sst_pdata *pdata) · line 329

Quoted 4 lines · Jarkko Nikula
sound/soc/intel/sst-baytrail-dsp.c +1 -1
-	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
+	ret = dma_coerce_mask_and_coherent(sst->dma_dev, DMA_BIT_MASK(32));
  	if (ret)
  		return ret;

My resolution of the merge of your revised version and topic/intel looks like this so I *think* it's OK but please check that I did the right thing.

Thanks, it's ok! And sorry the mess, I was somehow blind to see Liam's patch being 3.15 material. Hurry to weekend I guess.

Signature · 1 line
Jarkko