On Wed, Oct 27, 2021 at 01:22:28PM +0100, John Levon wrote: > On Wed, Oct 27, 2021 at 11:15:35AM +0100, Stefan Hajnoczi wrote: > > > > > I like this approach as well. > > > > As you have mentioned, the device emulation code with first approach > > > > does have to how to handle the region accesses. The second approach will > > > > make things more transparent. Let me see how can I modify what there is > > > > there now and may ask further questions. > > > > > > Sorry I'm a bit late to this discussion, I'm not clear on the above WRT > > > vfio-user. If an ioregionfd has to cover a whole BAR0 (?), how would this > > > interact with partly-mmap()able regions like we do with SPDK/vfio-user/NVMe? > > > > The ioregionfd doesn't need to cover an entire BAR. QEMU's MemoryRegions > > form a hierarchy, so it's possible to sub-divide the BAR into several > > MemoryRegions. > > I think you're saying that when vfio-user client in qemu calls > VFIO_USER_DEVICE_GET_REGION_IO_FDS, it would create a sub-MR corresponding to > each one, before asking KVM to configure them? Yes. Actually I wasn't thinking of the vfio-user client but just about QEMU device emulation code in general. What you suggested sounds like a clean mapping from MemoryRegions to vfio-user. Stefan