[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Reset pass-thru devices in a VM
On Fri, Aug 09, 2019 at 10:49:32AM +0200, Jan Beulich wrote: >On 09.08.2019 10:38, Chao Gao wrote: >>I have a device which only supports secondary bus reset. After being >>assigned to a VM, it would be placed under host bridge. For devices >>under host bridge, secondary bus reset is not applicable. Thus, a VM >>has no way to reset this device. >> >>This device's usage would be limited without PCI reset (for example, its >>driver cannot re-initialize the device properly without PCI reset, which >>means in VM device won't be usable after unloading the driver), it would >>be much better if there is a way available to VMs to reset the device. >> >>In my mind, a straightfoward solution is to create a virtual bridge >>for a VM and place the pass-thru device under a virtual bridge. But it >>isn't supported in Xen (KVM/QEMU supports) and enabling it looks need >>a lot of efforts. > >Meanwhile I think a couple of years ago there was some initial effort >to get a newer chipset (Q35 iirc) emulated for HVM guests. Yes. But it seems that no one is working on this feature now. > >>Alternatively, emulating FLR (Function Level Reset) >>capability for this device might be a feasible way and only needs >>relatively few changes. I am planning to enable an opt-in feature >>(like 'permissive') to allow qemu to expose FLR capability to guest for >>pass-thru devices as long as this device is resetable on dom0 (i.e. the >>device has 'reset' attribute under its sysfs). And when guest initiates >>an FLR, qemu just echo 1 to the 'reset' attribute on dom0. >> >>Do you think emulating FLR capability is doable? > >Wouldn't a such emulated guest initiated reset affect other devices >(likely not under control of this guest) as well? No. Linux kernel guarantees that reset to a device won't affect other devices. Otherwise, such device cannot be reset and no 'reset' attribute will be created under device's sysfs. Specfically, the invocation of pci_dev_reset_slot_function() and pci_parent_bus_reset() in pci_probe_reset_function() will check whether the device (function) is the only one under the slot or bus respectively. In pci_create_capabilities_sysfs(), 'reset' attribute is created only if dev->reset_fn is not zero. Thanks Chao _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |