From patchwork Tue Aug 16 08:14:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jike Song X-Patchwork-Id: 659524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sD54p56pkz9t2M for ; Tue, 16 Aug 2016 18:24:42 +1000 (AEST) Received: from localhost ([::1]:40717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZZfs-0008Nl-O0 for incoming@patchwork.ozlabs.org; Tue, 16 Aug 2016 04:24:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZZY9-0002Qn-Sq for qemu-devel@nongnu.org; Tue, 16 Aug 2016 04:16:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZZY3-0005Hf-KH for qemu-devel@nongnu.org; Tue, 16 Aug 2016 04:16:40 -0400 Received: from mga02.intel.com ([134.134.136.20]:7144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZZY3-0005HV-EG for qemu-devel@nongnu.org; Tue, 16 Aug 2016 04:16:35 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 16 Aug 2016 01:16:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,529,1464678000"; d="scan'208"; a="1026170529" Received: from kvmgt1.bj.intel.com ([10.238.154.158]) by fmsmga001.fm.intel.com with ESMTP; 16 Aug 2016 01:16:21 -0700 From: Jike Song To: alex.williamson@redhat.com, kwankhede@nvidia.com, cjia@nvidia.com Date: Tue, 16 Aug 2016 16:14:15 +0800 Message-Id: <1471335257-6226-4-git-send-email-jike.song@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471335257-6226-1-git-send-email-jike.song@intel.com> References: <1471335257-6226-1-git-send-email-jike.song@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.20 Subject: [Qemu-devel] [RFC v6-based v1 3/5] mdev: remove uuid from parent_ops X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevin.tian@intel.com, guangrong.xiao@linux.intel.com, kvm@vger.kernel.org, qemu-devel@nongnu.org, zhenyuw@linux.intel.com, jike.song@intel.com, kraxel@redhat.com, pbonzini@redhat.com, bjsdjshi@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" mdev should be able to start/stop separately, not relying on grouping in a VM. And even if grouping start/stop needed, it's always easy for userspace to find out all mdevs belonging to a particular VM. Signed-off-by: Jike Song --- drivers/vfio/mdev/mdev_core.c | 4 ++-- include/linux/mdev.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c index a677db7..934dac9 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c @@ -396,9 +396,9 @@ int mdev_device_start(struct device *dev, bool start) struct parent_device *parent = dev_to_parent_dev(dev->parent); if (start && parent->ops->start) - ret = parent->ops->start(mdev->uuid); + ret = parent->ops->start(mdev); else if (!start && parent->ops->stop) - ret = parent->ops->stop(mdev->uuid); + ret = parent->ops->stop(mdev); if (ret) pr_err("mdev %s failed %d\n", start ? "start" : "stop", ret); diff --git a/include/linux/mdev.h b/include/linux/mdev.h index 8488b27..c06967d 100644 --- a/include/linux/mdev.h +++ b/include/linux/mdev.h @@ -79,10 +79,10 @@ struct mdev_device { * Returns integer: success (0) or error (< 0) * @start: Called to initiate mediated device initialization * process in parent device's driver before VMM starts. - * @uuid: UUID + * @mdev: mediated device structure * Returns integer: success (0) or error (< 0) * @stop: Called to teardown mediated device related resources - * @uuid: UUID + * @mdev: mediated device structure * Returns integer: success (0) or error (< 0) * @read: Read emulation callback * @mdev: mediated device structure @@ -134,8 +134,8 @@ struct parent_ops { int (*create)(struct mdev_device *mdev, char *mdev_params); int (*destroy)(struct mdev_device *mdev); int (*reset)(struct mdev_device *mdev); - int (*start)(uuid_le uuid); - int (*stop)(uuid_le uuid); + int (*start)(struct mdev_device *mdev); + int (*stop)(struct mdev_device *mdev); ssize_t (*read)(struct mdev_device *mdev, char *buf, size_t count, loff_t pos); ssize_t (*write)(struct mdev_device *mdev, char *buf, size_t count,