zephyr: openamp_rsc_table App in imx7d-pico (M4-Side name in Zephyr=pico_pi_m4) I cant see /dev/ttyRPMSG

Hi,

https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/ipc/openamp_rsc_table#id6

I stay trying this since last month in my imx7d-pico (m4 side) Zephyr upstream board is pico_pi_m4 using mailbox=mub

I can run Remoteproc and zephyr on this device but without resource table, vrings and mailbox(mu) by NXP: https://www.youtube.com/watch?v=NFyEJXIpq4E

Now I stay trying openamp_rsc_table based on this link below: https://github.com/zephyrproject-rtos/zephyr/pull/60455

I can go up and run everything but the channel and /dev/ttyRPMSG are not created

cat /sys/kernel/debug/remoteproc/remoteproc0/carveout_memories

Carveout memory entry:
	Name: vdev0vring0
	Virtual address: 7938acbc
	DMA address: 0x90000000
	Device address: 0x90000000
	Length: 0x8000 Bytes

Carveout memory entry:
	Name: vdev0vring1
	Virtual address: 3a612924
	DMA address: 0x90008000
	Device address: 0x90008000
	Length: 0x8000 Bytes

cat /sys/kernel/debug/remoteproc/remoteproc0/resource_table

Entry 0 is of type vdev
  ID 7
  Notify ID 0
  Device features 0x1
  Guest features 0x1
  Config length 0x0
  Status 0x7
  Number of vrings 2
  Reserved (should be zero) [0][0]

  Vring 0
    Device Address 0x90000000
    Alignment 16
    Number of buffers 8
    Notify ID 0
    Physical Address 0x0

  Vring 1
    Device Address 0x90008000
    Alignment 16
    Number of buffers 8
    Notify ID 1
    Physical Address 0x0

pico_pi_m4.overlay


/ {
	chosen {
		/*
		 * shared memory reserved for the inter-processor communication
		 */
		zephyr,ipc_shm = &ocramfake;
		zephyr,ipc = &mub;
	};

	ocramfake: memory@90000000  {
		compatible = "mmio-sram";
		reg = <0x90000000  0x110000>;
	};
};

&mub {
	status = "okay";
};

Screenshot from 2024-02-25 19-43-35

In linux Yocto A7 Side imx7d-pico-pi-qca-m4.dts (file):

