Instead of notifying userspace in the end-of-transfer (EOT) interrupt
and program the hardware in the start-of-transfer (SOT) interrupt, we
can do both things in the EOT, allowing us to mask the SOT, and halve
the number of interrupts sent by the HDL core.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/dma/dma-axi-dmac.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index 5109530b66de..beed91a8238c 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -415,6 +415,7 @@ static bool axi_dmac_transfer_done(struct axi_dmac_chan *chan,
list_del(&active->vdesc.node);
vchan_cookie_complete(&active->vdesc);
active = axi_dmac_active_desc(chan);
+ start_next = !!active;
}
} else {
do {
@@ -1000,6 +1001,7 @@ static int axi_dmac_probe(struct platform_device *pdev)
struct axi_dmac *dmac;
struct regmap *regmap;
unsigned int version;
+ u32 irq_mask = 0;
int ret;
dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
@@ -1067,7 +1069,10 @@ static int axi_dmac_probe(struct platform_device *pdev)
dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
- axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, 0x00);
+ if (dmac->chan.hw_sg)
+ irq_mask |= AXI_DMAC_IRQ_SOT;
+
+ axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, irq_mask);
if (of_dma_is_coherent(pdev->dev.of_node)) {
ret = axi_dmac_read(dmac, AXI_DMAC_REG_COHERENCY_DESC);
--
2.42.0
On 04-12-23, 15:03, Paul Cercueil wrote:
> Instead of notifying userspace in the end-of-transfer (EOT) interrupt
> and program the hardware in the start-of-transfer (SOT) interrupt, we
> can do both things in the EOT, allowing us to mask the SOT, and halve
> the number of interrupts sent by the HDL core.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/dma/dma-axi-dmac.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> index 5109530b66de..beed91a8238c 100644
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
> @@ -415,6 +415,7 @@ static bool axi_dmac_transfer_done(struct axi_dmac_chan *chan,
> list_del(&active->vdesc.node);
> vchan_cookie_complete(&active->vdesc);
> active = axi_dmac_active_desc(chan);
> + start_next = !!active;
Should this be in current patch, sounds like this should be a different
patch?
> }
> } else {
> do {
> @@ -1000,6 +1001,7 @@ static int axi_dmac_probe(struct platform_device *pdev)
> struct axi_dmac *dmac;
> struct regmap *regmap;
> unsigned int version;
> + u32 irq_mask = 0;
> int ret;
>
> dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
> @@ -1067,7 +1069,10 @@ static int axi_dmac_probe(struct platform_device *pdev)
>
> dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
>
> - axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, 0x00);
> + if (dmac->chan.hw_sg)
> + irq_mask |= AXI_DMAC_IRQ_SOT;
> +
> + axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, irq_mask);
>
> if (of_dma_is_coherent(pdev->dev.of_node)) {
> ret = axi_dmac_read(dmac, AXI_DMAC_REG_COHERENCY_DESC);
> --
> 2.42.0
>
--
~Vinod
Hi Vinod,
Le lundi 11 décembre 2023 à 17:31 +0530, Vinod Koul a écrit :
> On 04-12-23, 15:03, Paul Cercueil wrote:
> > Instead of notifying userspace in the end-of-transfer (EOT)
> > interrupt
> > and program the hardware in the start-of-transfer (SOT) interrupt,
> > we
> > can do both things in the EOT, allowing us to mask the SOT, and
> > halve
> > the number of interrupts sent by the HDL core.
> >
> > Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> > ---
> > drivers/dma/dma-axi-dmac.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-
> > dmac.c
> > index 5109530b66de..beed91a8238c 100644
> > --- a/drivers/dma/dma-axi-dmac.c
> > +++ b/drivers/dma/dma-axi-dmac.c
> > @@ -415,6 +415,7 @@ static bool axi_dmac_transfer_done(struct
> > axi_dmac_chan *chan,
> > list_del(&active->vdesc.node);
> > vchan_cookie_complete(&active->vdesc);
> > active = axi_dmac_active_desc(chan);
> > + start_next = !!active;
>
> Should this be in current patch, sounds like this should be a
> different
> patch?
It belongs here. This line is what allows a new transfer to be
programmed from the EOT. Since we disable the SOT interrupt, if we
remove that line, the driver won't work.
Cheers,
-Paul
>
> > }
> > } else {
> > do {
> > @@ -1000,6 +1001,7 @@ static int axi_dmac_probe(struct
> > platform_device *pdev)
> > struct axi_dmac *dmac;
> > struct regmap *regmap;
> > unsigned int version;
> > + u32 irq_mask = 0;
> > int ret;
> >
> > dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac),
> > GFP_KERNEL);
> > @@ -1067,7 +1069,10 @@ static int axi_dmac_probe(struct
> > platform_device *pdev)
> >
> > dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
> >
> > - axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, 0x00);
> > + if (dmac->chan.hw_sg)
> > + irq_mask |= AXI_DMAC_IRQ_SOT;
> > +
> > + axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, irq_mask);
> >
> > if (of_dma_is_coherent(pdev->dev.of_node)) {
> > ret = axi_dmac_read(dmac,
> > AXI_DMAC_REG_COHERENCY_DESC);
> > --
> > 2.42.0
> >
>
© 2016 - 2026 Red Hat, Inc.