Jason Wang
2023-Sep-26 02:32 UTC
[PATCH vfio 11/11] vfio/virtio: Introduce a vfio driver over virtio devices
On Mon, Sep 25, 2023 at 4:26?PM Parav Pandit <parav at nvidia.com> wrote:> > > > > From: Jason Wang <jasowang at redhat.com> > > Sent: Monday, September 25, 2023 8:00 AM > > > > On Fri, Sep 22, 2023 at 8:25?PM Parav Pandit <parav at nvidia.com> wrote: > > > > > > > > > > From: Jason Gunthorpe <jgg at nvidia.com> > > > > Sent: Friday, September 22, 2023 5:53 PM > > > > > > > > > > > And what's more, using MMIO BAR0 then it can work for legacy. > > > > > > > > Oh? How? Our team didn't think so. > > > > > > It does not. It was already discussed. > > > The device reset in legacy is not synchronous. > > > > How do you know this? > > > Not sure the motivation of same discussion done in the OASIS with you and others in past.That is exactly the same point. It's too late to define the legacy behaviour accurately in the spec so people will be lost in the legacy maze easily.> > Anyways, please find the answer below. > > About reset, > The legacy device specification has not enforced below cited 1.0 driver requirement of 1.0. > > "The driver SHOULD consider a driver-initiated reset complete when it reads device status as 0."We are talking about how to make devices work for legacy drivers. So it has nothing related to 1.0.> > [1] https://ozlabs.org/~rusty/virtio-spec/virtio-0.9.5.pdf > > > > The drivers do not wait for reset to complete; it was written for the sw > > backend. > > > > Do you see there's a flush after reset in the legacy driver? > > > Yes. it only flushes the write by reading it. The driver does not get _wait_ for the reset to complete within the device like above.It's the implementation details in legacy. The device needs to make sure (reset) the driver can work (is done before get_status return). That's all.
Parav Pandit
2023-Sep-26 04:01 UTC
[PATCH vfio 11/11] vfio/virtio: Introduce a vfio driver over virtio devices
> From: Jason Wang <jasowang at redhat.com> > Sent: Tuesday, September 26, 2023 8:03 AM > > It's the implementation details in legacy. The device needs to make sure (reset) > the driver can work (is done before get_status return).It is part of the 0.9.5 and 1.x specification as I quoted those text above.
Michael S. Tsirkin
2023-Sep-26 11:49 UTC
[PATCH vfio 11/11] vfio/virtio: Introduce a vfio driver over virtio devices
On Tue, Sep 26, 2023 at 10:32:39AM +0800, Jason Wang wrote:> It's the implementation details in legacy. The device needs to make > sure (reset) the driver can work (is done before get_status return).I think that there's no way to make it reliably work for all legacy drivers. They just assumed a software backend and did not bother with DMA ordering. You can try to avoid resets, they are not that common so things will tend to mostly work if you don't stress them to much with things like hot plug/unplug in a loop. Or you can try to use a driver after 2011 which is more aware of hardware ordering and flushes the reset write with a read. One of these two tricks, I think, is the magic behind the device exposing memory bar 0 that you mention. -- MST