[PATCH v2 00/29] vfio-user client

John Levon posted 29 patches 5 months, 4 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250520150419.2172078-1-john.levon@nutanix.com
Maintainers: John Levon <john.levon@nutanix.com>, Thanos Makatos <thanos.makatos@nutanix.com>, Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>
There is a newer version of this series
MAINTAINERS                           |   10 +-
docs/devel/index-internals.rst        |    1 +
docs/devel/vfio-user.rst              | 1522 +++++++++++++++++++++++++
docs/system/device-emulation.rst      |    1 +
docs/system/devices/vfio-user.rst     |   24 +
meson.build                           |    1 +
hw/vfio-user/container.h              |   27 +
hw/vfio-user/device.h                 |   27 +
hw/vfio-user/protocol.h               |  245 ++++
hw/vfio-user/proxy.h                  |  137 +++
hw/vfio-user/trace.h                  |    1 +
hw/vfio/pci.h                         |   16 +
include/hw/vfio/vfio-container-base.h |   70 +-
include/hw/vfio/vfio-device.h         |   15 +-
include/hw/vfio/vfio-region.h         |    2 +
include/system/memory.h               |   19 +-
hw/vfio-user/container.c              |  348 ++++++
hw/vfio-user/device.c                 |  389 +++++++
hw/vfio-user/pci.c                    |  428 +++++++
hw/vfio-user/proxy.c                  | 1314 +++++++++++++++++++++
hw/vfio/container-base.c              |    4 +-
hw/vfio/container.c                   |    3 +-
hw/vfio/device.c                      |   57 +-
hw/vfio/iommufd.c                     |    3 +-
hw/vfio/listener.c                    |   39 +-
hw/vfio/pci.c                         |  195 ++--
hw/vfio/region.c                      |   10 +-
hw/virtio/vhost-vdpa.c                |    9 +-
system/memory.c                       |   32 +-
hw/meson.build                        |    1 +
hw/vfio-user/meson.build              |   11 +
hw/vfio-user/trace-events             |   18 +
hw/vfio/trace-events                  |    6 +-
meson_options.txt                     |    2 +
scripts/meson-buildoptions.sh         |    4 +
35 files changed, 4845 insertions(+), 146 deletions(-)
create mode 100644 docs/devel/vfio-user.rst
create mode 100644 docs/system/devices/vfio-user.rst
create mode 100644 hw/vfio-user/container.h
create mode 100644 hw/vfio-user/device.h
create mode 100644 hw/vfio-user/protocol.h
create mode 100644 hw/vfio-user/proxy.h
create mode 100644 hw/vfio-user/trace.h
create mode 100644 hw/vfio-user/container.c
create mode 100644 hw/vfio-user/device.c
create mode 100644 hw/vfio-user/pci.c
create mode 100644 hw/vfio-user/proxy.c
create mode 100644 hw/vfio-user/meson.build
create mode 100644 hw/vfio-user/trace-events
[PATCH v2 00/29] vfio-user client
Posted by John Levon 5 months, 4 weeks ago
The series contains an implement of a vfio-user client in QEMU, along with a few
more preparatory patches.

The vfio-user protocol allows for implementing (PCI) devices in another
userspace process; SPDK is one example, which includes a virtual NVMe
implementation.

The vfio-user framework consists of 3 parts:
 1) The VFIO user protocol specification.
 2) A client - the VFIO device in QEMU that encapsulates VFIO messages
    and sends them to the server.
 3) A server - a remote process that emulates a device.

This patchset implements parts 1 and 2.

It has been tested against libvfio-user test servers as well as SPDK.

A previous version of this series can be found at
https://lore.kernel.org/qemu-devel/047d7d93-3fa5-41db-bdbf-3c14c8b47455@redhat.com/T/#t

Changes since last series:

 - rebased on v5 of vfio: return mr from vfio_get_xlat_addr
 - added docs for VFIOIOMMUClass
 - separated out vfio pci exports and renamed to vfio_pci namespace

