[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/31] docs: vhost-user: Add Xen specific memory mapping support
From: |
Michael S. Tsirkin |
Subject: |
[PULL 07/31] docs: vhost-user: Add Xen specific memory mapping support |
Date: |
Tue, 25 Apr 2023 03:45:08 -0400 |
From: Viresh Kumar <viresh.kumar@linaro.org>
The current model of memory mapping at the back-end works fine where a
standard call to mmap() (for the respective file descriptor) is enough
before the front-end can start accessing the guest memory.
There are other complex cases though where the back-end needs more
information and simple mmap() isn't enough. For example Xen, a type-1
hypervisor, currently supports memory mapping via two different methods,
foreign-mapping (via /dev/privcmd) and grant-dev (via /dev/gntdev). In
both these cases, the back-end needs to call mmap() and ioctl(), with
extra information like the Xen domain-id of the guest whose memory we
are trying to map.
Add a new protocol feature, 'VHOST_USER_PROTOCOL_F_XEN_MMAP', which lets
the back-end know about the additional memory mapping requirements.
When this feature is negotiated, the front-end will send the additional
information within the memory regions themselves.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Message-Id:
<6d0bd7f0e1aeec3ddb603ae4ff334c75c7d0d7b3.1678351495.git.viresh.kumar@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
---
docs/interop/vhost-user.rst | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
index 1720d68126..5a070adbc1 100644
--- a/docs/interop/vhost-user.rst
+++ b/docs/interop/vhost-user.rst
@@ -145,6 +145,26 @@ Memory region description
:mmap offset: 64-bit offset where region starts in the mapped memory
+When the ``VHOST_USER_PROTOCOL_F_XEN_MMAP`` protocol feature has been
+successfully negotiated, the memory region description contains two extra
+fields at the end.
+
++---------------+------+--------------+-------------+----------------+-------+
+| guest address | size | user address | mmap offset | xen mmap flags | domid |
++---------------+------+--------------+-------------+----------------+-------+
+
+:xen mmap flags: 32-bit bit field
+
+- Bit 0 is set for Xen foreign memory mapping.
+- Bit 1 is set for Xen grant memory mapping.
+- Bit 8 is set if the memory region can not be mapped in advance, and memory
+ areas within this region must be mapped / unmapped only when required by the
+ back-end. The back-end shouldn't try to map the entire region at once, as the
+ front-end may not allow it. The back-end should rather map only the required
+ amount of memory at once and unmap it after it is used.
+
+:domid: a 32-bit Xen hypervisor specific domain id.
+
Single memory region description
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -864,6 +884,7 @@ Protocol features
#define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS 14
#define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS 15
#define VHOST_USER_PROTOCOL_F_STATUS 16
+ #define VHOST_USER_PROTOCOL_F_XEN_MMAP 17
Front-end message types
-----------------------
--
MST
- [PULL 00/31] virtio,pc,pci: fixes, features, cleanups, Michael S. Tsirkin, 2023/04/25
- [PULL 01/31] virtio: refresh vring region cache after updating a virtqueue size, Michael S. Tsirkin, 2023/04/25
- [PULL 03/31] vdpa: accept VIRTIO_NET_F_SPEED_DUPLEX in SVQ, Michael S. Tsirkin, 2023/04/25
- [PULL 05/31] vhost: Drop unused eventfd_add|del hooks, Michael S. Tsirkin, 2023/04/25
- [PULL 04/31] meson_options.txt: Enable qom-cast-debug by default again, Michael S. Tsirkin, 2023/04/25
- [PULL 06/31] docs: vhost-user: Define memory region separately, Michael S. Tsirkin, 2023/04/25
- [PULL 08/31] virtio-balloon: optimize the virtio-balloon on the ARM platform, Michael S. Tsirkin, 2023/04/25
- [PULL 07/31] docs: vhost-user: Add Xen specific memory mapping support,
Michael S. Tsirkin <=
- [PULL 02/31] Add my old and new work email mapping and use work email to support biosbits, Michael S. Tsirkin, 2023/04/25
- [PULL 09/31] MAINTAINERS: Mark AMD-Vi emulation as orphan, Michael S. Tsirkin, 2023/04/25
- [PULL 11/31] hw/i386/amd_iommu: Remove intermediate AMDVIState::devid field, Michael S. Tsirkin, 2023/04/25
- [PULL 10/31] hw/i386/amd_iommu: Explicit use of AMDVI_BASE_ADDR in amdvi_init, Michael S. Tsirkin, 2023/04/25
- [PULL 12/31] hw/i386/amd_iommu: Move capab_offset from AMDVIState to AMDVIPCIState, Michael S. Tsirkin, 2023/04/25
- [PULL 13/31] hw/i386/amd_iommu: Set PCI static/const fields via PCIDeviceClass, Michael S. Tsirkin, 2023/04/25
- [PULL 14/31] hw/i386/amd_iommu: Factor amdvi_pci_realize out of amdvi_sysbus_realize, Michael S. Tsirkin, 2023/04/25
- [PULL 15/31] hw: Add compat machines for 8.1, Michael S. Tsirkin, 2023/04/25
- [PULL 16/31] pci: avoid accessing slot_reserved_mask directly outside of pci.c, Michael S. Tsirkin, 2023/04/25
- [PULL 17/31] vhost-user-blk-server: notify client about disk resize, Michael S. Tsirkin, 2023/04/25