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.

[参考译文] AM62A7:使用1GB DDR 时的 CMA 内存池分配问题

Guru**** 2538950 points
Other Parts Discussed in Thread: AM62A7

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1415322/am62a7-cma-memory-pool-allocation-issue-with-1gb-ddr

器件型号:AM62A7

工具与软件:

您好!  

Yocto SDK: 09_01_00

EVM:AM62A SK EVM

我们已基于 AM62A SK EVM 设计了定制 ME 电路板。 我们唯一做的更改是将 DDR 从4GB 更改为1GB。 DDR 更改后、我们遇到了 CMA 内存池分配问题。 我在下面添加了错误的内核日志。

Starting kernel ...
 
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.1.46-rt13-gb871cdee8c (oe-user@oe-host) (aarch64-oe-linux-gcc (GCC) 11.4.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT_RT Thu Dec  7 23:52:13 UTC 2023
[    0.000000] Machine model: Texas Instruments AM62A7 SK
[    0.000000] earlycon: ns16550a0 at MMIO32 0x0000000002800000 (options '')
[    0.000000] printk: bootconsole [ns16550a0] enabled
[    0.000000] efi: UEFI not found.
[    0.000000] OF: reserved mem: failed to allocate memory for node 'linux,cma': size 576 MiB
[    0.000000] Reserved memory: created DMA memory pool at 0x0000000099800000, size 1 MiB
[    0.000000] OF: reserved mem: initialized node c7x-dma-memory@99800000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x0000000099900000, size 30 MiB
[    0.000000] OF: reserved mem: initialized node c7x-memory@99900000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x000000009b800000, size 1 MiB
[    0.000000] OF: reserved mem: initialized node r5f-dma-memory@9b800000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x000000009b900000, size 15 MiB
[    0.000000] OF: reserved mem: initialized node r5f-dma-memory@9b900000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x000000009c800000, size 1 MiB
[    0.000000] OF: reserved mem: initialized node r5f-dma-memory@9c800000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x000000009c900000, size 30 MiB
[    0.000000] OF: reserved mem: initialized node r5f-dma-memory@9c900000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x00000000a1000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node edgeai-dma-memory@a1000000, compatible id shared-dma-pool
[    0.000000] OF: reserved mem: initialized node edgeai_shared-memories, compatible id dma-heap-carveout
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000080000000-0x00000000bfffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080000000-0x00000000997fffff]
[    0.000000]   node   0: [mem 0x0000000099800000-0x000000009b7fefff]
[    0.000000]   node   0: [mem 0x000000009b800000-0x000000009e6fffff]
[    0.000000]   node   0: [mem 0x000000009e700000-0x000000009e77ffff]
[    0.000000]   node   0: [mem 0x000000009e780000-0x00000000a2ffffff]
[    0.000000]   node   0: [mem 0x00000000a3000000-0x00000000bfffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000bfffffff]
[    0.000000] On node 0, zone DMA: 1 pages in unavailable ranges
[    0.000000] cma: Reserved 32 MiB at 0x00000000bce00000

