Memory can be shared between guests and between Dom0 and guests. This page describes the details needed for sharing memory.
Table of Contents
The following description is one way to accomplish the shared memory and there may be others. The following technique was last tested with the 2017.1 Xilinx release of Petalinux. The following paragraphs describe the process by which some memory is taken from Linux in the device tree and then added as a UIO device in the device tree. It is assumed the user has basic device tree skills understanding how to make changes to existing nodes and adding new nodes together with a basic understand of Xen guest configuration files.
The memory is accessed in Dom0 and the guest as I/O memory rather than normal memory such that performance is not a primary concern. This is the only easy configuration that is supported by default with Xen.
Dom0 Device Tree Changes
Adding Shared Memory
The UIO driver in Linux is used to access the shared memory from Dom0. Note that the iomem statement in the Xen guest configuration file allocates memory in 4K pages so that a 4K minimum is used. The following device tree snippet illustrates how to add the shared memory node.
The command line of Linux is altered to allow the UIO driver to work with the shared memory node that was added. The following command line illustrates the addition of the UIO kernel module parameter initialization to allow the UIO driver to be compatible with the shared memory node in the device tree.
Note that the string "uio-dev" only has to match the compatible property of the shared memory node and could be any string.
The Xen guest configuration file is altered to use the shared memory as Device I/O memory. The following line illustrates the I/O mem line that allows the guest access to the shared memory together with the 2nd UART.