Skip to content

Commit 3b6bb5b

Browse files
geertujoergroedel
authored andcommitted
iommu/ipmmu-vmsa: Restrict IOMMU Domain Geometry to 32-bit address space
Currently, the IPMMU/VMSA driver supports 32-bit I/O Virtual Addresses only, and thus sets io_pgtable_cfg.ias = 32. However, it doesn't force a 32-bit IOVA space through the IOMMU Domain Geometry. Hence if a device (e.g. SYS-DMAC) rightfully configures a 40-bit DMA mask, it will still be handed out a 40-bit IOVA, outside the 32-bit IOVA space, leading to out-of-bounds accesses of the PGD when mapping the IOVA. Force a 32-bit IOMMU Domain Geometry to fix this. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent d5adbfc commit 3b6bb5b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iommu/ipmmu-vmsa.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain)
313313
domain->cfg.ias = 32;
314314
domain->cfg.oas = 40;
315315
domain->cfg.tlb = &ipmmu_gather_ops;
316+
domain->io_domain.geometry.aperture_end = DMA_BIT_MASK(32);
317+
domain->io_domain.geometry.force_aperture = true;
316318
/*
317319
* TODO: Add support for coherent walk through CCI with DVM and remove
318320
* cache handling. For now, delegate it to the io-pgtable code.

0 commit comments

Comments
 (0)