2018-07-17 10:34:36

by Hanna Hawa

[permalink] [raw]
Subject: [PATCH 0/5] dmaengine: mv_xor_v2: fixes and alignment for XOR-v2 driver

From: Hanna Hawa <[email protected]>

This series bring some minor fixes & alignmnet to the driver of
Marvell XOR-v2 engine.

Thanks,
Hanna

Hanna Hawa (5):
dmaengine: mv_xor_v2: explicitly freeup irq
dmaengine: mv_xor_v2: kill the tasklets upon exit
dmaengine: mv_xor_v2: convert callback to helper function
dmaengine: mv_xor_v2: move unmap to before callback
dmaengine: mv_xor_v2: enable COMPILE_TEST

drivers/dma/Kconfig | 2 +-
drivers/dma/mv_xor_v2.c | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)

--
1.9.1



2018-07-17 10:34:36

by Hanna Hawa

[permalink] [raw]
Subject: [PATCH 1/5] dmaengine: mv_xor_v2: explicitly freeup irq

From: Hanna Hawa <[email protected]>

dmaengine device should explicitly call devm_free_irq() when using
devm_request_irq().

The irq is still ON when devices remove is executed and irq should be
quiesced before remove is completed.

Signed-off-by: Hanna Hawa <[email protected]>
---
drivers/dma/mv_xor_v2.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
index c6589cc..e16083a 100644
--- a/drivers/dma/mv_xor_v2.c
+++ b/drivers/dma/mv_xor_v2.c
@@ -174,6 +174,7 @@ struct mv_xor_v2_device {
int desc_size;
unsigned int npendings;
unsigned int hw_queue_idx;
+ struct msi_desc *msi_desc;
};

/**
@@ -780,6 +781,7 @@ static int mv_xor_v2_probe(struct platform_device *pdev)
msi_desc = first_msi_entry(&pdev->dev);
if (!msi_desc)
goto free_msi_irqs;
+ xor_dev->msi_desc = msi_desc;

ret = devm_request_irq(&pdev->dev, msi_desc->irq,
mv_xor_v2_interrupt_handler, 0,
@@ -897,6 +899,8 @@ static int mv_xor_v2_remove(struct platform_device *pdev)
xor_dev->desc_size * MV_XOR_V2_DESC_NUM,
xor_dev->hw_desq_virt, xor_dev->hw_desq);

+ devm_free_irq(&pdev->dev, xor_dev->msi_desc->irq, xor_dev);
+
platform_msi_domain_free_irqs(&pdev->dev);

clk_disable_unprepare(xor_dev->clk);
--
1.9.1


2018-07-17 10:34:40

by Hanna Hawa

[permalink] [raw]
Subject: [PATCH 2/5] dmaengine: mv_xor_v2: kill the tasklets upon exit

From: Hanna Hawa <[email protected]>

The mv_xor_v2 driver uses a tasklet, initialized during the probe()
routine. However, it forgets to cleanup the tasklet using
tasklet_kill() function during the remove() routine, which this patch
fixes. This prevents the tasklet from potentially running after the
module has been removed.

Fixes: 19a340b1a820 ("dmaengine: mv_xor_v2: new driver")

Signed-off-by: Hanna Hawa <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
---
drivers/dma/mv_xor_v2.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
index e16083a..e718498 100644
--- a/drivers/dma/mv_xor_v2.c
+++ b/drivers/dma/mv_xor_v2.c
@@ -903,6 +903,8 @@ static int mv_xor_v2_remove(struct platform_device *pdev)

platform_msi_domain_free_irqs(&pdev->dev);

+ tasklet_kill(&xor_dev->irq_tasklet);
+
clk_disable_unprepare(xor_dev->clk);

return 0;
--
1.9.1


2018-07-17 10:34:41

by Hanna Hawa

[permalink] [raw]
Subject: [PATCH 3/5] dmaengine: mv_xor_v2: convert callback to helper function

From: Hanna Hawa <[email protected]>

This is in preperation of moving to a callback that provides results to the
callback for the transaction. The conversion will maintain current behavior
and the driver must convert to new callback mechanism at a later time in
order to receive results.

Signed-off-by: Hanna Hawa <[email protected]>
---
drivers/dma/mv_xor_v2.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
index e718498..14e2a7a 100644
--- a/drivers/dma/mv_xor_v2.c
+++ b/drivers/dma/mv_xor_v2.c
@@ -589,9 +589,8 @@ static void mv_xor_v2_tasklet(unsigned long data)
*/
dma_cookie_complete(&next_pending_sw_desc->async_tx);

