bdev_virtio: destruct all vdevs on shutdown

This patch also resets each device
before destructing it. This is urgently
required for virtio_pci, as it notifies
the QEMU about our shutdown.

This patch fixes running subsequent
bdev_virtio instances in PCI mode within
the same vhost.

Change-Id: I2569251362f2aaf058f6e44f068b280244bd38c1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381201
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-10-03 20:58:58 +02:00 committed by Jim Harris
parent 6368d6c0f5
commit 1faea41722
2 changed files with 6 additions and 0 deletions

View File

@ -682,6 +682,11 @@ out:
static void bdev_virtio_finish(void)
{
struct virtio_dev *vdev, *next;
TAILQ_FOREACH_SAFE(vdev, &g_virtio_driver.attached_ctrlrs, tailq, next) {
virtio_dev_free(vdev);
}
}
SPDK_LOG_REGISTER_TRACE_FLAG("virtio", SPDK_TRACE_VIRTIO)

View File

@ -304,6 +304,7 @@ virtio_dev_free(struct virtio_dev *dev)
{
uint32_t vdev_id = dev->id;
vtpci_reset(dev);
virtio_free_queues(dev);
vtpci_ops(dev)->free_vdev(dev);
vtpci_deinit(vdev_id);