From: Russell King - ARM Linux <linux@arm•linux.org.uk>
To: Dan Williams <dan.j.williams@intel•com>,Vinod Koul
<vinod.koul@intel•com>
Cc: linuxppc-dev@lists•ozlabs.org,
Stephen Warren <swarren@nvidia•com>,
linux-arm-kernel@lists•infradead.org
Subject: [PATCH 9/9] dmaengine: ensure all DMA engine drivers initialize their cookies
Date: Tue, 06 Mar 2012 22:36:27 +0000 [thread overview]
Message-ID: <E1S52zb-0002NE-La@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20120306223321.GD15201@n2100.arm.linux.org.uk>
Ensure all DMA engine drivers initialize their cookies in the same way,
so that they all behave in a similar fashion. This means their first
issued cookie will be 2 rather than 1, and will increment to INT_MAX
before returning 1 and starting over.
In connection with this, Dan Williams said:
> Russell King wrote:
> > Secondly, some DMA engine drivers initialize the dma_chan cookie to 0,
> > others to 1. Is there a reason for this, or are these all buggy?
>
> I know that ioat and iop-adma expect 0 to mean "I have cleaned up this
> descriptor and it is idle", and would break if zero was an in-flight
> cookie value. The reserved usage of zero is an driver internal
> concern, but I have no problem formalizing it as a reserved value.
Signed-off-by: Russell King <rmk+kernel@arm•linux.org.uk>
---
drivers/dma/fsldma.c | 1 +
drivers/dma/imx-dma.c | 1 +
drivers/dma/imx-sdma.c | 1 +
drivers/dma/ioat/dma.c | 1 +
drivers/dma/iop-adma.c | 1 +
drivers/dma/mv_xor.c | 1 +
drivers/dma/mxs-dma.c | 1 +
drivers/dma/ppc4xx/adma.c | 1 +
drivers/dma/shdma.c | 1 +
9 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 2f6c806..7d7384b 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1292,6 +1292,7 @@ static int __devinit fsl_dma_chan_probe(struct fsldma_device *fdev,
chan->idle = true;
chan->common.device = &fdev->common;
+ dma_cookie_init(&chan->common);
/* find the IRQ line, if it exists in the device tree */
chan->irq = irq_of_parse_and_map(node, 0);
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index ba317e6..4e14f51 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -348,6 +348,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
spin_lock_init(&imxdmac->lock);
imxdmac->chan.device = &imxdma->dma_device;
+ dma_cookie_init(&imxdmac->chan);
imxdmac->channel = i;
/* Add the channel to the DMAC list */
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 4406be2..0be36a4 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1356,6 +1356,7 @@ static int __init sdma_probe(struct platform_device *pdev)
spin_lock_init(&sdmac->lock);
sdmac->chan.device = &sdma->dma_device;
+ dma_cookie_init(&sdmac->chan);
sdmac->channel = i;
/*
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 97e100c..31493d8 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -109,6 +109,7 @@ void ioat_init_channel(struct ioatdma_device *device, struct ioat_chan_common *c
chan->reg_base = device->reg_base + (0x80 * (idx + 1));
spin_lock_init(&chan->cleanup_lock);
chan->common.device = dma;
+ dma_cookie_init(&chan->common);
list_add_tail(&chan->common.device_node, &dma->channels);
device->idx[idx] = chan;
init_timer(&chan->timer);
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 4370b10..1f3a703 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -1545,6 +1545,7 @@ static int __devinit iop_adma_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&iop_chan->chain);
INIT_LIST_HEAD(&iop_chan->all_slots);
iop_chan->common.device = dma_dev;
+ dma_cookie_init(&iop_chan->common);
list_add_tail(&iop_chan->common.device_node, &dma_dev->channels);
if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) {
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 486353e..fa5d55f 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1193,6 +1193,7 @@ static int __devinit mv_xor_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&mv_chan->completed_slots);
INIT_LIST_HEAD(&mv_chan->all_slots);
mv_chan->common.device = dma_dev;
+ dma_cookie_init(&mv_chan->common);
list_add_tail(&mv_chan->common.device_node, &dma_dev->channels);
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 5f3492e..a2267f9 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -618,6 +618,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
mxs_chan->mxs_dma = mxs_dma;
mxs_chan->chan.device = &mxs_dma->dma_device;
+ dma_cookie_init(&mxs_chan->chan);
tasklet_init(&mxs_chan->tasklet, mxs_dma_tasklet,
(unsigned long) mxs_chan);
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 9752062..ced9882 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -4497,6 +4497,7 @@ static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev)
INIT_LIST_HEAD(&chan->all_slots);
chan->device = adev;
chan->common.device = &adev->common;
+ dma_cookie_init(&chan->common);
list_add_tail(&chan->common.device_node, &adev->common.channels);
tasklet_init(&chan->irq_tasklet, ppc440spe_adma_tasklet,
(unsigned long)chan);
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 50510ef..5c40886 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -1089,6 +1089,7 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
/* reference struct dma_device */
new_sh_chan->common.device = &shdev->common;
+ dma_cookie_init(&new_sh_chan->common);
new_sh_chan->dev = shdev->common.dev;
new_sh_chan->id = id;
--
1.7.4.4
next prev parent reply other threads:[~2012-03-06 22:36 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 22:33 [PATCH v2 0/9] DMA engine cookie handling cleanups Russell King - ARM Linux
2012-03-06 22:34 ` [PATCH 2/9] dmaengine: move last completed cookie into generic dma_chan structure Russell King - ARM Linux
2012-03-07 0:38 ` H Hartley Sweeten
2012-03-06 22:34 ` [PATCH 3/9] dmaengine: add private header file Russell King - ARM Linux
2012-03-07 0:47 ` H Hartley Sweeten
2012-03-06 22:34 ` [PATCH 4/9] dmaengine: consolidate assignment of DMA cookies Russell King - ARM Linux
2012-03-07 0:53 ` H Hartley Sweeten
2012-03-06 22:35 ` [PATCH 5/9] dmaengine: provide a common function for completing a dma descriptor Russell King - ARM Linux
2012-03-07 0:56 ` H Hartley Sweeten
2012-04-23 9:40 ` Boojin Kim
2012-04-23 9:50 ` Russell King - ARM Linux
2012-04-23 10:01 ` Vinod Koul
2012-04-23 11:06 ` Boojin Kim
2012-04-23 11:13 ` Russell King - ARM Linux
2012-03-06 22:35 ` [PATCH 6/9] dmaengine: consolidate tx_status functions Russell King - ARM Linux
2012-03-07 1:04 ` H Hartley Sweeten
2012-03-06 22:36 ` Russell King - ARM Linux [this message]
2012-03-07 8:33 ` [PATCH v2 0/9] DMA engine cookie handling cleanups Linus Walleij
2012-03-07 9:06 ` Russell King - ARM Linux
2012-03-07 13:54 ` Vinod Koul
2012-03-12 16:11 ` Russell King - ARM Linux
2012-03-12 16:23 ` Vinod Koul
2012-03-13 8:40 ` Vinod Koul
2012-03-13 12:31 ` Russell King - ARM Linux
2012-03-13 14:38 ` Vinod Koul
2012-03-19 14:35 ` Vinod Koul
2012-03-07 18:09 ` Jassi Brar
2012-03-07 18:21 ` Russell King - ARM Linux
2012-03-07 18:44 ` Jassi Brar
2012-03-09 8:59 ` Shawn Guo
2012-03-13 11:45 ` Nicolas Ferre
-- strict thread matches above, loose matches on Subject: below --
2012-03-05 20:14 [PATCH " Russell King - ARM Linux
2012-03-05 20:17 ` [PATCH 9/9] dmaengine: ensure all DMA engine drivers initialize their cookies Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1S52zb-0002NE-La@rmk-PC.arm.linux.org.uk \
--to=linux@arm$(echo .)linux.org.uk \
--cc=dan.j.williams@intel$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=swarren@nvidia$(echo .)com \
--cc=vinod.koul@intel$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox