iommu/virtio: Support identity-mapped domains
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Wed, 1 Dec 2021 17:33:25 +0000 (17:33 +0000)
committerJoerg Roedel <jroedel@suse.de>
Mon, 6 Dec 2021 14:03:05 +0000 (15:03 +0100)
commitb03cbca48d6408cea866057654675dd63a1bdcd3
tree52ab329a74551c4587ff3f9f2cbfbcbf94614ba0
parentc0c763598960153e10622ff0a802012a073174a0
iommu/virtio: Support identity-mapped domains

Support identity domains for devices that do not offer the
VIRTIO_IOMMU_F_BYPASS_CONFIG feature, by creating 1:1 mappings between
the virtual and physical address space. Identity domains created this
way still perform noticeably better than DMA domains, because they don't
have the overhead of setting up and tearing down mappings at runtime.
The performance difference between this and bypass is minimal in
comparison.

It does not matter that the physical addresses in the identity mappings
do not all correspond to memory. By enabling passthrough we are trusting
the device driver and the device itself to only perform DMA to suitable
locations. In some cases it may even be desirable to perform DMA to MMIO
regions.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Link: https://lore.kernel.org/r/20211201173323.1045819-6-jean-philippe@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/virtio-iommu.c