Loading drivers/gpu/drm/msm/msm_drv.h +2 −0 Original line number Diff line number Diff line Loading @@ -668,6 +668,8 @@ int msm_gem_map_vma(struct msm_gem_address_space *aspace, struct msm_gem_vma *vma, struct sg_table *sgt, int npages, unsigned int flags); struct device *msm_gem_get_aspace_device(struct msm_gem_address_space *aspace); void msm_gem_address_space_put(struct msm_gem_address_space *aspace); struct msm_gem_address_space * Loading drivers/gpu/drm/msm/msm_gem.c +37 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "msm_gem.h" #include "msm_gpu.h" #include "msm_mmu.h" #include "sde_dbg.h" static void msm_gem_vunmap_locked(struct drm_gem_object *obj); Loading Loading @@ -416,9 +417,44 @@ int msm_gem_get_iova(struct drm_gem_object *obj, if (!vma) { struct page **pages; struct device *dev; struct dma_buf *dmabuf; bool reattach = false; /* * both secure/non-secure domains are attached with the default * devive (non-sec) with dma_buf_attach during * msm_gem_prime_import. detach and attach the correct device * to the dma_buf based on the aspace domain. */ dev = msm_gem_get_aspace_device(aspace); if (dev && obj->import_attach && (dev != obj->import_attach->dev)) { dmabuf = obj->import_attach->dmabuf; DRM_DEBUG("detach nsec-dev:%pK attach sec-dev:%pK\n", obj->import_attach->dev, dev); SDE_EVT32(obj->import_attach->dev, dev, msm_obj->sgt); if (msm_obj->sgt) dma_buf_unmap_attachment(obj->import_attach, msm_obj->sgt, DMA_BIDIRECTIONAL); dma_buf_detach(dmabuf, obj->import_attach); obj->import_attach = dma_buf_attach(dmabuf, dev); if (IS_ERR(obj->import_attach)) { DRM_ERROR("dma_buf_attach failure, err=%ld\n", PTR_ERR(obj->import_attach)); goto unlock; } reattach = true; } /* perform delayed import for buffers without existing sgt */ if ((msm_obj->flags & MSM_BO_EXTBUF) && !(msm_obj->sgt)) { if (((msm_obj->flags & MSM_BO_EXTBUF) && !(msm_obj->sgt)) || reattach) { ret = msm_gem_delayed_import(obj); if (ret) { DRM_ERROR("delayed dma-buf import failed %d\n", Loading drivers/gpu/drm/msm/msm_gem_vma.c +10 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,16 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace, return -EINVAL; } struct device *msm_gem_get_aspace_device(struct msm_gem_address_space *aspace) { struct device *client_dev = NULL; if (aspace && aspace->mmu && aspace->mmu->funcs->get_dev) client_dev = aspace->mmu->funcs->get_dev(aspace->mmu); return client_dev; } void msm_gem_add_obj_to_aspace_active_list( struct msm_gem_address_space *aspace, struct drm_gem_object *obj) Loading drivers/gpu/drm/msm/msm_mmu.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ struct msm_mmu_funcs { uint32_t dest_address, uint32_t size, int prot); int (*one_to_one_unmap)(struct msm_mmu *mmu, uint32_t dest_address, uint32_t size); struct device *(*get_dev)(struct msm_mmu *mmu); }; struct msm_mmu { Loading drivers/gpu/drm/msm/msm_smmu.c +8 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,13 @@ static void msm_smmu_destroy(struct msm_mmu *mmu) kfree(smmu); } struct device *msm_smmu_get_dev(struct msm_mmu *mmu) { struct msm_smmu *smmu = to_msm_smmu(mmu); return smmu->client_dev; } static int msm_smmu_map_dma_buf(struct msm_mmu *mmu, struct sg_table *sgt, int dir, u32 flags) { Loading Loading @@ -292,6 +299,7 @@ static const struct msm_mmu_funcs funcs = { .set_attribute = msm_smmu_set_attribute, .one_to_one_map = msm_smmu_one_to_one_map, .one_to_one_unmap = msm_smmu_one_to_one_unmap, .get_dev = msm_smmu_get_dev, }; static struct msm_smmu_domain msm_smmu_domains[MSM_SMMU_DOMAIN_MAX] = { Loading Loading
drivers/gpu/drm/msm/msm_drv.h +2 −0 Original line number Diff line number Diff line Loading @@ -668,6 +668,8 @@ int msm_gem_map_vma(struct msm_gem_address_space *aspace, struct msm_gem_vma *vma, struct sg_table *sgt, int npages, unsigned int flags); struct device *msm_gem_get_aspace_device(struct msm_gem_address_space *aspace); void msm_gem_address_space_put(struct msm_gem_address_space *aspace); struct msm_gem_address_space * Loading
drivers/gpu/drm/msm/msm_gem.c +37 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "msm_gem.h" #include "msm_gpu.h" #include "msm_mmu.h" #include "sde_dbg.h" static void msm_gem_vunmap_locked(struct drm_gem_object *obj); Loading Loading @@ -416,9 +417,44 @@ int msm_gem_get_iova(struct drm_gem_object *obj, if (!vma) { struct page **pages; struct device *dev; struct dma_buf *dmabuf; bool reattach = false; /* * both secure/non-secure domains are attached with the default * devive (non-sec) with dma_buf_attach during * msm_gem_prime_import. detach and attach the correct device * to the dma_buf based on the aspace domain. */ dev = msm_gem_get_aspace_device(aspace); if (dev && obj->import_attach && (dev != obj->import_attach->dev)) { dmabuf = obj->import_attach->dmabuf; DRM_DEBUG("detach nsec-dev:%pK attach sec-dev:%pK\n", obj->import_attach->dev, dev); SDE_EVT32(obj->import_attach->dev, dev, msm_obj->sgt); if (msm_obj->sgt) dma_buf_unmap_attachment(obj->import_attach, msm_obj->sgt, DMA_BIDIRECTIONAL); dma_buf_detach(dmabuf, obj->import_attach); obj->import_attach = dma_buf_attach(dmabuf, dev); if (IS_ERR(obj->import_attach)) { DRM_ERROR("dma_buf_attach failure, err=%ld\n", PTR_ERR(obj->import_attach)); goto unlock; } reattach = true; } /* perform delayed import for buffers without existing sgt */ if ((msm_obj->flags & MSM_BO_EXTBUF) && !(msm_obj->sgt)) { if (((msm_obj->flags & MSM_BO_EXTBUF) && !(msm_obj->sgt)) || reattach) { ret = msm_gem_delayed_import(obj); if (ret) { DRM_ERROR("delayed dma-buf import failed %d\n", Loading
drivers/gpu/drm/msm/msm_gem_vma.c +10 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,16 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace, return -EINVAL; } struct device *msm_gem_get_aspace_device(struct msm_gem_address_space *aspace) { struct device *client_dev = NULL; if (aspace && aspace->mmu && aspace->mmu->funcs->get_dev) client_dev = aspace->mmu->funcs->get_dev(aspace->mmu); return client_dev; } void msm_gem_add_obj_to_aspace_active_list( struct msm_gem_address_space *aspace, struct drm_gem_object *obj) Loading
drivers/gpu/drm/msm/msm_mmu.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ struct msm_mmu_funcs { uint32_t dest_address, uint32_t size, int prot); int (*one_to_one_unmap)(struct msm_mmu *mmu, uint32_t dest_address, uint32_t size); struct device *(*get_dev)(struct msm_mmu *mmu); }; struct msm_mmu { Loading
drivers/gpu/drm/msm/msm_smmu.c +8 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,13 @@ static void msm_smmu_destroy(struct msm_mmu *mmu) kfree(smmu); } struct device *msm_smmu_get_dev(struct msm_mmu *mmu) { struct msm_smmu *smmu = to_msm_smmu(mmu); return smmu->client_dev; } static int msm_smmu_map_dma_buf(struct msm_mmu *mmu, struct sg_table *sgt, int dir, u32 flags) { Loading Loading @@ -292,6 +299,7 @@ static const struct msm_mmu_funcs funcs = { .set_attribute = msm_smmu_set_attribute, .one_to_one_map = msm_smmu_one_to_one_map, .one_to_one_unmap = msm_smmu_one_to_one_unmap, .get_dev = msm_smmu_get_dev, }; static struct msm_smmu_domain msm_smmu_domains[MSM_SMMU_DOMAIN_MAX] = { Loading