qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC 4/8] vdpa: Add log_enabled to VhostVDPAState


From: Eugenio Pérez
Subject: [RFC 4/8] vdpa: Add log_enabled to VhostVDPAState
Date: Wed, 10 Aug 2022 20:42:16 +0200

This enables VhostVDPAState to track the logging of the memory.

It cannot be merged with s->always_svq because always_svq is immutable
from the moment the device is parsed, and log_enabled must be enabled or
disabled depending on the log state.

Apart from that, they will affect the same to vhost vdpa device,
enabling the shadow virtqueue unconditionally.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 net/vhost-vdpa.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 85b10799bd..a035c89c34 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -42,6 +42,10 @@ typedef struct VhostVDPAState {
 
     /* The device always have SVQ enabled */
     bool always_svq;
+
+    /* Device log enabled */
+    bool log_enabled;
+
     bool started;
 } VhostVDPAState;
 
@@ -346,15 +350,15 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc)
     cvq_group.index = v->dev->vq_index_end - 1;
 
     /* Default values */
-    v->listener_shadow_vq = s->always_svq;
-    v->shadow_vqs_enabled = s->always_svq;
+    v->listener_shadow_vq = s->always_svq || s->log_enabled;
+    v->shadow_vqs_enabled = s->always_svq || s->log_enabled;
     s->vhost_vdpa.address_space_id = VHOST_VDPA_NET_CVQ_PASSTHROUGH;
 
     if (s->address_space_num < 2) {
         return 0;
     }
 
-    if (s->always_svq) {
+    if (s->always_svq || s->log_enabled) {
         goto out;
     }
 
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]