diff mbox series

dmaengine: ptdma: use consistent DMA masks

Message ID 20240219201039.40379-1-tstruk@gigaio.com (mailing list archive)
State Superseded
Headers show
Series dmaengine: ptdma: use consistent DMA masks | expand

Commit Message

Tadeusz Struk Feb. 19, 2024, 8:10 p.m. UTC
The PTDMA driver sets DMA masks in two different places for the same
device inconsistently. First call is in pt_pci_probe(), where it uses
48bit mask. The second call is in pt_dmaengine_register(), where it
uses a 64bit mask. Using 64bit dma mask causes IO_PAGE_FAULT errors
on DMA transfers between main memory and other devices.
Without the extra call it works fine. Additionally the second call
doesn't check the return value so it can silently fail.
Remove the superfluous dma_set_mask() call and only use 48bit mask.

Cc: stable@vger.kernel.org
Fixes: b0b4a6b10577 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")

Signed-off-by: Tadeusz Struk <tstruk@gigaio.com>
---
 drivers/dma/ptdma/ptdma-dmaengine.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Basavaraj Natikar Feb. 20, 2024, 7:12 a.m. UTC | #1
On 2/20/2024 1:40 AM, Tadeusz Struk wrote:
> The PTDMA driver sets DMA masks in two different places for the same
> device inconsistently. First call is in pt_pci_probe(), where it uses
> 48bit mask. The second call is in pt_dmaengine_register(), where it
> uses a 64bit mask. Using 64bit dma mask causes IO_PAGE_FAULT errors
> on DMA transfers between main memory and other devices.
> Without the extra call it works fine. Additionally the second call
> doesn't check the return value so it can silently fail.
> Remove the superfluous dma_set_mask() call and only use 48bit mask.
>
> Cc: stable@vger.kernel.org
> Fixes: b0b4a6b10577 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")
>
> Signed-off-by: Tadeusz Struk <tstruk@gigaio.com>
> ---
>  drivers/dma/ptdma/ptdma-dmaengine.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/ptdma/ptdma-dmaengine.c
> index 1aa65e5de0f3..f79240734807 100644
> --- a/drivers/dma/ptdma/ptdma-dmaengine.c
> +++ b/drivers/dma/ptdma/ptdma-dmaengine.c
> @@ -385,8 +385,6 @@ int pt_dmaengine_register(struct pt_device *pt)
>  	chan->vc.desc_free = pt_do_cleanup;
>  	vchan_init(&chan->vc, dma_dev);
>  
> -	dma_set_mask_and_coherent(pt->dev, DMA_BIT_MASK(64));
> -

Looks good to me
Reviewed-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>

>  	ret = dma_async_device_register(dma_dev);
>  	if (ret)
>  		goto err_reg;
Vinod Koul Feb. 22, 2024, 1:56 p.m. UTC | #2
On 19-02-24, 21:10, Tadeusz Struk wrote:
> The PTDMA driver sets DMA masks in two different places for the same
> device inconsistently. First call is in pt_pci_probe(), where it uses
> 48bit mask. The second call is in pt_dmaengine_register(), where it
> uses a 64bit mask. Using 64bit dma mask causes IO_PAGE_FAULT errors
> on DMA transfers between main memory and other devices.
> Without the extra call it works fine. Additionally the second call
> doesn't check the return value so it can silently fail.
> Remove the superfluous dma_set_mask() call and only use 48bit mask.
> 
> Cc: stable@vger.kernel.org
> Fixes: b0b4a6b10577 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")
> 
No empty line here please

> Signed-off-by: Tadeusz Struk <tstruk@gigaio.com>

I cant pick this, it was sent by email which this patch was not
signed-off by, please either resend from same id as sob or sign with
both

> ---
>  drivers/dma/ptdma/ptdma-dmaengine.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/ptdma/ptdma-dmaengine.c
> index 1aa65e5de0f3..f79240734807 100644
> --- a/drivers/dma/ptdma/ptdma-dmaengine.c
> +++ b/drivers/dma/ptdma/ptdma-dmaengine.c
> @@ -385,8 +385,6 @@ int pt_dmaengine_register(struct pt_device *pt)
>  	chan->vc.desc_free = pt_do_cleanup;
>  	vchan_init(&chan->vc, dma_dev);
>  
> -	dma_set_mask_and_coherent(pt->dev, DMA_BIT_MASK(64));
> -
>  	ret = dma_async_device_register(dma_dev);
>  	if (ret)
>  		goto err_reg;
> -- 
> 2.43.2
Tadeusz Struk Feb. 22, 2024, 4:24 p.m. UTC | #3
On 2/22/24 14:56, Vinod Koul wrote:
>> Signed-off-by: Tadeusz Struk<tstruk@gigaio.com>
> I cant pick this, it was sent by email which this patch was not
> signed-off by, please either resend from same id as sob or sign with
> both

I will resend with a proper "From" line now.
Thanks,
Tadeusz
Vinod Koul Feb. 23, 2024, 12:08 p.m. UTC | #4
On Mon, 19 Feb 2024 21:10:39 +0100, Tadeusz Struk wrote:
> The PTDMA driver sets DMA masks in two different places for the same
> device inconsistently. First call is in pt_pci_probe(), where it uses
> 48bit mask. The second call is in pt_dmaengine_register(), where it
> uses a 64bit mask. Using 64bit dma mask causes IO_PAGE_FAULT errors
> on DMA transfers between main memory and other devices.
> Without the extra call it works fine. Additionally the second call
> doesn't check the return value so it can silently fail.
> Remove the superfluous dma_set_mask() call and only use 48bit mask.
> 
> [...]

Applied, thanks!

[1/1] dmaengine: ptdma: use consistent DMA masks
      commit: df2515a17914ecfc2a0594509deaf7fcb8d191ac

Best regards,
diff mbox series

Patch

diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/ptdma/ptdma-dmaengine.c
index 1aa65e5de0f3..f79240734807 100644
--- a/drivers/dma/ptdma/ptdma-dmaengine.c
+++ b/drivers/dma/ptdma/ptdma-dmaengine.c
@@ -385,8 +385,6 @@  int pt_dmaengine_register(struct pt_device *pt)
 	chan->vc.desc_free = pt_do_cleanup;
 	vchan_init(&chan->vc, dma_dev);
 
-	dma_set_mask_and_coherent(pt->dev, DMA_BIT_MASK(64));
-
 	ret = dma_async_device_register(dma_dev);
 	if (ret)
 		goto err_reg;