Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3395443pxf; Mon, 22 Mar 2021 05:34:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCbte4BKluEQr7dyR8ogYTL+rOeFw6FUJ3uMaZKHGd5jQhqA/Ua4kxYX1NXeGQTt3ADivR X-Received: by 2002:a17:906:4f10:: with SMTP id t16mr18958918eju.531.1616416498293; Mon, 22 Mar 2021 05:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616416498; cv=none; d=google.com; s=arc-20160816; b=jrPYDni+duAU9PJcZ8w8nC3zlXXwITdxgUZeDZCVdtX72mPs2+MPSmgECNnOP5e6bA OTp9guHxeBs5L2EcnkcNDhwwuzTa0D2krZ6W5iOnTf6ktu60qawtC7GixwGacAKckf+8 zHviAaPZhoUplFAPI923sReLFXAtoTXKts2h9uHV8s1eEwloNUJ3XGsQtnxMJUziN6Sz xA6jFJs8kjFA89MJ0oQr7qI8Ime8zdcABr/51CF5OaPYGX6DMNo0LjM7W8UXTwsKtUDY 5DrgbzmBUS82xwC6weYO8EAJTQpsl1XH3WUuvn+veIO6XYr/ZaEig3qBFX/Q1Y1TKB69 D5ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nKdRTlBKhnS2iqscBWFZG5zlypHsM0TeXpoE3czB1b4=; b=MKe/xAJKB04ssg6b27JJdovCqUygY8Gcfdy56HbEZ6mxwevEgGTgkKxUJgCSEavl5M 1xIyG7iPzLcivg/RliwXL98vDAdT9ayIZW/Wu+fBzOtPmQYJsFp10qYioH+AcJncC0z8 pT/ssOByxntgPKIsVxpvHSxB1EmavJoVVU82QUNKY5yU450flBMyuNhVXjleZztIN6+y Bao+M4eDGEIqcgrRZ2Vwyjv62tKGhF6XFsKyBDVl+AJ35FhXabApvu38D7XYb2Lq3YnB dFDgt1QjmB16tkTW0xKTdPw2zPsyoDFTIkCwUWS8YXiYsCJyIZPHMa3qY+mLl7zgR0eM 7TTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SLJOuYKz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si11275450eju.471.2021.03.22.05.34.35; Mon, 22 Mar 2021 05:34:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SLJOuYKz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbhCVMdi (ORCPT + 99 others); Mon, 22 Mar 2021 08:33:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:54580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231394AbhCVMbn (ORCPT ); Mon, 22 Mar 2021 08:31:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1077461994; Mon, 22 Mar 2021 12:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616416303; bh=Sx6D0JMxot2iQKtDArVYoWeYn06xBWSeB/JlDe45mtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLJOuYKz7QWX4TTQ6tT0CTCXGao5fu0TVc3LPwD3o4FA+oUVaPQ+yiBUCSAALITHP B2nsvsBUqKgg82FRtksdEF9cv3tVKAHOp6YMpCDAK3fByynw+5e8ZRUmhoFCFzCvZm BVYtw3WBt6eRUKtZdlWqKlxBAvzrvsylWYlvC5xU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Nicolin Chen , Joerg Roedel Subject: [PATCH 5.11 055/120] iommu/tegra-smmu: Make tegra_smmu_probe_device() to handle all IOMMU phandles Date: Mon, 22 Mar 2021 13:27:18 +0100 Message-Id: <20210322121931.519757598@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210322121929.669628946@linuxfoundation.org> References: <20210322121929.669628946@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko commit 8dfd0fa6ecdc5e2099a57d485b7ce237abc6c7a0 upstream. The tegra_smmu_probe_device() handles only the first IOMMU device-tree phandle, skipping the rest. Devices like 3D module on Tegra30 have multiple IOMMU phandles, one for each h/w block, and thus, only one IOMMU phandle is added to fwspec for the 3D module, breaking GPU. Previously this problem was masked by tegra_smmu_attach_dev() which didn't use the fwspec, but parsed the DT by itself. The previous commit to tegra-smmu driver partially reverted changes that caused problems for T124 and now we have tegra_smmu_attach_dev() that uses the fwspec and the old-buggy variant of tegra_smmu_probe_device() which skips secondary IOMMUs. Make tegra_smmu_probe_device() not to skip the secondary IOMMUs. This fixes a partially attached IOMMU of the 3D module on Tegra30 and now GPU works properly once again. Fixes: 765a9d1d02b2 ("iommu/tegra-smmu: Fix mc errors on tegra124-nyan") Signed-off-by: Dmitry Osipenko Tested-by: Nicolin Chen Link: https://lore.kernel.org/r/20210312155439.18477-1-digetx@gmail.com Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/tegra-smmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -849,12 +849,11 @@ static struct iommu_device *tegra_smmu_p smmu = tegra_smmu_find(args.np); if (smmu) { err = tegra_smmu_configure(smmu, dev, &args); - of_node_put(args.np); - if (err < 0) + if (err < 0) { + of_node_put(args.np); return ERR_PTR(err); - - break; + } } of_node_put(args.np);