diff mbox

Jetson TK1 & HDMI output in mainline kernel

Message ID 4736cd4f-adcb-8e7d-f5a1-c71bb7c88ff8@xs4all.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Hans Verkuil July 14, 2017, 5:30 p.m. UTC
Hi Mikko, Thierry,

While setting up my Jetson TK1 using the mainline kernel I discovered that the HDMI output
didn't work.

After some more debugging I discovered that this commit 404bfb78daf3bedafb0bfab24947059575cbea3d
(gpu: host1x: Add IOMMU support) was the culprit.

As far as I understand it host1x_probe() calls iommu_attach_device(), which in turn tries to
find the 'iommus' property in the DT. But the hdmi@54280000 device has no such property and so
iommu_attach_device() returns -ENODEV and the host1x_probe fails.

After making this extremely ugly patch it all works again:


My plan is to use my Jetson TK1 to upstream the Tegra CEC driver that I wrote, but
a working HDMI output would help a lot :-)

I'm not sure if my analysis of the cause is correct, but if someone can take a look
then I would appreciate that!

Regards,

	Hans

Comments

Mikko Perttunen July 17, 2017, 7:37 a.m. UTC | #1
On 14.07.2017 20:30, Hans Verkuil wrote:
> Hi Mikko, Thierry,
>
> While setting up my Jetson TK1 using the mainline kernel I discovered that the HDMI output
> didn't work.
>
> After some more debugging I discovered that this commit 404bfb78daf3bedafb0bfab24947059575cbea3d
> (gpu: host1x: Add IOMMU support) was the culprit.
>
> As far as I understand it host1x_probe() calls iommu_attach_device(), which in turn tries to
> find the 'iommus' property in the DT. But the hdmi@54280000 device has no such property and so
> iommu_attach_device() returns -ENODEV and the host1x_probe fails.
>
> After making this extremely ugly patch it all works again:
>
> diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
> index 2c58a390123a..683f3a5f382a 100644
> --- a/drivers/gpu/host1x/dev.c
> +++ b/drivers/gpu/host1x/dev.c
> @@ -186,6 +186,11 @@ static int host1x_probe(struct platform_device *pdev)
>  			return -ENOMEM;
>
>  		err = iommu_attach_device(host->domain, &pdev->dev);
> +		if (err == -ENODEV) {
> +			iommu_domain_free(host->domain);
> +			host->domain = NULL;
> +			goto no_mmu;
> +		}
>  		if (err)
>  			goto fail_free_domain;
>
> @@ -197,7 +202,7 @@ static int host1x_probe(struct platform_device *pdev)
>  				 geometry->aperture_end >> order);
>  		host->iova_end = geometry->aperture_end;
>  	}
> -
> +no_mmu:
>  	err = host1x_channel_list_init(&host->channel_list,
>  				       host->info->nb_channels);
>  	if (err) {
>
> My plan is to use my Jetson TK1 to upstream the Tegra CEC driver that I wrote, but
> a working HDMI output would help a lot :-)
>

Nice :)

> I'm not sure if my analysis of the cause is correct, but if someone can take a look
> then I would appreciate that!

Yeah, this was discovered independently on linux-tegra a few days ago - 
an almost identical patch is posted there as well but AFAIK not 
integrated yet. Hopefully we can get it integrated soon :)

Hopefully we can get a system to automatically run test suites on 
multiple chip generations - that would eliminate these sorts of mistakes.

Thanks,
Mikko

>
> Regards,
>
> 	Hans
>
diff mbox

Patch

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 2c58a390123a..683f3a5f382a 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -186,6 +186,11 @@  static int host1x_probe(struct platform_device *pdev)
 			return -ENOMEM;

 		err = iommu_attach_device(host->domain, &pdev->dev);
+		if (err == -ENODEV) {
+			iommu_domain_free(host->domain);
+			host->domain = NULL;
+			goto no_mmu;
+		}
 		if (err)
 			goto fail_free_domain;

@@ -197,7 +202,7 @@  static int host1x_probe(struct platform_device *pdev)
 				 geometry->aperture_end >> order);
 		host->iova_end = geometry->aperture_end;
 	}
-
+no_mmu:
 	err = host1x_channel_list_init(&host->channel_list,
 				       host->info->nb_channels);
 	if (err) {