Re: [PATCH 20/22] vfio-user/pci.c: use QOM casts where appropriate

2025-07-15 Thread John Levon
ead(VFIOPCIDevice *vdev, > VFIOUserDMARW *msg) > > static void vfio_user_dma_write(VFIOPCIDevice *vdev, VFIOUserDMARW *msg) > { > -PCIDevice *pdev = &vdev->pdev; > +PCIDevice *pdev = PCI_DEVICE(vdev); > VFIOUserProxy *proxy = vdev->vbasedev.proxy; > MemTxResult r; > Reviewed-by: John Levon

Re: [PATCH 09/22] vfio/container.c: use QOM casts where appropriate

2025-07-15 Thread John Levon
On Tue, Jul 15, 2025 at 10:25:49AM +0100, Mark Cave-Ayland wrote: > Use QOM casts to convert between VFIOUserContainer and VFIOContainerBase > instead > of accessing bcontainer directly. > > Signed-off-by: Mark Cave-Ayland Patch subject should be "vfio-user/container.c" not vfio/container.c

Re: [PATCH 13/22] vfio-user/pci.c: rename VFIOUserPCIDevice device field to parent_obj

2025-07-15 Thread John Levon
_USER_PCI) > > struct VFIOUserPCIDevice { > -VFIOPCIDevice device; > +VFIOPCIDevice parent_obj; > > SocketAddress *socket; > bool send_queued; /* all sends are queued */ Reviewed-by: John Levon

Re: [PATCH 10/22] vfio-user/container.h: rename VFIOUserContainer bcontainer field to parent_obj

2025-07-15 Thread John Levon
ntainer sub-class for vfio-user. */ > struct VFIOUserContainer { > -VFIOContainerBase bcontainer; > +VFIOContainerBase parent_obj; > > VFIOUserProxy *proxy; > }; Reviewed-by: John Levon

Re: [PATCH 12/22] vfio-user/pci.c: use QOM casts where appropriate

2025-07-15 Thread John Levon
r *name, > VFIOUserPCIDevice *udev = VFIO_USER_PCI(obj); > bool success; > > -if (udev->device.vbasedev.proxy) { > +if (VFIO_PCI_BASE(udev)->vbasedev.proxy) { > error_setg(errp, "Proxy is connected"); > return; > } Reviewed-by: John Levon

Re: [PATCH 11/22] vfio-user/pci.c: update VFIOUserPCIDevice declaration

2025-07-15 Thread John Levon
ruct VFIOUserPCIDevice { > VFIOPCIDevice device; > + > SocketAddress *socket; > bool send_queued; /* all sends are queued */ > uint32_t wait_time; /* timeout for message replies */ Reviewed-by: John Levon

Re: [PATCH 08/22] vfio-user/container.h: update VFIOUserContainer declaration

2025-07-15 Thread John Levon
se bcontainer; > + > VFIOUserProxy *proxy; > -} VFIOUserContainer; > +}; > > OBJECT_DECLARE_SIMPLE_TYPE(VFIOUserContainer, VFIO_IOMMU_USER); > Reviewed-by: John Levon

[PATCH v3 1/4] hw/vfio-user: add Cédric Le Goater as a maintainer

2025-07-15 Thread John Levon
Signed-off-by: John Levon --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index e88ed2c0a9..30e9b71e6e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4287,6 +4287,7 @@ F: tests/functional/test_multiprocess.py VFIO-USER: M: John Levon M: Thanos

[PATCH v3 4/4] hw/vfio-user: fix use of uninitialized variable

2025-07-15 Thread John Levon
e same way to resolve this. Resolves: Coverity CID 1611805 Fixes: 18e899e6 ("vfio-user: implement VFIO_USER_DMA_MAP/UNMAP") Reported-by: Cédric Le Goater Signed-off-by: John Levon Reviewed-by: Cédric Le Goater --- hw/vfio-user/container.c | 6 +- 1 file changed, 1 insertion(+), 5 del

[PATCH v3 0/4] vfio-user fixes

2025-07-15 Thread John Levon
Some small Coverity and related fixes for the recently merged vfio-user series. thanks john John Levon (4): hw/vfio-user: add Cédric Le Goater as a maintainer hw/vfio: fix region fd initialization hw/vfio-user: wait for proxy close correctly hw/vfio-user: fix use of uninitialized

[PATCH v3 3/4] hw/vfio-user: wait for proxy close correctly

2025-07-15 Thread John Levon
ity. Signed-off-by: John Levon Reviewed-by: Mark Cave-Ayland Reviewed-by: Cédric Le Goater --- hw/vfio-user/proxy.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c index c418954440..2275d3fe39 100644 --- a/hw/vfio-u

[PATCH v3 2/4] hw/vfio: fix region fd initialization

2025-07-15 Thread John Levon
We were not initializing the region fd array to -1, so we would accidentally try to close(0) on cleanup for any region that is not referenced. Fixes: 95cdb024 ("vfio: add region info cache") Signed-off-by: John Levon Reviewed-by: Mark Cave-Ayland Reviewed-by: Cédric Le Goater --

Re: [PATCH v2 3/4] hw/vfio-user: wait for proxy close correctly

2025-07-15 Thread John Levon
On Tue, Jul 15, 2025 at 10:01:59AM +0100, Mark Cave-Ayland wrote: > On 15/07/2025 06:52, John Levon wrote: > > > Coverity reported: > > > > CID 1611806: Concurrent data access violations (BAD_CHECK_OF_WAIT_COND) > > > > A wait is performed without a loop

[PATCH v2 4/4] hw/vfio-user: fix use of uninitialized variable

2025-07-14 Thread John Levon
e same way to resolve this. Resolves: Coverity CID 1611805 Fixes: 18e899e6 ("vfio-user: implement VFIO_USER_DMA_MAP/UNMAP") Reported-by: Cédric Le Goater Signed-off-by: John Levon --- hw/vfio-user/container.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/vfi

[PATCH v2 3/4] hw/vfio-user: wait for proxy close correctly

2025-07-14 Thread John Levon
xes: 0b3d881a ("vfio-user: implement message receive infrastructure") Signed-off-by: John Levon --- hw/vfio-user/proxy.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c index c418954440..2275d3fe39 100644 --- a

[PATCH v2 2/4] hw/vfio: fix region fd initialization

2025-07-14 Thread John Levon
We were not initializing the region fd array to -1, so we would accidentally try to close(0) on cleanup for any region that is not referenced. Fixes: 95cdb024 ("vfio: add region info cache") Signed-off-by: John Levon --- hw/vfio/device.c | 6 +- 1 file changed, 5 insertions(+),

[PATCH v2 1/4] hw/vfio-user: add Cédric Le Goater as a maintainer

2025-07-14 Thread John Levon
Signed-off-by: John Levon --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index e88ed2c0a9..30e9b71e6e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4287,6 +4287,7 @@ F: tests/functional/test_multiprocess.py VFIO-USER: M: John Levon M: Thanos

[PATCH v2 0/4] vfio-user fixes

2025-07-14 Thread John Levon
Some small Coverity and related fixes for the recently merged vfio-user series. thanks john John Levon (4): hw/vfio-user: add Cédric Le Goater as a maintainer hw/vfio: fix region fd initialization hw/vfio-user: wait for proxy close correctly hw/vfio-user: fix use of uninitialized

[PATCH v2] hw/vfio-user: wait for proxy close correctly

2025-07-11 Thread John Levon
ity. Signed-off-by: John Levon --- hw/vfio-user/proxy.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c index c418954440..2275d3fe39 100644 --- a/hw/vfio-user/proxy.c +++ b/hw/vfio-user/proxy.c @@ -32,7 +32,6 @@ static v

[PATCH] hw/vfio: fix region fd initialization

2025-07-10 Thread John Levon
We were not initializing the region fd array to -1, so we would accidentally try to close(0) on cleanup for any region that is not referenced. Fixes: 95cdb024 ("vfio: add region info cache") Signed-off-by: John Levon --- hw/vfio/device.c | 6 +- 1 file changed, 5 insertions(+),

[PATCH] hw/vfio-user: wait for proxy close correctly

2025-07-10 Thread John Levon
Coverity reported: CID 1611806: Concurrent data access violations (BAD_CHECK_OF_WAIT_COND) A wait is performed without a loop. If there is a spurious wakeup, the condition may not be satisfied. Fix this by checking ->state for VFIO_PROXY_CLOSED in a loop. Signed-off-by: John Levon ---

Re: [PULL 08/25] vfio-user: connect vfio proxy to remote server

2025-07-10 Thread John Levon
On Thu, Jul 10, 2025 at 01:33:17PM +0100, Peter Maydell wrote: > On Thu, 26 Jun 2025 at 08:51, Cédric Le Goater wrote: > > > > From: John Levon > > > > Introduce the vfio-user "proxy": this is the client code responsible for > > sending and receiving v

[PATCH] hw/vfio-user: fix use of uninitialized variable

2025-07-08 Thread John Levon
e same way to resolve this. Reported-by: Cédric Le Goater Signed-off-by: John Levon --- hw/vfio-user/container.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c index d318e6a339..d589dd90f5 100644 --- a/hw/vfio-user/cont

[PATCH v5 06/19] vfio-user: implement VFIO_USER_DEVICE_GET_REGION_INFO

2025-06-25 Thread John Levon
Add support for getting region info for vfio-user. As vfio-user has one fd per region, enable ->use_region_fds. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/device.h | 2 ++ hw/vfio-user/protoco

[PATCH v5 05/19] vfio-user: implement VFIO_USER_DEVICE_GET_INFO

2025-06-25 Thread John Levon
Add support for getting basic device information. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/device.h | 20 ++ hw/vfio-user/protocol.h | 12 + hw/vfio-user/proxy.h | 7

[PATCH v5 18/19] docs: add vfio-user documentation

2025-06-25 Thread John Levon
Add some basic documentation on vfio-user usage. Signed-off-by: John Levon --- docs/system/device-emulation.rst | 1 + docs/system/devices/vfio-user.rst | 26 ++ 2 files changed, 27 insertions(+) create mode 100644 docs/system/devices/vfio-user.rst diff --git a/docs

[PATCH v5 14/19] vfio-user: implement VFIO_USER_DMA_READ/WRITE

2025-06-25 Thread John Levon
Unlike most other messages, this is a server->client message, for when a server wants to do "DMA"; this is slow, so normally the server has memory directly mapped instead. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-b

[PATCH v5 19/19] vfio-user: introduce vfio-user protocol specification

2025-06-25 Thread John Levon
discussed as an RFC in: "RFC: use VFIO over a UNIX domain socket to implement device offloading" Signed-off-by: Thanos Makatos Signed-off-by: John Levon --- MAINTAINERS|3 +- docs/interop/index.rst |1 + docs/interop/vfio-user.

[PATCH v5 12/19] vfio-user: implement VFIO_USER_DEVICE_RESET

2025-06-25 Thread John Levon
Hook this call up to the legacy reset handler for vfio-user-pci. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/device.h | 2 ++ hw/vfio-user/device.c | 18 ++ hw/vfio-user/pci.c| 15

[PATCH v5 09/19] vfio-user: implement VFIO_USER_DEVICE_GET/SET_IRQ*

2025-06-25 Thread John Levon
IRQ setup uses the same semantics as the traditional vfio path, but we need to share the corresponding file descriptors with the server as necessary. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user

[PATCH v5 10/19] vfio-user: forward MSI-X PBA BAR accesses to server

2025-06-25 Thread John Levon
For vfio-user, the server holds the pending IRQ state; set up an I/O region for the MSI-X PBA so we can ask the server for this state on a PBA read. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/pci.h

[PATCH v5 11/19] vfio-user: set up container access to the proxy

2025-06-25 Thread John Levon
The user container will shortly need access to the underlying vfio-user proxy; set this up. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/container.h | 2 ++ hw/vfio-user/container.c | 43

[PATCH v5 13/19] vfio-user: implement VFIO_USER_DMA_MAP/UNMAP

2025-06-25 Thread John Levon
From: John Levon When the vfio-user container gets mapping updates, share them with the vfio-user by sending a message; this can include the region fd, allowing the server to directly mmap() the region as needed. For performance, we only wait for the message responses when we're doing w

[PATCH v5 03/19] vfio-user: implement message receive infrastructure

2025-06-25 Thread John Levon
Add the basic implementation for receiving vfio-user messages from the control socket. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- meson.build | 1 + hw/vfio-user/protocol.h | 53 + hw/vfio

[PATCH v5 08/19] vfio-user: set up PCI in vfio_user_pci_realize()

2025-06-25 Thread John Levon
Re-use PCI setup functions from hw/vfio/pci.c to realize the vfio-user PCI device. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/pci.c | 29 + 1 file changed, 29 insertions

[PATCH v5 02/19] vfio-user: connect vfio proxy to remote server

2025-06-25 Thread John Levon
rPCIDevice instance. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/proxy.h | 79 + include/hw/vfio/vfio-device.h | 2 + hw/vfio-user/pci.c| 22 + hw/vfio-us

[PATCH v5 07/19] vfio-user: implement VFIO_USER_REGION_READ/WRITE

2025-06-25 Thread John Levon
Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/protocol.h | 12 ++ hw/vfio-user/device.c | 79 +++ hw/vfio-user/trace-events | 1 + 3 files changed, 92

[PATCH v5 04/19] vfio-user: implement message send infrastructure

2025-06-25 Thread John Levon
Add plumbing for sending vfio-user messages on the control socket. Add initial version negotation on connection. Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon --- hw/vfio-user/protocol.h | 62 + hw/vfio-user

[PATCH v5 16/19] vfio-user: support posted writes

2025-06-25 Thread John Levon
Support an asynchronous send of a vfio-user socket message (no wait for a reply) when the write is posted. This is only safe when no regions are mappable by the VM. Add an option to explicitly disable this as well. Signed-off-by: John Levon --- hw/vfio-user/proxy.h | 6 ++ hw/vfio-user

[PATCH v5 17/19] vfio-user: add coalesced posted writes

2025-06-25 Thread John Levon
: John Levon --- hw/vfio-user/protocol.h | 21 ++ hw/vfio-user/proxy.h | 12 ++ hw/vfio-user/device.c | 40 +++ hw/vfio-user/proxy.c | 84 +++ hw/vfio-user/trace-events | 1 + 5 files changed, 158 insertions(+) diff

[PATCH v5 15/19] vfio-user: add 'x-msg-timeout' option

2025-06-25 Thread John Levon
By default, the vfio-user subsystem will wait 5 seconds for a message reply from the server. Add an option to allow this to be configurable. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/proxy.h | 1

[PATCH v5 00/19] vfio-user client

2025-06-25 Thread John Levon
functional test is still being worked on. A previous version of this series can be found at https://lore.kernel.org/qemu-devel/20250619133154.264786-1-john.le...@nutanix.com/ Changes since last series: - fixed SPDX identifier nits - code review changes for error handling thanks john John Levon (18

[PATCH v5 01/19] vfio-user: add vfio-user class and container

2025-06-25 Thread John Levon
.c for instantiating VFIOUserPCIDevice objects, sharing some common code from hw/vfio/pci.c. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- MAINTAINERS | 8 + hw/vfio-user/container.h

Re: [PATCH] vfio: add license tag to some files

2025-06-25 Thread John Levon
On Tue, Jun 24, 2025 at 11:35:52AM +0200, Cédric Le Goater wrote: > > These files came from hw/vfio/ and were then modified so would carry the > > same > > license. Please let me know what you'd like me to do. > > Ah. Please consider them as new. These are infrastructure files which are > all si

Re: [PATCH v4 03/19] vfio-user: implement message receive infrastructure

2025-06-25 Thread John Levon
On Wed, Jun 25, 2025 at 10:02:50AM +0200, Cédric Le Goater wrote: > > +/* > > + * Process a received message. > > + */ > > +static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg, > > + bool isreply) > > This routine could have an 'Error **errp' paramete

