aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCao jin <caoj.fnst@cn.fujitsu.com>2016-10-17 10:58:03 -0600
committerAlex Williamson <alex.williamson@redhat.com>2016-10-17 10:58:03 -0600
commit893bfc3cc893ed36cedc364e99cf483e9b08c294 (patch)
tree8c24cb82f07265ac8064eaef10b841a6801c7fff
parent31e6a7b17b35711eb44f0e686b5ba68d15bfe4c1 (diff)
vfio: fix duplicate function call
When vfio device is reset(encounter FLR, or bus reset), if need to do bus reset(vfio_pci_hot_reset_one is called), vfio_pci_pre_reset & vfio_pci_post_reset will be called twice. Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r--hw/vfio/pci.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index fef436a1de..65d30fdef9 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -1951,7 +1951,9 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
trace_vfio_pci_hot_reset(vdev->vbasedev.name, single ? "one" : "multi");
- vfio_pci_pre_reset(vdev);
+ if (!single) {
+ vfio_pci_pre_reset(vdev);
+ }
vdev->vbasedev.needs_reset = false;
info = g_malloc0(sizeof(*info));
@@ -2109,7 +2111,9 @@ out:
}
}
out_single:
- vfio_pci_post_reset(vdev);
+ if (!single) {
+ vfio_pci_post_reset(vdev);
+ }
g_free(info);
return ret;