yeahuh / rpms / qemu-kvm

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