Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1460572imm; Wed, 8 Aug 2018 18:12:33 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx5IU9A5flpm3QPge1RMYYo2fnK6D3kPrbW778zEpEbNaArl7cFl8iu3yu3WTgDEAuaPllI X-Received: by 2002:a63:5e45:: with SMTP id s66-v6mr37771pgb.151.1533777152943; Wed, 08 Aug 2018 18:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533777152; cv=none; d=google.com; s=arc-20160816; b=qm8Y8CnX1Lb/Uj7b8307QqSxvUrOvtBkZCr5C8ROU/kzGnugd9YIctwYktG3bAoWnl sAOWgrbxzTT1lUqVSuHVT/2Cs2r9X1DKVRLl2Oq1yW+p879viJLdvo7cN4JoYIJxAoeF HbHJOXv1BQCqZF+MkQJakeV5f98YRtzqnl2NjJcjLQ94ybSoVQG103JhjZ0e0BffHNvj n5OY/LH8XwT6AJ73nbB4VyOT/uhHsL+qgdSvmva3jWMZOzej2bdbZaRX9RXOikj4E2so RqBm4USPfay6dcPxVsLWs6xdkaq6yx4b8nu6NPG8ox0DblDKWP7Ar8CHS1EmtXzuArTT rcPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=V9HE8uroZD5wrNbgO9IGVHfWSOX2r0xl+i5a2UwaeLo=; b=c5I2j0WbROvOSs5vjYpwZLVE93FlTk2HWBT1+4zaijaHiLj3SRjRt8okxJiaEFgQSX j0mkahczmWZG+gl2MC/MwDp79dI/+XGAt4xghTtoL0VERTBHPoMg2NLYb8nlorjCWmCM jau0fkvReLzG/msueVhJdb/Juwnws7+VmoLlFw/IcZf8Amos0Nf0LfCiP875+7qune9G QXHvO4BkOtnRVpryEaflVvnOL5PfY7xV5WEN4YIbIVvTCoQ9aqTxtxM4gYnPMmIGDaWa ntLz93Q+NUTLjF4XxeUlekOSCfghI85b26IlmjB5AlrO39tj+dIeGg9+CcUX8ruMX1ak 487Q== 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 f62-v6si6354240pfb.218.2018.08.08.18.12.18; Wed, 08 Aug 2018 18:12:32 -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 S1731993AbeHIDd2 (ORCPT + 99 others); Wed, 8 Aug 2018 23:33:28 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10646 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730262AbeHIDd2 (ORCPT ); Wed, 8 Aug 2018 23:33:28 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 03EFDD5A49D14; Thu, 9 Aug 2018 09:11:11 +0800 (CST) Received: from localhost (10.67.212.75) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 9 Aug 2018 09:11:02 +0800 Date: Thu, 9 Aug 2018 09:09:38 +0800 From: Kenneth Lee To: Joerg Roedel CC: Kenneth Lee , Jonathan Corbet , Herbert Xu , "David S . Miller" , Alex Williamson , Hao Fang , Zhou Wang , Zaibo Xu , Philippe Ombredanne , "Greg Kroah-Hartman" , Thomas Gleixner , , , , , , , Lu Baolu , Sanjay Kumar , Subject: Re: [RFC PATCH 2/7] iommu: Add share domain interface in iommu for spimdev Message-ID: <20180809010938.GH91035@Turing-Arch-b> References: <20180801102221.5308-1-nek.in.cn@gmail.com> <20180801102221.5308-3-nek.in.cn@gmail.com> <20180808091354.ppqgineql3pufwwr@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180808091354.ppqgineql3pufwwr@8bytes.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 08, 2018 at 11:13:54AM +0200, Joerg Roedel wrote: > Date: Wed, 8 Aug 2018 11:13:54 +0200 > From: Joerg Roedel > To: Kenneth Lee > CC: Jonathan Corbet , Herbert Xu > , "David S . Miller" , > Alex Williamson , Kenneth Lee > , Hao Fang , Zhou Wang > , Zaibo Xu , Philippe > Ombredanne , Greg Kroah-Hartman > , Thomas Gleixner , > linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, > linux-crypto@vger.kernel.org, iommu@lists.linux-foundation.org, > kvm@vger.kernel.org, linux-accelerators@lists.ozlabs.org, Lu Baolu > , Sanjay Kumar , > linuxarm@huawei.com > Subject: Re: [RFC PATCH 2/7] iommu: Add share domain interface in iommu for > spimdev > User-Agent: NeoMutt/20170421 (1.8.2) > Message-ID: <20180808091354.ppqgineql3pufwwr@8bytes.org> > > On Wed, Aug 01, 2018 at 06:22:16PM +0800, Kenneth Lee wrote: > > From: Kenneth Lee > > > > This patch add sharing interface for a iommu_group. The new interface: > > > > iommu_group_share_domain() > > iommu_group_unshare_domain() > > > > can be used by some virtual iommu_group (such as iommu_group for spimdev) > > to share their parent's iommu_group. > > > > When the domain of the group is shared, it cannot be changed before > > unshared. In the future, notification can be added if update is required. > > >From the description or the patch I don't really get why this is needed. > Please update the description and make a case for this API addition. > Yes, I will add more description in next version. The idea here is: 1. iommu_domain is the setting of the IOMMU(the unit) of an iommu_group. 2. The iommu_group originally uses a default domain or a created one (e.g. by vfio) as its effective domain. There is only one user for a domain. If a device is bound to vfio driver, it uses the new created domain. And if it is unbound from vfio driver, it is switched back to the default domain. 3. But for spimdev, we create an mdev which share it parent device's IOMMU. That means, the parent device (along with its iommu group) will continue use its iommu_domain, and the mdev will use the same at the same time. 4. This API, is to tell the iommu_group that the domain is shared by the spimdev. And it should be changed before it is unshared. Cheers > > Joerg -- -Kenneth(Hisilicon)