Re: [PATCH v4 00/19] vfio-user client

2025-06-25 Thread John Levon
On Wed, Jun 25, 2025 at 10:56:44AM +0200, Cédric Le Goater wrote: > Could you please send v5 this week ? I plan to merge it first as other > proposals are knocking at the VFIO door and I am OOO on week 28. Will take care of your Error comments then send out thanks john

Re: [PATCH] vfio: add license tag to some files

2025-06-24 Thread John Levon
On Tue, Jun 24, 2025 at 11:27:57AM +0200, Cédric Le Goater wrote: > On 6/24/25 11:19, John Levon wrote: > > On Tue, Jun 24, 2025 at 10:05:44AM +0100, Daniel P. Berrangé wrote: > > > > > On Tue, Jun 24, 2025 at 10:34:40AM +0200, Cédric Le Goater wrote: > > > >

Re: [PATCH] vfio: add license tag to some files

2025-06-24 Thread John Levon
On Tue, Jun 24, 2025 at 10:05:44AM +0100, Daniel P. Berrangé wrote: > On Tue, Jun 24, 2025 at 10:34:40AM +0200, Cédric Le Goater wrote: > > + Daniel > > > > On 6/23/25 11:30, John Levon wrote: > > > Add SPDX-License-Identifier to some files missing it in hw/vfi

