From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51344C433DF for ; Thu, 20 Aug 2020 16:58:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3788B2072D for ; Thu, 20 Aug 2020 16:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729219AbgHTQ6V (ORCPT ); Thu, 20 Aug 2020 12:58:21 -0400 Received: from foss.arm.com ([217.140.110.172]:42882 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbgHTQ6V (ORCPT ); Thu, 20 Aug 2020 12:58:21 -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 EF2C030E; Thu, 20 Aug 2020 09:58:19 -0700 (PDT) Received: from [10.57.40.122] (unknown [10.57.40.122]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 410683F66B; Thu, 20 Aug 2020 09:58:15 -0700 (PDT) Subject: Re: [PATCH 10/18] iommu/msm: Add IOMMU_DOMAIN_DMA support To: Rob Clark Cc: Christoph Hellwig , Joerg Roedel , Russell King - ARM Linux , Geert Uytterhoeven , dri-devel , Bjorn Andersson , Matthias Brugger , Thierry Reding , Laurent Pinchart , digetx@gmail.com, Suman Anna , Will Deacon , Marek Szyprowski , "moderated list:ARM/S5P EXYNOS AR..." , Magnus Damm , Kyungmin Park , Jonathan Hunter , Andy Gross , Yong Wu , linux-media@vger.kernel.org, linux-arm-msm , Krishna Reddy , "moderated list:ARM/Mediatek SoC..." , linux-tegra@vger.kernel.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Seung-Woo Kim , Linux Kernel Mailing List , t-kristo@ti.com, iommu@lists.linux-foundation.org References: <93d7de3533cfd952aecd6198b9221d7a58c0e521.1597931876.git.robin.murphy@arm.com> From: Robin Murphy Message-ID: Date: Thu, 20 Aug 2020 17:58:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On 2020-08-20 16:55, Rob Clark wrote: > Side note, I suspect we'll end up needing something like > 0e764a01015dfebff8a8ffd297d74663772e248a .. if someone can dig a 32b > device out of the closet and dust it off, the fix is easy enough. > Just wanted to mention that here so anyone with a 32b device could > find what is needed. FWIW there shouldn't be any material change here - the generic default domain is installed under the same circumstances as the Arm dma_iommu_mapping was, so if any platform does have an issue, then it should already have started 4 years with f78ebca8ff3d ("iommu/msm: Add support for generic master bindings"). Robin. > > BR, > -R > > On Thu, Aug 20, 2020 at 8:09 AM Robin Murphy wrote: >> >> 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 >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel