Re: [PATCH 0/1] Update vfio-user module to the latest

2022-08-07 Thread John Levon
On Fri, Aug 05, 2022 at 09:24:56AM +0100, Daniel P. Berrangé wrote: > > > For the RFC QEMU user space eBPF support, > > > https://lore.kernel.org/all/20220617073630.535914-6-chen.zh...@intel.com/T/ > > > Maybe introduce the libubpf.so as a subproject like libvfio-user.so is > > > more appropriate

Re: [PATCH v6 0/5] Support message-based DMA in vfio-user server

2024-05-02 Thread John Levon
On Wed, Nov 01, 2023 at 06:16:06AM -0700, Mattias Nissler wrote: > This series adds basic support for message-based DMA in qemu's vfio-user Now qemu 9.0 is out, any reason not to get this series merged? thanks john

Re: MMIO/PIO dispatch file descriptors (ioregionfd) design discussion

2021-10-26 Thread John Levon
On Mon, Oct 25, 2021 at 08:21:22AM -0700, Elena wrote: > > I'm curious what approach you want to propose for QEMU integration. A > > while back I thought about the QEMU API. It's possible to implement it > > along the lines of the memory_region_add_eventfd() API where each > > ioregionfd is explic

Re: MMIO/PIO dispatch file descriptors (ioregionfd) design discussion

2021-10-27 Thread John Levon
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

Re: [PATCH v3 06/12] vfio-user: run vfio-user context

