Sample Header Ad - 728x90

How to disable/enable bounce-buffers in IOMMU?

4 votes
1 answer
1103 views
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
Asked by sammy17 (115 rep)
Jun 2, 2023, 07:22 PM
Last activity: Jun 15, 2023, 07:07 AM