From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH 1/2] PCI: Add interfaces to store and load the device saved state Date: Mon, 18 Apr 2011 13:44:11 -0600 Message-ID: <1303155851.3110.92.camel@x201> References: <20110415194220.2838.10750.stgit@s20.home> <20110415195433.2838.96871.stgit@s20.home> <4DAAB1A6.4000308@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: linux-pci@vger.kernel.org, kvm@vger.kernel.org, jan.kiszka@siemens.com, jbarnes@virtuousgeek.org To: Avi Kivity Return-path: In-Reply-To: <4DAAB1A6.4000308@redhat.com> Sender: linux-pci-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Sun, 2011-04-17 at 12:23 +0300, Avi Kivity wrote: > On 04/15/2011 10:54 PM, Alex Williamson wrote: > > For KVM device assignment, we'd like to save off the state of a device > > prior to passing it to the guest and restore it later. We also want > > to allow pci_reset_funciton() to be called while the device is owned > > by the guest. This however overwrites and invalidates the struct pci_dev > > buffers, so we can't just manually call save and restore. Add generic > > interfaces for the saved state to be stored into a buffer and reloaded > > back into struct pci_dev at a later time. > > > > +/** > > + * pci_store_saved_state - Store the device saved state into a buffer > > + * @dev: - PCI device that we're dealing with > > + * > > + * Returns an opaque buffer containing the device saved state. > > + * NULL if no state or error. > > + */ > > +void *pci_store_saved_state(struct pci_dev *dev) > > This is too opaque - no type safety. You can return a struct pci_state > *, leaving it undefined in headers files. Good idea, I'll roll this in. Thanks, Alex