From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v4 6/9] KVM: Save/restore state of assigned PCI device Date: Tue, 09 Nov 2010 14:35:45 +0200 Message-ID: <4CD94021.4090705@redhat.com> References: <1323c55899273c3bfc746fda9b47948aca6eae2f.1289215310.git.jan.kiszka@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm , Alex Williamson , "Michael S. Tsirkin" To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:3833 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750701Ab0KIMfv (ORCPT ); Tue, 9 Nov 2010 07:35:51 -0500 In-Reply-To: <1323c55899273c3bfc746fda9b47948aca6eae2f.1289215310.git.jan.kiszka@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: 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