From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Dutile Subject: Re: [Qemu-devel] SR-IOV PF reset and QEMU VFs VFIO passthrough Date: Mon, 03 Jun 2013 14:41:04 -0400 Message-ID: <51ACE340.1030406@redhat.com> References: <20130601121320.GC5157@irqsave.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <20130601121320.GC5157@irqsave.net> Sender: linux-pci-owner@vger.kernel.org To: =?ISO-8859-1?Q?Beno=EEt_Canet?= Cc: linux-pci@vger.kernel.org, qemu-devel@nongnu.org, iommu@lists.linux-foundation.org, alex.williamson@redhat.com List-Id: iommu@lists.linux-foundation.org On 06/01/2013 08:13 AM, Beno=EEt Canet wrote: > > Hello, > > I may have soon the PF driver of an SR-IOV card to code and make work= with > QEMU/KVM so I have the following questions. > > In an AMD64 setup where QEMU use VFIO to passthrough the VFs of an SR= -IOV card > to a guest will the consequences of a PF FLR be handled fine by QEMU = and the > guest ? > the reset occurs long before the device is passed to the guest. > I read that pci_reset_function would call pci_restore_state restoring= the SR-IOV > configuration after the reset of the PF. > correct. > The ways the hardware work means that the VFs would disappear and rea= ppear in a > short lapse of time. > Not sure your definitiion of 'disappear'. If you mean: if I had anothe= r thread poking at the device, the device would appear to be removed, then come = back (if os poking hasn't crashed from the device's lack of response). If you mean the VF gets entirely removed from the PCI tree, then no. A pci reset !=3D hot unplug/plug. The device remains in the device tre= e. > Will these events be handled by the kernel pci hotplug code ? > 'these events' ??? -- which events.... =46LR is currently done by libvirt & qemu/vfio to ensure assigned devic= es are quiesced as they are switched from host->guest domain, and guest->(back-to-)host= domain. > Given that the PF driver restore the PF config space after the reset = will /sys The PF driver doesn't do the config space restore -- it's done in PCI c= ore code. > files used by QEMU disappear and reappear messing the QEMU VFIO passt= hrough or As stated above, the devices don't disappear from the device tree, so t= hey don't get removed/added to the /sys(/bus/pci/...) files. > will it goes smoothly ? > it goes smoothly today.... :-/ > Best regards > > Beno=EEt Canet > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjZgy-0004rq-Jp for qemu-devel@nongnu.org; Mon, 03 Jun 2013 14:41:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjZgu-0001rG-1m for qemu-devel@nongnu.org; Mon, 03 Jun 2013 14:41:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjZgt-0001r9-P3 for qemu-devel@nongnu.org; Mon, 03 Jun 2013 14:41:11 -0400 Message-ID: <51ACE340.1030406@redhat.com> Date: Mon, 03 Jun 2013 14:41:04 -0400 From: Don Dutile MIME-Version: 1.0 References: <20130601121320.GC5157@irqsave.net> In-Reply-To: <20130601121320.GC5157@irqsave.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] SR-IOV PF reset and QEMU VFs VFIO passthrough List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Beno=EEt_Canet?= Cc: linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org, alex.williamson@redhat.com, qemu-devel@nongnu.org On 06/01/2013 08:13 AM, Beno=EEt Canet wrote: > > Hello, > > I may have soon the PF driver of an SR-IOV card to code and make work w= ith > QEMU/KVM so I have the following questions. > > In an AMD64 setup where QEMU use VFIO to passthrough the VFs of an SR-I= OV card > to a guest will the consequences of a PF FLR be handled fine by QEMU an= d the > guest ? > the reset occurs long before the device is passed to the guest. > I read that pci_reset_function would call pci_restore_state restoring t= he SR-IOV > configuration after the reset of the PF. > correct. > The ways the hardware work means that the VFs would disappear and reapp= ear in a > short lapse of time. > Not sure your definitiion of 'disappear'. If you mean: if I had another = thread poking at the device, the device would appear to be removed, then come ba= ck (if os poking hasn't crashed from the device's lack of response). If you mean the VF gets entirely removed from the PCI tree, then no. A pci reset !=3D hot unplug/plug. The device remains in the device tree. > Will these events be handled by the kernel pci hotplug code ? > 'these events' ??? -- which events.... FLR is currently done by libvirt & qemu/vfio to ensure assigned devices a= re quiesced as they are switched from host->guest domain, and guest->(back-to-)host d= omain. > Given that the PF driver restore the PF config space after the reset wi= ll /sys The PF driver doesn't do the config space restore -- it's done in PCI cor= e code. > files used by QEMU disappear and reappear messing the QEMU VFIO passthr= ough or As stated above, the devices don't disappear from the device tree, so the= y don't get removed/added to the /sys(/bus/pci/...) files. > will it goes smoothly ? > it goes smoothly today.... :-/ > Best regards > > Beno=EEt Canet >