Received: from eggs.gnu.org ([2001:4830:134:3::10]:60542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6YB7-0001Fo-3O for qemu-devel@nongnu.org; Wed, 09 Dec 2015 01:24:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6YB2-0004Ys-3j for qemu-devel@nongnu.org; Wed, 09 Dec 2015 01:24:41 -0500 Received: from mail-io0-x234.google.com ([2607:f8b0:4001:c06::234]:33364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6YB1-0004Yn-VP for qemu-devel@nongnu.org; Wed, 09 Dec 2015 01:24:36 -0500 Received: by iouu10 with SMTP id u10so50136714iou.0 for ; Tue, 08 Dec 2015 22:24:35 -0800 (PST) Received: from [10.150.137.167] ([128.135.100.115]) by smtp.gmail.com with ESMTPSA id i69sm2814285iod.27.2015.12.08.22.24.34 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 22:24:34 -0800 (PST) From: Huaicheng Li Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: Date: Wed, 9 Dec 2015 00:24:32 -0600 Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Subject: [Qemu-devel] Save IDEState data to files when VM shutdown List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi all, Please correct me if I=E2=80=99m wrong. I made some changes to IDE emulation (add some extra structures to = =E2=80=9Cstruct IDEState") and want to save these info to files when VM = shutdowns. So I can reload these info from files next time when VM = starts. According to my understanding, one IDEState structure is = corresponding to one disk for VM and all available drives are = probed/initialised by ide_init2() in hw/ide.c (I used qemu v0.11) during = VM startup. It seemed that IDEState structure are saved to QEMUFile = structure via pci_ide_save(), but I can only trace up to = register_savevm(), where pci_ide_save() is registered as a callback. I = can=E2=80=99t find where exactly this function starts execution or being = called. My questions are:=20 (1). Does QEMUFile structure represent a running VM instance, through = which I can access the IDE drive (struct IDEState) pointers ? (2). When does qemu execute pci_ide_save()?=20 (3). How does qemu handle VM shutdown? It seems ACPI event is sent to VM = so guest OS will shutdown in the way like real OS running on real = hardware. But how and where does qemu exactly handle this? I think I = need to add my codes here.=20 Any hints, suggestions would be appreciated. Thanks. Huaicheng Li=