John Levon (27):
  vfio: add more VFIOIOMMUClass docs
  vfio: move more cleanup into vfio_pci_put_device()
  vfio: move config space read into vfio_pci_config_setup()
  vfio: refactor out IRQ signalling setup
  vfio: export PCI helpers needed for vfio-user
  vfio: enable per-IRQ MSI-X masking
  vfio: add per-region fd support
  vfio: mark posted writes in region write callbacks
  vfio/container: pass MemoryRegion to DMA operations
  vfio-user: add vfio-user class and container
  vfio-user: connect vfio proxy to remote server
  vfio-user: implement message receive infrastructure
  vfio-user: implement message send infrastructure
  vfio-user: implement VFIO_USER_DEVICE_GET_INFO
  vfio-user: implement VFIO_USER_DEVICE_GET_REGION_INFO
  vfio-user: implement VFIO_USER_REGION_READ/WRITE
  vfio-user: set up PCI in vfio_user_pci_realize()
  vfio-user: implement VFIO_USER_DEVICE_GET/SET_IRQ*
  vfio-user: forward MSI-X PBA BAR accesses to server
  vfio-user: set up container access to the proxy
  vfio-user: implement VFIO_USER_DEVICE_RESET
  vfio-user: implement VFIO_USER_DMA_MAP/UNMAP
  vfio-user: implement VFIO_USER_DMA_READ/WRITE
  vfio-user: add 'x-msg-timeout' option
  vfio-user: support posted writes
  vfio-user: add coalesced posted writes
  docs: add vfio-user documentation

Steve Sistare (1):
  vfio: return mr from vfio_get_xlat_addr

Thanos Makatos (1):
  vfio-user: introduce vfio-user protocol specification

 MAINTAINERS                           |   10 +-
 docs/devel/index-internals.rst        |    1 +
 docs/devel/vfio-user.rst              | 1522 +++++++++++++++++++++++++
 docs/system/device-emulation.rst      |    1 +
 docs/system/devices/vfio-user.rst     |   24 +
 meson.build                           |    1 +
 hw/vfio-user/container.h              |   27 +
 hw/vfio-user/device.h                 |   27 +
 hw/vfio-user/protocol.h               |  245 ++++
 hw/vfio-user/proxy.h                  |  137 +++
 hw/vfio-user/trace.h                  |    1 +
 hw/vfio/pci.h                         |   16 +
 include/hw/vfio/vfio-container-base.h |   70 +-
 include/hw/vfio/vfio-device.h         |   15 +-
 include/hw/vfio/vfio-region.h         |    2 +
 include/system/memory.h               |   19 +-
 hw/vfio-user/container.c              |  348 ++++++
 hw/vfio-user/device.c                 |  389 +++++++
 hw/vfio-user/pci.c                    |  428 +++++++
 hw/vfio-user/proxy.c                  | 1314 +++++++++++++++++++++
 hw/vfio/container-base.c              |    4 +-
 hw/vfio/container.c                   |    3 +-
 hw/vfio/device.c                      |   57 +-
 hw/vfio/iommufd.c                     |    3 +-
 hw/vfio/listener.c                    |   39 +-
 hw/vfio/pci.c                         |  195 ++--
 hw/vfio/region.c                      |   10 +-
 hw/virtio/vhost-vdpa.c                |    9 +-
 system/memory.c                       |   32 +-
 hw/meson.build                        |    1 +
 hw/vfio-user/meson.build              |   11 +
 hw/vfio-user/trace-events             |   18 +
 hw/vfio/trace-events                  |    6 +-
 meson_options.txt                     |    2 +
 scripts/meson-buildoptions.sh         |    4 +
 35 files changed, 4845 insertions(+), 146 deletions(-)
 create mode 100644 docs/devel/vfio-user.rst
 create mode 100644 docs/system/devices/vfio-user.rst
 create mode 100644 hw/vfio-user/container.h
 create mode 100644 hw/vfio-user/device.h
 create mode 100644 hw/vfio-user/protocol.h
 create mode 100644 hw/vfio-user/proxy.h
 create mode 100644 hw/vfio-user/trace.h
 create mode 100644 hw/vfio-user/container.c
 create mode 100644 hw/vfio-user/device.c
 create mode 100644 hw/vfio-user/pci.c
 create mode 100644 hw/vfio-user/proxy.c
 create mode 100644 hw/vfio-user/meson.build
 create mode 100644 hw/vfio-user/trace-events