Re: [PATCH v3 00/23] vfio-user client

2025-06-23 Thread John Levon
On Sun, Jun 22, 2025 at 02:57:57PM +0200, Cédric Le Goater wrote: > PCI enumeration work but the kernel module won't load on ubuntu 24.04 Sorry, I forgot - there's a kernel bug in the Ubuntu LTS kernel for this driver. Mark has a fix - Mark, can you share? regards john

[PATCH] vfio: add license tag to some files

2025-06-23 Thread John Levon
Add SPDX-License-Identifier to some files missing it in hw/vfio/. Signed-off-by: John Levon --- hw/vfio/trace.h | 3 +++ hw/vfio/Kconfig | 2 ++ hw/vfio/meson.build | 2 ++ hw/vfio/trace-events | 2 ++ 4 files changed, 9 insertions(+) diff --git a/hw/vfio/trace.h b/hw/vfio/trace.h

Re: [PATCH v4 00/19] vfio-user client

2025-06-21 Thread John Levon
On Sat, Jun 21, 2025 at 04:25:24PM +0200, Cédric Le Goater wrote: > > So please let me know what if anything needs to be fixed (and if I should > > make > > the same retrospective fix to hw/vfio/ equivalent). > > Did you update the QEMU tree ? > > $ git describe > v10.0.0-1657-g6e1571533fd9