/*
 * Copyright 2018 TechNexion Ltd.
 *
 * Author: Tapani Utriainen <tapani@technexion.com>
 *         Richard Hu <richard.hu@technexion.com>
 *         Ray Chang <ray.chang@technexion.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

 #include "imx7d-pico-pi-qca.dts"

 / {
     memory {
         linux,usable-memory = <0x80000000 0x1ff00000>;
     };
 
     reserved-memory {
         #address-cells = <1>;
         #size-cells = <1>;
         ranges;
 
         //  mailbox_reserved: vrings0@30ab0000  {
        //    reg = <0x30ab0000 0x10000>;
        //    no-map;
        //  };

        m4_reserved: m4@90000000 {
           reg = <0x90000000 0x100000>;
           no-map;
         };        

        vdev0vring0: vdev0vring0@90000000 {
            compatible = "shared-dma-pool";
//            compatible = "shared-dma-pool";
            reg = <0x90000000  0x8000>;
            no-map;
        };

        vdev0vring1: vdev0vring1@90008000 {
            compatible = "shared-dma-pool";
//            compatible = "shared-dma-pool";
            reg = <0x90008000  0x8000>;
            no-map;
        };

        // rsc_table: rsc_table@900ff000 {
        //  reg = <0x900ff000  0x1000>;
        //  no-map;
        // };

        vdev0buffer: vdev0buffer@90010000 {
            compatible = "shared-dma-pool";
            reg = <0x90010000 0x80000>;
            no-map;
        };
 
        //  cm4tcmcode: cm4tcmcode@0x7f8000 {
        //      compatible = "shared-dma-pool";
        //      reg = <0x007f8000 0x8000>;
        //      no-map;
        //  };
 
        //  cm4sramcode: cm4sramcode@0x900000 {
        //      compatible = "shared-dma-pool";
        //      reg = <0x00900000 0x40000>;
        //      no-map;
        //  };
     };
 
     imx7d-cm4 {
         compatible = "fsl,imx7d-cm4";
         clocks = <&clks IMX7D_ARM_M4_ROOT_CLK>;
//         fsl,auto-boot;
         mbox-names = "tx0", "rx0", "rxdb0";
		 mboxes = <&mub 0 1
			  &mub 1 1
			  &mub 3 1>;
  //	     memory-region = <&rpmsg_vrings>, <&cm4tcmcode>, <&cm4sramcode>;
        memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>;
        //, <&cm4tcmcode>;
        fsl,rproc-auto-boot = <1>;
        fsl,rproc-fw-name="zephyr_openamp_rsc_table.elf";
        syscon = <&src>;
        status = "okay"; 
     };
 
     m4_tcm: tcml@007f8000 {
         compatible = "fsl, m4_tcml";
         reg = <0x007f8000 0x8000>;
     };
 
     gpio-leds {
         status = "disabled";
     };
 };
 
 &adc1 {
     status = "disabled";
 };
 
 &adc2 {
     status = "disabled";
 };
 
 &gpt3 {
     status = "disabled";
 };
 
 &gpt4 {
     status = "disabled";
 };
 
 &ocram {
     reg = <0x00901000 0xf000>;
 };
 
 &rpmsg{
     vdev-nums = <1>;
     memory-region = <&vdev0buffer>;
//     memory-region = <&vdev0vring0>, <&vdev0vring1>, <&vdevbuffer>, <&cm4tcmcode>, <&cm4sramcode>;
     reg = <0x9fff0000 0x10000>;
     status = "okay";   // Tava disabled
 };
 
 &uart6 {
     status = "disabled";
 };
 
 &mub {
     status = "okay";
 };
 
 &wdog3{
     status = "disabled";
 };

Why I can`t see vdev0buffer in result of the cat /sys/kernel/debug/remoteproc/remoteproc0/carveout_memories And cat /sys/kernel/debug/remoteproc/remoteproc0/resource_table commands?

Why when I change MAX_RPMSG_NUM_BUFS and MAX_RPMSG_BUF_SIZE from 512 to 256 in virtio_rpmsg_bus.c (file in rpmsg/drivers in my linux kernel), nothing change in Number of buffers 8 in my resource_table? Screenshot from 2024-02-25 19-56-19

Edited:

Change CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=8 to CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=512 in prj.conf. But not solved.

CONFIG_KERNEL_BIN_NAME="zephyr_openamp_rsc_table"
CONFIG_PRINTK=n
CONFIG_IPM=y
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_HEAP_MEM_POOL_SIZE=1024
CONFIG_OPENAMP=y
CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=32
CONFIG_OPENAMP_RSC_TABLE=y
CONFIG_OPENAMP_MASTER=n

Captura de tela de 2024-02-26 16-34-58

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Comments: 64

Most upvoted comments

@jlh-makeen

Unfortunately, I still don’t have carveout for vdev0buffer And /dev/ttyRPMSG.

pico_pi_m4.overlay

/ {
	chosen {
		/*
		 * shared memory reserved for the inter-processor communication
		 */
		zephyr,ipc_shm = &ocramfake;
		zephyr,ipc = &mub;
	};

	ocramfake: memory@9ff00000  {
		compatible = "mmio-sram";
		reg = <0x9ff0000  0x100000>;
//   I tried with 0x110000 and with 0x100000
	};
	// ocramfake: memory@8ff00000  {
	// 	compatible = "mmio-sram";
	// 	reg = <0x8ff00000  0x110000>;
	// };
};

&mub {
	status = "okay";
};

imx7d-pico-pi-qca-m4.dts

