Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755243AbdGKGnz (ORCPT ); Tue, 11 Jul 2017 02:43:55 -0400 Received: from mail.kapsi.fi ([217.30.184.167]:54048 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751496AbdGKGnx (ORCPT ); Tue, 11 Jul 2017 02:43:53 -0400 Subject: Re: [PATCH] gpu: host1x: Free the IOMMU domain when there is no device to attach To: Paul Kocialkowski , linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <20170710193305.5987-1-contact@paulk.fr> Cc: Jonathan Hunter , Stephen Warren , Mikko Perttunen , Thierry Reding From: Mikko Perttunen Message-ID: <09ecbf74-ac5d-a7f5-c6bd-53f4f84a0de5@kapsi.fi> Date: Tue, 11 Jul 2017 09:43:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20170710193305.5987-1-contact@paulk.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 62.209.167.43 X-SA-Exim-Mail-From: cyndis@kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1580 Lines: 45 Thanks for the patch, didn't consider this case. I really need to get together some system to automatically test on multiple platforms.. :) Reviewed-by: Mikko Perttunen On 10.07.2017 22:33, Paul Kocialkowski wrote: > When there is no device to attach to the IOMMU domain, as may be the > case when the device-tree does not contain the proper iommu node, it is > best to keep going without IOMMU support rather than failing. > This allows the driver to probe and function instead of taking down > all of the tegra drm driver, leading to missing display support. > > Signed-off-by: Paul Kocialkowski > --- > drivers/gpu/host1x/dev.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c > index ac65f52850a6..f296738d0de8 100644 > --- a/drivers/gpu/host1x/dev.c > +++ b/drivers/gpu/host1x/dev.c > @@ -186,8 +186,13 @@ static int host1x_probe(struct platform_device *pdev) > return -ENOMEM; > > err = iommu_attach_device(host->domain, &pdev->dev); > - if (err) > + if (err == -ENODEV) { > + iommu_domain_free(host->domain); > + host->domain = NULL; > + goto iommu_skip; > + } else if (err) { > goto fail_free_domain; > + } > > geometry = &host->domain->geometry; > > @@ -198,6 +203,7 @@ static int host1x_probe(struct platform_device *pdev) > host->iova_end = geometry->aperture_end; > } > > +iommu_skip: > err = host1x_channel_list_init(host); > if (err) { > dev_err(&pdev->dev, "failed to initialize channel list\n"); >