Lines Matching +full:- +full:- +full:cc
26 #include "hw/virtio/virtio-bus.h"
27 #include "system/cryptodev-vhost.h"
31 #include "qemu/error-report.h"
32 #include "hw/virtio/virtio-crypto.h"
33 #include "system/cryptodev-vhost-user.h"
39 return crypto->dev.max_queues; in cryptodev_vhost_get_max_queues()
44 vhost_dev_cleanup(&crypto->dev); in cryptodev_vhost_cleanup()
57 crypto->dev.max_queues = 1; in cryptodev_vhost_init()
58 crypto->dev.nvqs = 1; in cryptodev_vhost_init()
59 crypto->dev.vqs = crypto->vqs; in cryptodev_vhost_init()
61 crypto->cc = options->cc; in cryptodev_vhost_init()
63 crypto->dev.protocol_features = 0; in cryptodev_vhost_init()
64 crypto->backend = -1; in cryptodev_vhost_init()
66 /* vhost-user needs vq_index to initiate a specific queue pair */ in cryptodev_vhost_init()
67 crypto->dev.vq_index = crypto->cc->queue_index * crypto->dev.nvqs; in cryptodev_vhost_init()
69 r = vhost_dev_init(&crypto->dev, options->opaque, options->backend_type, 0, in cryptodev_vhost_init()
88 crypto->dev.nvqs = 1; in cryptodev_vhost_start_one()
89 crypto->dev.vqs = crypto->vqs; in cryptodev_vhost_start_one()
91 r = vhost_dev_enable_notifiers(&crypto->dev, dev); in cryptodev_vhost_start_one()
96 r = vhost_dev_start(&crypto->dev, dev, false); in cryptodev_vhost_start_one()
104 vhost_dev_disable_notifiers(&crypto->dev, dev); in cryptodev_vhost_start_one()
113 vhost_dev_stop(&crypto->dev, dev, false); in cryptodev_vhost_stop_one()
114 vhost_dev_disable_notifiers(&crypto->dev, dev); in cryptodev_vhost_stop_one()
118 cryptodev_get_vhost(CryptoDevBackendClient *cc, in cryptodev_get_vhost() argument
124 if (!cc) { in cryptodev_get_vhost()
128 switch (cc->type) { in cryptodev_get_vhost()
131 vhost_crypto = cryptodev_vhost_user_get_vhost(cc, b, queue); in cryptodev_get_vhost()
145 crypto->dev.vq_index = vq_index; in cryptodev_vhost_set_vq_index()
149 vhost_set_vring_enable(CryptoDevBackendClient *cc, in vhost_set_vring_enable() argument
154 cryptodev_get_vhost(cc, b, queue); in vhost_set_vring_enable()
157 cc->vring_enable = enable; in vhost_set_vring_enable()
163 vhost_ops = crypto->dev.vhost_ops; in vhost_set_vring_enable()
164 if (vhost_ops->vhost_set_vring_enable) { in vhost_set_vring_enable()
165 return vhost_ops->vhost_set_vring_enable(&crypto->dev, enable); in vhost_set_vring_enable()
179 CryptoDevBackend *b = vcrypto->cryptodev; in cryptodev_vhost_start()
181 CryptoDevBackendClient *cc; in cryptodev_vhost_start() local
183 if (!k->set_guest_notifiers) { in cryptodev_vhost_start()
185 return -ENOSYS; in cryptodev_vhost_start()
189 cc = b->conf.peers.ccs[i]; in cryptodev_vhost_start()
191 vhost_crypto = cryptodev_get_vhost(cc, b, i); in cryptodev_vhost_start()
198 if (cc->type == QCRYPTODEV_BACKEND_TYPE_VHOST_USER) { in cryptodev_vhost_start()
199 dev->use_guest_notifier_mask = false; in cryptodev_vhost_start()
203 r = k->set_guest_notifiers(qbus->parent, total_queues, true); in cryptodev_vhost_start()
205 error_report("error binding guest notifier: %d", -r); in cryptodev_vhost_start()
210 cc = b->conf.peers.ccs[i]; in cryptodev_vhost_start()
212 vhost_crypto = cryptodev_get_vhost(cc, b, i); in cryptodev_vhost_start()
219 if (cc->vring_enable) { in cryptodev_vhost_start()
221 r = vhost_set_vring_enable(cc, b, i, cc->vring_enable); in cryptodev_vhost_start()
232 while (--i >= 0) { in cryptodev_vhost_start()
233 cc = b->conf.peers.ccs[i]; in cryptodev_vhost_start()
234 vhost_crypto = cryptodev_get_vhost(cc, b, i); in cryptodev_vhost_start()
237 e = k->set_guest_notifiers(qbus->parent, total_queues, false); in cryptodev_vhost_start()
251 CryptoDevBackend *b = vcrypto->cryptodev; in cryptodev_vhost_stop()
253 CryptoDevBackendClient *cc; in cryptodev_vhost_stop() local
258 cc = b->conf.peers.ccs[i]; in cryptodev_vhost_stop()
260 vhost_crypto = cryptodev_get_vhost(cc, b, i); in cryptodev_vhost_stop()
264 r = k->set_guest_notifiers(qbus->parent, total_queues, false); in cryptodev_vhost_stop()
276 CryptoDevBackend *b = vcrypto->cryptodev; in cryptodev_vhost_virtqueue_mask()
278 CryptoDevBackendClient *cc; in cryptodev_vhost_virtqueue_mask() local
282 cc = b->conf.peers.ccs[queue]; in cryptodev_vhost_virtqueue_mask()
283 vhost_crypto = cryptodev_get_vhost(cc, b, queue); in cryptodev_vhost_virtqueue_mask()
285 vhost_virtqueue_mask(&vhost_crypto->dev, dev, idx, mask); in cryptodev_vhost_virtqueue_mask()
292 CryptoDevBackend *b = vcrypto->cryptodev; in cryptodev_vhost_virtqueue_pending()
294 CryptoDevBackendClient *cc; in cryptodev_vhost_virtqueue_pending() local
298 cc = b->conf.peers.ccs[queue]; in cryptodev_vhost_virtqueue_pending()
299 vhost_crypto = cryptodev_get_vhost(cc, b, queue); in cryptodev_vhost_virtqueue_pending()
301 return vhost_virtqueue_pending(&vhost_crypto->dev, idx); in cryptodev_vhost_virtqueue_pending()
322 cryptodev_get_vhost(CryptoDevBackendClient *cc, in cryptodev_get_vhost() argument
331 return -1; in cryptodev_vhost_start()