From patchwork Fri Feb 18 11:39:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Perttunen X-Patchwork-Id: 12751410 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 226B5C433F5 for ; Fri, 18 Feb 2022 12:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1NVc33FLUUCkTXZbMRu524mxcM5aHnAvIj7s+afoC98=; b=bFMzE0e2Sj5/6A xPlvZJtF4MHX4ZbI4f1gnbcpYjPZ+WrrFvEIvOQ9pUnFuy1E/ZzIr4B9rzV/h7xL4LdHIdzWt0LGZ Rf8wSZsP0Ml3EBiaTfEjZOdRhKvorX9PVlkih8EUE8vYIAbnBVLCnB+xWazp4eap1ZOuHGpFaMP+t VLjqZffRIFXNswWs2vmIp73z7B116eMPNpwBZJCyvyFDltYpz1Psc52X/DnvS7I9ZSPJGmAPhVNBi 9jSc0KiAzKGtZJoa87rOtfjOaypVG7VPvZs3CalkkAYND0j+wjHTZGwKQ8F26RLp7ajgioCgmNvYm VeV7wP/P38fzmLyQZw8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL2UE-00EFJF-0Y; Fri, 18 Feb 2022 12:35:47 +0000 Received: from mail.kapsi.fi ([2001:67c:1be8::25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL1g9-00E3yn-1W for linux-arm-kernel@lists.infradead.org; Fri, 18 Feb 2022 11:44:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=J+rRNDls/ju+huBYt5djRYvtPipgQzrZeloYiORvFeI=; b=LENxateumiBnveV23r6262JWWv 0OrHv3wH+LWMNIFvJUppfim0dTHplEZeIabcBg7VEAy2aNlqY4ASntZPaA2/+r1r33SbICe15l31e 0Tvy2U7Ai/62EcYKgq1i975L6B3NEO16sLIpAifsvEE8XGEbe1xCzS/h7osUBRArb+l7UcMvpCUdz OY2C02VjiYM9oeFM7+RaEIyy/K8QrQDOsnw+SD0NtuNPyGisV0q8Z4E4xq+A1i5BP+wLY9LGX126u TuLgaafAiqhRrTEo8if7MGK8F0UHZdLog7niuwSW/ngElXzJbBzvTakxv3azd4qeQAra3WbHX1bLJ 3HsIOewA==; Received: from 91-158-25-70.elisa-laajakaista.fi ([91.158.25.70] helo=toshino.localdomain) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1nL1fq-0006eP-7M; Fri, 18 Feb 2022 13:43:42 +0200 From: Mikko Perttunen To: thierry.reding@gmail.com, jonathanh@nvidia.com, joro@8bytes.org, will@kernel.org, robh+dt@kernel.org, robin.murphy@arm.com Cc: linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mikko Perttunen Subject: [PATCH v3 5/9] iommu/arm-smmu: Attach to host1x context device bus Date: Fri, 18 Feb 2022 13:39:48 +0200 Message-Id: <20220218113952.3077606-6-mperttunen@nvidia.com> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220218113952.3077606-1-mperttunen@nvidia.com> References: <20220218113952.3077606-1-mperttunen@nvidia.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 91.158.25.70 X-SA-Exim-Mail-From: mperttunen@nvidia.com X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_034401_298720_AD632C3A X-CRM114-Status: GOOD ( 11.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Set itself as the IOMMU for the host1x context device bus, containing "dummy" devices used for Host1x context isolation. Signed-off-by: Mikko Perttunen --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 4bc75c4ce402..23082675d542 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -39,6 +39,7 @@ #include #include +#include #include "arm-smmu.h" @@ -2051,8 +2052,20 @@ static int arm_smmu_bus_init(struct iommu_ops *ops) goto err_reset_pci_ops; } #endif +#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS + if (!iommu_present(&host1x_context_device_bus_type)) { + err = bus_set_iommu(&host1x_context_device_bus_type, ops); + if (err) + goto err_reset_fsl_mc_ops; + } +#endif + return 0; +err_reset_fsl_mc_ops: __maybe_unused; +#ifdef CONFIG_FSL_MC_BUS + bus_set_iommu(&fsl_mc_bus_type, NULL); +#endif err_reset_pci_ops: __maybe_unused; #ifdef CONFIG_PCI bus_set_iommu(&pci_bus_type, NULL);