Compiling and Loading the Driver - 4.1 English

DMA/Bridge Subsystem for PCI Express Product Guide (PG195)

Document ID
PG195
Release Date
2023-11-24
Version
4.1 English
The provided PCIe drivers and software should be customized to a specific platform. To accomplish this, drivers and software are normally developed to verify the Vendor ID, Device ID, Revision ID, Subsystem Vendor ID, and Subsystem ID before attempting to access device-extended capabilities or peripherals like the PCIe-XVC-VSEC or AXI-XVC. Because the provided driver is generic, it only verifies the Vendor ID and Device ID for compatibility before attempting to identify the PCIe-XVC-VSEC or AXI-XVC peripheral.

The XVC driver and software are provide as a ZIP file included with the Vivado Design Suite installation.

  1. Copy the ZIP file from the Vivado install directory to the FPGA connected Host PC and extract (unzip) its contents. This file is located at the following path within the Vivado installation directory.

    XVC Driver and SW Path: …/data/xicom/driver/pcie/xvc_pcie.zip

    The README.txt files within the driver_* and xvcserver directories identify how to compile, install, and run the XVC drivers and software, and are summarized in the following steps. Follow the following steps after the driver and software files have been copied to the Host PC and you are logged in as a user with root permissions.

  2. Modify the variables within the driver_*/xvc_pcie_user_config.h file to match your hardware design and IP settings. Consider modifying the following variables:
    PCIE_VENDOR_ID
    The PCIe Vendor ID defined in the PCIe® IP customization.
    PCIE_DEVICE_ID
    The PCIe Device ID defined in the PCIe® IP customization.
    Config_space
    Allows for the selection between using a PCIe-XVC-VSEC or an AXI-XVC peripheral. The default value of AUTO first attempts to discover the PCIe-XVC-VSEC, then attempts to connect to an AXI-XVC peripheral if the PCIe-XVC-VSEC is not found. A value of CONFIG or BAR can be used to explicitly select between PCIe® -XVC-VSEC and AXI-XVC implementations, as desired.
    config_vsec_id
    The PCIe XVC VSEC ID (default 0x0008) defined in the Debug Bridge IP when the Bridge Type is configured for From PCIE to BSCAN. This value is only used for detection of the PCIe® -XVC-VSEC.
    config_vsec_rev
    The PCIe XVC VSEC Rev ID (default 0x0) defined in the Debug Bridge IP when the Bridge Type is configured for From PCIe to BSCAN. This value is only used for detection of the PCIe-XVC-VSEC.
    bar_index
    The PCIe BAR index that should be used to access the Debug Bridge IP when the Bridge Type is configured for From AXI to BSCAN. This BAR index is specified as a combination of the PCIe IP customization and the addressable AXI peripherals in your system design. This value is only used for detection of an AXI-XVC peripheral.
    bar_offset
    PCIe BAR Offset that should be used to access the Debug Bridge IP when the Bridge Type is configured for From AXI to BSCAN. This BAR offset is specified as a combination of the PCIe IP customization and the addressable AXI peripherals in your system design. This value is only used for detection of an AXI-XVC peripheral.
  3. Move the source files to the directory of your choice. For example, use:

    /home/username/xil_xvc or /usr/local/src/xil_xvc

  4. Make sure you have root permissions and change to the directory containing the driver files.
    # cd /driver_*/
  5. Compile the driver module:
    # make install

    The kernel module object file will be installed as:

    /lib/modules/[KERNEL_VERSION]/kernel/drivers/pci/pcie/Xilinx/xil_xvc_driver.ko

  6. Run the depmod command to pick up newly installed kernel modules:
    # depmod -a
  7. Make sure no older versions of the driver are loaded:
    # modprobe -r xil_xvc_driver
  8. Load the module:
    # modprobe xil_xvc_driver

    If you run the dmesg command, you will see the following message:

    kernel: xil_xvc_driver: Starting…
    Note: You can also use insmod on the kernel object file to load the module:
    # insmod xil_xvc_driver.ko

    However, this is not recommended unless necessary for compatibility with older kernels.

  9. The resulting character file, /dev/xil_xvc/cfg_ioc0, is owned by user root and group root, and it will need to have permissions of 660. Change permissions on this file if it does not allow the application to interact with the driver.
    # chmod 660 /dev/xil_xvc/cfg_ioc0
  10. Build the simple test program for the driver:
    # make test
  11. Run the test program:
    # ./driver_test/verify_xil_xvc_driver

    You should see various successful tests of differing lengths, followed by the following message:

    "XVC PCIE Driver Verified Successfully!"