{"id":20713299,"url":"https://github.com/linaro/zephyr-ivshmem","last_synced_at":"2026-04-21T11:33:21.544Z","repository":{"id":163160417,"uuid":"638582930","full_name":"Linaro/zephyr-ivshmem","owner":"Linaro","description":"IVSHMEM dual test bed sample app for Zephyr RTOS","archived":false,"fork":false,"pushed_at":"2023-05-18T22:16:36.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-17T21:30:14.064Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Linaro.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-09T16:53:56.000Z","updated_at":"2024-07-20T02:53:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e8983f5-f59d-4a0d-983a-630805be435b","html_url":"https://github.com/Linaro/zephyr-ivshmem","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linaro%2Fzephyr-ivshmem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linaro%2Fzephyr-ivshmem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linaro%2Fzephyr-ivshmem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Linaro%2Fzephyr-ivshmem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Linaro","download_url":"https://codeload.github.com/Linaro/zephyr-ivshmem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242988012,"owners_count":20217534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T02:24:23.854Z","updated_at":"2025-12-24T11:08:14.826Z","avatar_url":"https://github.com/Linaro.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"IVSHMEM dual test bed sample app\n################################\n\nPrerequisites\n*************\n\n* Tested with Zephyr main branch commit id:\n   https://github.com/zephyrproject-rtos/zephyr/commit/6697c5aa0bb296ad008ef8f728df254954764962\n\n* Tested agains Zephyr SDK 0.16.1\n\n* QEMU needs to available.\n\nivshmem-server needs to be available and running. The server is available in\nZephyr SDK or pre-built in some distributions. Otherwise, it is available in\nQEMU source tree.\n\nivshmem-client needs to be available as it is employed in this sample as an\nexternal application. The same conditions of ivshmem-server applies to the\nivshmem-server, as it is also available via QEMU.\n\n\nPreparing IVSHMEM server\n************************\n#. The ivshmem-server utillity for QEMU can be found into the zephyr sdk\n   directory, in:\n   ``/path/to/your/zephyr-sdk/zephyr-\u003cversion\u003e/sysroots/x86_64-pokysdk-linux/usr/xilinx/bin/``\n\n#. You may also find ivshmem-client utillity, it can be useful to debug if everything works\n   as expected.\n\n#. Run ivshmem-server. For the ivshmem-server, both number of vectors and\n   shared memory size are decided at run-time (when the server is executed).\n   For Zephyr, the number of vectors and shared memory size of ivshmem are\n   decided at compile-time and run-time, respectively.For Arm64 we use\n   vectors == 2 for the project configuration in this sample. Here is an example:\n\n   .. code-block:: console\n\n      # n = number of vectors\n      $ sudo ivshmem-server -n 2\n      $ *** Example code, do not use in production ***\n\n#. Appropriately set ownership of ``/dev/shm/ivshmem`` and\n   ``/tmp/ivshmem_socket`` for your deployment scenario. For instance:\n\n   .. code-block:: console\n\n      $ sudo chgrp $USER /dev/shm/ivshmem\n      $ sudo chmod 060 /dev/shm/ivshmem\n      $ sudo chgrp $USER /tmp/ivshmem_socket\n      $ sudo chmod 060 /tmp/ivshmem_socket\n\nBuilding and Running\n********************\nThere are instance_1 and instance_2 folders, use the --build-dir or -d options to get two\nIVSHMEM Zephyr enabled apps:\n\n   .. code-block:: console\n\n      $ cd path/to/ivshmem_test_bed\n      $ west build -pauto -bqemu_cortex_a53 -d instance_1\n      $ west build -pauto -bqemu_cortex_a53 -d instance_2\n\n* Note: Warnings that appear are from ivshmem-shell subsystem and can be ignored.\n\nAfter getting the both appplications built, open two terminals and run each\ninstance separately.\n\nFor example to run instance 1:\n\n   .. code-block:: console\n\n      $ west build -t run -d instance_1\n\nFor instance 2, just go to the other build directory in another terminal:\n\n   .. code-block:: console\n\n      $ west build -t run -d instance_2\n\n\nUsing this test-bed\n*******************\n\nAfter running both the instances, you may able to get the following\nscreenshot in the console:\n\n   .. code-block:: console\n\n      [0/1] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: cortex-a53\n      *** Booting Zephyr OS build zephyr-v3.3.0-3373-gca6c08f960d8 ***\n      Use ivshmem_send_notify to send a message\n\n\n      uart:~$\n\nGet the ID of your peers using the dump command:\n\n   .. code-block:: console\n\n      uart:~$ ivshmem_dump shmem\n      IVshmem up and running:\n            Shared memory: 0xafa00000 of size 4194304 bytes\n            Peer id: 11\n            Notification vectors: 2\n\nOn the other instance running on other terminal tab:\n\n   .. code-block:: console\n\n      uart:~$ ivshmem_dump shmem\n      IVshmem up and running:\n            Shared memory: 0xafa00000 of size 4194304 bytes\n            Peer id: 10\n            Notification vectors: 2\n\nSend any data from a peer to another one:\n\n   .. code-block:: console\n\n      uart:~$ ivshmem_send_notify 11 0 \"message from peer 10 to peer 11\"\n      Message message from peer 10 to peer 11 sent to peer 11 on vector 0\n\nCheck the result on the other instance:\n\n   .. code-block:: console\n\n      uart:~$ received IRQ and full message: message from peer 10 to peer 11\n\nThe ivshmem_send_notify command takes three parameters: the peer ID, the vector and the string to send.\n\nLong-run usage of this test-bed remarks\n***************************************\n\nThe command ``ivshmem_send_continuous`` was created with the purpose of create a\nstress test environmet of this test bed, its usage is similar of the other commands\nin this app.\n\nThe long-run test scenario followed the instructions below in the strict sequence\nin a clean-state virtual machine running ubuntu 20.04 and 22.04\n(Note: Both the tests were executed with 6 hour time duration):\n\n#. Start the ivshmem and set the device owners as described above.\n#. Build instance_1 and instance_2 test-bed application in two different terminal tabs.\n#. Get, for each instance, their peer id by using ``ivshmem_dump shmem``:\n\n      .. code-block:: console\n\n         uart:~$ ivshmem_dump shmem\n         IVshmem up and running:\n               Shared memory: 0xafa00000 of size 4194304 bytes\n               Peer id: 10\n               Notification vectors: 2\n\n#. Select any of instance and issue the ``ivshmem_send_continuous`` command:\n\n      .. code-block:: console\n\n         uart:~$ ivshmem_send_continuous 9 0 \"Ping message from ID8\"\n         Message Ping message from ID8 sent to peer 9 on vector 0\n\n#. Observe the message arrival on the other instance:\n\n      .. code-block:: console\n\n         received IRQ and full message: Ping message from ID8                                                                        \"\n         received IRQ and full message: Ping message from ID8                                                                        \"\n         received IRQ and full message: Ping message from ID8                                                                        \"\n         received IRQ and full message: Ping message from ID8                                                                        \"\n         received IRQ and full message: Ping message from ID8                                                                        \"\n         received IRQ and full message: Ping message from ID8                                                                        \"\n         received IRQ and full message: Ping message from ID8                                                                        \"\n         received IRQ and full message: Ping message from ID8                                                                        \"\n\n#. Let it running for a couple of hours, in this scenario 2 hours, then issue the stop command:\n\n      .. code-block:: console\n\n         uart:~$ ivshmem_send_continuous_stop\n\n#. The message should stop to arrive, observe it on the other instance.\n#. Invert the instance, and repeat the last 4 instructions above.\n#. Observe the result must be the same, messages arrives without error to the other instances\n   and after a stop command it should stop.\n#. Perform the ``ivshmem_send_continuous`` command once again and leave it for 6 hours.\n#. Observe periodically the other instance, the messages should still arrive contionuosly even after\n   hours of running without errors.\n#. As a final test step, kill both instances of the test-bed, clean both zephyr workspace and rebuild\n   the apps again:\n\n   .. code-block:: console\n\n      $ west build -palways -t run -d instance_1 #-palways will clear the workspace first\n      $ west build -palways -t run -d instance_2\n\n#. Re-run the long run tests and observe the results should be the same, message arrivals\n   without errors or crashing.\n\n#. Additionally you can create a third instance called instance_3 and also flood the ivshmem\n   area:\n\n   .. code-block:: console\n\n      $ mkdir instance_3\n      $ west build -palways -bqemu_cortex_a53 -t run -d instance_3\n\n#. Run ``ivshmem_send_continuous`` command from the third instance to intentionally overwrite\n   the contents of the other sending instance.\n\n#. Observe the although the buffer received on the receiving instance has corrupt contents\n   because there is not locking mechanism on the buffer yet, the application still does not\n   crashes and receive the IRQs properly.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinaro%2Fzephyr-ivshmem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinaro%2Fzephyr-ivshmem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinaro%2Fzephyr-ivshmem/lists"}