Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2008158imm; Sat, 18 Aug 2018 08:59:32 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz/EN8CpH1+yWmFNMdM7M1IzarpG8AdYreLa5a0nEEscu7K0iA5hkqMdfDQeYNog8o56ovS X-Received: by 2002:a62:64d0:: with SMTP id y199-v6mr41426986pfb.255.1534607972842; Sat, 18 Aug 2018 08:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534607972; cv=none; d=google.com; s=arc-20160816; b=B1VU1H9AJrhvIVdsKPUEWM4f8H3S6PG431uTGcikqoy7NCv1/m0DSqFsXZXgJ5V19Z /yaVM/I8j4CUpuhf9gU1gWuR0f5d8GMlAxrezujy8tEiMWc5rgtjqy/3i2BaQzaGezID PHCtJkIZHShLWjBfNQ4YDwEoPhSqr4fKtqZ09SZ4bTwhX50Ke+28FW+JoIKR22Z2VdZt /acZ3HuNX0+Vmf1sHGvUhVsQtfvBkGibLXYg1siTzwirkQx6K5maVWlE/CZVypAQF75H eXw1GqJHalOv7D9paVq+QN0ywgTCKXXeQzQMws197keBe37lWeOqIgnqSGJQoRC2+2RP 4bbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ptf8gnYc/0ZhN76ToXP1EAN9E1bddmt41o9VjobpoBA=; b=QxGup7QMKDlFZI4hbJvIQ8WOzNzAD7JpvqI+PxoU1gS1YXFMXMuJOxKW4eog6Mi8he Le3od1mxIy6IUUcHqGIDBsR9dYL6SnhwNwUz76JfAPFdriDDtDTlqEsK0Q3dR2yR7hYP IVfKY6AYqFi9By1ieC3ghPkEDsHMmtx3f/lpDUt33NTMuouf/jmCY/hLm3/ZyixTffNb +0DZKBTH6k4H0IS3hm0XLB5gXomvHVfprD8pwTwgP5LgA4VSJTwl5jd/HimWRLLnGdSl Poler5J5oNVJSniqAXfFk7bTK5sThjdSuFTzTDMzHrSScRgsED5Gup+cXp3UlsWm9RIP sYIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OQdonk2T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17-v6si4444057pgl.488.2018.08.18.08.59.17; Sat, 18 Aug 2018 08:59:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OQdonk2T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbeHRTDv (ORCPT + 99 others); Sat, 18 Aug 2018 15:03:51 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:41695 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbeHRTDu (ORCPT ); Sat, 18 Aug 2018 15:03:50 -0400 Received: by mail-ed1-f66.google.com with SMTP id s24-v6so6110329edr.8; Sat, 18 Aug 2018 08:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ptf8gnYc/0ZhN76ToXP1EAN9E1bddmt41o9VjobpoBA=; b=OQdonk2TmlmXTgyymOY6XDvatjQK1aQ0U6g4ZtX10vg82i/hwT/NvJK98fTgWpfl+W AvFgyjx7T8aTJzebFb6pQYG5tBGTcSHllj2fao7RunkCb4aAREaKGK5CErXq4aISe1NJ DlQsD466c50PO2SQFSSmfM3RYvWaPSVpFDQjhaoeRTxF5TyHE/9uuSsaffv5qpdFwyP4 sCkXXyapFs4ndaMH2GHLSI2+wDlCrF6hClghwqQ5xMXGlbIL40NiBEJypZ+y4E+6puAk lcpygMrbofopXzPQvJsz2reRgIsZeNDbqMHFS2j77aiPon/RmIV8ZkOatXT+635IxiN2 YbVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ptf8gnYc/0ZhN76ToXP1EAN9E1bddmt41o9VjobpoBA=; b=aZ4Ht4VvND5ue4cnc2C9bHWArgYZ6g6HKVmQrvynKyh7y2z/doThkBh5uj/u0gy46B enwxSGfD3lSsLzQZOIiKA/2AMsXCN03Mx49p+xbpSO0v3jOO19qdrMzSvllBhM/0eVha e4o31luUNzdNYI8IzZ4CC1DWdqM8F4LjIYTkvJA7NSDPsiiI2UjRjN4TcpqlGgBwTYvu NHeYtonhg8vhbQElCMrz5PEAxc8jvC4CjMv82OBkgsTN0N1S/xkvL2S/YX9AAUT+6I4O CECetXbT3Kd4htgVCk1LuE/hWKcS2IcdUVvIHkzP726bzAJ59h3GBlmfPkomBTVf403F E6cA== X-Gm-Message-State: AOUpUlFFNs7R/K89kXL826Q5S+J8uD6Z79xXj886zN4LvQ97gO+5Wbiv 2hRJNplka/W4gSpE7z6E+sY= X-Received: by 2002:a50:a93c:: with SMTP id l57-v6mr45539846edc.229.1534607740370; Sat, 18 Aug 2018 08:55:40 -0700 (PDT) Received: from localhost.localdomain (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id v8-v6sm2784014edr.48.2018.08.18.08.55.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Aug 2018 08:55:39 -0700 (PDT) From: Dmitry Osipenko To: Joerg Roedel , Robin Murphy , Thierry Reding , Jonathan Hunter , Rob Herring Cc: iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 03/19] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT Date: Sat, 18 Aug 2018 18:54:14 +0300 Message-Id: <20180818155430.5586-4-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180818155430.5586-1-digetx@gmail.com> References: <20180818155430.5586-1-digetx@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GART can't handle all devices, hence ignore devices that aren't related to GART. IOMMU phandle must be explicitly assign to devices in the device tree. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index e9524ed264cf..f6cf5cd5aaca 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -342,8 +342,12 @@ static bool gart_iommu_capable(enum iommu_cap cap) static int gart_iommu_add_device(struct device *dev) { - struct iommu_group *group = iommu_group_get_for_dev(dev); + struct iommu_group *group; + if (!dev->iommu_fwspec) + return -ENODEV; + + group = iommu_group_get_for_dev(dev); if (IS_ERR(group)) return PTR_ERR(group); @@ -360,6 +364,12 @@ static void gart_iommu_remove_device(struct device *dev) iommu_device_unlink(&gart_handle->iommu, dev); } +static int gart_iommu_of_xlate(struct device *dev, + struct of_phandle_args *args) +{ + return 0; +} + static const struct iommu_ops gart_iommu_ops = { .capable = gart_iommu_capable, .domain_alloc = gart_iommu_domain_alloc, @@ -373,6 +383,7 @@ static const struct iommu_ops gart_iommu_ops = { .unmap = gart_iommu_unmap, .iova_to_phys = gart_iommu_iova_to_phys, .pgsize_bitmap = GART_IOMMU_PGSIZES, + .of_xlate = gart_iommu_of_xlate, }; static int tegra_gart_suspend(struct device *dev) @@ -438,6 +449,7 @@ static int tegra_gart_probe(struct platform_device *pdev) } iommu_device_set_ops(&gart->iommu, &gart_iommu_ops); + iommu_device_set_fwnode(&gart->iommu, dev->fwnode); ret = iommu_device_register(&gart->iommu); if (ret) { -- 2.18.0