mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
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:
@@ -1108,6 +1108,14 @@ static int rk_iommu_add_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 -ENOMEM;
|
||||
|
||||
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1118,6 +1126,9 @@ static void rk_iommu_remove_device(struct device *dev)
|
||||
|
||||
iommu = rk_iommu_from_dev(dev);
|
||||
|
||||
kfree(dev->dma_parms);
|
||||
dev->dma_parms = NULL;
|
||||
|
||||
device_link_del(data->link);
|
||||
iommu_device_unlink(&iommu->iommu, dev);
|
||||
iommu_group_remove_device(dev);
|
||||
|
||||
Reference in New Issue
Block a user