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 vhost_dev_stop(&vub->vhost_dev, vdev, true); in vub_stop()
82 ret = k->set_guest_notifiers(qbus->parent, vub->vhost_dev.nvqs, false); in vub_stop()
88 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()
115 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_get_features() local
117 g_assert(vub->vhost_dev.features); in vub_get_features()
118 return vub->vhost_dev.features & ~(1ULL << VHOST_USER_F_PROTOCOL_FEATURES); in vub_get_features()
128 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_get_config() local
135 g_assert(vub->config_size && vub->vhost_user.supports_config == true); in vub_get_config()
137 if (vhost_dev_get_config(&vub->vhost_dev, config, in vub_get_config()
138 vub->config_size, &local_err)) { in vub_get_config()
145 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_set_config() local
148 g_assert(vub->config_size && vub->vhost_user.supports_config == true); in vub_set_config()
150 ret = vhost_dev_set_config(&vub->vhost_dev, config_data, in vub_set_config()
151 0, vub->config_size, in vub_set_config()
181 static void do_vhost_user_cleanup(VirtIODevice *vdev, VHostUserBase *vub) in do_vhost_user_cleanup() argument
183 vhost_user_cleanup(&vub->vhost_user); in do_vhost_user_cleanup()
185 for (int i = 0; i < vub->num_vqs; i++) { in do_vhost_user_cleanup()
186 VirtQueue *vq = g_ptr_array_index(vub->vqs, i); in do_vhost_user_cleanup()
196 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_connect() local
197 struct vhost_dev *vhost_dev = &vub->vhost_dev; in vub_connect()
199 if (vub->connected) { in vub_connect()
202 vub->connected = true; in vub_connect()
208 if (vub->vhost_user.supports_config) { in vub_connect()
225 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_disconnect() local
226 struct vhost_virtqueue *vhost_vqs = vub->vhost_dev.vqs; in vub_disconnect()
228 if (!vub->connected) { in vub_disconnect()
231 vub->connected = false; in vub_disconnect()
234 vhost_dev_cleanup(&vub->vhost_dev); in vub_disconnect()
239 qemu_chr_fe_set_handlers(&vub->chardev, in vub_disconnect()
248 VHostUserBase *vub = VHOST_USER_BASE(vdev); in vub_event() local
253 qemu_chr_fe_disconnect(&vub->chardev); in vub_event()
259 vhost_user_async_close(dev, &vub->chardev, &vub->vhost_dev, in vub_event()
273 VHostUserBase *vub = VHOST_USER_BASE(dev); in vub_device_realize() local
276 if (!vub->chardev.chr) { in vub_device_realize()
281 if (!vub->virtio_id) { in vub_device_realize()
286 if (!vub->num_vqs) { in vub_device_realize()
287 vub->num_vqs = 1; /* reasonable default? */ in vub_device_realize()
290 if (!vub->vq_size) { in vub_device_realize()
291 vub->vq_size = 64; in vub_device_realize()
299 if (vub->config_size) { in vub_device_realize()
300 vub->vhost_user.supports_config = true; in vub_device_realize()
303 if (!vhost_user_init(&vub->vhost_user, &vub->chardev, errp)) { in vub_device_realize()
307 virtio_init(vdev, vub->virtio_id, vub->config_size); in vub_device_realize()
316 vub->vqs = g_ptr_array_sized_new(vub->num_vqs); in vub_device_realize()
317 for (int i = 0; i < vub->num_vqs; i++) { in vub_device_realize()
318 g_ptr_array_add(vub->vqs, in vub_device_realize()
319 virtio_add_queue(vdev, vub->vq_size, in vub_device_realize()
323 vub->vhost_dev.nvqs = vub->num_vqs; in vub_device_realize()
324 vub->vhost_dev.vqs = g_new0(struct vhost_virtqueue, vub->vhost_dev.nvqs); in vub_device_realize()
327 ret = vhost_dev_init(&vub->vhost_dev, &vub->vhost_user, in vub_device_realize()
331 do_vhost_user_cleanup(vdev, vub); in vub_device_realize()
334 qemu_chr_fe_set_handlers(&vub->chardev, NULL, NULL, vub_event, NULL, in vub_device_realize()
341 VHostUserBase *vub = VHOST_USER_BASE(dev); in vub_device_unrealize() local
342 struct vhost_virtqueue *vhost_vqs = vub->vhost_dev.vqs; in vub_device_unrealize()
346 vhost_dev_cleanup(&vub->vhost_dev); in vub_device_unrealize()
348 do_vhost_user_cleanup(vdev, vub); in vub_device_unrealize()