On Wed, May 22, 2019 at 07:18:39PM +0900, Yoshihiro Shimoda wrote: > In IOMMU environment, since it's possible to merge scatter gather > buffers of memory requests to one iova, this patch changes the max_segs > value when init_card of mmc_host timing to improve the transfer > performance on renesas_sdhi_internal_dmac. Well, you can't merge everything with an IOMMU. For one not every IOMMU can merge multiple scatterlist segments, second even it can merge segements the segments need to be aligned to the IOMMU page size. And then of course we might have an upper limit on the total mapping. > + if (host->pdata->max_segs < SDHI_MAX_SEGS_IN_IOMMU && > + host->pdev->dev.iommu_group && > + (mmc_card_mmc(card) || mmc_card_sd(card))) > + host->mmc->max_segs = SDHI_MAX_SEGS_IN_IOMMU; This is way to magic. We'll need a proper DMA layer API to expose this information, and preferably a block layer helper to increase max_segs instead of hacking that up in the driver.