From nobody Tue Feb 10 04:03:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=nvidia.com ARC-Seal: i=1; a=rsa-sha256; t=1562645599; cv=none; d=zoho.com; s=zohoarc; b=WTf1Kdep0Vpp0TZYl5eZsgnnq2ya4b/I4Th5vu2rmh++BgAz8TPxgy+QQaLASqSt0CLmBwuaSbSp93VyaDUnc1Wjbs3pn/EN+tEwEGh/2vA+xFe8+gZj0LeceWHn7Li8R0sI0uOl4x0u1faT0NNCMnLCLZ2EfBseW/sNUVY862g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562645599; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=oDXfXH2QKaDnSbDGeApTn7hYtedGL0xz2YwbKpIZ7YQ=; b=NgTSP8eMaYSX3zdspwDQOU7aSrxEdNUOwIyeejNI+uPTwwr8sMI6lz2WOh8nA8/AyjFlomB9fzboiMWFTL7tPcOxA/OgU3KHACaHgg1yybLk9wQyk5bJri5CdbCbApglW3PWO+Y8Lr7Mx7gVK2nS9u0gTywEFa1Bc82iCGIRCJQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1562645599662910.5039000015187; Mon, 8 Jul 2019 21:13:19 -0700 (PDT) Received: from localhost ([::1]:46554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkhVG-0007ld-Ji for importer@patchew.org; Tue, 09 Jul 2019 00:13:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35026) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkhQn-0002Vu-My for qemu-devel@nongnu.org; Tue, 09 Jul 2019 00:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkhQk-0003Pm-P1 for qemu-devel@nongnu.org; Tue, 09 Jul 2019 00:08:39 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:11839) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hkhQk-0003Op-6V for qemu-devel@nongnu.org; Tue, 09 Jul 2019 00:08:38 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 08 Jul 2019 21:08:09 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 08 Jul 2019 21:08:10 -0700 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 9 Jul 2019 02:03:13 +0000 Received: from kwankhede-dev.nvidia.com (10.124.1.5) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 9 Jul 2019 02:03:06 +0000 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 08 Jul 2019 21:08:10 -0700 From: Kirti Wankhede To: , Date: Tue, 9 Jul 2019 07:29:14 +0530 Message-ID: <1562637554-22439-14-git-send-email-kwankhede@nvidia.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1562637554-22439-1-git-send-email-kwankhede@nvidia.com> References: <1562637554-22439-1-git-send-email-kwankhede@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1562645296; bh=oDXfXH2QKaDnSbDGeApTn7hYtedGL0xz2YwbKpIZ7YQ=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=Hnrrjp0wk6SdJX/6NHmxeiN13Cby44HgAKY6a+IMh6Z+aAC8d5PFtVCwoymLtMYks iTz0MervqLRW3kooXvy7h9qgxt+FvGlofQRLxkyBqNg91P8uqGKNC6YVefQN5w7HDB LMJ8juz6D6QkaJCUtca6JN2F++KZEIGUnf5i+kno/L8yB20ctmHsuP5OORArtcKpF6 5zDnEmlCwMwFBIJEnpia+2T6agJBJelIJCALXVFxZpPdBEE38p0m7nrHXamIIQN+cY puSjkJHvCoKSxH+ISq1nUbgpPaBNxDbUTQjkx0x7oWQY2PI5IdXXUtmQohzw6TvIDQ GOKYlZYq6Eseg== X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 216.228.121.65 Subject: [Qemu-devel] [PATCH v6 13/13] vfio: Make vfio-pci device migration capable. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhengxiao.zx@Alibaba-inc.com, kevin.tian@intel.com, yi.l.liu@intel.com, yan.y.zhao@intel.com, eskultet@redhat.com, ziye.yang@intel.com, qemu-devel@nongnu.org, cohuck@redhat.com, shuangtai.tst@alibaba-inc.com, dgilbert@redhat.com, zhi.a.wang@intel.com, mlevitsk@redhat.com, pasic@linux.ibm.com, aik@ozlabs.ru, Kirti Wankhede , eauger@redhat.com, felipe@nutanix.com, jonathan.davies@nutanix.com, changpeng.liu@intel.com, Ken.Xue@amd.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Call vfio_migration_probe() and vfio_migration_finalize() functions for vfio-pci device to enable migration for vfio PCI device. Removed vfio_pci_vmstate structure. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 5fe4f8076cac..2ea17a814d55 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2852,6 +2852,7 @@ static void vfio_realize(PCIDevice *pdev, Error **err= p) vdev->vbasedev.ops =3D &vfio_pci_ops; vdev->vbasedev.type =3D VFIO_DEVICE_TYPE_PCI; vdev->vbasedev.dev =3D DEVICE(vdev); + vdev->vbasedev.device_state =3D 0; =20 tmp =3D g_strdup_printf("%s/iommu_group", vdev->vbasedev.sysfsdev); len =3D readlink(tmp, group_path, sizeof(group_path)); @@ -3112,6 +3113,12 @@ static void vfio_realize(PCIDevice *pdev, Error **er= rp) } } =20 + ret =3D vfio_migration_probe(&vdev->vbasedev, errp); + if (ret) { + error_report("%s: Failed to setup for migration", + vdev->vbasedev.name); + } + vfio_register_err_notifier(vdev); vfio_register_req_notifier(vdev); vfio_setup_resetfn_quirk(vdev); @@ -3131,6 +3138,7 @@ static void vfio_instance_finalize(Object *obj) VFIOPCIDevice *vdev =3D PCI_VFIO(obj); VFIOGroup *group =3D vdev->vbasedev.group; =20 + vdev->vbasedev.device_state =3D 0; vfio_display_finalize(vdev); vfio_bars_finalize(vdev); g_free(vdev->emulated_config_bits); @@ -3159,6 +3167,7 @@ static void vfio_exitfn(PCIDevice *pdev) } vfio_teardown_msi(vdev); vfio_bars_exit(vdev); + vfio_migration_finalize(&vdev->vbasedev); } =20 static void vfio_pci_reset(DeviceState *dev) @@ -3267,11 +3276,6 @@ static Property vfio_pci_dev_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 -static const VMStateDescription vfio_pci_vmstate =3D { - .name =3D "vfio-pci", - .unmigratable =3D 1, -}; - static void vfio_pci_dev_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -3279,7 +3283,6 @@ static void vfio_pci_dev_class_init(ObjectClass *klas= s, void *data) =20 dc->reset =3D vfio_pci_reset; dc->props =3D vfio_pci_dev_properties; - dc->vmsd =3D &vfio_pci_vmstate; dc->desc =3D "VFIO-based PCI device assignment"; set_bit(DEVICE_CATEGORY_MISC, dc->categories); pdc->realize =3D vfio_realize; --=20 2.7.0