Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp969386imm; Fri, 27 Jul 2018 09:04:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc5fpEV/+T4bL0RKWBPAZK33DAd3u7TsgxEj0Dh1Rd0QFo43pWzMJHSksJgt0a2oKoRZhQJ X-Received: by 2002:a63:375b:: with SMTP id g27-v6mr6765248pgn.59.1532707451034; Fri, 27 Jul 2018 09:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532707451; cv=none; d=google.com; s=arc-20160816; b=A9Sy08oQHbapuwgL7RVQGwNbrkljv/IID2d8xRyx2Z+V2OtOiyfSUcQ2tXv3knh4Hd ZeQKo3lIVcLwxCVtmghgMtHyY09WlWEhRi3Xo4x9tj19zo+AJ0r7AxmIGbZQqV86LYV3 1kStcfHkvqN0x7ATziO9780DGay2S50tMbpmJTGHTs1Bwt/Rtlzff6pr+vvIwylVCg5G 62LKDxPaNzdPR4yk572feshE02fk6zmHYwGjY4BshnLkatCQyf71zbCUBggessFUjNEG WnvZodJleq7ycUvRinvoDsFL5iPsljdAk/wO6JI00yKhDFvJzIGO0Adyicqh3/sdggD9 Lu1A== 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:arc-authentication-results; bh=rYEK0lLT5eMHu87STQ+1vahRMagi6V9/MlDN+b0ZVlc=; b=DUycfqYsZRcKC7Fsy6kMgU6gwY24IhLB37G9qeCbdnQwlz4XK8UaVTLipiRXoRrXET sZGMisnvTORdXJGURyebNni0TCLxxxEy1v72j0RcJ1m4FwHWvhchSNJC5QhWRcaEw2m/ vazmYS1yy1nPra7Nbjxg6ncel9Xp8DMrTb2EvDtaruwNBquYTxM5eU9Spq9e2jY8LG9+ /TZiqL8DJtQRjb5wQxB7i5z57q0dncD5cH7+3+qLCs+VuD6k9um4aQBTvOm3+V+bfAp6 JspDGMLcaIKjXTWlS9T+x11WnlaIl9IMk4hv5tYAKWLFh55SEBBfaF8M0GbHc9Mvg7DC HPuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8-v6si3670618pgq.432.2018.07.27.09.03.54; Fri, 27 Jul 2018 09:04:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388834AbeG0RZP (ORCPT + 99 others); Fri, 27 Jul 2018 13:25:15 -0400 Received: from foss.arm.com ([217.140.101.70]:45546 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388156AbeG0RZP (ORCPT ); Fri, 27 Jul 2018 13:25:15 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5068AED1; Fri, 27 Jul 2018 09:02:42 -0700 (PDT) Received: from [10.4.12.131] (e110467-lin.Emea.Arm.com [10.4.12.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 31CEF3F6A8; Fri, 27 Jul 2018 09:02:39 -0700 (PDT) Subject: Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU To: Dmitry Osipenko , Will Deacon , Joerg Roedel Cc: devicetree@vger.kernel.org, Mikko Perttunen , "Rafael J. Wysocki" , Nicolas Chauvet , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, Russell King , Rob Herring , Jonathan Hunter , linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org, Thierry Reding , Ben Skeggs , Catalin Marinas , nouveau@lists.freedesktop.org, Frank Rowand , linux-kernel@vger.kernel.org References: <20180726231624.21084-1-digetx@gmail.com> <20180727082512.lpvmeuvxnw3mpeym@8bytes.org> <20180727090328.GH28088@arm.com> <4164951.xGHfcFJ9uZ@dimapc> From: Robin Murphy Message-ID: Date: Fri, 27 Jul 2018 17:02:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <4164951.xGHfcFJ9uZ@dimapc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/07/18 15:10, Dmitry Osipenko wrote: > On Friday, 27 July 2018 12:03:28 MSK Will Deacon wrote: >> On Fri, Jul 27, 2018 at 10:25:13AM +0200, Joerg Roedel wrote: >>> On Fri, Jul 27, 2018 at 02:16:18AM +0300, Dmitry Osipenko wrote: >>>> The proposed solution adds a new option to the base device driver >>>> structure that allows device drivers to explicitly convey to the drivers >>>> core that the implicit IOMMU backing for devices must not happen. >>> >>> Why is IOMMU mapping a problem for the Tegra GPU driver? >>> >>> If we add something like this then it should not be the choice of the >>> device driver, but of the user and/or the firmware. >> >> Agreed, and it would still need somebody to configure an identity domain so >> that transactions aren't aborted immediately. We currently allow the >> identity domain to be used by default via a command-line option, so I guess >> we'd need a way for firmware to request that on a per-device basis. > > The IOMMU mapping itself is not a problem, the problem is the management of > the IOMMU. For Tegra we don't want anything to intrude into the IOMMU > activities because: > > 1) GPU HW require additional configuration for the IOMMU usage and dumb > mapping of the allocations simply doesn't work. Generally, that's already handled by the DRM drivers allocating their own unmanaged domains. The only problem we really need to solve in that regard is that currently the device DMA ops don't get updated when moving away from the managed domain. That's been OK for the VFIO case where the device is bound to a different driver which we know won't make any explicit DMA API calls, but for the more general case of IOMMU-aware drivers we could certainly do with a bit of cooperation between the IOMMU API, DMA API, and arch code to update the DMA ops dynamically to cope with intermediate subsystems making DMA API calls on behalf of devices they don't know the intimate details of. > 2) Older Tegra generations have a limited resource and capabilities in regards > to IOMMU usage, allocating IOMMU domain per-device is just impossible for > example. > > 3) HW performs context switches and so particular allocations have to be > assigned to a particular contexts IOMMU domain. I understand Qualcomm SoCs have a similar thing too, and AFAICS that case just doesn't fit into the current API model at all. We need the IOMMU driver to somehow know about the specific details of which devices have magic associations with specific contexts, and we almost certainly need a more expressive interface than iommu_domain_alloc() to have any hope of reliable results. Robin. > Some of the above is due to a SW driver model (and its work-in-progress > status), other is due to a HW model. So essentially we need a way for a driver > to tell the core not to mess with IOMMU stuff of drivers device behind the > drivers back. > > I'm not sure what you guys are meaning by the "firmware", could you elaborate > please? Do you mean the Open Firmware and hence the devicetree or what? > > > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu >