aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/vhost/vhost.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 6eb15259f5ae..db21518f7e8d 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1004,10 +1004,14 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len)
1004 if (unlikely(vq->log_used)) { 1004 if (unlikely(vq->log_used)) {
1005 /* Make sure data is seen before log. */ 1005 /* Make sure data is seen before log. */
1006 smp_wmb(); 1006 smp_wmb();
1007 log_write(vq->log_base, vq->log_addr + sizeof *vq->used->ring * 1007 /* Log used ring entry write. */
1008 (vq->last_used_idx % vq->num), 1008 log_write(vq->log_base,
1009 sizeof *vq->used->ring); 1009 vq->log_addr + ((void *)used - (void *)vq->used),
1010 log_write(vq->log_base, vq->log_addr, sizeof *vq->used->ring); 1010 sizeof *used);
1011 /* Log used index update. */
1012 log_write(vq->log_base,
1013 vq->log_addr + offsetof(struct vring_used, idx),
1014 sizeof vq->used->idx);
1011 if (vq->log_ctx) 1015 if (vq->log_ctx)
1012 eventfd_signal(vq->log_ctx, 1); 1016 eventfd_signal(vq->log_ctx, 1);
1013 } 1017 }