iommu/rockchip: add max segment size for device

The default max segment size is 64Kb, if memory that device
want to map larger than default then it will break to several times
mapping which may result in non-contiguous IOVA. So set to 4Gb

Change-Id: I22eb7f30a3f741689c8c32734509c34f99fd8100
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Simon Xue
2021-04-06 16:54:17 +08:00
committed by Tao Huang
parent 85959f645b
commit 3fc0486fdf

View File

@@ -1107,6 +1107,14 @@ static struct iommu_device *rk_iommu_probe_device(struct device *dev)
data->defer_attach = false;
/* set max segment size for dev, needed for single chunk map */
if (!dev->dma_parms)
dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
if (!dev->dma_parms)
return ERR_PTR(-ENOMEM);
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
return &iommu->iommu;
}