From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ross Lagerwall Subject: Re: [PATCH] libxl: Don't insert PCI device into xenstore for HVM guests Date: Mon, 1 Jun 2015 16:43:53 +0100 Message-ID: <556C7DB9.5000705@citrix.com> References: <1432886385-20313-1-git-send-email-ross.lagerwall@citrix.com> <20150601152636.GD11531@x230.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150601152636.GD11531@x230.dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: Wei Liu , Stefano Stabellini , Ian Jackson , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 06/01/2015 04:26 PM, Konrad Rzeszutek Wilk wrote: > On Fri, May 29, 2015 at 08:59:45AM +0100, Ross Lagerwall wrote: >> When doing passthrough of a PCI device for an HVM guest, don't insert >> the device into xenstore, otherwise pciback attempts to use it which >> conflicts with QEMU. > > How does it conflict? It doesn't work with repeated use. See below. >> >> This manifests itself such that the first time a device is passed to a >> domain, it succeeds. Subsequent attempts fail unless the device is >> unbound from pciback or the machine rebooted. > > Can you be more specific please? What are the issues? Why does it > fail? Without this patch, if a device (e.g. a GPU) is bound to pciback and then passed through to a guest using xl pci-attach, it appears in the guest and works fine. If the guest is rebooted, and the device is again passed through with xl pci-attach, it appears in the guest as before but does not work. In Windows, it gets something like Error Code 43 and on Linux, the Nouveau driver fails to initialize the device (with error -22 or something). The only way to get the device to work again is to reboot the host or unbind and rebind it to pciback. With this patch, it works as expected. The device is bound to pciback and works after being passed through, even after the VM is rebooted. > > There are certain things that pciback does to "prepare" an PCI device > which QEMU also does. Some of them - such as saving the configuration > registers (And then restoring them after the device has been detached) - > is something that QEMU does not do. > I really have no idea what the correct thing to do is, but the current code with qemu-trad doesn't seem to work (for me). Regards -- Ross Lagerwall