Lines Matching +full:shared +full:- +full:memory

1 .. zephyr:code-sample:: ivshmem-doorbell
3 :relevant-api: ivshmem
5 Use Inter-VM Shared Memory to exchange messages between two processes running on different
20 ivshmem-server needs to be available and running. The server is available in
21 Zephyr SDK or pre-built in some distributions. Otherwise, it is available in
24 ivshmem-client needs to be available as it is employed in this sample as an
25 external application. The same conditions of ivshmem-server applies to the
26 ivshmem-server, as it is also available via QEMU.
31 Building ivshmem-doorbell is as follows:
36 .. zephyr-app-commands::
37 :zephyr-app: samples/drivers/virtualization/ivshmem/doorbell
38 :host-os: unix
46 .. zephyr-app-commands::
47 :zephyr-app: samples/drivers/virtualization/ivshmem/doorbell
48 :host-os: unix
56 .. zephyr-app-commands::
57 :zephyr-app: samples/drivers/virtualization/ivshmem/doorbell
58 :host-os: unix
68 The ivshmem shared memory can be manipulated to crash QEMU and bring down
73 Due to limited RAM memory available in qemu_x86_64 dts, it is not possible
74 to use the default shared memory size of ivshmem (4MB) for this platform.
78 #. Run ivshmem-server. For the ivshmem-server, both number of vectors and
79 shared memory size are decided at run-time (when the server is executed).
80 For Zephyr, the number of vectors and shared memory size of ivshmem are
81 decided at compile-time and run-time, respectively.
83 - (Arm64) Use vectors == 2 for the project configuration in this sample.
86 .. code-block:: console
89 $ sudo ivshmem-server -n 2
92 - (x86_64) The default shared memory size is bigger than the memory
95 .. code-block:: console
97 # n = number of vectors, l = shared memory size
98 $ sudo ivshmem-server -n 2 -l 4096
101 - (Optional) If vectors != 2, you need to change ivshmem driver
107 .. code-block:: console
118 .. code-block:: console
120 $ west build -t run
121 -- west build: running target run
122 [0/1] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: cortex-a53
123 *** Booting Zephyr OS build zephyr-v3.3.0-1649-g612f49da5dee ***
124 Use write_shared_memory.sh and ivshmem-client to send a message
126 #. Write a message in the shared memory. The shared memory size *must* be kept
127 the same as specified for ivshmem-server. This is the purpose of the
128 ``write_shared_memory`` script; failing to respect the shared memory size
131 - (Arm64) a simple "hello world" message (the script assumes the default
132 size of ivshmem-server):
134 .. code-block:: console
136 # ./write_shared_memory.sh -m "your message"
137 $ ./write_shared_memory.sh -m "hello world"
140 - (x86_64) a simple "hello world" message:
142 .. code-block:: console
144 # ./write_shared_memory.sh -m "your message" -s <size of shared memory>
145 # assumption: the user created ivshmem-server with size 4096
146 $ ./write_shared_memory.sh -m "hello world" -s 4096
149 5. Send an interrupt to the guest. Using ivshmem-client, for instance:
151 .. code-block:: console
154 $ ivshmem-client
169 #. The sample will print the text in the shared memory whenever an interrupt is
170 received (in any of the ivshmem-vectors). Example of output for arm64:
172 .. code-block:: console
174 $ west build -t run
175 -- west build: running target run
176 [0/1] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: cortex-a53
177 *** Booting Zephyr OS build zephyr-v3.3.0-1649-g612f49da5dee ***
178 Use write_shared_memory.sh and ivshmem-client to send a message
195 This sample assumes that the shared memory region size is constant; therefore,
196 once the memory is set during PCI configuration, it should not be tampered
197 with. This is straight-forward if you are writing an application and uses
199 the shared memory as a file, and overwrite the shared memory size to the input
202 One way to ensure proper consistency is: (i) restrict access to the shared
203 memory to trusted users; a rogue user with improper access can easily truncate
204 the memory size to zero, for example by using :command:`truncate`, and make QEMU
206 (ii) make sure writes always respect the shared memory region size.