Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1464945ybb; Thu, 9 Apr 2020 02:40:43 -0700 (PDT) X-Google-Smtp-Source: APiQypK2L8BdPn1YBD/hkNxO9MeGiyeYCKVLAo4eBqJu0AKbDvq8wSWuGu+f6l0LdtdmroL15oE6 X-Received: by 2002:a4a:625b:: with SMTP id y27mr9336096oog.70.1586425243850; Thu, 09 Apr 2020 02:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586425243; cv=none; d=google.com; s=arc-20160816; b=HxcbwBSRrsawkoJE7cXXK/1eMsMPpwvb6byoSRilK3GxxuchQBqVhRGi4xVMU4R1vi At7Img1Wf2Hw//Z4vSGLK2Z2iqnh2mY2iSgJfEbajGyjLemtkY7LJvx5+2cDwcJIjftN OLgMflLUSpyHDsCa3eKbGPVdNRC6wCxSwhv5k54ONBKqSS1DhnqUefrG0v+26MYXejOm affjeS1ijpv2qyUxyrBOR1vSB8RB+Jd/Q58wuJqZPR003tc6Cm/wzbOCQTpG0sSs4GG6 IHEvPIXgksctdCxolDfxe0mAcKbDknZ6SLbbaU9uCmdpqDPZiucwN3smDnJSav4IN6Wd MXig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TUDoLKMMdHMR1rZNFcHOOtCZYFU9bh9JO/aemHvhjFk=; b=X1Enz5Py8QteKxm9F/sSgPSlWlt0RYn8tHksdXl2fR7tKkb8YpS3RSXbnP9mMvwmI9 uqCBoqdU4dderJriGrkf/Ooteyh1adn8pBI869FI/bECCFYWFupbNcjPpqwKAqa+wqGp fPB55fUb475wxk8An8Hvr6NunzN7E/cp9lPugG+srx6xMUfmpKNUrOCsyE2FM1eZcaZV wOfauH3i0Dm+scCUZsbIeHEh5LsD2x/Fc4bhW5EYUSqa1k7biCR6ZI+kJ9UW3lbxOr0J VadDPwCxb7soIXrlNRZcCWelHNxb1FcC33HjTh+iqNDQ8JU4Vr9+vyRcsGhlS0LT0zX2 Q2CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jYpPR8OT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h82si2039827oia.187.2020.04.09.02.40.29; Thu, 09 Apr 2020 02:40:43 -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; dkim=pass header.i=@linaro.org header.s=google header.b=jYpPR8OT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbgDIJit (ORCPT + 99 others); Thu, 9 Apr 2020 05:38:49 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46595 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbgDIJis (ORCPT ); Thu, 9 Apr 2020 05:38:48 -0400 Received: by mail-wr1-f68.google.com with SMTP id f13so4553400wrm.13 for ; Thu, 09 Apr 2020 02:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TUDoLKMMdHMR1rZNFcHOOtCZYFU9bh9JO/aemHvhjFk=; b=jYpPR8OTb2GGh/MMhOBz3qkV5a8N2A6Gz3Of3JWdBmSlWODObZq+oeuRnxnFnyrov1 TALT9vbCUEF14fW9cphDRYFxAFq4fWeB/IBODCAdEBKDh1i80RzE3AkmZiKSk+aIrFQm 3AARvtT5Kb0HTFBjcA4VwdDfk1x0QFZmiWIizxLG18zsQDj31PwUpJhjs9dfPzp+X4La /AmaK5dH9ZSPvQueveNNFLTAOapbu+XgTg/y0LNqXd9T7Vub0E5dmLiYcLLDefOeqmaj NaU5ezsjDcIgctN7UpNnTD7r/Sn/F2KpybWn7ajy+B7uS5/Ojud58INLA7awb4/CPxNg w33A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TUDoLKMMdHMR1rZNFcHOOtCZYFU9bh9JO/aemHvhjFk=; b=s5mL3XRZLCSfvuNGsRiCzJ2v7hi0/76ZQH1WOowrE7ADxeOXodrNqXZTOj5f+3OKyB cTn+0j3R7THr6Wrk5UFuqgNtHoavCQKVHXx91oRP9no6XiCCilY2zx+wQ3CxfHd6RrP+ lHnkbrnHizfOBwpEs3tvG5Fp7tBGirWK7JmBwUA1qia8uOSI/rOrz2bJHnklKQ+sgxYy KSlDdVjlYTl+6K5K/ghRN2fvAqkouLTfFzafFUj+EG/bQaG4uF3/X/JynYcg2moCZpPp pfCI/FAA70xq6YzutkmbalNoZ3tTPKd9iYzwswuTP3DFJJFWPhoU726H0DwjHHKYZy3w OdMw== X-Gm-Message-State: AGi0PubQmUB5DpAUerDKIPAuMfjUh6rpAiuOv6AJUMUNNQrwx2lRduzC 1XUvpY99o8IG+cWwzmFmlXvtbA== X-Received: by 2002:a5d:5143:: with SMTP id u3mr13924339wrt.64.1586425127458; Thu, 09 Apr 2020 02:38:47 -0700 (PDT) Received: from myrica ([2001:171b:226b:54a0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id m8sm2922990wmc.28.2020.04.09.02.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2020 02:38:46 -0700 (PDT) Date: Thu, 9 Apr 2020 11:38:39 +0200 From: Jean-Philippe Brucker To: "Liu, Yi L" Cc: "Tian, Kevin" , "alex.williamson@redhat.com" , "eric.auger@redhat.com" , "jacob.jun.pan@linux.intel.com" , "joro@8bytes.org" , "Raj, Ashok" , "Tian, Jun J" , "Sun, Yi Y" , "peterx@redhat.com" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Wu, Hao" Subject: Re: [PATCH v1 6/8] vfio/type1: Bind guest page tables to host Message-ID: <20200409093839.GH2435@myrica> References: <1584880325-10561-1-git-send-email-yi.l.liu@intel.com> <1584880325-10561-7-git-send-email-yi.l.liu@intel.com> <20200403083407.GB1269501@myrica> <20200409082846.GE2435@myrica> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 09, 2020 at 09:15:29AM +0000, Liu, Yi L wrote: > > From: Jean-Philippe Brucker > > Sent: Thursday, April 9, 2020 4:29 PM > > To: Liu, Yi L > > > > On Tue, Apr 07, 2020 at 10:33:25AM +0000, Liu, Yi L wrote: > > > Hi Jean, > > > > > > > From: Jean-Philippe Brucker < jean-philippe@linaro.org > > > > > Sent: Friday, April 3, 2020 4:35 PM > > > > Subject: Re: [PATCH v1 6/8] vfio/type1: Bind guest page tables to host > > > > > > > > On Thu, Apr 02, 2020 at 08:05:29AM +0000, Liu, Yi L wrote: > > > > > > > > > static long vfio_iommu_type1_ioctl(void *iommu_data, > > > > > > > > > default: > > > > > > > > > return -EINVAL; > > > > > > > > > } > > > > > > > > > + > > > > > > > > > + } else if (cmd == VFIO_IOMMU_BIND) { > > > > > > > > > > > > > > > > BIND what? VFIO_IOMMU_BIND_PASID sounds clearer to me. > > > > > > > > > > > > > > Emm, it's up to the flags to indicate bind what. It was proposed to > > > > > > > cover the three cases below: > > > > > > > a) BIND/UNBIND_GPASID > > > > > > > b) BIND/UNBIND_GPASID_TABLE > > > > > > > c) BIND/UNBIND_PROCESS > > > > > > > > > > > > > > So it's called VFIO_IOMMU_BIND. > > > > > > > > > > > > but aren't they all about PASID related binding? > > > > > > > > > > yeah, I can rename it. :-) > > > > > > > > I don't know if anyone intends to implement it, but SMMUv2 supports > > > > nesting translation without any PASID support. For that case the name > > > > VFIO_IOMMU_BIND_GUEST_PGTBL without "PASID" anywhere makes more > > sense. > > > > Ideally we'd also use a neutral name for the IOMMU API instead of > > > > bind_gpasid(), but that's easier to change later. > > > > > > I agree VFIO_IOMMU_BIND is somehow not straight-forward. Especially, it may > > > cause confusion when thinking about VFIO_SET_IOMMU. How about using > > > VFIO_NESTING_IOMMU_BIND_STAGE1 to cover a) and b)? And has another > > > VFIO_BIND_PROCESS in future for the SVA bind case. > > > > I think minimizing the number of ioctls is more important than finding the > > ideal name. VFIO_IOMMU_BIND was fine to me, but if it's too vague then > > rename it to VFIO_IOMMU_BIND_PASID and we'll just piggy-back on it for > > non-PASID things (they should be rare enough). > maybe we can start with VFIO_IOMMU_BIND_PASID. Actually, there is > also a discussion on reusing the same ioctl and vfio structure for > pasid_alloc/free, bind/unbind_gpasid. and cache_inv. how about your > opinion? Merging bind with unbind and alloc with free makes sense. I'd leave at least invalidate a separate ioctl, because alloc/bind/unbind/free are setup functions while invalidate is a runtime thing and performance sensitive. But I can't see a good reason not to merge them all together, so either way is fine by me. Thanks, Jean