- if (next_pending_sw_desc->async_tx.callback)
- next_pending_sw_desc->async_tx.callback(
- next_pending_sw_desc->async_tx.callback_param);
+ dmaengine_desc_get_callback_invoke(
+ &next_pending_sw_desc->async_tx, NULL);

dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
}
--
1.9.1


2018-07-17 10:34:43

by Hanna Hawa

[permalink] [raw]
Subject: [PATCH 4/5] dmaengine: mv_xor_v2: move unmap to before callback

From: Hanna Hawa <[email protected]>

Completion callback should happen after dma_descriptor_unmap() has
happened. This allow the cache invalidate to happen and ensure that
the data accessed by the upper layer is in memory that was from DMA
rather than stale data. On some architecture this is done by the
hardware, however we should make the code consistent to not cause
confusion.

Signed-off-by: Hanna Hawa <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
---
drivers/dma/mv_xor_v2.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
index 14e2a7a..d41d916 100644
--- a/drivers/dma/mv_xor_v2.c
+++ b/drivers/dma/mv_xor_v2.c
@@ -589,10 +589,9 @@ static void mv_xor_v2_tasklet(unsigned long data)
*/
dma_cookie_complete(&next_pending_sw_desc->async_tx);

+ dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
dmaengine_desc_get_callback_invoke(
&next_pending_sw_desc->async_tx, NULL);
-
- dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
}

dma_run_dependencies(&next_pending_sw_desc->async_tx);
--
1.9.1


2018-07-17 10:37:43

by Hanna Hawa

[permalink] [raw]
Subject: [PATCH 5/5] dmaengine: mv_xor_v2: enable COMPILE_TEST

From: Hanna Hawa <[email protected]>

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Hanna Hawa <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
---
drivers/dma/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index ca1680a..1f76129 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -366,7 +366,7 @@ config MV_XOR

config MV_XOR_V2
bool "Marvell XOR engine version 2 support "
- depends on ARM64
+ depends on ARM64 || COMPILE_TEST
select DMA_ENGINE
select DMA_ENGINE_RAID
select ASYNC_TX_ENABLE_CHANNEL_SWITCH
--
1.9.1


2018-07-20 09:30:14

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 3/5] dmaengine: mv_xor_v2: convert callback to helper function

On 17-07-18, 13:30, [email protected] wrote:
> From: Hanna Hawa <[email protected]>
>
> This is in preperation of moving to a callback that provides results to the

typo preperation

> callback for the transaction. The conversion will maintain current behavior
> and the driver must convert to new callback mechanism at a later time in
> order to receive results.
>
> Signed-off-by: Hanna Hawa <[email protected]>
> ---
> drivers/dma/mv_xor_v2.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
> index e718498..14e2a7a 100644
> --- a/drivers/dma/mv_xor_v2.c
> +++ b/drivers/dma/mv_xor_v2.c
> @@ -589,9 +589,8 @@ static void mv_xor_v2_tasklet(unsigned long data)
> */
> dma_cookie_complete(&next_pending_sw_desc->async_tx);
>
> - if (next_pending_sw_desc->async_tx.callback)
> - next_pending_sw_desc->async_tx.callback(
> - next_pending_sw_desc->async_tx.callback_param);
> + dmaengine_desc_get_callback_invoke(
> + &next_pending_sw_desc->async_tx, NULL);
>
> dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
> }

--
~Vinod

2018-07-20 09:33:38

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 0/5] dmaengine: mv_xor_v2: fixes and alignment for XOR-v2 driver

On 17-07-18, 13:29, [email protected] wrote:
> From: Hanna Hawa <[email protected]>
>
> This series bring some minor fixes & alignmnet to the driver of
> Marvell XOR-v2 engine.

Applied after fixing typo is 3rd patch, thanks

--
~Vinod