Re: [PATCH v4 00/19] vfio-user client

2025-06-21 Thread John Levon
On Fri, Jun 20, 2025 at 11:11:10AM +0200, Cédric Le Goater wrote: > > The series contains an implement of a vfio-user client in QEMU, along with > > a few > > more preparatory patches. > > Please run ./scripts/checkpatch.pl and resend later on, as we might get > reviews. Output is below, MAINTA

Re: [PATCH v3 00/23] vfio-user client

2025-06-21 Thread John Levon
On Fri, Jun 20, 2025 at 10:32:10AM +0200, Cédric Le Goater wrote: > Before merging, I would like to be able to experiment a minimum. > > Does a dummy device (server side) implementation exist ? and a > GH repo I could pull the code from. > > John, > > How do you test ? I use these scripts for

[PATCH v4 17/19] vfio-user: add coalesced posted writes

2025-06-19 Thread John Levon
: John Levon --- hw/vfio-user/protocol.h | 21 ++ hw/vfio-user/proxy.h | 12 ++ hw/vfio-user/device.c | 40 +++ hw/vfio-user/proxy.c | 84 +++ hw/vfio-user/trace-events | 1 + 5 files changed, 158 insertions(+) diff

[PATCH v4 09/19] vfio-user: implement VFIO_USER_DEVICE_GET/SET_IRQ*

