This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] TDA4VL-Q1: How to generate downstream PCIe interrupt from RC to EP

Part Number: TDA4VL-Q1
Other Parts Discussed in Thread: AM68, TDA4VM, TDA4VL, TDA4VH, AM69

TDA4VL, TDA4VM, TDA4VH, and their respective AM6x device counterparts of AM68, TDA4VM, and AM69 all have the ability to generate a downstream PCIe interrupt from RC to EP. However, no examples can be found in the SDK. Are there any examples that can be referenced?

  • This is an unmaintained example, and only verified to work with a specific combination of device and SDK version (TDA4VL on Processor SDK Linux 9.0.1.3 version).

    As of February 26, 2024, there are no plans to officially support this feature in TI SDK, as this is a vendor specific feature and non-standard by PCIe specifications. However, this FAQ is an attempt to provide a reference for those who wish to implement and integrate this feature into their application. As a disclaimer, since this is not a feature in the standard TI SDK, support and testing for this feature is limited.

    As an additional disclaimer, the following example was made using TDA4VL on Processor SDK Linux 9.0.1.3 version. If using a different device, please note the possible difference in address offsets in the scripts. If using a different SDK version, please note changes in device tree format and driver.

    Triggering downstream interrupt on EP, locally from EP

    Prerequisite:

    1. J721S2/TDA4VL EVM board x 1

    Instructions:

    The following instructions set up TI device as EP with a simple downstream interrupt handler:

    1. Download J721S2 9.0.1.3 Linux SDK version from https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-J721S2/09.00.01.03
    2. Create prebuilt adas SD card following instructions from here: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-j721s2/09_00_01_03/exports/docs/linux/Overview/Processor_SDK_Linux_create_SD_card.html#create-sd-card-with-default-images-using-script
    3. cd <Linux SDK installation directory>/board-support/linux-6.1.46+gitAUTOINC+f8110d9ce8-gf8110d9ce8
    4. Run "git apply 0001-Debug-downstream-PCIe-interrupts.-Use-in-conjunction.patch" to apply this patch to Linux kernel and device tree: 0001-Debug-downstream-PCIe-interrupts.-Use-in-conjunction.patch
    5. cd back to Linux SDK installation directory and run "make linux" and "sudo ROOTFS_PART=/path/to/sd/card/root/partition make linux_install" to build and install Linux kernel. Details for building can be found here: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-j721s2/09_00_01_03/exports/docs/linux/Overview_Top_Level_Makefile.html
    6. To test the downstream interrupt locally, run the following bash script on the EP device: test_pcie_downstream_interrupt.sh
    7. There should be a log that says "debug: downstream irq handled" that gets printed out. This is the interrupt handler printing out a printk statement.

    Triggering downstream interrupt on EP, from a connected RC device

    Prerequisite:

    1. J721S2/TDA4VL EVM board x 2
    2. PCIe cable to connect the two boards
    3. Triggering downstream interrupt on EP, locally from EP has been followed

    Instructions:

    If wanting to trigger this interrupt from RC instead of triggering it locally on the EP, this can be done through PCIe configuration space writes using setpci:

    1. On the EP device that is set up in "Triggering downstream interrupt on EP, locally from EP", set up EP device with physical functions following this documentation: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-j721s2/09_00_01_03/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/PCIe/PCIe_End_Point.html. Please note the DIP switch configuration, as wrong configuration is a common issue.
    2. Create a SD card for the second EVM board for RC. Default prebuilt SD card should be configured as RC, so follow steps 1 and 2 in "Triggering downstream interrupt on EP, locally from EP" section
    3. Assuming EP device is powered on and physical functions are set up, and connected through PCIe cable, turn on RC device.
    4. Login as root, and run lspci. There should be some devices similar to "0001:01:00.0 Unassigned class [ff00]: Texas Instruments Device b00d" listed. If these unassigned class device cannot be found, then most likely there is an issue with setting up EP device. Please review the SDK documentation for PCIe_End_Point in step 1.
    5. Run "setpci -s 0001:01:00.0 ECAP_VNDR+8.l=100". This will set HTI bit of PCIE_CORE_PFn_I_VENDOR_SPECIFIC_CONTROL_REG, which is a register that is part of the Extended Capability (ECAP) Vendor (VNDR) specific register.
    6. On EP device, see if "debug: downstream irq handled" is shown. If not, on the EP device, run "devmem2 0x29170c8 w 0x0 > /dev/null" and "devmem2 0x0d800408 w 0x0 > /dev/null" to set the EOI register to signify end of interrupt handler, and reset the PCIE_CORE_PFn_I_VENDOR_SPECIFIC_CONTROL_REG. And then, on RC side, try running the setpci command again.

    Regards,

    Takuma