Re: [RFC PATCH] dma-iommu: Add iommu_dma_max_mapping_size()

From: Robin Murphy
Date: Wed May 18 2022 - 09:45:21 EST


On 2022-05-18 14:12, Christoph Hellwig wrote:
On Tue, May 17, 2022 at 11:40:52AM +0100, Robin Murphy wrote:
Indeed, sorry but NAK for this being nonsense. As I've said at least once
before, if the unnecessary SAC address allocation attempt slows down your
workload, make it not do that in the first place. If you don't like the
existing command-line parameter then fine, there are plenty of other
options, it just needs to be done in a way that doesn't break x86 systems
with dodgy firmware, as my first attempt turned out to.

What broke x86?

See the thread at [1] (and in case of curiosity the other IVRS patches I refer to therein were at [2]). Basically, undescribed limitations lead to DMA address truncation once iommu-dma starts allocating from what it thinks is the full usable IOVA range. Your typical desktop PC is unlikely to have enough concurrent DMA-mapped memory to overflow the 32-bit IOVA space naturally, so this has probably been hiding an untold multitude of sins over the years.

Robin.

[1] https://lore.kernel.org/linux-iommu/e583fc6dd1fb4ffc90310ff4372ee776f9cc7a3c.1594207679.git.robin.murphy@xxxxxxx/
[2] https://lore.kernel.org/linux-iommu/20200605145655.13639-1-sebott@xxxxxxxxx/