Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1006490yba; Thu, 9 May 2019 09:13:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy25hb44CC7VtHWMABtUV8GYlK/HksfMBMiMejG+UOMrqq3cNoPvRbdRJcM9Q2Z4Z3TpknB X-Received: by 2002:a17:902:f215:: with SMTP id gn21mr6289887plb.194.1557418417568; Thu, 09 May 2019 09:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557418417; cv=none; d=google.com; s=arc-20160816; b=sXAqufA6V9sts9uC2Y3caMaPLxhVB5symELT7ssq/p6dZ/yb815R77TIRRsUr68DFL XJNWGLfIJ0PK5cTr/IOINCIWK4WBiiIXVvnJow9ttx9IQcZvjWQSQFSG0tM4kn/rHiFY kK28P6MHrbSrUjKKqXmQBqqmbZAwUmxHdNtvEX9CM4w0drndxM0mxtAN8OszcnmJ3jGu fusMWLQBWa/qfhBGiq7saEik4qwAZvxXfma+9YNhFtF1jQjG6Gl4Pss0nLBvffz6S/dC c8Q30nQO5hRsYFLFoW13hPEex37o7dEP+WanKEEvAik7z3Ijo4JkrSsgdNp0gm1+zZKQ bw+A== 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=lcJ/jzlUXKJ4l3k2HNnuLacA/aS7m+7xx/IfUQn97xg=; b=XwUSB/9Maeq1+mbK9vBaGbywtwzyWYUt/1axBMdlVsR7+OIIO+m18jxxf1o0qeMLNl F6k+8DtaEnFY1/iz5Fnj5DIIovPpdBmP9ln6YmXAAIKPuT1N3YDDJpyaJVUUonNx463X gM2iOyHD2L7nidB3ITBw/CrTvEM5rZNw6tgeYGYxmS6tY/hXyY22qJmdwc1//kqgARJJ flAbt+pBP2r3zYHX8ejncD5UyXYxdr2wrwB0vZa5mDk4ozi8RiWa+POc7O5aTpypl3z2 nUxp6vI0WzHN/lG7KPvynH7/VZeGRmzsYoPVTLq1n+kX4hRB17repAalsI+977QylX/X mE+g== 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 f12si3548097pgo.388.2019.05.09.09.13.20; Thu, 09 May 2019 09:13:37 -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 S1726861AbfEIQLr (ORCPT + 99 others); Thu, 9 May 2019 12:11:47 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45454 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbfEIQLq (ORCPT ); Thu, 9 May 2019 12:11:46 -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 47635374; Thu, 9 May 2019 09:11:46 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC37C3F6C4; Thu, 9 May 2019 09:11:44 -0700 (PDT) Subject: Re: [PATCH v3 1/8] iommu: Add ops entry for supported default domain type To: Lu Baolu , Tom Murphy Cc: "Tian, Kevin" , Ashok Raj , Dmitry Safonov , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, jacob.jun.pan@intel.com, David Woodhouse References: <20190429020925.18136-1-baolu.lu@linux.intel.com> <20190429020925.18136-2-baolu.lu@linux.intel.com> <3e0da076-4916-1a02-615c-927c1b3528b8@linux.intel.com> From: Robin Murphy Message-ID: <56205a21-c72f-a460-77a2-4bb4f46f6e08@arm.com> Date: Thu, 9 May 2019 17:11:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <3e0da076-4916-1a02-615c-927c1b3528b8@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/05/2019 03:30, Lu Baolu wrote: > Hi Robin, > > On 5/7/19 6:28 PM, Robin Murphy wrote: >> On 06/05/2019 16:32, Tom Murphy via iommu wrote: >>> The AMD driver already solves this problem and uses the generic >>> iommu_request_dm_for_dev function. It seems like both drivers have the >>> same problem and could use the same solution. Is there any reason we >>> can't have use the same solution for the intel and amd driver? >>> >>> Could we justĀ  copy the implementation of the AMD driver? It would be >>> nice to have the same behavior across both drivers especially as we >>> move to make both drivers use more generic code. >> >> TBH I don't think the API really needs to be involved at all here. >> Drivers can already not provide the requested default domain type if >> they don't support it, so as long as the driver can ensure that the >> device ends up with IOMMU or direct DMA ops as appropriate, I don't >> see any great problem with drivers just returning a passthrough domain >> when a DMA domain was requested, or vice versa (and logging a message >> that the requested type was overridden). The only type that we really >> do have to honour strictly is non-default (i.e. unmanaged) domains. > > I agree with you that we only have to honor strictly the non-default > domains. But domain type saved in iommu_domain is consumed in iommu.c > and exposed to user through sysfs. It's not clean if the iommu driver > silently replace the default domain. Right, I did get a bit ahead of myself there - the implicit step before that is to fix default domain allocation so that the core actually passes the relevant device which it has to hand, such that the IOMMU drivers *can* make the right decision up-front. Robin.