Commit 1a608d2b authored by Mostafa Saleh's avatar Mostafa Saleh
Browse files

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: default avatarMostafa Saleh <smostafa@google.com>
parent 2bee4c22
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment