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.

AM5728: PCIe EP outbound address translation problem

Part Number: AM5728

Hi,

I'm using idkAM5728 as pci-e EP mode. The RC is Linux PC.

Here's my version info.

  • PDK : 1.0.17
  • SYS/BIOS : 6.76.3.01
  • CCS : 9.3.0.00012
  • Linux OS : Ubuntu 20.04

Referring to the example code, I changed the BAR and in/outbound settings to suit my environment.

Also, referring to the forum, I changed the hardware and succeeded in sending and receiving data through the BAR address.

For data transmission/reception, the mmap function is used in Linux, and the BAR memory address is directly accessed in the am5728 board.

I set inbound configuration and confirmed that data transmission and reception are working well. My inbound config is as below.

// Inbound Configuration
/*Configure IB region for memory transfer*/
regionParams.regionDir    = PCIE_ATU_REGION_DIR_INBOUND;
regionParams.tlpType      = PCIE_TLP_TYPE_MEM;
regionParams.enableRegion = 1;
regionParams.matchMode    = PCIE_ATU_REGION_MATCH_MODE_ADDR;

regionParams.lowerBaseAddr    = 0xA1400000; // BAR 1 base
regionParams.upperBaseAddr    = 0;
regionParams.regionWindowSize = 0x000FFFFF; // 1M

/* This aligns the buffer to 4K, which needs to be compensated by the application */
regionParams.lowerTargetAddr = ((uintptr_t)dstBuf.buf & ~0xfffU) ;
regionParams.upperTargetAddr = 0;

if ( (retVal = Pcie_atuRegionConfig(
                                    handle,
                                    pcie_LOCATION_LOCAL,
                                    (uint32_t) 0U,
                                    &regionParams)) != pcie_RET_OK)
{
    return retVal;
}

I can write data to 0xA1300000 on Linux PC and read data from the dstbuf address on the AM5728 board.

And now, I'm having trouble setting up outbound configuration. My outbound config is as below.

// Outbound Configuration
if ((retVal = Pcie_getMemSpaceReserved (handle, &resSize)) != pcie_RET_OK) {
    PCIE_logPrintf ("getMemSpaceReserved failed (%d)\n", (int)retVal);
    return retVal;
}

/*Configure OB region for memory transfer*/
regionParams.regionDir    = PCIE_ATU_REGION_DIR_OUTBOUND;
regionParams.tlpType      = PCIE_TLP_TYPE_MEM;
regionParams.enableRegion = 1;

regionParams.lowerBaseAddr    = PCIE_WINDOW_MEM_BASE + resSize;
regionParams.upperBaseAddr    = 0; /* only 32 bits needed given data area size */
regionParams.regionWindowSize = 0x000FFFFF; // 1M

regionParams.lowerTargetAddr = 0xA1300000;  // BAR0 base
regionParams.upperTargetAddr = 0;

return Pcie_atuRegionConfig(
                            handle,
                            pcie_LOCATION_LOCAL,
                            (uint32_t) 1U,
                            &regionParams);

The value of the register(0x51000900~0x51000920) is set correctly, but data transmission/reception is not possible.

If my understanding is correct, AM5728 board writes data to 0x21000000, Linux PC can read data by accessing 0xA1300000.

But I write data to 0x21000000 on AM5728 board, I can't read data from 0xA1300000 on Linux PC.

Instead, if I write data to 0xA1300000 on the AM5728 board, I can read data from 0xA1300000 on the Linux PC.

It works as if no outbound configuration was done.

I think my outbound settings are correct. Am I missing something?

This is the output of lspci on RC (linux pc).