[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Reset pass-thru devices in a VM

  • To: Chao Gao <chao.gao@xxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 9 Aug 2019 14:42:09 +0200
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 09 Aug 2019 12:42:24 +0000
  • Ironport-sdr: CCU/+jBNta44SBii62QGGcUTebksHiOqfKWpENnnTd/Jw2sEQhL3i+Pv78HnUmTBh+1u2VkNxn qFa7H0Ynf18oaS6WvYcCpBV16tkoITGSfjm7SuRmeqssqjSj0dOnS4p6z8l42eF+VCjd1g1BpD RXpo7tYlZWao1++WYMtqztNhkFA3YMqQ993rUpCR66DOsBlTCrL5VagipWTT4sA2iXBPpUTYN6 S5nuMbi9+pg6sFvCgEuDN/fXKwFGjftx8ZK/dko8LOZNI6V0yTB9BiTKOA5aGDcpa6fz1lfdXG x1Q=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Aug 09, 2019 at 04:38:33PM +0800, Chao Gao wrote:
> Hi everyone,
> 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.

I think in general we don't allow guests to perform any kind of reset
of PCI devices, that's always in control of the hardware domain.

How are for example BARs going to be placed after such reset?

> 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.

Is this something common (ie: requiring device reset functionality)
for drivers to work correctly?

So far we seem to have managed to get away without it.

> 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. 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.

So you would expose the device as FLR capable and just implement it as
a secondary bus reset on the device model?

That seems feasible, but as noted above I would be worried about the
resources owned by the device, and how they are going to be placed
after such reset. Note you would also have to notify Xen somehow of
such reset, so it tears down all the state related to the device.

Thanks, Roger.

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.