[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v12 11/15] vfio: modify vfio_pci_hot_reset to suppor
From: |
Chen Hanxiao |
Subject: |
[Qemu-devel] [PATCH v12 11/15] vfio: modify vfio_pci_hot_reset to support bus reset |
Date: |
Thu, 16 Jul 2015 12:00:49 +0800 |
From: Chen Fan <address@hidden>
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>
Signed-off-by: Chen Hanxiao <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 bab72a4..c52456b 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3287,6 +3287,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;
@@ -3316,6 +3317,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) {
@@ -3327,12 +3329,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) {
--
2.1.0
- [Qemu-devel] [PATCH v12 00/15] vfio-pci: pass the aer error to guest, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 02/15] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 04/15] vfio: make the 4 bytes aligned for capability size, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 03/15] pcie: modify the capability size assert, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 05/15] vfio: add pcie extanded capability support, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 06/15] aer: impove pcie_aer_init to support vfio device, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 08/15] vfio: add check host bus reset is support or not, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 07/15] vfio: add aer support for vfio device, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 09/15] pci: add bus reset_notifiers callbacks for host bus reset, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 11/15] vfio: modify vfio_pci_hot_reset to support bus reset,
Chen Hanxiao <=
- [Qemu-devel] [PATCH v12 13/15] pcie_aer: expose pcie_aer_msg() interface, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 10/15] vfio: add sec_bus_reset notifier to notify physical bus reset is needed, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 14/15] vfio-pci: pass the aer error to guest, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 12/15] vfio: do hot bus reset when do virtual secondary bus reset, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 15/15] vfio: add 'aer' property to expose aercap, Chen Hanxiao, 2015/07/16
- [Qemu-devel] [PATCH v12 01/15] vfio: extract vfio_get_hot_reset_info as a single function, Chen Hanxiao, 2015/07/16
- Re: [Qemu-devel] [PATCH v12 00/15] vfio-pci: pass the aer error to guest, Alex Williamson, 2015/07/16