git: 45f70f98fc55 - main - iommu_gas_map_region(): add comment explaining the ma array shift
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Apr 2025 22:56:31 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=45f70f98fc55b753b1e7a7374b4a061aa1f27392 commit 45f70f98fc55b753b1e7a7374b4a061aa1f27392 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-01-25 09:37:50 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-04-01 22:23:17 +0000 iommu_gas_map_region(): add comment explaining the ma array shift and the difference between start and entry->start values at this point. Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/dev/iommu/iommu_gas.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index d97bdee47b28..ffa8dc096adc 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -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));