Commit e2dacf6c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull dmaengine fixes from Vinod Koul:
 "A couple of core fixes and odd driver fixes for dmaengine subsystem:

  Core:
   - drop ACPI CSRT table reference after using it
   - fix of_dma_router_xlate() error handling

  Drivers fixes in idxd, at_hdmac, pl330, dw-edma and jz478"

* tag 'dmaengine-fix-5.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine:
  dmaengine: ti: k3-udma: Update rchan_oes_offset for am654 SYSFW ABI 3.0
  drivers/dma/dma-jz4780: Fix race condition between probe and irq handler
  dmaengine: dw-edma: Fix scatter-gather address calculation
  dmaengine: ti: k3-udma: Fix the TR initialization for prep_slave_sg
  dmaengine: pl330: Fix burst length if burst size is smaller than bus width
  dmaengine: at_hdmac: add missing kfree() call in at_dma_xlate()
  dmaengine: at_hdmac: add missing put_device() call in at_dma_xlate()
  dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
  dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling
  dmaengine: idxd: reset states after device disable or reset
  dmaengine: acpi: Put the CSRT table after using it
parents 86edf52e 46815bf4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -135,11 +135,13 @@ static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma)
		if (ret < 0) {
			dev_warn(&adev->dev,
				 "error in parsing resource group\n");
			return;
			break;
		}

		grp = (struct acpi_csrt_group *)((void *)grp + grp->length);
	}

	acpi_put_table((struct acpi_table_header *)csrt);
}

/**
+9 −2
Original line number Diff line number Diff line
@@ -1650,13 +1650,17 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
		return NULL;

	dmac_pdev = of_find_device_by_node(dma_spec->np);
	if (!dmac_pdev)
		return NULL;

	dma_cap_zero(mask);
	dma_cap_set(DMA_SLAVE, mask);

	atslave = kmalloc(sizeof(*atslave), GFP_KERNEL);
	if (!atslave)
	if (!atslave) {
		put_device(&dmac_pdev->dev);
		return NULL;
	}

	atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW;
	/*
@@ -1685,8 +1689,11 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
	atslave->dma_dev = &dmac_pdev->dev;

	chan = dma_request_channel(mask, at_dma_filter, atslave);
	if (!chan)
	if (!chan) {
		put_device(&dmac_pdev->dev);
		kfree(atslave);
		return NULL;
	}

	atchan = to_at_dma_chan(chan);
	atchan->per_if = dma_spec->args[0] & 0xff;
+19 −19
Original line number Diff line number Diff line
@@ -879,24 +879,11 @@ static int jz4780_dma_probe(struct platform_device *pdev)
		return -EINVAL;
	}

	ret = platform_get_irq(pdev, 0);
	if (ret < 0)
		return ret;

	jzdma->irq = ret;

	ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
			  jzdma);
	if (ret) {
		dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
		return ret;
	}

	jzdma->clk = devm_clk_get(dev, NULL);
	if (IS_ERR(jzdma->clk)) {
		dev_err(dev, "failed to get clock\n");
		ret = PTR_ERR(jzdma->clk);
		goto err_free_irq;
		return ret;
	}

	clk_prepare_enable(jzdma->clk);
@@ -949,10 +936,23 @@ static int jz4780_dma_probe(struct platform_device *pdev)
		jzchan->vchan.desc_free = jz4780_dma_desc_free;
	}

	ret = platform_get_irq(pdev, 0);
	if (ret < 0)
		goto err_disable_clk;

	jzdma->irq = ret;

	ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
			  jzdma);
	if (ret) {
		dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
		goto err_disable_clk;
	}

	ret = dmaenginem_async_device_register(dd);
	if (ret) {
		dev_err(dev, "failed to register device\n");
		goto err_disable_clk;
		goto err_free_irq;
	}

	/* Register with OF DMA helpers. */
@@ -960,17 +960,17 @@ static int jz4780_dma_probe(struct platform_device *pdev)
					 jzdma);
	if (ret) {
		dev_err(dev, "failed to register OF DMA controller\n");
		goto err_disable_clk;
		goto err_free_irq;
	}

	dev_info(dev, "JZ4780 DMA controller initialised\n");
	return 0;

err_disable_clk:
	clk_disable_unprepare(jzdma->clk);

err_free_irq:
	free_irq(jzdma->irq, jzdma);

err_disable_clk:
	clk_disable_unprepare(jzdma->clk);
	return ret;
}

+6 −5
Original line number Diff line number Diff line
@@ -405,7 +405,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
			if (xfer->cyclic) {
				burst->dar = xfer->xfer.cyclic.paddr;
			} else {
				burst->dar = sg_dma_address(sg);
				burst->dar = dst_addr;
				/* Unlike the typical assumption by other
				 * drivers/IPs the peripheral memory isn't
				 * a FIFO memory, in this case, it's a
@@ -413,14 +413,13 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
				 * and destination addresses are increased
				 * by the same portion (data length)
				 */
				src_addr += sg_dma_len(sg);
			}
		} else {
			burst->dar = dst_addr;
			if (xfer->cyclic) {
				burst->sar = xfer->xfer.cyclic.paddr;
			} else {
				burst->sar = sg_dma_address(sg);
				burst->sar = src_addr;
				/* Unlike the typical assumption by other
				 * drivers/IPs the peripheral memory isn't
				 * a FIFO memory, in this case, it's a
@@ -428,13 +427,15 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
				 * and destination addresses are increased
				 * by the same portion (data length)
				 */
				dst_addr += sg_dma_len(sg);
			}
		}

		if (!xfer->cyclic)
		if (!xfer->cyclic) {
			src_addr += sg_dma_len(sg);
			dst_addr += sg_dma_len(sg);
			sg = sg_next(sg);
		}
	}

	return vchan_tx_prep(&chan->vc, &desc->vd, xfer->flags);

+26 −0
Original line number Diff line number Diff line
@@ -410,10 +410,27 @@ int idxd_device_enable(struct idxd_device *idxd)
	return 0;
}

void idxd_device_wqs_clear_state(struct idxd_device *idxd)
{
	int i;

	lockdep_assert_held(&idxd->dev_lock);

	for (i = 0; i < idxd->max_wqs; i++) {
		struct idxd_wq *wq = &idxd->wqs[i];

		if (wq->state == IDXD_WQ_ENABLED) {
			idxd_wq_disable_cleanup(wq);
			wq->state = IDXD_WQ_DISABLED;
		}
	}
}

int idxd_device_disable(struct idxd_device *idxd)
{
	struct device *dev = &idxd->pdev->dev;
	u32 status;
	unsigned long flags;

	if (!idxd_is_enabled(idxd)) {
		dev_dbg(dev, "Device is not enabled\n");
@@ -429,13 +446,22 @@ int idxd_device_disable(struct idxd_device *idxd)
		return -ENXIO;
	}

	spin_lock_irqsave(&idxd->dev_lock, flags);
	idxd_device_wqs_clear_state(idxd);
	idxd->state = IDXD_DEV_CONF_READY;
	spin_unlock_irqrestore(&idxd->dev_lock, flags);
	return 0;
}

void idxd_device_reset(struct idxd_device *idxd)
{
	unsigned long flags;

	idxd_cmd_exec(idxd, IDXD_CMD_RESET_DEVICE, 0, NULL);
	spin_lock_irqsave(&idxd->dev_lock, flags);
	idxd_device_wqs_clear_state(idxd);
	idxd->state = IDXD_DEV_CONF_READY;
	spin_unlock_irqrestore(&idxd->dev_lock, flags);
}

/* Device configuration bits */
Loading