|
Justin M. Forbes |
eff942 |
From 575c00a2880177295a116d43132566143af69a0b Mon Sep 17 00:00:00 2001
|
|
Justin M. Forbes |
eff942 |
From: Michael S. Tsirkin <mst@redhat.com>
|
|
Justin M. Forbes |
eff942 |
Date: Wed, 24 Feb 2010 21:09:51 +0200
|
|
Justin M. Forbes |
eff942 |
Subject: [PATCH] vhost: move vhost_set_vq_addr
|
|
Justin M. Forbes |
eff942 |
|
|
Justin M. Forbes |
eff942 |
Move function in file: we'll add another
|
|
Justin M. Forbes |
eff942 |
call site in the following patch.
|
|
Justin M. Forbes |
eff942 |
|
|
Justin M. Forbes |
eff942 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Justin M. Forbes |
eff942 |
---
|
|
Justin M. Forbes |
eff942 |
hw/vhost.c | 38 +++++++++++++++++++-------------------
|
|
Justin M. Forbes |
eff942 |
1 files changed, 19 insertions(+), 19 deletions(-)
|
|
Justin M. Forbes |
eff942 |
|
|
Justin M. Forbes |
eff942 |
diff --git a/hw/vhost.c b/hw/vhost.c
|
|
Justin M. Forbes |
eff942 |
index 3c54596..54386e1 100644
|
|
Justin M. Forbes |
eff942 |
--- a/hw/vhost.c
|
|
Justin M. Forbes |
eff942 |
+++ b/hw/vhost.c
|
|
Justin M. Forbes |
eff942 |
@@ -306,6 +306,25 @@ static void vhost_client_set_memory(CPUPhysMemoryClient *client,
|
|
Justin M. Forbes |
eff942 |
}
|
|
Justin M. Forbes |
eff942 |
}
|
|
Justin M. Forbes |
eff942 |
|
|
Justin M. Forbes |
eff942 |
+static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
|
|
Justin M. Forbes |
eff942 |
+ struct vhost_virtqueue *vq,
|
|
Justin M. Forbes |
eff942 |
+ unsigned idx, bool enable_log)
|
|
Justin M. Forbes |
eff942 |
+{
|
|
Justin M. Forbes |
eff942 |
+ struct vhost_vring_addr addr = {
|
|
Justin M. Forbes |
eff942 |
+ .index = idx,
|
|
Justin M. Forbes |
eff942 |
+ .desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
|
|
Justin M. Forbes |
eff942 |
+ .avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
|
|
Justin M. Forbes |
eff942 |
+ .used_user_addr = (u_int64_t)(unsigned long)vq->used,
|
|
Justin M. Forbes |
eff942 |
+ .log_guest_addr = vq->used_phys,
|
|
Justin M. Forbes |
eff942 |
+ .flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
|
|
Justin M. Forbes |
eff942 |
+ };
|
|
Justin M. Forbes |
eff942 |
+ int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
|
|
Justin M. Forbes |
eff942 |
+ if (r < 0) {
|
|
Justin M. Forbes |
eff942 |
+ return -errno;
|
|
Justin M. Forbes |
eff942 |
+ }
|
|
Justin M. Forbes |
eff942 |
+ return 0;
|
|
Justin M. Forbes |
eff942 |
+}
|
|
Justin M. Forbes |
eff942 |
+
|
|
Justin M. Forbes |
eff942 |
static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
|
|
Justin M. Forbes |
eff942 |
{
|
|
Justin M. Forbes |
eff942 |
uint64_t features = dev->acked_features;
|
|
Justin M. Forbes |
eff942 |
@@ -350,25 +369,6 @@ static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
|
|
Justin M. Forbes |
eff942 |
return 0;
|
|
Justin M. Forbes |
eff942 |
}
|
|
Justin M. Forbes |
eff942 |
|
|
Justin M. Forbes |
eff942 |
-static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
|
|
Justin M. Forbes |
eff942 |
- struct vhost_virtqueue *vq,
|
|
Justin M. Forbes |
eff942 |
- unsigned idx, bool enable_log)
|
|
Justin M. Forbes |
eff942 |
-{
|
|
Justin M. Forbes |
eff942 |
- struct vhost_vring_addr addr = {
|
|
Justin M. Forbes |
eff942 |
- .index = idx,
|
|
Justin M. Forbes |
eff942 |
- .desc_user_addr = (u_int64_t)(unsigned long)vq->desc,
|
|
Justin M. Forbes |
eff942 |
- .avail_user_addr = (u_int64_t)(unsigned long)vq->avail,
|
|
Justin M. Forbes |
eff942 |
- .used_user_addr = (u_int64_t)(unsigned long)vq->used,
|
|
Justin M. Forbes |
eff942 |
- .log_guest_addr = vq->used_phys,
|
|
Justin M. Forbes |
eff942 |
- .flags = enable_log ? (1 << VHOST_VRING_F_LOG) : 0,
|
|
Justin M. Forbes |
eff942 |
- };
|
|
Justin M. Forbes |
eff942 |
- int r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr);
|
|
Justin M. Forbes |
eff942 |
- if (r < 0) {
|
|
Justin M. Forbes |
eff942 |
- return -errno;
|
|
Justin M. Forbes |
eff942 |
- }
|
|
Justin M. Forbes |
eff942 |
- return 0;
|
|
Justin M. Forbes |
eff942 |
-}
|
|
Justin M. Forbes |
eff942 |
-
|
|
Justin M. Forbes |
eff942 |
static int vhost_virtqueue_init(struct vhost_dev *dev,
|
|
Justin M. Forbes |
eff942 |
struct VirtIODevice *vdev,
|
|
Justin M. Forbes |
eff942 |
struct vhost_virtqueue *vq,
|
|
Justin M. Forbes |
eff942 |
--
|
|
Justin M. Forbes |
eff942 |
1.6.6.1
|
|
Justin M. Forbes |
eff942 |
|