Received: from eggs.gnu.org ([2001:4830:134:3::10]:58050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmhuM-0006q5-6Q for qemu-devel@nongnu.org; Thu, 15 Oct 2015 08:45:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmhuI-0000X4-VQ for qemu-devel@nongnu.org; Thu, 15 Oct 2015 08:45:22 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:49065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmhuI-0000Wx-P8 for qemu-devel@nongnu.org; Thu, 15 Oct 2015 08:45:18 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NW900KTZI3F5MA0@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Thu, 15 Oct 2015 13:45:15 +0100 (BST) From: Pavel Fedin Date: Thu, 15 Oct 2015 15:45:14 +0300 Message-id: <010601d10747$569ae800$03d0b800$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Content-language: ru Subject: [Qemu-devel] [PATCH] arm_gic_kvm: Disable live migration if not supported List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: 'Peter Maydell' Currently, if the kernel does not have live migration API, the migration will still be attempted, but vGIC save/restore functions will just not do anything. This will result in a broken machine state. This patch fixes the problem by patching vmstate_gic.unmigratable flag in runtine. Signed-off-by: Pavel Fedin --- hw/intc/arm_gic_common.c | 2 +- hw/intc/arm_gic_kvm.c | 17 ++++++----------- hw/intc/gic_internal.h | 2 ++ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 2b08175..1af4590 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -60,7 +60,7 @@ static const VMStateDescription vmstate_gic_irq_state = { } }; -static const VMStateDescription vmstate_gic = { +VMStateDescription vmstate_gic = { .name = "arm_gic", .version_id = 12, .minimum_version_id = 12, diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c index e8b2386..ad63081 100644 --- a/hw/intc/arm_gic_kvm.c +++ b/hw/intc/arm_gic_kvm.c @@ -307,11 +307,6 @@ static void kvm_arm_gic_put(GICState *s) int num_cpu; int num_irq; - if (!kvm_arm_gic_can_save_restore(s)) { - DPRINTF("Cannot put kernel gic state, no kernel interface"); - return; - } - /* Note: We do the restore in a slightly different order than the save * (where the order doesn't matter and is simply ordered according to the * register offset values */ @@ -411,11 +406,6 @@ static void kvm_arm_gic_get(GICState *s) int i; int cpu; - if (!kvm_arm_gic_can_save_restore(s)) { - DPRINTF("Cannot get kernel gic state, no kernel interface"); - return; - } - /***************************************************************** * Distributor State */ @@ -503,7 +493,10 @@ static void kvm_arm_gic_reset(DeviceState *dev) KVMARMGICClass *kgc = KVM_ARM_GIC_GET_CLASS(s); kgc->parent_reset(dev); - kvm_arm_gic_put(s); + + if (kvm_arm_gic_can_save_restore(s)) { + kvm_arm_gic_put(s); + } } static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) @@ -573,6 +566,8 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) KVM_DEV_ARM_VGIC_GRP_ADDR, KVM_VGIC_V2_ADDR_TYPE_CPU, s->dev_fd); + + vmstate_gic.unmigratable = !kvm_arm_gic_can_save_restore(s); } static void kvm_arm_gic_class_init(ObjectClass *klass, void *data) diff --git a/hw/intc/gic_internal.h b/hw/intc/gic_internal.h index 20c1e8a..e846f1b 100644 --- a/hw/intc/gic_internal.h +++ b/hw/intc/gic_internal.h @@ -77,6 +77,8 @@ #define REV_11MPCORE 0 #define REV_NVIC 0xffffffff +extern VMStateDescription vmstate_gic; + void gic_set_pending_private(GICState *s, int cpu, int irq); uint32_t gic_acknowledge_irq(GICState *s, int cpu, MemTxAttrs attrs); void gic_complete_irq(GICState *s, int cpu, int irq, MemTxAttrs attrs); -- 1.9.5.msysgit.0