[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [v11 11/15] vfio: modify vfio_pci_hot_reset to support bus
From: |
Chen Fan |
Subject: |
[Qemu-devel] [v11 11/15] vfio: modify vfio_pci_hot_reset to support bus reset |
Date: |
Wed, 24 Jun 2015 17:46:04 +0800 |
the vfio_pci_hot_reset differentiate the single and multi in-used
devices for reset. but in multi case, when some dependent devices
are not assigned to VM, the devices can not be recovered by driver.
Signed-off-by: Chen Fan <address@hidden>
---
hw/vfio/pci.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 7cc81ae..aeb489e 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3311,6 +3311,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool
single)
PCIHostDeviceAddress host;
VFIOPCIDevice *tmp;
VFIODevice *vbasedev_iter;
+ bool found;
host.domain = devices[i].segment;
host.bus = devices[i].bus;
@@ -3340,6 +3341,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool
single)
goto out;
}
+ found = false;
/* Prep dependent devices for reset and clear our marker. */
QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
if (vbasedev_iter->type != VFIO_DEVICE_TYPE_PCI) {
@@ -3351,12 +3353,23 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool
single)
ret = -EINVAL;
goto out_single;
}
+ found = true;
vfio_pci_pre_reset(tmp);
tmp->vbasedev.needs_reset = false;
multi = true;
break;
}
}
+
+ /*
+ * If the dependent device is not assigned to VM, we should
+ * not call hot bus reset, otherwise, the dependent device
+ * can not be used in the future.
+ */
+ if (!single && !found) {
+ ret = -EINVAL;
+ goto out_single;
+ }
}
if (!single && !multi) {
--
1.9.3
- [Qemu-devel] [v11 00/15] vfio-pci: pass the aer error to guest, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 04/15] vfio: make the 4 bytes aligned for capability size, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 01/15] vfio: extract vfio_get_hot_reset_info as a single function, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 03/15] pcie: modify the capability size assert, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 02/15] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 05/15] vfio: add pcie extanded capability support, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 06/15] aer: impove pcie_aer_init to support vfio device, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 09/15] pci: add bus reset_notifiers callbacks for host bus reset, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 10/15] vfio: add sec_bus_reset notifier to notify physical bus reset is needed, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 11/15] vfio: modify vfio_pci_hot_reset to support bus reset,
Chen Fan <=
- [Qemu-devel] [v11 08/15] vfio: add check host bus reset is support or not, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 12/15] vfio: do hot bus reset when do virtual secondary bus reset, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 13/15] pcie_aer: expose pcie_aer_msg() interface, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 07/15] vfio: add aer support for vfio device, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 14/15] vfio-pci: pass the aer error to guest, Chen Fan, 2015/06/24
- [Qemu-devel] [v11 15/15] vfio: add 'aer' property to expose aercap, Chen Fan, 2015/06/24
- Re: [Qemu-devel] [v11 00/15] vfio-pci: pass the aer error to guest, Chen Fan, 2015/06/30