cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
10,614 Views
Registered: ‎10-18-2011

Using axi_cdma for DMA transfer over PCIe

Hi all,

I have a small AXI memory mapped design that contains 1 axi_pcie, 1 axi_v6_ddrx and 1 axi_cdma.

The axi_cdma is connected as master on both axi_v6_ddrx slave and axi_pcie slave.

The axi_pcie is also connected as master on an AXI-lite interconnect (to access axi_cdma slave registers).

This way, I want the Host CPU to program the axi_cdma so that it can transfer data between the AXI DDR (on the FPGA side) and the PCIe DDR (on the Host side).

The problem is that I don't understand how to configure the axi_cdma ; the only addresses it knows are AXI addresses, not PCIe addresses. How is the translation performed?

If I configure the axi_cdma with AXI addresses, how will those AXI addresses be translated into PCIe addresses?

Thank you for your help.

Best regards.

0 Kudos
Reply
10 Replies
Xilinx Employee
Xilinx Employee
10,607 Views
Registered: ‎04-06-2010

You're going to need to map a BAR to the CDMA core so that the host can write to the DMA.  This is done by setting the C_PCIEBAR2AXIBAR_# to the CDMA base address.  I recommend reading over Example 3 in the Data Sheet under the Address Translation section.  This is on page 24 and 25.  

http://www.xilinx.com/support/documentation/ip_documentation/axi_pcie/v1_00_a/ds820_axi_pcie.pdf

 

If you read this section and this doesn't make sense, let me know.

0 Kudos
Reply
Visitor
Visitor
10,548 Views
Registered: ‎10-18-2011

Thanks for your answer.

I understand how to access the PCIe BAR from the Host CPU.

My question was more about the addresses I have to write to configure the DMA.

Imagine I have a 8-KiB virtual buffer on the Host memory, composed of two 4-KiB physically continuous pages (@ PCIe address 0x12345678 and PCIe address 0x23456789 for example, please forget about the nasty alignments).

I want to start a 8-KiB DMA from the AXI address 0x00000000 (up to AXI address 0x00001fff) to this Host virtual buffer (bus mastering).

How do I configure the scatter-gather DMA (because it does not know the PCIe addresses and only knows about AXI addresses)?

Best regards.

0 Kudos
Reply
Xilinx Employee
Xilinx Employee
10,541 Views
Registered: ‎04-06-2010

Where do you plan to store your descriptors?  In the host's memory, or on memory mapped BRAM in your EDK project?

0 Kudos
Reply
Visitor
Visitor
10,533 Views
Registered: ‎10-18-2011

I think in BRAM would be the best option (no latency for fetching descriptors) as I can limit the size of a DMA to 1 MiB (hence 256 pages of 4KiB which leads to 256 descriptors).

0 Kudos
Reply
Visitor
Visitor
10,488 Views
Registered: ‎10-18-2011

Up

Anybody?

0 Kudos
Reply
Xilinx Employee
Xilinx Employee
10,477 Views
Registered: ‎04-06-2010

The descriptors are going to need to contain AXI address because that's what the CDMA uses for SA or DA.  

When you're setting up these addresses, you need to ensure that it's going to translate correctly by making sure the AXIBAR2PCIEBAR_## are set up correctly.  The AXIBAR2PCIEBAR_## register can be written to via the Control Interface.  These registers are read/write registers, so you can check them and update them on the fly.

 

Hope this helps.

0 Kudos
Reply
Visitor
Visitor
10,433 Views
Registered: ‎10-18-2011

Thanks.

0 Kudos
Reply
Observer
Observer
10,336 Views
Registered: ‎09-20-2011

Hey luisb,

 

I have to do a simular task as araquirit.

What do you especially mean with "so you can check them and update them on the fly."

As I know you cannot write from an 64-bit AXI to an 32-bit AXI-Lite-Bus, don't you? So you are not able to modify the AXIBAR2PCIEBAR_## register on the fly, are you?

 

Thanks for your response!

-----------------------------------------------------------------------------------------
It's always good practice giving feedback, when description/solution/recommendation have been helpful!
0 Kudos
Reply
Xilinx Employee
Xilinx Employee
10,288 Views
Registered: ‎04-06-2010

You can write from a 64-bit AXI data width to a 32-bit lite interface. If the byte enables are correct on the 64-bit interface, it should result in a 1 beat transaction.

To answer your question, yes you can update on the fly.
0 Kudos
Reply
Explorer
Explorer
2,623 Views
Registered: ‎11-28-2011

luisb,
How is the "base" address of the CDMA determined? Is that the Offset Address shown in the Address Editor in Vivado?
0 Kudos
Reply