Re: [RFC: DMA_PMD 01/22] iommu/dma: introduce CONFIG_DMA_PMD and metadata table

From: Randy Dunlap

Date: Sat Oct 03 2026 - 17:45:05 EST




On 10/3/26 2:22 PM, Luigi Rizzo wrote:
> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> index 6e07bd69467a3..1bb347fd9da4a 100644
> --- a/drivers/iommu/Kconfig
> +++ b/drivers/iommu/Kconfig
> @@ -158,6 +158,38 @@ config IOMMU_DMA
> select NEED_SG_DMA_LENGTH
> select NEED_SG_DMA_FLAGS if SWIOTLB
>
> +# PMD_SIZE IOMMU backing for DMA-coherent devices
> +config DMA_PMD
> + bool "PMD_SIZE IOMMU backing for DMA-coherent devices"
> + depends on IOMMU_DMA
> + depends on X86_64 || (ARM64 && ARM64_4K_PAGES)
> + depends on !PREEMPT_RT
> + default y
> + help
> + Hand out DMA buffers carved out of PMD_SIZE physically contiguous
> + blocks that the IOMMU maps with a single leaf PTE. Mapping,
> + unmapping and IOTLB flushing are done lazily to reduce CPU overhead.
> + The large mappings greatly reduce IOTLB usage. As in strict iommu
> + mode, pages are returned to the buddy allocator only when any existing
> + mappings have been removed and IOTLB flushed.
> + Costs 128KB of metadata per GB of DMA_PMD buffers, allocated on demand.

Paragraph 1 of the patch description says 64KB per 1GB, not 128KB.
Or am I mixing things up?

--
~Randy