From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2 2/5] net/virtio: add interrupt configure for vdev Date: Wed, 29 Mar 2017 15:30:26 +0800 Message-ID: <20170329073026.GI18844@yliu-dev.sh.intel.com> References: <1488563803-87754-1-git-send-email-jianfeng.tan@intel.com> <1490689316-131625-1-git-send-email-jianfeng.tan@intel.com> <1490689316-131625-3-git-send-email-jianfeng.tan@intel.com> <20170329062706.GD18844@yliu-dev.sh.intel.com> <20170329070906.GG18844@yliu-dev.sh.intel.com> <88908890-f115-9f6c-d242-d6bf9d9ba292@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, david.marchand@6wind.com, maxime.coquelin@redhat.com To: "Tan, Jianfeng" Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 1F71E1396 for ; Wed, 29 Mar 2017 09:32:42 +0200 (CEST) Content-Disposition: inline In-Reply-To: <88908890-f115-9f6c-d242-d6bf9d9ba292@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Mar 29, 2017 at 03:27:28PM +0800, Tan, Jianfeng wrote: > > > On 3/29/2017 3:09 PM, Yuanhan Liu wrote: > >On Wed, Mar 29, 2017 at 03:03:16PM +0800, Tan, Jianfeng wrote: > >> > >>On 3/29/2017 2:27 PM, Yuanhan Liu wrote: > >>>On Tue, Mar 28, 2017 at 08:21:53AM +0000, Jianfeng Tan wrote: > >>>>For virtio PCI devices, interrupt should be configured before setting > >>>>VIRTIO_CONFIG_STATUS_DRIVER_OK so that QEMU can properly set eventfds > >>>>in the host. > >>>> > >>>>For virtio virtual devices, VIRTIO_CONFIG_STATUS_DRIVER_OK should be > >>>>set firstly, so that intr_handle is initialized in > >>>>virtio_user_start_device(). > >>>I'm wondering why can't you let virtio-user follow virtio-pci? > >>It's because that virtio-user not only counts on virtio_user_start_device() > >>to allocate intr_handle, it also needs the information in this function to > >>initialize this struct. For virtio-pci, similar information is from > >>rte_intr_enable/rte_intr_efd_enable. > >> > >>Or do you mean we can move calling virtio_user_start_device() ahead? I can > >>hardly find other place instead of DRIVER_OK. > >For example, virtio_user_dev_init()? > > > > > But in that way, there is only one chance to negotiate features with the > backend. What if we change the configuration through > rte_eth_dev_configure()? Then there will be a reset; everything should be reset properly in the device. --yliu > > Yes, we can just put callfd/kickfd creation and intr_handle initialization > into virtio_user_dev_init(), and its destructor into > virtio_user_dev_uninit(). It sounds like a feasible way to go. > > Thanks, > Jianfeng