aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio-crypto.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2016-12-22 11:12:38 +0800
committerMichael S. Tsirkin <mst@redhat.com>2017-01-10 07:02:52 +0200
commit46fd17054548b15b3b8a5991492f5f0dc37957d4 (patch)
tree7590dc9d3f7208e1976d6461f3373ef60c9709eb /hw/virtio/virtio-crypto.c
parentc159a4d1d0434fcf670f8684273bce0eca117a27 (diff)
cryptodev: introduce a new is_used property
This property is used to Tag the cryptodev backend is used by virtio-crypto or not. Making cryptodev can't be hot unplugged when it's in use. Cleanup resources when cryptodev is finalized. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/virtio-crypto.c')
-rw-r--r--hw/virtio/virtio-crypto.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index f872c87cb9..6318fcf01b 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -799,6 +799,7 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
}
virtio_crypto_init_config(vdev);
+ cryptodev_backend_set_used(vcrypto->cryptodev, true);
}
static void virtio_crypto_device_unrealize(DeviceState *dev, Error **errp)
@@ -818,6 +819,7 @@ static void virtio_crypto_device_unrealize(DeviceState *dev, Error **errp)
g_free(vcrypto->vqs);
virtio_cleanup(vdev);
+ cryptodev_backend_set_used(vcrypto->cryptodev, false);
}
static const VMStateDescription vmstate_virtio_crypto = {