Loading drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c +17 −14 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ struct scratch_mapping { struct cam_context_bank_info { struct device *dev; struct dma_iommu_mapping *mapping; struct iommu_domain *domain; enum iommu_attr attr; dma_addr_t va_start; size_t va_len; Loading Loading @@ -529,9 +529,11 @@ static int cam_smmu_attach_device(int idx) { int rc; struct cam_context_bank_info *cb = &iommu_cb_set.cb_info[idx]; struct iommu_domain *domain = iommu_cb_set.cb_info[idx].domain; /* attach the mapping to device */ rc = arm_iommu_attach_device(cb->dev, cb->mapping); rc = iommu_attach_device(domain, cb->dev); if (rc < 0) { pr_err("Error: ARM IOMMU attach failed. ret = %d\n", rc); return -ENODEV; Loading Loading @@ -852,6 +854,8 @@ static int cam_smmu_send_syscall_pix_intf(int vmid, int idx) static int cam_smmu_detach_device(int idx) { struct cam_context_bank_info *cb = &iommu_cb_set.cb_info[idx]; struct iommu_domain *domain = iommu_cb_set.cb_info[idx].domain; if (!list_empty_careful(&iommu_cb_set.cb_info[idx].smmu_buf_list)) { pr_err("Client %s buffer list is not clean!\n", Loading @@ -861,7 +865,7 @@ static int cam_smmu_detach_device(int idx) } /* detach the mapping to device */ arm_iommu_detach_device(cb->dev); iommu_detach_device(domain, cb->dev); iommu_cb_set.cb_info[idx].state = CAM_SMMU_DETACH; return 0; } Loading Loading @@ -1210,7 +1214,7 @@ int cam_smmu_set_attr(int handle, uint32_t flags, int32_t *data) } if (iommu_cb_set.cb_info[idx].state == CAM_SMMU_DETACH) { domain = iommu_cb_set.cb_info[idx].mapping->domain; domain = iommu_cb_set.cb_info[idx].domain; cb = &iommu_cb_set.cb_info[idx]; cb->attr |= flags; /* set attributes */ Loading Loading @@ -1337,7 +1341,7 @@ static int cam_smmu_alloc_scratch_buffer_add_to_list(int idx, /* Get the domain from within our cb_set struct and map it*/ domain = iommu_cb_set.cb_info[idx].mapping->domain; domain = iommu_cb_set.cb_info[idx].domain; rc = cam_smmu_alloc_scratch_va(&iommu_cb_set.cb_info[idx].scratch_map, virt_len, &iova); Loading Loading @@ -1407,7 +1411,7 @@ static int cam_smmu_free_scratch_buffer_remove_from_list( int rc = 0; size_t unmapped; struct iommu_domain *domain = iommu_cb_set.cb_info[idx].mapping->domain; iommu_cb_set.cb_info[idx].domain; struct scratch_mapping *scratch_map = &iommu_cb_set.cb_info[idx].scratch_map; Loading Loading @@ -2049,8 +2053,8 @@ static void cam_smmu_release_cb(struct platform_device *pdev) int i = 0; for (i = 0; i < iommu_cb_set.cb_num; i++) { arm_iommu_detach_device(iommu_cb_set.cb_info[i].dev); arm_iommu_release_mapping(iommu_cb_set.cb_info[i].mapping); iommu_detach_device(iommu_cb_set.cb_info[i].domain, iommu_cb_set.cb_info[i].dev); } iommu_cb_set.cb_num = 0; Loading Loading @@ -2087,12 +2091,11 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, cb->va_start = SZ_128K; cb->va_len = VA_SPACE_END - SZ_128M; } /* create a virtual mapping */ cb->mapping = arm_iommu_create_mapping(&platform_bus_type, cb->va_start, cb->va_len); if (IS_ERR(cb->mapping)) { pr_err("Error: create mapping Failed\n"); cb->domain = iommu_get_domain_for_dev(cb->dev); if (IS_ERR(cb->domain)) { pr_err("iommu get domain for dev: %s failed\n", dev_name(cb->dev)); rc = -ENODEV; goto end; } Loading Loading @@ -2229,7 +2232,7 @@ static int cam_populate_smmu_context_banks(struct device *dev, if (rc < 0) pr_err("Error: failed to setup cb : %s\n", cb->name); iommu_set_fault_handler(cb->mapping->domain, iommu_set_fault_handler(cb->domain, cam_smmu_iommu_fault_handler, (void *)cb->name); Loading Loading
drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c +17 −14 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ struct scratch_mapping { struct cam_context_bank_info { struct device *dev; struct dma_iommu_mapping *mapping; struct iommu_domain *domain; enum iommu_attr attr; dma_addr_t va_start; size_t va_len; Loading Loading @@ -529,9 +529,11 @@ static int cam_smmu_attach_device(int idx) { int rc; struct cam_context_bank_info *cb = &iommu_cb_set.cb_info[idx]; struct iommu_domain *domain = iommu_cb_set.cb_info[idx].domain; /* attach the mapping to device */ rc = arm_iommu_attach_device(cb->dev, cb->mapping); rc = iommu_attach_device(domain, cb->dev); if (rc < 0) { pr_err("Error: ARM IOMMU attach failed. ret = %d\n", rc); return -ENODEV; Loading Loading @@ -852,6 +854,8 @@ static int cam_smmu_send_syscall_pix_intf(int vmid, int idx) static int cam_smmu_detach_device(int idx) { struct cam_context_bank_info *cb = &iommu_cb_set.cb_info[idx]; struct iommu_domain *domain = iommu_cb_set.cb_info[idx].domain; if (!list_empty_careful(&iommu_cb_set.cb_info[idx].smmu_buf_list)) { pr_err("Client %s buffer list is not clean!\n", Loading @@ -861,7 +865,7 @@ static int cam_smmu_detach_device(int idx) } /* detach the mapping to device */ arm_iommu_detach_device(cb->dev); iommu_detach_device(domain, cb->dev); iommu_cb_set.cb_info[idx].state = CAM_SMMU_DETACH; return 0; } Loading Loading @@ -1210,7 +1214,7 @@ int cam_smmu_set_attr(int handle, uint32_t flags, int32_t *data) } if (iommu_cb_set.cb_info[idx].state == CAM_SMMU_DETACH) { domain = iommu_cb_set.cb_info[idx].mapping->domain; domain = iommu_cb_set.cb_info[idx].domain; cb = &iommu_cb_set.cb_info[idx]; cb->attr |= flags; /* set attributes */ Loading Loading @@ -1337,7 +1341,7 @@ static int cam_smmu_alloc_scratch_buffer_add_to_list(int idx, /* Get the domain from within our cb_set struct and map it*/ domain = iommu_cb_set.cb_info[idx].mapping->domain; domain = iommu_cb_set.cb_info[idx].domain; rc = cam_smmu_alloc_scratch_va(&iommu_cb_set.cb_info[idx].scratch_map, virt_len, &iova); Loading Loading @@ -1407,7 +1411,7 @@ static int cam_smmu_free_scratch_buffer_remove_from_list( int rc = 0; size_t unmapped; struct iommu_domain *domain = iommu_cb_set.cb_info[idx].mapping->domain; iommu_cb_set.cb_info[idx].domain; struct scratch_mapping *scratch_map = &iommu_cb_set.cb_info[idx].scratch_map; Loading Loading @@ -2049,8 +2053,8 @@ static void cam_smmu_release_cb(struct platform_device *pdev) int i = 0; for (i = 0; i < iommu_cb_set.cb_num; i++) { arm_iommu_detach_device(iommu_cb_set.cb_info[i].dev); arm_iommu_release_mapping(iommu_cb_set.cb_info[i].mapping); iommu_detach_device(iommu_cb_set.cb_info[i].domain, iommu_cb_set.cb_info[i].dev); } iommu_cb_set.cb_num = 0; Loading Loading @@ -2087,12 +2091,11 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, cb->va_start = SZ_128K; cb->va_len = VA_SPACE_END - SZ_128M; } /* create a virtual mapping */ cb->mapping = arm_iommu_create_mapping(&platform_bus_type, cb->va_start, cb->va_len); if (IS_ERR(cb->mapping)) { pr_err("Error: create mapping Failed\n"); cb->domain = iommu_get_domain_for_dev(cb->dev); if (IS_ERR(cb->domain)) { pr_err("iommu get domain for dev: %s failed\n", dev_name(cb->dev)); rc = -ENODEV; goto end; } Loading Loading @@ -2229,7 +2232,7 @@ static int cam_populate_smmu_context_banks(struct device *dev, if (rc < 0) pr_err("Error: failed to setup cb : %s\n", cb->name); iommu_set_fault_handler(cb->mapping->domain, iommu_set_fault_handler(cb->domain, cam_smmu_iommu_fault_handler, (void *)cb->name); Loading