Skip to contentSkip to conversation

Using PTDMA driver for generic DMA

PATCH Applied Tadeusz Struk 6 participants 11 messages Feb 2, 2024 – Feb 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,
I'm trying to use the AMD PTDMA engine for generic data transfers, but I can't get it to work.
It fails for me with "ptdma 0000:52:00.2: PTDMA error: (null) (0x27)" which, I'm guessing, translates to "ERR 39: ODMA0_AXI_DECERR" After some research I've found a note in drivers/dma/ptdma/Kconfig, which says that "...this DMA controller is intended to be used with AMD Non-Transparent Bridge devices and not for general purpose peripheral DMA." My question is, what is the "ERR 39: ODMA0_AXI_DECERR", and is it even possible to use the PTDMA engine to talk to anything else other than AMD NTB?

Thanks,
Tadeusz

#1 lore raw

Hello Tadeusz,

Sorry for the delay in response.

The "ERR 39: ODMA0_AXI_DECERR" is a Decode Error relating to destination.

Please note that, the PTDMA DMA controller is intended to be used with AMD Non-Transparent Bridge devices and not for general purpose peripheral DMA use cases. PTDMA engine can not talk to anything other than NTB device.

Thanks,
Raju

Quoted 15 lines · Tadeusz Struk

Hello,
I'm trying to use the AMD PTDMA engine for generic data transfers, but I can't get it to work.
It fails for me with "ptdma 0000:52:00.2: PTDMA error: (null) (0x27)" which, I'm guessing, translates to "ERR 39: ODMA0_AXI_DECERR" After some research I've found a note in drivers/dma/ptdma/Kconfig, which says that "...this DMA controller is intended to be used with AMD Non-Transparent Bridge devices and not for general purpose peripheral DMA." My question is, what is the "ERR 39: ODMA0_AXI_DECERR", and is it even possible to use the PTDMA engine to talk to anything else other than AMD NTB?

Thanks,
Tadeusz

#2 lore raw
Quoted 7 lines · Raju Rangoju

Hello Tadeusz,

Sorry for the delay in response.

The "ERR 39: ODMA0_AXI_DECERR" is a Decode Error relating to destination.

Quoted 7 lines

Please note that, the PTDMA DMA controller is intended to be used with AMD Non-Transparent Bridge devices and not for general purpose peripheral DMA use cases. PTDMA engine can not talk to anything other than NTB device.

Thanks,
Raju

Hi Raju,

Are you able to share why the PTDMA has that limitation? How does it even know whether it's talking to an (AMD) NTB device? Is there some special handshaking or flow control happening that only works in conjunction with the AMD NTB?

I understand if that may be a company confidential thing and you can't disclose, but it just seems odd that a standalone DMA engine would only function if its destination address represented only one specific type of device.

Thanks,
Eric

#3 lore raw
In reply to Raju Rangoju

Hi Raju,

Quoted 5 lines · Raju Rangoju

Hello Tadeusz,

Sorry for the delay in response.

The "ERR 39: ODMA0_AXI_DECERR" is a Decode Error relating to destination.

Could you please send a patch that adds short comments explaining these error codes similar to this one?

Thanks and regards,
Tadeusz

#4 lore raw

PATCH 1/1 dmaengine: ptdma: use consistent DMA masks

In reply to Raju Rangoju

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.

Fixes b0b4a6b10577 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")
---
 drivers/dma/ptdma/ptdma-dmaengine.c | 2 --
 1 file changed, 2 deletions(-)
drivers/dma/ptdma/ptdma-dmaengine.c +0 -2
index 1aa65e5de0f3..f79240734807 100644
@@ -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;
Signature · 1 line
2.43.2
Reviewed-by on v1 1/1
#5 lore raw

Re: [PATCH] dmaengine: ptdma: use consistent DMA masks

Quoted 22 lines · Tadeusz Struk

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.

Fixes b0b4a6b10577 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")
---
 drivers/dma/ptdma/ptdma-dmaengine.c | 2 --
 1 file changed, 2 deletions(-)
drivers/dma/ptdma/ptdma-dmaengine.c +0 -0
index 1aa65e5de0f3..f79240734807 100644

drivers/dma/ptdma/ptdma-dmaengine.c int pt_dmaengine_register(struct pt_device *pt) · line 389

Quoted 5 lines
drivers/dma/ptdma/ptdma-dmaengine.c +0 -2
@@ -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

Quoted 3 lines
drivers/dma/ptdma/ptdma-dmaengine.c +0 -0
 	ret = dma_async_device_register(dma_dev);
 	if (ret)
 		goto err_reg;
maintainer
#6 lore raw

Re: [PATCH] dmaengine: ptdma: use consistent DMA masks

In reply to Tadeusz Struk
Quoted 9 lines · Tadeusz Struk

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.

Quoted 3 lines
Fixes b0b4a6b10577 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")

No empty line here please

Quoted 1 line

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

Quoted 19 lines
---
 drivers/dma/ptdma/ptdma-dmaengine.c | 2 --
 1 file changed, 2 deletions(-)
drivers/dma/ptdma/ptdma-dmaengine.c +0 -2
index 1aa65e5de0f3..f79240734807 100644
@@ -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;
Signature · 1 line
2.43.2
Signature · 1 line
~Vinod
#7 lore raw

Re: [PATCH] dmaengine: ptdma: use consistent DMA masks

Quoted 4 lines · Vinod Koul
Quoted 1 line

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

#8 lore raw

PATCH RESEND 1/1 dmaengine: ptdma: use consistent DMA masks

In reply to Vinod Koul

From: Tadeusz Struk <[email protected]>

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.

Fixes b0b4a6b10577 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")
---
 drivers/dma/ptdma/ptdma-dmaengine.c | 2 --
 1 file changed, 2 deletions(-)
drivers/dma/ptdma/ptdma-dmaengine.c +0 -2
index 1aa65e5de0f3..f79240734807 100644
@@ -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;
Signature · 1 line
2.43.2
maintainer Applied
#9 lore raw

Re: [PATCH RESEND] dmaengine: ptdma: use consistent DMA masks

Quoted 10 lines · Tadeusz Struk

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,

Signature · 1 line
~Vinod
maintainer Applied
#10 lore raw

Re: [PATCH] dmaengine: ptdma: use consistent DMA masks

In reply to Tadeusz Struk
Quoted 10 lines · Tadeusz Struk

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,

Signature · 1 line
~Vinod