Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10df3509 authored by Liam Girdwood's avatar Liam Girdwood Committed by Mark Brown
Browse files

ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled.



The Intel IOMMU requires that the ACPI device is used to allocate all
DMA memory buffers. This means we need to pass the DMA device pointer into child
component devices that allocate DMA memory.

We also only set the DMA mask for the ACPI device now instead of for each
component device.

Signed-off-by: default avatarLiam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 0b708c87
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ static int sst_acpi_probe(struct platform_device *pdev)

	sst_pdata = &sst_acpi->sst_pdata;
	sst_pdata->id = desc->sst_id;
	sst_pdata->dma_dev = dev;
	sst_acpi->desc = desc;
	sst_acpi->mach = mach;

+1 −0
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ struct sst_dsp {
	spinlock_t spinlock;	/* IPC locking */
	struct mutex mutex;	/* DSP FW lock */
	struct device *dev;
	struct device *dma_dev;
	void *thread_context;
	int irq;
	u32 id;
+1 −0
Original line number Diff line number Diff line
@@ -337,6 +337,7 @@ struct sst_dsp *sst_dsp_new(struct device *dev,
	spin_lock_init(&sst->spinlock);
	mutex_init(&sst->mutex);
	sst->dev = dev;
	sst->dma_dev = pdata->dma_dev;
	sst->thread_context = sst_dev->thread_context;
	sst->sst_dev = sst_dev;
	sst->id = pdata->id;
+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ struct sst_pdata {
	u32 dma_base;
	u32 dma_size;
	int dma_engine;
	struct device *dma_dev;

	/* DSP */
	u32 id;
+2 −8
Original line number Diff line number Diff line
@@ -57,14 +57,8 @@ struct sst_fw *sst_fw_new(struct sst_dsp *dsp,
	sst_fw->private = private;
	sst_fw->size = fw->size;

	err = dma_coerce_mask_and_coherent(dsp->dev, DMA_BIT_MASK(32));
	if (err < 0) {
		kfree(sst_fw);
		return NULL;
	}

	/* allocate DMA buffer to store FW data */
	sst_fw->dma_buf = dma_alloc_coherent(dsp->dev, sst_fw->size,
	sst_fw->dma_buf = dma_alloc_coherent(dsp->dma_dev, sst_fw->size,
				&sst_fw->dmable_fw_paddr, GFP_DMA | GFP_KERNEL);
	if (!sst_fw->dma_buf) {
		dev_err(dsp->dev, "error: DMA alloc failed\n");
@@ -106,7 +100,7 @@ void sst_fw_free(struct sst_fw *sst_fw)
	list_del(&sst_fw->list);
	mutex_unlock(&dsp->mutex);

	dma_free_coherent(dsp->dev, sst_fw->size, sst_fw->dma_buf,
	dma_free_coherent(dsp->dma_dev, sst_fw->size, sst_fw->dma_buf,
			sst_fw->dmable_fw_paddr);
	kfree(sst_fw);
}
Loading