mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
video: rockchip: mpp: deal with the case for iommu share
In platform arm32, iommu is shared in different device, it must attach to ensure hardware working in current device. Change-Id: I854a362adf6145dcfd796885922683f8a6b7e131 Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
This commit is contained in:
@@ -320,6 +320,8 @@ static int mpp_dev_abort(struct mpp_dev *mpp)
|
||||
static int mpp_task_run(struct mpp_dev *mpp,
|
||||
struct mpp_task *task)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mpp_debug_enter();
|
||||
|
||||
/*
|
||||
@@ -327,6 +329,16 @@ static int mpp_task_run(struct mpp_dev *mpp,
|
||||
* working in current hardware
|
||||
*/
|
||||
mpp_set_grf(mpp->grf_info);
|
||||
/*
|
||||
* for iommu share hardware, should attach to ensure
|
||||
* working in current device
|
||||
*/
|
||||
ret = mpp_iommu_attach(mpp->iommu_info);
|
||||
if (ret) {
|
||||
dev_err(mpp->dev, "mpp_iommu_attach failed\n");
|
||||
return -ENODATA;
|
||||
}
|
||||
|
||||
mpp_power_on(mpp);
|
||||
mpp_time_record(task);
|
||||
mpp_debug(DEBUG_TASK_INFO, "pid %d, start hw %s\n",
|
||||
|
||||
@@ -213,16 +213,8 @@ struct mpp_dma_buffer *mpp_dma_import_fd(struct mpp_iommu_info *iommu_info,
|
||||
ret = PTR_ERR(sgt);
|
||||
goto fail_map;
|
||||
}
|
||||
|
||||
ret = mpp_iommu_attach(iommu_info);
|
||||
if (ret) {
|
||||
dev_err(session->dev, "mpp_iommu_attach failed\n");
|
||||
goto fail_attachment;
|
||||
}
|
||||
|
||||
buffer->iova = sg_dma_address(sgt->sgl);
|
||||
buffer->size = sg_dma_len(sgt->sgl);
|
||||
|
||||
buffer->attach = attach;
|
||||
buffer->sgt = sgt;
|
||||
buffer->session = session;
|
||||
@@ -239,8 +231,6 @@ struct mpp_dma_buffer *mpp_dma_import_fd(struct mpp_iommu_info *iommu_info,
|
||||
|
||||
return buffer;
|
||||
|
||||
fail_attachment:
|
||||
dma_buf_unmap_attachment(buffer->attach, sgt, buffer->dir);
|
||||
fail_map:
|
||||
dma_buf_detach(buffer->dmabuf, attach);
|
||||
fail_attach:
|
||||
|
||||
Reference in New Issue
Block a user