diff options
| -rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index e2ee80f36e3e..fc011e13213b 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
| @@ -44,6 +44,9 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) | |||
| 44 | u16 cmd; | 44 | u16 cmd; |
| 45 | u8 msix_pos; | 45 | u8 msix_pos; |
| 46 | 46 | ||
| 47 | /* Don't allow our initial saved state to include busmaster */ | ||
| 48 | pci_clear_master(pdev); | ||
| 49 | |||
| 47 | ret = pci_enable_device(pdev); | 50 | ret = pci_enable_device(pdev); |
| 48 | if (ret) | 51 | if (ret) |
| 49 | return ret; | 52 | return ret; |
| @@ -99,7 +102,8 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) | |||
| 99 | struct pci_dev *pdev = vdev->pdev; | 102 | struct pci_dev *pdev = vdev->pdev; |
| 100 | int bar; | 103 | int bar; |
| 101 | 104 | ||
| 102 | pci_disable_device(pdev); | 105 | /* Stop the device from further DMA */ |
| 106 | pci_clear_master(pdev); | ||
| 103 | 107 | ||
| 104 | vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE | | 108 | vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE | |
| 105 | VFIO_IRQ_SET_ACTION_TRIGGER, | 109 | VFIO_IRQ_SET_ACTION_TRIGGER, |
| @@ -128,7 +132,7 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) | |||
| 128 | __func__, dev_name(&pdev->dev)); | 132 | __func__, dev_name(&pdev->dev)); |
| 129 | 133 | ||
| 130 | if (!vdev->reset_works) | 134 | if (!vdev->reset_works) |
| 131 | return; | 135 | goto out; |
| 132 | 136 | ||
| 133 | pci_save_state(pdev); | 137 | pci_save_state(pdev); |
| 134 | } | 138 | } |
| @@ -151,6 +155,8 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) | |||
| 151 | } | 155 | } |
| 152 | 156 | ||
| 153 | pci_restore_state(pdev); | 157 | pci_restore_state(pdev); |
| 158 | out: | ||
| 159 | pci_disable_device(pdev); | ||
| 154 | } | 160 | } |
| 155 | 161 | ||
| 156 | static void vfio_pci_release(void *device_data) | 162 | static void vfio_pci_release(void *device_data) |