2025-06-19 Thread John Levon
IRQ setup uses the same semantics as the traditional vfio path, but we need to share the corresponding file descriptors with the server as necessary. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user

[PATCH v4 12/19] vfio-user: implement VFIO_USER_DEVICE_RESET

2025-06-19 Thread John Levon
Hook this call up to the legacy reset handler for vfio-user-pci. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/device.h | 2 ++ hw/vfio-user/device.c | 12 hw/vfio-user/pci.c| 15

[PATCH v4 15/19] vfio-user: add 'x-msg-timeout' option

2025-06-19 Thread John Levon
By default, the vfio-user subsystem will wait 5 seconds for a message reply from the server. Add an option to allow this to be configurable. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/proxy.h | 1

[PATCH v4 10/19] vfio-user: forward MSI-X PBA BAR accesses to server

2025-06-19 Thread John Levon
For vfio-user, the server holds the pending IRQ state; set up an I/O region for the MSI-X PBA so we can ask the server for this state on a PBA read. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/pci.h

[PATCH v4 05/19] vfio-user: implement VFIO_USER_DEVICE_GET_INFO

2025-06-19 Thread John Levon
Add support for getting basic device information. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/device.h | 20 hw/vfio-user/protocol.h | 12 ++ hw/vfio-user/proxy.h

[PATCH v4 04/19] vfio-user: implement message send infrastructure

2025-06-19 Thread John Levon
Add plumbing for sending vfio-user messages on the control socket. Add initial version negotation on connection. Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon --- hw/vfio-user/protocol.h | 62 + hw/vfio-user

[PATCH v4 01/19] vfio-user: add vfio-user class and container

2025-06-19 Thread John Levon
.c for instantiating VFIOUserPCIDevice objects, sharing some common code from hw/vfio/pci.c. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- MAINTAINERS | 8 + hw/vfio-user/container.h

[PATCH v4 16/19] vfio-user: support posted writes

