Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp57678imm; Wed, 5 Sep 2018 18:33:04 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbo9Fj4jiY+PZSs1SF+Esicw3CrIdWvqt9HjigzDJrEzayqtvHRkrz86f8FUSKIC2YhfCPR X-Received: by 2002:a17:902:d881:: with SMTP id b1-v6mr414400plz.191.1536197584179; Wed, 05 Sep 2018 18:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536197584; cv=none; d=google.com; s=arc-20160816; b=dvOiBVCxgHBNWJ6Po+CMSbXICBdFYBQBuvmaHDcuzn3AGGE0dfKESexB0Anlk61DJE VxIWwHkwnSrCoghYrrhOGBgjFuG0Qdgv5vQIIWvLnMgZCcx3XZAX1b0GoRATtXNktwl8 pXnDDZDlBsD2gSsazuACA5Y4Rc57NKSeCk+IJtht9I04D3EFMv9QLrM8QvSPxIrKBERf 5X9GEmqCEPaEnDRoqarvQEThCW22sjogSiICAsp7EUF9h4zb5RnjK2qt27Zt4+DilcKU e013l/oX5LZrmIpGHkid60ylNjmRUGLx6nJLa0izLtMTxyWI896g3DtJjWAIqIS1P1hG i0vg== 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:to:subject:cc; bh=R1ZgTt3ZAcBqkNPWmBp5KNUk0VbX14mrCEP388EPWQ4=; b=TGQlZi3TLJS7PBj7UL+RQ50aAvi44eEwjq3FrponbAk8WicgWv67v75BU6nSnwF729 BYH4n5RBFemuZ3FaQ27SqMd1cwTPB50XdDoitYU8DCpCBXmgxmYo9wVF+hAu97NC84r1 xjna2qcyRX7DN2SJIFsZgLlvHpf4H397reik8+ZIwM7kYQWxR61TMBfrKcWR29N3ZtRp Zz9C8uGtFMlCzUjDzVVSSu/HM/XJ6FWv30hjPnEkMDORaHCmshSplWeIVDgWegr1Nwxy LVQdHCnvqf50enJKWW+ylxWOve3QPvuqCbzPD4Df7QabGeKPo5ArEfsJILtqRUi6RiEB +hMg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si3638064plc.288.2018.09.05.18.32.48; Wed, 05 Sep 2018 18:33:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbeIFGDk (ORCPT + 99 others); Thu, 6 Sep 2018 02:03:40 -0400 Received: from mga01.intel.com ([192.55.52.88]:60497 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbeIFGDj (ORCPT ); Thu, 6 Sep 2018 02:03:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2018 18:30:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,334,1531810800"; d="scan'208";a="68728726" Received: from allen-box.sh.intel.com (HELO [10.239.161.122]) ([10.239.161.122]) by fmsmga008.fm.intel.com with ESMTP; 05 Sep 2018 18:30:45 -0700 Cc: baolu.lu@linux.intel.com, Joerg Roedel , David Woodhouse , Kirti Wankhede , "Raj, Ashok" , "Kumar, Sanjay K" , "Pan, Jacob jun" , Jean-Philippe Brucker , "Liu, Yi L" , "Sun, Yi Y" , "peterx@redhat.com" , "Bie, Tiwei" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH v2 00/10] vfio/mdev: IOMMU aware mediated device To: Alex Williamson , "Tian, Kevin" References: <20180830040922.30426-1-baolu.lu@linux.intel.com> <20180905131534.1e638e3e@t450s.home> From: Lu Baolu Message-ID: Date: Thu, 6 Sep 2018 09:29:42 +0800 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: <20180905131534.1e638e3e@t450s.home> 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 Hi, On 09/06/2018 03:15 AM, Alex Williamson wrote: > On Wed, 5 Sep 2018 03:01:39 +0000 > "Tian, Kevin" wrote: > >>> From: Lu Baolu [mailto:baolu.lu@linux.intel.com] >>> Sent: Thursday, August 30, 2018 12:09 PM >>> >> [...] >>> >>> In order to distinguish the IOMMU-capable mediated devices from those >>> which still need to rely on parent devices, this patch set adds a >>> domain type attribute to each mdev. >>> >>> enum mdev_domain_type { >>> DOMAIN_TYPE_NO_IOMMU, /* Don't need any IOMMU support. >>> * All isolation and protection >>> * are handled by the parent >>> * device driver with a device >>> * specific mechanism. >>> */ >>> DOMAIN_TYPE_ATTACH_PARENT, /* IOMMU can isolate and >>> protect >>> * the mdev, and the isolation >>> * domain should be attaced with >>> * the parent device. >>> */ >>> }; >>> >> >> ATTACH_PARENT is not like a good counterpart to NO_IOMMU. > > Please do not use NO_IOMMU, we already have a thing called > vfio-noiommu, enabled through CONFIG_VFIO_NOIOMMU and module parameter > enable_unsafe_noiommu_mode. This is much, much too similar and will > generate confusion. Sure. Will remove this confusion. > >> what about DOMAIN_TYPE_NO_IOMMU/DOMAIN_TYPE_IOMMU? whether >> to attach parent device is just internal logic. >> >> Alternatively DOMAIN_TYPE_SOFTWARE/DOMAIN_TYPE_HARDWARE, >> where software means iommu_domain is managed by software while >> the other means managed by hardware. > > I haven't gotten deep enough into the series to see how it's used, but > my gut reaction is that we don't need an enum, we just need some sort > of pointer on the mdev that points to an iommu_parent, which indicates > the root of our IOMMU based isolation, or is NULL, which indicates we > use vendor defined isolation as we have now. It works as long as we can distinguish IOMMU based isolation and the vendor defined isolation. How about making the iommu_parent points the device structure who created the mdev? If this pointer is NOT NULL we will bind the domain to the device pointed to by it, otherwise, handle it in the vendor defined way? Best regards, Lu Baolu > >> One side note to Alex - with multiple domain extension in IOMMU layer, >> this version combines IOMMU-capable usages in VFIO: PASID-based (as >> in scalable iov) and RID-based (as the usage of mdev wrapper on any >> device). Both cases share the common path - just binding the domain to the >> parent device of mdev. IOMMU layer will handle two cases differently later. > > Good, I'm glad you've considered the regular (RID) IOMMU domain and not > just the new aux domain. Thanks, > > Alex >