drm/rockchip: logo: add iommu map size for logo buffer iommu mapping

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>
This commit is contained in:
Mark Yao
2017-01-18 12:50:40 +08:00
committed by Huang, Tao
parent 756733c3ab
commit 112d2aa334
3 changed files with 6 additions and 3 deletions

View File

@@ -162,8 +162,10 @@ static int init_loader_memory(struct drm_device *drm_dev)
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;

View File

@@ -102,6 +102,7 @@ struct rockchip_logo {
dma_addr_t dma_addr;
phys_addr_t start;
phys_addr_t size;
size_t iommu_map_size;
int count;
};

View File

@@ -67,7 +67,7 @@ static void rockchip_drm_fb_destroy(struct drm_framebuffer *fb)
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,