Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Linux PCIe DMA driver

Altera_Forum
Honored Contributor II
4,017 Views

Is there a recent (kernel4.12.12) PCIe DMA driver available to match the Altera PCIe DMA reference design (17.1)? 

 

I
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
2,743 Views

Hi, 

 

 

--- Quote Start ---  

Is there a recent (kernel4.12.12) PCIe DMA driver available to match the Altera PCIe DMA reference design (17.1)? 

 

--- Quote End ---  

 

 

The next driver 

 

https://elixir.bootlin.com/linux/v4.12.12/source/drivers/pci/host/pcie-altera.c 

 

is not available?
0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

Thanks, I'm sorry, I should have been more specific... 

 

I was thinking of the driver within the AN829_driver directory of design example at: 

https://cloud.altera.com/devstore/platform/17.1.2/pro/cyclone-10-gx-pcie-gen2-x4-dma/ 

 

It did not compile out of the box so I just wanted to make sure I had the latest version. 

If somebody built this driver it would be great to learn which kernel and gcc versions was used.
0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

Hi, 

 

 

--- Quote Start ---  

Thanks, I'm sorry, I should have been more specific... 

 

I was thinking of the driver within the AN829_driver directory of design example at: 

https://cloud.altera.com/devstore/platform/17.1.2/pro/cyclone-10-gx-pcie-gen2-x4-dma/ 

 

It did not compile out of the box so I just wanted to make sure I had the latest version. 

If somebody built this driver it would be great to learn which kernel and gcc versions was used. 

--- Quote End ---  

 

 

What error message does your compiler say? 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

It was pretty simple actually, most of it was warnings, but the error was related to the date and time-stamp (gcc 6.4 is probably more strict than older versions). I got it compiled, but I'm having problems when loading the example design: https://www.alteraforum.com/forum/showthread.php?t=58585

0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

BTW this is the diff in case anybody should need it: 

 

diff --git a/altera_dma.c b/altera_dma.c index 5d62cb7..74c5457 100755 --- a/altera_dma.c +++ b/altera_dma.c @@ -872,7 +872,8 @@ static void __exit altera_pci_remove(struct pci_dev *dev) pci_free_consistent(dev, PAGE_SIZE*bk_ptr->numpages, bk_ptr->rp_wr_buffer_virt_addr, bk_ptr->rp_wr_buffer_bus_addr); kfree(bk_ptr); - printk(KERN_DEBUG ALTERA_DMA_DRIVER_NAME ": " "altera_dma_remove()," " " __DATE__ " " __TIME__ " " "\n"); + // printk(KERN_DEBUG ALTERA_DMA_DRIVER_NAME ": " "altera_dma_remove()," " " __DATE__ " " __TIME__ " " "\n"); + printk(KERN_DEBUG ALTERA_DMA_DRIVER_NAME ": " "altera_dma_remove()\n"); } static struct pci_device_id pci_ids = { @@ -891,7 +892,8 @@ static int __init altera_dma_init(void) { int rc = 0; - printk(KERN_DEBUG ALTERA_DMA_DRIVER_NAME ": " "altera_dma_init()," " " __DATE__ " " __TIME__ " " "\n"); + // printk(KERN_DEBUG ALTERA_DMA_DRIVER_NAME ": " "altera_dma_init()," " " __DATE__ " " __TIME__ " " "\n"); + printk(KERN_DEBUG ALTERA_DMA_DRIVER_NAME ": " "altera_dma_init()\n"); rc = pci_register_driver(&dma_driver_ops); if (rc) { printk(KERN_ERR ALTERA_DMA_DRIVER_NAME ": PCI driver registration failed\n"); l
0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

Hi, 

 

If you are using a kit 

 

https://www.altera.com/products/boards_and_kits/dev-kits/altera/cyclone-10-gx-development-kit.html 

 

, did you connect J12 to give enough supply?  

And did you recompile the hw design?  

If those have no effect, I recommend you to ask Intel's(Altera's) support. 

 

Regards, 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
2,743 Views

Yes, it's the Cyclone 10GX development kit. 

Yes, I have the J12 PCIe power connector connected to my PSU 

Yes, I tried both the enclosed master_image/top.sof file and re-built one using 17.1.0 Build 240. The resulting behavior is the same. 

 

This is what I tried: 

 

tar xvf ../Cyclone10GX_PCIeGen2x4_DMA_17_1_2.par quartus_sh --restore 17.1.2/Cyclone10GX_PCIeGen2x4_DMA_17_1_2/Cyclone10GX_PCIeGen2x4_DMA_17_1_2.qar find . -name '*.sof'|xargs md5sum 726940bdd434031299372ceeb1cae16e ./master_image/top.sof  

After building using "Version 17.1.0 Build 240 10/25/2017 SJ Pro Edition" I get the resulting sof file in output_files 

 

find . -name '*.sof'|xargs ls -l -rw-r--r-- 1 petter petter 9061253 Mar 29 05:52 ./master_image/top.sof -rw-r--r-- 1 petter petter 9061249 May 9 22:52 ./output_files/top.sof  

Load the pre-built sof: 

 

quartus_pgm -c 'USB-BlasterII on zappa ' -m jtag -o p\;./master_image/top.sof@2  

 

Boot the PCIe PC: 

 

pciebench~# reboot  

PC will not boot. Can't even get into BIOS. 

 

Power cycle the PC (which will also wipe out the FPGA configuration loaded via JTAG) 

 

PC boots and I'm able to log in. Load the self-built sof: 

 

quartus_pgm -c 'USB-BlasterII on zappa ' -m jtag -o p\;./output_files/top.sof@2  

pciebench ~# reboot  

Same result. PC will not boot. 

 

I have no problems booting the PC if I load one of my test designs containing some simple logic to flash the LEDs and read data from the FPGA using JTAG. 

 

quartus_pgm -c 'USB-BlasterII on zappa ' -m jtag -o p\;/work/petter/fpga/builds/tests/cyclone-10gx-dev-kit/ce725c4+/project.sof@2  

PC will boot fine, and I can log in. 

 

I will try to contact Altera to make sure I have the most recent example.
0 Kudos
BAPAYYAK
Beginner
1,323 Views

I am having same problem. I am @ 4.15.0-213..I am working with Arria10  AVMM DMA IP. Could any body guide for its driver in linux. As alterawiki is closed I can't find Working drivers....if so it is ending with errors as mentioned above. Thankyou in advance

.

0 Kudos
BAPAYYAK
Beginner
1,317 Views

4.15.0-213 is kernel version

0 Kudos
Reply