From nobody Sat Nov 15 14:11:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1595406647; cv=none; d=zohomail.com; s=zohoarc; b=b/PQi6iIUylR+BDO3DkQLt45qMwyhFZJKLtGmkDrjuDnCBkwOc9aMXa2SPiCP51ZhTJl7/i01ALhRB/sBVjx6zaZYEI9Pc5oSygYUkkreDxbfn9uJBxAclyrC1C3F9Y4rTzc1q/d7/A2bArGoiQwJr687sFIy/6blG8/PFfD6Ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595406647; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=iLLmeaxyfbf+M5PGMBBfGUDROD57KSQpXgin2QnyVtw=; b=TnOe7OcwJ18DwpbUnUdeX+vn/xN/iVQQ89h0PRC5w/6QhCnqnyPt++u9kOPxCQtlmvuUOseCC0Y4lsi5s2BJeYdiYl3olPHnoRt7XHX+4aW1gZF95eVMpbIyBk5zdJoQNFqdh8FSmpCszPwGzaH6+QiN3WHanfc/WzESwtYTNPU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.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 1595406647586839.3403756192857; Wed, 22 Jul 2020 01:30:47 -0700 (PDT) Received: from localhost ([::1]:60462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyA9F-0007gu-Tf for importer@patchew.org; Wed, 22 Jul 2020 04:30:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyA8c-0007E1-M6 for qemu-devel@nongnu.org; Wed, 22 Jul 2020 04:30:06 -0400 Received: from mga04.intel.com ([192.55.52.120]:9930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyA8Z-00077X-TH for qemu-devel@nongnu.org; Wed, 22 Jul 2020 04:30:06 -0400 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 01:29:55 -0700 Received: from arthur-vostro-3668.sh.intel.com ([10.239.159.135]) by orsmga004.jf.intel.com with ESMTP; 22 Jul 2020 01:29:53 -0700 IronPort-SDR: p+KtaBWFkbrG0LJbggPHhHpbE8jstNLDgWbHJiuB0L6sc9mZ1YPGC+CkqTrbzFdjqnqw/aysk6 wnPdtZkImz8A== X-IronPort-AV: E=McAfee;i="6000,8403,9689"; a="147787773" X-IronPort-AV: E=Sophos;i="5.75,381,1589266800"; d="scan'208";a="147787773" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False IronPort-SDR: Ak6twXAZcc2jqrZXb6mPeQm8Y/5BDhVbXw2OzjgxMUP14iHblMYpp6IijVGrMHSX9r3cBaW9DK 9D8XbTHMUBqw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,381,1589266800"; d="scan'208";a="432302549" From: Zeng Guang To: jslaby@suse.cz, david@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org Subject: [PATCH] hw/misc/edu: support pci device state migration Date: Wed, 22 Jul 2020 16:13:23 +0800 Message-Id: <20200722081323.9893-1-guang.zeng@intel.com> X-Mailer: git-send-email 2.17.1 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=192.55.52.120; envelope-from=guang.zeng@intel.com; helo=mga04.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 04:29:56 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Zeng Guang , wei.w.wang@intel.com, chao.gao@intel.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently edu device doesn't support live migration. Part of PCI configuration information would be lost after migration. PCI device state in source VM: Bus 0, device 3, function 0: Class 0255: PCI device 1234:11e8 PCI subsystem 1af4:1100 IRQ 11, pin A BAR0: 32 bit memory at 0xfea00000 [0xfeafffff]. id "" PCI device state in destination VM: Bus 0, device 3, function 0: Class 0255: PCI device 1234:11e8 PCI subsystem 1af4:1100 IRQ 0, pin A BAR0: 32 bit memory at 0xffffffffffffffff [0x000ffffe]. id "" Add VMState for edu device to support migration. Signed-off-by: Gao Chao Signed-off-by: Zeng Guang Reviewed-by: Wei Wang --- hw/misc/edu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/misc/edu.c b/hw/misc/edu.c index ec617e63f3..3ff2759ee1 100644 --- a/hw/misc/edu.c +++ b/hw/misc/edu.c @@ -27,6 +27,7 @@ #include "hw/pci/pci.h" #include "hw/hw.h" #include "hw/pci/msi.h" +#include "migration/vmstate.h" #include "qemu/timer.h" #include "qemu/main-loop.h" /* iothread mutex */ #include "qemu/module.h" @@ -405,6 +406,16 @@ static void edu_instance_init(Object *obj) &edu->dma_mask, OBJ_PROP_FLAG_READWRITE= ); } =20 +static const VMStateDescription vmstate_edu =3D { + .name =3D "edu", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_PCI_DEVICE(pdev, EduState), + VMSTATE_END_OF_LIST() + } +}; + static void edu_class_init(ObjectClass *class, void *data) { DeviceClass *dc =3D DEVICE_CLASS(class); @@ -415,6 +426,7 @@ static void edu_class_init(ObjectClass *class, void *da= ta) k->vendor_id =3D PCI_VENDOR_ID_QEMU; k->device_id =3D 0x11e8; k->revision =3D 0x10; + dc->vmsd =3D &vmstate_edu; k->class_id =3D PCI_CLASS_OTHERS; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } --=20 2.17.1