diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/assigned-dev.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index ae72ae604c89..6cc4b97ec458 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
@@ -197,8 +197,13 @@ 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 | if (pci_load_and_free_saved_state(assigned_dev->dev, |
202 | &assigned_dev->pci_saved_state)) | ||
203 | printk(KERN_INFO "%s: Couldn't reload %s saved state\n", | ||
204 | __func__, dev_name(&assigned_dev->dev->dev)); | ||
205 | else | ||
206 | pci_restore_state(assigned_dev->dev); | ||
202 | 207 | ||
203 | pci_release_regions(assigned_dev->dev); | 208 | pci_release_regions(assigned_dev->dev); |
204 | pci_disable_device(assigned_dev->dev); | 209 | pci_disable_device(assigned_dev->dev); |
@@ -516,7 +521,10 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
516 | 521 | ||
517 | pci_reset_function(dev); | 522 | pci_reset_function(dev); |
518 | pci_save_state(dev); | 523 | pci_save_state(dev); |
519 | 524 | match->pci_saved_state = pci_store_saved_state(dev); | |
525 | if (!match->pci_saved_state) | ||
526 | printk(KERN_DEBUG "%s: Couldn't store %s saved state\n", | ||
527 | __func__, dev_name(&dev->dev)); | ||
520 | match->assigned_dev_id = assigned_dev->assigned_dev_id; | 528 | match->assigned_dev_id = assigned_dev->assigned_dev_id; |
521 | match->host_segnr = assigned_dev->segnr; | 529 | match->host_segnr = assigned_dev->segnr; |
522 | match->host_busnr = assigned_dev->busnr; | 530 | match->host_busnr = assigned_dev->busnr; |
@@ -546,7 +554,9 @@ out: | |||
546 | mutex_unlock(&kvm->lock); | 554 | mutex_unlock(&kvm->lock); |
547 | return r; | 555 | return r; |
548 | out_list_del: | 556 | out_list_del: |
549 | pci_restore_state(dev); | 557 | if (pci_load_and_free_saved_state(dev, &match->pci_saved_state)) |
558 | printk(KERN_INFO "%s: Couldn't reload %s saved state\n", | ||
559 | __func__, dev_name(&dev->dev)); | ||
550 | list_del(&match->list); | 560 | list_del(&match->list); |
551 | pci_release_regions(dev); | 561 | pci_release_regions(dev); |
552 | out_disable: | 562 | out_disable: |