cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
169b9a
From 9001bf38b596c0eb50daa52181ec6b4cf56cfb94 Mon Sep 17 00:00:00 2001
6e672b
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
169b9a
Date: Tue, 15 May 2018 11:56:31 +0200
169b9a
Subject: [PATCH 05/10] kvm/apic: fix 2.2->2.1 migration
6e672b
6e672b
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
6e672b
Message-id: <20180515115634.24469-3-dgilbert@redhat.com>
6e672b
Patchwork-id: 80269
6e672b
O-Subject: [RHEL-7.6 qemu-kvm PATCH v2 2/5] kvm/apic: fix 2.2->2.1 migration
169b9a
Bugzilla: 1577680
6e672b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
6e672b
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
6e672b
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
6e672b
6e672b
From: Paolo Bonzini <pbonzini@redhat.com>
6e672b
6e672b
The wait_for_sipi field is set back to 1 after an INIT, so it was not
6e672b
effective to reset it in kvm_apic_realize.  Introduce a reset callback
6e672b
and reset wait_for_sipi there.
6e672b
6e672b
Reported-by: Igor Mammedov <imammedo@redhat.com>
6e672b
Cc: qemu-stable@nongnu.org
6e672b
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
6e672b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6e672b
(cherry picked from commit 575a6f4082c45778b93032ef1e7fbea4467b3a2a)
6e672b
   We're adding this just to get the reset member; 1.5.3 doesn't
6e672b
   currently have the wait_for_sipi change in the kvm code.
6e672b
6e672b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
6e672b
---
6e672b
 hw/i386/kvm/apic.c              | 6 ++++++
6e672b
 hw/intc/apic_common.c           | 5 +++++
6e672b
 include/hw/i386/apic_internal.h | 1 +
6e672b
 3 files changed, 12 insertions(+)
6e672b
6e672b
diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c
6e672b
index 8f80425..6ead17c 100644
6e672b
--- a/hw/i386/kvm/apic.c
6e672b
+++ b/hw/i386/kvm/apic.c
6e672b
@@ -171,6 +171,11 @@ static const MemoryRegionOps kvm_apic_io_ops = {
6e672b
     .endianness = DEVICE_NATIVE_ENDIAN,
6e672b
 };
6e672b
 
6e672b
+static void kvm_apic_reset(APICCommonState *s)
6e672b
+{
6e672b
+    /* This function intentionally left blank, for now */
6e672b
+}
6e672b
+
6e672b
 static void kvm_apic_init(APICCommonState *s)
6e672b
 {
6e672b
     memory_region_init_io(&s->io_memory, &kvm_apic_io_ops, s, "kvm-apic-msi",
6e672b
@@ -186,6 +191,7 @@ static void kvm_apic_class_init(ObjectClass *klass, void *data)
6e672b
     APICCommonClass *k = APIC_COMMON_CLASS(klass);
6e672b
 
6e672b
     k->init = kvm_apic_init;
6e672b
+    k->reset = kvm_apic_reset;
6e672b
     k->set_base = kvm_apic_set_base;
6e672b
     k->set_tpr = kvm_apic_set_tpr;
6e672b
     k->get_tpr = kvm_apic_get_tpr;
6e672b
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
6e672b
index ff413de..fff9266 100644
6e672b
--- a/hw/intc/apic_common.c
6e672b
+++ b/hw/intc/apic_common.c
6e672b
@@ -173,6 +173,7 @@ bool apic_next_timer(APICCommonState *s, int64_t current_time)
6e672b
 void apic_init_reset(DeviceState *d)
6e672b
 {
6e672b
     APICCommonState *s = DO_UPCAST(APICCommonState, busdev.qdev, d);
6e672b
+    APICCommonClass *info = APIC_COMMON_GET_CLASS(s);
6e672b
     int i;
6e672b
 
6e672b
     if (!s) {
6e672b
@@ -201,6 +202,10 @@ void apic_init_reset(DeviceState *d)
6e672b
         qemu_del_timer(s->timer);
6e672b
     }
6e672b
     s->timer_expiry = -1;
6e672b
+
6e672b
+    if (info->reset) {
6e672b
+        info->reset(s);
6e672b
+    }
6e672b
 }
6e672b
 
6e672b
 void apic_designate_bsp(DeviceState *d)
6e672b
diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h
6e672b
index 1b0a7fb..a77da1c 100644
6e672b
--- a/include/hw/i386/apic_internal.h
6e672b
+++ b/include/hw/i386/apic_internal.h
6e672b
@@ -89,6 +89,7 @@ typedef struct APICCommonClass
6e672b
     void (*external_nmi)(APICCommonState *s);
6e672b
     void (*pre_save)(APICCommonState *s);
6e672b
     void (*post_load)(APICCommonState *s);
6e672b
+    void (*reset)(APICCommonState *s);
6e672b
 } APICCommonClass;
6e672b
 
6e672b
 struct APICCommonState {
6e672b
-- 
6e672b
1.8.3.1
6e672b