Lines Matching +full:qemu +full:- +full:conf

2  * QEMU Cryptodev backend for QEMU cipher APIs
24 #include "qemu/osdep.h"
27 #include "qemu/error-report.h"
28 #include "hw/virtio/vhost-user.h"
29 #include "standard-headers/linux/virtio_crypto.h"
30 #include "sysemu/cryptodev-vhost.h"
31 #include "chardev/char-fe.h"
32 #include "sysemu/cryptodev-vhost-user.h"
40 #define TYPE_CRYPTODEV_BACKEND_VHOST_USER "cryptodev-vhost-user"
70 assert(cc->type == QCRYPTODEV_BACKEND_TYPE_VHOST_USER); in cryptodev_vhost_user_get_vhost()
73 return s->vhost_crypto[queue]; in cryptodev_vhost_user_get_vhost()
82 if (!cryptodev_vhost_user_running(s->vhost_crypto[i])) { in cryptodev_vhost_user_stop()
86 cryptodev_vhost_cleanup(s->vhost_crypto[i]); in cryptodev_vhost_user_stop()
87 s->vhost_crypto[i] = NULL; in cryptodev_vhost_user_stop()
101 if (cryptodev_vhost_user_running(s->vhost_crypto[i])) { in cryptodev_vhost_user_start()
105 options.opaque = &s->vhost_user; in cryptodev_vhost_user_start()
107 options.cc = b->conf.peers.ccs[i]; in cryptodev_vhost_user_start()
108 s->vhost_crypto[i] = cryptodev_vhost_init(&options); in cryptodev_vhost_user_start()
109 if (!s->vhost_crypto[i]) { in cryptodev_vhost_user_start()
116 cryptodev_vhost_get_max_queues(s->vhost_crypto[i]); in cryptodev_vhost_user_start()
129 return -1; in cryptodev_vhost_user_start()
138 if (s->chr_name == NULL) { in cryptodev_vhost_claim_chardev()
144 chr = qemu_chr_find(s->chr_name); in cryptodev_vhost_claim_chardev()
147 "Device '%s' not found", s->chr_name); in cryptodev_vhost_claim_chardev()
158 int queues = b->conf.peers.queues; in cryptodev_vhost_user_event()
167 b->ready = true; in cryptodev_vhost_user_event()
170 b->ready = false; in cryptodev_vhost_user_event()
184 int queues = backend->conf.peers.queues; in cryptodev_vhost_user_init()
198 s->opened = true; in cryptodev_vhost_user_init()
202 cc->info_str = g_strdup_printf("cryptodev-vhost-user%zu to %s ", in cryptodev_vhost_user_init()
203 i, chr->label); in cryptodev_vhost_user_init()
204 cc->queue_index = i; in cryptodev_vhost_user_init()
205 cc->type = QCRYPTODEV_BACKEND_TYPE_VHOST_USER; in cryptodev_vhost_user_init()
207 backend->conf.peers.ccs[i] = cc; in cryptodev_vhost_user_init()
210 if (!qemu_chr_fe_init(&s->chr, chr, errp)) { in cryptodev_vhost_user_init()
216 if (!vhost_user_init(&s->vhost_user, &s->chr, errp)) { in cryptodev_vhost_user_init()
220 qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, in cryptodev_vhost_user_init()
223 backend->conf.crypto_services = in cryptodev_vhost_user_init()
227 backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC; in cryptodev_vhost_user_init()
228 backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1; in cryptodev_vhost_user_init()
230 backend->conf.max_size = UINT64_MAX; in cryptodev_vhost_user_init()
231 backend->conf.max_cipher_key_len = VHOST_USER_MAX_CIPHER_KEY_LEN; in cryptodev_vhost_user_init()
232 backend->conf.max_auth_key_len = VHOST_USER_MAX_AUTH_KEY_LEN; in cryptodev_vhost_user_init()
241 backend->conf.peers.ccs[queue_index]; in cryptodev_vhost_user_crypto_create_session()
248 struct vhost_dev *dev = &(vhost_crypto->dev); in cryptodev_vhost_user_crypto_create_session()
249 ret = dev->vhost_ops->vhost_crypto_create_session(dev, in cryptodev_vhost_user_crypto_create_session()
253 return -1; in cryptodev_vhost_user_crypto_create_session()
258 return -1; in cryptodev_vhost_user_crypto_create_session()
268 uint32_t op_code = sess_info->op_code; in cryptodev_vhost_user_create_session()
285 sess_info->op_code); in cryptodev_vhost_user_create_session()
286 return -VIRTIO_CRYPTO_NOTSUPP; in cryptodev_vhost_user_create_session()
293 status = -VIRTIO_CRYPTO_ERR; in cryptodev_vhost_user_create_session()
295 sess_info->session_id = ret; in cryptodev_vhost_user_create_session()
312 backend->conf.peers.ccs[queue_index]; in cryptodev_vhost_user_close_session()
314 int ret = -1, status; in cryptodev_vhost_user_close_session()
318 struct vhost_dev *dev = &(vhost_crypto->dev); in cryptodev_vhost_user_close_session()
319 ret = dev->vhost_ops->vhost_crypto_close_session(dev, in cryptodev_vhost_user_close_session()
322 status = -VIRTIO_CRYPTO_ERR; in cryptodev_vhost_user_close_session()
327 status = -VIRTIO_CRYPTO_NOTSUPP; in cryptodev_vhost_user_close_session()
342 int queues = backend->conf.peers.queues; in cryptodev_vhost_user_cleanup()
348 cc = backend->conf.peers.ccs[i]; in cryptodev_vhost_user_cleanup()
351 backend->conf.peers.ccs[i] = NULL; in cryptodev_vhost_user_cleanup()
355 vhost_user_cleanup(&s->vhost_user); in cryptodev_vhost_user_cleanup()
364 if (s->opened) { in cryptodev_vhost_user_set_chardev()
367 g_free(s->chr_name); in cryptodev_vhost_user_set_chardev()
368 s->chr_name = g_strdup(value); in cryptodev_vhost_user_set_chardev()
377 Chardev *chr = qemu_chr_fe_get_driver(&s->chr); in cryptodev_vhost_user_get_chardev()
379 if (chr && chr->label) { in cryptodev_vhost_user_get_chardev()
380 return g_strdup(chr->label); in cryptodev_vhost_user_get_chardev()
391 qemu_chr_fe_deinit(&s->chr, false); in cryptodev_vhost_user_finalize()
393 g_free(s->chr_name); in cryptodev_vhost_user_finalize()
401 bc->init = cryptodev_vhost_user_init; in cryptodev_vhost_user_class_init()
402 bc->cleanup = cryptodev_vhost_user_cleanup; in cryptodev_vhost_user_class_init()
403 bc->create_session = cryptodev_vhost_user_create_session; in cryptodev_vhost_user_class_init()
404 bc->close_session = cryptodev_vhost_user_close_session; in cryptodev_vhost_user_class_init()
405 bc->do_op = NULL; in cryptodev_vhost_user_class_init()