3

I am trying to figure out how to disable bounce buffers used in IOMMU when the hardware IOMMU is used.

To give more context, when IOMMU_DEFAULT_DMA_STRICT is set in the kernel it enables strict IOTLB invalidations on page unmap. Also, it uses an "additional layer of bounce-buffering".

Reference:

config IOMMU_DEFAULT_DMA_STRICT
    bool "Translated - Strict"
    help
      Trusted devices use translation to restrict their access to only
      DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
      to passing "iommu.passthrough=0 iommu.strict=1" on the command line.

      Untrusted devices always use this mode, with an additional layer of
      bounce-buffering such that they cannot gain access to any unrelated
      data within a mapped page.

According to the description, this feature enables both strict IOTLB invalidations and bounce-buffer for untrusted PCI devices. My current understanding is this config option still uses hardware IOMMU and bounce-buffers together (please correct me if I am wrong).

I want a way to enable/disable only the bounce buffers in IOMMU to find the performance overhead involved.

In other words, I want to find the overhead of this "additional layer".

Please let me know if there is a way to enable/disable only the SW bounce buffers when hardware IOMMU is used.

What I tried so far:

I noticed there are kernel command line options such as iommu=soft and swiotlb={force | noforce}.

iommu=soft seems to be a replacement for the hardware IOMMU using software bounce-buffering (reference https://www.kernel.org/doc/Documentation/x86/x86_64/boot-options.txt) which is not what I want.

I want to enable/disable bounce-buffering when it's used as an "additional layer" for the hardware IOMMU.

swiotlb=force seems to be what I want as it forces all the IO operations through SW bounce buffers. However, it does not specify whether hardware IOMMU is still used or not.

It would be great if someone can confirm this.

If this is the case, to enable hardware IOMMU without SW bounce buffers I will use below kernel cmdline parameters:

intel_iommu=on iommu=force

To enable SW bounce buffers with HW IOMMU:

intel_iommu=on iommu=force swiotlb=force

1 Answer 1

1

I asked the kernel developers the same question and am posting the answer here if anyone else has the same question (relevant kernel mail thread).

There is no kernel boot option or config option to enable or disable IOMMU SW bounce buffers. SW bounce buffers are internally enabled for any untrusted PCI device. Linux kernel considers devices/interfaces with external-facing ports as untrusted (more accurate details can be found in kernel patches and kernel src itself, e.g. - https://patchwork.kernel.org/project/linux-pci/patch/[email protected]/).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .