Date: Tue, 1 Apr 2025 22:56:31 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 45f70f98fc55 - main - iommu_gas_map_region(): add comment explaining the ma array shift Message-ID: <202504012256.531MuVEn029564@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504012256.531MuVEn029564>