mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
cryptodev: add vhost support
Impliment the vhost-crypto's funtions, such as startup, stop and notification etc. Introduce an enum QCryptoCryptoDevBackendOptionsType in order to identify the cryptodev vhost backend is vhost-user or vhost-kernel-module (If exist). At this point, the cryptdoev-vhost-user works. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
042cea274c
commit
5da73dabe8
7 changed files with 398 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "standard-headers/linux/virtio_crypto.h"
|
||||
#include "sysemu/cryptodev-vhost.h"
|
||||
#include "chardev/char-fe.h"
|
||||
#include "sysemu/cryptodev-vhost-user.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@ -58,6 +59,20 @@ cryptodev_vhost_user_running(
|
|||
return crypto ? 1 : 0;
|
||||
}
|
||||
|
||||
CryptoDevBackendVhost *
|
||||
cryptodev_vhost_user_get_vhost(
|
||||
CryptoDevBackendClient *cc,
|
||||
CryptoDevBackend *b,
|
||||
uint16_t queue)
|
||||
{
|
||||
CryptoDevBackendVhostUser *s =
|
||||
CRYPTODEV_BACKEND_VHOST_USER(b);
|
||||
assert(cc->type == CRYPTODEV_BACKEND_TYPE_VHOST_USER);
|
||||
assert(queue < MAX_CRYPTO_QUEUE_NUM);
|
||||
|
||||
return s->vhost_crypto[queue];
|
||||
}
|
||||
|
||||
static void cryptodev_vhost_user_stop(int queues,
|
||||
CryptoDevBackendVhostUser *s)
|
||||
{
|
||||
|
@ -188,6 +203,7 @@ static void cryptodev_vhost_user_init(
|
|||
cc->info_str = g_strdup_printf("cryptodev-vhost-user%zu to %s ",
|
||||
i, chr->label);
|
||||
cc->queue_index = i;
|
||||
cc->type = CRYPTODEV_BACKEND_TYPE_VHOST_USER;
|
||||
|
||||
backend->conf.peers.ccs[i] = cc;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue