Skip to content

Commit

Permalink
qemu/ivshmem: switch proxy/server roles
Browse files Browse the repository at this point in the history
In this PR we switch proxy/server roles to set proxy as remoteproc master,
This will help us communicate with the linux kernel without making any changes
in the rpproxy_ivshmem configuration.

Build NuttX RTOS:
$ cmake -B proxy -DBOARD_CONFIG=qemu-armv8a:rpproxy_ivshmem -GNinja
$ cmake --build proxy
$ qemu-system-aarch64 -cpu cortex-a53 -nographic -machine virt,virtualization=on,gic-version=3 -kernel proxy/nuttx \
  -device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb \
  -object memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/ivshmem0,size=4194304,share=yes

Bringup Linux Kernel:
$ qemu-system-aarch64 -M virt -cpu cortex-a57 -smp 1 -m 4G -kernel linux/arch/arm64/boot/Image -initrd busybox-1.35.0/initramfs.cpio.gz \
  -nographic -append "init=/init console=ttyAMA0" \
  -device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb -object \
  memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/ivshmem0,size=4194304,share=yes

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd070]
[    0.000000] Linux version 6.14.0-rc1-00035-g998ca87a4914 (archer@archer) (aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #7 SMP PREEMPT Tue Feb 11 12:19:40 CST 2025
[    0.000000] KASLR enabled
[    0.000000] random: crng init done
[    0.000000] Machine model: linux,dummy-virt
...
[    1.001209] remoteproc remoteproc0: ivshmem_rproc is available
[    1.001548] remoteproc remoteproc0: attaching to ivshmem_rproc
[    1.001721] ivshmem_rproc 0000:00:0b.0: dma declare pa=0x80000000d0 dma=0xd0 size=65536
[    1.002164] ivshmem_rproc 0000:00:0b.0: mem entry pa=0x80000100d0 dma=0x100d0, size=4128560
[    1.003605] ivshmem_rproc 0000:00:0b.0: attach entry
[    1.005573] virtio_rpmsg_bus virtio1: rpmsg host is online
[    1.005741] rproc-virtio rproc-virtio.1.auto: registered virtio1 (type 7)
[    1.005873] remoteproc remoteproc0: remote processor ivshmem_rproc is now attached
[    1.012959] virtio_rpmsg_bus virtio1: creating channel rpmsg-syslog addr 0x400
[    1.014240] virtio_rpmsg_bus virtio1: creating channel rpmsg-sensor addr 0x401
[    1.014454] virtio_rpmsg_bus virtio1: creating channel rpmsg-ping addr 0x402
[    1.014644] rpmsg_ping virtio1.rpmsg-ping.-1.1026: rpmsg_ping_probe

below is rpmsg-syslog from NuttX kernel
...
[    1.116680] [    0.000000] [ 0] [  INFO] [proxy] pci_register_rptun_ivshmem_driver: Register ivshmem driver, id=0, cpuname=server, master=0
[    1.116867] [    0.025900] [ 3] [  INFO] [proxy] pci_scan_bus: pci_scan_bus for bus 0
[    1.116987] [    0.026900] [ 3] [  INFO] [proxy] pci_scan_bus: class = 00000600, hdr_type = 00000000
[    1.117121] [    0.027100] [ 3] [  INFO] [proxy] pci_scan_bus: 00:00 [1b36:0008]
[    1.117232] [    0.027500] [ 3] [  INFO] [proxy] pci_setup_device: pbar0 set bad mask
[    1.117349] [    0.027700] [ 3] [  INFO] [proxy] pci_setup_device: pbar1 set bad mask
[    1.117460] [    0.027900] [ 3] [  INFO] [proxy] pci_setup_device: pbar2 set bad mask
[    1.117573] [    0.028100] [ 3] [  INFO] [proxy] pci_setup_device: pbar3 set bad mask
[    1.117692] [    0.028200] [ 3] [  INFO] [proxy] pci_setup_device: pbar4 set bad mask

Signed-off-by: chao an <anchao.archer@bytedance.com>
  • Loading branch information
anchao authored and raiden00pl committed Feb 12, 2025
1 parent 729f8a7 commit e538855
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ CONFIG_RPMSGMTD=y
CONFIG_RPMSG_PING=y
CONFIG_RPTUN=y
CONFIG_RPTUN_IVSHMEM=y
CONFIG_RPTUN_IVSHMEM_NAME="0:server:m"
CONFIG_RPTUN_IVSHMEM_NAME="0:server:s"
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RPMSG_PING=y
CONFIG_RPTUN=y
CONFIG_RPTUN_IVSHMEM=y
CONFIG_RPTUN_IVSHMEM_NAME="0:proxy:s"
CONFIG_RPTUN_IVSHMEM_NAME="0:proxy:m"
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RPMSG_PING=y
CONFIG_RPTUN=y
CONFIG_RPTUN_IVSHMEM=y
CONFIG_RPTUN_IVSHMEM_NAME="0:server:m"
CONFIG_RPTUN_IVSHMEM_NAME="0:server:s"
CONFIG_RPTUN_STACKSIZE=8192
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RPMSG_PING=y
CONFIG_RPTUN=y
CONFIG_RPTUN_IVSHMEM=y
CONFIG_RPTUN_IVSHMEM_NAME="0:proxy:s"
CONFIG_RPTUN_IVSHMEM_NAME="0:proxy:m"
CONFIG_RPTUN_STACKSIZE=8192
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
Expand Down

0 comments on commit e538855

Please sign in to comment.