Subject: Re: [PATCH V1 mlx5-next 12/13] vfio/pci: Add infrastructure to let vfio_pci_core drivers trap device RESET

From: Jason Gunthorpe <[email-masked]>
Date: Fri, 15 Oct 2021 17:03:28 -0300

On Fri, Oct 15, 2021 at 01:52:37PM -0600, Alex Williamson wrote:
> On Wed, 13 Oct 2021 12:47:06 +0300
> Yishai Hadas <[email-masked]> wrote:
> 
> > Add infrastructure to let vfio_pci_core drivers trap device RESET.
> > 
> > The motivation for this is to let the underlay driver be aware that
> > reset was done and set its internal state accordingly.
> 
> I think the intention of the uAPI here is that the migration error
> state is exited specifically via the reset ioctl.  Maybe that should be
> made more clear, but variant drivers can already wrap the core ioctl
> for the purpose of determining that mechanism of reset has occurred.

It is not just recovering the error state.

Any transition to reset changes the firmware state. Eg if userspace
uses one of the other emulation paths to trigger the reset after
putting the device off running then the driver state and FW state
become desynchronized.

So all the reset paths need to be synchronized some how, either
blocked while in non-running states or aligning the SW state with the
new post-reset FW state.

Jason