[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 17/23] vfio-user: dma map/unmap operations
From: |
Alex Williamson |
Subject: |
Re: [PATCH v2 17/23] vfio-user: dma map/unmap operations |
Date: |
Mon, 6 Feb 2023 13:58:35 -0700 |
On Wed, 1 Feb 2023 21:55:53 -0800
John Johnson <john.g.johnson@oracle.com> wrote:
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index 6f99907..f04fd20 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -889,6 +894,29 @@ static bool
> vfio_known_safe_misalignment(MemoryRegionSection *section)
> return true;
> }
>
> +static void vfio_listener_begin(MemoryListener *listener)
> +{
> + VFIOContainer *container = container_of(listener, VFIOContainer,
> listener);
> +
> + /*
> + * When DMA space is the physical address space,
> + * the region add/del listeners will fire during
> + * memory update transactions. These depend on BQL
> + * being held, so do any resulting map/demap ops async
> + * while keeping BQL.
> + */
> + container->async_ops = true;
> +}
> +
> +static void vfio_listener_commit(MemoryListener *listener)
> +{
> + VFIOContainer *container = container_of(listener, VFIOContainer,
> listener);
> +
> + /* wait here for any async requests sent during the transaction */
> + container->io->wait_commit(container);
> + container->async_ops = false;
> +}
Since this ends up being entirely vfio-user related, what about
embedding a user struct in VFIOContainer and make optional
listener_begin and listener_commit callbacks in VFIOContainerIO, ie.
if (container->io->listener_commit) {
container->io->listener_commit(container);
}
Thanks,
Alex
- [PATCH v2 09/23] vfio-user: define socket send functions, (continued)
[PATCH v2 17/23] vfio-user: dma map/unmap operations, John Johnson, 2023/02/02
[PATCH v2 21/23] vfio-user: pci reset, John Johnson, 2023/02/02
[PATCH v2 22/23] vfio-user: add 'x-msg-timeout' option that specifies msg wait times, John Johnson, 2023/02/02
[PATCH v2 12/23] vfio-user: region read/write, John Johnson, 2023/02/02
[PATCH v2 14/23] vfio-user: get and set IRQs, John Johnson, 2023/02/02
[PATCH v2 18/23] vfio-user: add dma_unmap_all, John Johnson, 2023/02/02