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.

C6run: changing memory map

Hi,

I am trying to run my application  using C6Run_0_98_03_03 on beagleboard xM Rev C.

DVSDK version is 4_01_00_09.

In this case default memory map is as below.

DSP_REGION_BASE_ADDR=0x83700000 
DSP_REGION_CMEM_SIZE=0x02900000
DSP_REGION_CODE_SIZE=0x02000000

When I try to change the settings to bigger values in top level make file of DVSDK, let's say as below
DSP_REGION_BASE_ADDR=0x83700000 
DSP_REGION_CMEM_SIZE=0x04000000
DSP_REGION_CODE_SIZE=0x03000000
I get following type of error while loading kernel modules on board.

CMEMK Error: Failed to request_mem_region(0x83700000, 
16777216)
insmod: error inserting './cmemk.ko': -1 Bad address
[ 8677.679412] DSPLINK Module (1.65.00.02) created on Date: Jan 5 2012 Time: 19:16:16
mknod: /dev/dsplink: File exists

I am also making corresponding changes to platform.mak file
I want to change this to higher values for DSP_REGION_CMEM_SIZE and DSP_REGION_CODE_SIZE.
These changes should also get reflected in kernel modules like cmemk.ko, dsplinkmodule.ko etc. to get this working.
But I am not sure how to change the default memory map of DVSDK which should use desired settings of above variables.
Can anyone please help me in getting this resolved?