2021-10-28 Thread John Levon
On Wed, Oct 27, 2021 at 05:21:30PM +0100, Stefan Hajnoczi wrote: > > +static void vfu_object_ctx_run(void *opaque) > > +{ > > +VfuObject *o = opaque; > > +int ret = -1; > > + > > +while (ret != 0) { > > +ret = vfu_run_ctx(o->vfu_ctx); > > +if (ret < 0) { > > +

Re: [PATCH v4 07/14] vfio-user: run vfio-user context

2022-01-10 Thread John Levon
On Thu, Jan 06, 2022 at 01:35:32PM +, Stefan Hajnoczi wrote: > > > >> +static void vfu_object_attach_ctx(void *opaque) > > > >> +{ > > > >> +VfuObject *o = opaque; > > > >> +GPollFD pfds[1]; > > > >> +int ret; > > > >> + > > > >> +qemu_set_fd_handler(o->vfu_poll_fd, NULL, NULL,

Re: [PATCH v3 4/4] hw/nvme: add polling support

2022-11-08 Thread John Levon
On Fri, Nov 04, 2022 at 07:32:12AM +0100, Klaus Jensen wrote: > On Nov 3 21:19, Jinhao Fan wrote: > > On 11/3/2022 8:10 PM, Klaus Jensen wrote: > > > I agree that the spec is a little unclear on this point. In any case, in > > > Linux, when the driver has decided that the sq tail must be updated,

Re: [PATCH 1/2] hw/nvme: Implement shadow doorbell buffer support

2022-06-09 Thread John Levon
On Thu, Jun 09, 2022 at 08:29:30AM -0600, Keith Busch wrote: > On Wed, Jun 08, 2022 at 10:55:30PM +0200, Klaus Jensen wrote: > > > > Keith, is this a bug in the kernel? If the code here would expect the > > doorbell buffer to be updated for the admin queue as well, would we > > break? > > The ad

Re: [PATCH 1/2] hw/nvme: Implement shadow doorbell buffer support

2022-06-09 Thread John Levon
On Thu, Jun 09, 2022 at 07:27:57PM +0200, Klaus Jensen wrote: > > It's not just unnecessary, but enabling shadow doorbells on admin queues > > will > > actively break device implementations (such as SPDK), which have had to > > presume > > that driver implementations don't use shadow doorbells f

Re: [PATCH 1/2] hw/nvme: Implement shadow doorbell buffer support

2022-06-15 Thread John Levon
On Wed, Jun 15, 2022 at 10:48:26AM +0200, Klaus Jensen wrote: > > By the way, I noticed that the patch never updates the cq's ei_addr value. > > Is > > that on purpose? > > Yeah, I also mentioned this previously[1] and I still think we need to > update the event index. Otherwise (and my testing

Re: [PATCH 1/2] hw/nvme: Implement shadow doorbell buffer support

2022-06-15 Thread John Levon
On Wed, Jun 15, 2022 at 11:33:02AM +0200, Klaus Jensen wrote: > > BTW I'm surprised that this patch has just this: > > > > +static void nvme_update_sq_eventidx(const NvmeSQueue *sq) > > +{ > > +pci_dma_write(&sq->ctrl->parent_obj, sq->ei_addr, &sq->tail, > > + sizeof(sq->tail

Re: [PATCH 1/2] hw/nvme: Implement shadow doorbell buffer support

2022-06-15 Thread John Levon
On Wed, Jun 15, 2022 at 07:22:22PM +0800, Jinhao Fan wrote: > >>> Isn't this racy against the driver? Compare > >>> https://github.com/spdk/spdk/blob/master/lib/nvmf/vfio_user.c#L1317 > >> > >> QEMU has full memory barriers on dma read/write, so I believe this is > >> safe? > > > > But don't you

Re: [PATCH v1 02/24] vfio-user: add VFIO base abstract class

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:24PM -0800, John Johnson wrote: > Add an abstract base class both the kernel driver > and user socket implementations can use to share code. LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 03/24] vfio-user: add container IO ops vector

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:25PM -0800, John Johnson wrote: > Used for communication with VFIO driver > (prep work for vfio-user, which will communicate over a socket) > index e573f5a..6fd40f1 100644 > --- a/include/hw/vfio/vfio-common.h > +++ b/include/hw/vfio/vfio-common.h > + > +extern VFIOC

Re: [PATCH v1 04/24] vfio-user: add region cache

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:26PM -0800, John Johnson wrote: > cache VFIO_DEVICE_GET_REGION_INFO results to reduce > memory alloc/free cycles and as prep work for vfio-user LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 05/24] vfio-user: add device IO ops vector

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:27PM -0800, John Johnson wrote: > Used for communication with VFIO driver > (prep work for vfio-user, which will communicate over a socket) > > @@ -1166,12 +1178,13 @@ uint32_t vfio_pci_read_config(PCIDevice *pdev, > uint32_t addr, int len) > if (~emu_bits & (0

Re: [PATCH v1 06/24] vfio-user: Define type vfio_user_pci_dev_info

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:28PM -0800, John Johnson wrote: > New class for vfio-user with its class and instance > constructors and destructors, and its pci ops. LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 07/24] vfio-user: connect vfio proxy to remote server

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:29PM -0800, John Johnson wrote: > add user.c & user.h files for vfio-user code > add proxy struct to handle comms with remote server LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 08/24] vfio-user: define socket receive functions

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:30PM -0800, John Johnson wrote: > Add infrastructure needed to receive incoming messages > > +static void vfio_user_process(VFIOProxy *proxy, VFIOUserMsg *msg, bool > isreply) > +{ > + > +/* > + * Replies signal a waiter, if none just check for errors > +

Re: [PATCH v1 09/24] vfio-user: define socket send functions

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:31PM -0800, John Johnson wrote: > Also negotiate protocol version with remote server LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 10/24] vfio-user: get device info

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:32PM -0800, John Johnson wrote: > +/* > + * VFIO_USER_DEVICE_GET_INFO > + * imported from struct_device_info > + */ > +typedef struct { > +VFIOUserHdr hdr; > +uint32_t argsz; > +uint32_t flags; > +uint32_t num_regions; > +uint32_t num_irqs; > +

Re: [PATCH v1 11/24] vfio-user: get region info

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:33PM -0800, John Johnson wrote: > Add per-region FD to support mmap() of remote device regions > > +/* > + * VFIO_USER_DEVICE_GET_REGION_INFO > + * imported from struct_vfio_region_info s/struct_vfio_region_info/struct vfio_region_info/ regards john

Re: [PATCH v1 12/24] vfio-user: region read/write

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:34PM -0800, John Johnson wrote: > Add support for posted writes on remote devices LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 13/24] vfio-user: pci_user_realize PCI setup

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:35PM -0800, John Johnson wrote: > PCI BARs read from remote device > PCI config reads/writes sent to remote server Reviewed-by: John Levon regards john

Re: [PATCH v1 14/24] vfio-user: get and set IRQs

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:36PM -0800, John Johnson wrote: > +static int vfio_user_io_get_irq_info(VFIODevice *vbasedev, > + struct vfio_irq_info *irq) > +{ > +int ret; > + > +ret = vfio_user_get_irq_info(vbasedev->proxy, irq); > +if (ret) { > +

Re: [PATCH v1 15/24] vfio-user: forward msix BAR accesses to server

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:37PM -0800, John Johnson wrote: > Server holds device current device pending state > Use irq masking commands in socket case As far as I'm able to tell, this looks good to me regards john

Re: [PATCH v1 16/24] vfio-user: proxy container connect/disconnect

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:38PM -0800, John Johnson wrote: > +/* > + * The proxy uses a SW IOMMU in lieu of the HW one > + * used in the ioctl() version. Mascarade as TYPE1 > + * for maximum capatibility > + */ capability > @@ -3692,12 +3698,18 @@ static void vfio_user_in

Re: [PATCH v1 18/24] vfio-user: add dma_unmap_all

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:40PM -0800, John Johnson wrote: > Signed-off-by: John G Johnson > Signed-off-by: Elena Ufimtseva > Signed-off-by: Jagannathan Raman > --- > +static int vfio_user_io_dirty_bitmap(VFIOContainer *container, > +struct vfio_iommu_type1_dirty_bit

Re: [PATCH v1 19/24] vfio-user: secure DMA support

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:41PM -0800, John Johnson wrote: > Secure DMA forces the remote process to use DMA r/w messages > instead of directly mapping guest memeory. I don't really get why this is called "secure" - shouldn't have an option name more closely resembling what it actually does?

Re: [PATCH v1 20/24] vfio-user: dma read/write operations

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:42PM -0800, John Johnson wrote: > static void vfio_user_pci_process_req(void *opaque, VFIOUserMsg *msg) > { > +VFIOPCIDevice *vdev = opaque; > +VFIOUserHdr *hdr = msg->hdr; > + > +/* no incoming PCI requests pass FDs */ > +if (msg->fds != NULL) { > +

Re: [PATCH v1 21/24] vfio-user: pci reset

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:43PM -0800, John Johnson wrote: > Message to tell the server to reset the device. LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 22/24] vfio-user: add 'x-msg-timeout' option that specifies msg wait times

2022-12-09 Thread John Levon
LGTM Reviewed-by: John Levon regards john

Re: [PATCH v1 23/24] vfio-user: add coalesced posted writes

2022-12-09 Thread John Levon
On Tue, Nov 08, 2022 at 03:13:45PM -0800, John Johnson wrote: > Add new message to send multiple writes to server LGTM - but maybe commit message could have some context as to why this is useful? Reviewed-by: John Levon regards john

Re: [PATCH v1 06/24] vfio-user: Define type vfio_user_pci_dev_info

2022-12-12 Thread John Levon
On Mon, Dec 12, 2022 at 10:01:33AM +0100, Cédric Le Goater wrote: > > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > > index 80b03a2..dc19869 100644 > > --- a/hw/vfio/pci.c > > +++ b/hw/vfio/pci.c > > @@ -19,6 +19,7 @@ > >*/ > > #include "qemu/osdep.h" > > +#include CONFIG_DEVICES > > #inclu

[RFC v6 00/26] vfio-user client

2024-05-29 Thread John Levon
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 lightly tested against libvfio-user test servers as well as SPDK. Contributors: John G Johnson John Levon Thanos Makatos Elena Ufimtseva

[PATCH 04/26] vfio: add vfio_attach_device_by_iommu_type()

2024-05-29 Thread John Levon
From: John Levon Allow attachment by explicitly passing a TYPE_VFIO_IOMMU_* string; vfio-user will use this later. Signed-off-by: John Levon --- hw/vfio/common.c | 25 ++--- include/hw/vfio/vfio-common.h | 3 +++ 2 files changed, 21 insertions(+), 7 deletions

[PATCH 13/26] vfio-user: define socket send functions

2024-05-29 Thread John Levon
From: Jagannathan Raman Also negotiate protocol version with remote server Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon --- hw/vfio/trace-events| 2 + hw/vfio/user-pci.c | 18 +- hw/vfio/user-protocol.h

[PATCH 03/26] vfio/container: support VFIO_DMA_UNMAP_FLAG_ALL

2024-05-29 Thread John Levon
From: John Levon Some containers can directly implement unmapping all regions; add a new flag to support this. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/common.c | 24

[PATCH 11/26] vfio-user: connect vfio proxy to remote server

2024-05-29 Thread John Levon
From: Jagannathan Raman add user.c & user.h files for vfio-user code add proxy struct to handle comms with remote server Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/meson.build | 2 +- hw/

[PATCH 12/26] vfio-user: define socket receive functions

2024-05-29 Thread John Levon
From: Jagannathan Raman Add infrastructure needed to receive incoming messages Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/trace-events| 5 + hw/vfio/user-pci.c | 11 ++ hw/vfio/user

[PATCH 15/26] vfio-user: get region info

2024-05-29 Thread John Levon
From: Jagannathan Raman Add per-region FD to support mmap() of remote device regions Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/ap.c | 2 ++ hw/vfio/ccw.c | 2 ++ hw

[PATCH 25/26] vfio-user: add 'x-msg-timeout' option that specifies msg wait times

2024-05-29 Thread John Levon
From: Jagannathan Raman Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/user-pci.c | 4 hw/vfio/user.c | 7 --- hw/vfio/user.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff

[PATCH 07/26] vfio: add VFIO base abstract class

2024-05-29 Thread John Levon
From: Jagannathan Raman Add an abstract base class both the kernel driver and user socket implementations can use to share code. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/pci.c | 108

[PATCH 14/26] vfio-user: get device info

2024-05-29 Thread John Levon
From: Jagannathan Raman Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/trace-events | 1 + hw/vfio/user-container.c | 10 +- hw/vfio/user-protocol.h | 12 hw/vfio/user.c

[PATCH 10/26] vfio-user: add vfio-user class and container

2024-05-29 Thread John Levon
: Jagannathan Raman Signed-off-by: John Levon --- MAINTAINERS | 1 + hw/vfio/container.c | 2 +- hw/vfio/meson.build | 5 + hw/vfio/pci.c | 12 +- hw/vfio/pci.h | 7 + hw/vfio/user

[PATCH 08/26] vfio: add device IO ops vector

2024-05-29 Thread John Levon
From: Jagannathan Raman Used for communication with VFIO driver (prep work for vfio-user, which will communicate over a socket) Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/ap.c | 2

[PATCH 26/26] vfio-user: add coalesced posted writes

2024-05-29 Thread John Levon
-off-by: John Levon --- hw/vfio/trace-events| 1 + hw/vfio/user-protocol.h | 21 +++ hw/vfio/user.c | 130 +++- hw/vfio/user.h | 7 +++ 4 files changed, 157 insertions(+), 2 deletions(-) diff --git a/hw/vfio/trace-events b/hw/vfio

[PATCH 18/26] vfio-user: get and set IRQs

2024-05-29 Thread John Levon
From: Jagannathan Raman Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/pci.c | 3 +- hw/vfio/trace-events| 2 + hw/vfio/user-protocol.h | 25 +++ hw/vfio/user.c | 140

[PATCH 17/26] vfio-user: pci_user_realize PCI setup

2024-05-29 Thread John Levon
From: Jagannathan Raman PCI BARs read from remote device PCI config reads/writes sent to remote server Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/pci.c | 249

[PATCH 09/26] vfio-user: introduce vfio-user protocol specification

2024-05-29 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|4 +- docs/devel/index-internals.rst |1 + docs/devel/vfio-user.rst

[PATCH 19/26] vfio-user: forward msix BAR accesses to server

2024-05-29 Thread John Levon
From: Jagannathan Raman Server holds device current device pending state Use irq masking commands in socket case Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/helpers.c | 26 +++ hw/vfio

[PATCH 24/26] vfio-user: pci reset

2024-05-29 Thread John Levon
From: Jagannathan Raman Message to tell the server to reset the 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 | 15 +++ hw/vfio/user.c | 12 hw/vfio/user.h

[PATCH 23/26] vfio-user: dma read/write operations

2024-05-29 Thread John Levon
From: Jagannathan Raman Messages from server to client that perform device DMA. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/user-pci.c | 110 hw/vfio/user

[PATCH 01/26] vfio/container: pass MemoryRegion to DMA operations

2024-05-29 Thread John Levon
From: Jagannathan Raman Pass through the MemoryRegion to DMA operation handlers of vfio containers. The vfio-user container will need this later. Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon --- hw/vfio/common.c

[PATCH 02/26] vfio/container: pass listener_begin/commit callbacks

2024-05-29 Thread John Levon
The vfio-user container will later need to hook into these callbacks; set up vfio to use them, and optionally pass them through to the container. Signed-off-by: John Levon --- hw/vfio/common.c | 22 ++ include/hw/vfio/vfio-container-base.h | 2 ++ 2

[PATCH 22/26] vfio-user: no-mmap DMA support

2024-05-29 Thread John Levon
From: Jagannathan Raman Force remote process to use DMA r/w messages instead of directly mapping guest memory. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/user-container.c | 2 +- hw/vfio/user-pci.c

[PATCH 16/26] vfio-user: region read/write

2024-05-29 Thread John Levon
From: Jagannathan Raman Add support for posted writes on remote devices Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/helpers.c | 20 -- hw/vfio/pci.c | 5 +- hw/vfio

[PATCH 21/26] vfio-user: dma map/unmap operations

2024-05-29 Thread John Levon
Implement DMA map/unmap for the vfio-user container. Add ability to do async operations during memory transactions. Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon --- hw/vfio/trace-events | 4 ++ hw/vfio/user

[PATCH 06/26] vfio: add region cache

2024-05-29 Thread John Levon
From: Jagannathan Raman cache VFIO_DEVICE_GET_REGION_INFO results to reduce memory alloc/free cycles and as prep work for vfio-user Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/ccw.c | 5

[PATCH 20/26] vfio-user: proxy container connect/disconnect

2024-05-29 Thread John Levon
From: Jagannathan Raman Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/container.c | 4 ++- hw/vfio/user-container.c | 52 --- hw/vfio/user-protocol.h

[PATCH 05/26] vfio: add vfio_prepare_device()

2024-05-29 Thread John Levon
From: John Levon Commonize some initialization code shared by the legacy and iommufd vfio implementations (and later by vfio-user). Signed-off-by: John Levon --- hw/vfio/common.c | 19 +++ hw/vfio/container.c | 14 +- hw/vfio/iommufd.c

Re: [RFC v4 01/21] vfio-user: introduce vfio-user protocol specification

2022-03-10 Thread John Levon
On Wed, Mar 09, 2022 at 03:34:53PM -0700, Alex Williamson wrote: > > +The only device-specific region type and subtype supported by vfio-user is > > +``VFIO_REGION_TYPE_MIGRATION`` (3) and ``VFIO_REGION_SUBTYPE_MIGRATION`` > > (1). > > These should be considered deprecated from the kernel interf

Deadlock with SATA CD I/O and eject

2023-09-18 Thread John Levon
Observed with base of qemu 6.2.0, but from code inspection it looks to me like it's still current in upstream master. Apologies if I have missed a fix in this area. Symptom: run a UEFI-booted SATA CD Windows installer. When it hits "Loading files.." screen, run an eject e.g. virsh qemu-monitor-

Re: Deadlock with SATA CD I/O and eject

2023-09-19 Thread John Levon
On Tue, Sep 19, 2023 at 12:54:59PM +0200, Kevin Wolf wrote: > > In the meantime, we start processing the blk_drain() code, so by the time > > this > > blk_pread() actually gets handled, quiesce is set, and we get stuck in the > > blk_wait_while_drained(). > > > > I don't know the qemu block stac

Re: [RFC PATCH v2 1/1] vfio-user: add live migration to vfio-user protocol specification

2023-08-23 Thread John Levon
On Wed, Aug 23, 2023 at 10:04:00AM +, William Henderson wrote: > +* *argsz* is the size of the above structure. As we discussed offline, this isn't right for any of these. They have the same ->argsz semantics as discussed here: https://github.com/nutanix/libvfio-user/blob/master/docs/vfio-us

Re: [PATCH v4 08/14] vfio-user: handle PCI config space accesses

2021-12-16 Thread John Levon
On Thu, Dec 16, 2021 at 11:30:20AM +, Stefan Hajnoczi wrote: > > +ret = vfu_setup_region(o->vfu_ctx, VFU_PCI_DEV_CFG_REGION_IDX, > > + pci_config_size(o->pci_dev), > > &vfu_object_cfg_access, > > + VFU_REGION_FLAG_RW | VFU_REGION_FLAG_AL

Re: [PATCH v8] introduce vfio-user protocol specification

2021-05-05 Thread John Levon
On Tue, May 04, 2021 at 02:51:45PM +0100, Stefan Hajnoczi wrote: > > +While passing of file descriptors is desirable for performance reasons, it > > is > > +not necessary neither for the client nor for the server to support it in > > order > > Double negative. "not" can be removed. Done. I als

Re: [PATCH v8] introduce vfio-user protocol specification

2021-05-10 Thread John Levon
On Mon, May 10, 2021 at 05:57:37PM +0100, Stefan Hajnoczi wrote: > On Wed, Apr 14, 2021 at 04:41:22AM -0700, Thanos Makatos wrote: > > Elena A: I CCed you in case you want to review the Sorry, we should have included Elena already. > > +VFIO sparse mmap > > + > > + > > ++---

Re: [PATCH v8] introduce vfio-user protocol specification

2021-05-11 Thread John Levon
On Tue, May 11, 2021 at 11:09:53AM +0100, Stefan Hajnoczi wrote: > > > > +* *sub-regions* is the array of Sub-Region IO FD info structures > > > > + > > > > +The reply message will additionally include at least one file > > > > descriptor in the > > > > +ancillary data. Note that more than one su

Re: [PATCH v1] target/i386: Always set leaf 0x1f

2024-07-24 Thread John Levon
On Wed, Jul 24, 2024 at 03:59:29PM +0530, Manish wrote: > > > Leaf 0x1f is superset of 0xb, so it makes sense to set 0x1f equivalent > > > to 0xb by default and workaround windows issue.> > > > This change adds a > > > new property 'cpuid-0x1f-enforce' to set leaf 0x1f equivalent to 0xb in > > > c

Re: [PATCH v1] target/i386: Always set leaf 0x1f

2024-07-31 Thread John Levon
On Wed, Jul 31, 2024 at 03:02:15PM +0800, Xiaoyao Li wrote: > > Windows does not expect 0x1f to be present for any CPU model. But if it > > is exposed to the guest, it expects non-zero values. > > Please fix Windows! A ticket has been filed with MSFT, we are aware this is a guest bug. But that

Re: [PATCH v8] introduce vfio-user protocol specification

2021-05-19 Thread John Levon
On Wed, May 19, 2021 at 03:08:17PM -0600, Alex Williamson wrote: > > +VFIO_USER_DMA_MAP > > +- > > + > > +Message Format > > +^^ > > + > > ++--++ > > +| Name | Value | > > ++==+

Re: [PATCH v8] introduce vfio-user protocol specification

2021-05-04 Thread John Levon
On Tue, May 04, 2021 at 02:51:45PM +0100, Stefan Hajnoczi wrote: > On Wed, Apr 14, 2021 at 04:41:22AM -0700, Thanos Makatos wrote: > > This patch introduces the vfio-user protocol specification (formerly > > known as VFIO-over-socket), which is designed to allow devices to be Thanks for your revi

[DRAFT RFC] ioeventfd/ioregionfd support in vfio-user

2021-01-21 Thread John Levon
Hi, please take a look. For context, this addition is against the current https://github.com/nutanix/libvfio-user/blob/master/docs/vfio-user.rst specification. kvm@ readers: Stefan suggested this may be of interest from a VFIO point of view, in case there is any potential cross-over in defining

Re: [DRAFT RFC] ioeventfd/ioregionfd support in vfio-user

2021-01-28 Thread John Levon
On Tue, Jan 26, 2021 at 11:01:04AM +, Stefan Hajnoczi wrote: > > 4) (ioregionfd issue) region_id is 4 bytes, which seems a little awkward > > from > > the server side: this has to encode both the region ID as well as the > > offset of > > the sub-region within that region. Can this be 64 bit

[PATCH] virtio: reset device on bad guest index in virtio_load()

2020-11-20 Thread John Levon
n and successfully restore the device to a working state. Other implementations do not correctly handle this, but as the VQ is not in a functional state anyway, this is still worth doing. Signed-off-by: John Levon --- hw/virtio/virtio.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-)

[PATCH] virtio: reset device on bad guest index in virtio_load()

2020-11-20 Thread John Levon
n and successfully restore the device to a working state. Other implementations do not correctly handle this, but as the VQ is not in a functional state anyway, this is still worth doing. Signed-off-by: John Levon --- hw/virtio/virtio.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-)

Re: [PATCH] virtio: reset device on bad guest index in virtio_load()

2020-11-30 Thread John Levon
On Fri, Nov 20, 2020 at 06:51:07PM +, John Levon wrote: > If we find a queue with an inconsistent guest index value, explicitly mark the > device as needing a reset - and broken - via virtio_error(). > > There's at least one driver implementation - the virtio-win NetKVM driv

Re: [PATCH RFC server 01/11] vfio-user: build library

2021-07-19 Thread John Levon
On Mon, Jul 19, 2021 at 04:00:03PM -0400, Jagannathan Raman wrote: > add the libvfio-user library as a submodule. build it as part of QEMU > > diff --git a/meson.build b/meson.build > index 6e4d2d8..f2f9f86 100644 > --- a/meson.build > +++ b/meson.build > @@ -1894,6 +1894,41 @@ if get_option('cfi

Re: [PATCH RFC server 01/11] vfio-user: build library

2021-07-20 Thread John Levon
On Tue, Jul 20, 2021 at 04:20:13PM +0400, Marc-André Lureau wrote: > > >> + libvfiouser = static_library('vfiouser', > > >> + build_by_default: false, > > >> + sources: vfiouser_files, > > >> + dependencies:

Re: [PATCH RFC server 04/11] vfio-user: find and init PCI device

2021-07-26 Thread John Levon
On Mon, Jul 19, 2021 at 04:00:06PM -0400, Jagannathan Raman wrote: > +vfu_pci_set_id(o->vfu_ctx, > + pci_get_word(o->pci_dev->config + PCI_VENDOR_ID), > + pci_get_word(o->pci_dev->config + PCI_DEVICE_ID), > + pci_get_word(o->pci_dev->config

Re: [PATCH RFC server 06/11] vfio-user: handle PCI config space accesses

2021-07-26 Thread John Levon
On Mon, Jul 19, 2021 at 04:00:08PM -0400, Jagannathan Raman wrote: > Define and register handlers for PCI config space accesses > > Signed-off-by: Elena Ufimtseva > Signed-off-by: John G Johnson > Signed-off-by: Jagannathan Raman > --- > hw/remote/vfio-user-obj.c | 41

Re: [PATCH RFC server 05/11] vfio-user: run vfio-user context

2021-08-16 Thread John Levon
On Fri, Aug 13, 2021 at 02:51:53PM +, Jag Raman wrote: > Thanks for the information about the Blocking and Non-Blocking mode. > > I’d like to explain why we are using a separate thread presently and > check with you if it’s possible to poll on multiple vfu contexts at the > same time (similar

Re: [PATCH RFC v2 09/16] vfio-user: region read/write

2021-09-07 Thread John Levon
On Mon, Aug 16, 2021 at 09:42:42AM -0700, Elena Ufimtseva wrote: > +int vfio_user_region_write(VFIODevice *vbasedev, uint32_t index, > + uint64_t offset, uint32_t count, void *data) > +{ > +g_autofree VFIOUserRegionRW *msgp = NULL; > +int size = sizeof(*msgp) + co

Re: [PATCH RFC v2 14/16] vfio-user: dma read/write operations

2021-09-08 Thread John Levon
On Wed, Sep 08, 2021 at 10:51:11AM +0100, Stefan Hajnoczi wrote: > > + > > +buf = g_malloc0(size); > > +memcpy(buf, msg, sizeof(*msg)); > > + > > +pci_dma_read(pdev, msg->offset, buf + sizeof(*msg), msg->count); > > The vfio-user spec doesn't go into errors but pci_dma_read() can retu

Re: [PATCH RFC server v2 05/11] vfio-user: run vfio-user context

2021-09-08 Thread John Levon
On Wed, Sep 08, 2021 at 01:58:46PM +0100, Stefan Hajnoczi wrote: > > +static void *vfu_object_attach_ctx(void *opaque) > > +{ > > +VfuObject *o = opaque; > > +int ret; > > + > > +retry_attach: > > +ret = vfu_attach_ctx(o->vfu_ctx); > > +if (ret < 0 && (errno == EAGAIN || errno == E

Re: [PATCH RFC server v2 05/11] vfio-user: run vfio-user context

2021-09-08 Thread John Levon
On Wed, Sep 08, 2021 at 04:02:22PM +0100, Stefan Hajnoczi wrote: > > We'd have to have a whole separate API to do that, so a separate thread > > seems a > > better approach? > > Whether to support non-blocking properly in libvfio-user is a decision > for you. If libvfio-user doesn't support non-

Re: [PATCH RFC v2 09/16] vfio-user: region read/write

2021-09-09 Thread John Levon
On Thu, Sep 09, 2021 at 06:00:36AM +, John Johnson wrote: > > On Sep 7, 2021, at 10:24 AM, John Levon wrote: > > > > On Mon, Aug 16, 2021 at 09:42:42AM -0700, Elena Ufimtseva wrote: > > > >> +int vfio_user_region_write(VFI

Re: [PATCH RFC v2 09/16] vfio-user: region read/write

2021-09-10 Thread John Levon
On Fri, Sep 10, 2021 at 06:07:56AM +, John Johnson wrote: > >>> On Mon, Aug 16, 2021 at 09:42:42AM -0700, Elena Ufimtseva wrote: > >>> > +int vfio_user_region_write(VFIODevice *vbasedev, uint32_t index, > + uint64_t offset, uint32_t count, void *data) > >>>

Re: [PATCH RFC server v2 01/11] vfio-user: build library

2021-09-11 Thread John Levon
On Fri, Sep 10, 2021 at 05:20:09PM +0200, Philippe Mathieu-Daudé wrote: > On 8/27/21 7:53 PM, Jagannathan Raman wrote: > > add the libvfio-user library as a submodule. build it as a cmake > > subproject. > > > > Signed-off-by: Elena Ufimtseva > > Signed-off-by: John G Johnson > > Signed-off-by:

Re: [PATCH v5] introduce vfio-user protocol specification

2020-10-30 Thread John Levon
On Wed, Oct 28, 2020 at 04:41:31PM +, Thanos Makatos wrote: > FYI here's v5 of the vfio-user protocol, my --cc in git send-email got messed > up somehow Hi Thanos, this looks great, I just had some minor questions below. > Command Concurrency > --- > A client may pipeline mu

Re: [PATCH v5] introduce vfio-user protocol specification

2020-11-02 Thread John Levon
On Mon, Nov 02, 2020 at 11:29:23AM +, Thanos Makatos wrote: > > +==++= > > ==+ > > > | version | object | ``{"major": , "minor": }`` > > > | > > > | ||

Re: [PATCH v5] introduce vfio-user protocol specification

2020-11-07 Thread John Levon
On Thu, Nov 05, 2020 at 05:50:27PM -0800, John G Johnson wrote: > The idea behind the version IDs is to identify incompatible protocol > changes as major versions, and compatible changes as minor versions. What > would be the purpose of the third version type? Well, like any patch version,

Re: Use of BQL from thread in PCIe device

2024-12-18 Thread John Levon
On Wed, Dec 18, 2024 at 04:19:47PM +, Markus Lavin wrote: > Hi, > > I think that I might have misunderstood something fundamental about the BQL > (or possibly Qemu in general). > > I have a custom PCIe device that connects to an outside simulation environment > using Unix domain sockets. To

[PATCH 21/26] vfio-user: dma map/unmap operations

2025-01-08 Thread John Levon
From: John Levon Implement DMA map/unmap for the vfio-user container. Add ability to do async operations during memory transactions. Originally-by: John Johnson Signed-off-by: Jagannathan Raman Signed-off-by: Elena Ufimtseva Signed-off-by: John Levon --- hw/vfio/trace-events | 4

Re: [v7 00/26] vfio-user client

2025-01-23 Thread John Levon
On Wed, Jan 08, 2025 at 11:50:06AM +, John Levon wrote: > Hi, this is the 7th revision of the vfio-user client implementation. > > First of all, thank you for your time reviewing the previous versions. > > The vfio-user framework consists of 3 parts: > 1) The

Re: [v7 00/26] vfio-user client

2025-01-23 Thread John Levon
On Thu, Jan 23, 2025 at 02:50:16PM +0100, Cédric Le Goater wrote: > > > Hi, this is the 7th revision of the vfio-user client implementation. > > Well, among the reasons why we tend to push this at end of > the list are : Thanks for the steers. Just a note in case you're not aware - most of these

[PATCH 09/26] vfio-user: introduce vfio-user protocol specification

2025-01-08 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|8 +- docs/devel/index-internals.rst |1 + docs/devel/vfio-user.rst

[PATCH 03/26] vfio/container: support VFIO_DMA_UNMAP_FLAG_ALL

2025-01-08 Thread John Levon
Some containers can directly implement unmapping all regions; add a new flag to support this. Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/common.c | 24 +++-- hw/vfio

[PATCH 19/26] vfio-user: forward msix BAR accesses to server

2025-01-08 Thread John Levon
From: Jagannathan Raman Server holds device current device pending state Use irq masking commands in socket case Originally-by: John Johnson Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John Levon --- hw/vfio/helpers.c | 26 +++ hw/vfio

  1   2   >