mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
dmaengine fixes for v5.2
The fixes for 5.2 are: - bam_dma fix for completed descriptor count - fix for imx-sdma remove BD_INTR for channel0 and use-after-free on probe error path - endian bug fix in jz4780 IRQ handler -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJdIKs7AAoJEHwUBw8lI4NHlJMP/2b3q9I2E6tXXmI2vXrZPueP i0nSNbo18ACwXhF60v7E0jMs/TIYp18+Pu2TqsAv8rghl/GCJZwm65tMI9nEmlgi Jne8nIaXEHomQwuXOt4wqgIruX3gvBXiDxorUmPl1hU7dRuMQHSfYkDGRrp0ucKl I1ntgJUs51AiKTkLa6GrEXevpp1o34G+j0fZg/vu9vF4uiWmB1v0hxJSznEnkS4k NnQJ8+sSXmlqwUC/wnHKXKFsZu4MwRSYE+yWb2fCg8/PdZNGCxD+cMrudFskc1wo V1WfEufFbxV5z3YaO9a5Z+u9aTSWNW0xjFkPqCEbfduwyeSgrVjXlO9GRFMSAAMw aAXw1/KFl/asI/h4JsY7iIlg4xv7lKjcT3N0pE+/0SUvUvkENAYsU9MCbWEj+O5n MyH2URZJX1bqf1qcREB4+dPUlLbWgBU/U9lpFt2B2tO75T7zvij9jx1UfiH9SzOl FfylulXChYaFgDQY0UnfmveaUqd/Z/z+z5/ml1Dct0QxSWQREkBbNn3nTsV46Gn2 bvdaN3Fqiy8WZF3IK9SzsILuXMNmAMUyKoFCEdun/s/7ItK1y59hMZv1NloSrE7U m8Liz2OEdetDTHK1anCuaD8UaPua/9buYaSwVgeN3w6SoJ7usmjk2ol0aRwU8qK1 zPnVoLqy8FG6SXFzciCl =xnkJ -----END PGP SIGNATURE----- Merge tag 'dmaengine-fix-5.2' of git://git.infradead.org/users/vkoul/slave-dma Pull dmaengine fixes from Vinod Koul: - bam_dma fix for completed descriptor count - fix for imx-sdma remove BD_INTR for channel0 and use-after-free on probe error path - endian bug fix in jz4780 IRQ handler * tag 'dmaengine-fix-5.2' of git://git.infradead.org/users/vkoul/slave-dma: dmaengine: qcom: bam_dma: Fix completed descriptors count dmaengine: imx-sdma: remove BD_INTR for channel0 dmaengine: imx-sdma: fix use-after-free on probe error path dmaengine: jz4780: Fix an endian bug in IRQ handler
This commit is contained in:
commit
2692982b08
@ -718,12 +718,13 @@ static irqreturn_t jz4780_dma_irq_handler(int irq, void *data)
|
||||
{
|
||||
struct jz4780_dma_dev *jzdma = data;
|
||||
unsigned int nb_channels = jzdma->soc_data->nb_channels;
|
||||
uint32_t pending, dmac;
|
||||
unsigned long pending;
|
||||
uint32_t dmac;
|
||||
int i;
|
||||
|
||||
pending = jz4780_dma_ctrl_readl(jzdma, JZ_DMA_REG_DIRQP);
|
||||
|
||||
for_each_set_bit(i, (unsigned long *)&pending, nb_channels) {
|
||||
for_each_set_bit(i, &pending, nb_channels) {
|
||||
if (jz4780_dma_chan_irq(jzdma, &jzdma->chan[i]))
|
||||
pending &= ~BIT(i);
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
|
||||
spin_lock_irqsave(&sdma->channel_0_lock, flags);
|
||||
|
||||
bd0->mode.command = C0_SETPM;
|
||||
bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD;
|
||||
bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
|
||||
bd0->mode.count = size / 2;
|
||||
bd0->buffer_addr = buf_phys;
|
||||
bd0->ext_buffer_addr = address;
|
||||
@ -1025,7 +1025,7 @@ static int sdma_load_context(struct sdma_channel *sdmac)
|
||||
context->gReg[7] = sdmac->watermark_level;
|
||||
|
||||
bd0->mode.command = C0_SETDM;
|
||||
bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD;
|
||||
bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
|
||||
bd0->mode.count = sizeof(*context) / 4;
|
||||
bd0->buffer_addr = sdma->context_phys;
|
||||
bd0->ext_buffer_addr = 2048 + (sizeof(*context) / 4) * channel;
|
||||
@ -2096,27 +2096,6 @@ static int sdma_probe(struct platform_device *pdev)
|
||||
if (pdata && pdata->script_addrs)
|
||||
sdma_add_scripts(sdma, pdata->script_addrs);
|
||||
|
||||
if (pdata) {
|
||||
ret = sdma_get_firmware(sdma, pdata->fw_name);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev, "failed to get firmware from platform data\n");
|
||||
} else {
|
||||
/*
|
||||
* Because that device tree does not encode ROM script address,
|
||||
* the RAM script in firmware is mandatory for device tree
|
||||
* probe, otherwise it fails.
|
||||
*/
|
||||
ret = of_property_read_string(np, "fsl,sdma-ram-script-name",
|
||||
&fw_name);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev, "failed to get firmware name\n");
|
||||
else {
|
||||
ret = sdma_get_firmware(sdma, fw_name);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev, "failed to get firmware from device tree\n");
|
||||
}
|
||||
}
|
||||
|
||||
sdma->dma_device.dev = &pdev->dev;
|
||||
|
||||
sdma->dma_device.device_alloc_chan_resources = sdma_alloc_chan_resources;
|
||||
@ -2161,6 +2140,33 @@ static int sdma_probe(struct platform_device *pdev)
|
||||
of_node_put(spba_bus);
|
||||
}
|
||||
|
||||
/*
|
||||
* Kick off firmware loading as the very last step:
|
||||
* attempt to load firmware only if we're not on the error path, because
|
||||
* the firmware callback requires a fully functional and allocated sdma
|
||||
* instance.
|
||||
*/
|
||||
if (pdata) {
|
||||
ret = sdma_get_firmware(sdma, pdata->fw_name);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev, "failed to get firmware from platform data\n");
|
||||
} else {
|
||||
/*
|
||||
* Because that device tree does not encode ROM script address,
|
||||
* the RAM script in firmware is mandatory for device tree
|
||||
* probe, otherwise it fails.
|
||||
*/
|
||||
ret = of_property_read_string(np, "fsl,sdma-ram-script-name",
|
||||
&fw_name);
|
||||
if (ret) {
|
||||
dev_warn(&pdev->dev, "failed to get firmware name\n");
|
||||
} else {
|
||||
ret = sdma_get_firmware(sdma, fw_name);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev, "failed to get firmware from device tree\n");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_register:
|
||||
|
@ -799,6 +799,9 @@ static u32 process_channel_irqs(struct bam_device *bdev)
|
||||
/* Number of bytes available to read */
|
||||
avail = CIRC_CNT(offset, bchan->head, MAX_DESCRIPTORS + 1);
|
||||
|
||||
if (offset < bchan->head)
|
||||
avail--;
|
||||
|
||||
list_for_each_entry_safe(async_desc, tmp,
|
||||
&bchan->desc_list, desc_node) {
|
||||
/* Not enough data to read */
|
||||
|
Loading…
Reference in New Issue
Block a user