Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1438890ybt; Thu, 25 Jun 2020 06:13:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgLJXLEU2f0w4Po95up3BzhpMpM0qHUemTJ5IfW+WSx2SfKT8wIQJE4UDnEryIjGJQFAf1 X-Received: by 2002:a17:907:b03:: with SMTP id h3mr31177967ejl.367.1593090839442; Thu, 25 Jun 2020 06:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593090839; cv=none; d=google.com; s=arc-20160816; b=uzn2PTPYJ3GoFxXUZF5nxf0rkrl0FENuiNVfBB31HR1yMgACA0d/Npp0CW1HTyFNN8 jWW05H72/IevJPVCRsVhWIeZFAXG4SRJBL5Cbh1kGf4Z5Wh/e1CkH+mHQiblLZCL8ca4 2MHwsoJP9BxehltikmD4a0CSJld2czroXLVoRy92BO3bXM7dVwF7ibitYOgK/XWSwpwy ueyZoEIt9bfktRRogCMy6N+IhvATfG5FUuU7yKN70PKGdw8WgAQDKXU9vDGAMvZt2n+s xjaJJBaw4b113W7Tm/wotrwjrkKYDYPMGzfkSkXAeAW0S2JjvRRWzKRnGhkGaRniXXqA hxoA== 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; bh=oWKDOkH5Ol1P6PM4MRYBchEpd7q8JJNOMliExvoGq6M=; b=fbPTFeS2wFq6d9BzW2d0j5jhM1J2sruO/cHULgxys6SCbTKo24MFY72tXMS8ngbCHE SB+Unh5C/9Z+EeCSOo7FMLLgOFOHkRrywgfUOJpCs5M+anxZzgHnSMVUAOVX5xtWkIHx b5Jn/J9QvaT6S1rZ9WJCIAOyjCnzhLV6oDzOiqK/8D6Ez2FxnSBCaPuHWTdzna8YbSS1 YVUbp3JJdlzpty5NSyb9YxaR/QslJK0+DO9rqkeSFhooSypEch62XgaDRMcBSmaeYvR5 xFltmGUXc8niET1zQrw0DMdI4Ans8i8oypSHTOsL0Vj4hIxKYcrZa4IZn+Qh5BtSNxVo pBiA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si272301edr.42.2020.06.25.06.13.36; Thu, 25 Jun 2020 06:13:59 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405008AbgFYNJp (ORCPT + 99 others); Thu, 25 Jun 2020 09:09:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404853AbgFYNIn (ORCPT ); Thu, 25 Jun 2020 09:08:43 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DC7AC08C5C1 for ; Thu, 25 Jun 2020 06:08:43 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id 0044846A; Thu, 25 Jun 2020 15:08:38 +0200 (CEST) From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: Russell King , Catalin Marinas , Will Deacon , Tony Luck , Fenghua Yu , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , x86@kernel.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Marek Szyprowski , Joerg Roedel , David Woodhouse , Lu Baolu , Matthias Brugger , Heiko Stuebner , Thierry Reding , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, intel-gfx@lists.freedesktop.org, Joerg Roedel Subject: [PATCH 06/13] iommu/tegra: Use dev_iommu_priv_get/set() Date: Thu, 25 Jun 2020 15:08:29 +0200 Message-Id: <20200625130836.1916-7-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200625130836.1916-1-joro@8bytes.org> References: <20200625130836.1916-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Remove the use of dev->archdata.iommu and use the private per-device pointer provided by IOMMU core code instead. Signed-off-by: Joerg Roedel --- drivers/iommu/tegra-gart.c | 8 ++++---- drivers/iommu/tegra-smmu.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index 5fbdff6ff41a..fac720273889 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -113,8 +113,8 @@ static int gart_iommu_attach_dev(struct iommu_domain *domain, if (gart->active_domain && gart->active_domain != domain) { ret = -EBUSY; - } else if (dev->archdata.iommu != domain) { - dev->archdata.iommu = domain; + } else if (dev_iommu_priv_get(dev) != domain) { + dev_iommu_priv_set(dev, domain); gart->active_domain = domain; gart->active_devices++; } @@ -131,8 +131,8 @@ static void gart_iommu_detach_dev(struct iommu_domain *domain, spin_lock(&gart->dom_lock); - if (dev->archdata.iommu == domain) { - dev->archdata.iommu = NULL; + if (dev_iommu_priv_get(dev) == domain) { + dev_iommu_priv_set(dev, NULL); if (--gart->active_devices == 0) gart->active_domain = NULL; diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 7426b7666e2b..124c8848ab7e 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -465,7 +465,7 @@ static void tegra_smmu_as_unprepare(struct tegra_smmu *smmu, static int tegra_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) { - struct tegra_smmu *smmu = dev->archdata.iommu; + struct tegra_smmu *smmu = dev_iommu_priv_get(dev); struct tegra_smmu_as *as = to_smmu_as(domain); struct device_node *np = dev->of_node; struct of_phandle_args args; @@ -780,7 +780,7 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev) * supported by the Linux kernel, so abort after the * first match. */ - dev->archdata.iommu = smmu; + dev_iommu_priv_set(dev, smmu); break; } @@ -797,7 +797,7 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev) static void tegra_smmu_release_device(struct device *dev) { - dev->archdata.iommu = NULL; + dev_iommu_priv_set(dev, NULL); } static const struct tegra_smmu_group_soc * @@ -856,7 +856,7 @@ static struct iommu_group *tegra_smmu_group_get(struct tegra_smmu *smmu, static struct iommu_group *tegra_smmu_device_group(struct device *dev) { struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); - struct tegra_smmu *smmu = dev->archdata.iommu; + struct tegra_smmu *smmu = dev_iommu_priv_get(dev); struct iommu_group *group; group = tegra_smmu_group_get(smmu, fwspec->ids[0]); -- 2.27.0