BACKPORT: FROMLIST: drivers/iommu: Add deferred map_sg operations
With pKVM SMMUv3 driver which para-virtualizes the IOMMU in the hypervisor, has an extra overhead with map_sg, as it loops over iommu_map, and for each map requires context switching, disabling interrupts... Instead, add an new domain operations: - alloc_cookie_sg: Allocate a new sg deferred cookie - add_deferred_map_sg: Add a mapping to the cookie - consume_deferred_map_sg: Consume and release the cookie Alternativly, we can pass the sg list as is. However, this would duplicate some of the logic and it would make more sense to conolidate all the sg list parsing for IOMMU drivers in one place. virtio-iommu is another IOMMU that can benfit from this, but it would need to have a new operation that standerdize passing an sglist based on these ops. Link: https://lore.kernel.org/all/20241212180423.1578358-56-smostafa@google.com/ [@smostafa Fix error path so mappings are cleaned in case of errors at consume operation] Bug: 357781595 Bug: 384432312 Change-Id: I174e5064922adcfbe0e3505c65e47ba4a28336f4 Signed-off-by:Mostafa Saleh <smostafa@google.com>
Loading
Please sign in to comment