Lines Matching refs:vub

24     VHostUserBase *vub = VHOST_USER_BASE(vdev);  in vub_start()  local
32 ret = vhost_dev_enable_notifiers(&vub->vhost_dev, vdev); in vub_start()
38 ret = k->set_guest_notifiers(qbus->parent, vub->vhost_dev.nvqs, true); in vub_start()
44 vub->vhost_dev.acked_features = vdev->guest_features; in vub_start()
46 ret = vhost_dev_start(&vub->vhost_dev, vdev, true); in vub_start()
57 for (i = 0; i < vub->vhost_dev.nvqs; i++) { in vub_start()
58 vhost_virtqueue_mask(&vub->vhost_dev, vdev, i, false); in vub_start()
64 k->set_guest_notifiers(qbus->parent, vub->vhost_dev.nvqs, false); in vub_start()
66 vhost_dev_disable_notifiers(&vub->vhost_dev, vdev); in vub_start()
71 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_stop() local
80 ret = vhost_dev_stop(&vub->vhost_dev, vdev, true); in vub_stop()
82 if (k->set_guest_notifiers(qbus->parent, vub->vhost_dev.nvqs, false) < 0) { in vub_stop()
87 vhost_dev_disable_notifiers(&vub->vhost_dev, vdev); in vub_stop()
93 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_set_status() local
96 if (vhost_dev_is_started(&vub->vhost_dev) == should_start) { in vub_set_status()
120 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_get_features() local
122 g_assert(vub->vhost_dev.features); in vub_get_features()
123 return vub->vhost_dev.features & ~(1ULL << VHOST_USER_F_PROTOCOL_FEATURES); in vub_get_features()
133 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_get_config() local
140 g_assert(vub->config_size && vub->vhost_user.supports_config == true); in vub_get_config()
142 if (vhost_dev_get_config(&vub->vhost_dev, config, in vub_get_config()
143 vub->config_size, &local_err)) { in vub_get_config()
150 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_set_config() local
153 g_assert(vub->config_size && vub->vhost_user.supports_config == true); in vub_set_config()
155 ret = vhost_dev_set_config(&vub->vhost_dev, config_data, in vub_set_config()
156 0, vub->config_size, in vub_set_config()
186 static void do_vhost_user_cleanup(VirtIODevice *vdev, VHostUserBase *vub) in do_vhost_user_cleanup() argument
188 vhost_user_cleanup(&vub->vhost_user); in do_vhost_user_cleanup()
190 for (int i = 0; i < vub->num_vqs; i++) { in do_vhost_user_cleanup()
191 VirtQueue *vq = g_ptr_array_index(vub->vqs, i); in do_vhost_user_cleanup()
201 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_connect() local
202 struct vhost_dev *vhost_dev = &vub->vhost_dev; in vub_connect()
204 if (vub->connected) { in vub_connect()
207 vub->connected = true; in vub_connect()
213 if (vub->vhost_user.supports_config) { in vub_connect()
230 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_disconnect() local
231 struct vhost_virtqueue *vhost_vqs = vub->vhost_dev.vqs; in vub_disconnect()
233 if (!vub->connected) { in vub_disconnect()
236 vub->connected = false; in vub_disconnect()
239 vhost_dev_cleanup(&vub->vhost_dev); in vub_disconnect()
244 qemu_chr_fe_set_handlers(&vub->chardev, in vub_disconnect()
253 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_event() local
258 qemu_chr_fe_disconnect(&vub->chardev); in vub_event()
264 vhost_user_async_close(dev, &vub->chardev, &vub->vhost_dev, in vub_event()
278 VHostUserBase *vub = VHOST_USER_BASE(dev); in vub_device_realize() local
281 if (!vub->chardev.chr) { in vub_device_realize()
286 if (!vub->virtio_id) { in vub_device_realize()
291 if (!vub->num_vqs) { in vub_device_realize()
292 vub->num_vqs = 1; /* reasonable default? */ in vub_device_realize()
295 if (!vub->vq_size) { in vub_device_realize()
296 vub->vq_size = 64; in vub_device_realize()
304 if (vub->config_size) { in vub_device_realize()
305 vub->vhost_user.supports_config = true; in vub_device_realize()
308 if (!vhost_user_init(&vub->vhost_user, &vub->chardev, errp)) { in vub_device_realize()
312 virtio_init(vdev, vub->virtio_id, vub->config_size); in vub_device_realize()
321 vub->vqs = g_ptr_array_sized_new(vub->num_vqs); in vub_device_realize()
322 for (int i = 0; i < vub->num_vqs; i++) { in vub_device_realize()
323 g_ptr_array_add(vub->vqs, in vub_device_realize()
324 virtio_add_queue(vdev, vub->vq_size, in vub_device_realize()
328 vub->vhost_dev.nvqs = vub->num_vqs; in vub_device_realize()
329 vub->vhost_dev.vqs = g_new0(struct vhost_virtqueue, vub->vhost_dev.nvqs); in vub_device_realize()
332 ret = vhost_dev_init(&vub->vhost_dev, &vub->vhost_user, in vub_device_realize()
336 do_vhost_user_cleanup(vdev, vub); in vub_device_realize()
339 qemu_chr_fe_set_handlers(&vub->chardev, NULL, NULL, vub_event, NULL, in vub_device_realize()
346 VHostUserBase *vub = VHOST_USER_BASE(dev); in vub_device_unrealize() local
347 struct vhost_virtqueue *vhost_vqs = vub->vhost_dev.vqs; in vub_device_unrealize()
351 vhost_dev_cleanup(&vub->vhost_dev); in vub_device_unrealize()
353 do_vhost_user_cleanup(vdev, vub); in vub_device_unrealize()