From patchwork Tue Oct 5 20:35:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 66862 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 59A6BB70B8 for ; Wed, 6 Oct 2010 07:43:02 +1100 (EST) Received: from localhost ([127.0.0.1]:52357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3ELj-0004LG-6E for incoming@patchwork.ozlabs.org; Tue, 05 Oct 2010 16:42:59 -0400 Received: from [140.186.70.92] (port=59842 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3EEj-00010f-7X for qemu-devel@nongnu.org; Tue, 05 Oct 2010 16:35:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3EEh-00075l-VG for qemu-devel@nongnu.org; Tue, 05 Oct 2010 16:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3EEh-00075h-Kq for qemu-devel@nongnu.org; Tue, 05 Oct 2010 16:35:43 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o95KZeOh002332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Oct 2010 16:35:41 -0400 Received: from s20.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o95KZeKJ000871; Tue, 5 Oct 2010 16:35:40 -0400 From: Alex Williamson To: qemu-devel@nongnu.org Date: Tue, 05 Oct 2010 14:35:39 -0600 Message-ID: <20101005203539.12739.62009.stgit@s20.home> In-Reply-To: <20101005202556.12739.14080.stgit@s20.home> References: <20101005202556.12739.14080.stgit@s20.home> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: alex.williamson@redhat.com, cam@cs.ualberta.ca, quintela@redhat.com Subject: [Qemu-devel] [RFC PATCH 2/5] savevm: Remove register_device_unmigratable() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that the save state handler can return error, this is redundant. Update the only user to return error from their save handler. Signed-off-by: Alex Williamson --- hw/hw.h | 2 -- hw/ivshmem.c | 9 +++++---- savevm.c | 31 ------------------------------- 3 files changed, 5 insertions(+), 37 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index b6f1236..5209ed9 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -264,8 +264,6 @@ int register_savevm_live(DeviceState *dev, void *opaque); void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque); -void register_device_unmigratable(DeviceState *dev, const char *idstr, - void *opaque); typedef void QEMUResetHandler(void *opaque); diff --git a/hw/ivshmem.c b/hw/ivshmem.c index 0919c4e..f0cfed5 100644 --- a/hw/ivshmem.c +++ b/hw/ivshmem.c @@ -621,6 +621,11 @@ static int ivshmem_save(QEMUFile* f, void *opaque) IVShmemState *proxy = opaque; IVSHMEM_DPRINTF("ivshmem_save\n"); + + if (proxy->role_val == IVSHMEM_PEER) { + return -EINVAL; + } + pci_device_save(&proxy->dev, f); if (ivshmem_has_feature(proxy, IVSHMEM_MSI)) { @@ -702,10 +707,6 @@ static int pci_ivshmem_init(PCIDevice *dev) s->role_val = IVSHMEM_MASTER; /* default */ } - if (s->role_val == IVSHMEM_PEER) { - register_device_unmigratable(&s->dev.qdev, "ivshmem", s); - } - pci_conf = s->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REDHAT_QUMRANET); pci_conf[0x02] = 0x10; diff --git a/savevm.c b/savevm.c index f8a7819..7ca27f6 100644 --- a/savevm.c +++ b/savevm.c @@ -1018,7 +1018,6 @@ typedef struct SaveStateEntry { const VMStateDescription *vmsd; void *opaque; CompatEntry *compat; - int no_migrate; } SaveStateEntry; @@ -1082,7 +1081,6 @@ int register_savevm_live(DeviceState *dev, se->load_state = load_state; se->opaque = opaque; se->vmsd = NULL; - se->no_migrate = 0; if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *id = dev->parent_bus->info->get_dev_path(dev); @@ -1149,31 +1147,6 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) } } -/* mark a device as not to be migrated, that is the device should be - unplugged before migration */ -void register_device_unmigratable(DeviceState *dev, const char *idstr, - void *opaque) -{ - SaveStateEntry *se; - char id[256] = ""; - - if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { - char *path = dev->parent_bus->info->get_dev_path(dev); - if (path) { - pstrcpy(id, sizeof(id), path); - pstrcat(id, sizeof(id), "/"); - qemu_free(path); - } - } - pstrcat(id, sizeof(id), idstr); - - QTAILQ_FOREACH(se, &savevm_handlers, entry) { - if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { - se->no_migrate = 1; - } - } -} - int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, const VMStateDescription *vmsd, void *opaque, int alias_id, @@ -1382,10 +1355,6 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se, int version_id) static int vmstate_save(QEMUFile *f, SaveStateEntry *se) { - if (se->no_migrate) { - return -1; - } - if (!se->vmsd) { /* Old style */ return se->save_state(f, se->opaque); }