qemu-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]