Regards,
Mike
  • mike gp said:
    CMEMK Error: Failed to request_mem_region(0x83700000,
    16777216)

    In my experience, a failure from request_mem_region() happens when CMEM's physical memory overlaps with the Linux kernel.  The Linux kernel will use memory starting at 0x80000000 for a length specified on the Linux boot command with a bootargs entry "mem=##M".

    I'm not familiar with the DVSDK and how it handles those memory map variables that you want to change, but the error above shows that an attempt is being made to insmod cmemk.ko with phys_start=0x83700000.  That means that the Linux kernel can't occupy that address, and if you do (0x83700000 - 0x80000000) we're left with 0x03700000 for the amount of kernel memory, which equates to "mem=55M".  If your bootargs "mem=##M" parameter is bigger than "55M" then you would get this problem.

    mike gp said:

    In this case default memory map is as below.

    DSP_REGION_BASE_ADDR=0x83700000 
    DSP_REGION_CMEM_SIZE=0x02900000
    DSP_REGION_CODE_SIZE=0x02000000
    
    
    When I try to change the settings to bigger values in top level make file of DVSDK, let's say as below
    DSP_REGION_BASE_ADDR=0x83700000 
    DSP_REGION_CMEM_SIZE=0x04000000
    DSP_REGION_CODE_SIZE=0x03000000

    The above error prints a length of 16 MB (16777216), which doesn't correspond to either the old or new value of DSP_REGION_CMEM_SIZE, so I'm not sure what's up with that discrepency.

    Regards,

    - Rob

     

  • Hi Robert,

    Thank you for your reply.

    My bootargs parameters are 

    'mem=55M@0x80000000 mem=384M@0x88000000'

    I believe first parameter  mem=55M@0x80000000 is for linux kernel

    and second parameter mem=384M@0x88000000 is for DSP.

    I am sorry about  above mentioned disrepency. It was an error to paste from my side.

    Below is the scenario:

    DSP_REGION_BASE_ADDR=0x83700000

    DSP_REGION_CMEM_SIZE=0x04000000

    DSP_REGION_CODE_SIZE=0x04000000

    and I am getting following error:

    [  454.108489] CMEM Range Overlaps Kernel Physical - allowing overlap
    [ 454.122100] CMEM phys_start (0x83700000) overlaps kernel (0x80000000 -> 0x9b700000)
    [ 454.130249] CMEMK Error: Failed to request_mem_region(0x83700000, 134217728)
    insmod: error inserting './cmemk.ko': -1 Bad address
    [ 454.173400] DSPLINK Module (1.65.00.02) created on Date: Feb 9 2012 Time: 21:56:02
    mknod: /dev/dsplink: File exists
    
    
    Could you please tell me what could be the problem?
    
    
    Regards,
    Mike


  • Mike,

            

    mike gp said:
    and second parameter mem=384M@0x88000000 is for DSP.

             This is not correct, as per your boot arg 'mem=55M@0x80000000 mem=384M@0x88000000', both are managed by kernel except the one from (0x80000000+55M to 0x88000000)

             Refer the sample DVSDK memory map at http://processors.wiki.ti.com/index.php/DVSDK_4.x_FAQ#What_is_the_memory_partition_in_various_modules_in_DVSDK.3F

             There is also guide line at below link on how to change memory map, this exactly does not match your release, but i hope it would help.

             http://processors.wiki.ti.com/index.php/DVSDK_4.x_FAQ#How_to_change_memory_partition.3F

             Please ensure that all your memory partitions are exclusive for each module.

           

    mike gp said:
    [ 454.122100] CMEM phys_start (0x83700000) overlaps kernel (0x80000000 -> 0x9b700000)

            The above error is acceptable or warning, but your must ensure that CMEM range does not fall under kernel manager regions as in mem= boot args, My understanding is that though we give two mem paramteres kernel some have has a table to indicate that the starting address of first mem to end address of send mem is kernel manages even though end of first mem to start of second mem is not actually used for any purpose by kernel. Though CMEM has falls in the region end of first mem to start of second mem as per kernel table it sees that it overlaps, but it is just the warning. I feel that is the purpose "allowOverlap=1" is passed while insmod cmem.

            so you can ignore this, but enuse it does falls in mem boot args.

    mike gp said:
    [ 454.130249] CMEMK Error: Failed to request_mem_region(0x83700000, 134217728)
    insmod: error inserting './cmemk.ko': -1 Bad address

    I think this is the problem, i think in your cmem script you would have given phys_end as 0x8B700000 (0x83700000+ 128M), which is exactly managed by kernel as in 2nd mem bootargs mem=384M@0x88000000, as per your boot args your max cmem can be 0x83700000 to 0x88000000.

    Best Regards

    Velan

  • Velan has already addressed your issues correctly, but I'd to add a little more...

    mike gp said:
    [ 454.108489] CMEM Range Overlaps Kernel Physical - allowing overlap
    [ 454.122100] CMEM phys_start (0x83700000) overlaps kernel (0x80000000 -> 0x9b700000)

    As Velan said, this warning is OK and is expected when the boot has created a hole in the kernel memory (by way of the 2 mem=##@########).  The message shows the crudeness of the overlap check - CMEM assumes that the kernel has 1 memory block that uses all memory from the beginning of DDR for the total amount of the 2 blocks (it doesn't handle the holes).  The use of allowOverlap=1 on the insmod cmemk.ko command just tells CMEM to "not worry about it".

    So, if you want to increase your CMEM size to 0x08000000, and CMEM currently starts at 0x83700000, then you will need to have your 2nd kernel block start later, at 0x8b700000, with a corresponding adjustment to the size - mem=329M@0x8b700000 - which will create a kernel memory block from 0x8b700000 - 0x9fffffff.

    I say 0x08000000 in the above paragraph because that is the amount that I see used in the request_mem_region() that fails.  But I see your DSP_REGION_CMEM_SIZE=0x04000000 and DSP_REGION_CODE_SIZE=0x04000000, so I assume that CMEM's size is the addition of those 2 sizes.  That seems a little strange, though.  Based on those variable names, I would expect CMEM to be given 0x04000000 and the next 0x04000000 being "given" to the linker of the DSP executable and kept away from CMEM and Linux.

    Regards,

    - Rob

     

  • Hello Robert, Velan,

    I got it.

    Thank you very much for your help...

    Regards,

    Mike