/*
 * Copyright 2018 TechNexion Ltd.
 *
 * Author: Tapani Utriainen <tapani@technexion.com>
 *         Richard Hu <richard.hu@technexion.com>
 *         Ray Chang <ray.chang@technexion.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

 #include "imx7d-pico-pi-qca.dts"

 / {
     memory {
         linux,usable-memory = <0x80000000 0x1ff00000>;
     };
 
     reserved-memory {
         #address-cells = <1>;
         #size-cells = <1>;
         ranges;


         vdev0vring0: vdev0vring0@9ff00000 {
            compatible = "shared-dma-pool";
            reg = <0x9ff00000 0x1000>;
            no-map;
        };

        vdev0vring1: vdev0vring1@9ff01000 {
            compatible = "shared-dma-pool";
            reg = <0x9ff01000 0x1000>;
            no-map;
        };

        vdev0buffer: vdev0buffer@9ff02000 {
            compatible = "shared-dma-pool";
              reg = <0x9ff02000 0xfe000>;
            no-map;
        };
 
        cm4tcmcode: cm4tcmcode@0x7f8000 {
             compatible = "shared-dma-pool";
             reg = <0x007f8000 0x8000>;
             no-map;
         };
 
         cm4sramcode: cm4sramcode@0x900000 {
             compatible = "shared-dma-pool";
             reg = <0x00900000 0x40000>;
            no-map;
         };
    };
         
//         vdev0vring0: vdev0vring0@00902000 {
//             compatible = "shared-dma-pool";
// //            compatible = "shared-dma-pool";
// //            reg = <0x9ff00000  0x8000>;
//             reg = <0x00902000 0x2000>;
//             no-map;
//         };

//         vdev0vring1: vdev0vring1@00904000 {
//             compatible = "shared-dma-pool";
// //            compatible = "shared-dma-pool";
// //            reg = <0x9ff08000  0x8000>;
//             reg = <0x00904000 0x2000>;
//             no-map;
//         };

//         vdev0buffer: vdev0buffer@00906000 {
//             compatible = "shared-dma-pool";
// //            reg = <0x9ff10000 0x80000>;
//               reg = <0x00906000 0x9C40>;
//             no-map;
//         };

//         cm4tcmcode: cm4tcmcode@0x7f8000 {
//              compatible = "shared-dma-pool";
//              reg = <0x007f8000 0x8000>;
//              no-map;
//          };
   
//      };
 
     imx7d-cm4 {
         compatible = "fsl,imx7d-cm4";
         clocks = <&clks IMX7D_ARM_M4_ROOT_CLK>;
//         fsl,auto-boot;
         mbox-names = "tx0", "rx0", "rxdb0";
		 mboxes = <&mub 0 1
			  &mub 1 1
			  &mub 3 1>;
  //	     memory-region = <&rpmsg_vrings>, <&cm4tcmcode>, <&cm4sramcode>;
        memory-region = <&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>, <&cm4tcmcode>, <&cm4sramcode>; 
        fsl,rproc-auto-boot = <1>;
        fsl,rproc-fw-name="zephyr_openamp_rsc_table.elf";
        syscon = <&src>;
        status = "okay"; 
     };
 
     m4_tcm: tcml@007f8000 {
         compatible = "fsl, m4_tcml";
         reg = <0x007f8000 0x8000>;
     };
 
     gpio-leds {
         status = "disabled";
     };
 };
 
 &adc1 {
     status = "disabled";
 };
 
 &adc2 {
     status = "disabled";
 };
 
 &gpt3 {
     status = "disabled";
 };
 
 &gpt4 {
     status = "disabled";
 };
 
 &ocram {
     reg = <0x00901000 0xf000>;
 };
 
 &rpmsg{
     vdev-nums = <1>;
//     memory-region = <&vdev0buffer>;
//     memory-region = <&vdev0vring0>, <&vdev0vring1>, <&vdevbuffer>, <&cm4tcmcode>, <&cm4sramcode>;
     reg = <0x9fff0000 0x10000>;
     status = "okay";   // Tava disabled
 };
 
 &uart6 {
     status = "disabled";
 };
 
 &mub {
     status = "okay";
 };
 
 &wdog3{
     status = "disabled";
 };

root@scorpion:/lib/firmware# modprobe rpmsg_client_sample && modprobe imx_rpmsg_tty 
[   86.807476] NLB imx_rpmmsg_tty
root@scorpion:/lib/firmware# echo start > /sys/class/remoteproc/remoteproc0/state    
[   92.828659] remoteproc remoteproc0: powering up imx-rproc
[   92.852848] remoteproc remoteproc0: Booting fw image zephyr_openamp_rsc_table.elf, size 660180
[   92.861895]  remoteproc0#vdev0buffer: assigned reserved memory node vdev0buffer@9ff02000
[   92.875105] virtio_rpmsg_bus virtio1: rpmsg host is online
[   92.882776]  remoteproc0#vdev0buffer: registered virtio1 (type 7)
[   92.889343] remoteproc remoteproc0: remote processor imx-rproc is now up
root@scorpion:/lib/firmware# cat /sys/kernel/debug/remoteproc/remoteproc0/resource_table 
Entry 0 is of type vdev
  ID 7
  Notify ID 0
  Device features 0x1
  Guest features 0x1
  Config length 0x0
  Status 0x7
  Number of vrings 2
  Reserved (should be zero) [0][0]

  Vring 0
    Device Address 0x9ff00000
    Alignment 16
    Number of buffers 16
    Notify ID 0
    Physical Address 0x0

  Vring 1
    Device Address 0x9ff01000
    Alignment 16
    Number of buffers 16
    Notify ID 1
    Physical Address 0x0

root@scorpion:/lib/firmware# cat /sys/kernel/debug/remoteproc/remoteproc0/carveout_memories
Carveout memory entry:
	Name: vdev0vring0
	Virtual address: 7b0edb64
	DMA address: 0x9ff00000
	Device address: 0x9ff00000
	Length: 0x1000 Bytes

Carveout memory entry:
	Name: vdev0vring1
	Virtual address: 7c87c534
	DMA address: 0x9ff01000
	Device address: 0x9ff01000
	Length: 0x1000 Bytes

Carveout memory entry:
	Name: cm4tcmcode
	Virtual address: 75013cd3
	DMA address: 0x007f8000
	Device address: 0x7f8000
	Length: 0x8000 Bytes

Carveout memory entry:
	Name: cm4sramcode
	Virtual address: 243f5356
	DMA address: 0x00900000
	Device address: 0x900000
	Length: 0x40000 Bytes

root@scorpion:/lib/firmware# ls /dev/r*
/dev/ram0   /dev/ram13	/dev/ram4  /dev/ram9	     /dev/rpmsg_ctrl1
/dev/ram1   /dev/ram14	/dev/ram5  /dev/random	     /dev/rtc
/dev/ram10  /dev/ram15	/dev/ram6  /dev/remoteproc0  /dev/rtc0
/dev/ram11  /dev/ram2	/dev/ram7  /dev/rfkill
/dev/ram12  /dev/ram3	/dev/ram8  /dev/rpmsg_ctrl0
root@scorpion:/lib/firmware# ls /dev/tty*
/dev/tty    /dev/tty19	/dev/tty3   /dev/tty40	/dev/tty51  /dev/tty62
/dev/tty0   /dev/tty2	/dev/tty30  /dev/tty41	/dev/tty52  /dev/tty63
/dev/tty1   /dev/tty20	/dev/tty31  /dev/tty42	/dev/tty53  /dev/tty7
/dev/tty10  /dev/tty21	/dev/tty32  /dev/tty43	/dev/tty54  /dev/tty8
/dev/tty11  /dev/tty22	/dev/tty33  /dev/tty44	/dev/tty55  /dev/tty9
/dev/tty12  /dev/tty23	/dev/tty34  /dev/tty45	/dev/tty56  /dev/ttymxc4
/dev/tty13  /dev/tty24	/dev/tty35  /dev/tty46	/dev/tty57  /dev/ttymxc6
/dev/tty14  /dev/tty25	/dev/tty36  /dev/tty47	/dev/tty58
/dev/tty15  /dev/tty26	/dev/tty37  /dev/tty48	/dev/tty59
/dev/tty16  /dev/tty27	/dev/tty38  /dev/tty49	/dev/tty6
/dev/tty17  /dev/tty28	/dev/tty39  /dev/tty5	/dev/tty60
/dev/tty18  /dev/tty29	/dev/tty4   /dev/tty50	/dev/tty61
root@scorpion:/lib/firmware# 
root@scorpion:/lib/firmware# dmesg | grep -i "remoteproc"
[    2.139313] remoteproc remoteproc0: imx-rproc is available
[    2.159148] remoteproc remoteproc0: attaching to imx-rproc
[    2.164721] remoteproc remoteproc0: remote processor imx-rproc is now attached
[   27.148570] remoteproc remoteproc0: stopped remote processor imx-rproc
[   92.828659] remoteproc remoteproc0: powering up imx-rproc
[   92.852848] remoteproc remoteproc0: Booting fw image zephyr_openamp_rsc_table.elf, size 660180
[   92.861895]  remoteproc0#vdev0buffer: assigned reserved memory node vdev0buffer@9ff02000
[   92.882776]  remoteproc0#vdev0buffer: registered virtio1 (type 7)
[   92.889343] remoteproc remoteproc0: remote processor imx-rproc is now up
root@scorpion:/lib/firmware# dmesg | grep -i "virtio0"
[    0.134940] virtio_rpmsg_bus virtio0: rpmsg host is online
root@scorpion:/lib/firmware# dmesg | grep -i "virtio1"
[   92.875105] virtio_rpmsg_bus virtio1: rpmsg host is online
[   92.882776]  remoteproc0#vdev0buffer: registered virtio1 (type 7)
root@scorpion:/lib/firmware# dmesg | grep -i "virtio0"
[    0.134940] virtio_rpmsg_bus virtio0: rpmsg host is online

@neuberfran

So regarding the DT configs, Zephyr needs to use MU_B 0x30ab0000 and Linux needs to use MU_A 0x30aa0000.

Otherwise you get a ressource conflict.