qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, mst@redhat.com,
	jasowang@redhat.com, quintela@redhat.com, dovgaluk@ispras.ru,
	kraxel@redhat.com, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH v8 3/9] apic: save apic_delivered flag
Date: Thu, 26 Jan 2017 15:34:29 +0300	[thread overview]
Message-ID: <20170126123429.5412.94368.stgit@PASHA-ISP> (raw)
In-Reply-To: <20170126123411.5412.44769.stgit@PASHA-ISP>

This patch implements saving/restoring of static apic_delivered variable.

v8: saving static variable only for one of the APICs

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 hw/intc/apic_common.c           |   37 +++++++++++++++++++++++++++++++++++++
 include/hw/i386/apic_internal.h |    2 ++
 2 files changed, 39 insertions(+)

diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index d78c885..edacb16 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -384,6 +384,29 @@ static bool apic_common_sipi_needed(void *opaque)
     return s->wait_for_sipi != 0;
 }
 
+static bool apic_irq_delivered_needed(void *opaque)
+{
+    static APICCommonState *first_apic;
+    APICCommonState *s = APIC_COMMON(opaque);
+    if (!first_apic) {
+        first_apic = s;
+    }
+    return s == first_apic;
+}
+
+static void apic_irq_delivered_pre_save(void *opaque)
+{
+    APICCommonState *s = APIC_COMMON(opaque);
+    s->apic_irq_delivered = apic_irq_delivered;
+}
+
+static int apic_irq_delivered_post_load(void *opaque, int version_id)
+{
+    APICCommonState *s = APIC_COMMON(opaque);
+    apic_irq_delivered = s->apic_irq_delivered;
+    return 0;
+}
+
 static const VMStateDescription vmstate_apic_common_sipi = {
     .name = "apic_sipi",
     .version_id = 1,
@@ -396,6 +419,19 @@ static const VMStateDescription vmstate_apic_common_sipi = {
     }
 };
 
+static const VMStateDescription vmstate_apic_irq_delivered = {
+    .name = "apic_irq_delivered",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = apic_irq_delivered_needed,
+    .pre_save = apic_irq_delivered_pre_save,
+    .post_load = apic_irq_delivered_post_load,
+    .fields = (VMStateField[]) {
+        VMSTATE_INT32(apic_irq_delivered, APICCommonState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static const VMStateDescription vmstate_apic_common = {
     .name = "apic",
     .version_id = 3,
@@ -430,6 +466,7 @@ static const VMStateDescription vmstate_apic_common = {
     },
     .subsections = (const VMStateDescription*[]) {
         &vmstate_apic_common_sipi,
+        &vmstate_apic_irq_delivered,
         NULL
     }
 };
diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h
index 1209eb4..20ad28c 100644
--- a/include/hw/i386/apic_internal.h
+++ b/include/hw/i386/apic_internal.h
@@ -189,6 +189,8 @@ struct APICCommonState {
     DeviceState *vapic;
     hwaddr vapic_paddr; /* note: persistence via kvmvapic */
     bool legacy_instance_id;
+
+    int apic_irq_delivered; /* for saving static variable */
 };
 
 typedef struct VAPICState {

  parent reply	other threads:[~2017-01-26 12:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 12:34 [Qemu-devel] [PATCH v8 0/9] replay additions Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 1/9] replay: exception replay fix Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 2/9] icount: exit cpu loop on expire Pavel Dovgalyuk
2017-01-26 13:02   ` Paolo Bonzini
2017-01-26 13:37     ` Pavel Dovgalyuk
2017-01-26 14:28       ` Paolo Bonzini
2017-01-26 14:32         ` Pavel Dovgalyuk
2017-01-26 14:44           ` Paolo Bonzini
2017-01-27  6:09             ` Pavel Dovgalyuk
2017-01-27 11:02               ` Paolo Bonzini
2017-01-26 12:34 ` Pavel Dovgalyuk [this message]
2017-01-26 12:49   ` [Qemu-devel] [PATCH v8 3/9] apic: save apic_delivered flag Paolo Bonzini
2017-01-26 13:03     ` Pavel Dovgalyuk
2017-01-26 13:06       ` Paolo Bonzini
2017-01-26 13:07         ` Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 4/9] integratorcp: adding vmstate for save/restore Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 5/9] block: implement bdrv_snapshot_goto for blkreplay Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 6/9] blkreplay: create temporary overlay for underlaying devices Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 7/9] replay: disable default snapshot for record/replay Pavel Dovgalyuk
2017-01-26 12:34 ` [Qemu-devel] [PATCH v8 8/9] audio: make audio poll timer deterministic Pavel Dovgalyuk
2017-01-26 12:35 ` [Qemu-devel] [PATCH v8 9/9] replay: add record/replay for audio passthrough Pavel Dovgalyuk
2017-01-26 13:05 ` [Qemu-devel] [PATCH v8 0/9] replay additions Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170126123429.5412.94368.stgit@PASHA-ISP \
    --to=pavel.dovgaluk@ispras.ru \
    --cc=dovgaluk@ispras.ru \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).