From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jike Song Subject: Re: [PATCH 1/3] Mediated device Core driver Date: Thu, 30 Jun 2016 15:12:48 +0800 Message-ID: <5774C670.7080200@intel.com> References: <1466440308-4961-1-git-send-email-kwankhede@nvidia.com> <1466440308-4961-2-git-send-email-kwankhede@nvidia.com> <5773D24A.4060005@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: shuai.ruan@intel.com, kevin.tian@intel.com, cjia@nvidia.com, kvm@vger.kernel.org, alex.williamson@redhat.com, qemu-devel@nongnu.org, Kirti Wankhede , kraxel@redhat.com, pbonzini@redhat.com, bjsdjshi@linux.vnet.ibm.com, zhiyuan.lv@intel.com To: Xiao Guangrong Return-path: In-Reply-To: <5773D24A.4060005@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org On 06/29/2016 09:51 PM, Xiao Guangrong wrote: > On 06/21/2016 12:31 AM, Kirti Wankhede wrote: >> + mutex_unlock(&parent_devices.list_lock); >> + return parent; >> +} >> + >> +static int mdev_device_create_ops(struct mdev_device *mdev, char *mdev_params) >> +{ >> + struct parent_device *parent = mdev->parent; >> + int ret; >> + >> + mutex_lock(&parent->ops_lock); >> + if (parent->ops->create) { >> + ret = parent->ops->create(mdev->dev.parent, mdev->uuid, >> + mdev->instance, mdev_params); > > I think it is better if we pass @mdev to this callback, then the parent driver > can do its specified operations and associate it with the instance, > e.g, via mdev->private. > Just noticed that mdev->driver_data is missing in v5, I'd like to have it back :) Yes either mdev need to be passed to parent driver (preferred), or find_mdev_device to be exported for parent driver (less preferred, but at least functional). -- Thanks, Jike From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIWAn-0006ek-HA for qemu-devel@nongnu.org; Thu, 30 Jun 2016 03:14:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIWAi-0002yU-Gs for qemu-devel@nongnu.org; Thu, 30 Jun 2016 03:14:04 -0400 Received: from mga02.intel.com ([134.134.136.20]:28064) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIWAi-0002yP-B5 for qemu-devel@nongnu.org; Thu, 30 Jun 2016 03:14:00 -0400 Message-ID: <5774C670.7080200@intel.com> Date: Thu, 30 Jun 2016 15:12:48 +0800 From: Jike Song MIME-Version: 1.0 References: <1466440308-4961-1-git-send-email-kwankhede@nvidia.com> <1466440308-4961-2-git-send-email-kwankhede@nvidia.com> <5773D24A.4060005@linux.intel.com> In-Reply-To: <5773D24A.4060005@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] Mediated device Core driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xiao Guangrong Cc: Kirti Wankhede , alex.williamson@redhat.com, pbonzini@redhat.com, kraxel@redhat.com, cjia@nvidia.com, shuai.ruan@intel.com, kvm@vger.kernel.org, kevin.tian@intel.com, qemu-devel@nongnu.org, zhiyuan.lv@intel.com, bjsdjshi@linux.vnet.ibm.com On 06/29/2016 09:51 PM, Xiao Guangrong wrote: > On 06/21/2016 12:31 AM, Kirti Wankhede wrote: >> + mutex_unlock(&parent_devices.list_lock); >> + return parent; >> +} >> + >> +static int mdev_device_create_ops(struct mdev_device *mdev, char *mdev_params) >> +{ >> + struct parent_device *parent = mdev->parent; >> + int ret; >> + >> + mutex_lock(&parent->ops_lock); >> + if (parent->ops->create) { >> + ret = parent->ops->create(mdev->dev.parent, mdev->uuid, >> + mdev->instance, mdev_params); > > I think it is better if we pass @mdev to this callback, then the parent driver > can do its specified operations and associate it with the instance, > e.g, via mdev->private. > Just noticed that mdev->driver_data is missing in v5, I'd like to have it back :) Yes either mdev need to be passed to parent driver (preferred), or find_mdev_device to be exported for parent driver (less preferred, but at least functional). -- Thanks, Jike