Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1246535 > unrolled thread
| Started by | Vinod Koul <vinod.koul@intel.com> |
|---|---|
| First post | 2015-10-14 13:30 +0200 |
| Last post | 2015-10-14 15:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH V2 2/2] dmaengine: tegra-adma: Add support for Tegra210 ADMA Vinod Koul <vinod.koul@intel.com> - 2015-10-14 13:30 +0200
Re: [PATCH V2 2/2] dmaengine: tegra-adma: Add support for Tegra210 ADMA Jon Hunter <jonathanh@nvidia.com> - 2015-10-14 15:40 +0200
| From | Vinod Koul <vinod.koul@intel.com> |
|---|---|
| Date | 2015-10-14 13:30 +0200 |
| Subject | Re: [PATCH V2 2/2] dmaengine: tegra-adma: Add support for Tegra210 ADMA |
| Message-ID | <qjspQ-5qz-5@gated-at.bofh.it> |
On Mon, Oct 05, 2015 at 01:10:07PM +0100, Jon Hunter wrote:
> +static enum dma_status tegra_adma_tx_status(struct dma_chan *dc,
> + dma_cookie_t cookie,
> + struct dma_tx_state *txstate)
> +{
> + struct tegra_adma_chan *tdc = to_tegra_adma_chan(dc);
> + struct tegra_adma_desc *desc;
> + struct virt_dma_desc *vd;
> + enum dma_status ret;
> + unsigned long flags;
> + unsigned int residual;
> +
> + spin_lock_irqsave(&tdc->lock, flags);
> +
> + ret = dma_cookie_status(dc, cookie, txstate);
> + if (ret == DMA_COMPLETE) {
> + spin_unlock_irqrestore(&tdc->lock, flags);
> + return ret;
> + }
txstate can be NULL, upon which below code doesn't help in getting executed
so bailing here or above case is fine
> +static struct dma_async_tx_descriptor *tegra_adma_prep_dma_cyclic(
> + struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_len,
> + size_t period_len, enum dma_transfer_direction direction,
> + unsigned long flags)
> +{
> + struct tegra_adma_chan *tdc = to_tegra_adma_chan(dc);
> + struct tegra_adma_desc *desc = NULL;
> +
> + if (!tdc->config_valid) {
> + dev_err(tdc2dev(tdc), "ADMA slave configuration not set\n");
> + return NULL;
> + }
> +
> + if (!buf_len || !period_len || period_len > ADMA_CH_TC_COUNT_MASK) {
> + dev_err(tdc2dev(tdc), "invalid buffer/period len\n");
> + return NULL;
> + }
> +
> + if (buf_len % period_len) {
> + dev_err(tdc2dev(tdc), "buf_len not a multiple of period_len\n");
> + return NULL;
> + }
> +
> + if (!IS_ALIGNED(buf_addr, 4)) {
> + dev_err(tdc2dev(tdc), "invalid buffer alignment\n");
> + return NULL;
> + }
> +
> + desc = kzalloc(sizeof(*desc), GFP_ATOMIC);
we recommend GFP_NOWAIT for the subsystem
> +static int tegra_adma_remove(struct platform_device *pdev)
> +{
> + struct tegra_adma *tdma = platform_get_drvdata(pdev);
> + struct tegra_adma_chan *tdc;
> + int i;
> +
> + dma_async_device_unregister(&tdma->dma_dev);
> +
> + for (i = 0; i < tdma->nr_channels; ++i) {
> + tdc = &tdma->channels[i];
> + tasklet_kill(&tdc->vc.task);
> + }
this is good, but your irq is still active and can fire and thus trigger
more tasklets!
--
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jon Hunter <jonathanh@nvidia.com> |
|---|---|
| Date | 2015-10-14 15:40 +0200 |
| Message-ID | <qjurF-8nB-31@gated-at.bofh.it> |
| In reply to | #1246535 |
On 14/10/15 12:27, Vinod Koul wrote:
> On Mon, Oct 05, 2015 at 01:10:07PM +0100, Jon Hunter wrote:
>
>> +static enum dma_status tegra_adma_tx_status(struct dma_chan *dc,
>> + dma_cookie_t cookie,
>> + struct dma_tx_state *txstate)
>> +{
>> + struct tegra_adma_chan *tdc = to_tegra_adma_chan(dc);
>> + struct tegra_adma_desc *desc;
>> + struct virt_dma_desc *vd;
>> + enum dma_status ret;
>> + unsigned long flags;
>> + unsigned int residual;
>> +
>> + spin_lock_irqsave(&tdc->lock, flags);
>> +
>> + ret = dma_cookie_status(dc, cookie, txstate);
>> + if (ret == DMA_COMPLETE) {
>> + spin_unlock_irqrestore(&tdc->lock, flags);
>> + return ret;
>> + }
>
> txstate can be NULL, upon which below code doesn't help in getting executed
> so bailing here or above case is fine
Ok, will fix.
>> +static struct dma_async_tx_descriptor *tegra_adma_prep_dma_cyclic(
>> + struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_len,
>> + size_t period_len, enum dma_transfer_direction direction,
>> + unsigned long flags)
>> +{
>> + struct tegra_adma_chan *tdc = to_tegra_adma_chan(dc);
>> + struct tegra_adma_desc *desc = NULL;
>> +
>> + if (!tdc->config_valid) {
>> + dev_err(tdc2dev(tdc), "ADMA slave configuration not set\n");
>> + return NULL;
>> + }
>> +
>> + if (!buf_len || !period_len || period_len > ADMA_CH_TC_COUNT_MASK) {
>> + dev_err(tdc2dev(tdc), "invalid buffer/period len\n");
>> + return NULL;
>> + }
>> +
>> + if (buf_len % period_len) {
>> + dev_err(tdc2dev(tdc), "buf_len not a multiple of period_len\n");
>> + return NULL;
>> + }
>> +
>> + if (!IS_ALIGNED(buf_addr, 4)) {
>> + dev_err(tdc2dev(tdc), "invalid buffer alignment\n");
>> + return NULL;
>> + }
>> +
>> + desc = kzalloc(sizeof(*desc), GFP_ATOMIC);
>
> we recommend GFP_NOWAIT for the subsystem
Ok, makes sense. I should probably fix up the tegra APB dma driver too.
>> +static int tegra_adma_remove(struct platform_device *pdev)
>> +{
>> + struct tegra_adma *tdma = platform_get_drvdata(pdev);
>> + struct tegra_adma_chan *tdc;
>> + int i;
>> +
>> + dma_async_device_unregister(&tdma->dma_dev);
>> +
>> + for (i = 0; i < tdma->nr_channels; ++i) {
>> + tdc = &tdma->channels[i];
>> + tasklet_kill(&tdc->vc.task);
>> + }
> this is good, but your irq is still active and can fire and thus trigger
> more tasklets!
Ah, yes. Will fix.
Thanks!
Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web