[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cdd979bca2b8cc4ff170442d968b63f2b3f0ccd6.camel@infradead.org>
Date: Thu, 03 Apr 2025 09:10:41 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: "Michael S. Tsirkin" <mst@...hat.com>, virtio-comment@...ts.linux.dev,
Claire Chang <tientzu@...omium.org>, linux-devicetree
<devicetree@...r.kernel.org>, Rob Herring <robh+dt@...nel.org>,
Jörg Roedel <joro@...tes.org>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
graf@...zon.de
Subject: Re: [RFC PATCH 1/3] content: Add VIRTIO_F_SWIOTLB to negotiate use
of SWIOTLB bounce buffers
On Thu, 2025-04-03 at 00:39 -0700, Christoph Hellwig wrote:
> On Thu, Apr 03, 2025 at 08:37:20AM +0100, David Woodhouse wrote:
> > Hm. I was just trying to point out what seemed obvious, that when a PCI
> > device does 'DMA' to an address region which is actually within one of
> > its *own* BARs,
>
> PCIe devices can't do DMA to their own BARs by definition, see the route
> to self rule.
>
> Pretending that they do it by parsing the addresses is bound to fail
> because the addresses seen by the driver and the device can be
> different.
>
> NVMe got this wrong not just once but twice and is still suffering from
> this misunderstanding. If you want to enhance a protocol to support
> addressing a local indirection buffer do not treat it as fake DMA
> but rather use explicit addressing for it, or you will be in a world of
> trouble.
This is, of course, the other benefit of pointing out the "obvious".
Because you can get corrected when you've got it wrong :)
Thanks. I'll take a closer look at handling that. I think it's
reasonable for the negotiation of the VIRTIO_F_SWIOTLB feature to be
the thing that switches *all* addresses to be on-device, and the on-
device buffer can't be accessed unless VIRTIO_F_SWIOTLB has been
negotiated.
Which neatly sidesteps the original thing I was trying to clarify
anyway.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)
Powered by blists - more mailing lists