Re: [PATCH v4 2/2] dma: add IOMMU static calls with clear default ops
From: Robin Murphy
Date: Tue Aug 27 2024 - 07:58:30 EST
On 20/08/2024 1:22 pm, Christoph Hellwig wrote:
On Mon, Aug 19, 2024 at 02:16:56PM +0100, Robin Murphy wrote:
Thanks, I've just had a quick look over what you queued on
dma-iommu-direct-calls, and you're welcome to stick my ack on that if you
like.
Yes, thank you a lot for your review!
While I have your attention - with these two patches we stop building
dummy_dma_ops for most common configs. Do you think we need additional
safeguards for this case? My idea would be to remove them and force the
bus_dma_mask to zero where we currently set the dummy ops, but I could
use a little reality check for that idea.
Yeah, the dummy ops were a nice idea at the time, but have been looking
increasingly anachronistic for a while - in fact I think they're
effectively broken already now, since if arm64 stops selecting DMA_OPS
via IOMMU_DMA then the set_dma_ops() in the ACPI path isn't going to be
effective anyway.
I certainly don't hate the idea of using bus_dma_limit as the next most
functionally robust way to deny DMA for now. It would probably be a bit
awkward to upheave the existing notion of 0 meaning no limit, but
setting it to 1 would have the desired effect in practice (at least with
dma-direct), plus would look nicely deliberate - for completeness we'd
probably just want an extra check or two in the right place(s) to ensure
that such a DMA-denied device still can't end up being given ops other
than dma-direct, but that seems simple enough.
Thanks,
Robin.