日志 AS 中出现错误 "of: reserved mem: failed to allocation memory for node 'Linux,CMA': size 576 MiB"(共:保留内存:无法为节点"Linux,CMA"分配内存:大小576 MiB")。  这可能是由于 DDR 的大小为1GB 所致。  

由于这种分配错误、当我们从摄像机传感器开始流式传输视频时、内核会崩溃。 我们使用的是1920x1200分辨率- 10位模式。 从摄像头传感器流式传输或捕获图像时、我们收到以下 CAM 分配错误。  

k location=frame%d.rawheight=1200, framerate=120/1, format=rggb10 ! multifilesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-bayer, width=(int)1920, height=(int)1200, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-bayer, width=(int)1920, height=(int)1200, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstMultiFileSink:multifilesink0.GstPad:sink: caps = video/x-bayer, width=(int)1920, height=(int)1200, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-bayer, width=(int)1920, height=(int)1200, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
[   28.111966] ar0235 2-0036: exposure value = 1499
Redistribute latency...
[   28.333950] cma: cma_alloc: reserved: alloc failed, req-size: 1125 pages, ret: -12
[   28.333987] ------------[ cut here ]------------
[   28.333990] WARNING: CPU: 3 PID: 678 at mm/page_alloc.c:5535 0xffff80000813e470
[   28.333999] Modules linked in: overlay cfg80211 rfkill xhci_plat_hcd dwc3 rpmsg_ctrl rpmsg_char cdns_csi2rx spidev crct10dif_ce phy_can_transceiver e5010_jpeg_enc dwc3_am62 k3_j72xx_bandgap rtc_ti_k3 ti_k3_r5_remoteproc ti_k3_dsp_remoteproc tidss virtio_rpmsg_bus rpmsg_ns drm_dma_helper ti_k3_common wave5 j721e_csi2rx drm_kms_helper sa2ul v4l2_mem2mem syscopyarea sysfillrect sysimgblt fb_sys_fops videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common cdns_dphy_rx tps6598x ar0235 typec v4l2_fwnode m_can_platform v4l2_async m_can videodev pwm_tiehrpwm mc can_dev spi_omap2_mcspi optee_rng rng_core cryptodev(O) fuse drm drm_panel_orientation_quirks ipv6
[   28.334149] CPU: 3 PID: 678 Comm: v4l2src0:src Tainted: G           O       6.1.46-rt13-gb871cdee8c #1
[   28.334158] Hardware name: Texas Instruments AM62A7 SK (DT)
[   28.334162] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   28.334171] pc : 0xffff80000813e470
[   28.334174] lr : 0xffff8000080a2bb0
[   28.334176] sp : ffff00000893b860
[   28.334179] x29: ffff00000893b860 x28: ffff000005691860 x27: 0000000000000001
[   28.334189] x26: 000000000000000b x25: ffff000004d812d0 x24: ffff8000080a1a18
[   28.334200] x23: ffff0000001bac10 x22: ffff0000054f9920 x21: ffff0000001bac10
[   28.334210] x20: 0000000000000cc0 x19: 0000000000000000 x18: ffffffffffffffff
[   28.334220] x17: 6572202c73656761 x16: 702035323131203a x15: 657a69732d716572
[   28.334230] x14: 202c64656c696166 x13: 32312d203a746572 x12: 202c736567617020
[   28.334240] x11: 35323131203a657a x10: 69732d716572202c x9 : ffff800008e5d050
[   28.334251] x8 : 0000000000000000 x7 : ffff800008eb7718 x6 : 0000000000000000
[   28.334261] x5 : 0000000000000001 x4 : 0000000000000035 x3 : 0000000000000000
[   28.334270] x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffff800008f59000
[   28.334280] Call trace:
[   28.334283]  0xffff80000813e470
[   28.334287]  0xffff8000080a2bb0
[   28.334289]  0xffff8000080a2d64
[   28.334292]  0xffff8000080a1a18
[   28.334295]  0xffff800000bbf94c
[   28.334297]  0xffff800000ba65f4
[   28.334300]  0xffff800000ba6c80
[   28.334303]  0xffff800000bb13bc
[   28.334305]  0xffff800000bb1810
[   28.334308]  0xffff800000b40564
[   28.334311]  0xffff800000b40880
[   28.334314]  0xffff800000b41774
[   28.334316]  0xffff800000b41ba4
[   28.334319]  0xffff800000b3a16c
[   28.334321]  0xffff800008182b60
[   28.334324]  0xffff80000801de8c
[   28.334327]  0xffff80000801df80
[   28.334329]  0xffff800008a1ccf0
[   28.334332]  0xffff800008a1e1a4
[   28.334335]  0xffff800008011488
[   28.334338] ---[ end trace 0000000000000000 ]---
[   28.334348] ti-udma 4e230000.dma-controller: dma alloc of size 4608000 failed

我们正在对视频流进行 JPEG 编码和 ISP 处理。 我们如何避免 CMA 内存分配错误、使其不会影响我们的流媒体功能?  

此致、

Jay

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Jay:

    我已将您的问题分配给主题专家。 请预计1-2个工作日内回复。

    此致、
    Aparna

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Aparna:  

    感谢您的答复。 我们将在该线程中等待专家的响应。 谢谢你。

    此致、

    Jay

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你(们)好  

    我有同样的问题。 将 am62a7 DDR 表格4GB 修改为1GB。  SDK 版本9.2;  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我想我找到了错误的原因。 我将其更改为1GB DDR、地址偏移范围为0x80000000 -> 0xC0000000、但" Linux、CMA"存储器配置为<0x00 0xC0000000 0x00 0x24000000>、这显然超出了 DDR 布局。 我尝试将 CMA 更改为 alloc-range =<0x00 0x90000000 0x00 0x009600000>;

    [ 0.000000]保留内存:在0x0000000090000000处创建了 CMA 内存池、大小为150 MIB
    [ 0.000000] of:reserved mem:initialized node linux、cma、compatible id shared-dma-pool

    dmesg 无错误

    但我不确定150MB 的 CMA 内存是否能满足我的需要。 显示的存储器大小仅为367MB

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    请在此处查看:  https://dev.ti.com/tirex/explore/content/am62ax_academy_9_02_00_00_v1/_build_am62ax_academy_9_02_00_00_v1/source/linux/ch-porting/porting-uboot.html#modifying-ram-size

    以获得有关更改 DDR 大小的指导。  

    此外、请确保使用 DDR  配置工具:dev.ti.com/.../ 来针对板上的 DDR 进行配置。  自您可以成功引导以来、您似乎拥有了大多数正确值、只需确保已正确设置"DDR 密度(每通道)"以确保正确寻址、并将生成的输出文件构建到您的代码中即可。

    此致、

    James

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 James:  

    感谢您指出移植指南。  

    我们已更改内存大小、并且工作正常。 但没有如何根据1GB DDR 更改 CMA 内存池的信息。 如下所示、内核"k3-am62a7-sk.dts "的 DTS 文件中提到了 CMA 内存池。

            /* global cma region */
            linux,cma {
                compatible = "shared-dma-pool";
                reusable;
                size = <0x00 0x24000000>;
                alloc-ranges = <0x00 0xc0000000 0x00 0x24000000>;
                linux,cma-default;
            };

    将使用 CMA 内存池的位置?

    如果您能提供有关如何根据1GB DDR 更改 CMA 内存池的更多信息、将会很有帮助。

    此致、

    Jay

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 James:

    该主题的任何更新?

    此致、

    Jay  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 TI 团队:

    此问题对于我们向客户发布硬件至关重要。 我们可以为此提供解决方案吗?

    此致、

    Jay