Re: [RFC PATCH 1/3] content: Add VIRTIO_F_SWIOTLB to negotiate use of SWIOTLB bounce buffers
From: David Woodhouse
Date: Fri Apr 04 2025 - 04:16:58 EST
On Fri, 2025-04-04 at 04:09 -0400, Michael S. Tsirkin wrote:
> On Fri, Apr 04, 2025 at 08:50:47AM +0100, David Woodhouse wrote:
> > What's annoying is that this should work out of the box *already* with
> > virtio-mmio and a `restricted-dma-pool` — for systems which aren't
> > afflicted by UEFI/ACPI/PCI as their discovery mechanisms.
>
>
> That specifically would be just a driver bugfix then?
I actually think it works out of the box and there isn't even a bug to
fix. Haven't tested yet.
The sad part is that the system does it all automatically *if* it has
CONFIG_DMA_RESTRICTED_POOL (e.g. Linux) and the driver never even
notices that the dma_ops it's using are the swiotlb ops using the
provided buffer.
Which is *kind* of nice... except that when on a guest OS which *isn't*
Linux with CONFIG_DMA_RESTRICTED_POOL, the guest will just ignore the
`restricted-dma-pool` node and try DMA to system memory anyway, which
will fail.
That's why my proposal adds the negotiated VIRTIO_F_SWIOTLB feature, so
that the device side can refuse, if the guest *isn't* agreeing to use
the bounce buffer in the situations where it must do so.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature