From 87e896abe6d926caba19a9b8a83936fca2137f05 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 11 Sep 2015 17:14:25 -0300 Subject: pc: Introduce pc-*-2.5 machine classes Signed-off-by: Eduardo Habkost Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/compat.h | 3 +++ include/hw/i386/pc.h | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'include') diff --git a/include/hw/compat.h b/include/hw/compat.h index 94c8097d0c..095de5d12f 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -1,6 +1,9 @@ #ifndef HW_COMPAT_H #define HW_COMPAT_H +#define HW_COMPAT_2_4 \ + /* empty */ + #define HW_COMPAT_2_3 \ {\ .driver = "virtio-blk-pci",\ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 3e002c9da6..6896328aa0 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -291,7 +291,11 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t); int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); +#define PC_COMPAT_2_4 \ + HW_COMPAT_2_4 + #define PC_COMPAT_2_3 \ + PC_COMPAT_2_4 \ HW_COMPAT_2_3 \ {\ .driver = TYPE_X86_CPU,\ -- cgit v1.2.3 From dcb10c000cdd4d14f5ac4f07b04fb666494ef4a8 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 23 Sep 2015 12:19:56 +0800 Subject: vhost-user: add protocol feature negotiation Support a separate bitmask for vhost-user protocol features, and messages to get/set protocol features. Invoke them at init. No features are defined yet. [ leverage vhost_user_call for request handling -- Yuanhan Liu ] Signed-off-by: Michael S. Tsirkin Signed-off-by: Yuanhan Liu Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Signed-off-by: Yuanhan Liu Reviewed-by: Marcel Apfelbaum Tested-by: Marcel Apfelbaum --- include/hw/virtio/vhost.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index dd510509eb..6467c73ecf 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -47,6 +47,7 @@ struct vhost_dev { unsigned long long features; unsigned long long acked_features; unsigned long long backend_features; + unsigned long long protocol_features; bool started; bool log_enabled; unsigned long long log_size; -- cgit v1.2.3 From e2051e9e004649b53af4db34f78c689fb44e075b Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Wed, 23 Sep 2015 12:19:58 +0800 Subject: vhost-user: add VHOST_USER_GET_QUEUE_NUM message This is for querying how many queues the backend supports if it has mq support(when VHOST_USER_PROTOCOL_F_MQ flag is set from the quried protocol features). vhost_net_get_max_queues() is the interface to export that value, and to tell if the backend supports # of queues user requested, which is done in the following patch. Signed-off-by: Yuanhan Liu Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Signed-off-by: Yuanhan Liu Tested-by: Marcel Apfelbaum --- include/hw/virtio/vhost.h | 1 + include/net/vhost_net.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 6467c73ecf..c3758f3c78 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -48,6 +48,7 @@ struct vhost_dev { unsigned long long acked_features; unsigned long long backend_features; unsigned long long protocol_features; + unsigned long long max_queues; bool started; bool log_enabled; unsigned long long log_size; diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index 840d4b16e2..8db723e54b 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -13,6 +13,7 @@ typedef struct VhostNetOptions { void *opaque; } VhostNetOptions; +uint64_t vhost_net_get_max_queues(VHostNetState *net); struct vhost_net *vhost_net_init(VhostNetOptions *options); int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues); -- cgit v1.2.3 From fc57fd9900dc6344b8833e7641f63cddc6840301 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Wed, 23 Sep 2015 12:19:59 +0800 Subject: vhost: introduce vhost_backend_get_vq_index method Minusing the idx with the base(dev->vq_index) for vhost-kernel, and then adding it back for vhost-user doesn't seem right. Here introduces a new method vhost_backend_get_vq_index() for getting the right vq index for following vhost messages calls. Suggested-by: Jason Wang Signed-off-by: Yuanhan Liu Reviewed-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Signed-off-by: Yuanhan Liu Tested-by: Marcel Apfelbaum --- include/hw/virtio/vhost-backend.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h index e472f29714..e1dfc6dd73 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -24,12 +24,14 @@ typedef int (*vhost_call)(struct vhost_dev *dev, unsigned long int request, void *arg); typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque); typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev); +typedef int (*vhost_backend_get_vq_index)(struct vhost_dev *dev, int idx); typedef struct VhostOps { VhostBackendType backend_type; vhost_call vhost_call; vhost_backend_init vhost_backend_init; vhost_backend_cleanup vhost_backend_cleanup; + vhost_backend_get_vq_index vhost_backend_get_vq_index; } VhostOps; extern const VhostOps user_ops; -- cgit v1.2.3 From 7263a0ad7899994b719ebed736a1119cc2e08110 Mon Sep 17 00:00:00 2001 From: Changchun Ouyang Date: Wed, 23 Sep 2015 12:20:01 +0800 Subject: vhost-user: add a new message to disable/enable a specific virt queue. Add a new message, VHOST_USER_SET_VRING_ENABLE, to enable or disable a specific virt queue, which is similar to attach/detach queue for tap device. virtio driver on guest doesn't have to use max virt queue pair, it could enable any number of virt queue ranging from 1 to max virt queue pair. Signed-off-by: Changchun Ouyang Signed-off-by: Yuanhan Liu Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Signed-off-by: Yuanhan Liu Reviewed-by: Jason Wang Tested-by: Marcel Apfelbaum --- include/hw/virtio/vhost-backend.h | 2 ++ include/net/vhost_net.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h index e1dfc6dd73..3a0f6e2dc2 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -25,6 +25,7 @@ typedef int (*vhost_call)(struct vhost_dev *dev, unsigned long int request, typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque); typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev); typedef int (*vhost_backend_get_vq_index)(struct vhost_dev *dev, int idx); +typedef int (*vhost_backend_set_vring_enable)(struct vhost_dev *dev, int enable); typedef struct VhostOps { VhostBackendType backend_type; @@ -32,6 +33,7 @@ typedef struct VhostOps { vhost_backend_init vhost_backend_init; vhost_backend_cleanup vhost_backend_cleanup; vhost_backend_get_vq_index vhost_backend_get_vq_index; + vhost_backend_set_vring_enable vhost_backend_set_vring_enable; } VhostOps; extern const VhostOps user_ops; diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index 8db723e54b..0188c4d02d 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -28,4 +28,6 @@ bool vhost_net_virtqueue_pending(VHostNetState *net, int n); void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, int idx, bool mask); VHostNetState *get_vhost_net(NetClientState *nc); + +int vhost_set_vring_enable(NetClientState * nc, int enable); #endif -- cgit v1.2.3