-- 
2.43.0
Re: [PATCH v2 00/29] vfio-user client
Posted by Cédric Le Goater 5 months, 3 weeks ago
John

On 5/20/25 17:03, John Levon wrote:
> The series contains an implement of a vfio-user client in QEMU, along with a few
> more preparatory patches.
> 
> The vfio-user protocol allows for implementing (PCI) devices in another
> userspace process; SPDK is one example, which includes a virtual NVMe
> implementation.
> 
> The vfio-user framework consists of 3 parts:
>   1) The VFIO user protocol specification.
>   2) A client - the VFIO device in QEMU that encapsulates VFIO messages
>      and sends them to the server.
>   3) A server - a remote process that emulates a device.
> 
> This patchset implements parts 1 and 2.
> 
> It has been tested against libvfio-user test servers as well as SPDK.
> 
> A previous version of this series can be found at
> https://lore.kernel.org/qemu-devel/047d7d93-3fa5-41db-bdbf-3c14c8b47455@redhat.com/T/#t
> 
> Changes since last series:
> 
>   - rebased on v5 of vfio: return mr from vfio_get_xlat_addr
>   - added docs for VFIOIOMMUClass
>   - separated out vfio pci exports and renamed to vfio_pci namespace
> 
> John Levon (27):
>    vfio: add more VFIOIOMMUClass docs
>    vfio: move more cleanup into vfio_pci_put_device()
>    vfio: move config space read into vfio_pci_config_setup()
>    vfio: refactor out IRQ signalling setup
>    vfio: export PCI helpers needed for vfio-user
>    vfio: enable per-IRQ MSI-X masking
>    vfio: add per-region fd support
>    vfio: mark posted writes in region write callbacks
>    vfio/container: pass MemoryRegion to DMA operations
>    vfio-user: add vfio-user class and container
>    vfio-user: connect vfio proxy to remote server
>    vfio-user: implement message receive infrastructure
>    vfio-user: implement message send infrastructure
>    vfio-user: implement VFIO_USER_DEVICE_GET_INFO
>    vfio-user: implement VFIO_USER_DEVICE_GET_REGION_INFO
>    vfio-user: implement VFIO_USER_REGION_READ/WRITE
>    vfio-user: set up PCI in vfio_user_pci_realize()
>    vfio-user: implement VFIO_USER_DEVICE_GET/SET_IRQ*
>    vfio-user: forward MSI-X PBA BAR accesses to server
>    vfio-user: set up container access to the proxy
>    vfio-user: implement VFIO_USER_DEVICE_RESET
>    vfio-user: implement VFIO_USER_DMA_MAP/UNMAP
>    vfio-user: implement VFIO_USER_DMA_READ/WRITE
>    vfio-user: add 'x-msg-timeout' option
>    vfio-user: support posted writes
>    vfio-user: add coalesced posted writes
>    docs: add vfio-user documentation
> 
> Steve Sistare (1):
>    vfio: return mr from vfio_get_xlat_addr
> 
> Thanos Makatos (1):
>    vfio-user: introduce vfio-user protocol specification
> 
>   MAINTAINERS                           |   10 +-
>   docs/devel/index-internals.rst        |    1 +
>   docs/devel/vfio-user.rst              | 1522 +++++++++++++++++++++++++
>   docs/system/device-emulation.rst      |    1 +
>   docs/system/devices/vfio-user.rst     |   24 +
>   meson.build                           |    1 +
>   hw/vfio-user/container.h              |   27 +
>   hw/vfio-user/device.h                 |   27 +
>   hw/vfio-user/protocol.h               |  245 ++++
>   hw/vfio-user/proxy.h                  |  137 +++
>   hw/vfio-user/trace.h                  |    1 +
>   hw/vfio/pci.h                         |   16 +
>   include/hw/vfio/vfio-container-base.h |   70 +-
>   include/hw/vfio/vfio-device.h         |   15 +-
>   include/hw/vfio/vfio-region.h         |    2 +
>   include/system/memory.h               |   19 +-
>   hw/vfio-user/container.c              |  348 ++++++
>   hw/vfio-user/device.c                 |  389 +++++++
>   hw/vfio-user/pci.c                    |  428 +++++++
>   hw/vfio-user/proxy.c                  | 1314 +++++++++++++++++++++
>   hw/vfio/container-base.c              |    4 +-
>   hw/vfio/container.c                   |    3 +-
>   hw/vfio/device.c                      |   57 +-
>   hw/vfio/iommufd.c                     |    3 +-
>   hw/vfio/listener.c                    |   39 +-
>   hw/vfio/pci.c                         |  195 ++--
>   hw/vfio/region.c                      |   10 +-
>   hw/virtio/vhost-vdpa.c                |    9 +-
>   system/memory.c                       |   32 +-
>   hw/meson.build                        |    1 +
>   hw/vfio-user/meson.build              |   11 +
>   hw/vfio-user/trace-events             |   18 +
>   hw/vfio/trace-events                  |    6 +-
>   meson_options.txt                     |    2 +
>   scripts/meson-buildoptions.sh         |    4 +
>   35 files changed, 4845 insertions(+), 146 deletions(-)
>   create mode 100644 docs/devel/vfio-user.rst
>   create mode 100644 docs/system/devices/vfio-user.rst
>   create mode 100644 hw/vfio-user/container.h
>   create mode 100644 hw/vfio-user/device.h
>   create mode 100644 hw/vfio-user/protocol.h
>   create mode 100644 hw/vfio-user/proxy.h
>   create mode 100644 hw/vfio-user/trace.h
>   create mode 100644 hw/vfio-user/container.c
>   create mode 100644 hw/vfio-user/device.c
>   create mode 100644 hw/vfio-user/pci.c
>   create mode 100644 hw/vfio-user/proxy.c
>   create mode 100644 hw/vfio-user/meson.build
>   create mode 100644 hw/vfio-user/trace-events
> 

I am planning to take first patches 2,3,4 in vfio-next. The rest
either requires rework or conflicts with the live update series.
Tell me if you are ok with that.


Thanks,

C.
Re: [PATCH v2 00/29] vfio-user client
Posted by John Levon 5 months, 3 weeks ago
On Tue, May 27, 2025 at 11:39:48AM +0200, Cédric Le Goater wrote:

> On 5/20/25 17:03, John Levon wrote:
> > The series contains an implement of a vfio-user client in QEMU, along with a few
> > more preparatory patches.
> 
> I am planning to take first patches 2,3,4 in vfio-next. The rest
> either requires rework or conflicts with the live update series.
> Tell me if you are ok with that.

Sure, I'm fine with that.

thanks
john
Re: [PATCH v2 00/29] vfio-user client
Posted by Cédric Le Goater 5 months, 3 weeks ago
On 5/27/25 12:04, John Levon wrote:
> On Tue, May 27, 2025 at 11:39:48AM +0200, Cédric Le Goater wrote:
> 
>> On 5/20/25 17:03, John Levon wrote:
>>> The series contains an implement of a vfio-user client in QEMU, along with a few
>>> more preparatory patches.
>>
>> I am planning to take first patches 2,3,4 in vfio-next. The rest
>> either requires rework or conflicts with the live update series.
>> Tell me if you are ok with that.
> 
> Sure, I'm fine with that.
done.


Thanks,

C.