Forum Discussion

TKele's avatar
TKele
Icon for New Contributor rankNew Contributor
7 years ago

Arria 10 SoC system/fpga/reset manager register write from Linux

Hi,

Reading registers from Linux in system/fpga/reset manager works fine, however writing fails:

[ 2389.391130] Unhandled fault: external abort on non-linefetch (0x1818) at 0xb6fe98

[ 2389.399403] pgd = ee37c000

[ 2389.402098] [b6f65078] *pgd=3ec84831

Bus error (core dumped)

According to http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0344b/Bgbiaghh.html 0x1818 means precise external abort, nontranslation, AXI Slave error caused the abort.

Do you have any idea why writing fails? We are just trying to set cdratio in imgcfg_ctrl_02 register in fpga_mgr_fpgamgrregs

Thanks in advance!

Regards,

Tibor

8 Replies

  • FawazJ_Altera's avatar
    FawazJ_Altera
    Icon for Frequent Contributor rankFrequent Contributor

    Hello,

    Can you send me the command you used to write to this register?

    Thanks

  • TKele's avatar
    TKele
    Icon for New Contributor rankNew Contributor

    Hello,

    I map the FPGA manager memory with this function:

    static int MapMem (int fd, volatile unsigned int **pBaseAddr, unsigned int physicalBaseAddr, unsigned int size)
    {
        void *pVirtualBase;
     
        pVirtualBase = mmap (NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, physicalBaseAddr);
        if (pVirtualBase == MAP_FAILED)
        {
            return errno;
        }
     
        *pBaseAddr = (volatile unsigned int *)pVirtualBase;
     
        return 0;
    }

    where physicalBaseAddr and size parameters are:

    #define FPGAMGR_IMG_BASEADDR        (0xFFCFE000)
    #define FPGAMGR_IMG_SIZE            (0x2000)

    Then I try to write imgcfg_ctrl_02 register:

    pFpgaMgrInstanceBaseAddr [0x78 / sizeof (unsigned int)] |= (1U << 24U) | // CFGWDTH_32
                                                                   (cdRatio << 16U);

    And here I get the above error, while reading the register works just fine.

    Regards,

    Tibor

  • FawazJ_Altera's avatar
    FawazJ_Altera
    Icon for Frequent Contributor rankFrequent Contributor

    Can you use memtool instead to write to that register?

    memtool -<size> <address in 0x00 format>=<data in 0x00 format>

    Furthermore, I noticed from the the code above:

    #define FPGAMGR_IMG_BASEADDR (0xFFCFE000)

    If you check the Arria 10 SoC register map, you would find that this address is not for FPGA configuration control, it is for storing the decrypted AES data.

    sec_mgr_aesfifo 0xFFCFE000

    To use the FPGA manager, you should use this address:

    fpga_mgr_fpgamgrregs address should be : 0xFFD03000

    https://www.intel.com/content/www/us/en/programmable/hps/arria-10/hps.html#reg_soc_top/sfo1429889205804.html

    Thanks

  • TKele's avatar
    TKele
    Icon for New Contributor rankNew Contributor

    Hello,

    Sorry, I copied the wrong address. The problem persists with 0xFFD03000 as well.

    memtool is not part of my Ångström. As far as I can see all memtool implementations use the same concept as I do.

    Regards,

    Tibor Kelemen

  • FawazJ_Altera's avatar
    FawazJ_Altera
    Icon for Frequent Contributor rankFrequent Contributor

    Hello sir,

    Memtool should be available in kernel 4.5 and below. if you are using 4.9, you need to enable it when building linux kernel.

    The easy way would be:

    1- Download the memtool.c from this link:

    https://gist.github.com/mike0/2910170

    2-compile the memtool.c on your linux board.

    gcc -o memtool memtool.c

    3- mv memtool /usr/bin

    4- memtool is ready to use.

    The difference here, memtool is running on linux. This will provide access to registers. If you are able to read/write data as expected, this means there is some initialization missing in your coding.

    Please try memtool and let me know the feedback. We are still investigating about this issue.

    Thanks

  • FawazJ_Altera's avatar
    FawazJ_Altera
    Icon for Frequent Contributor rankFrequent Contributor

    FYI,

    I have tested resetting FPGA by using memtool and it was working. However, this was tested on Cyclone V soc. I am still preparing the system to test on Arria 10 soc.

    Thanks

  • TKele's avatar
    TKele
    Icon for New Contributor rankNew Contributor

    Hello,

    The result is identical with the linked memtool.c. I'm not using DS-5 and I mentioned that my implementation functions the same way as any memtool implementation.

    Reading is fine:

    root@arria10:~# ./memtool -32 0xFFD03078 1
    Reading 0x1 count starting at address 0xFFD03078
     
    0xFFD03078:  01030101

    However writing back the same word fails:

    root@arria10:~# ./memtool -32 0xFFD03078=0x01030101
    Writing 32-bit value 0x1030101 to address 0xFFD03078[  587.119527] Unhandled fault: external abort on non-linefetch (0x1818) at 0xb6faf078
    [  587.131553] pgd = ee19c000
    [  587.134248] [b6faf078] *pgd=3ecf6831
     
    Bus error (core dumped)

    Regards,

    Tibor

  • FawazJ_Altera's avatar
    FawazJ_Altera
    Icon for Frequent Contributor rankFrequent Contributor

    Hello,

    I suspect this is a kernel issue.

    Unhandled fault happen when you are trying to read memory that is not mapped through MMU.

    Did you check the bridges status? Was FPGA configured from SDcard?