From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E2C2C2BA15 for ; Fri, 3 Apr 2020 08:17:55 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1583920721 for ; Fri, 3 Apr 2020 08:17:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1583920721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C437A8693C; Fri, 3 Apr 2020 08:17:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kPUW7VupqFvE; Fri, 3 Apr 2020 08:17:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id C2AB38666D; Fri, 3 Apr 2020 08:17:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B9BE1C1AE2; Fri, 3 Apr 2020 08:17:53 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D11DC07FF for ; Fri, 3 Apr 2020 08:17:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5A13822268 for ; Fri, 3 Apr 2020 08:17:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xugCDi4coJT6 for ; Fri, 3 Apr 2020 08:17:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by silver.osuosl.org (Postfix) with ESMTPS id D2CB02050F for ; Fri, 3 Apr 2020 08:17:50 +0000 (UTC) IronPort-SDR: +RtD8xMPAaekFqPXpiK5QnVw1nJZ24GUroyvqxISPLfBt32bRlAOBGgk/G9qrH8g5cauff06CT 2g5rx1fc8OOw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2020 01:17:50 -0700 IronPort-SDR: G6b6slSIE/t2d13pNmA/tIbwsDvao3N24PZCcZsdrf55GWQvM/6MbJhOv+kyDytmBX+dj+aTqQ bqYzx7NKrBRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,339,1580803200"; d="scan'208";a="268289774" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2020 01:17:49 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 01:17:49 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 01:17:49 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.225]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.191]) with mapi id 14.03.0439.000; Fri, 3 Apr 2020 16:17:45 +0800 From: "Liu, Yi L" To: Alex Williamson 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: AQHWAEUdmZ6qeWVhq0GPreoHiPHgtahlqq4AgAF03/A= Date: Fri, 3 Apr 2020 08:17:44 +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> <20200402120100.19e43c72@w520.home> In-Reply-To: <20200402120100.19e43c72@w520.home> 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] MIME-Version: 1.0 Cc: "jean-philippe@linaro.org" , "Tian, Kevin" , "Raj, Ashok" , "kvm@vger.kernel.org" , "Tian, Jun J" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "Sun, Yi Y" , "Wu, Hao" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" > From: Alex Williamson < alex.williamson@redhat.com > > Sent: Friday, April 3, 2020 2:01 AM > To: Liu, Yi L > Subject: Re: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to > userspace > > On Sun, 22 Mar 2020 05:32:00 -0700 > "Liu, Yi L" wrote: > > > 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) { > > + /* nesting iommu type supports PASID requests (alloc/free) */ > > + nesting_cap->nesting_capabilities |= VFIO_IOMMU_PASID_REQS; > > + } > > + > > + return 0; > > +} > > + > > static long vfio_iommu_type1_ioctl(void *iommu_data, > > unsigned int cmd, unsigned long arg) { @@ - > 2283,6 +2307,10 @@ > > static long vfio_iommu_type1_ioctl(void *iommu_data, > > if (ret) > > return ret; > > > > + ret = vfio_iommu_info_add_nesting_cap(iommu, &caps); > > + if (ret) > > + return ret; > > + > > if (caps.size) { > > info.flags |= VFIO_IOMMU_INFO_CAPS; > > > > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > > index 298ac80..8837219 100644 > > --- a/include/uapi/linux/vfio.h > > +++ b/include/uapi/linux/vfio.h > > @@ -748,6 +748,14 @@ struct vfio_iommu_type1_info_cap_iova_range { > > struct vfio_iova_range iova_ranges[]; > > }; > > > > +#define VFIO_IOMMU_TYPE1_INFO_CAP_NESTING 2 > > + > > +struct vfio_iommu_type1_info_cap_nesting { > > + struct vfio_info_cap_header header; > > +#define VFIO_IOMMU_PASID_REQS (1 << 0) > > + __u32 nesting_capabilities; > > +}; > > + > > #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) > > > > /** > > I think this answers my PROBE question on patch 1/. yep. > Should the quota/usage be exposed to the user here? Thanks, Do you mean report the quota available for this user in this cap info as well? For usage, do you mean the alloc and free or others? Regards, Yi Liu _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu