Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp629901pxa; Thu, 27 Aug 2020 11:19:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcjX078kPyD26et5oWwrbbhDHLE0kZEjjVNdo2gbThf9KxyaUFRgbE7ljEMqt3/meW0AMM X-Received: by 2002:a17:906:eda2:: with SMTP id sa2mr23435878ejb.166.1598552367546; Thu, 27 Aug 2020 11:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598552367; cv=none; d=google.com; s=arc-20160816; b=05RMUgKBYcbaaF6rKiQnYmotIVvZepSNERlOlUxmlgJt2cuYnxuSCD+U64WsFCi+CB AdPXUmnDUEJgfp3r2qmZK3FyumPohtWwFO7OkoaH6a87omJbgOC9EqkAIHH+urE20iMN rpOb3nO+gJf8L/Esh5088TN8G7UPBpmrt/4h6Ma7AGYaOtTOjAfiwBvO5XXEG+JVfBCO 67TIDEoPSj1u/gKmhtfKOTO5Ofe2At4ho4ImvC+D/S6yb+IszhXDMNQgDBQxOCgLPQ2q uopYcyGyuvBKwqOcwC3lH4h4lLr6sCM8GxEiFiK7dwT2goseFayFcg3ZPKhI8AVM6SMm l0QQ== 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=N6iXbhYclqmXzx5c9Wu7DTONYs3memP5EQnQskJPI7U=; b=YmPvq46X6hT1Wy4WePGGNNO/EqXOTG4D0F428Rh4vADnzlvtcGWlO/SYcCuG4fhq45 R2dL1192P89sSjfajyZF8lWXYtAanpnvDqD4ZAWzI37tfsPoDrhmwx2yvxJvwu5dbodi +Ajk4Yd/Vy7L+r1k5ISKCn1PHl3Sz0VyNdlM3xjRkmO6Ok857SkRbx0nQG6C2g2FdyyR EXmg3qppMAfSOh1BBuFs5+Me+U7pYJKxE8KC6uNOc3oegHGcDIdiPCOlyNJEaOqGpQZg FSibpkNPFtvt2d+nhCOQ/zdfMPje9qKA4czCpc2FGmpIrOA/bw3f2N3WOo6EwSHnp68f gWSQ== 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 u1si2057751edd.388.2020.08.27.11.19.04; Thu, 27 Aug 2020 11:19:27 -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 S1727024AbgH0SST (ORCPT + 99 others); Thu, 27 Aug 2020 14:18:19 -0400 Received: from foss.arm.com ([217.140.110.172]:32922 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbgH0SSS (ORCPT ); Thu, 27 Aug 2020 14:18:18 -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 35068101E; Thu, 27 Aug 2020 11:18:17 -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 C62533F68F; Thu, 27 Aug 2020 11:18:13 -0700 (PDT) Subject: Re: [PATCH 13/18] iommu/tegra: Add IOMMU_DOMAIN_DMA support To: Thierry Reding Cc: geert+renesas@glider.be, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, laurent.pinchart@ideasonboard.com, digetx@gmail.com, will@kernel.org, hch@lst.de, linux-samsung-soc@vger.kernel.org, magnus.damm@gmail.com, linux@armlinux.org.uk, jonathanh@nvidia.com, agross@kernel.org, kyungmin.park@samsung.com, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, inki.dae@samsung.com, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, t-kristo@ti.com, iommu@lists.linux-foundation.org References: <20200827154502.GA1660457@ulmo> From: Robin Murphy Message-ID: Date: Thu, 27 Aug 2020 19:18: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: <20200827154502.GA1660457@ulmo> Content-Type: text/plain; charset=windows-1252; 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-27 16:45, Thierry Reding wrote: > On Thu, Aug 20, 2020 at 04:08:32PM +0100, 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/tegra-smmu.c | 37 +++++++++++++++++++++---------------- >> 1 file changed, 21 insertions(+), 16 deletions(-) > > We can't do that yet because it will currently still break for use-cases > such as display where we don't properly set up identity mappings during > boot. The result is that the dma-iommu code will enable translations > before the driver gets a chance to set up any mappings and if the > display controller was left on by the bootloader, scanning out a splash > screen, this causes faults between the point where dma-iommu is being > set up for the display controller and where the display controller > starts mapping its own buffers (rather than the ones mapped by the > bootloader). Rest assured that I understand the situation all too well ;) As with tegra-gart, the unspoken point here is that since tegra-smmu implements of_xlate(), then arm_setup_iommu_dma_ops() must already be causing the exact same problem, no? This patch only seeks to move any existing behaviour over to the common backend, regardless of whether it was ever really appropriate in the first place. > That said, I do have a series that I've been carrying around for longer > than I've wanted that does exactly this for Tegra SMMU and I'd prefer if > you could drop this particular change from your series so that I can > keep working on resolving the identity mapping issues first. That would mean you'd see a functional change from the final patch, wherein nothing would ever be able to get translation unless drivers do their own explicit IOMMU API management. If you definitely want that change then OK, but it would still be nice to do it "properly" with IOMMU_DOMAIN_IDENTITY support, rather than just forcibly failing default domain allocation. I'm having a go at reworking the tegra-gart patch in that direction, so I can certainly try it for tegra-smmu as well. Robin.