From patchwork Mon Jul 10 19:33:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 9833721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CA23460318 for ; Mon, 10 Jul 2017 19:33:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FC71283FB for ; Mon, 10 Jul 2017 19:33:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53FDC284C8; Mon, 10 Jul 2017 19:33:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE48A283FB for ; Mon, 10 Jul 2017 19:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=x5RXxFPUMckQEiIc2U/hxxQ7qN6Selwnd9TmKJNxjtM=; b=Yf1 llN73guJeDLNmHQfjdDaJP5DhuGNHfWVQ87DYIxzhxYN5+y5dXDTRjxhIbqiHp2F1s2KSonRQYklz VSraBjONnkGeq1PerDS2/gp8cfRo8D0baniP6WyTLAxHOXGOvqzolVK5sSSpAFjO7GwKpj7IIe57i 6O4pGsX9UzMAL2qopVNbIGuZKMA16WbMWMt0KYcdUdPQbqO8wQgeZMH5S6izNfqofT8AMIldsbCf0 nRcTPSDpfCUzupSDHflWkX4F/pzXw9+jOlhLspwWwVcdkfv1WuPuKXOlZKxHq6cb+ay/1riEf5Mnz 4+lPDVckO7Cx4pZK6jep2sURnL9dEiA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dUeRA-0004JE-6Z; Mon, 10 Jul 2017 19:33:40 +0000 Received: from gagarine.paulk.fr ([109.190.93.129]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dUeR6-0004Hx-LS for linux-arm-kernel@lists.infradead.org; Mon, 10 Jul 2017 19:33:39 +0000 Received: by gagarine.paulk.fr (Postfix, from userid 65534) id 9FF6B214DE; Mon, 10 Jul 2017 21:33:11 +0200 (CEST) Received: from localhost.localdomain (vpn-0-22.aquilenet.fr [141.255.130.22]) by gagarine.paulk.fr (Postfix) with ESMTP id 3DEE2214BF; Mon, 10 Jul 2017 21:33:08 +0200 (CEST) From: Paul Kocialkowski To: linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] gpu: host1x: Free the IOMMU domain when there is no device to attach Date: Mon, 10 Jul 2017 21:33:05 +0200 Message-Id: <20170710193305.5987-1-contact@paulk.fr> X-Mailer: git-send-email 2.13.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170710_123336_940436_24A5F360 X-CRM114-Status: GOOD ( 15.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thierry Reding , Stephen Warren , Mikko Perttunen , Paul Kocialkowski , Jonathan Hunter MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Mikko Perttunen Tested-by: Marcel Ziswiler --- 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");