Add SHMEM_MAP/_UNMAP request to the vhost-user
spec documentation.
Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
docs/interop/vhost-user.rst | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
index d8419fd2f1..d680fea4a3 100644
--- a/docs/interop/vhost-user.rst
+++ b/docs/interop/vhost-user.rst
@@ -369,6 +369,7 @@ In QEMU the vhost-user message is implemented with the following struct:
VhostUserConfig config;
VhostUserVringArea area;
VhostUserInflight inflight;
+ VhostUserMMap mmap;
};
} QEMU_PACKED VhostUserMsg;
@@ -1859,6 +1860,36 @@ is sent by the front-end.
when the operation is successful, or non-zero otherwise. Note that if the
operation fails, no fd is sent to the backend.
+``VHOST_USER_BACKEND_SHMEM_MAP``
+ :id: 9
+ :equivalent ioctl: N/A
+ :request payload: fd and ``struct VhostUserMMap``
+ :reply payload: N/A
+
+ This message can be submitted by the backends to advertise a new mapping
+ to be made in a given VIRTIO Shared Memory Region. Upon receiving the message,
+ The front-end will mmap the given fd into the VIRTIO Shared Memory Region
+ with the requested ``shmid``. A reply is generated indicating whether mapping
+ succeeded.
+
+ Mapping over an already existing map is not allowed and request shall fail.
+ Therefore, the memory range in the request must correspond with a valid,
+ free region of the VIRTIO Shared Memory Region. Also, note that mappings
+ consume resources and that the request can fail when there are no resources
+ available.
+
+``VHOST_USER_BACKEND_SHMEM_UNMAP``
+ :id: 10
+ :equivalent ioctl: N/A
+ :request payload: ``struct VhostUserMMap``
+ :reply payload: N/A
+
+ This message can be submitted by the backends so that the front-end un-mmap
+ a given range (``shm_offset``, ``len``) in the VIRTIO Shared Memory Region
+ with the requested ``shmid``. Note that the given range shall correspond to
+ the entirety of a valid mapped region.
+ A reply is generated indicating whether unmapping succeeded.
+
.. _reply_ack:
VHOST_USER_PROTOCOL_F_REPLY_ACK
--
2.45.2
On Thu, Sep 12, 2024 at 04:44:30PM +0200, Albert Esteve wrote: > Add SHMEM_MAP/_UNMAP request to the vhost-user > spec documentation. > > Signed-off-by: Albert Esteve <aesteve@redhat.com> > --- > docs/interop/vhost-user.rst | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst > index d8419fd2f1..d680fea4a3 100644 > --- a/docs/interop/vhost-user.rst > +++ b/docs/interop/vhost-user.rst > @@ -369,6 +369,7 @@ In QEMU the vhost-user message is implemented with the following struct: > VhostUserConfig config; > VhostUserVringArea area; > VhostUserInflight inflight; > + VhostUserMMap mmap; > }; > } QEMU_PACKED VhostUserMsg; > > @@ -1859,6 +1860,36 @@ is sent by the front-end. > when the operation is successful, or non-zero otherwise. Note that if the > operation fails, no fd is sent to the backend. > > +``VHOST_USER_BACKEND_SHMEM_MAP`` > + :id: 9 > + :equivalent ioctl: N/A > + :request payload: fd and ``struct VhostUserMMap`` > + :reply payload: N/A > + > + This message can be submitted by the backends to advertise a new mapping > + to be made in a given VIRTIO Shared Memory Region. Upon receiving the message, > + The front-end will mmap the given fd into the VIRTIO Shared Memory Region > + with the requested ``shmid``. A reply is generated indicating whether mapping > + succeeded. > + > + Mapping over an already existing map is not allowed and request shall fail. > + Therefore, the memory range in the request must correspond with a valid, > + free region of the VIRTIO Shared Memory Region. Also, note that mappings > + consume resources and that the request can fail when there are no resources > + available. > + > +``VHOST_USER_BACKEND_SHMEM_UNMAP`` > + :id: 10 > + :equivalent ioctl: N/A > + :request payload: ``struct VhostUserMMap`` > + :reply payload: N/A > + > + This message can be submitted by the backends so that the front-end un-mmap > + a given range (``shm_offset``, ``len``) in the VIRTIO Shared Memory Region > + with the requested ``shmid``. Note that the given range shall correspond to > + the entirety of a valid mapped region. > + A reply is generated indicating whether unmapping succeeded. There is no mention of VHOST_USER_PROTOCOL_F_SHMEM. I think it needs to be negotiated in order to use VHOST_USER_BACKEND_SHMEM_MAP and VHOST_USER_BACKEND_SHMEM_UNMAP. > + > .. _reply_ack: > > VHOST_USER_PROTOCOL_F_REPLY_ACK > -- > 2.45.2 >
On Thu, Sep 12, 2024 at 04:44:30PM +0200, Albert Esteve wrote: > Add SHMEM_MAP/_UNMAP request to the vhost-user > spec documentation. > > Signed-off-by: Albert Esteve <aesteve@redhat.com> > --- > docs/interop/vhost-user.rst | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst > index d8419fd2f1..d680fea4a3 100644 > --- a/docs/interop/vhost-user.rst > +++ b/docs/interop/vhost-user.rst > @@ -369,6 +369,7 @@ In QEMU the vhost-user message is implemented with the following struct: > VhostUserConfig config; > VhostUserVringArea area; > VhostUserInflight inflight; > + VhostUserMMap mmap; > }; > } QEMU_PACKED VhostUserMsg; > > @@ -1859,6 +1860,36 @@ is sent by the front-end. > when the operation is successful, or non-zero otherwise. Note that if the > operation fails, no fd is sent to the backend. > > +``VHOST_USER_BACKEND_SHMEM_MAP`` > + :id: 9 > + :equivalent ioctl: N/A > + :request payload: fd and ``struct VhostUserMMap`` Where is struct VhostUserMMap defined? Please keep patches self-contained and in a logical order so they can be reviewed linearly. Otherwise: Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> > + :reply payload: N/A > + > + This message can be submitted by the backends to advertise a new mapping > + to be made in a given VIRTIO Shared Memory Region. Upon receiving the message, > + The front-end will mmap the given fd into the VIRTIO Shared Memory Region > + with the requested ``shmid``. A reply is generated indicating whether mapping > + succeeded. > + > + Mapping over an already existing map is not allowed and request shall fail. > + Therefore, the memory range in the request must correspond with a valid, > + free region of the VIRTIO Shared Memory Region. Also, note that mappings > + consume resources and that the request can fail when there are no resources > + available. > + > +``VHOST_USER_BACKEND_SHMEM_UNMAP`` > + :id: 10 > + :equivalent ioctl: N/A > + :request payload: ``struct VhostUserMMap`` > + :reply payload: N/A > + > + This message can be submitted by the backends so that the front-end un-mmap > + a given range (``shm_offset``, ``len``) in the VIRTIO Shared Memory Region > + with the requested ``shmid``. Note that the given range shall correspond to > + the entirety of a valid mapped region. > + A reply is generated indicating whether unmapping succeeded. > + > .. _reply_ack: > > VHOST_USER_PROTOCOL_F_REPLY_ACK > -- > 2.45.2 >
© 2016 - 2024 Red Hat, Inc.