Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1556495ybi; Wed, 3 Jul 2019 18:38:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsjeALmV+gA1lUZc7fGuaENimKPsQ5WcBhMNhZ2G169HYfNYsHofCpCmB7CuYZ41N0Hbnw X-Received: by 2002:a63:6a81:: with SMTP id f123mr18988193pgc.348.1562204321514; Wed, 03 Jul 2019 18:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562204321; cv=none; d=google.com; s=arc-20160816; b=zzUqZqs5lRjdQerTs7MlRiCfiNcN/u5KFeuI7u/MwlA3zzEXbq4ofk4hqqhY6jzN6l XaGv1wk2nPcrRQeby5YpaKTFYkrf5Vom2EqPV/9XRWGShcIYmoJlznaW3OECQdPHLOnV UFlptPl/kGcKd/hljUBA8c5HrRQj8AW9ciZifPHQiBCLSPIftL3W25ljlM/PhRBhfC6p Z0eeQAUNabYfiJI6Vy05ECmKs3KLGqYy3gUftZu2C3rUFpAxHaREvcJKLORvhLv/HG9X L43CezPlDnlG2Ums6t8O+DniuvtV5lBHJL6zAhDbS445Ebqz6I2AWHA7yx+05nJC64Es T14Q== 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; bh=SIL5Y/WGRxn5GPGKCqlnjJ9WMcRog446u+uIrQRjxgY=; b=dqNT3rmME4UwUu2zKZ3HudBQC+ue81In8qipnwV9b8s/xKQl3jnvF+sG8Wye1Vk064 I4SgRz5Oc93zpqK0BCkgCgLN7b8XnktIQ3dCzJ8mzJ41oi9ua8LFuZr79/ye0h+MGAls Zyb48PXS1WOapn7DvZXUGj7xwtU2gqQzehl7qjJL34iJFw9VflIgWY0gNT6e8mctwTDB T6Nre0ozYl3aY4oe1DG//y36ji6s7o1X10dJ6hhK76g7byToIgHk9kIlTJmAaFGVy5mA wNP2JORIxppAyJi3mg42aDuwm+AspYF8b4v7sMjySwSGEjyVY5b3wQd4OQwamPuNCrYi Q/Nw== 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 k193si3878909pgc.473.2019.07.03.18.38.25; Wed, 03 Jul 2019 18:38:41 -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 S1727203AbfGDBiD (ORCPT + 99 others); Wed, 3 Jul 2019 21:38:03 -0400 Received: from mga14.intel.com ([192.55.52.115]:20681 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbfGDBiD (ORCPT ); Wed, 3 Jul 2019 21:38:03 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 18:38:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,449,1557212400"; d="scan'208";a="169312757" Received: from npg-dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.151]) by orsmga006.jf.intel.com with ESMTP; 03 Jul 2019 18:38:00 -0700 Date: Thu, 4 Jul 2019 09:36:36 +0800 From: Tiwei Bie To: Alex Williamson 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: <20190704013636.GA26992@___> References: <20190703091339.1847-1-tiwei.bie@intel.com> <20190703123157.2452bf95@x1.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190703123157.2452bf95@x1.home> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 03, 2019 at 12:31:57PM -0600, Alex Williamson wrote: > 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, Thanks for the details! Will give it a try! Thanks, Tiwei