iommu_gas_map_region(): add comment explaining the ma array shift

(cherry picked from commit 45f70f98fc55b753b1e7a7374b4a061aa1f27392)
This commit is contained in:
Konstantin Belousov 2025-01-25 11:37:50 +02:00
parent f034ddd2fa
commit b01d15abba

View file

@ -875,6 +875,11 @@ iommu_gas_map_region(struct iommu_domain *domain, struct iommu_map_entry *entry,
if (entry->end == entry->start)
return (0);
/*
* iommu_gas_alloc_region() might clipped the entry start and
* end positions. Adjust the beginning of the ma array to map
* the pages at the requested relative positions.
*/
error = domain->ops->map(domain, entry,
ma + OFF_TO_IDX(start - entry->start), eflags,
((flags & IOMMU_MF_CANWAIT) != 0 ? IOMMU_PGF_WAITOK : 0));