Multi Channel DMA Intel® FPGA IP for PCI Express* Design Example User Guide

ID 683517
Date 7/30/2024
Public
Document Table of Contents

3.5.2.3.2.1. Installing the Linux Kernel Driver

  1. Install the UIO driver If we are proceeding with UIO support. If we are proceeding with vfio, this step not required:

    $ modprobe uio

  2. Build the mcdma kernel driver and load:
    1. $ cd software/kernel
    2. $ make clean all -C driver/kmod/mcdma-custom-driver
    3. $ insmod driver/kmod/mcdma-custom-driver/ifc_uio.ko
  3. Verify whether driver is loaded or not:

    $ lspci -d 1172:000 -v | grep ifc_uio

    (Kernel driver in use: ifc_uio)

Currently, UIO is the default.

To use the vfio driver, modify UIO_SUPPORT in common/mk/common.mk as follows:

__cflags += -UUIO_SUPPORT

Currently, the build for the 64-bit OS is the default.

To change to building for a 32-bit OS, modify "software/user/common/mk/common.mk" as follows:

Undefine IFC_PIO64 and define IFC_PIO32 and IFC_32BIT_SUPPORT

__cflags += -UIFC_PIO_64

__cflags += -DIFC_PIO_32

__cflags += -DIFC_32BIT_SUPPORT

For a 64-bit OS, if the 32-bit PIO is to be enabled instead of the 64-bit PIO, modify "software/user/common/mk/common.mk" as follows:

Undefine IFC_PIO64 and define IFC_PIO32

__cflags += -UIFC_PIO_64

__cflags += -DIFC_PIO_32

  1. Install vfio-pci module.

    $ modprobe vfio-pci

  2. Bind the device to vfio-pci
    1. If the device is bound to ifc_uio, unbind with the following command:

      $ echo "<bdf>" > /sys/bus/pci/devices/<bdf>/driver/unbind

      E.g: echo "0000:01:00.0" > /sys/bus/pci/devices/0000\:01\:00.0/driver/unbind

    2. Bind the device to vfio-pci

      echo <PCI Vendor ID> <PCI Device ID> > /sys/bus/pci/drivers/vfio-pci/new_id

      Example: echo 1172 0000 > /sys/bus/pci/drivers/vfio-pci/new_id

Note: For VFIO, in case of multi PF scenarios, you must check whether the BDFs are in same IOMMU group or not using the command: readlink /sys/bus/pci/devices/BDF/iommu_group

Example: readlink /sys/bus/pci/devices/0000:01:00.0/iommu_group

Note: If BDFs are in same IOMMU group, you need to apply the ACS patch, else its not required.