* Re: RFC: vfio-pci API for PCI bus/slot (hot) resets [not found] ` <1375478934.15999.33.camel@pasglop> @ 2013-08-02 22:49 ` Bjorn Helgaas 2013-08-02 23:15 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 4+ messages in thread From: Bjorn Helgaas @ 2013-08-02 22:49 UTC (permalink / raw) To: Benjamin Herrenschmidt Cc: Alex Williamson, kvm, linux-kernel, Alexey Kardashevskiy, Gavin Shan, linux-pci@vger.kernel.org [+cc linux-pci] On Fri, Aug 2, 2013 at 3:28 PM, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > Right. Another use case is, I know of devices that need a fundamental > reset (PERST) after applying a FW update. This is a tangent from the real discussion here, but the question of resetting a device after a firmware update concerns me. Many if not all of our current reset interfaces save & restore the architected parts of config space around the reset. But a reset after a firmware update may change things like the number and type of BARs or even the functionality of the device, so I don't think the restore is safe in general. I doubt this is a big problem in general, but I have found reports of people having to do a system reset or reboot after updating, e.g., FPGA images. I suppose at least some of these could be worked around with the right hotplug incantations. http://forums.xilinx.com/t5/PCI-Express/PC-is-hung-if-run-the-second-program-FPGA-by-JTAG/td-p/20871 http://www.alteraforum.com/forum/archive/index.php/t-28477.html http://www.alteraforum.com/forum/showthread.php?t=35091 https://github.com/NetFPGA/NetFPGA-public/wiki/Restore-PCIE-Configuration http://lkml.indiana.edu/hypermail/linux/kernel/1104.3/02544.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFC: vfio-pci API for PCI bus/slot (hot) resets 2013-08-02 22:49 ` RFC: vfio-pci API for PCI bus/slot (hot) resets Bjorn Helgaas @ 2013-08-02 23:15 ` Benjamin Herrenschmidt 2013-08-02 23:37 ` Alex Williamson 0 siblings, 1 reply; 4+ messages in thread From: Benjamin Herrenschmidt @ 2013-08-02 23:15 UTC (permalink / raw) To: Bjorn Helgaas Cc: Alex Williamson, kvm, linux-kernel, Alexey Kardashevskiy, Gavin Shan, linux-pci@vger.kernel.org On Fri, 2013-08-02 at 16:49 -0600, Bjorn Helgaas wrote: > [+cc linux-pci] > > On Fri, Aug 2, 2013 at 3:28 PM, Benjamin Herrenschmidt > <benh@kernel.crashing.org> wrote: > > > Right. Another use case is, I know of devices that need a fundamental > > reset (PERST) after applying a FW update. > > This is a tangent from the real discussion here, but the question of > resetting a device after a firmware update concerns me. Many if not > all of our current reset interfaces save & restore the architected > parts of config space around the reset. But a reset after a firmware > update may change things like the number and type of BARs or even the > functionality of the device, so I don't think the restore is safe in > general. Right. > I doubt this is a big problem in general, but I have found reports of > people having to do a system reset or reboot after updating, e.g., > FPGA images. I suppose at least some of these could be worked around > with the right hotplug incantations. Yes. We have that similar issue with error handling, when the driver doesn't have the right hooks, we simulate an unplug, reset, then replug. Maybe we could provide generic helpers to do that... Cheers, Ben. > http://forums.xilinx.com/t5/PCI-Express/PC-is-hung-if-run-the-second-program-FPGA-by-JTAG/td-p/20871 > http://www.alteraforum.com/forum/archive/index.php/t-28477.html > http://www.alteraforum.com/forum/showthread.php?t=35091 > https://github.com/NetFPGA/NetFPGA-public/wiki/Restore-PCIE-Configuration > http://lkml.indiana.edu/hypermail/linux/kernel/1104.3/02544.html > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFC: vfio-pci API for PCI bus/slot (hot) resets 2013-08-02 23:15 ` Benjamin Herrenschmidt @ 2013-08-02 23:37 ` Alex Williamson 2013-08-02 23:56 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 4+ messages in thread From: Alex Williamson @ 2013-08-02 23:37 UTC (permalink / raw) To: Benjamin Herrenschmidt Cc: Bjorn Helgaas, kvm, linux-kernel, Alexey Kardashevskiy, Gavin Shan, linux-pci@vger.kernel.org On Sat, 2013-08-03 at 09:15 +1000, Benjamin Herrenschmidt wrote: > On Fri, 2013-08-02 at 16:49 -0600, Bjorn Helgaas wrote: > > [+cc linux-pci] > > > > On Fri, Aug 2, 2013 at 3:28 PM, Benjamin Herrenschmidt > > <benh@kernel.crashing.org> wrote: > > > > > Right. Another use case is, I know of devices that need a fundamental > > > reset (PERST) after applying a FW update. > > > > This is a tangent from the real discussion here, but the question of > > resetting a device after a firmware update concerns me. Many if not > > all of our current reset interfaces save & restore the architected > > parts of config space around the reset. But a reset after a firmware > > update may change things like the number and type of BARs or even the > > functionality of the device, so I don't think the restore is safe in > > general. > > Right. > > > I doubt this is a big problem in general, but I have found reports of > > people having to do a system reset or reboot after updating, e.g., > > FPGA images. I suppose at least some of these could be worked around > > with the right hotplug incantations. > > Yes. > > We have that similar issue with error handling, when the driver doesn't > have the right hooks, we simulate an unplug, reset, then replug. > > Maybe we could provide generic helpers to do that... Devices going away and coming back is pretty difficult for vfio to handle. Perhaps helpers to rescan a device in-place would be easier. On the QEMU side we'd need to rescan the device after each reset, which would be rather tedious for the typical case where it doesn't change. Thanks, Alex ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RFC: vfio-pci API for PCI bus/slot (hot) resets 2013-08-02 23:37 ` Alex Williamson @ 2013-08-02 23:56 ` Benjamin Herrenschmidt 0 siblings, 0 replies; 4+ messages in thread From: Benjamin Herrenschmidt @ 2013-08-02 23:56 UTC (permalink / raw) To: Alex Williamson Cc: Bjorn Helgaas, kvm, linux-kernel, Alexey Kardashevskiy, Gavin Shan, linux-pci@vger.kernel.org On Fri, 2013-08-02 at 17:37 -0600, Alex Williamson wrote: > > Yes. > > > > We have that similar issue with error handling, when the driver doesn't > > have the right hooks, we simulate an unplug, reset, then replug. > > > > Maybe we could provide generic helpers to do that... > > Devices going away and coming back is pretty difficult for vfio to > handle. Perhaps helpers to rescan a device in-place would be easier. Well, in the error handling case (and *maybe* in the "FW update" case) we need to unbind and rebind the driver as well. The whole point is that we have to do that because the driver doesn't have the right hooks. In the VFIO case, we will have to implement something here so that the VFIO driver stub doesn't get handled that treatment :-) We'll probably need some arch specific stuff in vfio_pci unfortunately, so that the errors get forwarded to the guest via our EEH interfaces, and let the guest handle it's error handling. Of course that leaves an interesting problem as to what state the device is in when it comes back to the host ... This is made a LOT more complicated in the VFIO model than it is in the "pHyp" model (our proprietary hypervisor). Under pHyp, the PE doesn't have a concept of being used outside of a guest, and it always reset before being assigned/unassigned. The guest can mess around all it wants (bus numbers, BARs, etc...) it can only hurt itself. The hypervisor doesn't keep track of any of that. > On the QEMU side we'd need to rescan the device after each reset, which > would be rather tedious for the typical case where it doesn't change. This is a direct consequence of your model :-) It makes things more complex for us as well, but we have to bite that bullet now. Maybe we can consider an alternate/simpler model in the future, more akin to what pHyp does, where we "unplug" the device from the host when assigning it to a guest (and the whole hierarchy below it if it's a bridge) and let the guest do what it wants with it. Doing so means we no longer have to emulate/filter config space (provided your HW handles MSI virtualization properly), care about bus numbers, BARs, etc... nor do we need to keep track of a lot of this in qemu. All we need is reset the whole & lot and re-probe the bus leg when returning the devices to the host. Cheers, Ben. > Thanks, > > Alex > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-02 23:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1375395497.31262.271.camel@ul30vt.home>
[not found] ` <1375420202.3743.97.camel@pasglop>
[not found] ` <1375461387.31262.314.camel@ul30vt.home>
[not found] ` <1375478934.15999.33.camel@pasglop>
2013-08-02 22:49 ` RFC: vfio-pci API for PCI bus/slot (hot) resets Bjorn Helgaas
2013-08-02 23:15 ` Benjamin Herrenschmidt
2013-08-02 23:37 ` Alex Williamson
2013-08-02 23:56 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).