On 05/30/2017 08:17 PM, Michael S. Tsirkin wrote:
On Fri, May 26, 2017 at 04:28:57PM +0200, Maxime Coquelin wrote:
From: Marc-André Lureau<marcandre.lur...@redhat.com>

Learn to give a socket to the slave to let him make requests to the
master.

Signed-off-by: Marc-André Lureau<marcandre.lur...@redhat.com>
Signed-off-by: Maxime Coquelin<maxime.coque...@redhat.com>
---
  docs/specs/vhost-user.txt |  32 +++++++++++-
  hw/virtio/vhost-user.c    | 127 ++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 157 insertions(+), 2 deletions(-)

diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt
index 036890f..5fa7016 100644
--- a/docs/specs/vhost-user.txt
+++ b/docs/specs/vhost-user.txt
@@ -139,6 +139,7 @@ in the ancillary data:
   * VHOST_USER_SET_VRING_KICK
   * VHOST_USER_SET_VRING_CALL
   * VHOST_USER_SET_VRING_ERR
+ * VHOST_USER_SET_SLAVE_REQ_FD
If Master is unable to send the full message or receives a wrong reply it will
  close the connection. An optional reconnection mechanism can be implemented.
@@ -252,6 +253,18 @@ Once the source has finished migration, rings will be 
stopped by
  the source. No further update must be done before rings are
  restarted.
+Slave communication
+-------------------
+
+An optional communication channel is provided if the slave declares
+VHOST_USER_PROTOCOL_F_SLAVE_REQ protocol feature, to allow the slave to make
+requests to the master.
+
+The fd is provided via VHOST_USER_SET_SLAVE_REQ_FD ancillary data.
+
+A slave may then send VHOST_USER_SLAVE_* messages to the master
+using this fd communication channel.
+
  Protocol features
  -----------------
@@ -260,9 +273,10 @@ Protocol features
  #define VHOST_USER_PROTOCOL_F_RARP           2
  #define VHOST_USER_PROTOCOL_F_REPLY_ACK      3
  #define VHOST_USER_PROTOCOL_F_MTU            4
+#define VHOST_USER_PROTOCOL_F_SLAVE_REQ      5
-Message types
--------------
+Master message types
+--------------------
* VHOST_USER_GET_FEATURES

So down the road, we should make sure a device without
VHOST_USER_PROTOCOL_F_SLAVE_REQ does not advertise IOMMU
since you don't handle these messages otherwise.

Right, I will add a check to ensure this, and make this clearer
in the IOMMU spec part.

Thanks,
Maxime


Reply via email to