msm: kgsl: Handle a defer from IOMMU

of_dma_configure() will return -EPROBE_DEFER if the IOMMU driver isn't
set up yet. Propagate that error all the way back to probe.

Change-Id: Ic0dedbad3bdda6516386f6eeff485065f83aee9b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
Jordan Crouse 2020-01-06 15:08:02 -07:00
commit fb77ada179
4 changed files with 16 additions and 10 deletions

View file

@ -4841,6 +4841,11 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
if (status)
goto error;
/* This can return -EPROBE_DEFER */
status = kgsl_mmu_probe(device);
if (status != 0)
goto error_pwrctrl_close;
if (!devm_request_mem_region(&pdev->dev, device->reg_phys,
device->reg_len, device->name)) {
dev_err(device->dev, "request_mem_region failed\n");
@ -4868,10 +4873,6 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
rwlock_init(&device->context_lock);
spin_lock_init(&device->submit_lock);
status = kgsl_mmu_probe(device);
if (status != 0)
goto error_pwrctrl_close;
/* Check to see if our device can perform DMA correctly */
status = dma_set_coherent_mask(&pdev->dev, KGSL_DMA_BIT_MASK);
if (status)

View file

@ -288,10 +288,14 @@ static int gmu_iommu_cb_probe(struct gmu_device *gmu,
return -ENODEV;
pdev = of_find_device_by_node(node);
of_dma_configure(&pdev->dev, node, true);
ret = of_dma_configure(&pdev->dev, node, true);
of_node_put(node);
if (ret) {
platform_device_put(pdev);
return ret;
}
ctx->pdev = pdev;
ctx->domain = iommu_domain_alloc(&platform_bus_type);
if (ctx->domain == NULL) {

View file

@ -2412,6 +2412,7 @@ static int kgsl_iommu_probe_child(struct kgsl_device *device,
struct device_node *node = of_find_node_by_name(parent, name);
struct platform_device *pdev;
struct device_node *phandle;
int ret;
if (!node)
return -ENOENT;
@ -2430,10 +2431,10 @@ static int kgsl_iommu_probe_child(struct kgsl_device *device,
of_node_put(phandle);
of_dma_configure(&pdev->dev, node, true);
ret = of_dma_configure(&pdev->dev, node, true);
of_node_put(node);
return 0;
return ret;
}
static void iommu_probe_lpac_context(struct kgsl_device *device,

View file

@ -646,8 +646,8 @@ int kgsl_mmu_probe(struct kgsl_device *device)
* go for the NOMMU option instead
*/
ret = kgsl_iommu_probe(device);
if (!ret)
return 0;
if (!ret || ret == -EPROBE_DEFER)
return ret;
/* set up for NOMMU */
set_bit(KGSL_MMU_GLOBAL_PAGETABLE, &mmu->features);