Fix bug:
iova 0x0(logo buffer) unmap fail:
iommu: unaligned: iova 0x0 size 0xa5638 min_pagesz 0x1000
then cause iova 0x0 mmap fail:
iova: 0x0000000000000000 already mapped to 0x00000000f5c00000 cannot remap to phys: 0x00000000d6c6f000 prot: 0x3
Change-Id: I77443e9dba98aa6141aa44a42880b1cccc04043b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
logo->dma_addr = logo->mm.start;
- if (iommu_map_sg(private->domain, logo->dma_addr, sgt->sgl,
- sgt->nents, prot) < size) {
+ logo->iommu_map_size = iommu_map_sg(private->domain,
+ logo->dma_addr, sgt->sgl,
+ sgt->nents, prot);
+ if (logo->iommu_map_size < size) {
DRM_ERROR("failed to map buffer");
ret = -ENOMEM;
goto err_remove_node;
dma_addr_t dma_addr;
phys_addr_t start;
phys_addr_t size;
+ size_t iommu_map_size;
int count;
};
if (private && private->domain) {
iommu_unmap(private->domain, logo->dma_addr,
- logo->size);
+ logo->iommu_map_size);
drm_mm_remove_node(&logo->mm);
} else {
dma_unmap_sg(fb->dev->dev, logo->sgt->sgl,