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.

TI8148 HLOS side SharedRegion_setEntry problem

Hello! I desperately need your help with dynamic shared region entry setting on the hlos side through SharedRegion_setEntry call. I do it in the following way:


 SysLink_setup();

SharedRegion_Config * config = new SharedRegion_Config;
config->cacheLineSize = 128;
config->numEntries = 4;
config->translate = true;

int SRstatus = SharedRegion_setup(config);

SharedRegion_Entry *entry = new SharedRegion_Entry;
Int srStatus = SharedRegion_getEntry(0, entry);

if(!(entry->isValid)){
int SRstatus0,SRstatus1 = 0;
SharedRegion_Entry *entry0 = new SharedRegion_Entry;
SharedRegion_entryInit(entry0);

entry0->createHeap = true;

entry0->len = 0x1000000;

entry0->base = 0xBE900000;
entry0->isValid = true;
entry0->name = "SR0";
entry0->ownerProcId = 3;
entry0->cacheEnable = false;
entry0->cacheLineSize = 128;
SRstatus0 = SharedRegion_setEntry(0,entry0);
}

And i get a crush if createHeap field is set to true in SharedRegion_Entry.


  • Couple of issues I see:

    1. You cant add SR0. SR0 has spl meaning and is added automatically when loading the slave core executable.

    2. Base should be user virtual pointer when doing SharedRegion_setEntry on HLOS. You should first map physical contiguous memory to user space and then use the user virtual pointer in entry->base

    3. It looks like SR0 is not yet setup. This is a problem because Syslink/IPC internally uses SR0 heap to allocate data structures like gateMP required for other shared region heaps.So first load firmware so that SR0 is setup then you can add additional shared regions dynamically.

     

  • Hey, Badri Narayanan! First of all, thanks fo your quick reply! As you already mentioned SR0 cant be set up through SharedRegion_setEntry call. But the thing is that i want to be able to allocate some objects on the hlos side before running slave core, such as messages via messageq module, but i need a shared region with a valid heap setup, so is there any way to get fully initialized SR0 before running statically configured slave core? 

  • Can  you explain your requirement in more detail

    1.Why do you have to allocate msgs before loading firmware ?  You don't have to run your app. Just firmware load is sufficient to be able to use SR0

    2.Can you use cmem or some other vram allocation to allocate physically contiguous memory instead of using SharedRegion ?

    3.Did you try doing

       // Map physical addr to user and kernel space

        status = ProcMgr_map ( pSlaveProcHandle,
                               ( ProcMgr_MapType_MasterKnlVirt |
                                 ProcMgr_MapType_MasterUsrVirt ),
                               &addrInfo, ProcMgr_AddrType_MasterPhys );

      // Translate phyAddr to user virtual addr      

    status = ProcMgr_translateAddr ( pSlaveProcHandle,
                                         ( Ptr ) & pUsrVirtAddr,
                                         ProcMgr_AddrType_MasterUsrVirt,
                                         ( Ptr ) phyAddr,
                                         ProcMgr_AddrType_MasterPhys );

     //  Use userVirtAddr as SR base in SharedRegion_setEntry

     

  • One of the most important requirement for my app ( actually its an interface to an ipc subsystem ) is to be flexible, so it means that there must be no strict order of cores booting, there must be as less as possible static configuration involved. Right now i have a case when the statically configured slave is booting at the first place and then the host app is starting, so after a handshake (ipc_start , ipc_attach with appropriate ipc_control ) between them i can use ipc calls as my host app has an information about shared region, but after my slave core is shut down ( as i said it must be flexible, so slave core may shut down before host) shared region is no more valid and there is no more heap inside.   Or,for example, there is host app running, but slave side is not fired up yet, and i want to be able to allocate messages for a message q on the host side, because the operation of allocating a message is not logically connected with sending a message to a q of a concrete core, so there have to be no pre - requirements for allocating ( such as for slave to be fired up already).

    i have tried to map my slave virt address of a shared region to a host phys address and then translate host phys to host virt and these operations returns success but SetEntry crushes again:

    Assertion at Line no: 316 in /home/cheryuri/IPNC_RDK/Source/ipnc_rdk/../ti_tools/syslink_2_20_02_20/packages/ti/syslink/utils/hlos/usr/Unable to handle kernel NULL pointer dereference at virtual address 00000028
    osal/Linux/OsalDpgd = c3cb0000
    rv.c: (OsalDrv_r[00000028] *pgd=8478b031efCount > 0) : f, *pte=00000000ailed
    Assertion, *ppte=00000000 at Line no: 99
    in /home/cheryurInternal error: Oops: 17 [#1]
    last sysfs file: /sys/devices/virtual/syslinkipc/syslinkipc_FrameQ/uevent
    Modules linked in: syslink
    CPU: 0 Not tainted (2.6.37_DM8127_IPNC_3.50.00 #1)
    PC is at GateMP_getSharedAddr+0x28/0x60 [syslink]
    LR is at GateMP_getSharedAddr+0x28/0x60 [syslink]
    pc : [<bf02cef8>] lr : [<bf02cef8>] psr: 80000013
    sp : c3025d88 ip : 00000000 fp : c3025d9c
    r10: bf07def4 r9 : 00000003 r8 : 00000001
    r7 : cb209000 r6 : ce000000 r5 : bf0ae0c8 r4 : 00000000
    r3 : 00000000 r2 : bf06c9e6 r1 : 00000000 r0 : bf06c9e6
    Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    Control: 10c5387d Table: 83cb0019 DAC: 00000015
    Process app_host (pid: 323, stack limit = 0xc30242e8)
    Stack: (0xc3025d88 to 0xc3026000)
    5d80: cb20c000 cb209000 c3025dd4 c3025da0 bf0312ec bf02cedc
    5da0: 00000080 00000080 c3025dd4 c3025db8 bf024bbc bf01b928 bf024980 cb20c000
    5dc0: c3025e10 00000000 c3025e0c c3025dd8 bf0315b0 bf03123c c3025e10 00000001
    5de0: bf022d48 00000000 bf0ae0c8 c3025e4c 03bfff80 c5a7f024 c5a7f000 00000024
    5e00: c3025e3c c3025e10 bf0319b4 bf031384 00000000 00000000 ce000000 03bfff80
    5e20: 00000000 cb209000 00000001 00000000 c3025e8c c3025e40 bf025364 bf03196c
    5e40: c3025ec0 00024000 00000000 00000000 00000000 ce000000 03bfff80 00000000
    5e60: bf01c7fc bebddc0c bf0ae0c8 c024f2a0 00000009 00000000 c3024000 00000000
    5e80: c3025efc c3025e90 bf04acd4 bf02524c c024f2a0 bebddc0c 401ac000 00000000
    5ea0: c3025ecc c3025fb0 c3025fb0 00024000 c3025ecc c3025ec0 c008b858 c01d5580
    5ec0: ce000000 03c00000 00010003 000c0001 00000080 be900001 0007b048 00000007
    5ee0: c41aac80 00000009 bebddc0c 00000009 c3025f74 c3025f00 c00d6874 bf04aa04
    5f00: c003e298 c0391e9c 00000000 00000000 c3e84b80 00000022 c3d97288 00000002
    5f20: c47e26a0 00000000 c3024000 00000000 c3025f6c c3025f40 c00c91c8 c00f4030
    5f40: 00000000 c3d97280 00000022 00000000 c3e51f00 bebddc0c c024f2a0 00000009
    5f60: 00000000 c3024000 c3025fa4 c3025f78 c00d6940 c00d63b0 c3025fac 00000001
    5f80: c038ea18 40381b70 40380000 00011df0 00000036 c0048568 00000000 c3025fa8
    5fa0: c00483c0 c00d68f4 40381b70 40380000 00000009 c024f2a0 bebddc0c 00000009
    5fc0: 40381b70 40380000 00011df0 00000036 00000000 00000000 400ed000 bebddbf4
    5fe0: 00000000 bebddba8 000480d4 403171cc 20000010 00000009 00000000 00000000
    Backtrace:
    [<bf02ced0>] (GateMP_getSharedAddr+0x0/0x60 [syslink]) from [<bf0312ec>] (HeapMemMP_postInit+0xbc/0x148 [syslink])
    r5:cb209000 r4:cb20c000
    [<bf031230>] (HeapMemMP_postInit+0x0/0x148 [syslink]) from [<bf0315b0>] (_HeapMemMP_create+0x238/0x310 [syslink])
    r6:00000000 r5:c3025e10 r4:cb20c000
    [<bf031378>] (_HeapMemMP_create+0x0/0x310 [syslink]) from [<bf0319b4>] (HeapMemMP_create+0x54/0x80 [syslink])
    [<bf031960>] (HeapMemMP_create+0x0/0x80 [syslink]) from [<bf025364>] (SharedRegion_setEntry+0x124/0x1c0 [syslink])
    r5:00000000 r4:00000001
    [<bf025240>] (SharedRegion_setEntry+0x0/0x1c0 [syslink]) from [<bf04acd4>] (SharedRegionDrv_ioctl+0x2dc/0x3c8 [syslink])
    [<bf04a9f8>] (SharedRegionDrv_ioctl+0x0/0x3c8 [syslink]) from [<c00d6874>] (do_vfs_ioctl+0x4d0/0x544)
    r7:00000009 r6:bebddc0c r5:00000009 r4:c41aac80
    [<c00d63a4>] (do_vfs_ioctl+0x0/0x544) from [<c00d6940>] (sys_ioctl+0x58/0x7c)
    r9:c3024000 r8:00000000 r7:00000009 r6:c024f2a0 r5:bebddc0c
    r4:c3e51f00
    [<c00d68e8>] (sys_ioctl+0x0/0x7c) from [<c00483c0>] (ret_fast_syscall+0x0/0x30)
    r8:c0048568 r7:00000036 r6:00011df0 r5:40380000 r4:40381b70
    Code: e59f2038 e3a01805 e5950000 ebffba88 (e1d412b8)
    i/IPNC_RDK/Sourc---[ end trace 7c5eb981b49a1d5d ]---
    e/ipnc_rdk/../ti_tools/syslink_2_20_02_20/packages/ti/syslink/utils/hlos/usr/Linux/TraceDrv.c: (osStatus >= 0) : failed



  • The crash seems to be because HeapMemMP tries to get defaultGate gateMP instance used by all IPC modules internally and the default gate is not created. The default gate gets created only on Ipc_start which is invoked on loading firmware.

    As far as I see Syslink  is not designed to operate in the configuration you are using.I think you will atleast have to load firmware (not start the core) to have syslink sr0 properly setup.

    Another option is to use cmem to allocate all msgs. Then do SharedRegion setEntry for srId other than 0 before actually sending the message to remote core using MessageQ_put and not use MessageQ_alloc and MessageQ_free APIs in your code

  • Thank you for your explanation, Badri Narayanan! this was useful!