Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1217078ybi; Wed, 3 Jul 2019 11:33:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyesgXTPYodO70A8hsZuJchfsX6OssF29wTr1hAmbV03Ies54Lo6ARkiwjqdJ4czw9PNJo8 X-Received: by 2002:a65:63cd:: with SMTP id n13mr38318798pgv.153.1562178807945; Wed, 03 Jul 2019 11:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562178807; cv=none; d=google.com; s=arc-20160816; b=cl7IrDf/0tDAmzRozCzsQkGbyrVHjR2LCHX7R/taHFGIaYx3QURBjl7+FlHJLqpn8N miatdgeey61b45J932mgbNG0tNDpUlo/TijV4aHLro/fUl+mmkIPCrtj87ByBXV+YD2Q v94Yp77ZJJBBH9e+aJQvn+ghUYjFTvm+8vLE5joN/uXoTkz8bIoccOO27DY265FtgzUp F3Du91KIH1D9lldTWGf2V8ZuVvOxTj5yOgE3MXa1n+vMlzB/VYURS0KO3K6rqqbahrgi 2N/cKNPzZhzrV0jpFzeFwCotoTsXfGgr9KoVOX0s8R3wK2uEzhXrYINzTbN4IuTpI7nN B/ZA== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=7XoEbzpPl6RexPGAL32gP4dGz4T88ePlZQDtVIEWdOU=; b=q21d+21I9yLLE8qeJ6CbIxyEy67/9SqEBEmb1sovkikSPzX2vBUbqlTQTGp6k45dfc KkIg33vgDakwJwqakdSQHeEqJX3Dn6nZdVTucBCzRNrj6e9rjx9qApkkuzGp2K62Tt/N j/FfHnJpdjry7EeqkzdxPuc131I6gfDdQsqHonxrZNuZepr1+X5zSEgx+apaiI9OzGpW jUAgms8rl2SVEgiZAvziHFlXEJZyK72+owtSeACuLu6/Iwy2Mcj50sDoYZRfRpRiDe2R VRl/rkR2r6rF4CPpC+Kt0Wo2d5xvlKy57eaUco5v7n6W5P+tT84DnLoWqy0bTR4s6cRf PCig== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bx21si2492034pjb.21.2019.07.03.11.33.13; Wed, 03 Jul 2019 11:33:27 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727263AbfGCScK (ORCPT + 99 others); Wed, 3 Jul 2019 14:32:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54056 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbfGCScK (ORCPT ); Wed, 3 Jul 2019 14:32:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5D31307D846; Wed, 3 Jul 2019 18:32:04 +0000 (UTC) Received: from x1.home (ovpn-116-83.phx2.redhat.com [10.3.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1818F83085; Wed, 3 Jul 2019 18:31:58 +0000 (UTC) Date: Wed, 3 Jul 2019 12:31:57 -0600 From: Alex Williamson To: Tiwei Bie Cc: mst@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, dan.daly@intel.com, cunming.liang@intel.com, zhihong.wang@intel.com Subject: Re: [RFC v2] vhost: introduce mdev based hardware vhost backend Message-ID: <20190703123157.2452bf95@x1.home> In-Reply-To: <20190703091339.1847-1-tiwei.bie@intel.com> References: <20190703091339.1847-1-tiwei.bie@intel.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 03 Jul 2019 18:32:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 3 Jul 2019 17:13:39 +0800 Tiwei Bie wrote: > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > index 8f10748dac79..6c5718ab7eeb 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -201,6 +201,7 @@ struct vfio_device_info { > #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */ > #define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */ > #define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */ > +#define VFIO_DEVICE_FLAGS_VHOST (1 << 6) /* vfio-vhost device */ > __u32 num_regions; /* Max region index + 1 */ > __u32 num_irqs; /* Max IRQ index + 1 */ > }; > @@ -217,6 +218,7 @@ struct vfio_device_info { > #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba" > #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw" > #define VFIO_DEVICE_API_AP_STRING "vfio-ap" > +#define VFIO_DEVICE_API_VHOST_STRING "vfio-vhost" > > /** > * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8, > @@ -573,6 +575,23 @@ enum { > VFIO_CCW_NUM_IRQS > }; > > +/* > + * The vfio-vhost bus driver makes use of the following fixed region and > + * IRQ index mapping. Unimplemented regions return a size of zero. > + * Unimplemented IRQ types return a count of zero. > + */ > + > +enum { > + VFIO_VHOST_CONFIG_REGION_INDEX, > + VFIO_VHOST_NOTIFY_REGION_INDEX, > + VFIO_VHOST_NUM_REGIONS > +}; > + > +enum { > + VFIO_VHOST_VQ_IRQ_INDEX, > + VFIO_VHOST_NUM_IRQS > +}; > + Note that the vfio API has evolved a bit since vfio-pci started this way, with fixed indexes for pre-defined region types. We now support device specific regions which can be identified by a capability within the REGION_INFO ioctl return data. This allows a bit more flexibility, at the cost of complexity, but the infrastructure already exists in kernel and QEMU to make it relatively easy. I think we'll have the same support for interrupts soon too. If you continue to pursue the vfio-vhost direction you might want to consider these before committing to fixed indexes. Thanks, Alex