Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp343512ybb; Wed, 1 Apr 2020 00:48:37 -0700 (PDT) X-Google-Smtp-Source: APiQypITSFVnNE59JK7At8MGSeCQd1D9eAcHtHnkIZYVf9YjCdJjUB3lKZi43DgCDEttiST+p/FL X-Received: by 2002:aca:a94a:: with SMTP id s71mr1796779oie.152.1585727317770; Wed, 01 Apr 2020 00:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585727317; cv=none; d=google.com; s=arc-20160816; b=dqwwJSNLRNwD5nU6335hwL/EhEsTIRFSD6tLOlJfet3QIwK34P57areIQq7B12/eSC 0rFtjbc5iQyvNCQW0fcb1gxYcTZ8sW6O8yipMSt0reGALhDwPEkUHuFbxHSdd6FLagOb 0IlBXpVUvqdrKsM0w7DUyLFuScQESiqukc/Y/W+KqsXz0xLweCeEdoPx9rggbBt4Dnkj io9c6uYrif6SMXgKGqlg8ndwQGryOX/s0bpPaaPbVAD+JOoOYYpX6Z81+5JopFKefMxM kfI3ZSLCJCsp7ZvdDwlEOvNRzVR4AvGsBFF70sKWBoRJZnIs+b0yUbtD0JYMPWRaMg1T C9JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=tsRe2spdLh4zUA1KlAXwrmcWyeiGKEeNwyKcFe5YuKw=; b=ZaFxXRdKAv+quCdNH0//uY92LFJdNzbYiFXv2LaTub5ry3zr7V6lcLeVEWmdVWU6sl i6psQ7NEwfEo+osM61PA18ibqPAXtBDdjGNGPsGQSyH3houQerAzahHZNZmWDh4+6dnS HG437NK86+2b7ZxBGxzPPQuiRk7WKwal11q7S8ki3cSOMVf+TWx+EoDvwDFgRX0BbK1q WyH8sy9Zb7GO7ckhTjaRSkfZiyd5tvPDYTf0LaEpZdT+4b//fyQwFIzWMlgFiBnKGwcr 0l8z1slhw/4+wvEpDHjT+ZUgn0qHNKx34fBKYYkpY54RGKAG8VER/xoqgSDR/Cf7gNu2 CHZQ== 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 k66si598352oif.29.2020.04.01.00.48.26; Wed, 01 Apr 2020 00:48: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731981AbgDAHrE convert rfc822-to-8bit (ORCPT + 99 others); Wed, 1 Apr 2020 03:47:04 -0400 Received: from mga07.intel.com ([134.134.136.100]:53302 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731680AbgDAHrE (ORCPT ); Wed, 1 Apr 2020 03:47:04 -0400 IronPort-SDR: V9cWGyKGoKxV05Gg2SzgpLY5xUr8U5zPm2i32aGe9ZKl1hSjhT7fY/w6/2CJFquUWpUvbMVOYN uCpDDEfVT3jQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2020 00:47:03 -0700 IronPort-SDR: NHaDS5kwOgpn2UXqAATGI0FB+kkIK0rivSsuwBzCAaIv1gOnArckVCyIlC3hO8hkeIH4KzNgx7 1kP6WktN7tTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,330,1580803200"; d="scan'208";a="242153558" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga008.fm.intel.com with ESMTP; 01 Apr 2020 00:47:02 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 1 Apr 2020 00:47:02 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 1 Apr 2020 00:47:02 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.225]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.129]) with mapi id 14.03.0439.000; Wed, 1 Apr 2020 15:46:38 +0800 From: "Liu, Yi L" To: "Tian, Kevin" , "alex.williamson@redhat.com" , "eric.auger@redhat.com" CC: "jacob.jun.pan@linux.intel.com" , "joro@8bytes.org" , "Raj, Ashok" , "Tian, Jun J" , "Sun, Yi Y" , "jean-philippe@linaro.org" , "peterx@redhat.com" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Wu, Hao" Subject: RE: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to userspace Thread-Topic: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to userspace Thread-Index: AQHWAEUdmZ6qeWVhq0GPreoHiPHgtahgaLaAgAOJ0aA= Date: Wed, 1 Apr 2020 07:46:37 +0000 Message-ID: References: <1584880325-10561-1-git-send-email-yi.l.liu@intel.com> <1584880325-10561-4-git-send-email-yi.l.liu@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Tian, Kevin > Sent: Monday, March 30, 2020 5:44 PM > To: Liu, Yi L ; alex.williamson@redhat.com; > Subject: RE: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to > userspace > > > From: Liu, Yi L > > Sent: Sunday, March 22, 2020 8:32 PM > > > > From: Liu Yi L > > > > This patch reports PASID alloc/free availability to userspace (e.g. > > QEMU) thus userspace could do a pre-check before utilizing this feature. > > > > Cc: Kevin Tian > > CC: Jacob Pan > > Cc: Alex Williamson > > Cc: Eric Auger > > Cc: Jean-Philippe Brucker > > Signed-off-by: Liu Yi L > > --- > > drivers/vfio/vfio_iommu_type1.c | 28 ++++++++++++++++++++++++++++ > > include/uapi/linux/vfio.h | 8 ++++++++ > > 2 files changed, 36 insertions(+) > > > > diff --git a/drivers/vfio/vfio_iommu_type1.c > > b/drivers/vfio/vfio_iommu_type1.c index e40afc0..ddd1ffe 100644 > > --- a/drivers/vfio/vfio_iommu_type1.c > > +++ b/drivers/vfio/vfio_iommu_type1.c > > @@ -2234,6 +2234,30 @@ static int vfio_iommu_type1_pasid_free(struct > > vfio_iommu *iommu, > > return ret; > > } > > > > +static int vfio_iommu_info_add_nesting_cap(struct vfio_iommu *iommu, > > + struct vfio_info_cap *caps) > > +{ > > + struct vfio_info_cap_header *header; > > + struct vfio_iommu_type1_info_cap_nesting *nesting_cap; > > + > > + header = vfio_info_cap_add(caps, sizeof(*nesting_cap), > > + VFIO_IOMMU_TYPE1_INFO_CAP_NESTING, > > 1); > > + if (IS_ERR(header)) > > + return PTR_ERR(header); > > + > > + nesting_cap = container_of(header, > > + struct vfio_iommu_type1_info_cap_nesting, > > + header); > > + > > + nesting_cap->nesting_capabilities = 0; > > + if (iommu->nesting) { > > Is it good to report a nesting cap when iommu->nesting is disabled? I suppose the > check should move before vfio_info_cap_add... oops, yes it. > > > + /* nesting iommu type supports PASID requests (alloc/free) > > */ > > + nesting_cap->nesting_capabilities |= > > VFIO_IOMMU_PASID_REQS; > > VFIO_IOMMU_CAP_PASID_REQ? to avoid confusion with ioctl cmd > VFIO_IOMMU_PASID_REQUEST... got it. Thanks, Yi Liu