Message ID | a53fa7397145c2ec06707618fdd2697549fe71f1.1433812962.git.chen.fan.fnst@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
On Tue, 2015-06-09 at 11:37 +0800, Chen Fan wrote: > when do virtual secondary bus reset, the vfio device under > this bus need to do host bus reset to reset the device. > so add this case. > > Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> > --- > hw/vfio/pci.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index 6507f39..655ac59 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -4239,6 +4239,15 @@ static void vfio_pci_reset(DeviceState *dev) > > vfio_pci_pre_reset(vdev); > > + if (vdev->needs_bus_reset) { > + vdev->needs_bus_reset = false; > + /* Avoid duplicate bus reset */ > + if (vdev->vbasedev.needs_reset) { > + vfio_pci_hot_reset(vdev, false); > + } > + return; > + } So if we call hot reset, then we do pre-reset twice, once here, once in the hot reset function. If we don't call hot reset, we fail to call post-reset for cleanup. > + > if (vdev->resetfn && !vdev->resetfn(vdev)) { > goto post_reset; > }
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 6507f39..655ac59 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -4239,6 +4239,15 @@ static void vfio_pci_reset(DeviceState *dev) vfio_pci_pre_reset(vdev); + if (vdev->needs_bus_reset) { + vdev->needs_bus_reset = false; + /* Avoid duplicate bus reset */ + if (vdev->vbasedev.needs_reset) { + vfio_pci_hot_reset(vdev, false); + } + return; + } + if (vdev->resetfn && !vdev->resetfn(vdev)) { goto post_reset; }
when do virtual secondary bus reset, the vfio device under this bus need to do host bus reset to reset the device. so add this case. Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> --- hw/vfio/pci.c | 9 +++++++++ 1 file changed, 9 insertions(+)