render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone
Blob Blame History Raw
From 575c00a2880177295a116d43132566143af69a0b Mon Sep 17 00:00:00 2001
From: Michael S. Tsirkin <mst@redhat.com>
Date: Wed, 24 Feb 2010 21:09:51 +0200
Subject: [PATCH] vhost: move vhost_set_vq_addr

Move function in file: we'll add another
call site in the following patch.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/vhost.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/hw/vhost.c b/hw/vhost.c
index 3c54596..54386e1 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -306,6 +306,25 @@ static void vhost_client_set_memory(CPUPhysMemoryClient *client,
 	}
 }

+static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
+				    struct vhost_virtqueue *vq,
+				    unsigned idx, bool enable_log)
+{
+	struct vhost_vring_addr addr = {
+		.index = idx,
+		.desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
+		.avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
+		.used_user_addr = (u_int64_t)(unsigned long)vq->used,
+		.log_guest_addr = vq->used_phys,
+		.flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
+	};
+	int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
+	if (r < 0) {
+		return -errno;
+	}
+	return 0;
+}
+
 static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
 {
 	uint64_t features = dev->acked_features;
@@ -350,25 +369,6 @@ static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
 	return 0;
 }

-static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
-				    struct vhost_virtqueue *vq,
-				    unsigned idx, bool enable_log)
-{
-	struct vhost_vring_addr addr = {
-		.index = idx,
-		.desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
-		.avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
-		.used_user_addr = (u_int64_t)(unsigned long)vq->used,
-		.log_guest_addr = vq->used_phys,
-		.flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
-	};
-	int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
-	if (r < 0) {
-		return -errno;
-	}
-	return 0;
-}
-
 static int vhost_virtqueue_init(struct vhost_dev *dev,
 				struct VirtIODevice *vdev,
 				struct vhost_virtqueue *vq,
-- 
1.6.6.1