cancel
Showing results for 
Search instead for 
Did you mean: 

RPMSG SDB driver: memory being allocated from the A7 is not accessible to the M4.

GHamm.2
Associate II

See debug out for details.

CA7 : Forward efd info for buf7 with mFdSdbRpmsg:7 and efd:15

CA7 : DBG mmappedData[7]:0xb4d00000

CM4 : SDB0_RxCpltCallback: B7Ae8800000L00100000

CM4 : treatSDBEvent OK physAddr=0xe8800000 physSize=1048576 mArrayDdrBuffCount=7

According to the reference manual this area is only accessible by the A7 (DDR Extension).

I am using the /dev/rpmg-sdb driver to map the memory.

How do I get mmap to map in the proper space? Not sure why it is mapping in the upper range of DDR.

I have been using the logic analyzer example.

1 ACCEPTED SOLUTION

Accepted Solutions

In the DTS file.

Example CMA allocation for RPMSG

reserved-memory {

#address-cells = <1>;

#size-cells = <1>;

ranges;

linux,cma {

compatible = "shared-dma-pool";

reusable;

size = <0x4000000>;

alloc-ranges = <0xdc000000 0x4000000>;

linux,cma-default;

};

mcuram2: mcuram2@10000000 {

compatible = "shared-dma-pool";

reg = <0x10000000 0x40000>;

no-map;

gives a 64MB chunk for continuous mem allocation

View solution in original post

6 REPLIES 6
Olivier GALLIEN
ST Employee

Hi @GHamm.2​ ,

I'm not sure to catch the point. Are you encountering issue with the Logic analyzer example ?

AFAIK the M4 use DMA to write inside the buffer and do not access it directly.

Physical address looks consistent if you are in a 1GB DDR configuration

Please elaborate further.

Thanks,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi,

Thank you for your response. In the LASTATEMachine code on the M4. The DMA is used to transfer the data from the peripheral to SRAM. Then that data is copied to DDR. When the data is copied in SAMPLING_HIGH_FREQ_BUFF1 to the DDR address. The data is never copied and the program stops in the for loop. This is using the phys address of 0xe8800000. Seems to be inaccessible.

I have snice figured out how to change the allocation address by reconfiguring the CMA config. The default address for the CMA configuration is in the 0xExxxxxxx address space. I am now configuring it to use the starting address of 0xDxxxxxxx. The program now copies with no crash.

Olivier GALLIEN (ST Employee)

"Address printed in your traces looks to be in debug context, so accessible to CM4." 

Not sure why it was not working in the debug context. Maybe there was something else I needed to configure.

Thanks again,

GH

xzhen
Associate II

Hi, Russ

We meet the same problem. Because we use the 1GB DDR , so the sdb map the buffer to the 0xe8xxxxxx. And M4 can't write the data. 

How can I change the CMA config, Is it in the dts?

xzhen
Associate II

Thanks all

Xiao Zhen

In the DTS file.

Example CMA allocation for RPMSG

reserved-memory {

#address-cells = <1>;

#size-cells = <1>;

ranges;

linux,cma {

compatible = "shared-dma-pool";

reusable;

size = <0x4000000>;

alloc-ranges = <0xdc000000 0x4000000>;

linux,cma-default;

};

mcuram2: mcuram2@10000000 {

compatible = "shared-dma-pool";

reg = <0x10000000 0x40000>;

no-map;

gives a 64MB chunk for continuous mem allocation

Hello
Does anyone know why this solution might not work?
Despite such entries in device tree, the memory is always allocated in extended memory.
The address changes depending on the size I allocate but it is still too far.
I tried using kernel parameters. The size changes but unfortunately the address does not.

[ 0.000000] cma: Reserved 64 MiB at 0xf4000000
[ 0.000000] Kernel command line: root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw drm.edid_firmware= console=ttySTM0,115200 cma=64MB@3072MB-3584MB
[ 0.000000] Memory: 818656K/1048572K available (12288K kernel code, 1242K rwdata, 3480K rodata, 1024K init, 204K bss, 164380K reserved, 65536K cma-reserved, 65536K highmem)
###################################################################
[ 0.000000] cma: Reserved 128 MiB at 0xf0000000
[ 0.000000] Kernel command line: root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw drm.edid_firmware= console=ttySTM0,115200 cma=128MB@3072MB-3584MB
[ 0.000000] Memory: 753120K/1048572K available (12288K kernel code, 1242K rwdata, 3480K rodata, 1024K init, 204K bss, 164380K reserved, 131072K cma-reserved, 0K highmem)
###################################################################
[ 0.000000] cma: Reserved 256 MiB at 0xe0000000
[ 0.000000] Kernel command line: root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw drm.edid_firmware= console=ttySTM0,115200 cma=256MB@3072MB-3584MB
[ 0.000000] Memory: 621536K/1048572K available (12288K kernel code, 1242K rwdata, 3480K rodata, 1024K init, 204K bss, 164892K reserved, 262144K cma-reserved, 131072K highmem)
###################################################################

Only when the size is set to 512MB do we run into an address that I can use. But I don't need such a large size od CMA

[ 0.000000] cma: Reserved 512 MiB at 0xd0000000
[ 0.000000] Kernel command line: root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw drm.edid_firmware= console=ttySTM0,115200 cma=512MB@3072MB-3584MB
[ 0.000000] Memory: 358880K/1048572K available (12288K kernel code, 1242K rwdata, 3480K rodata, 1024K init, 204K bss, 165404K reserved, 524288K cma-reserved, 131072K highmem)


Any hints?
Thanks.