On Wed, Feb 05, 2025 at 07:28:37PM +0000, Robin Murphy wrote: > On 2025-02-04 6:34 pm, Jason Gunthorpe wrote: > > Instead use the virtual address and dma_map_single() like as->pd > > uses. Introduce a small struct tegra_pt instead of void * to have some > > clarity what is using this API and add compile safety during the > > conversion. > > Hmm, I'm not sure it's all that clear to have a major discrepancy between > how different levels of pagetable are referenced Well, with a trivial conversion the pd would be u32* and the pt would be u32**. There is 1 usage of a tegra_pd and 7 of a tegra_pt. Spraying u32** all over the place was pretty ugly. Removing one of the *'s was more than I wanted to do on this old driver. So, lets a type for pd. > > @@ -596,21 +600,21 @@ static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova, > > if (!as->pts[pde]) { > > dma_addr_t dma; > > - dma = dma_map_page(smmu->dev, page, 0, SMMU_SIZE_PT, > > - DMA_TO_DEVICE); > > + dma = dma_map_single(smmu->dev, pt, SMMU_SIZE_PD, > > SMMU_SIZE_PT (yeah they're numerically the same, but still...) Oops, copy pasteo > > + DMA_TO_DEVICE); > > if (dma_mapping_error(smmu->dev, dma)) { > > - __iommu_free_pages(page, 0); > > + iommu_free_page(pt); > > return NULL; > > } > > if (!smmu_dma_addr_valid(smmu, dma)) { > > dma_unmap_page(smmu->dev, dma, SMMU_SIZE_PT, > > DMA_TO_DEVICE); > > All the unmaps should be converted to _single as well (and in patch #1) - > the APIs are not officially interchangeable. Missed, that got it on both patches Thanks, Jason