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.

[FAQ] [参考译文] 【常见问题解答】如何检查 Linux 是否可以通过 RPMsg 与非 Linux 内核通信

Guru**** 2418580 points
Other Parts Discussed in Thread: AM67A, AM67

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1545497/faq-how-to-check-if-linux-can-communicate-with-a-non-linux-core-through-rpmsg

主题中讨论的其他器件:AM67、AM67A

在 Linux 可以通过 RPMsg 处理器间通信 (IPC) 协议与非 Linux 内核通信之前、需要满足以下几个条件:

1) Linux 和非 Linux 内核之间的 RPMsg 必须由两个软件实例上的软件驱动程序支持

2) 必须为两个软件实例编写通过 RPMsg 进行通信的应用程序代码

3) Linux Remoteproc 驱动程序必须初始化内核或连接到内核(如果内核已在运行)

4) RPMsg 基础架构(包括 virtio 缓冲区)必须由 Linux 初始化

如需更多信息:

运行开箱即用的 RPMsg 测试代码:
请参阅 Processor Academy > Linux > Evaluation Linux > IPC 示例
AM62x ||  AM62Ax ||   AM62Px ||   AM64x

使用 rpmsg_echo 示例时、“pass"和“和“fail"测试“测试的外观示例:
【常见问题解答】Linux:如何检查 DM R5F 上运行的二进制文件 
示例 1、2、3

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

    软件是否支持 Linux 与非 Linux 内核之间的 RPMsg?  

    请参阅 Processor Academy > Multicore > IPC > IPC 基础知识
    AM62x ||  AM62Ax ||   AM62Px ||   AM64x

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

    是否有应用程序代码要通过 RPMsg 进行通信?

    请参阅 Processor Academy > Multicore > IPC
    AM62x ||  AM62Ax ||   AM62Px ||   AM64x

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

    DM R5F:Remoteproc 是否连接到内核? RPMsg 基础架构是否已初始化?  

    这些处理器具有 DM R5F 内核:
    AM62x
    AM62Ax
    AM62Dx
    AM62Px
    AM67
    AM67A

    DM R5F 将在引导过程的早期加载、然后才会初始化 Linux。 由于 DM R5F 已在 Linux 引导期间运行、因此 Remoteproc 驱动程序应“连接“到 DM R5F、而不是“初始化“内核。

    我们来看看 Linux 成功连接到 DM R5F 并初始化 RPMsg 基础架构的引导的终端输出:

    // tested on AM62x RT Linux SDK 10.1
    root@am62xx-evm:~# uname -a
    Linux am62xx-evm 6.6.58-rt45-ti-rt-01780-gc79d7ef3a56f-dirty #1 SMP PREEMPT_RT Wed Nov 27 14:15:26 UTC 2024 aarch64 GNU/Linux
    
    // search for any terminal output that could be helpful
    // I will cut out anything unrelated to DM R5F to keep it simple
    
    root@am62xx-evm:~# dmesg | grep -e r5 -e remoteproc -e rproc -e rpmsg -e virtio
    [    0.000000] OF: reserved mem: initialized node r5f-dma-memory@9da00000, compatible id shared-dma-pool
    [    0.000000] OF: reserved mem: 0x000000009da00000..0x000000009dafffff (1024 KiB) nomap non-reusable r5f-dma-memory@9da00000
    [    0.000000] OF: reserved mem: initialized node r5f-memory@9db00000, compatible id shared-dma-pool
    [    0.000000] OF: reserved mem: 0x000000009db00000..0x000000009e6fffff (12288 KiB) nomap non-reusable r5f-memory@9db00000
    ...
    
    // DM R5F is already running
    [   11.099611] platform 78000000.r5f: R5F core may have been powered on by a different host, programmed state (0) != actual state (1)
    [   11.102767] platform 78000000.r5f: configured R5F for IPC-only mode
    [   11.103001] platform 78000000.r5f: assigned reserved memory node r5f-dma-memory@9da00000
    [   11.124169] remoteproc remoteproc1: 78000000.r5f is available
    [   11.124363] remoteproc remoteproc1: attaching to 78000000.r5f
    
    // now we are initializing the VIRTIO buffers that are used for RPMsg communication
    [   11.125123] rproc-virtio rproc-virtio.3.auto: assigned reserved memory node r5f-dma-memory@9da00000
    [   11.136027] virtio_rpmsg_bus virtio1: rpmsg host is online
    [   11.136083] rproc-virtio rproc-virtio.3.auto: registered virtio1 (type 7)
    
    // the remoteproc driver successfully attached to DM R5F
    [   11.136098] remoteproc remoteproc1: remote processor 78000000.r5f is now attached
    
    // the RPMsg code on the DM R5F defined 2 "endpoints" at 0xD and 0xE
    // now Linux creates 2 RPMsg channels to communicate with those 2 endpoints
    [   11.136462] virtio_rpmsg_bus virtio1: creating channel ti.ipc4.ping-pong addr 0xd
    [   11.136684] virtio_rpmsg_bus virtio1: creating channel rpmsg_chrdev addr 0xe
    

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

    其他非 Linux 内核: Remoteproc 是否连接到内核? RPMsg 基础架构是否已初始化?

    我们将以 AM62x 上的 M4F 为例。 但这种模式同样适用于所有其他非 Linux 内核。

    // tested on AM62x RT Linux SDK 10.1
    root@am62xx-evm:~# uname -a
    Linux am62xx-evm 6.6.58-rt45-ti-rt-01780-gc79d7ef3a56f-dirty #1 SMP PREEMPT_RT Wed Nov 27 14:15:26 UTC 2024 aarch64 GNU/Linux
    
    // search for any terminal output that could be helpful
    // I will cut out anything unrelated to M4F to keep it simple
    
    root@am62xx-evm:~# dmesg | grep -e m4 -e remoteproc -e rproc -e rpmsg -e virtio
    [    0.000000] OF: reserved mem: initialized node m4f-dma-memory@9cb00000, compatible id shared-dma-pool
    [    0.000000] OF: reserved mem: 0x000000009cb00000..0x000000009cbfffff (1024 KiB) nomap non-reusable m4f-dma-memory@9cb00000
    [    0.000000] OF: reserved mem: initialized node m4f-memory@9cc00000, compatible id shared-dma-pool
    [    0.000000] OF: reserved mem: 0x000000009cc00000..0x000000009d9fffff (14336 KiB) nomap non-reusable m4f-memory@9cc00000
    [   10.608475] k3-m4-rproc 5000000.m4fss: assigned reserved memory node m4f-dma-memory@9cb00000
    [   10.608593] k3-m4-rproc 5000000.m4fss: configured M4 for remoteproc mode
    [   10.608655] k3-m4-rproc 5000000.m4fss: local reset is deasserted for device
    [   10.621124] remoteproc remoteproc0: 5000000.m4fss is available
    [   10.658258] remoteproc remoteproc0: powering up 5000000.m4fss
    [   10.658328] remoteproc remoteproc0: Booting fw image am62-mcu-m4f0_0-fw, size 55100
    
    // now we are initializing the VIRTIO buffers that are used for RPMsg communication
    [   10.689140] rproc-virtio rproc-virtio.1.auto: assigned reserved memory node m4f-dma-memory@9cb00000
    [   10.772318] virtio_rpmsg_bus virtio0: rpmsg host is online
    [   10.772764] rproc-virtio rproc-virtio.1.auto: registered virtio0 (type 7)
    
    // M4F has been successfully initialized
    [   10.772789] remoteproc remoteproc0: remote processor 5000000.m4fss is now up
    
    // the RPMsg code on the M4F defined 2 "endpoints" at 0xD and 0xE
    // now Linux creates 2 RPMsg channels to communicate with those 2 endpoints
    [   10.772865] virtio_rpmsg_bus virtio0: creating channel ti.ipc4.ping-pong addr 0xd
    [   10.773133] virtio_rpmsg_bus virtio0: creating channel rpmsg_chrdev addr 0xe
    
    // note that Linux only has visibility into whether it initialized the M4F subsystem and loaded the firmware
    // Linux does NOT have direct visibility into the current state of the M4F software
    // so Linux will still say "running" even if the M4F code has crashed
    
    // earlier in the boot log, we saw that remoteproc0 = M4F for this specific boot
    root@am62xx-evm:~# cat /sys/class/remoteproc/remoteproc0/state
    running