Re: [PATCH v4 6/9] KVM: Save/restore state of assigned PCI device

Avi Kivity
2010-11-09T12:35:51Z

On 11/08/2010 01:21 PM, Jan Kiszka wrote:
> The guest may change states that pci_reset_function does not touch. So
> we better save/restore the assigned device across guest usage.

Why do we care? Shouldn't the next user reset the state to its taste?
Or are you worried about information leakage?
> @@ -514,6 +515,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
> }
>
> pci_reset_function(dev);
> + pci_save_state(dev);
>
> match->assigned_dev_id = assigned_dev->assigned_dev_id;
> match->host_segnr = assigned_dev->segnr;
> @@ -544,6 +546,7 @@ out:
> mutex_unlock(&kvm->lock);
> return r;
> out_list_del:
> + pci_restore_state(dev);
> list_del(&match->list);
> pci_release_regions(dev);
> out_disable:

This assumes no one else calls pci_save_state()/pci_restore_state()
while the guest is running. Is this true? What about suspend/resume?
(can this even work without guest assistance?)

--
error compiling committee.c: too many arguments to function