Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1388684pxa; Thu, 20 Aug 2020 10:00:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmseH5B7l/KSUe1w8DD83psgpJk/SxTdSX2f7Q6z8G2XfJb/kSJeYBWv7R+rZSvgzZp3cP X-Received: by 2002:a17:906:2542:: with SMTP id j2mr4081251ejb.442.1597942843795; Thu, 20 Aug 2020 10:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597942843; cv=none; d=google.com; s=arc-20160816; b=syPG9bwh8kTSl5nGlbu+6oN7F8Nr+xj2ff/yDEBFFiPtc9lsoKQzKV0j6ISnvYaE32 TQrOSG9Zy4sobeK0YTAdqIVrPdthqGUgqCEZtne3Ekd8ApsNXG4W/Y5av5tEKhsKB4zj Sj1hun425Blp8tpnarl1ezz4UcAYEQI0DmGH5ceOhthpHYqj1/YOeO9p+dKf6YxJN9ub VvhJwWTRTz3WedjgCbOnw+saLRwGXJmWAXGqf6XI/XQEpf68+4B5bUxQmZi+FmVKT31C HT5Kf0UqJTNd1UCv00fOw8DGq5OnDmJ+cU/Frs66I2jrRH/xin2n/ADyM1CzdmyKMKje lF7Q== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=HBuZCO258EFuWrX9LsdPKZdDO9g4pXgsV7zys7p50ss=; b=az+4FIyPv4MQ1uDwzL23FWWO2PW9P3knfGg372FvYsQlSitFuSUEaQZZX1BIOu6KJQ 0+xPAQ4zAPnRnUeRt0H0QOb8NKsO5Nm5HS+p1O/86JaOOLaHilj2tspBh5rIX0aV/m8R IZsxeyBet7KJi/Dfzm3GGlORIa9TPchWrzEoto7rl4r8JtqzagDj1z66AQxDbJaAAfxV X30ZfRXfxPupocFL7kRZOe95Bnwf/TJjFn8ySFEzRY5qp8A2UzWAAHGd62VmsELVvNUq wnhfEN/rlyYTSISgP8Q4+wBQ9i2mlEyIhZ7NYSJPCDBQslqLAEGnHJdOctFKYdaUeSxg E1Xg== 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 e12si1605875ejq.375.2020.08.20.10.00.19; Thu, 20 Aug 2020 10:00:43 -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 S1729605AbgHTQ6V (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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