2025-06-19 Thread John Levon
Support an asynchronous send of a vfio-user socket message (no wait for a reply) when the write is posted. This is only safe when no regions are mappable by the VM. Add an option to explicitly disable this as well. Signed-off-by: John Levon --- hw/vfio-user/proxy.h | 5 + hw/vfio-user

[PATCH v4 18/19] docs: add vfio-user documentation

2025-06-19 Thread John Levon
Add some basic documentation on vfio-user usage. Signed-off-by: John Levon --- docs/system/device-emulation.rst | 1 + docs/system/devices/vfio-user.rst | 24 2 files changed, 25 insertions(+) create mode 100644 docs/system/devices/vfio-user.rst diff --git a/docs

[PATCH v4 08/19] vfio-user: set up PCI in vfio_user_pci_realize()

2025-06-19 Thread John Levon
Re-use PCI setup functions from hw/vfio/pci.c to realize the vfio-user PCI device. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/pci.c | 29 + 1 file changed, 29 insertions

[PATCH v4 03/19] vfio-user: implement message receive infrastructure

2025-06-19 Thread John Levon
Add the basic implementation for receiving vfio-user messages from the control socket. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- meson.build | 1 + hw/vfio-user/protocol.h | 53 + hw/vfio

[PATCH v4 06/19] vfio-user: implement VFIO_USER_DEVICE_GET_REGION_INFO

2025-06-19 Thread John Levon
Add support for getting region info for vfio-user. As vfio-user has one fd per region, enable ->use_region_fds. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/device.h | 2 ++ hw/vfio-user/protoco

[PATCH v4 07/19] vfio-user: implement VFIO_USER_REGION_READ/WRITE

2025-06-19 Thread John Levon
Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/protocol.h | 12 +++ hw/vfio-user/device.c | 67 +++ hw/vfio-user/trace-events | 1 + 3 files changed, 80

[PATCH v4 13/19] vfio-user: implement VFIO_USER_DMA_MAP/UNMAP

2025-06-19 Thread John Levon
From: John Levon When the vfio-user container gets mapping updates, share them with the vfio-user by sending a message; this can include the region fd, allowing the server to directly mmap() the region as needed. For performance, we only wait for the message responses when we're doing w

[PATCH v4 19/19] vfio-user: introduce vfio-user protocol specification

2025-06-19 Thread John Levon
discussed as an RFC in: "RFC: use VFIO over a UNIX domain socket to implement device offloading" Signed-off-by: Thanos Makatos Signed-off-by: John Levon --- MAINTAINERS|3 +- docs/interop/index.rst |1 + docs/interop/vfio-user.

[PATCH v4 14/19] vfio-user: implement VFIO_USER_DMA_READ/WRITE

2025-06-19 Thread John Levon
Unlike most other messages, this is a server->client message, for when a server wants to do "DMA"; this is slow, so normally the server has memory directly mapped instead. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-b

[PATCH v4 11/19] vfio-user: set up container access to the proxy

2025-06-19 Thread John Levon
The user container will shortly need access to the underlying vfio-user proxy; set this up. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/container.h | 2 ++ hw/vfio-user/container.c | 43

[PATCH v4 02/19] vfio-user: connect vfio proxy to remote server

2025-06-19 Thread John Levon
rPCIDevice instance. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/proxy.h | 79 + include/hw/vfio/vfio-device.h | 2 + hw/vfio-user/pci.c| 22 + hw/vfio-us

[PATCH v4 00/19] vfio-user client

2025-06-19 Thread John Levon
has been removed - the documentation has been relocated next to vhost-user's - SocketAddress is now used for the command line parameter - small bits of code review feedback John Levon (18): vfio-user: add vfio-user class and container vfio-user: connect vfio proxy to remote server

[PATCH] vfio: add vfio_device_get_region_fd()

2025-06-16 Thread John Levon
This keeps the existence of ->region_fds private to hw/vfio/device.c. Signed-off-by: John Levon --- include/hw/vfio/vfio-device.h | 12 hw/vfio/device.c | 7 +++ hw/vfio/region.c | 5 + 3 files changed, 20 insertions(+), 4 deletions(-) d

[PATCH] vfio: add documentation for posted write argument

2025-06-16 Thread John Levon
Signed-off-by: John Levon --- include/hw/vfio/vfio-device.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h index d45e5a68a2..abea652be2 100644 --- a/include/hw/vfio/vfio-device.h +++ b/include/hw/vfio/vfio-device.h @@ -240,6

Re: [PATCH v3 00/23] vfio-user client

