xref: /openbmc/qemu/docs/system/devices/ivshmem-flat.rst (revision 8b70d7f2071e2db51b1910502bfb7f84ebf926be)
1*e6c33efeSGustavo RomeroInter-VM Shared Memory Flat Device
2*e6c33efeSGustavo Romero----------------------------------
3*e6c33efeSGustavo Romero
4*e6c33efeSGustavo RomeroThe ivshmem-flat device is meant to be used on machines that lack a PCI bus,
5*e6c33efeSGustavo Romeromaking them unsuitable for the use of the traditional ivshmem device modeled as
6*e6c33efeSGustavo Romeroa PCI device. Machines like those with a Cortex-M MCU are good candidates to use
7*e6c33efeSGustavo Romerothe ivshmem-flat device. Also, since the flat version maps the control and
8*e6c33efeSGustavo Romerostatus registers directly to the memory, it requires a quite tiny "device
9*e6c33efeSGustavo Romerodriver" to interact with other VMs, which is useful in some RTOSes, like
10*e6c33efeSGustavo RomeroZephyr, which usually run on constrained resource targets.
11*e6c33efeSGustavo Romero
12*e6c33efeSGustavo RomeroSimilar to the ivshmem device, the ivshmem-flat device supports both peer
13*e6c33efeSGustavo Romeronotification via HW interrupts and Inter-VM shared memory. This allows the
14*e6c33efeSGustavo Romerodevice to be used together with the traditional ivshmem, enabling communication
15*e6c33efeSGustavo Romerobetween, for instance, an aarch64 VM  (using the traditional ivshmem device and
16*e6c33efeSGustavo Romerorunning Linux), and an arm VM (using the ivshmem-flat device and running Zephyr
17*e6c33efeSGustavo Romeroinstead).
18*e6c33efeSGustavo Romero
19*e6c33efeSGustavo RomeroThe ivshmem-flat device does not support the use of a ``memdev`` option (see
20*e6c33efeSGustavo Romeroivshmem.rst for more details). It relies on the ivshmem server to create and
21*e6c33efeSGustavo Romerodistribute the proper shared memory file descriptor and the eventfd(s) to notify
22*e6c33efeSGustavo Romero(interrupt) the peers. Therefore, to use this device, it is always necessary to
23*e6c33efeSGustavo Romerohave an ivshmem server up and running for proper device creation.
24*e6c33efeSGustavo Romero
25*e6c33efeSGustavo RomeroAlthough the ivshmem-flat supports both peer notification (interrupts) and
26*e6c33efeSGustavo Romeroshared memory, the interrupt mechanism is optional. If no input IRQ is
27*e6c33efeSGustavo Romerospecified for the device it is disabled, preventing the VM from notifying or
28*e6c33efeSGustavo Romerobeing notified by other VMs (a warning will be displayed to the user to inform
29*e6c33efeSGustavo Romerothe IRQ mechanism is disabled). The shared memory region is always present.
30*e6c33efeSGustavo Romero
31*e6c33efeSGustavo RomeroThe MMRs (INTRMASK, INTRSTATUS, IVPOSITION, and DOORBELL registers) offsets at
32*e6c33efeSGustavo Romerothe MMR region, and their functions, follow the ivshmem spec, so they work
33*e6c33efeSGustavo Romeroexactly as in the ivshmem PCI device (see ./specs/ivshmem-spec.txt).
34