Parav Pandit
2023-Sep-22 12:25 UTC
[PATCH vfio 11/11] vfio/virtio: Introduce a vfio driver over virtio devices
> 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. The drivers do not wait for reset to complete; it was written for the sw backend. Hence MMIO BAR0 is not the best option in real implementations.
Michael S. Tsirkin
2023-Sep-22 15:13 UTC
[PATCH vfio 11/11] vfio/virtio: Introduce a vfio driver over virtio devices
On Fri, Sep 22, 2023 at 12:25:06PM +0000, Parav Pandit 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. > The drivers do not wait for reset to complete; it was written for the sw backend. > Hence MMIO BAR0 is not the best option in real implementations.Or maybe they made it synchronous in hardware, that's all. After all same is true for the IO BAR0 e.g. for the PF: IO writes are posted anyway. Whether that's possible would depend on the hardware architecture. -- MST
Jason Wang
2023-Sep-25 02:30 UTC
[PATCH vfio 11/11] vfio/virtio: Introduce a vfio driver over virtio devices
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?> 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? static void vp_reset(struct virtio_device *vdev) { struct virtio_pci_device *vp_dev = to_vp_device(vdev); /* 0 status means a reset. */ vp_legacy_set_status(&vp_dev->ldev, 0); /* Flush out the status write, and flush in device writes, * including MSi-X interrupts, if any. */ vp_legacy_get_status(&vp_dev->ldev); /* Flush pending VQ/configuration callbacks. */ vp_synchronize_vectors(vdev); } Thanks> Hence MMIO BAR0 is not the best option in real implementations. >