2025-06-12 Thread John Levon
On Thu, Jun 12, 2025 at 08:57:54AM +0200, Cédric Le Goater wrote: > On 6/7/25 02:10, 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

Re: [PATCH v3 06/23] vfio-user: add vfio-user class and container

2025-06-12 Thread John Levon
On Thu, Jun 12, 2025 at 08:39:17AM +0200, Cédric Le Goater wrote: > > +static void vfio_user_pci_realize(PCIDevice *pdev, Error **errp) > > +{ > > +ERRP_GUARD(); > > +VFIOUserPCIDevice *udev = VFIO_USER_PCI(pdev); > > +VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev); > > +VFIODevice *vba

[PATCH] vfio: improve VFIODeviceIOOps docs

2025-06-11 Thread John Levon
Explicitly describe every parameter rather than summarizing. Signed-off-by: John Levon --- include/hw/vfio/vfio-device.h | 52 +-- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h index

Re: [PATCH] vfio/pci: Fix instance_size of VFIO_PCI_BASE

2025-06-11 Thread John Levon
> > This isn't catastrophic only because VFIO_PCI_BASE is an abstract class. > > Fixes: d4e392d0a99b ("vfio: add vfio-pci-base class") > Signed-off-by: Zhenzhong Duan Thanks! I had a similar patch after IRC discussion. Reviewed-by: John Levon regards john

Re: [PATCH v3 06/23] vfio-user: add vfio-user class and container

2025-06-11 Thread John Levon
On Wed, Jun 11, 2025 at 09:46:15AM +0200, Cédric Le Goater wrote: > > > can't we simply have a CONFIG option and select the device on platforms > > > supporting it ? > > > > You mean always build vfio-user client rather than optionally? Why would it > > be > > different from other optional compo

Re: [PATCH v3 02/23] vfio: enable per-IRQ MSI-X masking

2025-06-10 Thread John Levon
On Fri, Jun 06, 2025 at 05:10:34PM -0700, John Levon wrote: > If VFIO_IRQ_INFO_MASKABLE is set for VFIO_PCI_MSIX_IRQ_INDEX, record > this in ->can_mask_msix, and use it to individually mask MSI-X > interrupts as needed. I'm just going to drop this patch. Neither vfio nor libvfi

