aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/assigned-dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/assigned-dev.c')
-rw-r--r--virt/kvm/assigned-dev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 7623408dbc81..d3892076f93c 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -197,7 +197,8 @@ static void kvm_free_assigned_device(struct kvm *kvm,
197{ 197{
198 kvm_free_assigned_irq(kvm, assigned_dev); 198 kvm_free_assigned_irq(kvm, assigned_dev);
199 199
200 pci_reset_function(assigned_dev->dev); 200 __pci_reset_function(assigned_dev->dev);
201 pci_restore_state(assigned_dev->dev);
201 202
202 pci_release_regions(assigned_dev->dev); 203 pci_release_regions(assigned_dev->dev);
203 pci_disable_device(assigned_dev->dev); 204 pci_disable_device(assigned_dev->dev);
@@ -514,6 +515,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
514 } 515 }
515 516
516 pci_reset_function(dev); 517 pci_reset_function(dev);
518 pci_save_state(dev);
517 519
518 match->assigned_dev_id = assigned_dev->assigned_dev_id; 520 match->assigned_dev_id = assigned_dev->assigned_dev_id;
519 match->host_segnr = assigned_dev->segnr; 521 match->host_segnr = assigned_dev->segnr;
@@ -544,6 +546,7 @@ out:
544 mutex_unlock(&kvm->lock); 546 mutex_unlock(&kvm->lock);
545 return r; 547 return r;
546out_list_del: 548out_list_del:
549 pci_restore_state(dev);
547 list_del(&match->list); 550 list_del(&match->list);
548 pci_release_regions(dev); 551 pci_release_regions(dev);
549out_disable: 552out_disable: