I would like to use some or all of the DSP L2 memory directly for high performance functions however I have been unable to load sections into the memory from Linux running on an arm.
I have entries for these memory locations in my resource table (using the deprecated RSC_INTMEM), and have created memory sections (called L2_RAM) and code segments (.l2_ram). So just need remoteproc_elf_loader.c to "memcpy" the code into the correct location.
This is what I have tried so far:
In /arch/arm/mach-davinci/da850.c I added some code to reserve and map the memory locations to virtual addresses.
#define DA850_SHARED_RAM_DSP_BASE 0x80000000
#define DA850_SHARED_RAM_DSP_SIZE SZ_128K
#define DA850_L2_RAM_DSP_BASE 0x11800000
#define DA850_L2_RAM_DSP_SIZE SZ_256K
// SNIP
// SHARED Ram structs
static struct resource da850_shared_ram_dsp_resources[] = {
{ /* registers */
.start = DA850_SHARED_RAM_DSP_BASE,
.end = DA850_SHARED_RAM_DSP_BASE + DA850_SHARED_RAM_DSP_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device da850_shared_ram_dsp_device = {
.name = "davinci_shared_ram_dsp",
.id = -1,
.num_resources = ARRAY_SIZE(da850_shared_ram_dsp_resources),
.resource = da850_shared_ram_dsp_resources,
};
// L2 Ram structs
static struct resource da850_l2_ram_dsp_resources[] = {
{ /* registers */
.start = DA850_L2_RAM_DSP_BASE,
.end = DA850_L2_RAM_DSP_BASE + DA850_L2_RAM_DSP_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device da850_l2_ram_dsp_device = {
.name = "davinci_l2_ram_dsp",
.id = -1,
.num_resources = ARRAY_SIZE(da850_l2_ram_dsp_resources),
.resource = da850_l2_ram_dsp_resources,
};
// SNIP
// shared memory 0x80000000
ret = platform_device_register(&da850_shared_ram_dsp_device);
if(ret){
printk("da850_register_misc_ram_dsp: error platform_device_register %s\n", da850_shared_ram_dsp_device.name);
return ret;
}
da850_shared_ram_dsp_device.dev.platform_data = ioremap_nocache(DA850_SHARED_RAM_DSP_BASE, DA850_SHARED_RAM_DSP_SIZE);
if (!da850_shared_ram_dsp_device.dev.platform_data) {
printk("da850_register_misc_ram_dsp: error ioremap_nocache %s\n", da850_shared_ram_dsp_device.name);
return -ENOMEM;
}
// l2 ram dsp
ret = platform_device_register(&da850_l2_ram_dsp_device);
if(ret){
printk("da850_register_misc_ram_dsp: error platform_device_register %s\n", da850_l2_ram_dsp_device.name);
return ret;
}
da850_l2_ram_dsp_device.dev.platform_data = ioremap_nocache(DA850_L2_RAM_DSP_BASE, DA850_L2_RAM_DSP_SIZE);
if (!da850_l2_ram_dsp_device.dev.platform_data) {
printk("da850_register_misc_ram_dsp: error ioremap_nocache %s\n", da850_l2_ram_dsp_device.name);
return -ENOMEM;
}
This creates memory locations in /proc/iomem.
Next the function "rproc_elf_load_sections()" in remoteproc_elf_loader.c can correctly memcpy() code to the "shared_ram_dsp" section. The DSP can then access and execute this code.
However, if I attempt to load memory into the "l2_ram_dsp" it fails. I do a memcmp() immediately following the memcpy. The memory area is all zero. For all the memcpy and memcmp calls am using the virtual address as stored in the carveout list.
I have tried using both "ioremap_nocache()" and "ioremap()" in the allocation/mapping function. I have also tried "memcpy_toio()" as well as "memcpy()" in the "rproc_elf_load_sections()" function. No combination worked.
How can I copy code sections (or anything for that matter) from the ARM into L1P ram or L2 ram?
-Douglas
NB: I found this :
but it does not answer the question.