Re: [PATCH v3 03/23] vfio: add per-region fd support

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 09:42:41AM +0200, Cédric Le Goater wrote: > > @@ -478,9 +491,14 @@ void vfio_device_unprepare(VFIODevice *vbasedev) > > for (i = 0; i < vbasedev->num_regions; i++) { > > g_free(vbasedev->reginfo[i]); > > +if (vbasedev->region_fds != NULL && vbasedev-

Re: [PATCH v3 03/23] vfio: add per-region fd support

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 09:42:41AM +0200, Cédric Le Goater wrote: > > @@ -478,9 +491,14 @@ void vfio_device_unprepare(VFIODevice *vbasedev) > > for (i = 0; i < vbasedev->num_regions; i++) { > > g_free(vbasedev->reginfo[i]); > > +if (vbasedev->region_fds != NULL && vbasedev-

Re: [PATCH v3 06/23] vfio-user: add vfio-user class and container

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 11:57:00AM +0200, Cédric Le Goater wrote: > > @@ -529,6 +531,8 @@ _meson_option_parse() { > > --disable-vdi) printf "%s" -Dvdi=disabled ;; > > --enable-vduse-blk-export) printf "%s" -Dvduse_blk_export=enabled ;; > > --disable-vduse-blk-export) printf "%s"

Re: [PATCH v3 05/23] vfio-user: introduce vfio-user protocol specification

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 11:38:29AM +0200, Cédric Le Goater wrote: > > + > > +-- > > +Version_ 0.9.1 > > +-- > > Are you planning to have a subsection per version ? > I've removed this, as it's not useful/meaningful at this point in time. regards john

Re: [PATCH v3 03/23] vfio: add per-region fd support

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 09:42:41AM +0200, Cédric Le Goater wrote: > On 6/7/25 02:10, John Levon wrote: > > For vfio-user, each region has its own fd rather than sharing > > vbasedev's. Add the necessary plumbing to support this, and use the > > corr

Re: [PATCH v3 03/23] vfio: add per-region fd support

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 01:57:23PM +0200, Cédric Le Goater wrote: > On 6/10/25 13:27, John Levon wrote: > > On Tue, Jun 10, 2025 at 11:58:18AM +0100, Mark Cave-Ayland wrote: > > > > > > +/* Use the per-region fd if set, or the shared fd. */ > > &

Re: [PATCH v3 06/23] vfio-user: add vfio-user class and container

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 12:42:35PM +0100, Mark Cave-Ayland wrote: > Question: how do you see the division between hw/vfio and hw/vfio-user? My > initial feeling is that there is substantial sharing between the two, in > which case I'd expect the files to be in hw/vfio as e.g. > hw/vfio/container-u

Re: [PATCH v3 03/23] vfio: add per-region fd support

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 11:58:18AM +0100, Mark Cave-Ayland wrote: > > +/* Use the per-region fd if set, or the shared fd. */ > > +fd = region->vbasedev->region_fds ? > > + region->vbasedev->region_fds[region->nr] : > > + region->vbasedev->fd, > > + > > This

Re: [PATCH v3 05/23] vfio-user: introduce vfio-user protocol specification

2025-06-10 Thread John Levon
On Tue, Jun 10, 2025 at 11:38:29AM +0200, Cédric Le Goater wrote: > > docs/devel/vfio-user.rst | 1522 > > I think this file should be split in several smaller files. The > protocol specification part belongs to "System Emulation Management > and Interopera

Re: [PATCH] vfio/container: Fix vfio_listener_commit()

2025-06-09 Thread John Levon
-off-by: Zhenzhong Duan D'oh, copy-and-paste error, thanks. Somewhat impressive this didn't show up as any failure in my testing. Reviewed-by: John Levon regards john

[PATCH v3 09/23] vfio-user: implement message send infrastructure

2025-06-06 Thread John Levon
Add plumbing for sending vfio-user messages on the control socket. Add initial version negotation on connection. Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon --- hw/vfio-user/protocol.h | 62 + hw/vfio-user

[PATCH v3 13/23] vfio-user: set up PCI in vfio_user_pci_realize()

2025-06-06 Thread John Levon
Re-use PCI setup functions from hw/vfio/pci.c to realize the vfio-user PCI device. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/pci.c | 29 + 1 file changed, 29 insertions

[PATCH v3 04/23] vfio: mark posted writes in region write callbacks

2025-06-06 Thread John Levon
For vfio-user, the region write implementation needs to know if the write is posted; add the necessary plumbing to support this. Signed-off-by: John Levon Reviewed-by: Cédric Le Goater --- include/hw/vfio/vfio-device.h | 4 ++-- include/hw/vfio/vfio-region.h | 1 + hw/vfio/device.c

[PATCH v3 07/23] vfio-user: connect vfio proxy to remote server

2025-06-06 Thread John Levon
rPCIDevice instance. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio-user/proxy.h | 82 + include/hw/vfio/vfio-device.h | 2 + hw/vfio-user/pci.c| 17 hw/vfio-us

[PATCH v3 18/23] vfio-user: implement VFIO_USER_DMA_MAP/UNMAP

2025-06-06 Thread John Levon
From: John Levon When the vfio-user container gets mapping updates, share them with the vfio-user by sending a message; this can include the region fd, allowing the server to directly mmap() the region as needed. For performance, we only wait for the message responses when we're doing w

[PATCH v3 22/23] vfio-user: add coalesced posted writes

2025-06-06 Thread John Levon
: John Levon --- hw/vfio-user/protocol.h | 21 ++ hw/vfio-user/proxy.h | 12 ++ hw/vfio-user/device.c | 40 +++ hw/vfio-user/proxy.c | 84 +++ hw/vfio-user/trace-events | 1 + 5 files changed, 158 insertions(+) diff

[PATCH v3 08/23] vfio-user: implement message receive infrastructure

2025-06-06 Thread John Levon
Add the basic implementation for receiving vfio-user messages from the control socket. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- meson.build | 1 + hw/vfio-user/protocol.h | 56 ++ hw/vfio

[PATCH v3 19/23] vfio-user: implement VFIO_USER_DMA_READ/WRITE

2025-06-06 Thread John Levon
Unlike most other messages, this is a server->client message, for when a server wants to do "DMA"; this is slow, so normally the server has memory directly mapped instead. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-b

[PATCH v3 03/23] vfio: add per-region fd support

2025-06-06 Thread John Levon
For vfio-user, each region has its own fd rather than sharing vbasedev's. Add the necessary plumbing to support this, and use the correct fd in vfio_region_mmap(). Signed-off-by: John Levon --- include/hw/vfio/vfio-device.h | 7 +-- hw/vfio/device.c

  1   2   3   4   5   >