Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1315143pxa; Thu, 20 Aug 2020 08:11:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaKNmQPTb7quq18yBBfxEVC93UBFJ2IU6Ak/Rog4xgI6u9iG1bcsJJPCIBu5DHyS4LFy7Z X-Received: by 2002:a50:935a:: with SMTP id n26mr3349366eda.107.1597936308007; Thu, 20 Aug 2020 08:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597936308; cv=none; d=google.com; s=arc-20160816; b=rSFwg4pJXMiRYAV+UOf7sKyD4hF4U2hWsLwwc2BRjts+f1bSs3HtS50KQsgNfQUM70 1fv+Esg8aguXlB4naYYwESNBvkOAfwOOCIFfiEqYkt7sWCExr1BZf9BqkVep5xZs+VgC lrSgpJuzyI3lzCjp/nLtCshtFsoNPbN235IO+kwdg3jJZbvH5k5FGt3Ay2DnTNheURqs ax4efLNncrqJkIWZmj9kC3M9vnsdEVKrQPVlMdrcVopeTYPx9DmF+BcEs99JMzF/WV9j SijIZXtNlxJZL7JOKZG/T76WRSOOG15Ak8yhyfp9i4VpJ8PguQQQ3M2dL0U6Fq/K+HkN IOwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jpnMoPczaIFGSWWcXNmM2x413mFgCQ4g3j/wBQvdu1k=; b=zLhSGpQgNmdH+Y5cvvtaVXhua55QClFvEdOdGVl+5ZeA1QqsIrudJFYvM7AuRFc5kH j0o84BJ99Kx0M6CYs+P2JyNK4NwS1OCzhTso/H4KmX35zhqR2lgBcszALlbiarkhDHRE LzYzOyPLYr4tQJG2C3K7OuBUHX25KizuqY6ZdbkzjRLbwfmgZtptTC5tMpXXiRyDO383 svfNdPGn/KAW3VT5EcJ+K3YCT2S4HSvelqnZGcbjiH/Ht7LkYP+HlBreV3o3kVTKzwI4 zUvunoMvr9QNGqKIjYfNSPvLqStaCW71w/m/8OzKQ433WJ0/6k6aSEd37EAu55uktY15 EdRg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si1503815edq.511.2020.08.20.08.11.22; Thu, 20 Aug 2020 08:11:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728751AbgHTPJh (ORCPT + 99 others); Thu, 20 Aug 2020 11:09:37 -0400 Received: from foss.arm.com ([217.140.110.172]:41062 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728698AbgHTPJd (ORCPT ); Thu, 20 Aug 2020 11:09:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB83F1476; Thu, 20 Aug 2020 08:09:31 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 539A53F6CF; Thu, 20 Aug 2020 08:09:28 -0700 (PDT) From: Robin Murphy To: hch@lst.de, joro@8bytes.org, linux@armlinux.org.uk Cc: will@kernel.org, inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, m.szyprowski@samsung.com, agross@kernel.org, bjorn.andersson@linaro.org, thierry.reding@gmail.com, jonathanh@nvidia.com, vdumpa@nvidia.com, digetx@gmail.com, matthias.bgg@gmail.com, yong.wu@mediatek.com, geert+renesas@glider.be, magnus.damm@gmail.com, t-kristo@ti.com, s-anna@ti.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/18] iommu/msm: Add IOMMU_DOMAIN_DMA support Date: Thu, 20 Aug 2020 16:08:29 +0100 Message-Id: <93d7de3533cfd952aecd6198b9221d7a58c0e521.1597931876.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.28.0.dirty In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that arch/arm is wired up for default domains and iommu-dma, implement the corresponding driver-side support for DMA domains. Signed-off-by: Robin Murphy --- drivers/iommu/msm_iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 3615cd6241c4..f34efcbb0b2b 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -314,13 +315,16 @@ static struct iommu_domain *msm_iommu_domain_alloc(unsigned type) { struct msm_priv *priv; - if (type != IOMMU_DOMAIN_UNMANAGED) + if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) return NULL; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) goto fail_nomem; + if (type == IOMMU_DOMAIN_DMA && iommu_get_dma_cookie(&priv->domain)) + goto fail_nomem; + INIT_LIST_HEAD(&priv->list_attached); priv->domain.geometry.aperture_start = 0; @@ -339,6 +343,7 @@ static void msm_iommu_domain_free(struct iommu_domain *domain) struct msm_priv *priv; unsigned long flags; + iommu_put_dma_cookie(domain); spin_lock_irqsave(&msm_iommu_lock, flags); priv = to_msm_priv(domain); kfree(priv); -- 2.28.0.dirty