diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2010-11-16 16:30:05 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:29:22 -0500 |
commit | ed78661f2614d3c9f69c23e280db3bafdabdf5bb (patch) | |
tree | 7344bdb2ae1ca07dcb2c4bf76e4618c1c65d47a9 /virt/kvm | |
parent | 1e001d49f9f9a0e3eb72939ad49d9a2c7754e9c1 (diff) |
KVM: Save/restore state of assigned PCI device
The guest may change states that pci_reset_function does not touch. So
we better save/restore the assigned device across guest usage.
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/assigned-dev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 7623408dbc8..d3892076f93 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; |
546 | out_list_del: | 548 | out_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); |
549 | out_disable: | 552 | out_disable: |