Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
7 years ago

Linux PCIe DMA driver

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

I

9 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • BAPAYYAK's avatar
    BAPAYYAK
    Icon for New Contributor rankNew Contributor

    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

    .